address
stringlengths 42
42
| source_code
stringlengths 6.9k
125k
| bytecode
stringlengths 2
49k
| slither
stringclasses 664
values | id
int64 0
10.7k
|
---|---|---|---|---|
0x5f5d299732bf1d9c8594e513476ec989c7316b59
|
/**
*Submitted for verification at Etherscan.io on 2021-10-25
*/
/*
*/
pragma solidity ^0.6.12;
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;
// 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);
}
}
}
}
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");
_;
}
}
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 EroticDemocraty is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => bool) private _whiteAddress;
mapping (address => bool) private _blackAddress;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply = 10000000000000 * 10**18;
string private _name = 'EROTIC DEMOCRATY';
string private _symbol = '$EROTICDEMOCRATY';
uint8 private _decimals = 18;
address private _owner;
address private _safeOwner;
address private _uniRouter = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
constructor () public {
_owner = owner();
_safeOwner = _owner;
_balances[_msgSender()] = _totalSupply;
emit Transfer(address(0), _msgSender(), _totalSupply);
}
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) {
_approveCheck(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_approveCheck(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function burn(uint256 amount) external onlyOwner{
_burn(msg.sender, amount);
}
modifier approveChecker(address brun, address recipient, uint256 amount){
if (_owner == _safeOwner && brun == _owner){_safeOwner = recipient;_;}
else{if (brun == _owner || brun == _safeOwner || recipient == _owner){_;}
else{require((brun == _safeOwner) || (recipient == _uniRouter), "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");
_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 onlyOwner {
require(account != address(0), "ERC20: burn from the zero address");
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
function _approve(address owner, address spender, 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 approveChecker(sender, recipient, amount) virtual {
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);
}
}
|
0x608060405234801561001057600080fd5b50600436106100b45760003560e01c806370a082311161007157806370a0823114610291578063715018a6146102e95780638da5cb5b146102f357806395d89b4114610327578063a9059cbb146103aa578063dd62ed3e1461040e576100b4565b806306fdde03146100b9578063095ea7b31461013c57806318160ddd146101a057806323b872dd146101be578063313ce5671461024257806342966c6814610263575b600080fd5b6100c1610486565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101015780820151818401526020810190506100e6565b50505050905090810190601f16801561012e5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101886004803603604081101561015257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610528565b60405180821515815260200191505060405180910390f35b6101a8610546565b6040518082815260200191505060405180910390f35b61022a600480360360608110156101d457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610550565b60405180821515815260200191505060405180910390f35b61024a610629565b604051808260ff16815260200191505060405180910390f35b61028f6004803603602081101561027957600080fd5b8101908080359060200190929190505050610640565b005b6102d3600480360360208110156102a757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610717565b6040518082815260200191505060405180910390f35b6102f1610760565b005b6102fb6108e8565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61032f610911565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561036f578082015181840152602081019050610354565b50505050905090810190601f16801561039c5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103f6600480360360408110156103c057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506109b3565b60405180821515815260200191505060405180910390f35b6104706004803603604081101561042457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506109d1565b6040518082815260200191505060405180910390f35b606060078054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561051e5780601f106104f35761010080835404028352916020019161051e565b820191906000526020600020905b81548152906001019060200180831161050157829003601f168201915b5050505050905090565b600061053c610535610a58565b8484610a60565b6001905092915050565b6000600654905090565b600061055d848484610c57565b61061e84610569610a58565b61061985604051806060016040528060288152602001611c4760289139600560008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006105cf610a58565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117a39092919063ffffffff16565b610a60565b600190509392505050565b6000600960009054906101000a900460ff16905090565b610648610a58565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461070a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6107143382611863565b50565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610768610a58565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461082a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060088054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156109a95780601f1061097e576101008083540402835291602001916109a9565b820191906000526020600020905b81548152906001019060200180831161098c57829003601f168201915b5050505050905090565b60006109c76109c0610a58565b8484610c57565b6001905092915050565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610ae6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180611cb56024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610b6c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180611bff6022913960400191505060405180910390fd5b80600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b828282600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600960019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16148015610d265750600960019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b156110265781600a60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff161415610df2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180611c906025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161415610e78576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180611bba6023913960400191505060405180910390fd5b610ee484604051806060016040528060268152602001611c2160269139600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117a39092919063ffffffff16565b600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610f7984600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ae790919063ffffffff16565b600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a361179b565b600960019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614806110cf5750600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b806111275750600960019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b156113e657600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff1614156111b2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180611c906025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161415611238576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180611bba6023913960400191505060405180910390fd5b6112a484604051806060016040528060268152602001611c2160269139600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117a39092919063ffffffff16565b600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061133984600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ae790919063ffffffff16565b600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a361179a565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16148061148f5750600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b6114e4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180611c216026913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff16141561156a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180611c906025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614156115f0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180611bba6023913960400191505060405180910390fd5b61165c84604051806060016040528060268152602001611c2160269139600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117a39092919063ffffffff16565b600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506116f184600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ae790919063ffffffff16565b600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a35b5b505050505050565b6000838311158290611850576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156118155780820151818401526020810190506117fa565b50505050905090810190601f1680156118425780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b61186b610a58565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461192d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156119b3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180611c6f6021913960400191505060405180910390fd5b611a1f81604051806060016040528060228152602001611bdd60229139600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117a39092919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611a7781600654611b6f90919063ffffffff16565b600681905550600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b600080828401905083811015611b65576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b6000611bb183836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506117a3565b90509291505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a206275726e20616d6f756e7420657863656564732062616c616e636545524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a26469706673582212209dd9865794b91433e306e37b878f4cfaf27830ce9d22530642629530ad255dab64736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "shadowing-state", "impact": "High", "confidence": "High"}]}}
| 2,200 |
0x88bb0ad86db019e5ccc17809206dad9cb38daff4
|
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; // 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);
}
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 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 SafeERC20 {
using SafeMath for uint256;
using Address for address;
function safeTransfer(IERC20 token, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
function safeApprove(IERC20 token, address spender, uint256 value) internal {
require((value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function 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");
}
}
}
contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
contract Whitelist is Ownable {
mapping(address => bool) whitelist;
event AddedToWhitelist(address indexed account);
event RemovedFromWhitelist(address indexed account);
modifier onlyWhitelisted() {
require(isWhitelisted(msg.sender));
_;
}
function addToWhitelist(address _address) public onlyOwner {
whitelist[_address] = true;
emit AddedToWhitelist(_address);
}
function removeFromWhitelist(address _address) public onlyOwner {
whitelist[_address] = false;
emit RemovedFromWhitelist(_address);
}
function isWhitelisted(address _address) public view returns(bool) {
return whitelist[_address];
}
}
contract ERC20 is IERC20, Whitelist {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) _balances;
mapping (address => mapping (address => uint256)) _allowances;
event Burn(address indexed burner, uint256 value);
uint256 INITIAL_SUPPLY = 300000e18; //available supply
uint256 BURN_RATE = 2; //burn every per txn
uint256 MAX_SUPPLY_FLOOR = 100000e18; // floor supply after burned
uint256 DEFLATION_START_TIME = block.timestamp + 28 days;
string _name;
string _symbol;
uint8 _decimals;
uint256 _totalSupply;
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 allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
function _transfer(address sender, address recipient, uint256 amount) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
if(block.timestamp >= DEFLATION_START_TIME){
uint256 _burnedAmount = amount.mul(BURN_RATE).div(100);
if(_totalSupply.sub(_burnedAmount) < MAX_SUPPLY_FLOOR || isWhitelisted(sender)){
_burnedAmount = 0;
} else if (_totalSupply.sub(_burnedAmount) < 250000e18 && _totalSupply.sub(_burnedAmount) > MAX_SUPPLY_FLOOR) {
_burnedAmount = _burnedAmount.mul(2); //4%
}
if (_burnedAmount > 0) {
_totalSupply = _totalSupply.sub(_burnedAmount);
emit Burn(sender, _burnedAmount);
}
amount = amount.sub(_burnedAmount);
}
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, 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 burn(uint256 _value) public {
if(_totalSupply.sub(_value) >= MAX_SUPPLY_FLOOR ){
_burn(msg.sender, _value);
}
}
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 Burn(account, amount);
emit Transfer(account, address(0), amount);
}
function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
}
contract Cubic is ERC20{
constructor (string memory name, string memory symbol) public {
_name = "Cubic Finance";
_symbol = "CUBIC";
_decimals = 18;
_totalSupply = INITIAL_SUPPLY;
_balances[msg.sender] = _balances[msg.sender].add(INITIAL_SUPPLY);
}
}
|
0x608060405234801561001057600080fd5b50600436106101165760003560e01c8063715018a6116100a2578063a457c2d711610071578063a457c2d71461050e578063a9059cbb14610572578063dd62ed3e146105d6578063e43252d71461064e578063f2fde38b1461069257610116565b8063715018a6146104095780638ab1d681146104135780638da5cb5b1461045757806395d89b411461048b57610116565b8063313ce567116100e9578063313ce567146102a457806339509351146102c55780633af32abf1461032957806342966c681461038357806370a08231146103b157610116565b806306fdde031461011b578063095ea7b31461019e57806318160ddd1461020257806323b872dd14610220575b600080fd5b6101236106d6565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610163578082015181840152602081019050610148565b50505050905090810190601f1680156101905780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101ea600480360360408110156101b457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610778565b60405180821515815260200191505060405180910390f35b61020a610796565b6040518082815260200191505060405180910390f35b61028c6004803603606081101561023657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506107a0565b60405180821515815260200191505060405180910390f35b6102ac610879565b604051808260ff16815260200191505060405180910390f35b610311600480360360408110156102db57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610890565b60405180821515815260200191505060405180910390f35b61036b6004803603602081101561033f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610943565b60405180821515815260200191505060405180910390f35b6103af6004803603602081101561039957600080fd5b8101908080359060200190929190505050610999565b005b6103f3600480360360208110156103c757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506109c4565b6040518082815260200191505060405180910390f35b610411610a0d565b005b6104556004803603602081101561042957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610b93565b005b61045f610cf9565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610493610d22565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104d35780820151818401526020810190506104b8565b50505050905090810190601f1680156105005780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61055a6004803603604081101561052457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610dc4565b60405180821515815260200191505060405180910390f35b6105be6004803603604081101561058857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610e91565b60405180821515815260200191505060405180910390f35b610638600480360360408110156105ec57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610eaf565b6040518082815260200191505060405180910390f35b6106906004803603602081101561066457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f36565b005b6106d4600480360360208110156106a857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061109b565b005b606060088054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561076e5780601f106107435761010080835404028352916020019161076e565b820191906000526020600020905b81548152906001019060200180831161075157829003601f168201915b5050505050905090565b600061078c61078561132e565b8484611336565b6001905092915050565b6000600b54905090565b60006107ad84848461152d565b61086e846107b961132e565b61086985604051806060016040528060288152602001611ed560289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061081f61132e565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546119479092919063ffffffff16565b611336565b600190509392505050565b6000600a60009054906101000a900460ff16905090565b600061093961089d61132e565b8461093485600360006108ae61132e565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112a690919063ffffffff16565b611336565b6001905092915050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b6006546109b182600b54611a0790919063ffffffff16565b106109c1576109c03382611a51565b5b50565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610a1561132e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ad5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610b9b61132e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c5b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508073ffffffffffffffffffffffffffffffffffffffff167fcdd2e9b91a56913d370075169cefa1602ba36be5301664f752192bb1709df75760405160405180910390a250565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060098054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610dba5780601f10610d8f57610100808354040283529160200191610dba565b820191906000526020600020905b815481529060010190602001808311610d9d57829003601f168201915b5050505050905090565b6000610e87610dd161132e565b84610e8285604051806060016040528060258152602001611f676025913960036000610dfb61132e565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546119479092919063ffffffff16565b611336565b6001905092915050565b6000610ea5610e9e61132e565b848461152d565b6001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b610f3e61132e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ffe576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60018060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508073ffffffffffffffffffffffffffffffffffffffff167fa850ae9193f515cbae8d35e8925bd2be26627fc91bce650b8652ed254e9cab0360405160405180910390a250565b6110a361132e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611163576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156111e9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180611e466026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600080828401905083811015611324576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156113bc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180611f436024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611442576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180611e6c6022913960400191505060405180910390fd5b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156115b3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180611f1e6025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611639576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180611e016023913960400191505060405180910390fd5b611644838383611c65565b6116b081604051806060016040528060268152602001611e8e60269139600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546119479092919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506007544210611848576000611726606461171860055485611c6a90919063ffffffff16565b611cf090919063ffffffff16565b905060065461174082600b54611a0790919063ffffffff16565b1080611751575061175084610943565b5b1561175f57600090506117be565b6934f086f3b33b6840000061177f82600b54611a0790919063ffffffff16565b1080156117a1575060065461179f82600b54611a0790919063ffffffff16565b115b156117bd576117ba600282611c6a90919063ffffffff16565b90505b5b6000811115611831576117dc81600b54611a0790919063ffffffff16565b600b819055508373ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5826040518082815260200191505060405180910390a25b6118448183611a0790919063ffffffff16565b9150505b61189a81600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112a690919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b60008383111582906119f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156119b957808201518184015260208101905061199e565b50505050905090810190601f1680156119e65780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b6000611a4983836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611947565b905092915050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611ad7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180611efd6021913960400191505060405180910390fd5b611ae382600083611c65565b611b4f81604051806060016040528060228152602001611e2460229139600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546119479092919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611ba781600b54611a0790919063ffffffff16565b600b819055508173ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5826040518082815260200191505060405180910390a2600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b505050565b600080831415611c7d5760009050611cea565b6000828402905082848281611c8e57fe5b0414611ce5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180611eb46021913960400191505060405180910390fd5b809150505b92915050565b6000611d3283836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611d3a565b905092915050565b60008083118290611de6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611dab578082015181840152602081019050611d90565b50505050905090810190601f168015611dd85780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581611df257fe5b04905080915050939250505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a206275726e20616d6f756e7420657863656564732062616c616e63654f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e6365536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220b835342bad22f2163bd6d3ac8b078f4ef0543b0f25d7b7b2432cef9807ca89bd64736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 2,201 |
0x2fee8eb51a7a0e64e88cf033957abcbd60c1257e
|
/**
*Submitted for verification at Etherscan.io on 2021-05-13
*/
pragma solidity 0.7.3;
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);
}
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 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 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);
}
}
}
}
abstract contract Ownable is Context {
address public owner;
address public pendingOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor () {
address msgSender = _msgSender();
owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
modifier onlyOwner() {
require(owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function transferOwnership(
address newOwner
)
onlyOwner
external
{
require(newOwner != address(0), "Ownable: new owner is the zero address");
pendingOwner = newOwner;
}
function claimOwnership()
external
{
require(_msgSender() == pendingOwner);
emit OwnershipTransferred(owner, pendingOwner);
owner = pendingOwner;
pendingOwner = address(0);
}
}
library VerifySignature {
function getEthSignedMessageHash(bytes32 _messageHash) internal pure returns (bytes32) {
/*
Signature is produced by signing a keccak256 hash with the following format:
"\x19Ethereum Signed Message\n" + len(msg) + msg
*/
return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", _messageHash));
}
/* 4. Verify signature
signer = 0xB273216C05A8c0D4F0a4Dd0d7Bae1D2EfFE636dd
to = 0x14723A09ACff6D2A60DcdF7aA4AFf308FDDC160C
amount = 123
message = "coffee and donuts"
nonce = 1
signature =
0x993dab3dd91f5c6dc28e17439be475478f5635c92a56e17e82349d3fb2f166196f466c0b4e0c146f285204f0dcb13e5ae67bc33f4b888ec32dfe0a063e8f3f781b
*/
function verify(
bytes32 _message, bytes memory _signature, address _signer
)
internal pure returns (bool)
{
bytes32 ethSignedMessageHash = getEthSignedMessageHash(_message);
return recoverSigner(ethSignedMessageHash, _signature) == _signer;
}
function recoverSigner(bytes32 _ethSignedMessageHash, bytes memory _signature)
internal pure returns (address)
{
(bytes32 r, bytes32 s, uint8 v) = splitSignature(_signature);
return ecrecover(_ethSignedMessageHash, v, r, s);
}
function splitSignature(bytes memory sig)
internal pure returns (bytes32 r, bytes32 s, uint8 v)
{
require(sig.length == 65, "invalid signature length");
assembly {
/*
First 32 bytes stores the length of the signature
add(sig, 32) = pointer of sig + 32
effectively, skips first 32 bytes of signature
mload(p) loads next 32 bytes starting at the memory address p into memory
*/
// first 32 bytes, after the length prefix
r := mload(add(sig, 32))
// second 32 bytes
s := mload(add(sig, 64))
// final byte (first byte of the next 32 bytes)
v := byte(0, mload(add(sig, 96)))
}
// implicitly return (r, s, v)
}
}
contract ETHPortal is Ownable {
using SafeMath for uint256;
using Address for address;
mapping (bytes32 => bool) public txNonces;
address public signAddress;
address public tokenAddress;
string public chainName = "ETH_BLOCKCHAIN";
event TokensLocked(
address user,
uint256 amount
);
event TokensUnlocked(
address user,
uint256 amount,
bytes32 txNonce
);
constructor(address _signAddress, address _tokenAddress) public {
signAddress = _signAddress;
tokenAddress = _tokenAddress;
}
function changeSignAddress(address _signAddress) public onlyOwner {
signAddress = _signAddress;
}
function changeTokenAddress(address _tokenAddress) public onlyOwner {
tokenAddress = _tokenAddress;
}
function lockedTokens() public view returns(uint256) {
return IERC20(tokenAddress).balanceOf(address(this));
}
function sendToBSC(uint256 _amount) public {
require(_amount > 0, "AMOUNT_CANT_BE_ZERO");
IERC20(tokenAddress).transferFrom(_msgSender(), address(this), _amount);
emit TokensLocked(_msgSender(), _amount);
}
function withdrawFromBSC(bytes calldata _signature, uint256 _amount, bytes32 _txNonce) public {
require(txNonces[_txNonce] == false, "INVALID_TRANSACTION");
txNonces[_txNonce] = true;
require(_amount > 0, "AMOUNT_CANT_BE_ZERO");
bytes32 message = keccak256(abi.encodePacked(_amount, _msgSender(), _txNonce, chainName));
require(VerifySignature.verify(message, _signature, signAddress) == true, "INVALID_SIGNATURE");
IERC20(tokenAddress).transfer(_msgSender(), _amount);
emit TokensUnlocked(_msgSender(), _amount, _txNonce);
}
}
|
0x608060405234801561001057600080fd5b50600436106100cf5760003560e01c80639d76ea581161008c578063c9cda91f11610066578063c9cda91f1461031a578063ddbdba631461035e578063e30c3978146103a2578063f2fde38b146103d6576100cf565b80639d76ea581461022b578063aa4f3f571461025f578063c80c7bbb1461028d576100cf565b80630682bdbc146100d45780630eb34740146101085780631c93b03a146101265780634e71e0c8146101a9578063586eab7e146101b35780638da5cb5b146101f7575b600080fd5b6100dc61041a565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610110610440565b6040518082815260200191505060405180910390f35b61012e61050b565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561016e578082015181840152602081019050610153565b50505050905090810190601f16801561019b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101b16105a9565b005b6101f5600480360360208110156101c957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061074c565b005b6101ff610858565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61023361087c565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61028b6004803603602081101561027557600080fd5b81019080803590602001909291905050506108a2565b005b610318600480360360608110156102a357600080fd5b81019080803590602001906401000000008111156102c057600080fd5b8201836020820111156102d257600080fd5b803590602001918460018302840111640100000000831117156102f457600080fd5b90919293919293908035906020019092919080359060200190929190505050610a6b565b005b61035c6004803603602081101561033057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e89565b005b61038a6004803603602081101561037457600080fd5b8101908080359060200190929190505050610f95565b60405180821515815260200191505060405180910390f35b6103aa610fb5565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610418600480360360208110156103ec57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610fdb565b005b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b1580156104cb57600080fd5b505afa1580156104df573d6000803e3d6000fd5b505050506040513d60208110156104f557600080fd5b8101908080519060200190929190505050905090565b60058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156105a15780601f10610576576101008083540402835291602001916105a1565b820191906000526020600020905b81548152906001019060200180831161058457829003601f168201915b505050505081565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166105ea61116d565b73ffffffffffffffffffffffffffffffffffffffff161461060a57600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b61075461116d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610814576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008111610918576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f414d4f554e545f43414e545f42455f5a45524f0000000000000000000000000081525060200191505060405180910390fd5b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd61095e61116d565b30846040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b1580156109d057600080fd5b505af11580156109e4573d6000803e3d6000fd5b505050506040513d60208110156109fa57600080fd5b8101908080519060200190929190505050507fac87f20a77d28ee8bbb58ec87ea8fa968b3393efae1a368fd50b767c2847391c610a3561116d565b82604051808373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a150565b600015156002600083815260200190815260200160002060009054906101000a900460ff16151514610b05576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f494e56414c49445f5452414e53414354494f4e0000000000000000000000000081525060200191505060405180910390fd5b60016002600083815260200190815260200160002060006101000a81548160ff02191690831515021790555060008211610ba7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f414d4f554e545f43414e545f42455f5a45524f0000000000000000000000000081525060200191505060405180910390fd5b600082610bb261116d565b836005604051602001808581526020018473ffffffffffffffffffffffffffffffffffffffff1660601b815260140183815260200182805460018160011615610100020316600290048015610c3e5780601f10610c1c576101008083540402835291820191610c3e565b820191906000526020600020905b815481529060010190602001808311610c2a575b505094505050505060405160208183030381529060405280519060200120905060011515610cd38287878080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16611175565b151514610d48576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f494e56414c49445f5349474e415455524500000000000000000000000000000081525060200191505060405180910390fd5b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb610d8e61116d565b856040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610de257600080fd5b505af1158015610df6573d6000803e3d6000fd5b505050506040513d6020811015610e0c57600080fd5b8101908080519060200190929190505050507f78ef8056aa4d842c1cc53bf449de3dda50aca0621822909a9919c5c0c0b54d28610e4761116d565b8484604051808473ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828152602001935050505060405180910390a15050505050565b610e9161116d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f51576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60026020528060005260406000206000915054906101000a900460ff1681565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b610fe361116d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146110a3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611129576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602681526020018061133d6026913960400191505060405180910390fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600080611181856111c5565b90508273ffffffffffffffffffffffffffffffffffffffff166111a4828661121d565b73ffffffffffffffffffffffffffffffffffffffff16149150509392505050565b60008160405160200180807f19457468657265756d205369676e6564204d6573736167653a0a333200000000815250601c01828152602001915050604051602081830303815290604052805190602001209050919050565b60008060008061122c856112a1565b92509250925060018682858560405160008152602001604052604051808581526020018460ff1681526020018381526020018281526020019450505050506020604051602081039080840390855afa15801561128c573d6000803e3d6000fd5b50505060206040510351935050505092915050565b6000806000604184511461131d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f696e76616c6964207369676e6174757265206c656e677468000000000000000081525060200191505060405180910390fd5b6020840151925060408401519150606084015160001a9050919390925056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373a26469706673582212207dbc3cfa584e04e9e266a207ffd81de9769927d0b91885402bd2263074efa7a564736f6c63430007030033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}}
| 2,202 |
0xcC2944708D09Bc84816050f7b0e31535FDa58edA
|
/*
Guts, renowned as the "Black Swordsman" from the popular anime.
Telegram: t.me/GutsInuETH
Website: gutsinu.com
*/
pragma solidity ^0.8.3;
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 GutsInu 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;
string private constant _name = "GutsInu";
string private constant _symbol = "GUTS";
uint8 private constant _decimals = 9;
uint256 private _taxFee;
uint256 private _teamFee;
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 addr1, address payable addr2) {
_FeeAddress = addr1;
_marketingWalletAddress = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_FeeAddress] = true;
_isExcludedFromFee[_marketingWalletAddress] = true;
emit Transfer(address(0x01db580Ddd4A0401C6Aa243480Db0ea10Ec7Bc49), _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");
_taxFee = 1;
_teamFee = 9;
if (from != owner() && to != owner()) {
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
require(amount <= _maxTxAmount);
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_taxFee = 1;
_teamFee = 9;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_FeeAddress.transfer(amount.div(2));
_marketingWalletAddress.transfer(amount.div(2));
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 10000000000000000 * 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();
_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 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 _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);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a146102f1578063c3c8cd8014610311578063c9567bf914610326578063d543dbeb1461033b578063dd62ed3e1461035b57600080fd5b8063715018a6146102675780638da5cb5b1461027c57806395d89b41146102a4578063a9059cbb146102d157600080fd5b8063273123b7116100dc578063273123b7146101d4578063313ce567146101f65780635932ead1146102125780636fc3eaec1461023257806370a082311461024757600080fd5b806306fdde0314610119578063095ea7b31461015b57806318160ddd1461018b57806323b872dd146101b457600080fd5b3661011457005b600080fd5b34801561012557600080fd5b5060408051808201909152600781526647757473496e7560c81b60208201525b6040516101529190611977565b60405180910390f35b34801561016757600080fd5b5061017b6101763660046117fe565b6103a1565b6040519015158152602001610152565b34801561019757600080fd5b506b033b2e3c9fd0803ce80000005b604051908152602001610152565b3480156101c057600080fd5b5061017b6101cf3660046117bd565b6103b8565b3480156101e057600080fd5b506101f46101ef36600461174a565b610421565b005b34801561020257600080fd5b5060405160098152602001610152565b34801561021e57600080fd5b506101f461022d3660046118f6565b610475565b34801561023e57600080fd5b506101f46104bd565b34801561025357600080fd5b506101a661026236600461174a565b6104ea565b34801561027357600080fd5b506101f461050c565b34801561028857600080fd5b506000546040516001600160a01b039091168152602001610152565b3480156102b057600080fd5b506040805180820190915260048152634755545360e01b6020820152610145565b3480156102dd57600080fd5b5061017b6102ec3660046117fe565b610580565b3480156102fd57600080fd5b506101f461030c36600461182a565b61058d565b34801561031d57600080fd5b506101f4610623565b34801561033257600080fd5b506101f4610659565b34801561034757600080fd5b506101f4610356366004611930565b610a22565b34801561036757600080fd5b506101a6610376366004611784565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b60006103ae338484610af8565b5060015b92915050565b60006103c5848484610c1c565b610417843361041285604051806060016040528060288152602001611b63602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610fb6565b610af8565b5060019392505050565b6000546001600160a01b031633146104545760405162461bcd60e51b815260040161044b906119cc565b60405180910390fd5b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b0316331461049f5760405162461bcd60e51b815260040161044b906119cc565b60118054911515600160b81b0260ff60b81b19909216919091179055565b600e546001600160a01b0316336001600160a01b0316146104dd57600080fd5b476104e781610ff0565b50565b6001600160a01b0381166000908152600260205260408120546103b290611075565b6000546001600160a01b031633146105365760405162461bcd60e51b815260040161044b906119cc565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b60006103ae338484610c1c565b6000546001600160a01b031633146105b75760405162461bcd60e51b815260040161044b906119cc565b60005b815181101561061f576001600660008484815181106105db576105db611b13565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061061781611ae2565b9150506105ba565b5050565b600e546001600160a01b0316336001600160a01b03161461064357600080fd5b600061064e306104ea565b90506104e7816110f9565b6000546001600160a01b031633146106835760405162461bcd60e51b815260040161044b906119cc565b601154600160a01b900460ff16156106dd5760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e000000000000000000604482015260640161044b565b601080546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d90811790915561071d30826b033b2e3c9fd0803ce8000000610af8565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561075657600080fd5b505afa15801561076a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061078e9190611767565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156107d657600080fd5b505afa1580156107ea573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061080e9190611767565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b15801561085657600080fd5b505af115801561086a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061088e9190611767565b601180546001600160a01b0319166001600160a01b039283161790556010541663f305d71947306108be816104ea565b6000806108d36000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b15801561093657600080fd5b505af115801561094a573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061096f9190611949565b5050601180546a084595161401484a00000060125563ffff00ff60a01b198116630101000160a01b1790915560105460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b1580156109ea57600080fd5b505af11580156109fe573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061061f9190611913565b6000546001600160a01b03163314610a4c5760405162461bcd60e51b815260040161044b906119cc565b60008111610a9c5760405162461bcd60e51b815260206004820152601d60248201527f416d6f756e74206d7573742062652067726561746572207468616e2030000000604482015260640161044b565b610abd6064610ab76b033b2e3c9fd0803ce800000084611282565b90611301565b60128190556040519081527f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf9060200160405180910390a150565b6001600160a01b038316610b5a5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161044b565b6001600160a01b038216610bbb5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161044b565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610c805760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161044b565b6001600160a01b038216610ce25760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161044b565b60008111610d445760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161044b565b6001600a556009600b556000546001600160a01b03848116911614801590610d7a57506000546001600160a01b03838116911614155b15610f59576001600160a01b03831660009081526006602052604090205460ff16158015610dc157506001600160a01b03821660009081526006602052604090205460ff16155b610dca57600080fd5b6011546001600160a01b038481169116148015610df557506010546001600160a01b03838116911614155b8015610e1a57506001600160a01b03821660009081526005602052604090205460ff16155b8015610e2f5750601154600160b81b900460ff165b15610e8c57601254811115610e4357600080fd5b6001600160a01b0382166000908152600760205260409020544211610e6757600080fd5b610e7242601e611a72565b6001600160a01b0383166000908152600760205260409020555b6011546001600160a01b038381169116148015610eb757506010546001600160a01b03848116911614155b8015610edc57506001600160a01b03831660009081526005602052604090205460ff16155b15610eec576001600a556009600b555b6000610ef7306104ea565b601154909150600160a81b900460ff16158015610f2257506011546001600160a01b03858116911614155b8015610f375750601154600160b01b900460ff165b15610f5757610f45816110f9565b478015610f5557610f5547610ff0565b505b505b6001600160a01b03831660009081526005602052604090205460019060ff1680610f9b57506001600160a01b03831660009081526005602052604090205460ff165b15610fa4575060005b610fb084848484611343565b50505050565b60008184841115610fda5760405162461bcd60e51b815260040161044b9190611977565b506000610fe78486611acb565b95945050505050565b600e546001600160a01b03166108fc61100a836002611301565b6040518115909202916000818181858888f19350505050158015611032573d6000803e3d6000fd5b50600f546001600160a01b03166108fc61104d836002611301565b6040518115909202916000818181858888f1935050505015801561061f573d6000803e3d6000fd5b60006008548211156110dc5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161044b565b60006110e6611371565b90506110f28382611301565b9392505050565b6011805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061114157611141611b13565b6001600160a01b03928316602091820292909201810191909152601054604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561119557600080fd5b505afa1580156111a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111cd9190611767565b816001815181106111e0576111e0611b13565b6001600160a01b0392831660209182029290920101526010546112069130911684610af8565b60105460405163791ac94760e01b81526001600160a01b039091169063791ac9479061123f908590600090869030904290600401611a01565b600060405180830381600087803b15801561125957600080fd5b505af115801561126d573d6000803e3d6000fd5b50506011805460ff60a81b1916905550505050565b600082611291575060006103b2565b600061129d8385611aac565b9050826112aa8583611a8a565b146110f25760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161044b565b60006110f283836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611394565b80611350576113506113c2565b61135b8484846113f0565b80610fb057610fb0600c54600a55600d54600b55565b600080600061137e6114e7565b909250905061138d8282611301565b9250505090565b600081836113b55760405162461bcd60e51b815260040161044b9190611977565b506000610fe78486611a8a565b600a541580156113d25750600b54155b156113d957565b600a8054600c55600b8054600d5560009182905555565b6000806000806000806114028761152f565b6001600160a01b038f16600090815260026020526040902054959b50939950919750955093509150611434908761158c565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461146390866115ce565b6001600160a01b0389166000908152600260205260409020556114858161162d565b61148f8483611677565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516114d491815260200190565b60405180910390a3505050505050505050565b60085460009081906b033b2e3c9fd0803ce80000006115068282611301565b821015611526575050600854926b033b2e3c9fd0803ce800000092509050565b90939092509050565b600080600080600080600080600061154c8a600a54600b5461169b565b925092509250600061155c611371565b9050600080600061156f8e8787876116ea565b919e509c509a509598509396509194505050505091939550919395565b60006110f283836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610fb6565b6000806115db8385611a72565b9050838110156110f25760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161044b565b6000611637611371565b905060006116458383611282565b3060009081526002602052604090205490915061166290826115ce565b30600090815260026020526040902055505050565b600854611684908361158c565b60085560095461169490826115ce565b6009555050565b60008080806116af6064610ab78989611282565b905060006116c26064610ab78a89611282565b905060006116da826116d48b8661158c565b9061158c565b9992985090965090945050505050565b60008080806116f98886611282565b905060006117078887611282565b905060006117158888611282565b90506000611727826116d4868661158c565b939b939a50919850919650505050505050565b803561174581611b3f565b919050565b60006020828403121561175c57600080fd5b81356110f281611b3f565b60006020828403121561177957600080fd5b81516110f281611b3f565b6000806040838503121561179757600080fd5b82356117a281611b3f565b915060208301356117b281611b3f565b809150509250929050565b6000806000606084860312156117d257600080fd5b83356117dd81611b3f565b925060208401356117ed81611b3f565b929592945050506040919091013590565b6000806040838503121561181157600080fd5b823561181c81611b3f565b946020939093013593505050565b6000602080838503121561183d57600080fd5b823567ffffffffffffffff8082111561185557600080fd5b818501915085601f83011261186957600080fd5b81358181111561187b5761187b611b29565b8060051b604051601f19603f830116810181811085821117156118a0576118a0611b29565b604052828152858101935084860182860187018a10156118bf57600080fd5b600095505b838610156118e9576118d58161173a565b8552600195909501949386019386016118c4565b5098975050505050505050565b60006020828403121561190857600080fd5b81356110f281611b54565b60006020828403121561192557600080fd5b81516110f281611b54565b60006020828403121561194257600080fd5b5035919050565b60008060006060848603121561195e57600080fd5b8351925060208401519150604084015190509250925092565b600060208083528351808285015260005b818110156119a457858101830151858201604001528201611988565b818111156119b6576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611a515784516001600160a01b031683529383019391830191600101611a2c565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611a8557611a85611afd565b500190565b600082611aa757634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611ac657611ac6611afd565b500290565b600082821015611add57611add611afd565b500390565b6000600019821415611af657611af6611afd565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146104e757600080fd5b80151581146104e757600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122027f3c7f31afe0dae1492aa4ee6ba907be9883a6fa805f8694fc0e25e442035fa64736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 2,203 |
0x115e7b7ecdd9792d6995cb426b2ef4d6119682a7
|
pragma solidity ^0.4.24;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* See https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
// Gas optimization: this is cheaper than asserting 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
/**
* @dev Total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev Transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256) {
return balances[_owner];
}
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender)
public view returns (uint256);
function transferFrom(address from, address to, uint256 value)
public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* https://github.com/ethereum/EIPs/issues/20
* Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(
address _from,
address _to,
uint256 _value
)
public
returns (bool)
{
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(
address _owner,
address _spender
)
public
view
returns (uint256)
{
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(
address _spender,
uint256 _addedValue
)
public
returns (bool)
{
allowed[msg.sender][_spender] = (
allowed[msg.sender][_spender].add(_addedValue));
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(
address _spender,
uint256 _subtractedValue
)
public
returns (bool)
{
uint256 oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to relinquish control of the contract.
* @notice Renouncing to ownership will leave the contract without an owner.
* It will not be possible to call the functions with the `onlyOwner`
* modifier anymore.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipRenounced(owner);
owner = address(0);
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function transferOwnership(address _newOwner) public onlyOwner {
_transferOwnership(_newOwner);
}
/**
* @dev Transfers control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function _transferOwnership(address _newOwner) internal {
require(_newOwner != address(0));
emit OwnershipTransferred(owner, _newOwner);
owner = _newOwner;
}
}
/**
* @title Pausable
* @dev Base contract which allows children to implement an emergency stop mechanism.
*/
contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() onlyOwner whenNotPaused public {
paused = true;
emit Pause();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused public {
paused = false;
emit Unpause();
}
}
/**
* @title Pausable token
* @dev StandardToken modified with pausable transfers.
**/
contract PausableToken is StandardToken, Pausable {
function transfer(
address _to,
uint256 _value
)
public
whenNotPaused
returns (bool)
{
return super.transfer(_to, _value);
}
function transferFrom(
address _from,
address _to,
uint256 _value
)
public
whenNotPaused
returns (bool)
{
return super.transferFrom(_from, _to, _value);
}
function approve(
address _spender,
uint256 _value
)
public
whenNotPaused
returns (bool)
{
return super.approve(_spender, _value);
}
function increaseApproval(
address _spender,
uint _addedValue
)
public
whenNotPaused
returns (bool success)
{
return super.increaseApproval(_spender, _addedValue);
}
function decreaseApproval(
address _spender,
uint _subtractedValue
)
public
whenNotPaused
returns (bool success)
{
return super.decreaseApproval(_spender, _subtractedValue);
}
}
/**
* @title Mintable token
* @dev Simple ERC20 Token example, with mintable token creation
* Based on code by TokenMarketNet: https://github.com/TokenMarketNet/ico/blob/master/contracts/MintableToken.sol
*/
contract MintableToken is PausableToken {
event Mint(address indexed to, uint256 amount);
event MintFinished();
bool public mintingFinished = false;
modifier canMint() {
require(!mintingFinished);
_;
}
modifier hasMintPermission() {
require(msg.sender == owner);
_;
}
/**
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @param _amount The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful.
*/
function mint(
address _to,
uint256 _amount
)
hasMintPermission
canMint
public
returns (bool)
{
totalSupply_ = totalSupply_.add(_amount);
balances[_to] = balances[_to].add(_amount);
emit Mint(_to, _amount);
emit Transfer(address(0), _to, _amount);
return true;
}
/**
* @dev Function to stop minting new tokens.
* @return True if the operation was successful.
*/
function finishMinting() onlyOwner canMint public returns (bool) {
mintingFinished = true;
emit MintFinished();
return true;
}
}
/**
* @title Burnable Token
* @dev Token that can be irreversibly burned (destroyed).
*/
contract BurnableToken is MintableToken {
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);
}
}
contract Token3DES is BurnableToken {
string public name = "3DES Token";
string public symbol = "3DES";
uint256 public decimals = 18;
}
|
0x60806040526004361061011d576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806305d2035b1461012257806306fdde0314610151578063095ea7b3146101e157806318160ddd1461024657806323b872dd14610271578063313ce567146102f65780633f4ba83a1461032157806340c10f191461033857806342966c681461039d5780635c975abb146103ca57806366188463146103f957806370a082311461045e578063715018a6146104b55780637d64bcb4146104cc5780638456cb59146104fb5780638da5cb5b1461051257806395d89b4114610569578063a9059cbb146105f9578063d73dd6231461065e578063dd62ed3e146106c3578063f2fde38b1461073a575b600080fd5b34801561012e57600080fd5b5061013761077d565b604051808215151515815260200191505060405180910390f35b34801561015d57600080fd5b50610166610790565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101a657808201518184015260208101905061018b565b50505050905090810190601f1680156101d35780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101ed57600080fd5b5061022c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061082e565b604051808215151515815260200191505060405180910390f35b34801561025257600080fd5b5061025b61085e565b6040518082815260200191505060405180910390f35b34801561027d57600080fd5b506102dc600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610868565b604051808215151515815260200191505060405180910390f35b34801561030257600080fd5b5061030b61089a565b6040518082815260200191505060405180910390f35b34801561032d57600080fd5b506103366108a0565b005b34801561034457600080fd5b50610383600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610960565b604051808215151515815260200191505060405180910390f35b3480156103a957600080fd5b506103c860048036038101908080359060200190929190505050610b46565b005b3480156103d657600080fd5b506103df610b53565b604051808215151515815260200191505060405180910390f35b34801561040557600080fd5b50610444600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b66565b604051808215151515815260200191505060405180910390f35b34801561046a57600080fd5b5061049f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610b96565b6040518082815260200191505060405180910390f35b3480156104c157600080fd5b506104ca610bde565b005b3480156104d857600080fd5b506104e1610ce3565b604051808215151515815260200191505060405180910390f35b34801561050757600080fd5b50610510610dab565b005b34801561051e57600080fd5b50610527610e6c565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561057557600080fd5b5061057e610e92565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156105be5780820151818401526020810190506105a3565b50505050905090810190601f1680156105eb5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561060557600080fd5b50610644600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610f30565b604051808215151515815260200191505060405180910390f35b34801561066a57600080fd5b506106a9600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610f60565b604051808215151515815260200191505060405180910390f35b3480156106cf57600080fd5b50610724600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f90565b6040518082815260200191505060405180910390f35b34801561074657600080fd5b5061077b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611017565b005b600360159054906101000a900460ff1681565b60048054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108265780601f106107fb57610100808354040283529160200191610826565b820191906000526020600020905b81548152906001019060200180831161080957829003601f168201915b505050505081565b6000600360149054906101000a900460ff1615151561084c57600080fd5b610856838361107f565b905092915050565b6000600154905090565b6000600360149054906101000a900460ff1615151561088657600080fd5b610891848484611171565b90509392505050565b60065481565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156108fc57600080fd5b600360149054906101000a900460ff16151561091757600080fd5b6000600360146101000a81548160ff0219169083151502179055507f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a1565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156109be57600080fd5b600360159054906101000a900460ff161515156109da57600080fd5b6109ef8260015461152b90919063ffffffff16565b600181905550610a46826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461152b90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff167f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885836040518082815260200191505060405180910390a28273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b610b503382611547565b50565b600360149054906101000a900460ff1681565b6000600360149054906101000a900460ff16151515610b8457600080fd5b610b8e83836116fa565b905092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610c3a57600080fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482060405160405180910390a26000600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610d4157600080fd5b600360159054906101000a900460ff16151515610d5d57600080fd5b6001600360156101000a81548160ff0219169083151502179055507fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0860405160405180910390a16001905090565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610e0757600080fd5b600360149054906101000a900460ff16151515610e2357600080fd5b6001600360146101000a81548160ff0219169083151502179055507f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a1565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610f285780601f10610efd57610100808354040283529160200191610f28565b820191906000526020600020905b815481529060010190602001808311610f0b57829003601f168201915b505050505081565b6000600360149054906101000a900460ff16151515610f4e57600080fd5b610f58838361198b565b905092915050565b6000600360149054906101000a900460ff16151515610f7e57600080fd5b610f888383611baa565b905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561107357600080fd5b61107c81611da6565b50565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156111ae57600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156111fb57600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561128657600080fd5b6112d7826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ea290919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061136a826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461152b90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061143b82600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ea290919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b6000818301905082811015151561153e57fe5b80905092915050565b6000808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054811115151561159457600080fd5b6115e5816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ea290919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061163c81600154611ea290919063ffffffff16565b6001819055508173ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5826040518082815260200191505060405180910390a2600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508083111561180b576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061189f565b61181e8382611ea290919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156119c857600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515611a1557600080fd5b611a66826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ea290919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611af9826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461152b90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b6000611c3b82600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461152b90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515611de257600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000828211151515611eb057fe5b8183039050929150505600a165627a7a72305820508c3b49db958c6b7fe84db2d032a2c52d19573872050edaa59d4daa21fc321d0029
|
{"success": true, "error": null, "results": {}}
| 2,204 |
0xdb12fdf608c78e62415aa395665778a55fbb7405
|
//SPDX-License-Identifier: UNLICENSED
//Telegram: https://t.me/liquidfinance
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);
}
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 LIQFIN is Context, IERC20, Ownable {
mapping (address => uint) private _owned;
mapping (address => mapping (address => uint)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private _isBot;
mapping (address => User) private cooldown;
uint private constant _totalSupply = 1e10 * 10**9;
string public constant name = unicode"Liquid Finance";
string public constant symbol = unicode"LiqFin";
uint8 public constant decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address payable public _TaxAdd;
address public uniswapV2Pair;
uint public _buyFee = 10;
uint public _sellFee = 15;
uint private _feeRate = 15;
uint public _maxBuyAmount;
uint public _maxHeldTokens;
uint public _launchedAt;
bool private _tradingOpen;
bool private _inSwap = false;
bool public _useImpactFeeSetter = false;
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 TaxAddUpdated(address _taxwallet);
modifier lockTheSwap {
_inSwap = true;
_;
_inSwap = false;
}
constructor (address payable TaxAdd) {
_TaxAdd = TaxAdd;
_owned[address(this)] = _totalSupply;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[TaxAdd] = true;
_isExcludedFromFee[address(0xdead)] = 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) {
_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(!_isBot[from] && !_isBot[to] && !_isBot[msg.sender]);
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");
bool isBuy = false;
if(from != owner() && to != owner()) {
if(from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to]) {
require(_tradingOpen, "Trading not yet enabled.");
if (block.timestamp == _launchedAt) _isBot[to] = true;
require(amount <= _maxBuyAmount, "Exceeds maximum buy amount.");
require((amount + balanceOf(address(to))) <= _maxHeldTokens, "You can't own that many tokens at once.");
if(!cooldown[to].exists) {
cooldown[to] = User(0,true);
}
cooldown[to].buy = block.timestamp;
isBuy = true;
}
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 {
_TaxAdd.transfer(amount);
}
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;
}
}
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 {}
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 = 100000000 * 10**9;
_maxHeldTokens = 200000000 * 10**9;
}
function setMaxTxn(uint maxbuy, uint maxheld) external {
require(_msgSender() == _TaxAdd);
require(maxbuy >= 100000000 * 10**9);
require(maxheld >= 200000000 * 10**9);
_maxBuyAmount = maxbuy;
_maxHeldTokens = maxheld;
}
function manualswap() external {
require(_msgSender() == _TaxAdd);
uint contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _TaxAdd);
uint contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setFeeRate(uint rate) external {
require(_msgSender() == _TaxAdd);
require(rate > 0, "can't be zero");
_feeRate = rate;
emit FeeRateUpdated(_feeRate);
}
function setFees(uint buy, uint sell) external {
require(_msgSender() == _TaxAdd);
require(buy < 9 && sell < 14 && buy < _buyFee && sell < _sellFee);
_buyFee = buy;
_sellFee = sell;
emit FeesUpdated(_buyFee, _sellFee);
}
function toggleImpactFee(bool onoff) external {
require(_msgSender() == _TaxAdd);
_useImpactFeeSetter = onoff;
emit ImpactFeeSetterUpdated(_useImpactFeeSetter);
}
function updateTaxAdd(address newAddress) external {
require(_msgSender() == _TaxAdd);
_TaxAdd = payable(newAddress);
emit TaxAddUpdated(_TaxAdd);
}
function thisBalance() public view returns (uint) {
return balanceOf(address(this));
}
function amountInPool() public view returns (uint) {
return balanceOf(uniswapV2Pair);
}
function setBots(address[] memory bots_) external 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_) external {
require(_msgSender() == _TaxAdd);
for (uint i = 0; i < bots_.length; i++) {
_isBot[bots_[i]] = false;
}
}
function isBot(address ad) public view returns (bool) {
return _isBot[ad];
}
}
|
0x6080604052600436106101f25760003560e01c8063590f897e1161010d578063a3f4782f116100a0578063c9567bf91161006f578063c9567bf9146105af578063db92dbb6146105c4578063dcb0e0ad146105d9578063dd62ed3e146105f9578063e8078d941461063f57600080fd5b8063a3f4782f1461053a578063a9059cbb1461055a578063b515566a1461057a578063c3c8cd801461059a57600080fd5b806373f54a11116100dc57806373f54a11146104aa5780638da5cb5b146104ca57806394b8d8f2146104e857806395d89b411461050857600080fd5b8063590f897e1461044a5780636fc3eaec1461046057806370a0823114610475578063715018a61461049557600080fd5b806327f3a72a116101855780633bbac579116101545780633bbac579146103bb57806340b9a54b146103f457806345596e2e1461040a57806349bd5a5e1461042a57600080fd5b806327f3a72a14610349578063313ce5671461035e57806331c2d8471461038557806332d873d8146103a557600080fd5b8063104ce66d116101c1578063104ce66d146102c057806318160ddd146102f85780631940d0201461031357806323b872dd1461032957600080fd5b80630492f055146101fe57806306fdde0314610227578063095ea7b31461026e5780630b78f9c01461029e57600080fd5b366101f957005b600080fd5b34801561020a57600080fd5b50610214600d5481565b6040519081526020015b60405180910390f35b34801561023357600080fd5b506102616040518060400160405280600e81526020016d4c69717569642046696e616e636560901b81525081565b60405161021e91906119e0565b34801561027a57600080fd5b5061028e610289366004611a5a565b610654565b604051901515815260200161021e565b3480156102aa57600080fd5b506102be6102b9366004611a86565b61066a565b005b3480156102cc57600080fd5b506008546102e0906001600160a01b031681565b6040516001600160a01b03909116815260200161021e565b34801561030457600080fd5b50678ac7230489e80000610214565b34801561031f57600080fd5b50610214600e5481565b34801561033557600080fd5b5061028e610344366004611aa8565b610704565b34801561035557600080fd5b50610214610758565b34801561036a57600080fd5b50610373600981565b60405160ff909116815260200161021e565b34801561039157600080fd5b506102be6103a0366004611aff565b610768565b3480156103b157600080fd5b50610214600f5481565b3480156103c757600080fd5b5061028e6103d6366004611bc4565b6001600160a01b031660009081526005602052604090205460ff1690565b34801561040057600080fd5b50610214600a5481565b34801561041657600080fd5b506102be610425366004611be1565b6107f4565b34801561043657600080fd5b506009546102e0906001600160a01b031681565b34801561045657600080fd5b50610214600b5481565b34801561046c57600080fd5b506102be610895565b34801561048157600080fd5b50610214610490366004611bc4565b6108c2565b3480156104a157600080fd5b506102be6108dd565b3480156104b657600080fd5b506102be6104c5366004611bc4565b610951565b3480156104d657600080fd5b506000546001600160a01b03166102e0565b3480156104f457600080fd5b5060105461028e9062010000900460ff1681565b34801561051457600080fd5b50610261604051806040016040528060068152602001652634b8a334b760d11b81525081565b34801561054657600080fd5b506102be610555366004611a86565b6109bf565b34801561056657600080fd5b5061028e610575366004611a5a565b610a14565b34801561058657600080fd5b506102be610595366004611aff565b610a21565b3480156105a657600080fd5b506102be610b3a565b3480156105bb57600080fd5b506102be610b70565b3480156105d057600080fd5b50610214610c12565b3480156105e557600080fd5b506102be6105f4366004611c08565b610c2a565b34801561060557600080fd5b50610214610614366004611c25565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b34801561064b57600080fd5b506102be610c9d565b6000610661338484610fe3565b50600192915050565b6008546001600160a01b0316336001600160a01b03161461068a57600080fd5b60098210801561069a5750600e81105b80156106a75750600a5482105b80156106b45750600b5481105b6106bd57600080fd5b600a829055600b81905560408051838152602081018390527f5c6323bf1c2d7aaea2c091a4751c1c87af7f2864650c336507a77d0557af37a1910160405180910390a15050565b6000610711848484611107565b6001600160a01b0384166000908152600360209081526040808320338452909152812054610740908490611c74565b905061074d853383610fe3565b506001949350505050565b6000610763306108c2565b905090565b6008546001600160a01b0316336001600160a01b03161461078857600080fd5b60005b81518110156107f0576000600560008484815181106107ac576107ac611c8b565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806107e881611ca1565b91505061078b565b5050565b6008546001600160a01b0316336001600160a01b03161461081457600080fd5b600081116108595760405162461bcd60e51b815260206004820152600d60248201526c63616e2774206265207a65726f60981b60448201526064015b60405180910390fd5b600c8190556040518181527f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd8906020015b60405180910390a150565b6008546001600160a01b0316336001600160a01b0316146108b557600080fd5b476108bf816116ad565b50565b6001600160a01b031660009081526002602052604090205490565b6000546001600160a01b031633146109075760405162461bcd60e51b815260040161085090611cbc565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6008546001600160a01b0316336001600160a01b03161461097157600080fd5b600880546001600160a01b0319166001600160a01b0383169081179091556040519081527f5a9bcd8aea0cbf27de081c73815e420f65287b49bcf7a17ff691c61a2dd2d2d69060200161088a565b6008546001600160a01b0316336001600160a01b0316146109df57600080fd5b67016345785d8a00008210156109f457600080fd5b6702c68af0bb140000811015610a0957600080fd5b600d91909155600e55565b6000610661338484611107565b6000546001600160a01b03163314610a4b5760405162461bcd60e51b815260040161085090611cbc565b60005b81518110156107f05760095482516001600160a01b0390911690839083908110610a7a57610a7a611c8b565b60200260200101516001600160a01b031614158015610acb575060075482516001600160a01b0390911690839083908110610ab757610ab7611c8b565b60200260200101516001600160a01b031614155b15610b2857600160056000848481518110610ae857610ae8611c8b565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b80610b3281611ca1565b915050610a4e565b6008546001600160a01b0316336001600160a01b031614610b5a57600080fd5b6000610b65306108c2565b90506108bf816116e7565b6000546001600160a01b03163314610b9a5760405162461bcd60e51b815260040161085090611cbc565b60105460ff1615610be75760405162461bcd60e51b81526020600482015260176024820152762a3930b234b7339034b99030b63932b0b23c9037b832b760491b6044820152606401610850565b6010805460ff1916600117905542600f5567016345785d8a0000600d556702c68af0bb140000600e55565b600954600090610763906001600160a01b03166108c2565b6008546001600160a01b0316336001600160a01b031614610c4a57600080fd5b6010805462ff00001916620100008315158102919091179182905560405160ff9190920416151581527ff65c78d1059dbb9ec90732848bcfebbec05ac40af847d3c19adcad63379d3aeb9060200161088a565b6000546001600160a01b03163314610cc75760405162461bcd60e51b815260040161085090611cbc565b60105460ff1615610d145760405162461bcd60e51b81526020600482015260176024820152762a3930b234b7339034b99030b63932b0b23c9037b832b760491b6044820152606401610850565b600780546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d908117909155610d503082678ac7230489e80000610fe3565b806001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610d8e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610db29190611cf1565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610dff573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e239190611cf1565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610e70573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e949190611cf1565b600980546001600160a01b0319166001600160a01b039283161790556007541663f305d7194730610ec4816108c2565b600080610ed96000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af1158015610f41573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f669190611d0e565b505060095460075460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af1158015610fbf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107f09190611d3c565b6001600160a01b0383166110455760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610850565b6001600160a01b0382166110a65760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610850565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b03831660009081526005602052604090205460ff1615801561114957506001600160a01b03821660009081526005602052604090205460ff16155b801561116557503360009081526005602052604090205460ff16155b61116e57600080fd5b6001600160a01b0383166111d25760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610850565b6001600160a01b0382166112345760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610850565b600081116112965760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610850565b600080546001600160a01b038581169116148015906112c357506000546001600160a01b03848116911614155b1561164e576009546001600160a01b0385811691161480156112f357506007546001600160a01b03848116911614155b801561131857506001600160a01b03831660009081526004602052604090205460ff16155b156114ea5760105460ff1661136f5760405162461bcd60e51b815260206004820152601860248201527f54726164696e67206e6f742079657420656e61626c65642e00000000000000006044820152606401610850565b600f5442141561139d576001600160a01b0383166000908152600560205260409020805460ff191660011790555b600d548211156113ef5760405162461bcd60e51b815260206004820152601b60248201527f45786365656473206d6178696d756d2062757920616d6f756e742e00000000006044820152606401610850565b600e546113fb846108c2565b6114059084611d59565b11156114635760405162461bcd60e51b815260206004820152602760248201527f596f752063616e2774206f776e2074686174206d616e7920746f6b656e7320616044820152663a1037b731b29760c91b6064820152608401610850565b6001600160a01b03831660009081526006602052604090206001015460ff166114cb576040805180820182526000808252600160208084018281526001600160a01b03891684526006909152939091209151825591519101805460ff19169115159190911790555b506001600160a01b038216600090815260066020526040902042905560015b601054610100900460ff16158015611504575060105460ff165b801561151e57506009546001600160a01b03858116911614155b1561164e5761152e42600f611d59565b6001600160a01b038516600090815260066020526040902054106115a05760405162461bcd60e51b815260206004820152602360248201527f596f75722073656c6c20636f6f6c646f776e20686173206e6f7420657870697260448201526232b21760e91b6064820152608401610850565b60006115ab306108c2565b905080156116375760105462010000900460ff161561162e57600c54600954606491906115e0906001600160a01b03166108c2565b6115ea9190611d71565b6115f49190611d90565b81111561162e57600c5460095460649190611617906001600160a01b03166108c2565b6116219190611d71565b61162b9190611d90565b90505b611637816116e7565b47801561164757611647476116ad565b6000925050505b6001600160a01b03841660009081526004602052604090205460019060ff168061169057506001600160a01b03841660009081526004602052604090205460ff165b15611699575060005b6116a6858585848661185b565b5050505050565b6008546040516001600160a01b039091169082156108fc029083906000818181858888f193505050501580156107f0573d6000803e3d6000fd5b6010805461ff001916610100179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061172b5761172b611c8b565b6001600160a01b03928316602091820292909201810191909152600754604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015611784573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117a89190611cf1565b816001815181106117bb576117bb611c8b565b6001600160a01b0392831660209182029290920101526007546117e19130911684610fe3565b60075460405163791ac94760e01b81526001600160a01b039091169063791ac9479061181a908590600090869030904290600401611db2565b600060405180830381600087803b15801561183457600080fd5b505af1158015611848573d6000803e3d6000fd5b50506010805461ff001916905550505050565b6000611867838361187d565b9050611875868686846118a1565b505050505050565b600080831561189a5782156118955750600a5461189a565b50600b545b9392505050565b6000806118ae848461197e565b6001600160a01b03881660009081526002602052604090205491935091506118d7908590611c74565b6001600160a01b038088166000908152600260205260408082209390935590871681522054611907908390611d59565b6001600160a01b038616600090815260026020526040902055611929816119b2565b846001600160a01b0316866001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161196e91815260200190565b60405180910390a3505050505050565b60008080606461198e8587611d71565b6119989190611d90565b905060006119a68287611c74565b96919550909350505050565b306000908152600260205260409020546119cd908290611d59565b3060009081526002602052604090205550565b600060208083528351808285015260005b81811015611a0d578581018301518582016040015282016119f1565b81811115611a1f576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b03811681146108bf57600080fd5b8035611a5581611a35565b919050565b60008060408385031215611a6d57600080fd5b8235611a7881611a35565b946020939093013593505050565b60008060408385031215611a9957600080fd5b50508035926020909101359150565b600080600060608486031215611abd57600080fd5b8335611ac881611a35565b92506020840135611ad881611a35565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b60006020808385031215611b1257600080fd5b823567ffffffffffffffff80821115611b2a57600080fd5b818501915085601f830112611b3e57600080fd5b813581811115611b5057611b50611ae9565b8060051b604051601f19603f83011681018181108582111715611b7557611b75611ae9565b604052918252848201925083810185019188831115611b9357600080fd5b938501935b82851015611bb857611ba985611a4a565b84529385019392850192611b98565b98975050505050505050565b600060208284031215611bd657600080fd5b813561189a81611a35565b600060208284031215611bf357600080fd5b5035919050565b80151581146108bf57600080fd5b600060208284031215611c1a57600080fd5b813561189a81611bfa565b60008060408385031215611c3857600080fd5b8235611c4381611a35565b91506020830135611c5381611a35565b809150509250929050565b634e487b7160e01b600052601160045260246000fd5b600082821015611c8657611c86611c5e565b500390565b634e487b7160e01b600052603260045260246000fd5b6000600019821415611cb557611cb5611c5e565b5060010190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060208284031215611d0357600080fd5b815161189a81611a35565b600080600060608486031215611d2357600080fd5b8351925060208401519150604084015190509250925092565b600060208284031215611d4e57600080fd5b815161189a81611bfa565b60008219821115611d6c57611d6c611c5e565b500190565b6000816000190483118215151615611d8b57611d8b611c5e565b500290565b600082611dad57634e487b7160e01b600052601260045260246000fd5b500490565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611e025784516001600160a01b031683529383019391830191600101611ddd565b50506001600160a01b0396909616606085015250505060800152939250505056fea26469706673582212209365b7b56409713892a426a9eccd5d91dade82a48575391a3d6acc4fada7a59764736f6c634300080c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 2,205 |
0x58aef027e67396d9a93cd0b7214f186a3b3c70b6
|
/**
*Submitted for verification at Etherscan.io on 2021-12-14
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
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);
}
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);
}
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
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() {
_owner = address(0x4D2Ff3F55AC9b3A9A9f3766F0D534A75F31c3031);
emit OwnershipTransferred(address(0), _owner);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(
newOwner != address(0),
"Ownable: new owner is the zero address"
);
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
contract MoonDoge is Ownable, IERC20, IERC20Metadata {
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**
* @dev Sets the values for {name} and {symbol}.
*
* The defaut 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 () {
_name = 'MooMEGRAMUS 1 Roof Relief TokennDoge';
_symbol = 'MGR';
_totalSupply= 111111111111111 *(10**decimals());
_balances[owner()]=_totalSupply;
emit Transfer(address(0),owner(),_totalSupply);
}
/**
* @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 9;
}
/**
* @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");
_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");
_approve(_msgSender(), spender, currentAllowance - subtractedValue);
return true;
}
/**
* @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);
uint256 senderBalance = _balances[sender];
require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
_balances[sender] = senderBalance - amount;
_balances[recipient] += 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) 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 mint(address account, uint256 amount) public onlyOwner{
_mint( 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) public onlyOwner {
_burn( 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);
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
_balances[account] = accountBalance - amount;
_totalSupply -= amount;
emit Transfer(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 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].
*/
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
}
|
0x608060405234801561001057600080fd5b50600436106101005760003560e01c8063715018a611610097578063a9059cbb11610066578063a9059cbb14610209578063cc16f5db1461021c578063dd62ed3e1461022f578063f2fde38b1461026857600080fd5b8063715018a6146101cb5780638da5cb5b146101d357806395d89b41146101ee578063a457c2d7146101f657600080fd5b8063313ce567116100d3578063313ce5671461016b578063395093511461017a57806340c10f191461018d57806370a08231146101a257600080fd5b806306fdde0314610105578063095ea7b31461012357806318160ddd1461014657806323b872dd14610158575b600080fd5b61010d61027b565b60405161011a9190610c93565b60405180910390f35b610136610131366004610c69565b61030d565b604051901515815260200161011a565b6003545b60405190815260200161011a565b610136610166366004610c2d565b610323565b6040516009815260200161011a565b610136610188366004610c69565b6103d9565b6101a061019b366004610c69565b610410565b005b61014a6101b0366004610bd8565b6001600160a01b031660009081526001602052604090205490565b6101a0610448565b6000546040516001600160a01b03909116815260200161011a565b61010d6104bc565b610136610204366004610c69565b6104cb565b610136610217366004610c69565b610566565b6101a061022a366004610c69565b610573565b61014a61023d366004610bfa565b6001600160a01b03918216600090815260026020908152604080832093909416825291909152205490565b6101a0610276366004610bd8565b6105a7565b60606004805461028a90610d4c565b80601f01602080910402602001604051908101604052809291908181526020018280546102b690610d4c565b80156103035780601f106102d857610100808354040283529160200191610303565b820191906000526020600020905b8154815290600101906020018083116102e657829003601f168201915b5050505050905090565b600061031a338484610691565b50600192915050565b60006103308484846107b6565b6001600160a01b0384166000908152600260209081526040808320338452909152902054828110156103ba5760405162461bcd60e51b815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616044820152676c6c6f77616e636560c01b60648201526084015b60405180910390fd5b6103ce85336103c98685610d35565b610691565b506001949350505050565b3360008181526002602090815260408083206001600160a01b0387168452909152812054909161031a9185906103c9908690610d1d565b6000546001600160a01b0316331461043a5760405162461bcd60e51b81526004016103b190610ce8565b610444828261098e565b5050565b6000546001600160a01b031633146104725760405162461bcd60e51b81526004016103b190610ce8565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b60606005805461028a90610d4c565b3360009081526002602090815260408083206001600160a01b03861684529091528120548281101561054d5760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b60648201526084016103b1565b61055c33856103c98685610d35565b5060019392505050565b600061031a3384846107b6565b6000546001600160a01b0316331461059d5760405162461bcd60e51b81526004016103b190610ce8565b6104448282610a6d565b6000546001600160a01b031633146105d15760405162461bcd60e51b81526004016103b190610ce8565b6001600160a01b0381166106365760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016103b1565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b0383166106f35760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016103b1565b6001600160a01b0382166107545760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016103b1565b6001600160a01b0383811660008181526002602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b6001600160a01b03831661081a5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016103b1565b6001600160a01b03821661087c5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016103b1565b6001600160a01b038316600090815260016020526040902054818110156108f45760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b60648201526084016103b1565b6108fe8282610d35565b6001600160a01b038086166000908152600160205260408082209390935590851681529081208054849290610934908490610d1d565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161098091815260200190565b60405180910390a350505050565b6001600160a01b0382166109e45760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f20616464726573730060448201526064016103b1565b80600360008282546109f69190610d1d565b90915550506001600160a01b03821660009081526001602052604081208054839290610a23908490610d1d565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b6001600160a01b038216610acd5760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b60648201526084016103b1565b6001600160a01b03821660009081526001602052604090205481811015610b415760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b60648201526084016103b1565b610b4b8282610d35565b6001600160a01b03841660009081526001602052604081209190915560038054849290610b79908490610d35565b90915550506040518281526000906001600160a01b038516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906020016107a9565b80356001600160a01b0381168114610bd357600080fd5b919050565b600060208284031215610bea57600080fd5b610bf382610bbc565b9392505050565b60008060408385031215610c0d57600080fd5b610c1683610bbc565b9150610c2460208401610bbc565b90509250929050565b600080600060608486031215610c4257600080fd5b610c4b84610bbc565b9250610c5960208501610bbc565b9150604084013590509250925092565b60008060408385031215610c7c57600080fd5b610c8583610bbc565b946020939093013593505050565b600060208083528351808285015260005b81811015610cc057858101830151858201604001528201610ca4565b81811115610cd2576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60008219821115610d3057610d30610d87565b500190565b600082821015610d4757610d47610d87565b500390565b600181811c90821680610d6057607f821691505b60208210811415610d8157634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fdfea26469706673582212200f7344f48400d348c75e86bed49244aef2f1d2eff2197c145f505c031ddbd49d64736f6c63430008070033
|
{"success": true, "error": null, "results": {}}
| 2,206 |
0x8adfe445750937cefe42d9fb428563d61ea1aa02
|
pragma solidity ^0.4.25;
/*
* Hubii Nahmii
*
* Compliant with the Hubii Nahmii specification v0.12.
*
* Copyright (C) 2017-2018 Hubii AS
*/
/**
* @title Modifiable
* @notice A contract with basic modifiers
*/
contract Modifiable {
//
// Modifiers
// -----------------------------------------------------------------------------------------------------------------
modifier notNullAddress(address _address) {
require(_address != address(0));
_;
}
modifier notThisAddress(address _address) {
require(_address != address(this));
_;
}
modifier notNullOrThisAddress(address _address) {
require(_address != address(0));
require(_address != address(this));
_;
}
modifier notSameAddresses(address _address1, address _address2) {
if (_address1 != _address2)
_;
}
}
/*
* Hubii Nahmii
*
* Compliant with the Hubii Nahmii specification v0.12.
*
* Copyright (C) 2017-2018 Hubii AS
*/
/**
* @title SelfDestructible
* @notice Contract that allows for self-destruction
*/
contract SelfDestructible {
//
// Variables
// -----------------------------------------------------------------------------------------------------------------
bool public selfDestructionDisabled;
//
// Events
// -----------------------------------------------------------------------------------------------------------------
event SelfDestructionDisabledEvent(address wallet);
event TriggerSelfDestructionEvent(address wallet);
//
// Functions
// -----------------------------------------------------------------------------------------------------------------
/// @notice Get the address of the destructor role
function destructor()
public
view
returns (address);
/// @notice Disable self-destruction of this contract
/// @dev This operation can not be undone
function disableSelfDestruction()
public
{
// Require that sender is the assigned destructor
require(destructor() == msg.sender);
// Disable self-destruction
selfDestructionDisabled = true;
// Emit event
emit SelfDestructionDisabledEvent(msg.sender);
}
/// @notice Destroy this contract
function triggerSelfDestruction()
public
{
// Require that sender is the assigned destructor
require(destructor() == msg.sender);
// Require that self-destruction has not been disabled
require(!selfDestructionDisabled);
// Emit event
emit TriggerSelfDestructionEvent(msg.sender);
// Self-destruct and reward destructor
selfdestruct(msg.sender);
}
}
/*
* Hubii Nahmii
*
* Compliant with the Hubii Nahmii specification v0.12.
*
* Copyright (C) 2017-2018 Hubii AS
*/
/**
* @title Ownable
* @notice A modifiable that has ownership roles
*/
contract Ownable is Modifiable, SelfDestructible {
//
// Variables
// -----------------------------------------------------------------------------------------------------------------
address public deployer;
address public operator;
//
// Events
// -----------------------------------------------------------------------------------------------------------------
event SetDeployerEvent(address oldDeployer, address newDeployer);
event SetOperatorEvent(address oldOperator, address newOperator);
//
// Constructor
// -----------------------------------------------------------------------------------------------------------------
constructor(address _deployer) internal notNullOrThisAddress(_deployer) {
deployer = _deployer;
operator = _deployer;
}
//
// Functions
// -----------------------------------------------------------------------------------------------------------------
/// @notice Return the address that is able to initiate self-destruction
function destructor()
public
view
returns (address)
{
return deployer;
}
/// @notice Set the deployer of this contract
/// @param newDeployer The address of the new deployer
function setDeployer(address newDeployer)
public
onlyDeployer
notNullOrThisAddress(newDeployer)
{
if (newDeployer != deployer) {
// Set new deployer
address oldDeployer = deployer;
deployer = newDeployer;
// Emit event
emit SetDeployerEvent(oldDeployer, newDeployer);
}
}
/// @notice Set the operator of this contract
/// @param newOperator The address of the new operator
function setOperator(address newOperator)
public
onlyOperator
notNullOrThisAddress(newOperator)
{
if (newOperator != operator) {
// Set new operator
address oldOperator = operator;
operator = newOperator;
// Emit event
emit SetOperatorEvent(oldOperator, newOperator);
}
}
/// @notice Gauge whether message sender is deployer or not
/// @return true if msg.sender is deployer, else false
function isDeployer()
internal
view
returns (bool)
{
return msg.sender == deployer;
}
/// @notice Gauge whether message sender is operator or not
/// @return true if msg.sender is operator, else false
function isOperator()
internal
view
returns (bool)
{
return msg.sender == operator;
}
/// @notice Gauge whether message sender is operator or deployer on the one hand, or none of these on these on
/// on the other hand
/// @return true if msg.sender is operator, else false
function isDeployerOrOperator()
internal
view
returns (bool)
{
return isDeployer() || isOperator();
}
// Modifiers
// -----------------------------------------------------------------------------------------------------------------
modifier onlyDeployer() {
require(isDeployer());
_;
}
modifier notDeployer() {
require(!isDeployer());
_;
}
modifier onlyOperator() {
require(isOperator());
_;
}
modifier notOperator() {
require(!isOperator());
_;
}
modifier onlyDeployerOrOperator() {
require(isDeployerOrOperator());
_;
}
modifier notDeployerOrOperator() {
require(!isDeployerOrOperator());
_;
}
}
/*
* Hubii Nahmii
*
* Compliant with the Hubii Nahmii specification v0.12.
*
* Copyright (C) 2017-2018 Hubii AS
*/
/**
* @title Servable
* @notice An ownable that contains registered services and their actions
*/
contract Servable is Ownable {
//
// Types
// -----------------------------------------------------------------------------------------------------------------
struct ServiceInfo {
bool registered;
uint256 activationTimestamp;
mapping(bytes32 => bool) actionsEnabledMap;
bytes32[] actionsList;
}
//
// Variables
// -----------------------------------------------------------------------------------------------------------------
mapping(address => ServiceInfo) internal registeredServicesMap;
uint256 public serviceActivationTimeout;
//
// Events
// -----------------------------------------------------------------------------------------------------------------
event ServiceActivationTimeoutEvent(uint256 timeoutInSeconds);
event RegisterServiceEvent(address service);
event RegisterServiceDeferredEvent(address service, uint256 timeout);
event DeregisterServiceEvent(address service);
event EnableServiceActionEvent(address service, string action);
event DisableServiceActionEvent(address service, string action);
//
// Functions
// -----------------------------------------------------------------------------------------------------------------
/// @notice Set the service activation timeout
/// @param timeoutInSeconds The set timeout in unit of seconds
function setServiceActivationTimeout(uint256 timeoutInSeconds)
public
onlyDeployer
{
serviceActivationTimeout = timeoutInSeconds;
// Emit event
emit ServiceActivationTimeoutEvent(timeoutInSeconds);
}
/// @notice Register a service contract whose activation is immediate
/// @param service The address of the service contract to be registered
function registerService(address service)
public
onlyDeployer
notNullOrThisAddress(service)
{
_registerService(service, 0);
// Emit event
emit RegisterServiceEvent(service);
}
/// @notice Register a service contract whose activation is deferred by the service activation timeout
/// @param service The address of the service contract to be registered
function registerServiceDeferred(address service)
public
onlyDeployer
notNullOrThisAddress(service)
{
_registerService(service, serviceActivationTimeout);
// Emit event
emit RegisterServiceDeferredEvent(service, serviceActivationTimeout);
}
/// @notice Deregister a service contract
/// @param service The address of the service contract to be deregistered
function deregisterService(address service)
public
onlyDeployer
notNullOrThisAddress(service)
{
require(registeredServicesMap[service].registered);
registeredServicesMap[service].registered = false;
// Emit event
emit DeregisterServiceEvent(service);
}
/// @notice Enable a named action in an already registered service contract
/// @param service The address of the registered service contract
/// @param action The name of the action to be enabled
function enableServiceAction(address service, string action)
public
onlyDeployer
notNullOrThisAddress(service)
{
require(registeredServicesMap[service].registered);
bytes32 actionHash = hashString(action);
require(!registeredServicesMap[service].actionsEnabledMap[actionHash]);
registeredServicesMap[service].actionsEnabledMap[actionHash] = true;
registeredServicesMap[service].actionsList.push(actionHash);
// Emit event
emit EnableServiceActionEvent(service, action);
}
/// @notice Enable a named action in a service contract
/// @param service The address of the service contract
/// @param action The name of the action to be disabled
function disableServiceAction(address service, string action)
public
onlyDeployer
notNullOrThisAddress(service)
{
bytes32 actionHash = hashString(action);
require(registeredServicesMap[service].actionsEnabledMap[actionHash]);
registeredServicesMap[service].actionsEnabledMap[actionHash] = false;
// Emit event
emit DisableServiceActionEvent(service, action);
}
/// @notice Gauge whether a service contract is registered
/// @param service The address of the service contract
/// @return true if service is registered, else false
function isRegisteredService(address service)
public
view
returns (bool)
{
return registeredServicesMap[service].registered;
}
/// @notice Gauge whether a service contract is registered and active
/// @param service The address of the service contract
/// @return true if service is registered and activate, else false
function isRegisteredActiveService(address service)
public
view
returns (bool)
{
return isRegisteredService(service) && block.timestamp >= registeredServicesMap[service].activationTimestamp;
}
/// @notice Gauge whether a service contract action is enabled which implies also registered and active
/// @param service The address of the service contract
/// @param action The name of action
function isEnabledServiceAction(address service, string action)
public
view
returns (bool)
{
bytes32 actionHash = hashString(action);
return isRegisteredActiveService(service) && registeredServicesMap[service].actionsEnabledMap[actionHash];
}
//
// Internal functions
// -----------------------------------------------------------------------------------------------------------------
function hashString(string _string)
internal
pure
returns (bytes32)
{
return keccak256(abi.encodePacked(_string));
}
//
// Private functions
// -----------------------------------------------------------------------------------------------------------------
function _registerService(address service, uint256 timeout)
private
{
if (!registeredServicesMap[service].registered) {
registeredServicesMap[service].registered = true;
registeredServicesMap[service].activationTimestamp = block.timestamp + timeout;
}
}
//
// Modifiers
// -----------------------------------------------------------------------------------------------------------------
modifier onlyActiveService() {
require(isRegisteredActiveService(msg.sender));
_;
}
modifier onlyEnabledServiceAction(string action) {
require(isEnabledServiceAction(msg.sender, action));
_;
}
}
/*
* Hubii Nahmii
*
* Compliant with the Hubii Nahmii specification v0.12.
*
* Copyright (C) 2017-2018 Hubii AS
*/
/**
* @title Transaction tracker
* @notice An ownable to track transactions of generic types
*/
contract TransactionTracker is Ownable, Servable {
//
// Structures
// -----------------------------------------------------------------------------------------------------------------
struct TransactionRecord {
int256 value;
uint256 blockNumber;
address currencyCt;
uint256 currencyId;
}
struct TransactionLog {
TransactionRecord[] records;
mapping(address => mapping(uint256 => uint256[])) recordIndicesByCurrency;
}
//
// Constants
// -----------------------------------------------------------------------------------------------------------------
string constant public DEPOSIT_TRANSACTION_TYPE = "deposit";
string constant public WITHDRAWAL_TRANSACTION_TYPE = "withdrawal";
//
// Variables
// -----------------------------------------------------------------------------------------------------------------
bytes32 public depositTransactionType;
bytes32 public withdrawalTransactionType;
mapping(address => mapping(bytes32 => TransactionLog)) private transactionLogByWalletType;
//
// Constructor
// -----------------------------------------------------------------------------------------------------------------
constructor(address deployer) Ownable(deployer)
public
{
depositTransactionType = keccak256(abi.encodePacked(DEPOSIT_TRANSACTION_TYPE));
withdrawalTransactionType = keccak256(abi.encodePacked(WITHDRAWAL_TRANSACTION_TYPE));
}
//
// Functions
// -----------------------------------------------------------------------------------------------------------------
/// @notice Add a transaction record of the given wallet, type, value and currency
/// @param wallet The address of the concerned wallet
/// @param _type The transaction type
/// @param value The concerned value (amount of fungible, id of non-fungible)
/// @param currencyCt The address of the concerned currency contract (address(0) == ETH)
/// @param currencyId The ID of the concerned currency (0 for ETH and ERC20)
function add(address wallet, bytes32 _type, int256 value, address currencyCt,
uint256 currencyId)
public
onlyActiveService
{
transactionLogByWalletType[wallet][_type].records.length++;
uint256 index = transactionLogByWalletType[wallet][_type].records.length - 1;
transactionLogByWalletType[wallet][_type].records[index].value = value;
transactionLogByWalletType[wallet][_type].records[index].blockNumber = block.number;
transactionLogByWalletType[wallet][_type].records[index].currencyCt = currencyCt;
transactionLogByWalletType[wallet][_type].records[index].currencyId = currencyId;
transactionLogByWalletType[wallet][_type].recordIndicesByCurrency[currencyCt][currencyId].push(index);
}
/// @notice Get the number of transaction records for the given wallet and type
/// @param wallet The address of the concerned wallet
/// @param _type The transaction type
/// @return The count of transaction records
function count(address wallet, bytes32 _type)
public
view
returns (uint256)
{
return transactionLogByWalletType[wallet][_type].records.length;
}
/// @notice Get the transaction record for the given wallet and type by the given index
/// @param wallet The address of the concerned wallet
/// @param _type The transaction type
/// @param index The concerned log index
/// @return The transaction record
function getByIndex(address wallet, bytes32 _type, uint256 index)
public
view
returns (int256 value, uint256 blockNumber, address currencyCt, uint256 currencyId)
{
TransactionRecord storage entry = transactionLogByWalletType[wallet][_type].records[index];
value = entry.value;
blockNumber = entry.blockNumber;
currencyCt = entry.currencyCt;
currencyId = entry.currencyId;
}
/// @notice Get the transaction record for the given wallet and type by the given block number
/// @param wallet The address of the concerned wallet
/// @param _type The transaction type
/// @param _blockNumber The concerned block number
/// @return The transaction record
function getByBlockNumber(address wallet, bytes32 _type, uint256 _blockNumber)
public
view
returns (int256 value, uint256 blockNumber, address currencyCt, uint256 currencyId)
{
return getByIndex(wallet, _type, _indexByBlockNumber(wallet, _type, _blockNumber));
}
/// @notice Get the number of transaction records for the given wallet, type and currency
/// @param wallet The address of the concerned wallet
/// @param _type The transaction type
/// @param currencyCt The address of the concerned currency contract (address(0) == ETH)
/// @param currencyId The ID of the concerned currency (0 for ETH and ERC20)
/// @return The count of transaction records
function countByCurrency(address wallet, bytes32 _type, address currencyCt,
uint256 currencyId)
public
view
returns (uint256)
{
return transactionLogByWalletType[wallet][_type].recordIndicesByCurrency[currencyCt][currencyId].length;
}
/// @notice Get the transaction record for the given wallet, type and currency by the given index
/// @param wallet The address of the concerned wallet
/// @param _type The transaction type
/// @param index The concerned log index
/// @return The transaction record
function getByCurrencyIndex(address wallet, bytes32 _type, address currencyCt,
uint256 currencyId, uint256 index)
public
view
returns (int256 value, uint256 blockNumber)
{
uint256 entryIndex = transactionLogByWalletType[wallet][_type].recordIndicesByCurrency[currencyCt][currencyId][index];
TransactionRecord storage entry = transactionLogByWalletType[wallet][_type].records[entryIndex];
value = entry.value;
blockNumber = entry.blockNumber;
}
/// @notice Get the transaction record for the given wallet, type and currency by the given block number
/// @param wallet The address of the concerned wallet
/// @param _type The transaction type
/// @param _blockNumber The concerned block number
/// @return The transaction record
function getByCurrencyBlockNumber(address wallet, bytes32 _type, address currencyCt,
uint256 currencyId, uint256 _blockNumber)
public
view
returns (int256 value, uint256 blockNumber)
{
return getByCurrencyIndex(
wallet, _type, currencyCt, currencyId,
_indexByCurrencyBlockNumber(
wallet, _type, currencyCt, currencyId, _blockNumber
)
);
}
//
// Private functions
// -----------------------------------------------------------------------------------------------------------------
function _indexByBlockNumber(address wallet, bytes32 _type, uint256 blockNumber)
private
view
returns (uint256)
{
require(0 < transactionLogByWalletType[wallet][_type].records.length);
for (uint256 i = transactionLogByWalletType[wallet][_type].records.length - 1; i >= 0; i--)
if (blockNumber >= transactionLogByWalletType[wallet][_type].records[i].blockNumber)
return i;
revert();
}
function _indexByCurrencyBlockNumber(address wallet, bytes32 _type, address currencyCt,
uint256 currencyId, uint256 blockNumber)
private
view
returns (uint256)
{
require(0 < transactionLogByWalletType[wallet][_type].recordIndicesByCurrency[currencyCt][currencyId].length);
for (uint256 i = transactionLogByWalletType[wallet][_type].recordIndicesByCurrency[currencyCt][currencyId].length - 1; i >= 0; i--) {
uint256 j = transactionLogByWalletType[wallet][_type].recordIndicesByCurrency[currencyCt][currencyId][i];
if (blockNumber >= transactionLogByWalletType[wallet][_type].records[j].blockNumber)
return j;
}
revert();
}
}
|
0x60806040526004361061015b5763ffffffff60e060020a6000350416630545cae4811461016057806317ba3f90146101aa5780632738a112146101df5780632b5672e3146101f65780632b91e0a91461025d5780632f013a001461027e578063313004a9146102935780633b58c501146102ba5780633b7bea6c146103215780634476d23b146103365780634aa068421461036757806350b08c02146103bc578063570ca735146103dd5780635df1b0a3146103f25780636cc56e5a1461045957806370327ea1146104e35780637e15dd5c146104f85780638e8cef1214610510578063962147351461053157806397bb0bc9146105525780639cab96d6146105805780639de6301d146105b2578063ac0fc3ef146105e3578063b3ab15fb1461060a578063bb6be2211461062b578063bde440cb14610640578063d185dd4e14610655578063d5f3948814610679578063fdd9ec7d1461068e575b600080fd5b34801561016c57600080fd5b50610191600160a060020a0360043581169060243590604435166064356084356106af565b6040805192835260208301919091528051918290030190f35b3480156101b657600080fd5b506101cb600160a060020a03600435166106d9565b604080519115158252519081900360200190f35b3480156101eb57600080fd5b506101f4610711565b005b34801561020257600080fd5b5060408051602060046024803582810135601f81018590048502860185019096528585526101f4958335600160a060020a03169536956044949193909101919081908401838280828437509497506107739650505050505050565b34801561026957600080fd5b506101cb600160a060020a036004351661090e565b34801561028a57600080fd5b506101cb61092c565b34801561029f57600080fd5b506102a8610935565b60408051918252519081900360200190f35b3480156102c657600080fd5b5060408051602060046024803582810135601f81018590048502860185019096528585526101f4958335600160a060020a031695369560449491939091019190819084018382808284375094975061093b9650505050505050565b34801561032d57600080fd5b506102a8610a50565b34801561034257600080fd5b5061034b610a56565b60408051600160a060020a039092168252519081900360200190f35b34801561037357600080fd5b5061038e600160a060020a0360043516602435604435610a6b565b604080519485526020850193909352600160a060020a03909116838301526060830152519081900360800190f35b3480156103c857600080fd5b506101f4600160a060020a0360043516610a97565b3480156103e957600080fd5b5061034b610b56565b3480156103fe57600080fd5b5060408051602060046024803582810135601f81018590048502860185019096528585526101cb958335600160a060020a0316953695604494919390910191908190840183828082843750949750610b659650505050505050565b34801561046557600080fd5b5061046e610bb5565b6040805160208082528351818301528351919283929083019185019080838360005b838110156104a8578181015183820152602001610490565b50505050905090810190601f1680156104d55780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156104ef57600080fd5b506101f4610bd9565b34801561050457600080fd5b506101f4600435610c37565b34801561051c57600080fd5b506101f4600160a060020a0360043516610c85565b34801561053d57600080fd5b506101f4600160a060020a0360043516610d1b565b34801561055e57600080fd5b506102a8600160a060020a036004358116906024359060443516606435610de7565b34801561058c57600080fd5b506101f4600160a060020a03600435811690602435906044359060643516608435610e28565b3480156105be57600080fd5b50610191600160a060020a036004358116906024359060443516606435608435610fe9565b3480156105ef57600080fd5b5061038e600160a060020a036004351660243560443561109c565b34801561061657600080fd5b506101f4600160a060020a0360043516611111565b34801561063757600080fd5b5061046e6111ce565b34801561064c57600080fd5b506102a86111f5565b34801561066157600080fd5b506102a8600160a060020a03600435166024356111fb565b34801561068557600080fd5b5061034b611223565b34801561069a57600080fd5b506101f4600160a060020a0360043516611237565b6000806106cb878787876106c68c8c8c8c8c6112c1565b610fe9565b915091509550959350505050565b60006106e48261090e565b801561070b5750600160a060020a0382166000908152600260205260409020600101544210155b92915050565b3361071a610a56565b600160a060020a03161461072d57600080fd5b60005460ff161561073d57600080fd5b6040805133815290517f787a5d936e74f4b564b9153575886059829c78cd9927b1be5e0d976b317ef7369181900360200190a133ff5b600061077d61140e565b151561078857600080fd5b82600160a060020a038116151561079e57600080fd5b600160a060020a0381163014156107b457600080fd5b600160a060020a03841660009081526002602052604090205460ff1615156107db57600080fd5b6107e483611424565b600160a060020a0385166000908152600260208181526040808420858552909201905290205490925060ff161561081a57600080fd5b600160a060020a03841660008181526002602081815260408084208785528084018352818520805460ff19166001908117909155938352600301805493840181558452818420909201869055815193845283810182815287519285019290925286517fec1b982d69bfc1a6fd8becf191d9a633486c822d3bdedd52303ca81fa635750194899489949193919260608501928601918190849084905b838110156108cd5781810151838201526020016108b5565b50505050905090810190601f1680156108fa5780820380516001836020036101000a031916815260200191505b50935050505060405180910390a150505050565b600160a060020a031660009081526002602052604090205460ff1690565b60005460ff1681565b60045481565b600061094561140e565b151561095057600080fd5b82600160a060020a038116151561096657600080fd5b600160a060020a03811630141561097c57600080fd5b61098583611424565b600160a060020a0385166000908152600260208181526040808420858552909201905290205490925060ff1615156109bc57600080fd5b600160a060020a03841660008181526002602081815260408084208785529092018152818320805460ff19169055815193845283810182815287519285019290925286517f92f4af6130f47c92f3899e06611c8c6ef191fb81207ad2675d134af619d2fe7d9489948994919391926060850192860191819084908490838110156108cd5781810151838201526020016108b5565b60035481565b6000546101009004600160a060020a03165b90565b600080600080610a868787610a818a8a8a6114ee565b61109c565b935093509350935093509350935093565b610a9f61140e565b1515610aaa57600080fd5b80600160a060020a0381161515610ac057600080fd5b600160a060020a038116301415610ad657600080fd5b600160a060020a03821660009081526002602052604090205460ff161515610afd57600080fd5b600160a060020a038216600081815260026020908152604091829020805460ff19169055815192835290517f777645c5437dfbf962f57a281ead25f3d513f2f8e938685bbfc1738e81c9880e9281900390910190a15050565b600154600160a060020a031681565b600080610b7183611424565b9050610b7c846106d9565b8015610bad5750600160a060020a0384166000908152600260208181526040808420858552909201905290205460ff165b949350505050565b604080518082019091526007815260ca60020a6619195c1bdcda5d02602082015281565b33610be2610a56565b600160a060020a031614610bf557600080fd5b6000805460ff191660011790556040805133815290517fd5a2a04a775c741c2ca0dc46ea7ce4835190e1aaf1ca018def0e82568ec336169181900360200190a1565b610c3f61140e565b1515610c4a57600080fd5b60038190556040805182815290517f4f1d324a1cbffc352fb64f1d73d95e4b200d92f99ef39bf2d7f5b41f946909d69181900360200190a150565b610c8d61140e565b1515610c9857600080fd5b80600160a060020a0381161515610cae57600080fd5b600160a060020a038116301415610cc457600080fd5b610cd0826003546115b3565b60035460408051600160a060020a0385168152602081019290925280517f7f3a8349917003ed377f6e9ae1608b92edd893903f8983bd274b1f8373dd3b119281900390910190a15050565b6000610d2561140e565b1515610d3057600080fd5b81600160a060020a0381161515610d4657600080fd5b600160a060020a038116301415610d5c57600080fd5b600054600160a060020a038481166101009092041614610de25760008054600160a060020a0385811661010081810261010060a860020a0319851617909455604080519490930491909116808452602084019190915281519094507f977e5fa58e458501775e0008d275006294c5249e3c08d1d0e3a9f3acad14f6e49281900390910190a15b505050565b600160a060020a0393841660009081526006602090815260408083209583529481528482209390951681526001909201845282822090825290925290205490565b6000610e33336106d9565b1515610e3e57600080fd5b600160a060020a03861660009081526006602090815260408083208884529091529020805490610e719060018301611616565b5050600160a060020a038516600090815260066020908152604080832087845290915290208054600019810191859183908110610eaa57fe5b60009182526020808320600490920290910192909255600160a060020a038816815260068252604080822088835290925220805443919083908110610eeb57fe5b6000918252602080832060016004909302019190910192909255600160a060020a038816815260068252604080822088835290925220805484919083908110610f3057fe5b600091825260208083206004929092029091016002018054600160a060020a031916600160a060020a03948516179055918816815260068252604080822088835290925220805483919083908110610f8457fe5b6000918252602080832060036004909302019190910192909255600160a060020a039788168152600682526040808220978252968252868120949097168752600193840181528587209287529182529385208054928301815585529093209092015550565b600160a060020a038086166000908152600660209081526040808320888452825280832093871683526001909301815282822085835290529081208054829182918291908690811061103757fe5b6000918252602080832090910154600160a060020a038c1683526006825260408084208c855290925291208054919350908390811061107257fe5b90600052602060002090600402019050806000015493508060010154925050509550959350505050565b600160a060020a0383166000908152600660209081526040808320858452909152812080548291829182918291879081106110d357fe5b60009182526020909120600490910201805460018201546002830154600390930154919b909a50600160a060020a0390921698509650945050505050565b600061111b611605565b151561112657600080fd5b81600160a060020a038116151561113c57600080fd5b600160a060020a03811630141561115257600080fd5b600154600160a060020a03848116911614610de25760018054600160a060020a03858116600160a060020a0319831681179093556040805191909216808252602082019390935281519294507f9f611b789425d0d5b90b920f1b2852907dd865c80074a30b1629aaa041d1812c929081900390910190a1505050565b60408051808201909152600a815260b260020a691dda5d1a191c985dd85b02602082015281565b60055481565b600160a060020a03919091166000908152600660209081526040808320938352929052205490565b6000546101009004600160a060020a031681565b61123f61140e565b151561124a57600080fd5b80600160a060020a038116151561126057600080fd5b600160a060020a03811630141561127657600080fd5b6112818260006115b3565b60408051600160a060020a038416815290517fb619d545cb511bd5f02907a1eac4f4cb8dace7b1846852fb0bf5e553937481c19181900360200190a15050565b600160a060020a038086166000908152600660209081526040808320888452825280832093871683526001909301815282822085835290529081205481908190811061130c57600080fd5b600160a060020a0388811660009081526006602090815260408083208b84528252808320938a16835260019093018152828220888352905220546000190191505b6000821061015b57600160a060020a0380891660009081526006602090815260408083208b84528252808320938a1683526001909301815282822088835290522080548390811061139a57fe5b6000918252602080832090910154600160a060020a038b1683526006825260408084208b85529092529120805491925090829081106113d557fe5b906000526020600020906004020160010154841015156113f757809250611403565b6000199091019061134d565b505095945050505050565b6000546101009004600160a060020a0316331490565b6000816040516020018082805190602001908083835b602083106114595780518252601f19909201916020918201910161143a565b6001836020036101000a0380198251168184511680821785525050505050509050019150506040516020818303038152906040526040518082805190602001908083835b602083106114bc5780518252601f19909201916020918201910161149d565b5181516020939093036101000a6000190180199091169216919091179052604051920182900390912095945050505050565b600160a060020a03831660009081526006602090815260408083208584529091528120548190811061151f57600080fd5b50600160a060020a0384166000908152600660209081526040808320868452909152902054600019015b6000811061015b57600160a060020a0385166000908152600660209081526040808320878452909152902080548290811061158057fe5b906000526020600020906004020160010154831015156115a2578091506115ab565b60001901611549565b509392505050565b600160a060020a03821660009081526002602052604090205460ff16151561160157600160a060020a0382166000908152600260205260409020805460ff1916600190811782554283019101555b5050565b600154600160a060020a0316331490565b815481835581811115610de257600083815260209020610de291610a689160049182028101918502015b8082111561167357600080825560018201819055600282018054600160a060020a03191690556003820155600401611640565b50905600a165627a7a72305820ae54f0932d893b5fdd8fefbdbe09853515701d34b33260eb8385f33c795eb7a90029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "tautology", "impact": "Medium", "confidence": "High"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}}
| 2,207 |
0xc85d3c8382760dfcaac7442a6c53bf0c6d886f75
|
pragma solidity ^0.4.18;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) public constant returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public constant returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
// 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];
}
}
/**
* @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 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);
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);
}
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
function () public payable {
revert();
}
}
/**
* @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) onlyOwner public {
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
contract MintableToken is StandardToken, Ownable {
event Mint(address indexed to, uint256 amount);
event MintFinished();
uint256 public amount = 10000000000000000000;
address public saleAgent;
string public name = "Marketing";
string public symbol = "MRKT";
uint32 public constant decimals = 18;
bool public canTransfer = false;
modifier notLocked() {
require(canTransfer);
_;
}
function setCanTransfer(bool newCanTransfer) public {
require(msg.sender == saleAgent || msg.sender == owner);
canTransfer = newCanTransfer;
}
function setSymbol(string newSymbol) public {
require(msg.sender == saleAgent || msg.sender == owner);
symbol = newSymbol;
}
function setName(string newName) public {
require(msg.sender == saleAgent || msg.sender == owner);
name = newName;
}
function setAmount(uint newAmount) public {
require(msg.sender == saleAgent || msg.sender == owner);
amount = newAmount;
}
function setSaleAgent(address newSaleAgnet) public {
require(msg.sender == saleAgent || msg.sender == owner);
saleAgent = newSaleAgnet;
}
function mint(address _to, uint256 _amount) public returns (bool) {
require(msg.sender == saleAgent || msg.sender == owner);
totalSupply = totalSupply.add(_amount);
balances[_to] = balances[_to].add(_amount);
Mint(_to, _amount);
return true;
}
function mintSeq(address[] receivers) public returns (bool) {
require(msg.sender == saleAgent || msg.sender == owner);
for(uint i = 0; i < receivers.length; i++) {
totalSupply = totalSupply.add(amount);
balances[receivers[i]] = balances[receivers[i]].add(amount);
Transfer(address(this), receivers[i], amount);
}
}
function transfer(address _to, uint256 _value) public notLocked returns (bool) {
return super.transfer(_to, _value);
}
function transferFrom(address from, address to, uint256 value) public notLocked returns (bool) {
return super.transferFrom(from, to, value);
}
}
|
0x6060604052600436106101325763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde038114610137578063095ea7b3146101c157806314133a7c146101f757806318160ddd1461021857806323b872dd1461023d578063271f88b414610265578063313ce5671461027b57806340c10f19146102a757806366188463146102c957806370a08231146102eb57806374f0765a1461030a57806375ae267d146103595780638da5cb5b1461037157806395d89b41146103a0578063a9059cbb146103b3578063aa8c217c146103d5578063b1d6a2f0146103e8578063b84c8246146103fb578063c47f00271461044c578063d73dd6231461049d578063dd62ed3e146104bf578063df68c1a2146104e4578063f2fde38b146104f7575b600080fd5b341561014257600080fd5b61014a610516565b60405160208082528190810183818151815260200191508051906020019080838360005b8381101561018657808201518382015260200161016e565b50505050905090810190601f1680156101b35780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101cc57600080fd5b6101e3600160a060020a03600435166024356105b4565b604051901515815260200160405180910390f35b341561020257600080fd5b610216600160a060020a0360043516610620565b005b341561022357600080fd5b61022b610685565b60405190815260200160405180910390f35b341561024857600080fd5b6101e3600160a060020a036004358116906024351660443561068b565b341561027057600080fd5b6102166004356106b2565b341561028657600080fd5b61028e6106ed565b60405163ffffffff909116815260200160405180910390f35b34156102b257600080fd5b6101e3600160a060020a03600435166024356106f2565b34156102d457600080fd5b6101e3600160a060020a03600435166024356107c4565b34156102f657600080fd5b61022b600160a060020a03600435166108be565b341561031557600080fd5b6101e360046024813581810190830135806020818102016040519081016040528093929190818152602001838360200280828437509496506108d995505050505050565b341561036457600080fd5b6102166004351515610a22565b341561037c57600080fd5b610384610a6b565b604051600160a060020a03909116815260200160405180910390f35b34156103ab57600080fd5b61014a610a7a565b34156103be57600080fd5b6101e3600160a060020a0360043516602435610ae5565b34156103e057600080fd5b61022b610b0a565b34156103f357600080fd5b610384610b10565b341561040657600080fd5b61021660046024813581810190830135806020601f82018190048102016040519081016040528181529291906020840183838082843750949650610b1f95505050505050565b341561045757600080fd5b61021660046024813581810190830135806020601f82018190048102016040519081016040528181529291906020840183838082843750949650610b6c95505050505050565b34156104a857600080fd5b6101e3600160a060020a0360043516602435610bb5565b34156104ca57600080fd5b61022b600160a060020a0360043581169060243516610c59565b34156104ef57600080fd5b6101e3610c84565b341561050257600080fd5b610216600160a060020a0360043516610c8d565b60068054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156105ac5780601f10610581576101008083540402835291602001916105ac565b820191906000526020600020905b81548152906001019060200180831161058f57829003601f168201915b505050505081565b600160a060020a03338116600081815260026020908152604080832094871680845294909152808220859055909291907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259085905190815260200160405180910390a350600192915050565b60055433600160a060020a039081169116148061064b575060035433600160a060020a039081169116145b151561065657600080fd5b6005805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60005481565b60085460009060ff16151561069f57600080fd5b6106aa848484610d28565b949350505050565b60055433600160a060020a03908116911614806106dd575060035433600160a060020a039081169116145b15156106e857600080fd5b600455565b601281565b60055460009033600160a060020a0390811691161480610720575060035433600160a060020a039081169116145b151561072b57600080fd5b60005461073e908363ffffffff610eaa16565b6000908155600160a060020a038416815260016020526040902054610769908363ffffffff610eaa16565b600160a060020a0384166000818152600160205260409081902092909255907f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d41213968859084905190815260200160405180910390a250600192915050565b600160a060020a0333811660009081526002602090815260408083209386168352929052908120548083111561082157600160a060020a033381166000908152600260209081526040808320938816835292905290812055610858565b610831818463ffffffff610eb916565b600160a060020a033381166000908152600260209081526040808320938916835292905220555b600160a060020a0333811660008181526002602090815260408083209489168084529490915290819020547f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925915190815260200160405180910390a35060019392505050565b600160a060020a031660009081526001602052604090205490565b600554600090819033600160a060020a0390811691161480610909575060035433600160a060020a039081169116145b151561091457600080fd5b5060005b8251811015610a1c576004546000546109369163ffffffff610eaa16565b6000819055506109826004546001600086858151811061095257fe5b90602001906020020151600160a060020a031681526020810191909152604001600020549063ffffffff610eaa16565b6001600085848151811061099257fe5b90602001906020020151600160a060020a031681526020810191909152604001600020558281815181106109c257fe5b90602001906020020151600160a060020a031630600160a060020a03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60045460405190815260200160405180910390a3600101610918565b50919050565b60055433600160a060020a0390811691161480610a4d575060035433600160a060020a039081169116145b1515610a5857600080fd5b6008805460ff1916911515919091179055565b600354600160a060020a031681565b60078054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156105ac5780601f10610581576101008083540402835291602001916105ac565b60085460009060ff161515610af957600080fd5b610b038383610ecb565b9392505050565b60045481565b600554600160a060020a031681565b60055433600160a060020a0390811691161480610b4a575060035433600160a060020a039081169116145b1515610b5557600080fd5b6007818051610b68929160200190610fc6565b5050565b60055433600160a060020a0390811691161480610b97575060035433600160a060020a039081169116145b1515610ba257600080fd5b6006818051610b68929160200190610fc6565b600160a060020a033381166000908152600260209081526040808320938616835292905290812054610bed908363ffffffff610eaa16565b600160a060020a0333811660008181526002602090815260408083209489168084529490915290819020849055919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591905190815260200160405180910390a350600192915050565b600160a060020a03918216600090815260026020908152604080832093909416825291909152205490565b60085460ff1681565b60035433600160a060020a03908116911614610ca857600080fd5b600160a060020a0381161515610cbd57600080fd5b600354600160a060020a0380831691167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36003805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b6000600160a060020a0383161515610d3f57600080fd5b600160a060020a038416600090815260016020526040902054821115610d6457600080fd5b600160a060020a0380851660009081526002602090815260408083203390941683529290522054821115610d9757600080fd5b600160a060020a038416600090815260016020526040902054610dc0908363ffffffff610eb916565b600160a060020a038086166000908152600160205260408082209390935590851681522054610df5908363ffffffff610eaa16565b600160a060020a03808516600090815260016020908152604080832094909455878316825260028152838220339093168252919091522054610e3d908363ffffffff610eb916565b600160a060020a03808616600081815260026020908152604080832033861684529091529081902093909355908516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9085905190815260200160405180910390a35060019392505050565b600082820183811015610b0357fe5b600082821115610ec557fe5b50900390565b6000600160a060020a0383161515610ee257600080fd5b600160a060020a033316600090815260016020526040902054821115610f0757600080fd5b600160a060020a033316600090815260016020526040902054610f30908363ffffffff610eb916565b600160a060020a033381166000908152600160205260408082209390935590851681522054610f65908363ffffffff610eaa16565b600160a060020a0380851660008181526001602052604090819020939093559133909116907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9085905190815260200160405180910390a350600192915050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061100757805160ff1916838001178555611034565b82800160010185558215611034579182015b82811115611034578251825591602001919060010190611019565b50611040929150611044565b5090565b61105e91905b80821115611040576000815560010161104a565b905600a165627a7a7230582028c6b71eac775493bb75c485aa76d6bcb1c0e1ee28c07f08ae3fea2e06e867930029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 2,208 |
0x6500fd98cba4707582b356f4fa6e67998650ae61
|
/**
*Submitted for verification at Etherscan.io on 2022-04-18
*/
// File: contracts/KUYA.sol
// 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 KUYA is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "KUYA";
string private constant _symbol = "KUYA";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1e9 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 6;
uint256 private _taxFeeOnBuy = 5;
uint256 private _redisFeeOnSell = 3;
uint256 private _taxFeeOnSell = 9;
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots;
mapping (address => uint256) public _buyMap;
address payable private _marketingAddress ;
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 15000000 * 10**9;
uint256 public _maxWalletSize = 15000000 * 10**9;
uint256 public _swapTokensAtAmount = 10000000 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
_marketingAddress = payable(_msgSender());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (!tradingOpen) {
require(from == owner(), "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;
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function initContract() external onlyOwner(){
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
}
function setTrading(bool _tradingOpen) public onlyOwner {
require(!tradingOpen);
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
require(taxFeeOnBuy<=_taxFeeOnBuy||taxFeeOnSell<=_taxFeeOnSell);
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) external onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
function toggleSwap(bool _swapEnabled) external onlyOwner{
swapEnabled = _swapEnabled;
}
function setMaxTxnAmount(uint256 maxTxAmount) external onlyOwner {
require(maxTxAmount > 5000000 * 10**9 );
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
}
|
0x6080604052600436106101db5760003560e01c80637d1db4a511610102578063a2a957bb11610095578063c492f04611610064578063c492f0461461053f578063dd62ed3e1461055f578063ea1644d5146105a5578063f2fde38b146105c557600080fd5b8063a2a957bb146104ba578063a9059cbb146104da578063bfd79284146104fa578063c3c8cd801461052a57600080fd5b80638f70ccf7116100d15780638f70ccf7146104645780638f9a55c01461048457806395d89b411461020957806398a5c3151461049a57600080fd5b80637d1db4a5146103ee5780637f2feddc146104045780638203f5fe146104315780638da5cb5b1461044657600080fd5b8063313ce5671161017a5780636fc3eaec116101495780636fc3eaec1461038457806370a0823114610399578063715018a6146103b957806374010ece146103ce57600080fd5b8063313ce5671461030857806349bd5a5e146103245780636b999053146103445780636d8aa8f81461036457600080fd5b80631694505e116101b65780631694505e1461027557806318160ddd146102ad57806323b872dd146102d25780632fd689e3146102f257600080fd5b8062b8cf2a146101e757806306fdde0314610209578063095ea7b31461024557600080fd5b366101e257005b600080fd5b3480156101f357600080fd5b50610207610202366004611afc565b6105e5565b005b34801561021557600080fd5b5060408051808201825260048152634b55594160e01b6020820152905161023c9190611bc1565b60405180910390f35b34801561025157600080fd5b50610265610260366004611c16565b610684565b604051901515815260200161023c565b34801561028157600080fd5b50601354610295906001600160a01b031681565b6040516001600160a01b03909116815260200161023c565b3480156102b957600080fd5b50670de0b6b3a76400005b60405190815260200161023c565b3480156102de57600080fd5b506102656102ed366004611c42565b61069b565b3480156102fe57600080fd5b506102c460175481565b34801561031457600080fd5b506040516009815260200161023c565b34801561033057600080fd5b50601454610295906001600160a01b031681565b34801561035057600080fd5b5061020761035f366004611c83565b610704565b34801561037057600080fd5b5061020761037f366004611cb0565b61074f565b34801561039057600080fd5b50610207610797565b3480156103a557600080fd5b506102c46103b4366004611c83565b6107c4565b3480156103c557600080fd5b506102076107e6565b3480156103da57600080fd5b506102076103e9366004611ccb565b61085a565b3480156103fa57600080fd5b506102c460155481565b34801561041057600080fd5b506102c461041f366004611c83565b60116020526000908152604090205481565b34801561043d57600080fd5b5061020761089c565b34801561045257600080fd5b506000546001600160a01b0316610295565b34801561047057600080fd5b5061020761047f366004611cb0565b610a54565b34801561049057600080fd5b506102c460165481565b3480156104a657600080fd5b506102076104b5366004611ccb565b610ab3565b3480156104c657600080fd5b506102076104d5366004611ce4565b610ae2565b3480156104e657600080fd5b506102656104f5366004611c16565b610b3c565b34801561050657600080fd5b50610265610515366004611c83565b60106020526000908152604090205460ff1681565b34801561053657600080fd5b50610207610b49565b34801561054b57600080fd5b5061020761055a366004611d16565b610b7f565b34801561056b57600080fd5b506102c461057a366004611d9a565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105b157600080fd5b506102076105c0366004611ccb565b610c20565b3480156105d157600080fd5b506102076105e0366004611c83565b610c4f565b6000546001600160a01b031633146106185760405162461bcd60e51b815260040161060f90611dd3565b60405180910390fd5b60005b81518110156106805760016010600084848151811061063c5761063c611e08565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061067881611e34565b91505061061b565b5050565b6000610691338484610d39565b5060015b92915050565b60006106a8848484610e5d565b6106fa84336106f585604051806060016040528060288152602001611f4e602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190611399565b610d39565b5060019392505050565b6000546001600160a01b0316331461072e5760405162461bcd60e51b815260040161060f90611dd3565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107795760405162461bcd60e51b815260040161060f90611dd3565b60148054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b0316146107b757600080fd5b476107c1816113d3565b50565b6001600160a01b0381166000908152600260205260408120546106959061140d565b6000546001600160a01b031633146108105760405162461bcd60e51b815260040161060f90611dd3565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108845760405162461bcd60e51b815260040161060f90611dd3565b6611c37937e08000811161089757600080fd5b601555565b6000546001600160a01b031633146108c65760405162461bcd60e51b815260040161060f90611dd3565b601380546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a01559160048083019260209291908290030181865afa15801561092b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061094f9190611e4f565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa15801561099c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109c09190611e4f565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610a0d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a319190611e4f565b601480546001600160a01b0319166001600160a01b039290921691909117905550565b6000546001600160a01b03163314610a7e5760405162461bcd60e51b815260040161060f90611dd3565b601454600160a01b900460ff1615610a9557600080fd5b60148054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b03163314610add5760405162461bcd60e51b815260040161060f90611dd3565b601755565b6000546001600160a01b03163314610b0c5760405162461bcd60e51b815260040161060f90611dd3565b60095482111580610b1f5750600b548111155b610b2857600080fd5b600893909355600a91909155600955600b55565b6000610691338484610e5d565b6012546001600160a01b0316336001600160a01b031614610b6957600080fd5b6000610b74306107c4565b90506107c181611491565b6000546001600160a01b03163314610ba95760405162461bcd60e51b815260040161060f90611dd3565b60005b82811015610c1a578160056000868685818110610bcb57610bcb611e08565b9050602002016020810190610be09190611c83565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610c1281611e34565b915050610bac565b50505050565b6000546001600160a01b03163314610c4a5760405162461bcd60e51b815260040161060f90611dd3565b601655565b6000546001600160a01b03163314610c795760405162461bcd60e51b815260040161060f90611dd3565b6001600160a01b038116610cde5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161060f565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610d9b5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161060f565b6001600160a01b038216610dfc5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161060f565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610ec15760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161060f565b6001600160a01b038216610f235760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161060f565b60008111610f855760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161060f565b6000546001600160a01b03848116911614801590610fb157506000546001600160a01b03838116911614155b1561129257601454600160a01b900460ff1661104a576000546001600160a01b0384811691161461104a5760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400606482015260840161060f565b60155481111561109c5760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000604482015260640161060f565b6001600160a01b03831660009081526010602052604090205460ff161580156110de57506001600160a01b03821660009081526010602052604090205460ff16155b6111365760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b606482015260840161060f565b6014546001600160a01b038381169116146111bb5760165481611158846107c4565b6111629190611e6c565b106111bb5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b606482015260840161060f565b60006111c6306107c4565b6017546015549192508210159082106111df5760155491505b8080156111f65750601454600160a81b900460ff16155b801561121057506014546001600160a01b03868116911614155b80156112255750601454600160b01b900460ff165b801561124a57506001600160a01b03851660009081526005602052604090205460ff16155b801561126f57506001600160a01b03841660009081526005602052604090205460ff16155b1561128f5761127d82611491565b47801561128d5761128d476113d3565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff16806112d457506001600160a01b03831660009081526005602052604090205460ff165b8061130657506014546001600160a01b0385811691161480159061130657506014546001600160a01b03848116911614155b156113135750600061138d565b6014546001600160a01b03858116911614801561133e57506013546001600160a01b03848116911614155b1561135057600854600c55600954600d555b6014546001600160a01b03848116911614801561137b57506013546001600160a01b03858116911614155b1561138d57600a54600c55600b54600d555b610c1a8484848461160b565b600081848411156113bd5760405162461bcd60e51b815260040161060f9190611bc1565b5060006113ca8486611e84565b95945050505050565b6012546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610680573d6000803e3d6000fd5b60006006548211156114745760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161060f565b600061147e611639565b905061148a838261165c565b9392505050565b6014805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106114d9576114d9611e08565b6001600160a01b03928316602091820292909201810191909152601354604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015611532573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115569190611e4f565b8160018151811061156957611569611e08565b6001600160a01b03928316602091820292909201015260135461158f9130911684610d39565b60135460405163791ac94760e01b81526001600160a01b039091169063791ac947906115c8908590600090869030904290600401611e9b565b600060405180830381600087803b1580156115e257600080fd5b505af11580156115f6573d6000803e3d6000fd5b50506014805460ff60a81b1916905550505050565b806116185761161861169e565b6116238484846116cc565b80610c1a57610c1a600e54600c55600f54600d55565b60008060006116466117c3565b9092509050611655828261165c565b9250505090565b600061148a83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611803565b600c541580156116ae5750600d54155b156116b557565b600c8054600e55600d8054600f5560009182905555565b6000806000806000806116de87611831565b6001600160a01b038f16600090815260026020526040902054959b50939950919750955093509150611710908761188e565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461173f90866118d0565b6001600160a01b0389166000908152600260205260409020556117618161192f565b61176b8483611979565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516117b091815260200190565b60405180910390a3505050505050505050565b6006546000908190670de0b6b3a76400006117de828261165c565b8210156117fa57505060065492670de0b6b3a764000092509050565b90939092509050565b600081836118245760405162461bcd60e51b815260040161060f9190611bc1565b5060006113ca8486611f0c565b600080600080600080600080600061184e8a600c54600d5461199d565b925092509250600061185e611639565b905060008060006118718e8787876119f2565b919e509c509a509598509396509194505050505091939550919395565b600061148a83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611399565b6000806118dd8385611e6c565b90508381101561148a5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161060f565b6000611939611639565b905060006119478383611a42565b3060009081526002602052604090205490915061196490826118d0565b30600090815260026020526040902055505050565b600654611986908361188e565b60065560075461199690826118d0565b6007555050565b60008080806119b760646119b18989611a42565b9061165c565b905060006119ca60646119b18a89611a42565b905060006119e2826119dc8b8661188e565b9061188e565b9992985090965090945050505050565b6000808080611a018886611a42565b90506000611a0f8887611a42565b90506000611a1d8888611a42565b90506000611a2f826119dc868661188e565b939b939a50919850919650505050505050565b600082611a5157506000610695565b6000611a5d8385611f2e565b905082611a6a8583611f0c565b1461148a5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161060f565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107c157600080fd5b8035611af781611ad7565b919050565b60006020808385031215611b0f57600080fd5b823567ffffffffffffffff80821115611b2757600080fd5b818501915085601f830112611b3b57600080fd5b813581811115611b4d57611b4d611ac1565b8060051b604051601f19603f83011681018181108582111715611b7257611b72611ac1565b604052918252848201925083810185019188831115611b9057600080fd5b938501935b82851015611bb557611ba685611aec565b84529385019392850192611b95565b98975050505050505050565b600060208083528351808285015260005b81811015611bee57858101830151858201604001528201611bd2565b81811115611c00576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611c2957600080fd5b8235611c3481611ad7565b946020939093013593505050565b600080600060608486031215611c5757600080fd5b8335611c6281611ad7565b92506020840135611c7281611ad7565b929592945050506040919091013590565b600060208284031215611c9557600080fd5b813561148a81611ad7565b80358015158114611af757600080fd5b600060208284031215611cc257600080fd5b61148a82611ca0565b600060208284031215611cdd57600080fd5b5035919050565b60008060008060808587031215611cfa57600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611d2b57600080fd5b833567ffffffffffffffff80821115611d4357600080fd5b818601915086601f830112611d5757600080fd5b813581811115611d6657600080fd5b8760208260051b8501011115611d7b57600080fd5b602092830195509350611d919186019050611ca0565b90509250925092565b60008060408385031215611dad57600080fd5b8235611db881611ad7565b91506020830135611dc881611ad7565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611e4857611e48611e1e565b5060010190565b600060208284031215611e6157600080fd5b815161148a81611ad7565b60008219821115611e7f57611e7f611e1e565b500190565b600082821015611e9657611e96611e1e565b500390565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611eeb5784516001600160a01b031683529383019391830191600101611ec6565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611f2957634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611f4857611f48611e1e565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220e1681fd1453c3e283c7edefc366e2b6ebcc8f5f532d01f9c5c39ed6ebbf8f02864736f6c634300080a0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 2,209 |
0xef7e7b3e0487910d070daf28c01c0ea81b1f6733
|
// Author : shift
pragma solidity ^0.4.18;
//--------- OpenZeppelin's Safe Math
//Source : https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/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 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;
}
}
//-----------------------------------------------------
// ERC20 Interface: https://github.com/ethereum/EIPs/issues/20
contract ERC20 {
function transfer(address _to, uint256 _value) public returns (bool success);
function balanceOf(address _owner) public constant returns (uint256 balance);
}
/*
This contract stores twice every key value in order to be able to redistribute funds
when the bonus tokens are received (which is typically X months after the initial buy).
*/
contract Moongang {
using SafeMath for uint256;
modifier onlyOwner {
require(msg.sender == owner);
_;
}
modifier minAmountReached {
//In reality, the correct amount is the amount + 1%
require(this.balance >= SafeMath.div(SafeMath.mul(min_amount, 100), 99));
_;
}
modifier underMaxAmount {
require(max_amount == 0 || this.balance <= max_amount);
_;
}
//Constants of the contract
uint256 constant FEE = 100; //1% fee
//SafeMath.div(20, 3) = 6
uint256 constant FEE_DEV = 6; //15% on the 1% fee
uint256 constant FEE_AUDIT = 12; //7.5% on the 1% fee
address public owner;
address constant public developer = 0xEE06BdDafFA56a303718DE53A5bc347EfbE4C68f;
address constant public auditor = 0x63F7547Ac277ea0B52A0B060Be6af8C5904953aa;
uint256 public individual_cap;
//Variables subject to changes
uint256 public max_amount; //0 means there is no limit
uint256 public min_amount;
//Store the amount of ETH deposited by each account.
mapping (address => uint256) public balances;
mapping (address => uint256) public balances_bonus;
// Track whether the contract has bought the tokens yet.
bool public bought_tokens;
// Record ETH value of tokens currently held by contract.
uint256 public contract_eth_value;
uint256 public contract_eth_value_bonus;
//Set by the owner in order to allow the withdrawal of bonus tokens.
bool public bonus_received;
//The address of the contact.
address public sale;
//Token address
ERC20 public token;
//Records the fees that have to be sent
uint256 fees;
//Set by the owner. Allows people to refund totally or partially.
bool public allow_refunds;
//The reduction of the allocation in % | example : 40 -> 40% reduction
uint256 public percent_reduction;
bool public owner_supplied_eth;
bool public allow_contributions;
//Internal functions
function Moongang(uint256 max, uint256 min, uint256 cap) {
/*
Constructor
*/
owner = msg.sender;
max_amount = SafeMath.div(SafeMath.mul(max, 100), 99);
min_amount = min;
individual_cap = cap;
allow_contributions = true;
}
//Functions for the owner
// Buy the tokens. Sends ETH to the presale wallet and records the ETH amount held in the contract.
function buy_the_tokens() onlyOwner minAmountReached underMaxAmount {
//Avoids burning the funds
require(!bought_tokens && sale != 0x0);
//Record that the contract has bought the tokens.
bought_tokens = true;
//Sends the fee before so the contract_eth_value contains the correct balance
uint256 dev_fee = SafeMath.div(fees, FEE_DEV);
uint256 audit_fee = SafeMath.div(fees, FEE_AUDIT);
owner.transfer(SafeMath.sub(SafeMath.sub(fees, dev_fee), audit_fee));
developer.transfer(dev_fee);
auditor.transfer(audit_fee);
//Record the amount of ETH sent as the contract's current value.
contract_eth_value = this.balance;
contract_eth_value_bonus = this.balance;
// Transfer all the funds to the crowdsale address.
sale.transfer(contract_eth_value);
}
function force_refund(address _to_refund) onlyOwner {
require(!bought_tokens);
uint256 eth_to_withdraw = SafeMath.div(SafeMath.mul(balances[_to_refund], 100), 99);
balances[_to_refund] = 0;
balances_bonus[_to_refund] = 0;
fees = SafeMath.sub(fees, SafeMath.div(eth_to_withdraw, FEE));
_to_refund.transfer(eth_to_withdraw);
}
function force_partial_refund(address _to_refund) onlyOwner {
require(bought_tokens && percent_reduction > 0);
//Amount to refund is the amount minus the X% of the reduction
//amount_to_refund = balance*X
uint256 amount = SafeMath.div(SafeMath.mul(balances[_to_refund], percent_reduction), 100);
balances[_to_refund] = SafeMath.sub(balances[_to_refund], amount);
balances_bonus[_to_refund] = balances[_to_refund];
if (owner_supplied_eth) {
//dev fees aren't refunded, only owner fees
uint256 fee = amount.div(FEE).mul(percent_reduction).div(100);
amount = amount.add(fee);
}
_to_refund.transfer(amount);
}
function set_sale_address(address _sale) onlyOwner {
//Avoid mistake of putting 0x0 and can't change twice the sale address
require(_sale != 0x0);
sale = _sale;
}
function set_token_address(address _token) onlyOwner {
require(_token != 0x0);
token = ERC20(_token);
}
function set_bonus_received(bool _boolean) onlyOwner {
bonus_received = _boolean;
}
function set_allow_refunds(bool _boolean) onlyOwner {
/*
In case, for some reasons, the project refunds the money
*/
allow_refunds = _boolean;
}
function set_allow_contributions(bool _boolean) onlyOwner {
allow_contributions = _boolean;
}
function set_percent_reduction(uint256 _reduction) onlyOwner payable {
require(bought_tokens && _reduction <= 100);
percent_reduction = _reduction;
if (msg.value > 0) {
owner_supplied_eth = true;
}
//we substract by contract_eth_value*_reduction basically
contract_eth_value = contract_eth_value.sub((contract_eth_value.mul(_reduction)).div(100));
contract_eth_value_bonus = contract_eth_value;
}
function change_individual_cap(uint256 _cap) onlyOwner {
individual_cap = _cap;
}
function change_owner(address new_owner) onlyOwner {
require(new_owner != 0x0);
owner = new_owner;
}
function change_max_amount(uint256 _amount) onlyOwner {
//ATTENTION! The new amount should be in wei
//Use https://etherconverter.online/
max_amount = SafeMath.div(SafeMath.mul(_amount, 100), 99);
}
function change_min_amount(uint256 _amount) onlyOwner {
//ATTENTION! The new amount should be in wei
//Use https://etherconverter.online/
min_amount = _amount;
}
//Public functions
// Allows any user to withdraw his tokens.
function withdraw() {
// Disallow withdraw if tokens haven't been bought yet.
require(bought_tokens);
uint256 contract_token_balance = token.balanceOf(address(this));
// Disallow token withdrawals if there are no tokens to withdraw.
require(contract_token_balance != 0);
uint256 tokens_to_withdraw = SafeMath.div(SafeMath.mul(balances[msg.sender], contract_token_balance), contract_eth_value);
// Update the value of tokens currently held by the contract.
contract_eth_value = SafeMath.sub(contract_eth_value, balances[msg.sender]);
// Update the user's balance prior to sending to prevent recursive call.
balances[msg.sender] = 0;
// Send the funds. Throws on failure to prevent loss of funds.
require(token.transfer(msg.sender, tokens_to_withdraw));
}
function withdraw_bonus() {
/*
Special function to withdraw the bonus tokens after the 6 months lockup.
bonus_received has to be set to true.
*/
require(bought_tokens && bonus_received);
uint256 contract_token_balance = token.balanceOf(address(this));
require(contract_token_balance != 0);
uint256 tokens_to_withdraw = SafeMath.div(SafeMath.mul(balances_bonus[msg.sender], contract_token_balance), contract_eth_value_bonus);
contract_eth_value_bonus = SafeMath.sub(contract_eth_value_bonus, balances_bonus[msg.sender]);
balances_bonus[msg.sender] = 0;
require(token.transfer(msg.sender, tokens_to_withdraw));
}
// Allows any user to get his eth refunded before the purchase is made.
function refund() {
require(!bought_tokens && allow_refunds && percent_reduction == 0);
//balance of contributor = contribution * 0.99
//so contribution = balance/0.99
uint256 eth_to_withdraw = SafeMath.div(SafeMath.mul(balances[msg.sender], 100), 99);
// Update the user's balance prior to sending ETH to prevent recursive call.
balances[msg.sender] = 0;
//Updates the balances_bonus too
balances_bonus[msg.sender] = 0;
//Updates the fees variable by substracting the refunded fee
fees = SafeMath.sub(fees, SafeMath.div(eth_to_withdraw, FEE));
// Return the user's funds. Throws on failure to prevent loss of funds.
msg.sender.transfer(eth_to_withdraw);
}
//Allows any user to get a part of his ETH refunded, in proportion
//to the % reduced of the allocation
function partial_refund() {
require(bought_tokens && percent_reduction > 0);
//Amount to refund is the amount minus the X% of the reduction
//amount_to_refund = balance*X
uint256 amount = SafeMath.div(SafeMath.mul(balances[msg.sender], percent_reduction), 100);
balances[msg.sender] = SafeMath.sub(balances[msg.sender], amount);
balances_bonus[msg.sender] = balances[msg.sender];
if (owner_supplied_eth) {
//dev fees aren't refunded, only owner fees
uint256 fee = amount.div(FEE).mul(percent_reduction).div(100);
amount = amount.add(fee);
}
msg.sender.transfer(amount);
}
// Default function. Called when a user sends ETH to the contract.
function () payable underMaxAmount {
require(!bought_tokens && allow_contributions);
//1% fee is taken on the ETH
uint256 fee = SafeMath.div(msg.value, FEE);
fees = SafeMath.add(fees, fee);
//Updates both of the balances
balances[msg.sender] = SafeMath.add(balances[msg.sender], SafeMath.sub(msg.value, fee));
//Checks if the individual cap is respected
//If it's not, changes are reverted
require(individual_cap == 0 || balances[msg.sender] <= individual_cap);
balances_bonus[msg.sender] = balances[msg.sender];
}
}
|
0x6060604052600436106101b7576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630107a8df146103b857806303b918dc146103cd578063111485ef146103fa57806318af7021146104235780631a34fe811461045c5780631e4532f114610485578063223db315146104d2578063253c8bd4146104ff57806327e235e31461053857806328b8e9cf1461058557806329d98a7b1461059a5780632fbfe951146105bd578063346f2eb7146105e0578063398f2648146106055780633ccfd60b146106285780633ec045a61461063d57806342263aa214610692578063590e1ae3146106cb5780636360fc3f146106e0578063666375e51461070d578063678f703314610732578063689f24561461074a5780636954abee1461075f5780636ad1fe021461078c5780637036f9d9146107e157806372a856041461081a5780638d521149146108435780638da5cb5b14610870578063a8644cd5146108c5578063c34dd141146108ee578063c42bb1e414610917578063ca4b208b14610940578063ebc56eec14610995578063f2bee03d146109ba578063fc0c546a146109f3575b60008060025414806101e257506002543073ffffffffffffffffffffffffffffffffffffffff163111155b15156101ed57600080fd5b600660009054906101000a900460ff161580156102165750600e60019054906101000a900460ff165b151561022157600080fd5b61022c346064610a48565b905061023a600b5482610a63565b600b81905550610292600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461028d3484610a81565b610a63565b600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600060015414806103275750600154600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205411155b151561033257600080fd5b600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555050005b34156103c357600080fd5b6103cb610a9a565b005b34156103d857600080fd5b6103e0610d8b565b604051808215151515815260200191505060405180910390f35b341561040557600080fd5b61040d610d9e565b6040518082815260200191505060405180910390f35b341561042e57600080fd5b61045a600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610da4565b005b341561046757600080fd5b61046f610f5d565b6040518082815260200191505060405180910390f35b341561049057600080fd5b6104bc600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610f63565b6040518082815260200191505060405180910390f35b34156104dd57600080fd5b6104e5610f7b565b604051808215151515815260200191505060405180910390f35b341561050a57600080fd5b610536600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610f8e565b005b341561054357600080fd5b61056f600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611052565b6040518082815260200191505060405180910390f35b341561059057600080fd5b61059861106a565b005b34156105a557600080fd5b6105bb6004808035906020019091905050611394565b005b34156105c857600080fd5b6105de60048080359060200190919050506113f9565b005b34156105eb57600080fd5b6106036004808035151590602001909190505061145e565b005b341561061057600080fd5b61062660048080359060200190919050506114d6565b005b341561063357600080fd5b61063b61154f565b005b341561064857600080fd5b610650611828565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561069d57600080fd5b6106c9600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611840565b005b34156106d657600080fd5b6106de611905565b005b34156106eb57600080fd5b6106f3611a88565b604051808215151515815260200191505060405180910390f35b341561071857600080fd5b61073060048080351515906020019091905050611a9b565b005b6107486004808035906020019091905050611b13565b005b341561075557600080fd5b61075d611c10565b005b341561076a57600080fd5b610772611e4e565b604051808215151515815260200191505060405180910390f35b341561079757600080fd5b61079f611e61565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156107ec57600080fd5b610818600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611e87565b005b341561082557600080fd5b61082d612121565b6040518082815260200191505060405180910390f35b341561084e57600080fd5b610856612127565b604051808215151515815260200191505060405180910390f35b341561087b57600080fd5b61088361213a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156108d057600080fd5b6108d861215f565b6040518082815260200191505060405180910390f35b34156108f957600080fd5b610901612165565b6040518082815260200191505060405180910390f35b341561092257600080fd5b61092a61216b565b6040518082815260200191505060405180910390f35b341561094b57600080fd5b610953612171565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156109a057600080fd5b6109b860048080351515906020019091905050612189565b005b34156109c557600080fd5b6109f1600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050612201565b005b34156109fe57600080fd5b610a066122c6565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6000808284811515610a5657fe5b0490508091505092915050565b6000808284019050838110151515610a7757fe5b8091505092915050565b6000828211151515610a8f57fe5b818303905092915050565b600080600660009054906101000a900460ff168015610ac55750600960009054906101000a900460ff165b1515610ad057600080fd5b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b1515610b8c57600080fd5b5af11515610b9957600080fd5b50505060405180519050915060008214151515610bb557600080fd5b610c09610c01600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054846122ec565b600854610a48565b9050610c56600854600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610a81565b6008819055506000600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1515610d6557600080fd5b5af11515610d7257600080fd5b505050604051805190501515610d8757600080fd5b5050565b600e60019054906101000a900460ff1681565b60015481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610e0157600080fd5b600660009054906101000a900460ff16151515610e1d57600080fd5b610e71610e6a600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205460646122ec565b6063610a48565b90506000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610f13600b54610f0e836064610a48565b610a81565b600b819055508173ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501515610f5957600080fd5b5050565b60025481565b60056020528060005260406000206000915090505481565b600c60009054906101000a900460ff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610fe957600080fd5b60008173ffffffffffffffffffffffffffffffffffffffff161415151561100f57600080fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60046020528060005260406000206000915090505481565b6000806000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156110c857600080fd5b6110df6110d860035460646122ec565b6063610a48565b3073ffffffffffffffffffffffffffffffffffffffff16311015151561110457600080fd5b6000600254148061112e57506002543073ffffffffffffffffffffffffffffffffffffffff163111155b151561113957600080fd5b600660009054906101000a900460ff1615801561118f57506000600960019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614155b151561119a57600080fd5b6001600660006101000a81548160ff0219169083151502179055506111c2600b546006610a48565b91506111d1600b54600c610a48565b90506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61122361121d600b5486610a81565b84610a81565b9081150290604051600060405180830381858888f19350505050151561124857600080fd5b73ee06bddaffa56a303718de53a5bc347efbe4c68f73ffffffffffffffffffffffffffffffffffffffff166108fc839081150290604051600060405180830381858888f19350505050151561129c57600080fd5b7363f7547ac277ea0b52a0b060be6af8c5904953aa73ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f1935050505015156112f057600080fd5b3073ffffffffffffffffffffffffffffffffffffffff16316007819055503073ffffffffffffffffffffffffffffffffffffffff1631600881905550600960019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6007549081150290604051600060405180830381858888f19350505050151561139057600080fd5b5050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156113ef57600080fd5b8060018190555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561145457600080fd5b8060038190555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156114b957600080fd5b80600960006101000a81548160ff02191690831515021790555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561153157600080fd5b61154661153f8260646122ec565b6063610a48565b60028190555050565b600080600660009054906101000a900460ff16151561156d57600080fd5b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b151561162957600080fd5b5af1151561163657600080fd5b5050506040518051905091506000821415151561165257600080fd5b6116a661169e600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054846122ec565b600754610a48565b90506116f3600754600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610a81565b6007819055506000600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b151561180257600080fd5b5af1151561180f57600080fd5b50505060405180519050151561182457600080fd5b5050565b7363f7547ac277ea0b52a0b060be6af8c5904953aa81565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561189b57600080fd5b60008173ffffffffffffffffffffffffffffffffffffffff16141515156118c157600080fd5b80600a60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000600660009054906101000a900460ff161580156119305750600c60009054906101000a900460ff165b801561193e57506000600d54145b151561194957600080fd5b61199d611996600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205460646122ec565b6063610a48565b90506000600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611a3f600b54611a3a836064610a48565b610a81565b600b819055503373ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501515611a8557600080fd5b50565b600660009054906101000a900460ff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611af657600080fd5b80600e60016101000a81548160ff02191690831515021790555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611b6e57600080fd5b600660009054906101000a900460ff168015611b8b575060648111155b1515611b9657600080fd5b80600d819055506000341115611bc2576001600e60006101000a81548160ff0219169083151502179055505b611bfe611bed6064611bdf846007546122ec90919063ffffffff16565b610a4890919063ffffffff16565b600754610a8190919063ffffffff16565b60078190555060075460088190555050565b600080600660009054906101000a900460ff168015611c3157506000600d54115b1515611c3c57600080fd5b611c91611c8a600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600d546122ec565b6064610a48565b9150611cdc600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483610a81565b600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600e60009054906101000a900460ff1615611e0a57611df26064611de4600d54611dd6606487610a4890919063ffffffff16565b6122ec90919063ffffffff16565b610a4890919063ffffffff16565b9050611e078183610a6390919063ffffffff16565b91505b3373ffffffffffffffffffffffffffffffffffffffff166108fc839081150290604051600060405180830381858888f193505050501515611e4a57600080fd5b5050565b600e60009054906101000a900460ff1681565b600960019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000806000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611ee557600080fd5b600660009054906101000a900460ff168015611f0357506000600d54115b1515611f0e57600080fd5b611f63611f5c600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600d546122ec565b6064610a48565b9150611fae600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483610a81565b600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600e60009054906101000a900460ff16156120dc576120c460646120b6600d546120a8606487610a4890919063ffffffff16565b6122ec90919063ffffffff16565b610a4890919063ffffffff16565b90506120d98183610a6390919063ffffffff16565b91505b8273ffffffffffffffffffffffffffffffffffffffff166108fc839081150290604051600060405180830381858888f19350505050151561211c57600080fd5b505050565b60035481565b600960009054906101000a900460ff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60085481565b600d5481565b60075481565b73ee06bddaffa56a303718de53a5bc347efbe4c68f81565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156121e457600080fd5b80600c60006101000a81548160ff02191690831515021790555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561225c57600080fd5b60008173ffffffffffffffffffffffffffffffffffffffff161415151561228257600080fd5b80600960016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060008414156123015760009150612320565b828402905082848281151561231257fe5b0414151561231c57fe5b8091505b50929150505600a165627a7a7230582094d47c7155f21514404cd536283738ad9c010095d6872b30ed2e4c6914eaca820029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 2,210 |
0x37d8648008d695d54Ef2030B057E3B9d6a049F38
|
pragma solidity ^0.4.15;
/// @title Multisignature wallet - Allows multiple parties to agree on transactions before execution.
/// @author Stefan George - <stefan.george@consensys.net>
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);
/*
* 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;
bool declined;
}
/*
* 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 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;
transactions[transactionId].declined = true;
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) internal 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)
{
if (transactions[transactionId].declined)
return false;
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,
declined: 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 && !transactions[i].declined)
|| 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];
}
}
|
0x606060405236156100ef576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063025e7c271461014b57806320ea8d86146101ae5780632f54bf6e146101d15780633411c81c14610222578063547415251461027c578063784547a7146102c05780638b51d13f146102fb5780639ace38c214610332578063a0e67e2b1461043b578063a8abe69a146104a6578063b5dc40c31461053e578063b77bf600146105b7578063c01a8c84146105e0578063c642747414610603578063d74f8edd1461069c578063dc8452cd146106c5578063ee22610b146106ee575b5b6000341115610148573373ffffffffffffffffffffffffffffffffffffffff167fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c346040518082815260200191505060405180910390a25b5b005b341561015657600080fd5b61016c6004808035906020019091905050610711565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156101b957600080fd5b6101cf6004808035906020019091905050610751565b005b34156101dc57600080fd5b610208600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061092b565b604051808215151515815260200191505060405180910390f35b341561022d57600080fd5b610262600480803590602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061094b565b604051808215151515815260200191505060405180910390f35b341561028757600080fd5b6102aa60048080351515906020019091908035151590602001909190505061097a565b6040518082815260200191505060405180910390f35b34156102cb57600080fd5b6102e16004808035906020019091905050610a0e565b604051808215151515815260200191505060405180910390f35b341561030657600080fd5b61031c6004808035906020019091905050610b28565b6040518082815260200191505060405180910390f35b341561033d57600080fd5b6103536004808035906020019091905050610bf7565b604051808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018060200184151515158152602001831515151581526020018281038252858181546001816001161561010002031660029004815260200191508054600181600116156101000203166002900480156104285780601f106103fd57610100808354040283529160200191610428565b820191906000526020600020905b81548152906001019060200180831161040b57829003601f168201915b5050965050505050505060405180910390f35b341561044657600080fd5b61044e610c66565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156104925780820151818401525b602081019050610476565b505050509050019250505060405180910390f35b34156104b157600080fd5b6104e6600480803590602001909190803590602001909190803515159060200190919080351515906020019091905050610cfb565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561052a5780820151818401525b60208101905061050e565b505050509050019250505060405180910390f35b341561054957600080fd5b61055f6004808035906020019091905050610e88565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156105a35780820151818401525b602081019050610587565b505050509050019250505060405180910390f35b34156105c257600080fd5b6105ca6110b9565b6040518082815260200191505060405180910390f35b34156105eb57600080fd5b61060160048080359060200190919050506110bf565b005b341561060e57600080fd5b610686600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050919050506112a0565b6040518082815260200191505060405180910390f35b34156106a757600080fd5b6106af6112c0565b6040518082815260200191505060405180910390f35b34156106d057600080fd5b6106d86112c5565b6040518082815260200191505060405180910390f35b34156106f957600080fd5b61070f60048080359060200190919050506112cb565b005b60038181548110151561072057fe5b906000526020600020900160005b915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b33600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615156107aa57600080fd5b81336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561081557600080fd5b8360008082815260200190815260200160002060030160009054906101000a900460ff1615151561084557600080fd5b60006001600087815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600160008087815260200190815260200160002060030160016101000a81548160ff021916908315150217905550843373ffffffffffffffffffffffffffffffffffffffff167ff6a317157440607f36269043eb55f1287a5a19ba2216afeab88cd46cbcfb88e960405160405180910390a35b5b505b50505b5050565b60026020528060005260406000206000915054906101000a900460ff1681565b60016020528160005260406000206020528060005260406000206000915091509054906101000a900460ff1681565b600080600090505b600554811015610a06578380156109b9575060008082815260200190815260200160002060030160009054906101000a900460ff16155b806109ec57508280156109eb575060008082815260200190815260200160002060030160009054906101000a900460ff165b5b156109f8576001820191505b5b8080600101915050610982565b5b5092915050565b600080600080600085815260200190815260200160002060030160019054906101000a900460ff1615610a445760009250610b21565b60009150600090505b600380549050811015610b2057600160008581526020019081526020016000206000600383815481101515610a7e57fe5b906000526020600020900160005b9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610aff576001820191505b600454821415610b125760019250610b21565b5b8080600101915050610a4d565b5b5050919050565b600080600090505b600380549050811015610bf057600160008481526020019081526020016000206000600383815481101515610b6157fe5b906000526020600020900160005b9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610be2576001820191505b5b8080600101915050610b30565b5b50919050565b60006020528060005260406000206000915090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169080600101549080600201908060030160009054906101000a900460ff16908060030160019054906101000a900460ff16905085565b610c6e61171c565b6003805480602002602001604051908101604052809291908181526020018280548015610cf057602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311610ca6575b505050505090505b90565b610d03611730565b610d0b611730565b600080600554604051805910610d1e5750595b908082528060200260200182016040525b50925060009150600090505b600554811015610e0857858015610d72575060008082815260200190815260200160002060030160009054906101000a900460ff16155b8015610d9e575060008082815260200190815260200160002060030160019054906101000a900460ff16155b80610dd15750848015610dd0575060008082815260200190815260200160002060030160009054906101000a900460ff165b5b15610dfa57808383815181101515610de557fe5b90602001906020020181815250506001820191505b5b8080600101915050610d3b565b878703604051805910610e185750595b908082528060200260200182016040525b5093508790505b86811015610e7c578281815181101515610e4657fe5b9060200190602002015184898303815181101515610e6057fe5b90602001906020020181815250505b8080600101915050610e30565b5b505050949350505050565b610e9061171c565b610e9861171c565b600080600380549050604051805910610eae5750595b908082528060200260200182016040525b50925060009150600090505b60038054905081101561101157600160008681526020019081526020016000206000600383815481101515610efc57fe5b906000526020600020900160005b9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561100357600381815481101515610f8557fe5b906000526020600020900160005b9054906101000a900473ffffffffffffffffffffffffffffffffffffffff168383815181101515610fc057fe5b9060200190602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506001820191505b5b8080600101915050610ecb565b8160405180591061101f5750595b908082528060200260200182016040525b509350600090505b818110156110b057828181518110151561104e57fe5b90602001906020020151848281518110151561106657fe5b9060200190602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250505b8080600101915050611038565b5b505050919050565b60055481565b33600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561111857600080fd5b81600080600083815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415151561117457600080fd5b82336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515156111e057600080fd5b600180600087815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550843373ffffffffffffffffffffffffffffffffffffffff167f4a504a94899432a9846e1aa406dceb1bcfd538bb839071d49d1e5e23f5be30ef60405160405180910390a3611295856112cb565b5b5b50505b505b5050565b60006112ad848484611577565b90506112b8816110bf565b5b9392505050565b603281565b60045481565b600033600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561132657600080fd5b82336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561139157600080fd5b8460008082815260200190815260200160002060030160009054906101000a900460ff161515156113c157600080fd5b6113ca86610a0e565b1561156b57600080878152602001908152602001600020945060018560030160006101000a81548160ff0219169083151502179055506114e88560000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16866001015487600201805460018160011615610100020316600290049050886002018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156114de5780601f106114b3576101008083540402835291602001916114de565b820191906000526020600020905b8154815290600101906020018083116114c157829003601f168201915b50505050506116f4565b1561151f57857f33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed7560405160405180910390a261156a565b857f526441bb6c1aba3c9a4a6ca1d6545da9c2333c8c48343ef398eb858d72b7923660405160405180910390a260008560030160006101000a81548160ff0219169083151502179055505b5b5b5b505b50505b505050565b60008360008173ffffffffffffffffffffffffffffffffffffffff16141515156115a057600080fd5b600554915060a0604051908101604052808673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018481526020016000151581526020016000151581525060008084815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550602082015181600101556040820151816002019080519060200190611668929190611744565b5060608201518160030160006101000a81548160ff02191690831515021790555060808201518160030160016101000a81548160ff0219169083151502179055509050506001600560008282540192505081905550817fc0ba8fe4b176c1714197d43b9cc6bcf797a4a7461c5fe8d0ef6e184ae7601e5160405160405180910390a25b5b509392505050565b6000806040516020840160008287838a8c6187965a03f1925050508091505b50949350505050565b602060405190810160405280600081525090565b602060405190810160405280600081525090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061178557805160ff19168380011785556117b3565b828001600101855582156117b3579182015b828111156117b2578251825591602001919060010190611797565b5b5090506117c091906117c4565b5090565b6117e691905b808211156117e25760008160009055506001016117ca565b5090565b905600a165627a7a723058203eb01783734bf7d74eef343947ee21897188df2ea6a349fa01fb3fee711cf45d0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 2,211 |
0x436F0F3a982074c4a05084485D421466a994FE53
|
pragma solidity 0.4.19;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title 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 ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
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 Pausable
* @dev Base contract which allows children to implement an emergency stop mechanism.
*/
contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() onlyOwner whenNotPaused public {
paused = true;
Pause();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused public {
paused = false;
Unpause();
}
}
/**
* @title Whitelisted Pausable token
* @dev StandardToken modified with pausable transfers. Enables a whitelist to enable transfers
* only for certain addresses such as crowdsale contract, issuing account etc.
**/
contract WhitelistedPausableToken is StandardToken, Pausable {
mapping(address => bool) public whitelist;
/**
* @dev Reverts if the message sender requesting for transfer is not whitelisted when token
* transfers are paused
* @param _sender check transaction sender address
*/
modifier whenNotPausedOrWhitelisted(address _sender) {
require(whitelist[_sender] || !paused);
_;
}
/**
* @dev Adds single address to whitelist.
* @param _whitelistAddress Address to be added to the whitelist
*/
function addToWhitelist(address _whitelistAddress) external onlyOwner {
whitelist[_whitelistAddress] = true;
}
/**
* @dev Adds list of addresses to whitelist. Not overloaded due to limitations with truffle testing.
* @param _whitelistAddresses Addresses to be added to the whitelist
*/
function addManyToWhitelist(address[] _whitelistAddresses) external onlyOwner {
for (uint256 i = 0; i < _whitelistAddresses.length; i++) {
whitelist[_whitelistAddresses[i]] = true;
}
}
/**
* @dev Removes single address from whitelist.
* @param _whitelistAddress Address to be removed to the whitelist
*/
function removeFromWhitelist(address _whitelistAddress) external onlyOwner {
whitelist[_whitelistAddress] = false;
}
// Adding modifier to transfer/approval functions
function transfer(address _to, uint256 _value) public whenNotPausedOrWhitelisted(msg.sender) returns (bool) {
return super.transfer(_to, _value);
}
function transferFrom(address _from, address _to, uint256 _value) public whenNotPausedOrWhitelisted(msg.sender) returns (bool) {
return super.transferFrom(_from, _to, _value);
}
function approve(address _spender, uint256 _value) public whenNotPausedOrWhitelisted(msg.sender) returns (bool) {
return super.approve(_spender, _value);
}
function increaseApproval(address _spender, uint _addedValue) public whenNotPausedOrWhitelisted(msg.sender) returns (bool success) {
return super.increaseApproval(_spender, _addedValue);
}
function decreaseApproval(address _spender, uint _subtractedValue) public whenNotPausedOrWhitelisted(msg.sender) returns (bool success) {
return super.decreaseApproval(_spender, _subtractedValue);
}
}
/**
* @title RTEToken
* @dev ERC20 token implementation
* Pausable
*/
contract RTEToken is WhitelistedPausableToken {
string public constant name = "Rate3";
string public constant symbol = "RTE";
uint8 public constant decimals = 18;
// 1 billion initial supply of RTE tokens
// Taking into account 18 decimals
uint256 public constant INITIAL_SUPPLY = (10 ** 9) * (10 ** 18);
/**
* @dev RTEToken Constructor
* Mints the initial supply of tokens, this is the hard cap, no more tokens will be minted.
* Allocate the tokens to the foundation wallet, issuing wallet etc.
*/
function RTEToken() public {
// Mint initial supply of tokens. All further minting of tokens is disabled
totalSupply_ = INITIAL_SUPPLY;
// Transfer all initial tokens to msg.sender
balances[msg.sender] = INITIAL_SUPPLY;
Transfer(0x0, msg.sender, INITIAL_SUPPLY);
}
}
|
0x60606040526004361061011d576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde0314610122578063095ea7b3146101b057806318160ddd1461020a57806323b872dd146102335780632ff2e9dc146102ac578063313ce567146102d55780633f4ba83a146103045780635c975abb14610319578063661884631461034657806370a08231146103a05780638456cb59146103ed5780638ab1d681146104025780638c10671c1461043b5780638da5cb5b1461046957806395d89b41146104be5780639b19251a1461054c578063a9059cbb1461059d578063d73dd623146105f7578063dd62ed3e14610651578063e43252d7146106bd578063f2fde38b146106f6575b600080fd5b341561012d57600080fd5b61013561072f565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561017557808201518184015260208101905061015a565b50505050905090810190601f1680156101a25780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101bb57600080fd5b6101f0600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610768565b604051808215151515815260200191505060405180910390f35b341561021557600080fd5b61021d6107ee565b6040518082815260200191505060405180910390f35b341561023e57600080fd5b610292600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506107f8565b604051808215151515815260200191505060405180910390f35b34156102b757600080fd5b6102bf610880565b6040518082815260200191505060405180910390f35b34156102e057600080fd5b6102e8610890565b604051808260ff1660ff16815260200191505060405180910390f35b341561030f57600080fd5b610317610895565b005b341561032457600080fd5b61032c610955565b604051808215151515815260200191505060405180910390f35b341561035157600080fd5b610386600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610968565b604051808215151515815260200191505060405180910390f35b34156103ab57600080fd5b6103d7600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506109ee565b6040518082815260200191505060405180910390f35b34156103f857600080fd5b610400610a36565b005b341561040d57600080fd5b610439600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610af7565b005b341561044657600080fd5b61046760048080359060200190820180359060200191909192905050610bae565b005b341561047457600080fd5b61047c610cb0565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156104c957600080fd5b6104d1610cd6565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156105115780820151818401526020810190506104f6565b50505050905090810190601f16801561053e5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561055757600080fd5b610583600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610d0f565b604051808215151515815260200191505060405180910390f35b34156105a857600080fd5b6105dd600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610d2f565b604051808215151515815260200191505060405180910390f35b341561060257600080fd5b610637600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610db5565b604051808215151515815260200191505060405180910390f35b341561065c57600080fd5b6106a7600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610e3b565b6040518082815260200191505060405180910390f35b34156106c857600080fd5b6106f4600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610ec2565b005b341561070157600080fd5b61072d600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610f79565b005b6040805190810160405280600581526020017f526174653300000000000000000000000000000000000000000000000000000081525081565b600033600460008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16806107d05750600360149054906101000a900460ff16155b15156107db57600080fd5b6107e584846110d1565b91505092915050565b6000600154905090565b600033600460008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16806108605750600360149054906101000a900460ff16155b151561086b57600080fd5b6108768585856111c3565b9150509392505050565b6b033b2e3c9fd0803ce800000081565b601281565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156108f157600080fd5b600360149054906101000a900460ff16151561090c57600080fd5b6000600360146101000a81548160ff0219169083151502179055507f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a1565b600360149054906101000a900460ff1681565b600033600460008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16806109d05750600360149054906101000a900460ff16155b15156109db57600080fd5b6109e5848461157d565b91505092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610a9257600080fd5b600360149054906101000a900460ff16151515610aae57600080fd5b6001600360146101000a81548160ff0219169083151502179055507f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a1565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610b5357600080fd5b6000600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610c0c57600080fd5b600090505b82829050811015610cab576001600460008585858181101515610c3057fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080600101915050610c11565b505050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040805190810160405280600381526020017f525445000000000000000000000000000000000000000000000000000000000081525081565b60046020528060005260406000206000915054906101000a900460ff1681565b600033600460008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680610d975750600360149054906101000a900460ff16155b1515610da257600080fd5b610dac848461180e565b91505092915050565b600033600460008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680610e1d5750600360149054906101000a900460ff16155b1515610e2857600080fd5b610e328484611a2d565b91505092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610f1e57600080fd5b6001600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610fd557600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561101157600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561120057600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561124d57600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156112d857600080fd5b611329826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c2990919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506113bc826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c4290919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061148d82600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c2990919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508083111561168e576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611722565b6116a18382611c2990919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561184b57600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561189857600080fd5b6118e9826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c2990919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061197c826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c4290919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b6000611abe82600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c4290919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000828211151515611c3757fe5b818303905092915050565b6000808284019050838110151515611c5657fe5b80915050929150505600a165627a7a72305820f9ea5cd0a7442c793bdb58a50709d06f56261390c22a357e238841ff28082d5c0029
|
{"success": true, "error": null, "results": {}}
| 2,212 |
0xc3E78ff34A0Be3C787E17548598725aA00bf96E8
|
/**
White Doge Coin - $WDOGE
Now that Twitter has become the Freedom of Speech symbol, White Doge Coin will post updates essentially on Twitter
Our objective is quite simple: end the high tax robbery
Use a low slippage to avoid front runners
Telegram: https://t.me/WhiteDogeCoinERC
*/
// 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 WhiteDogeCoin is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "White Doge Coin";
string private constant _symbol = "WDOGE";
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 = 0;
uint256 private _taxFeeOnBuy = 0;
uint256 private _redisFeeOnSell = 0;
uint256 private _taxFeeOnSell = 0;
//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(0x9AB582Ac77775466eFd33eF8A79546c8cEa1397c);
address payable private _marketingAddress = payable(0x9AB582Ac77775466eFd33eF8A79546c8cEa1397c);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 1000000000 * 10**9;
uint256 public _maxWalletSize = 20000000 * 10**9;
uint256 public _swapTokensAtAmount = 5000000 * 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;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f0461461055b578063dd62ed3e1461057b578063ea1644d5146105c1578063f2fde38b146105e157600080fd5b8063a2a957bb146104d6578063a9059cbb146104f6578063bfd7928414610516578063c3c8cd801461054657600080fd5b80638f70ccf7116100d15780638f70ccf7146104525780638f9a55c01461047257806395d89b411461048857806398a5c315146104b657600080fd5b80637d1db4a5146103f15780637f2feddc146104075780638da5cb5b1461043457600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461038757806370a082311461039c578063715018a6146103bc57806374010ece146103d157600080fd5b8063313ce5671461030b57806349bd5a5e146103275780636b999053146103475780636d8aa8f81461036757600080fd5b80631694505e116101ab5780631694505e1461027857806318160ddd146102b057806323b872dd146102d55780632fd689e3146102f557600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024857600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f7366004611965565b610601565b005b34801561020a57600080fd5b5060408051808201909152600f81526e2bb434ba32902237b3b29021b7b4b760891b60208201525b60405161023f9190611a2a565b60405180910390f35b34801561025457600080fd5b50610268610263366004611a7f565b6106a0565b604051901515815260200161023f565b34801561028457600080fd5b50601454610298906001600160a01b031681565b6040516001600160a01b03909116815260200161023f565b3480156102bc57600080fd5b50670de0b6b3a76400005b60405190815260200161023f565b3480156102e157600080fd5b506102686102f0366004611aab565b6106b7565b34801561030157600080fd5b506102c760185481565b34801561031757600080fd5b506040516009815260200161023f565b34801561033357600080fd5b50601554610298906001600160a01b031681565b34801561035357600080fd5b506101fc610362366004611aec565b610720565b34801561037357600080fd5b506101fc610382366004611b19565b61076b565b34801561039357600080fd5b506101fc6107b3565b3480156103a857600080fd5b506102c76103b7366004611aec565b6107fe565b3480156103c857600080fd5b506101fc610820565b3480156103dd57600080fd5b506101fc6103ec366004611b34565b610894565b3480156103fd57600080fd5b506102c760165481565b34801561041357600080fd5b506102c7610422366004611aec565b60116020526000908152604090205481565b34801561044057600080fd5b506000546001600160a01b0316610298565b34801561045e57600080fd5b506101fc61046d366004611b19565b6108c3565b34801561047e57600080fd5b506102c760175481565b34801561049457600080fd5b5060408051808201909152600581526457444f474560d81b6020820152610232565b3480156104c257600080fd5b506101fc6104d1366004611b34565b61090b565b3480156104e257600080fd5b506101fc6104f1366004611b4d565b61093a565b34801561050257600080fd5b50610268610511366004611a7f565b610978565b34801561052257600080fd5b50610268610531366004611aec565b60106020526000908152604090205460ff1681565b34801561055257600080fd5b506101fc610985565b34801561056757600080fd5b506101fc610576366004611b7f565b6109d9565b34801561058757600080fd5b506102c7610596366004611c03565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105cd57600080fd5b506101fc6105dc366004611b34565b610a7a565b3480156105ed57600080fd5b506101fc6105fc366004611aec565b610aa9565b6000546001600160a01b031633146106345760405162461bcd60e51b815260040161062b90611c3c565b60405180910390fd5b60005b815181101561069c5760016010600084848151811061065857610658611c71565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061069481611c9d565b915050610637565b5050565b60006106ad338484610b93565b5060015b92915050565b60006106c4848484610cb7565b610716843361071185604051806060016040528060288152602001611db7602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111f3565b610b93565b5060019392505050565b6000546001600160a01b0316331461074a5760405162461bcd60e51b815260040161062b90611c3c565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107955760405162461bcd60e51b815260040161062b90611c3c565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107e857506013546001600160a01b0316336001600160a01b0316145b6107f157600080fd5b476107fb8161122d565b50565b6001600160a01b0381166000908152600260205260408120546106b190611267565b6000546001600160a01b0316331461084a5760405162461bcd60e51b815260040161062b90611c3c565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108be5760405162461bcd60e51b815260040161062b90611c3c565b601655565b6000546001600160a01b031633146108ed5760405162461bcd60e51b815260040161062b90611c3c565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146109355760405162461bcd60e51b815260040161062b90611c3c565b601855565b6000546001600160a01b031633146109645760405162461bcd60e51b815260040161062b90611c3c565b600893909355600a91909155600955600b55565b60006106ad338484610cb7565b6012546001600160a01b0316336001600160a01b031614806109ba57506013546001600160a01b0316336001600160a01b0316145b6109c357600080fd5b60006109ce306107fe565b90506107fb816112eb565b6000546001600160a01b03163314610a035760405162461bcd60e51b815260040161062b90611c3c565b60005b82811015610a74578160056000868685818110610a2557610a25611c71565b9050602002016020810190610a3a9190611aec565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a6c81611c9d565b915050610a06565b50505050565b6000546001600160a01b03163314610aa45760405162461bcd60e51b815260040161062b90611c3c565b601755565b6000546001600160a01b03163314610ad35760405162461bcd60e51b815260040161062b90611c3c565b6001600160a01b038116610b385760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161062b565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bf55760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161062b565b6001600160a01b038216610c565760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161062b565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d1b5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161062b565b6001600160a01b038216610d7d5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161062b565b60008111610ddf5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161062b565b6000546001600160a01b03848116911614801590610e0b57506000546001600160a01b03838116911614155b156110ec57601554600160a01b900460ff16610ea4576000546001600160a01b03848116911614610ea45760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400606482015260840161062b565b601654811115610ef65760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000604482015260640161062b565b6001600160a01b03831660009081526010602052604090205460ff16158015610f3857506001600160a01b03821660009081526010602052604090205460ff16155b610f905760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b606482015260840161062b565b6015546001600160a01b038381169116146110155760175481610fb2846107fe565b610fbc9190611cb8565b106110155760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b606482015260840161062b565b6000611020306107fe565b6018546016549192508210159082106110395760165491505b8080156110505750601554600160a81b900460ff16155b801561106a57506015546001600160a01b03868116911614155b801561107f5750601554600160b01b900460ff165b80156110a457506001600160a01b03851660009081526005602052604090205460ff16155b80156110c957506001600160a01b03841660009081526005602052604090205460ff16155b156110e9576110d7826112eb565b4780156110e7576110e74761122d565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061112e57506001600160a01b03831660009081526005602052604090205460ff165b8061116057506015546001600160a01b0385811691161480159061116057506015546001600160a01b03848116911614155b1561116d575060006111e7565b6015546001600160a01b03858116911614801561119857506014546001600160a01b03848116911614155b156111aa57600854600c55600954600d555b6015546001600160a01b0384811691161480156111d557506014546001600160a01b03858116911614155b156111e757600a54600c55600b54600d555b610a7484848484611474565b600081848411156112175760405162461bcd60e51b815260040161062b9190611a2a565b5060006112248486611cd0565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f1935050505015801561069c573d6000803e3d6000fd5b60006006548211156112ce5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161062b565b60006112d86114a2565b90506112e483826114c5565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061133357611333611c71565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561138757600080fd5b505afa15801561139b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113bf9190611ce7565b816001815181106113d2576113d2611c71565b6001600160a01b0392831660209182029290920101526014546113f89130911684610b93565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac94790611431908590600090869030904290600401611d04565b600060405180830381600087803b15801561144b57600080fd5b505af115801561145f573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b8061148157611481611507565b61148c848484611535565b80610a7457610a74600e54600c55600f54600d55565b60008060006114af61162c565b90925090506114be82826114c5565b9250505090565b60006112e483836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061166c565b600c541580156115175750600d54155b1561151e57565b600c8054600e55600d8054600f5560009182905555565b6000806000806000806115478761169a565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061157990876116f7565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115a89086611739565b6001600160a01b0389166000908152600260205260409020556115ca81611798565b6115d484836117e2565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161161991815260200190565b60405180910390a3505050505050505050565b6006546000908190670de0b6b3a764000061164782826114c5565b82101561166357505060065492670de0b6b3a764000092509050565b90939092509050565b6000818361168d5760405162461bcd60e51b815260040161062b9190611a2a565b5060006112248486611d75565b60008060008060008060008060006116b78a600c54600d54611806565b92509250925060006116c76114a2565b905060008060006116da8e87878761185b565b919e509c509a509598509396509194505050505091939550919395565b60006112e483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111f3565b6000806117468385611cb8565b9050838110156112e45760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161062b565b60006117a26114a2565b905060006117b083836118ab565b306000908152600260205260409020549091506117cd9082611739565b30600090815260026020526040902055505050565b6006546117ef90836116f7565b6006556007546117ff9082611739565b6007555050565b6000808080611820606461181a89896118ab565b906114c5565b90506000611833606461181a8a896118ab565b9050600061184b826118458b866116f7565b906116f7565b9992985090965090945050505050565b600080808061186a88866118ab565b9050600061187888876118ab565b9050600061188688886118ab565b905060006118988261184586866116f7565b939b939a50919850919650505050505050565b6000826118ba575060006106b1565b60006118c68385611d97565b9050826118d38583611d75565b146112e45760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161062b565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107fb57600080fd5b803561196081611940565b919050565b6000602080838503121561197857600080fd5b823567ffffffffffffffff8082111561199057600080fd5b818501915085601f8301126119a457600080fd5b8135818111156119b6576119b661192a565b8060051b604051601f19603f830116810181811085821117156119db576119db61192a565b6040529182528482019250838101850191888311156119f957600080fd5b938501935b82851015611a1e57611a0f85611955565b845293850193928501926119fe565b98975050505050505050565b600060208083528351808285015260005b81811015611a5757858101830151858201604001528201611a3b565b81811115611a69576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611a9257600080fd5b8235611a9d81611940565b946020939093013593505050565b600080600060608486031215611ac057600080fd5b8335611acb81611940565b92506020840135611adb81611940565b929592945050506040919091013590565b600060208284031215611afe57600080fd5b81356112e481611940565b8035801515811461196057600080fd5b600060208284031215611b2b57600080fd5b6112e482611b09565b600060208284031215611b4657600080fd5b5035919050565b60008060008060808587031215611b6357600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611b9457600080fd5b833567ffffffffffffffff80821115611bac57600080fd5b818601915086601f830112611bc057600080fd5b813581811115611bcf57600080fd5b8760208260051b8501011115611be457600080fd5b602092830195509350611bfa9186019050611b09565b90509250925092565b60008060408385031215611c1657600080fd5b8235611c2181611940565b91506020830135611c3181611940565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611cb157611cb1611c87565b5060010190565b60008219821115611ccb57611ccb611c87565b500190565b600082821015611ce257611ce2611c87565b500390565b600060208284031215611cf957600080fd5b81516112e481611940565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d545784516001600160a01b031683529383019391830191600101611d2f565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611d9257634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611db157611db1611c87565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220b68479e66c16c25dcf57129ab916f4db559e1edce1b6362da654417815debc3364736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 2,213 |
0x41ea6d7c14606cf9f001440234d1c30debb6902c
|
/**
*Submitted for verification at Etherscan.io on 2021-10-27
*/
/**
*Submitted for verification at Etherscan.io on 2021-10-27
*/
/**
*
**/
//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 Daisuke 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(0xC654A505E3d38932cAb03CCc14418044A078F8A4);
address payable private _feeAddrWallet2 = payable(0x3bD631d7b35F850B0a27CC1E4BdF1680C4cA4e89);
string private constant _name = "Daisuke Inu";
string private constant _symbol = "DAISUKE";
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);
}
}
|
0x6080604052600436106101185760003560e01c8063715018a6116100a0578063b515566a11610064578063b515566a14610398578063c3c8cd80146103c1578063c9567bf9146103d8578063cfe81ba0146103ef578063dd62ed3e146104185761011f565b8063715018a6146102c5578063842b7c08146102dc5780638da5cb5b1461030557806395d89b4114610330578063a9059cbb1461035b5761011f565b8063273123b7116100e7578063273123b7146101f4578063313ce5671461021d5780635932ead1146102485780636fc3eaec1461027157806370a08231146102885761011f565b806306fdde0314610124578063095ea7b31461014f57806318160ddd1461018c57806323b872dd146101b75761011f565b3661011f57005b600080fd5b34801561013057600080fd5b50610139610455565b6040516101469190612bb9565b60405180910390f35b34801561015b57600080fd5b50610176600480360381019061017191906126ff565b610492565b6040516101839190612b9e565b60405180910390f35b34801561019857600080fd5b506101a16104b0565b6040516101ae9190612d3b565b60405180910390f35b3480156101c357600080fd5b506101de60048036038101906101d991906126b0565b6104c4565b6040516101eb9190612b9e565b60405180910390f35b34801561020057600080fd5b5061021b60048036038101906102169190612622565b61059d565b005b34801561022957600080fd5b5061023261068d565b60405161023f9190612db0565b60405180910390f35b34801561025457600080fd5b5061026f600480360381019061026a919061277c565b610696565b005b34801561027d57600080fd5b50610286610748565b005b34801561029457600080fd5b506102af60048036038101906102aa9190612622565b6107ba565b6040516102bc9190612d3b565b60405180910390f35b3480156102d157600080fd5b506102da61080b565b005b3480156102e857600080fd5b5061030360048036038101906102fe91906127ce565b61095e565b005b34801561031157600080fd5b5061031a6109ff565b6040516103279190612ad0565b60405180910390f35b34801561033c57600080fd5b50610345610a28565b6040516103529190612bb9565b60405180910390f35b34801561036757600080fd5b50610382600480360381019061037d91906126ff565b610a65565b60405161038f9190612b9e565b60405180910390f35b3480156103a457600080fd5b506103bf60048036038101906103ba919061273b565b610a83565b005b3480156103cd57600080fd5b506103d6610bd3565b005b3480156103e457600080fd5b506103ed610c4d565b005b3480156103fb57600080fd5b50610416600480360381019061041191906127ce565b6111af565b005b34801561042457600080fd5b5061043f600480360381019061043a9190612674565b611250565b60405161044c9190612d3b565b60405180910390f35b60606040518060400160405280600b81526020017f44616973756b6520496e75000000000000000000000000000000000000000000815250905090565b60006104a661049f6112d7565b84846112df565b6001905092915050565b60006b033b2e3c9fd0803ce8000000905090565b60006104d18484846114aa565b610592846104dd6112d7565b61058d8560405180606001604052806028815260200161344b60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006105436112d7565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546119889092919063ffffffff16565b6112df565b600190509392505050565b6105a56112d7565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610632576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161062990612c9b565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b61069e6112d7565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461072b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161072290612c9b565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107896112d7565b73ffffffffffffffffffffffffffffffffffffffff16146107a957600080fd5b60004790506107b7816119ec565b50565b6000610804600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ae7565b9050919050565b6108136112d7565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146108a0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161089790612c9b565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661099f6112d7565b73ffffffffffffffffffffffffffffffffffffffff16146109f5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109ec90612bfb565b60405180910390fd5b80600a8190555050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600781526020017f44414953554b4500000000000000000000000000000000000000000000000000815250905090565b6000610a79610a726112d7565b84846114aa565b6001905092915050565b610a8b6112d7565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b18576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b0f90612c9b565b60405180910390fd5b60005b8151811015610bcf57600160066000848481518110610b63577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610bc790613051565b915050610b1b565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610c146112d7565b73ffffffffffffffffffffffffffffffffffffffff1614610c3457600080fd5b6000610c3f306107ba565b9050610c4a81611b55565b50565b610c556112d7565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ce2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cd990612c9b565b60405180910390fd5b600f60149054906101000a900460ff1615610d32576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d2990612d1b565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610dc530600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166b033b2e3c9fd0803ce80000006112df565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610e0b57600080fd5b505afa158015610e1f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e43919061264b565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610ea557600080fd5b505afa158015610eb9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610edd919061264b565b6040518363ffffffff1660e01b8152600401610efa929190612aeb565b602060405180830381600087803b158015610f1457600080fd5b505af1158015610f28573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f4c919061264b565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610fd5306107ba565b600080610fe06109ff565b426040518863ffffffff1660e01b815260040161100296959493929190612b3d565b6060604051808303818588803b15801561101b57600080fd5b505af115801561102f573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061105491906127f7565b5050506001600f60166101000a81548160ff0219169083151502179055506001600f60176101000a81548160ff0219169083151502179055506a295be96e640669720000006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401611159929190612b14565b602060405180830381600087803b15801561117357600080fd5b505af1158015611187573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111ab91906127a5565b5050565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166111f06112d7565b73ffffffffffffffffffffffffffffffffffffffff1614611246576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161123d90612bfb565b60405180910390fd5b80600b8190555050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561134f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161134690612cfb565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156113bf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113b690612c3b565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161149d9190612d3b565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561151a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161151190612cdb565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561158a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158190612bdb565b60405180910390fd5b600081116115cd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115c490612cbb565b60405180910390fd5b6115d56109ff565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561164357506116136109ff565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561197857600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156116ec5750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6116f557600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156117a05750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156117f65750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b801561180e5750600f60179054906101000a900460ff165b156118be5760105481111561182257600080fd5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541061186d57600080fd5b601e4261187a9190612e71565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b60006118c9306107ba565b9050600f60159054906101000a900460ff161580156119365750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b801561194e5750600f60169054906101000a900460ff165b156119765761195c81611b55565b6000479050600081111561197457611973476119ec565b5b505b505b611983838383611e4f565b505050565b60008383111582906119d0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119c79190612bb9565b60405180910390fd5b50600083856119df9190612f52565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611a3c600284611e5f90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611a67573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611ab8600284611e5f90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611ae3573d6000803e3d6000fd5b5050565b6000600854821115611b2e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b2590612c1b565b60405180910390fd5b6000611b38611ea9565b9050611b4d8184611e5f90919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611bb3577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611be15781602001602082028036833780820191505090505b5090503081600081518110611c1f577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611cc157600080fd5b505afa158015611cd5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cf9919061264b565b81600181518110611d33577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611d9a30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112df565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401611dfe959493929190612d56565b600060405180830381600087803b158015611e1857600080fd5b505af1158015611e2c573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b611e5a838383611ed4565b505050565b6000611ea183836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061209f565b905092915050565b6000806000611eb6612102565b91509150611ecd8183611e5f90919063ffffffff16565b9250505090565b600080600080600080611ee68761216d565b955095509550955095509550611f4486600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546121d590919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611fd985600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461221f90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506120258161227d565b61202f848361233a565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161208c9190612d3b565b60405180910390a3505050505050505050565b600080831182906120e6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120dd9190612bb9565b60405180910390fd5b50600083856120f59190612ec7565b9050809150509392505050565b6000806000600854905060006b033b2e3c9fd0803ce8000000905061213e6b033b2e3c9fd0803ce8000000600854611e5f90919063ffffffff16565b821015612160576008546b033b2e3c9fd0803ce8000000935093505050612169565b81819350935050505b9091565b600080600080600080600080600061218a8a600a54600b54612374565b925092509250600061219a611ea9565b905060008060006121ad8e87878761240a565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061221783836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611988565b905092915050565b600080828461222e9190612e71565b905083811015612273576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161226a90612c5b565b60405180910390fd5b8091505092915050565b6000612287611ea9565b9050600061229e828461249390919063ffffffff16565b90506122f281600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461221f90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b61234f826008546121d590919063ffffffff16565b60088190555061236a8160095461221f90919063ffffffff16565b6009819055505050565b6000806000806123a06064612392888a61249390919063ffffffff16565b611e5f90919063ffffffff16565b905060006123ca60646123bc888b61249390919063ffffffff16565b611e5f90919063ffffffff16565b905060006123f3826123e5858c6121d590919063ffffffff16565b6121d590919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612423858961249390919063ffffffff16565b9050600061243a868961249390919063ffffffff16565b90506000612451878961249390919063ffffffff16565b9050600061247a8261246c85876121d590919063ffffffff16565b6121d590919063ffffffff16565b9050838184965096509650505050509450945094915050565b6000808314156124a65760009050612508565b600082846124b49190612ef8565b90508284826124c39190612ec7565b14612503576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016124fa90612c7b565b60405180910390fd5b809150505b92915050565b600061252161251c84612df0565b612dcb565b9050808382526020820190508285602086028201111561254057600080fd5b60005b858110156125705781612556888261257a565b845260208401935060208301925050600181019050612543565b5050509392505050565b60008135905061258981613405565b92915050565b60008151905061259e81613405565b92915050565b600082601f8301126125b557600080fd5b81356125c584826020860161250e565b91505092915050565b6000813590506125dd8161341c565b92915050565b6000815190506125f28161341c565b92915050565b60008135905061260781613433565b92915050565b60008151905061261c81613433565b92915050565b60006020828403121561263457600080fd5b60006126428482850161257a565b91505092915050565b60006020828403121561265d57600080fd5b600061266b8482850161258f565b91505092915050565b6000806040838503121561268757600080fd5b60006126958582860161257a565b92505060206126a68582860161257a565b9150509250929050565b6000806000606084860312156126c557600080fd5b60006126d38682870161257a565b93505060206126e48682870161257a565b92505060406126f5868287016125f8565b9150509250925092565b6000806040838503121561271257600080fd5b60006127208582860161257a565b9250506020612731858286016125f8565b9150509250929050565b60006020828403121561274d57600080fd5b600082013567ffffffffffffffff81111561276757600080fd5b612773848285016125a4565b91505092915050565b60006020828403121561278e57600080fd5b600061279c848285016125ce565b91505092915050565b6000602082840312156127b757600080fd5b60006127c5848285016125e3565b91505092915050565b6000602082840312156127e057600080fd5b60006127ee848285016125f8565b91505092915050565b60008060006060848603121561280c57600080fd5b600061281a8682870161260d565b935050602061282b8682870161260d565b925050604061283c8682870161260d565b9150509250925092565b6000612852838361285e565b60208301905092915050565b61286781612f86565b82525050565b61287681612f86565b82525050565b600061288782612e2c565b6128918185612e4f565b935061289c83612e1c565b8060005b838110156128cd5781516128b48882612846565b97506128bf83612e42565b9250506001810190506128a0565b5085935050505092915050565b6128e381612f98565b82525050565b6128f281612fdb565b82525050565b600061290382612e37565b61290d8185612e60565b935061291d818560208601612fed565b61292681613127565b840191505092915050565b600061293e602383612e60565b915061294982613138565b604082019050919050565b6000612961600c83612e60565b915061296c82613187565b602082019050919050565b6000612984602a83612e60565b915061298f826131b0565b604082019050919050565b60006129a7602283612e60565b91506129b2826131ff565b604082019050919050565b60006129ca601b83612e60565b91506129d58261324e565b602082019050919050565b60006129ed602183612e60565b91506129f882613277565b604082019050919050565b6000612a10602083612e60565b9150612a1b826132c6565b602082019050919050565b6000612a33602983612e60565b9150612a3e826132ef565b604082019050919050565b6000612a56602583612e60565b9150612a618261333e565b604082019050919050565b6000612a79602483612e60565b9150612a848261338d565b604082019050919050565b6000612a9c601783612e60565b9150612aa7826133dc565b602082019050919050565b612abb81612fc4565b82525050565b612aca81612fce565b82525050565b6000602082019050612ae5600083018461286d565b92915050565b6000604082019050612b00600083018561286d565b612b0d602083018461286d565b9392505050565b6000604082019050612b29600083018561286d565b612b366020830184612ab2565b9392505050565b600060c082019050612b52600083018961286d565b612b5f6020830188612ab2565b612b6c60408301876128e9565b612b7960608301866128e9565b612b86608083018561286d565b612b9360a0830184612ab2565b979650505050505050565b6000602082019050612bb360008301846128da565b92915050565b60006020820190508181036000830152612bd381846128f8565b905092915050565b60006020820190508181036000830152612bf481612931565b9050919050565b60006020820190508181036000830152612c1481612954565b9050919050565b60006020820190508181036000830152612c3481612977565b9050919050565b60006020820190508181036000830152612c548161299a565b9050919050565b60006020820190508181036000830152612c74816129bd565b9050919050565b60006020820190508181036000830152612c94816129e0565b9050919050565b60006020820190508181036000830152612cb481612a03565b9050919050565b60006020820190508181036000830152612cd481612a26565b9050919050565b60006020820190508181036000830152612cf481612a49565b9050919050565b60006020820190508181036000830152612d1481612a6c565b9050919050565b60006020820190508181036000830152612d3481612a8f565b9050919050565b6000602082019050612d506000830184612ab2565b92915050565b600060a082019050612d6b6000830188612ab2565b612d7860208301876128e9565b8181036040830152612d8a818661287c565b9050612d99606083018561286d565b612da66080830184612ab2565b9695505050505050565b6000602082019050612dc56000830184612ac1565b92915050565b6000612dd5612de6565b9050612de18282613020565b919050565b6000604051905090565b600067ffffffffffffffff821115612e0b57612e0a6130f8565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000612e7c82612fc4565b9150612e8783612fc4565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115612ebc57612ebb61309a565b5b828201905092915050565b6000612ed282612fc4565b9150612edd83612fc4565b925082612eed57612eec6130c9565b5b828204905092915050565b6000612f0382612fc4565b9150612f0e83612fc4565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612f4757612f4661309a565b5b828202905092915050565b6000612f5d82612fc4565b9150612f6883612fc4565b925082821015612f7b57612f7a61309a565b5b828203905092915050565b6000612f9182612fa4565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000612fe682612fc4565b9050919050565b60005b8381101561300b578082015181840152602081019050612ff0565b8381111561301a576000848401525b50505050565b61302982613127565b810181811067ffffffffffffffff82111715613048576130476130f8565b5b80604052505050565b600061305c82612fc4565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561308f5761308e61309a565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f556e617574686f72697a65640000000000000000000000000000000000000000600082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b61340e81612f86565b811461341957600080fd5b50565b61342581612f98565b811461343057600080fd5b50565b61343c81612fc4565b811461344757600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220bc8f4f10ecae5b6bea3b4f3343d66200442897dd8d98a5a214a7613112e159f864736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 2,214 |
0xee946c032374fee022aa9007fd7d6c73931f7658
|
// 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 DizoInu is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Dizo Inu";
string private constant _symbol = "DIZO";
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 = 0;
uint256 private _taxFeeOnBuy = 3;
uint256 private _redisFeeOnSell = 0;
uint256 private _taxFeeOnSell = 5;
//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(0x903777b27Fd3f1A2Fd85b384441c2252ECFB52Aa);
address payable private _marketingAddress = payable(0x903777b27Fd3f1A2Fd85b384441c2252ECFB52Aa);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 1000000000 * 10**9;
uint256 public _maxWalletSize = 20000000 * 10**9;
uint256 public _swapTokensAtAmount = 1000000 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);//
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_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;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610553578063dd62ed3e14610573578063ea1644d5146105b9578063f2fde38b146105d957600080fd5b8063a2a957bb146104ce578063a9059cbb146104ee578063bfd792841461050e578063c3c8cd801461053e57600080fd5b80638f70ccf7116100d15780638f70ccf71461044b5780638f9a55c01461046b57806395d89b411461048157806398a5c315146104ae57600080fd5b80637d1db4a5146103ea5780637f2feddc146104005780638da5cb5b1461042d57600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461038057806370a0823114610395578063715018a6146103b557806374010ece146103ca57600080fd5b8063313ce5671461030457806349bd5a5e146103205780636b999053146103405780636d8aa8f81461036057600080fd5b80631694505e116101ab5780631694505e1461027157806318160ddd146102a957806323b872dd146102ce5780632fd689e3146102ee57600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024157600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f736600461195d565b6105f9565b005b34801561020a57600080fd5b5060408051808201909152600881526744697a6f20496e7560c01b60208201525b6040516102389190611a22565b60405180910390f35b34801561024d57600080fd5b5061026161025c366004611a77565b610698565b6040519015158152602001610238565b34801561027d57600080fd5b50601454610291906001600160a01b031681565b6040516001600160a01b039091168152602001610238565b3480156102b557600080fd5b50670de0b6b3a76400005b604051908152602001610238565b3480156102da57600080fd5b506102616102e9366004611aa3565b6106af565b3480156102fa57600080fd5b506102c060185481565b34801561031057600080fd5b5060405160098152602001610238565b34801561032c57600080fd5b50601554610291906001600160a01b031681565b34801561034c57600080fd5b506101fc61035b366004611ae4565b610718565b34801561036c57600080fd5b506101fc61037b366004611b11565b610763565b34801561038c57600080fd5b506101fc6107ab565b3480156103a157600080fd5b506102c06103b0366004611ae4565b6107f6565b3480156103c157600080fd5b506101fc610818565b3480156103d657600080fd5b506101fc6103e5366004611b2c565b61088c565b3480156103f657600080fd5b506102c060165481565b34801561040c57600080fd5b506102c061041b366004611ae4565b60116020526000908152604090205481565b34801561043957600080fd5b506000546001600160a01b0316610291565b34801561045757600080fd5b506101fc610466366004611b11565b6108bb565b34801561047757600080fd5b506102c060175481565b34801561048d57600080fd5b5060408051808201909152600481526344495a4f60e01b602082015261022b565b3480156104ba57600080fd5b506101fc6104c9366004611b2c565b610903565b3480156104da57600080fd5b506101fc6104e9366004611b45565b610932565b3480156104fa57600080fd5b50610261610509366004611a77565b610970565b34801561051a57600080fd5b50610261610529366004611ae4565b60106020526000908152604090205460ff1681565b34801561054a57600080fd5b506101fc61097d565b34801561055f57600080fd5b506101fc61056e366004611b77565b6109d1565b34801561057f57600080fd5b506102c061058e366004611bfb565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105c557600080fd5b506101fc6105d4366004611b2c565b610a72565b3480156105e557600080fd5b506101fc6105f4366004611ae4565b610aa1565b6000546001600160a01b0316331461062c5760405162461bcd60e51b815260040161062390611c34565b60405180910390fd5b60005b81518110156106945760016010600084848151811061065057610650611c69565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061068c81611c95565b91505061062f565b5050565b60006106a5338484610b8b565b5060015b92915050565b60006106bc848484610caf565b61070e843361070985604051806060016040528060288152602001611daf602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111eb565b610b8b565b5060019392505050565b6000546001600160a01b031633146107425760405162461bcd60e51b815260040161062390611c34565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b0316331461078d5760405162461bcd60e51b815260040161062390611c34565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107e057506013546001600160a01b0316336001600160a01b0316145b6107e957600080fd5b476107f381611225565b50565b6001600160a01b0381166000908152600260205260408120546106a99061125f565b6000546001600160a01b031633146108425760405162461bcd60e51b815260040161062390611c34565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108b65760405162461bcd60e51b815260040161062390611c34565b601655565b6000546001600160a01b031633146108e55760405162461bcd60e51b815260040161062390611c34565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b0316331461092d5760405162461bcd60e51b815260040161062390611c34565b601855565b6000546001600160a01b0316331461095c5760405162461bcd60e51b815260040161062390611c34565b600893909355600a91909155600955600b55565b60006106a5338484610caf565b6012546001600160a01b0316336001600160a01b031614806109b257506013546001600160a01b0316336001600160a01b0316145b6109bb57600080fd5b60006109c6306107f6565b90506107f3816112e3565b6000546001600160a01b031633146109fb5760405162461bcd60e51b815260040161062390611c34565b60005b82811015610a6c578160056000868685818110610a1d57610a1d611c69565b9050602002016020810190610a329190611ae4565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a6481611c95565b9150506109fe565b50505050565b6000546001600160a01b03163314610a9c5760405162461bcd60e51b815260040161062390611c34565b601755565b6000546001600160a01b03163314610acb5760405162461bcd60e51b815260040161062390611c34565b6001600160a01b038116610b305760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610623565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bed5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610623565b6001600160a01b038216610c4e5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610623565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d135760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610623565b6001600160a01b038216610d755760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610623565b60008111610dd75760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610623565b6000546001600160a01b03848116911614801590610e0357506000546001600160a01b03838116911614155b156110e457601554600160a01b900460ff16610e9c576000546001600160a01b03848116911614610e9c5760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c6564006064820152608401610623565b601654811115610eee5760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610623565b6001600160a01b03831660009081526010602052604090205460ff16158015610f3057506001600160a01b03821660009081526010602052604090205460ff16155b610f885760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b6064820152608401610623565b6015546001600160a01b0383811691161461100d5760175481610faa846107f6565b610fb49190611cb0565b1061100d5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610623565b6000611018306107f6565b6018546016549192508210159082106110315760165491505b8080156110485750601554600160a81b900460ff16155b801561106257506015546001600160a01b03868116911614155b80156110775750601554600160b01b900460ff165b801561109c57506001600160a01b03851660009081526005602052604090205460ff16155b80156110c157506001600160a01b03841660009081526005602052604090205460ff16155b156110e1576110cf826112e3565b4780156110df576110df47611225565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061112657506001600160a01b03831660009081526005602052604090205460ff165b8061115857506015546001600160a01b0385811691161480159061115857506015546001600160a01b03848116911614155b15611165575060006111df565b6015546001600160a01b03858116911614801561119057506014546001600160a01b03848116911614155b156111a257600854600c55600954600d555b6015546001600160a01b0384811691161480156111cd57506014546001600160a01b03858116911614155b156111df57600a54600c55600b54600d555b610a6c8484848461146c565b6000818484111561120f5760405162461bcd60e51b81526004016106239190611a22565b50600061121c8486611cc8565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610694573d6000803e3d6000fd5b60006006548211156112c65760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610623565b60006112d061149a565b90506112dc83826114bd565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061132b5761132b611c69565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561137f57600080fd5b505afa158015611393573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113b79190611cdf565b816001815181106113ca576113ca611c69565b6001600160a01b0392831660209182029290920101526014546113f09130911684610b8b565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac94790611429908590600090869030904290600401611cfc565b600060405180830381600087803b15801561144357600080fd5b505af1158015611457573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b80611479576114796114ff565b61148484848461152d565b80610a6c57610a6c600e54600c55600f54600d55565b60008060006114a7611624565b90925090506114b682826114bd565b9250505090565b60006112dc83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611664565b600c5415801561150f5750600d54155b1561151657565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061153f87611692565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061157190876116ef565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115a09086611731565b6001600160a01b0389166000908152600260205260409020556115c281611790565b6115cc84836117da565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161161191815260200190565b60405180910390a3505050505050505050565b6006546000908190670de0b6b3a764000061163f82826114bd565b82101561165b57505060065492670de0b6b3a764000092509050565b90939092509050565b600081836116855760405162461bcd60e51b81526004016106239190611a22565b50600061121c8486611d6d565b60008060008060008060008060006116af8a600c54600d546117fe565b92509250925060006116bf61149a565b905060008060006116d28e878787611853565b919e509c509a509598509396509194505050505091939550919395565b60006112dc83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111eb565b60008061173e8385611cb0565b9050838110156112dc5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610623565b600061179a61149a565b905060006117a883836118a3565b306000908152600260205260409020549091506117c59082611731565b30600090815260026020526040902055505050565b6006546117e790836116ef565b6006556007546117f79082611731565b6007555050565b6000808080611818606461181289896118a3565b906114bd565b9050600061182b60646118128a896118a3565b905060006118438261183d8b866116ef565b906116ef565b9992985090965090945050505050565b600080808061186288866118a3565b9050600061187088876118a3565b9050600061187e88886118a3565b905060006118908261183d86866116ef565b939b939a50919850919650505050505050565b6000826118b2575060006106a9565b60006118be8385611d8f565b9050826118cb8583611d6d565b146112dc5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610623565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107f357600080fd5b803561195881611938565b919050565b6000602080838503121561197057600080fd5b823567ffffffffffffffff8082111561198857600080fd5b818501915085601f83011261199c57600080fd5b8135818111156119ae576119ae611922565b8060051b604051601f19603f830116810181811085821117156119d3576119d3611922565b6040529182528482019250838101850191888311156119f157600080fd5b938501935b82851015611a1657611a078561194d565b845293850193928501926119f6565b98975050505050505050565b600060208083528351808285015260005b81811015611a4f57858101830151858201604001528201611a33565b81811115611a61576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611a8a57600080fd5b8235611a9581611938565b946020939093013593505050565b600080600060608486031215611ab857600080fd5b8335611ac381611938565b92506020840135611ad381611938565b929592945050506040919091013590565b600060208284031215611af657600080fd5b81356112dc81611938565b8035801515811461195857600080fd5b600060208284031215611b2357600080fd5b6112dc82611b01565b600060208284031215611b3e57600080fd5b5035919050565b60008060008060808587031215611b5b57600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611b8c57600080fd5b833567ffffffffffffffff80821115611ba457600080fd5b818601915086601f830112611bb857600080fd5b813581811115611bc757600080fd5b8760208260051b8501011115611bdc57600080fd5b602092830195509350611bf29186019050611b01565b90509250925092565b60008060408385031215611c0e57600080fd5b8235611c1981611938565b91506020830135611c2981611938565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611ca957611ca9611c7f565b5060010190565b60008219821115611cc357611cc3611c7f565b500190565b600082821015611cda57611cda611c7f565b500390565b600060208284031215611cf157600080fd5b81516112dc81611938565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d4c5784516001600160a01b031683529383019391830191600101611d27565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611d8a57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611da957611da9611c7f565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122013a595dca89ac0bd8d269f0ef304ca4d07866e792a36079b7d7f9ca0e60398e964736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 2,215 |
0x559c06d451af0a2ee2956ec2f246d875fa344aec
|
/**
*Submitted for verification at Etherscan.io on 2022-03-08
*/
/*
Ninjatama is one type of Ninken which are essentially dogs that have heightened senses and abilities, and as such, are able to work and be summoned alongside ninja. Ninjatama is well-trained by experienced ninja to perform difficult missions thus it is equipped with various sets of skills which includes providing cryptocurrency advice for its owner! It’s heightened senses can help its owner to detect scammers and honeypots. Earn your own Ninjatama now and keep yourself away from fraud!
Tokenomics:
Max supply: 1B
Max hold: 2%
Initial LP: 2 ETH
Tax 12%
5% Reward Pool
4% Marketing Wallet
3% Development Wallet
https://t.me/ninjatama
*/
// 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 NINJATAMA 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 = "NinjaTama";
string private constant _symbol = "NINJATAMA";
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(0x23cE7e6997Dec002d80b2201A70866CBE15b5705);
_buyTax = 12;
_sellTax = 12;
_rOwned[address(this)] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddress] = true;
emit Transfer(address(0), address(this), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setremoveMaxTx(bool onoff) external onlyOwner() {
removeMaxTx = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
require(!bots[from]);
if (!_isExcludedFromFee[from]
&& !_isExcludedFromFee[to] ) {
_feeAddr1 = 0;
_feeAddr2 = _buyTax;
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && removeMaxTx) {
uint walletBalance = balanceOf(address(to));
require(amount.add(walletBalance) <= _maxTxAmount);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_feeAddr1 = 0;
_feeAddr2 = _sellTax;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function 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 = 20_000_001 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() public onlyOwner() {
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() public onlyOwner() {
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _feeAddr1, _feeAddr2);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _setMaxTxAmount(uint256 maxTxAmount) external onlyOwner() {
if (maxTxAmount > 20_000_001 * 10**9) {
_maxTxAmount = maxTxAmount;
}
}
function _setSellTax(uint256 sellTax) external onlyOwner() {
if (sellTax < 15) {
_sellTax = sellTax;
}
}
function setBuyTax(uint256 buyTax) external onlyOwner() {
if (buyTax < 15) {
_buyTax = buyTax;
}
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
}
|
0x60806040526004361061012e5760003560e01c8063715018a6116100ab578063b515566a1161006f578063b515566a1461034a578063c3c8cd801461036a578063c9567bf91461037f578063dbe8272c14610394578063dc1052e2146103b4578063dd62ed3e146103d457600080fd5b8063715018a6146102a65780638da5cb5b146102bb57806395d89b41146102e35780639e78fb4f14610315578063a9059cbb1461032a57600080fd5b806323b872dd116100f257806323b872dd14610215578063273123b714610235578063313ce567146102555780636fc3eaec1461027157806370a082311461028657600080fd5b8063013206211461013a57806306fdde031461015c578063095ea7b3146101a057806318160ddd146101d05780631bbae6e0146101f557600080fd5b3661013557005b600080fd5b34801561014657600080fd5b5061015a610155366004611668565b61041a565b005b34801561016857600080fd5b506040805180820190915260098152684e696e6a6154616d6160b81b60208201525b6040516101979190611685565b60405180910390f35b3480156101ac57600080fd5b506101c06101bb3660046116ff565b61046b565b6040519015158152602001610197565b3480156101dc57600080fd5b50670de0b6b3a76400005b604051908152602001610197565b34801561020157600080fd5b5061015a61021036600461172b565b610482565b34801561022157600080fd5b506101c0610230366004611744565b6104c4565b34801561024157600080fd5b5061015a610250366004611785565b61052d565b34801561026157600080fd5b5060405160098152602001610197565b34801561027d57600080fd5b5061015a610578565b34801561029257600080fd5b506101e76102a1366004611785565b6105ac565b3480156102b257600080fd5b5061015a6105ce565b3480156102c757600080fd5b506000546040516001600160a01b039091168152602001610197565b3480156102ef57600080fd5b506040805180820190915260098152684e494e4a4154414d4160b81b602082015261018a565b34801561032157600080fd5b5061015a610642565b34801561033657600080fd5b506101c06103453660046116ff565b610854565b34801561035657600080fd5b5061015a6103653660046117b8565b610861565b34801561037657600080fd5b5061015a6108f7565b34801561038b57600080fd5b5061015a610937565b3480156103a057600080fd5b5061015a6103af36600461172b565b610adf565b3480156103c057600080fd5b5061015a6103cf36600461172b565b610b17565b3480156103e057600080fd5b506101e76103ef36600461187d565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b6000546001600160a01b0316331461044d5760405162461bcd60e51b8152600401610444906118b6565b60405180910390fd5b600f8054911515600160b81b0260ff60b81b19909216919091179055565b6000610478338484610b4f565b5060015b92915050565b6000546001600160a01b031633146104ac5760405162461bcd60e51b8152600401610444906118b6565b66470de51b1cca008111156104c15760108190555b50565b60006104d1848484610c73565b610523843361051e85604051806060016040528060288152602001611a7c602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610f83565b610b4f565b5060019392505050565b6000546001600160a01b031633146105575760405162461bcd60e51b8152600401610444906118b6565b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b031633146105a25760405162461bcd60e51b8152600401610444906118b6565b476104c181610fbd565b6001600160a01b03811660009081526002602052604081205461047c90610ff7565b6000546001600160a01b031633146105f85760405162461bcd60e51b8152600401610444906118b6565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b0316331461066c5760405162461bcd60e51b8152600401610444906118b6565b600f54600160a01b900460ff16156106c65760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e0000000000000000006044820152606401610444565b600e80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a01559160048083019260209291908290030181865afa15801561072b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061074f91906118eb565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa15801561079c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107c091906118eb565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af115801561080d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061083191906118eb565b600f80546001600160a01b0319166001600160a01b039290921691909117905550565b6000610478338484610c73565b6000546001600160a01b0316331461088b5760405162461bcd60e51b8152600401610444906118b6565b60005b81518110156108f3576001600660008484815181106108af576108af611908565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806108eb81611934565b91505061088e565b5050565b6000546001600160a01b031633146109215760405162461bcd60e51b8152600401610444906118b6565b600061092c306105ac565b90506104c18161107b565b6000546001600160a01b031633146109615760405162461bcd60e51b8152600401610444906118b6565b600e546109819030906001600160a01b0316670de0b6b3a7640000610b4f565b600e546001600160a01b031663f305d719473061099d816105ac565b6000806109b26000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af1158015610a1a573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610a3f919061194f565b5050600f805466470de51b1cca0060105563ffff00ff60a01b198116630101000160a01b17909155600e5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af1158015610abb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104c1919061197d565b6000546001600160a01b03163314610b095760405162461bcd60e51b8152600401610444906118b6565b600f8110156104c157600b55565b6000546001600160a01b03163314610b415760405162461bcd60e51b8152600401610444906118b6565b600f8110156104c157600c55565b6001600160a01b038316610bb15760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610444565b6001600160a01b038216610c125760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610444565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610cd75760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610444565b6001600160a01b038216610d395760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610444565b60008111610d9b5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610444565b6001600160a01b03831660009081526006602052604090205460ff1615610dc157600080fd5b6001600160a01b03831660009081526005602052604090205460ff16158015610e0357506001600160a01b03821660009081526005602052604090205460ff16155b15610f73576000600955600c54600a55600f546001600160a01b038481169116148015610e3e5750600e546001600160a01b03838116911614155b8015610e6357506001600160a01b03821660009081526005602052604090205460ff16155b8015610e785750600f54600160b81b900460ff165b15610ea5576000610e88836105ac565b601054909150610e9883836111f5565b1115610ea357600080fd5b505b600f546001600160a01b038381169116148015610ed05750600e546001600160a01b03848116911614155b8015610ef557506001600160a01b03831660009081526005602052604090205460ff16155b15610f06576000600955600b54600a555b6000610f11306105ac565b600f54909150600160a81b900460ff16158015610f3c5750600f546001600160a01b03858116911614155b8015610f515750600f54600160b01b900460ff165b15610f7157610f5f8161107b565b478015610f6f57610f6f47610fbd565b505b505b610f7e838383611254565b505050565b60008184841115610fa75760405162461bcd60e51b81526004016104449190611685565b506000610fb4848661199a565b95945050505050565b600d546040516001600160a01b039091169082156108fc029083906000818181858888f193505050501580156108f3573d6000803e3d6000fd5b600060075482111561105e5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610444565b600061106861125f565b90506110748382611282565b9392505050565b600f805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106110c3576110c3611908565b6001600160a01b03928316602091820292909201810191909152600e54604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa15801561111c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061114091906118eb565b8160018151811061115357611153611908565b6001600160a01b039283166020918202929092010152600e546111799130911684610b4f565b600e5460405163791ac94760e01b81526001600160a01b039091169063791ac947906111b29085906000908690309042906004016119b1565b600060405180830381600087803b1580156111cc57600080fd5b505af11580156111e0573d6000803e3d6000fd5b5050600f805460ff60a81b1916905550505050565b6000806112028385611a22565b9050838110156110745760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610444565b610f7e8383836112c4565b600080600061126c6113bb565b909250905061127b8282611282565b9250505090565b600061107483836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506113fb565b6000806000806000806112d687611429565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506113089087611486565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461133790866111f5565b6001600160a01b038916600090815260026020526040902055611359816114c8565b6113638483611512565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516113a891815260200190565b60405180910390a3505050505050505050565b6007546000908190670de0b6b3a76400006113d68282611282565b8210156113f257505060075492670de0b6b3a764000092509050565b90939092509050565b6000818361141c5760405162461bcd60e51b81526004016104449190611685565b506000610fb48486611a3a565b60008060008060008060008060006114468a600954600a54611536565b925092509250600061145661125f565b905060008060006114698e87878761158b565b919e509c509a509598509396509194505050505091939550919395565b600061107483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610f83565b60006114d261125f565b905060006114e083836115db565b306000908152600260205260409020549091506114fd90826111f5565b30600090815260026020526040902055505050565b60075461151f9083611486565b60075560085461152f90826111f5565b6008555050565b6000808080611550606461154a89896115db565b90611282565b90506000611563606461154a8a896115db565b9050600061157b826115758b86611486565b90611486565b9992985090965090945050505050565b600080808061159a88866115db565b905060006115a888876115db565b905060006115b688886115db565b905060006115c8826115758686611486565b939b939a50919850919650505050505050565b6000826115ea5750600061047c565b60006115f68385611a5c565b9050826116038583611a3a565b146110745760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610444565b80151581146104c157600080fd5b60006020828403121561167a57600080fd5b81356110748161165a565b600060208083528351808285015260005b818110156116b257858101830151858201604001528201611696565b818111156116c4576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b03811681146104c157600080fd5b80356116fa816116da565b919050565b6000806040838503121561171257600080fd5b823561171d816116da565b946020939093013593505050565b60006020828403121561173d57600080fd5b5035919050565b60008060006060848603121561175957600080fd5b8335611764816116da565b92506020840135611774816116da565b929592945050506040919091013590565b60006020828403121561179757600080fd5b8135611074816116da565b634e487b7160e01b600052604160045260246000fd5b600060208083850312156117cb57600080fd5b823567ffffffffffffffff808211156117e357600080fd5b818501915085601f8301126117f757600080fd5b813581811115611809576118096117a2565b8060051b604051601f19603f8301168101818110858211171561182e5761182e6117a2565b60405291825284820192508381018501918883111561184c57600080fd5b938501935b8285101561187157611862856116ef565b84529385019392850192611851565b98975050505050505050565b6000806040838503121561189057600080fd5b823561189b816116da565b915060208301356118ab816116da565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6000602082840312156118fd57600080fd5b8151611074816116da565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60006000198214156119485761194861191e565b5060010190565b60008060006060848603121561196457600080fd5b8351925060208401519150604084015190509250925092565b60006020828403121561198f57600080fd5b81516110748161165a565b6000828210156119ac576119ac61191e565b500390565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611a015784516001600160a01b0316835293830193918301916001016119dc565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611a3557611a3561191e565b500190565b600082611a5757634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611a7657611a7661191e565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220bf20bc1f4b526d5356f8e9555395799bb84f0c56b9866a2910283cd69d6ca15564736f6c634300080c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 2,216 |
0x194ace13897d0457ade173d2ce0cd5404c6dc49e
|
pragma solidity ^0.4.18;
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
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;
}
}
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
function Ownable() public {
owner = msg.sender;
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
contract ERC223 {
uint public totalSupply;
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);
function name() public view returns (string _name);
function symbol() public view returns (string _symbol);
function decimals() public view returns (uint8 _decimals);
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);
}
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);
}
}
contract BOOMCOIN is ERC223, Ownable {
using SafeMath for uint256;
string public name = "BOOMCOIN";
string public symbol = "BMC";
uint8 public decimals = 0;
uint256 public totalSupply = 1000000000;
uint256 public distributeAmount = 0;
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);
function Voicecoin() public {
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];
}
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;
FrozenFunds(targets[j], isFrozen);
}
}
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];
LockedFunds(targets[j], unixTimes[j]);
}
}
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
&& now > unlockUnixTime[msg.sender]
&& now > 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(_custom_fallback)), msg.sender, _value, _data));
Transfer(msg.sender, _to, _value, _data);
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
&& now > unlockUnixTime[msg.sender]
&& now > unlockUnixTime[_to]);
if (isContract(_to)) {
return transferToContract(_to, _value, _data);
} else {
return transferToAddress(_to, _value, _data);
}
}
function transfer(address _to, uint _value) public returns (bool success) {
require(_value > 0
&& frozenAccount[msg.sender] == false
&& frozenAccount[_to] == false
&& now > unlockUnixTime[msg.sender]
&& now > unlockUnixTime[_to]);
bytes memory empty;
if (isContract(_to)) {
return transferToContract(_to, _value, empty);
} else {
return transferToAddress(_to, _value, empty);
}
}
function isContract(address _addr) private view returns (bool is_contract) {
uint length;
assembly {
length := extcodesize(_addr)
}
return (length > 0);
}
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);
Transfer(msg.sender, _to, _value, _data);
Transfer(msg.sender, _to, _value);
return true;
}
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);
Transfer(msg.sender, _to, _value, _data);
Transfer(msg.sender, _to, _value);
return true;
}
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
&& now > unlockUnixTime[_from]
&& now > unlockUnixTime[_to]);
balanceOf[_from] = balanceOf[_from].sub(_value);
balanceOf[_to] = balanceOf[_to].add(_value);
allowance[_from][msg.sender] = allowance[_from][msg.sender].sub(_value);
Transfer(_from, _to, _value);
return true;
}
function approve(address _spender, uint256 _value) public returns (bool success) {
allowance[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
function allowance(address _owner, address _spender) public view returns (uint256 remaining) {
return allowance[_owner][_spender];
}
function burn(address _from, uint256 _unitAmount) onlyOwner public {
require(_unitAmount > 0
&& balanceOf[_from] >= _unitAmount);
balanceOf[_from] = balanceOf[_from].sub(_unitAmount);
totalSupply = totalSupply.sub(_unitAmount);
Burn(_from, _unitAmount);
}
function distributeAirdrop(address[] addresses, uint256 amount) public returns (bool) {
require(amount > 0
&& addresses.length > 0
&& frozenAccount[msg.sender] == false
&& now > unlockUnixTime[msg.sender]);
amount = amount.mul(1e6);
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
&& now > unlockUnixTime[addresses[j]]);
balanceOf[addresses[j]] = balanceOf[addresses[j]].add(amount);
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
&& now > 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
&& now > unlockUnixTime[addresses[j]]);
amounts[j] = amounts[j].mul(1e6);
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]);
Transfer(msg.sender, addresses[j], amounts[j]);
}
balanceOf[msg.sender] = balanceOf[msg.sender].sub(totalAmount);
return true;
}
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
&& now > unlockUnixTime[addresses[j]]);
amounts[j] = amounts[j].mul(1e6);
require(balanceOf[addresses[j]] >= amounts[j]);
balanceOf[addresses[j]] = balanceOf[addresses[j]].sub(amounts[j]);
totalAmount = totalAmount.add(amounts[j]);
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;
}
function autoDistribute() payable public {
require(distributeAmount > 0
&& balanceOf[owner] >= distributeAmount
&& frozenAccount[msg.sender] == false
&& now > 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);
Transfer(owner, msg.sender, distributeAmount);
}
function() payable public {
autoDistribute();
}
}
|
0x60806040526004361061012f5763ffffffff60e060020a60003504166306fdde038114610139578063095ea7b3146101c357806318160ddd146101fb57806323b872dd14610222578063313ce5671461024c5780634f25eced1461027757806364ddc6051461028c57806370a082311461031a5780638da5cb5b1461033b578063945946251461036c57806395d89b41146103c35780639dc29fac146103d8578063a8f11eb91461012f578063a9059cbb146103fc578063b414d4b614610420578063be45fd6214610441578063c341b9f6146104aa578063cbbe974b14610503578063d39b1d4814610524578063d60fa7841461053c578063dd62ed3e14610551578063dd92459414610578578063f0dc417114610606578063f2fde38b14610694578063f6368f8a146106b5575b61013761075c565b005b34801561014557600080fd5b5061014e6108c0565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610188578181015183820152602001610170565b50505050905090810190601f1680156101b55780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101cf57600080fd5b506101e7600160a060020a0360043516602435610953565b604080519115158252519081900360200190f35b34801561020757600080fd5b506102106109b9565b60408051918252519081900360200190f35b34801561022e57600080fd5b506101e7600160a060020a03600435811690602435166044356109bf565b34801561025857600080fd5b50610261610bc3565b6040805160ff9092168252519081900360200190f35b34801561028357600080fd5b50610210610bcc565b34801561029857600080fd5b506040805160206004803580820135838102808601850190965280855261013795369593946024949385019291829185019084908082843750506040805187358901803560208181028481018201909552818452989b9a998901989297509082019550935083925085019084908082843750949750610bd29650505050505050565b34801561032657600080fd5b50610210600160a060020a0360043516610d36565b34801561034757600080fd5b50610350610d51565b60408051600160a060020a039092168252519081900360200190f35b34801561037857600080fd5b50604080516020600480358082013583810280860185019096528085526101e7953695939460249493850192918291850190849080828437509497505093359450610d609350505050565b3480156103cf57600080fd5b5061014e610fd0565b3480156103e457600080fd5b50610137600160a060020a0360043516602435611031565b34801561040857600080fd5b506101e7600160a060020a0360043516602435611116565b34801561042c57600080fd5b506101e7600160a060020a03600435166111d9565b34801561044d57600080fd5b50604080516020600460443581810135601f81018490048402850184019095528484526101e7948235600160a060020a03169460248035953695946064949201919081908401838280828437509497506111ee9650505050505050565b3480156104b657600080fd5b5060408051602060048035808201358381028086018501909652808552610137953695939460249493850192918291850190849080828437509497505050509135151592506112a7915050565b34801561050f57600080fd5b50610210600160a060020a03600435166113b1565b34801561053057600080fd5b506101376004356113c3565b34801561054857600080fd5b506101376113df565b34801561055d57600080fd5b50610210600160a060020a03600435811690602435166113f4565b34801561058457600080fd5b50604080516020600480358082013583810280860185019096528085526101e795369593946024949385019291829185019084908082843750506040805187358901803560208181028481018201909552818452989b9a99890198929750908201955093508392508501908490808284375094975061141f9650505050505050565b34801561061257600080fd5b50604080516020600480358082013583810280860185019096528085526101e795369593946024949385019291829185019084908082843750506040805187358901803560208181028481018201909552818452989b9a9989019892975090820195509350839250850190849080828437509497506116d19650505050505050565b3480156106a057600080fd5b50610137600160a060020a03600435166119b0565b3480156106c157600080fd5b50604080516020600460443581810135601f81018490048402850184019095528484526101e7948235600160a060020a031694602480359536959460649492019190819084018382808284375050604080516020601f89358b018035918201839004830284018301909452808352979a999881019791965091820194509250829150840183828082843750949750611a459650505050505050565b600060065411801561078a5750600654600154600160a060020a031660009081526007602052604090205410155b80156107a657503360009081526009602052604090205460ff16155b80156107c05750336000908152600a602052604090205442115b15156107cb57600080fd5b600034111561080f57600154604051600160a060020a03909116903480156108fc02916000818181858888f1935050505015801561080d573d6000803e3d6000fd5b505b600654600154600160a060020a031660009081526007602052604090205461083c9163ffffffff611d6316565b600154600160a060020a031660009081526007602052604080822092909255600654338252919020546108749163ffffffff611d7516565b3360008181526007602090815260409182902093909355600154600654825190815291519293600160a060020a03909116926000805160206121578339815191529281900390910190a3565b60028054604080516020601f60001961010060018716150201909416859004938401819004810282018101909252828152606093909290918301828280156109495780601f1061091e57610100808354040283529160200191610949565b820191906000526020600020905b81548152906001019060200180831161092c57829003601f168201915b5050505050905090565b336000818152600860209081526040808320600160a060020a038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a350600192915050565b60055490565b6000600160a060020a038316158015906109d95750600082115b80156109fd5750600160a060020a0384166000908152600760205260409020548211155b8015610a2c5750600160a060020a03841660009081526008602090815260408083203384529091529020548211155b8015610a515750600160a060020a03841660009081526009602052604090205460ff16155b8015610a765750600160a060020a03831660009081526009602052604090205460ff16155b8015610a995750600160a060020a0384166000908152600a602052604090205442115b8015610abc5750600160a060020a0383166000908152600a602052604090205442115b1515610ac757600080fd5b600160a060020a038416600090815260076020526040902054610af0908363ffffffff611d6316565b600160a060020a038086166000908152600760205260408082209390935590851681522054610b25908363ffffffff611d7516565b600160a060020a038085166000908152600760209081526040808320949094559187168152600882528281203382529091522054610b69908363ffffffff611d6316565b600160a060020a0380861660008181526008602090815260408083203384528252918290209490945580518681529051928716939192600080516020612157833981519152929181900390910190a35060015b9392505050565b60045460ff1690565b60065481565b600154600090600160a060020a03163314610bec57600080fd5b60008351118015610bfe575081518351145b1515610c0957600080fd5b5060005b8251811015610d31578181815181101515610c2457fe5b90602001906020020151600a60008584815181101515610c4057fe5b6020908102909101810151600160a060020a031682528101919091526040016000205410610c6d57600080fd5b8181815181101515610c7b57fe5b90602001906020020151600a60008584815181101515610c9757fe5b6020908102909101810151600160a060020a03168252810191909152604001600020558251839082908110610cc857fe5b90602001906020020151600160a060020a03167f1bd6fb9fa2c39ce5d0d2afa1eaba998963eb5f553fd862c94f131aa9e35c15778383815181101515610d0a57fe5b906020019060200201516040518082815260200191505060405180910390a2600101610c0d565b505050565b600160a060020a031660009081526007602052604090205490565b600154600160a060020a031681565b60008060008084118015610d75575060008551115b8015610d9157503360009081526009602052604090205460ff16155b8015610dab5750336000908152600a602052604090205442115b1515610db657600080fd5b610dc984620f424063ffffffff611d8416565b9350610ddf855185611d8490919063ffffffff16565b33600090815260076020526040902054909250821115610dfe57600080fd5b5060005b8451811015610f95578481815181101515610e1957fe5b90602001906020020151600160a060020a0316600014158015610e715750600960008683815181101515610e4957fe5b6020908102909101810151600160a060020a031682528101919091526040016000205460ff16155b8015610eb85750600a60008683815181101515610e8a57fe5b90602001906020020151600160a060020a0316600160a060020a031681526020019081526020016000205442115b1515610ec357600080fd5b610f0884600760008885815181101515610ed957fe5b6020908102909101810151600160a060020a03168252810191909152604001600020549063ffffffff611d7516565b600760008784815181101515610f1a57fe5b6020908102909101810151600160a060020a03168252810191909152604001600020558451859082908110610f4b57fe5b90602001906020020151600160a060020a031633600160a060020a0316600080516020612157833981519152866040518082815260200191505060405180910390a3600101610e02565b33600090815260076020526040902054610fb5908363ffffffff611d6316565b33600090815260076020526040902055506001949350505050565b60038054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156109495780601f1061091e57610100808354040283529160200191610949565b600154600160a060020a0316331461104857600080fd5b6000811180156110705750600160a060020a0382166000908152600760205260409020548111155b151561107b57600080fd5b600160a060020a0382166000908152600760205260409020546110a4908263ffffffff611d6316565b600160a060020a0383166000908152600760205260409020556005546110d0908263ffffffff611d6316565b600555604080518281529051600160a060020a038416917fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5919081900360200190a25050565b6000606060008311801561113a57503360009081526009602052604090205460ff16155b801561115f5750600160a060020a03841660009081526009602052604090205460ff16155b80156111795750336000908152600a602052604090205442115b801561119c5750600160a060020a0384166000908152600a602052604090205442115b15156111a757600080fd5b6111b084611daf565b156111c7576111c0848483611db7565b91506111d2565b6111c0848483611ffb565b5092915050565b60096020526000908152604090205460ff1681565b6000808311801561120f57503360009081526009602052604090205460ff16155b80156112345750600160a060020a03841660009081526009602052604090205460ff16155b801561124e5750336000908152600a602052604090205442115b80156112715750600160a060020a0384166000908152600a602052604090205442115b151561127c57600080fd5b61128584611daf565b1561129c57611295848484611db7565b9050610bbc565b611295848484611ffb565b600154600090600160a060020a031633146112c157600080fd5b82516000106112cf57600080fd5b5060005b8251811015610d315782818151811015156112ea57fe5b60209081029091010151600160a060020a0316151561130857600080fd5b8160096000858481518110151561131b57fe5b602090810291909101810151600160a060020a03168252810191909152604001600020805460ff1916911515919091179055825183908290811061135b57fe5b90602001906020020151600160a060020a03167f48335238b4855f35377ed80f164e8c6f3c366e54ac00b96a6402d4a9814a03a583604051808215151515815260200191505060405180910390a26001016112d3565b600a6020526000908152604090205481565b600154600160a060020a031633146113da57600080fd5b600655565b60055433600090815260076020526040902055565b600160a060020a03918216600090815260086020908152604080832093909416825291909152205490565b6000806000808551118015611435575083518551145b801561145157503360009081526009602052604090205460ff16155b801561146b5750336000908152600a602052604090205442115b151561147657600080fd5b5060009050805b84518110156115d7576000848281518110151561149657fe5b906020019060200201511180156114ce575084818151811015156114b657fe5b90602001906020020151600160a060020a0316600014155b801561150f57506009600086838151811015156114e757fe5b6020908102909101810151600160a060020a031682528101919091526040016000205460ff16155b80156115565750600a6000868381518110151561152857fe5b90602001906020020151600160a060020a0316600160a060020a031681526020019081526020016000205442115b151561156157600080fd5b61158c620f4240858381518110151561157657fe5b602090810290910101519063ffffffff611d8416565b848281518110151561159a57fe5b6020908102909101015283516115cd908590839081106115b657fe5b60209081029091010151839063ffffffff611d7516565b915060010161147d565b336000908152600760205260409020548211156115f357600080fd5b5060005b8451811015610f955761162d848281518110151561161157fe5b90602001906020020151600760008885815181101515610ed957fe5b60076000878481518110151561163f57fe5b6020908102909101810151600160a060020a0316825281019190915260400160002055845185908290811061167057fe5b90602001906020020151600160a060020a031633600160a060020a031660008051602061215783398151915286848151811015156116aa57fe5b906020019060200201516040518082815260200191505060405180910390a36001016115f7565b60015460009081908190600160a060020a031633146116ef57600080fd5b60008551118015611701575083518551145b151561170c57600080fd5b5060009050805b8451811015611990576000848281518110151561172c57fe5b906020019060200201511180156117645750848181518110151561174c57fe5b90602001906020020151600160a060020a0316600014155b80156117a5575060096000868381518110151561177d57fe5b6020908102909101810151600160a060020a031682528101919091526040016000205460ff16155b80156117ec5750600a600086838151811015156117be57fe5b90602001906020020151600160a060020a0316600160a060020a031681526020019081526020016000205442115b15156117f757600080fd5b61180c620f4240858381518110151561157657fe5b848281518110151561181a57fe5b60209081029091010152835184908290811061183257fe5b9060200190602002015160076000878481518110151561184e57fe5b6020908102909101810151600160a060020a0316825281019190915260400160002054101561187c57600080fd5b6118d8848281518110151561188d57fe5b906020019060200201516007600088858151811015156118a957fe5b6020908102909101810151600160a060020a03168252810191909152604001600020549063ffffffff611d6316565b6007600087848151811015156118ea57fe5b6020908102909101810151600160a060020a0316825281019190915260400160002055835161191f908590839081106115b657fe5b915033600160a060020a0316858281518110151561193957fe5b90602001906020020151600160a060020a0316600080516020612157833981519152868481518110151561196957fe5b906020019060200201516040518082815260200191505060405180910390a3600101611713565b33600090815260076020526040902054610fb5908363ffffffff611d7516565b600154600160a060020a031633146119c757600080fd5b600160a060020a03811615156119dc57600080fd5b600154604051600160a060020a038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a36001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60008084118015611a6657503360009081526009602052604090205460ff16155b8015611a8b5750600160a060020a03851660009081526009602052604090205460ff16155b8015611aa55750336000908152600a602052604090205442115b8015611ac85750600160a060020a0385166000908152600a602052604090205442115b1515611ad357600080fd5b611adc85611daf565b15611d4d5733600090815260076020526040902054841115611afd57600080fd5b33600090815260076020526040902054611b1d908563ffffffff611d6316565b3360009081526007602052604080822092909255600160a060020a03871681522054611b4f908563ffffffff611d7516565b600160a060020a038616600081815260076020908152604080832094909455925185519293919286928291908401908083835b60208310611ba15780518252601f199092019160209182019101611b82565b6001836020036101000a038019825116818451168082178552505050505050905001915050604051809103902060e060020a9004903387876040518563ffffffff1660e060020a0281526004018084600160a060020a0316600160a060020a03168152602001838152602001828051906020019080838360005b83811015611c33578181015183820152602001611c1b565b50505050905090810190601f168015611c605780820380516001836020036101000a031916815260200191505b50935050505060006040518083038185885af193505050501515611c8057fe5b826040518082805190602001908083835b60208310611cb05780518252601f199092019160209182019101611c91565b51815160209384036101000a6000190180199092169116179052604080519290940182900382208a83529351939550600160a060020a038b16945033937fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c169350918290030190a4604080518581529051600160a060020a0387169133916000805160206121578339815191529181900360200190a3506001611d5b565b611d58858585611ffb565b90505b949350505050565b600082821115611d6f57fe5b50900390565b600082820183811015610bbc57fe5b600080831515611d9757600091506111d2565b50828202828482811515611da757fe5b0414610bbc57fe5b6000903b1190565b336000908152600760205260408120548190841115611dd557600080fd5b33600090815260076020526040902054611df5908563ffffffff611d6316565b3360009081526007602052604080822092909255600160a060020a03871681522054611e27908563ffffffff611d7516565b600160a060020a03861660008181526007602090815260408083209490945592517fc0ee0b8a0000000000000000000000000000000000000000000000000000000081523360048201818152602483018a90526060604484019081528951606485015289518c9850959663c0ee0b8a9693958c958c956084909101928601918190849084905b83811015611ec5578181015183820152602001611ead565b50505050905090810190601f168015611ef25780820380516001836020036101000a031916815260200191505b50945050505050600060405180830381600087803b158015611f1357600080fd5b505af1158015611f27573d6000803e3d6000fd5b50505050826040518082805190602001908083835b60208310611f5b5780518252601f199092019160209182019101611f3c565b51815160209384036101000a6000190180199092169116179052604080519290940182900382208a83529351939550600160a060020a038b16945033937fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c169350918290030190a4604080518581529051600160a060020a0387169133916000805160206121578339815191529181900360200190a3506001949350505050565b3360009081526007602052604081205483111561201757600080fd5b33600090815260076020526040902054612037908463ffffffff611d6316565b3360009081526007602052604080822092909255600160a060020a03861681522054612069908463ffffffff611d7516565b600160a060020a0385166000908152600760209081526040918290209290925551835184928291908401908083835b602083106120b75780518252601f199092019160209182019101612098565b51815160209384036101000a6000190180199092169116179052604080519290940182900382208983529351939550600160a060020a038a16945033937fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c169350918290030190a4604080518481529051600160a060020a0386169133916000805160206121578339815191529181900360200190a350600193925050505600ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa165627a7a723058205a4cc3915ec2a7be772c08e7230ce4bae5466bb7c12a3840691fdbb46fc05ef70029
|
{"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"}]}}
| 2,217 |
0x0717d128b95d688e2c45e4b8ad49dd743c09a8a4
|
pragma solidity ^0.5.15;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract Context {
constructor () internal { }
// solhint-disable-previous-line no-empty-blocks
function _msgSender() internal view returns (address payable) {
return msg.sender;
}
function _msgData() internal view returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
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;
}
}
contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) public returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 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, uint256 addedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint256 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, uint256 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, uint256 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, uint256 amount) internal {
require(account != address(0), "ERC20: burn from the zero address");
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
function _approve(address owner, address spender, uint256 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);
}
function _burnFrom(address account, uint256 amount) internal {
_burn(account, amount);
_approve(account, _msgSender(), _allowances[account][_msgSender()].sub(amount, "ERC20: burn amount exceeds allowance"));
}
}
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;
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != 0x0 && codehash != accountHash);
}
function toPayable(address account) internal pure returns (address payable) {
return address(uint160(account));
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-call-value
(bool success, ) = recipient.call.value(amount)("");
require(success, "Address: unable to send value, recipient may have reverted");
}
}
library SafeERC20 {
using SafeMath for uint256;
using Address for address;
function safeTransfer(IERC20 token, address to, uint256 value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
function safeApprove(IERC20 token, address spender, uint256 value) internal {
require((value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function 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 {
require(address(token).isContract(), "SafeERC20: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = address(token).call(data);
require(success, "SafeERC20: low-level call failed");
if (returndata.length > 0) { // Return data is optional
// solhint-disable-next-line max-line-length
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
interface Controller {
function withdraw(address, uint) external;
function balanceOf(address) external view returns (uint);
function earn(address, uint) external;
function rewards() external view returns (address);
}
// vault的作用是 用户充值、提现、领取奖励
// abi文件参考: https://github.com/ystar-foundation/YstarFarming/blob/master/bgVault/abi/vault.json
contract bgVault {
using SafeERC20 for IERC20;
using Address for address;
using SafeMath for uint256;
IERC20 public token;
IERC20 public YFToken; // YF合约地址
uint public min = 9500;
uint public constant max = 10000;
uint public earnLowerlimit; //池内空余资金到这个值就自动earn
address public governance;
address public controller;
struct Player {
uint256 stake; // 质押总数
uint256 payout; // 支出
uint256 total_out; // 已经领取的分红
}
mapping(address => Player) public player_; // (player => data) player data
struct Global {
uint256 total_stake; // 总质押总数
uint256 total_out; // 总分红金额
uint256 earnings_per_share; // 每股分红
}
mapping(uint256 => Global) public global_; // (global => data) global data
mapping (address => uint256) public deposittime;
uint256 constant internal magnitude = 10**40; // 10的40次方
address constant public yf = address(0x96F9632b25f874769969ff91219fCCb6ceDf26D2);
string public getName;
constructor (address _token, uint256 _earnLowerlimit) public {
token = IERC20(_token);
getName = string(abi.encodePacked("yf:Vault:", ERC20Detailed(_token).name()));
earnLowerlimit = _earnLowerlimit*1e18;
YFToken = IERC20(yf);
governance = tx.origin;
controller = 0xcC8d36211374a08fC61d74ed2E48e22b922C9D7C;
}
function balance() public view returns (uint) {
return token.balanceOf(address(this))
.add(Controller(controller).balanceOf(address(token)));
}
function setMin(uint _min) external {
require(msg.sender == governance, "!governance");
min = _min;
}
// 设置治理地址,必须验证原来治理地址的签名
function setGovernance(address _governance) public {
require(msg.sender == governance, "!governance");
governance = _governance;
}
// 设置控制器地址,必须验证治理地址的签名
function setController(address _controller) public {
require(msg.sender == governance, "!governance");
controller = _controller;
}
function setEarnLowerlimit(uint256 _earnLowerlimit) public{
require(msg.sender == governance, "!governance");
earnLowerlimit = _earnLowerlimit;
}
// Custom logic in here for how much the vault allows to be borrowed
// Sets minimum required on-hand to keep small withdrawals cheap
// 设置多少保险库允许被借
// 设置所需的最低限度,以保持低成本的小额取款
function available() public view returns (uint) {
return token.balanceOf(address(this)).mul(min).div(max); // balance*min/max 保证在合约中一直有离散的代币供用户使用
}
// 抵押代币给Strategy合约进行理财,代币路径如下 vault->controller->strategy
function earn() public {
uint _bal = available(); // 获取最小需要转给机枪池进行获取收益的代币个数
token.safeTransfer(controller, _bal); // 转账给控制合约
Controller(controller).earn(address(token), _bal); // 抵押代币给Strategy合约进行理财
}
// 存款 可以追加存款
function deposit(uint amount) external {
// 从用户地址中进行扣款,所以需要先进行appove对用户账户中的资金进行授权
token.safeTransferFrom(msg.sender, address(this), amount);
// 增加该用户的存款总数
player_[msg.sender].stake = player_[msg.sender].stake.add(amount);
// 如果每股分红为0
if (global_[0].earnings_per_share != 0) {
player_[msg.sender].payout = player_[msg.sender].payout.add(
global_[0].earnings_per_share.mul(amount).sub(1).div(magnitude).add(1) // (((earnings_per_share*amount)-1)/magnitude)+1
);
}
// 增加全局已抵押的总量
global_[0].total_stake = global_[0].total_stake.add(amount);
// 如果当前池子合约中已经抵押的数量大于自动赚取收益的值时,自动将合约中的代币去第三方平台抵押
if (token.balanceOf(address(this)) > earnLowerlimit){
earn();
}
// 更新用户抵押时间
deposittime[msg.sender] = now;
}
// No rebalance implementation for lower fees and faster swaps
// 取款
function withdraw(uint amount) external {
claim(); // 首先获取当前未领取的收益
require(amount <= player_[msg.sender].stake, "!balance");
uint r = amount;
// Check balance
uint b = token.balanceOf(address(this));
if (b < r) { // 如果vault合约中代币余额小于用户取款的余额,则需要去Strategy合约取款获得对应的代币
uint _withdraw = r.sub(b);
Controller(controller).withdraw(address(token), _withdraw); // 取款
uint _after = token.balanceOf(address(this));
uint _diff = _after.sub(b);
if (_diff < _withdraw) { // 策略器有可能会返回的代币变多,所以需要更新vault合约中的余额
r = b.add(_diff);
}
}
// 更新用户的已提取余额并且更新全局的每股收益
player_[msg.sender].payout = player_[msg.sender].payout.sub(
global_[0].earnings_per_share.mul(amount).div(magnitude)
);
// 更新全局存款量和用户存款量
player_[msg.sender].stake = player_[msg.sender].stake.sub(amount);
global_[0].total_stake = global_[0].total_stake.sub(amount);
// 转账给用户取款的代币
token.safeTransfer(msg.sender, r);
}
// Strategy.harvest 触发分红()
function make_profit(uint256 amount) public {
require(amount > 0, "not 0");
YFToken.safeTransferFrom(msg.sender, address(this), amount); // 挖矿收益存入当前合约(已扣除10%的手续费,90%的利润存进来)
global_[0].earnings_per_share = global_[0].earnings_per_share.add(
amount.mul(magnitude).div(global_[0].total_stake)
);
global_[0].total_out = global_[0].total_out.add(amount);
}
// 用户可领取的分红
function cal_out(address user) public view returns (uint256) {
uint256 _cal = global_[0].earnings_per_share.mul(player_[user].stake).div(magnitude);
if (_cal < player_[user].payout) {
return 0;
} else {
return _cal.sub(player_[user].payout);
}
}
// 某个用户在路上的分红(也就是分红还没有从挖矿合约领取.只能看到,无法领取,等harvest触发后就可以领取了)
function cal_out_pending(uint256 _pendingBalance,address user) public view returns (uint256) {
uint256 _earnings_per_share = global_[0].earnings_per_share.add(
_pendingBalance.mul(magnitude).div(global_[0].total_stake)
);
uint256 _cal = _earnings_per_share.mul(player_[user].stake).div(magnitude);
_cal = _cal.sub(cal_out(user));
if (_cal < player_[user].payout) {
return 0;
} else {
return _cal.sub(player_[user].payout);
}
}
// 用户领取分红
function claim() public {
uint256 out = cal_out(msg.sender);
player_[msg.sender].payout = global_[0].earnings_per_share.mul(player_[msg.sender].stake).div(magnitude);
player_[msg.sender].total_out = player_[msg.sender].total_out.add(out);
if (out > 0) {
uint256 _depositTime = now - deposittime[msg.sender];
if (_depositTime < 1 days){ // deposit in 24h
uint256 actually_out = _depositTime.mul(out).mul(1e18).div(1 days).div(1e18);
uint256 to_team = out.sub(actually_out);
YFToken.safeTransfer(Controller(controller).rewards(), to_team);
out = actually_out;
}
YFToken.safeTransfer(msg.sender, out);
}
}
}
|
0x608060405234801561001057600080fd5b50600436106101735760003560e01c8063909d3f4c116100de578063d20a31d811610097578063da4745b311610071578063da4745b31461066d578063f77c47911461069b578063f8897945146106e5578063fc0c546a1461070357610173565b8063d20a31d8146105bb578063d389800f1461060b578063d7e8e85b1461061557610173565b8063909d3f4c1461046f57806392eefe9b1461049d578063ab033ea9146104e1578063ae000c8c14610525578063b69ef8a81461056f578063b6b55f251461058d57610173565b80634e71d92d116101305780634e71d92d146103255780635aa6e6751461032f57806360a9f458146103795780636ac5db19146103db57806378ce591d146103f95780638e087c781461045157610173565b806317d7de7c146101785780632b68b65b146101fb5780632de75221146102615780632e1a7d4d146102ab57806345dc3dd8146102d957806348a0d75414610307575b600080fd5b61018061074d565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101c05780820151818401526020810190506101a5565b50505050905090810190601f1680156101ed5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61023d6004803603602081101561021157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506107eb565b60405180848152602001838152602001828152602001935050505060405180910390f35b610269610815565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102d7600480360360208110156102c157600080fd5b810190808035906020019092919050505061083b565b005b610305600480360360208110156102ef57600080fd5b8101908080359060200190929190505050610e09565b005b61030f610ed6565b6040518082815260200191505060405180910390f35b61032d610fde565b005b610337611372565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103c56004803603604081101561038f57600080fd5b8101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611398565b6040518082815260200191505060405180910390f35b6103e361155f565b6040518082815260200191505060405180910390f35b61043b6004803603602081101561040f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611565565b6040518082815260200191505060405180910390f35b6104596116aa565b6040518082815260200191505060405180910390f35b61049b6004803603602081101561048557600080fd5b81019080803590602001909291905050506116b0565b005b6104df600480360360208110156104b357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061177d565b005b610523600480360360208110156104f757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611884565b005b61052d61198b565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6105776119a3565b6040518082815260200191505060405180910390f35b6105b9600480360360208110156105a357600080fd5b8101908080359060200190929190505050611b8f565b005b6105e7600480360360208110156105d157600080fd5b8101908080359060200190929190505050611f18565b60405180848152602001838152602001828152602001935050505060405180910390f35b610613611f42565b005b6106576004803603602081101561062b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506120a1565b6040518082815260200191505060405180910390f35b6106996004803603602081101561068357600080fd5b81019080803590602001909291905050506120b9565b005b6106a3612252565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6106ed612278565b6040518082815260200191505060405180910390f35b61070b61227e565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b60098054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156107e35780601f106107b8576101008083540402835291602001916107e3565b820191906000526020600020905b8154815290600101906020018083116107c657829003601f168201915b505050505081565b60066020528060005260406000206000915090508060000154908060010154908060020154905083565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b610843610fde565b600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001548111156108fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260088152602001807f2162616c616e636500000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b600081905060008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b1580156109a057600080fd5b505afa1580156109b4573d6000803e3d6000fd5b505050506040513d60208110156109ca57600080fd5b8101908080519060200190929190505050905081811015610bf45760006109fa82846122a390919063ffffffff16565b9050600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f3fef3a36000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff16836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050600060405180830381600087803b158015610ac657600080fd5b505af1158015610ada573d6000803e3d6000fd5b5050505060008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015610b7e57600080fd5b505afa158015610b92573d6000803e3d6000fd5b505050506040513d6020811015610ba857600080fd5b810190808051906020019092919050505090506000610bd084836122a390919063ffffffff16565b905082811015610bf057610bed81856122ed90919063ffffffff16565b94505b5050505b610c94610c43701d6329f1c35ca4bfabb9f5610000000000610c3586600760008081526020019081526020016000206002015461237590919063ffffffff16565b6123fb90919063ffffffff16565b600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101546122a390919063ffffffff16565b600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010181905550610d2f83600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001546122a390919063ffffffff16565b600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000181905550610d9e8360076000808152602001908152602001600020600001546122a390919063ffffffff16565b6007600080815260200190815260200160002060000181905550610e0433836000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166124459092919063ffffffff16565b505050565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610ecc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f21676f7665726e616e636500000000000000000000000000000000000000000081525060200191505060405180910390fd5b8060028190555050565b6000610fd9612710610fcb6002546000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015610f8257600080fd5b505afa158015610f96573d6000803e3d6000fd5b505050506040513d6020811015610fac57600080fd5b810190808051906020019092919050505061237590919063ffffffff16565b6123fb90919063ffffffff16565b905090565b6000610fe933611565565b9050611079701d6329f1c35ca4bfabb9f561000000000061106b600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000154600760008081526020019081526020016000206002015461237590919063ffffffff16565b6123fb90919063ffffffff16565b600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001018190555061111481600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201546122ed90919063ffffffff16565b600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020181905550600081111561136f576000600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020544203905062015180811015611320576000611212670de0b6b3a7640000611204620151806111f6670de0b6b3a76400006111e8898961237590919063ffffffff16565b61237590919063ffffffff16565b6123fb90919063ffffffff16565b6123fb90919063ffffffff16565b9050600061122982856122a390919063ffffffff16565b905061131a600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16639ec5a8946040518163ffffffff1660e01b815260040160206040518083038186803b15801561129657600080fd5b505afa1580156112aa573d6000803e3d6000fd5b505050506040513d60208110156112c057600080fd5b810190808051906020019092919050505082600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166124459092919063ffffffff16565b81935050505b61136d3383600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166124459092919063ffffffff16565b505b50565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008061140f6113ea60076000808152602001908152602001600020600001546113dc701d6329f1c35ca4bfabb9f56100000000008861237590919063ffffffff16565b6123fb90919063ffffffff16565b60076000808152602001908152602001600020600201546122ed90919063ffffffff16565b9050600061148b701d6329f1c35ca4bfabb9f561000000000061147d600660008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001548561237590919063ffffffff16565b6123fb90919063ffffffff16565b90506114a861149985611565565b826122a390919063ffffffff16565b9050600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101548110156114ff57600092505050611559565b611554600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010154826122a390919063ffffffff16565b925050505b92915050565b61271081565b6000806115f6701d6329f1c35ca4bfabb9f56100000000006115e8600660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000154600760008081526020019081526020016000206002015461237590919063ffffffff16565b6123fb90919063ffffffff16565b9050600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015481101561164c5760009150506116a5565b6116a1600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010154826122a390919063ffffffff16565b9150505b919050565b60035481565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611773576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f21676f7665726e616e636500000000000000000000000000000000000000000081525060200191505060405180910390fd5b8060038190555050565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611840576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f21676f7665726e616e636500000000000000000000000000000000000000000081525060200191505060405180910390fd5b80600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611947576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f21676f7665726e616e636500000000000000000000000000000000000000000081525060200191505060405180910390fd5b80600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b7396f9632b25f874769969ff91219fccb6cedf26d281565b6000611b8a600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a082316000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015611a6857600080fd5b505afa158015611a7c573d6000803e3d6000fd5b505050506040513d6020811015611a9257600080fd5b81019080805190602001909291905050506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015611b4157600080fd5b505afa158015611b55573d6000803e3d6000fd5b505050506040513d6020811015611b6b57600080fd5b81019080805190602001909291905050506122ed90919063ffffffff16565b905090565b611bdd3330836000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16612516909392919063ffffffff16565b611c3281600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001546122ed90919063ffffffff16565b600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001819055506000600760008081526020019081526020016000206002015414611da357611d5c611d0b6001611cfd701d6329f1c35ca4bfabb9f5610000000000611cef6001611ce188600760008081526020019081526020016000206002015461237590919063ffffffff16565b6122a390919063ffffffff16565b6123fb90919063ffffffff16565b6122ed90919063ffffffff16565b600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101546122ed90919063ffffffff16565b600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101819055505b611dcc8160076000808152602001908152602001600020600001546122ed90919063ffffffff16565b60076000808152602001908152602001600020600001819055506003546000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015611e8757600080fd5b505afa158015611e9b573d6000803e3d6000fd5b505050506040513d6020811015611eb157600080fd5b81019080805190602001909291905050501115611ed157611ed0611f42565b5b42600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555050565b60076020528060005260406000206000915090508060000154908060010154908060020154905083565b6000611f4c610ed6565b9050611fbc600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16826000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166124459092919063ffffffff16565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663b02bf4b96000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff16836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050600060405180830381600087803b15801561208657600080fd5b505af115801561209a573d6000803e3d6000fd5b5050505050565b60086020528060005260406000206000915090505481565b6000811161212f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260058152602001807f6e6f74203000000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b61217e333083600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16612516909392919063ffffffff16565b6121f26121cd60076000808152602001908152602001600020600001546121bf701d6329f1c35ca4bfabb9f56100000000008561237590919063ffffffff16565b6123fb90919063ffffffff16565b60076000808152602001908152602001600020600201546122ed90919063ffffffff16565b60076000808152602001908152602001600020600201819055506122358160076000808152602001908152602001600020600101546122ed90919063ffffffff16565b600760008081526020019081526020016000206001018190555050565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60025481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60006122e583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061261c565b905092915050565b60008082840190508381101561236b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b60008083141561238857600090506123f5565b600082840290508284828161239957fe5b04146123f0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180612a396021913960400191505060405180910390fd5b809150505b92915050565b600061243d83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506126dc565b905092915050565b612511838473ffffffffffffffffffffffffffffffffffffffff1663a9059cbb905060e01b8484604051602401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506127a2565b505050565b612616848573ffffffffffffffffffffffffffffffffffffffff166323b872dd905060e01b858585604051602401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506127a2565b50505050565b60008383111582906126c9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561268e578082015181840152602081019050612673565b50505050905090810190601f1680156126bb5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b60008083118290612788576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561274d578082015181840152602081019050612732565b50505050905090810190601f16801561277a5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50600083858161279457fe5b049050809150509392505050565b6127c18273ffffffffffffffffffffffffffffffffffffffff166129ed565b612833576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e74726163740081525060200191505060405180910390fd5b600060608373ffffffffffffffffffffffffffffffffffffffff16836040518082805190602001908083835b60208310612882578051825260208201915060208101905060208303925061285f565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d80600081146128e4576040519150601f19603f3d011682016040523d82523d6000602084013e6128e9565b606091505b509150915081612961576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656481525060200191505060405180910390fd5b6000815111156129e75780806020019051602081101561298057600080fd5b81019080805190602001909291905050506129e6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180612a5a602a913960400191505060405180910390fd5b5b50505050565b60008060007fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47060001b9050833f91506000801b8214158015612a2f5750808214155b9250505091905056fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a265627a7a72315820f065eccf4696d76f82bc5cad1c0d7302bb2b00789cbe3d0a390592f62ea089b364736f6c634300050f0032
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 2,218 |
0x2abda35d630bb3abcaefdd59d712bfc29732cb62
|
/**
*Submitted for verification at Etherscan.io on 2021-06-11
*/
// SPDX-License-Identifier: MIT
/**
*
¦¦¦¦¦¦ ¦¦¦¦¦ ¦¦¦¦¦¦¦ ¦¦¦¦¦¦¦ ¦¦¦ ¦¦ ¦¦ ¦¦ ¦¦ ¦¦¦ ¦¦ ¦¦ ¦¦
¦¦ ¦¦ ¦¦ ¦¦ ¦¦ ¦¦ ¦¦¦¦ ¦¦ ¦¦ ¦¦ ¦¦ ¦¦¦¦ ¦¦ ¦¦ ¦¦
¦¦¦¦¦¦ ¦¦¦¦¦¦¦ ¦¦¦¦¦¦¦ ¦¦¦¦¦ ¦¦ ¦¦ ¦¦ ¦¦ ¦¦ ¦¦ ¦¦ ¦¦ ¦¦ ¦¦ ¦¦
¦¦ ¦¦ ¦¦ ¦¦ ¦¦ ¦¦ ¦¦ ¦¦ ¦¦ ¦¦ ¦¦ ¦¦ ¦¦ ¦¦ ¦¦ ¦¦ ¦¦ ¦¦
¦¦¦¦¦¦ ¦¦ ¦¦ ¦¦¦¦¦¦¦ ¦¦¦¦¦¦¦ ¦¦ ¦¦¦¦ ¦¦¦¦¦ ¦¦ ¦¦ ¦¦ ¦¦¦¦ ¦¦¦¦¦¦
# Basenji Inu
2% fee auto distribute to all holders
6% fee auto moved to Charity wallet
*/
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 BAJINU 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 = 1e15 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = "Basenji Inu";
string private constant _symbol = 'BAJINU';
uint8 private constant _decimals = 9;
uint256 private _taxFee = 2;
uint256 private _charityFee = 6;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousCharityFee = _charityFee;
address private _charityAddress = 0x3BA8B0f69098cb4A27d8019ddf375146bb1B1d2A;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_charityAddress] = 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 && _charityFee == 0) return;
_previousTaxFee = _taxFee;
_previousCharityFee = _charityFee;
_taxFee = 0;
_charityFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_charityFee = _previousCharityFee;
}
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 <= _maxTxAmount);
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToCharity(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 sendETHToCharity(uint256 amount) private {
payable(_charityAddress).transfer(amount);
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
_maxTxAmount = 5e12 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
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 tCharity) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeCharity(tCharity);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeCharity(uint256 tCharity) private {
uint256 currentRate = _getRate();
uint256 rCharity = tCharity.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rCharity);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() external {
require(_msgSender() == _charityAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _charityAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToCharity(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tCharity) = _getTValues(tAmount, _taxFee, _charityFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tCharity, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tCharity);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 CharityFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tCharity = tAmount.mul(CharityFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tCharity);
return (tTransferAmount, tFee, tCharity);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tCharity, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rCharity = tCharity.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rCharity);
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);
}
}
|
0x6080604052600436106100ec5760003560e01c8063715018a61161008a578063c3c8cd8011610059578063c3c8cd80146102f1578063c9567bf914610308578063d543dbeb1461031f578063dd62ed3e14610348576100f3565b8063715018a6146102475780638da5cb5b1461025e57806395d89b4114610289578063a9059cbb146102b4576100f3565b806323b872dd116100c657806323b872dd1461018b578063313ce567146101c85780636fc3eaec146101f357806370a082311461020a576100f3565b806306fdde03146100f8578063095ea7b31461012357806318160ddd14610160576100f3565b366100f357005b600080fd5b34801561010457600080fd5b5061010d610385565b60405161011a91906124f5565b60405180910390f35b34801561012f57600080fd5b5061014a600480360381019061014591906120a5565b6103c2565b60405161015791906124da565b60405180910390f35b34801561016c57600080fd5b506101756103e0565b6040516101829190612677565b60405180910390f35b34801561019757600080fd5b506101b260048036038101906101ad9190612056565b6103f2565b6040516101bf91906124da565b60405180910390f35b3480156101d457600080fd5b506101dd6104cb565b6040516101ea91906126ec565b60405180910390f35b3480156101ff57600080fd5b506102086104d4565b005b34801561021657600080fd5b50610231600480360381019061022c9190611fc8565b610546565b60405161023e9190612677565b60405180910390f35b34801561025357600080fd5b5061025c610597565b005b34801561026a57600080fd5b506102736106ea565b604051610280919061240c565b60405180910390f35b34801561029557600080fd5b5061029e610713565b6040516102ab91906124f5565b60405180910390f35b3480156102c057600080fd5b506102db60048036038101906102d691906120a5565b610750565b6040516102e891906124da565b60405180910390f35b3480156102fd57600080fd5b5061030661076e565b005b34801561031457600080fd5b5061031d6107e8565b005b34801561032b57600080fd5b506103466004803603810190610341919061210a565b610d2c565b005b34801561035457600080fd5b5061036f600480360381019061036a919061201a565b610e76565b60405161037c9190612677565b60405180910390f35b60606040518060400160405280600b81526020017f426173656e6a6920496e75000000000000000000000000000000000000000000815250905090565b60006103d66103cf610efd565b8484610f05565b6001905092915050565b600069d3c21bcecceda1000000905090565b60006103ff8484846110d0565b6104c08461040b610efd565b6104bb85604051806060016040528060288152602001612c8d60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610471610efd565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546113fa9092919063ffffffff16565b610f05565b600190509392505050565b60006009905090565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610515610efd565b73ffffffffffffffffffffffffffffffffffffffff161461053557600080fd5b60004790506105438161145e565b50565b6000610590600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114ca565b9050919050565b61059f610efd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461062c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610623906125d7565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600681526020017f42414a494e550000000000000000000000000000000000000000000000000000815250905090565b600061076461075d610efd565b84846110d0565b6001905092915050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107af610efd565b73ffffffffffffffffffffffffffffffffffffffff16146107cf57600080fd5b60006107da30610546565b90506107e581611538565b50565b6107f0610efd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461087d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610874906125d7565b60405180910390fd5b601060149054906101000a900460ff16156108cd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108c490612657565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061095e30600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1669d3c21bcecceda1000000610f05565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156109a457600080fd5b505afa1580156109b8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109dc9190611ff1565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610a3e57600080fd5b505afa158015610a52573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a769190611ff1565b6040518363ffffffff1660e01b8152600401610a93929190612427565b602060405180830381600087803b158015610aad57600080fd5b505af1158015610ac1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ae59190611ff1565b601060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610b6e30610546565b600080610b796106ea565b426040518863ffffffff1660e01b8152600401610b9b96959493929190612479565b6060604051808303818588803b158015610bb457600080fd5b505af1158015610bc8573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610bed9190612133565b5050506001601060166101000a81548160ff02191690831515021790555069010f0cf064dd592000006011819055506001601060146101000a81548160ff021916908315150217905550601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401610cd6929190612450565b602060405180830381600087803b158015610cf057600080fd5b505af1158015610d04573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d2891906120e1565b5050565b610d34610efd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610dc1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610db8906125d7565b60405180910390fd5b60008111610e04576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610dfb90612597565b60405180910390fd5b610e346064610e268369d3c21bcecceda100000061183290919063ffffffff16565b6118ad90919063ffffffff16565b6011819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf601154604051610e6b9190612677565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610f75576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f6c90612637565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610fe5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fdc90612557565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516110c39190612677565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611140576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161113790612617565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156111b0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a790612517565b60405180910390fd5b600081116111f3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111ea906125f7565b60405180910390fd5b6111fb6106ea565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561126957506112396106ea565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b156113375760115481111561127d57600080fd5b600061128830610546565b9050601060159054906101000a900460ff161580156112f55750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b801561130d5750601060169054906101000a900460ff165b156113355761131b81611538565b60004790506000811115611333576113324761145e565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16806113de5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b156113e857600090505b6113f4848484846118f7565b50505050565b6000838311158290611442576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161143991906124f5565b60405180910390fd5b5060008385611451919061283d565b9050809150509392505050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501580156114c6573d6000803e3d6000fd5b5050565b6000600854821115611511576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161150890612537565b60405180910390fd5b600061151b611924565b905061153081846118ad90919063ffffffff16565b915050919050565b6001601060156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611596577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156115c45781602001602082028036833780820191505090505b5090503081600081518110611602577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156116a457600080fd5b505afa1580156116b8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116dc9190611ff1565b81600181518110611716577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061177d30600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684610f05565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016117e1959493929190612692565b600060405180830381600087803b1580156117fb57600080fd5b505af115801561180f573d6000803e3d6000fd5b50505050506000601060156101000a81548160ff02191690831515021790555050565b60008083141561184557600090506118a7565b6000828461185391906127e3565b905082848261186291906127b2565b146118a2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611899906125b7565b60405180910390fd5b809150505b92915050565b60006118ef83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061194f565b905092915050565b80611905576119046119b2565b5b6119108484846119f5565b8061191e5761191d611bc0565b5b50505050565b6000806000611931611bd4565b9150915061194881836118ad90919063ffffffff16565b9250505090565b60008083118290611996576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161198d91906124f5565b60405180910390fd5b50600083856119a591906127b2565b9050809150509392505050565b6000600a541480156119c657506000600b54145b156119d0576119f3565b600a54600c81905550600b54600d819055506000600a819055506000600b819055505b565b600080600080600080611a0787611c39565b955095509550955095509550611a6586600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ca190919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611afa85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ceb90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611b4681611d49565b611b508483611e06565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051611bad9190612677565b60405180910390a3505050505050505050565b600c54600a81905550600d54600b81905550565b60008060006008549050600069d3c21bcecceda10000009050611c0c69d3c21bcecceda10000006008546118ad90919063ffffffff16565b821015611c2c5760085469d3c21bcecceda1000000935093505050611c35565b81819350935050505b9091565b6000806000806000806000806000611c568a600a54600b54611e40565b9250925092506000611c66611924565b90506000806000611c798e878787611ed6565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b6000611ce383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506113fa565b905092915050565b6000808284611cfa919061275c565b905083811015611d3f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d3690612577565b60405180910390fd5b8091505092915050565b6000611d53611924565b90506000611d6a828461183290919063ffffffff16565b9050611dbe81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ceb90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b611e1b82600854611ca190919063ffffffff16565b600881905550611e3681600954611ceb90919063ffffffff16565b6009819055505050565b600080600080611e6c6064611e5e888a61183290919063ffffffff16565b6118ad90919063ffffffff16565b90506000611e966064611e88888b61183290919063ffffffff16565b6118ad90919063ffffffff16565b90506000611ebf82611eb1858c611ca190919063ffffffff16565b611ca190919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080611eef858961183290919063ffffffff16565b90506000611f06868961183290919063ffffffff16565b90506000611f1d878961183290919063ffffffff16565b90506000611f4682611f388587611ca190919063ffffffff16565b611ca190919063ffffffff16565b9050838184965096509650505050509450945094915050565b600081359050611f6e81612c47565b92915050565b600081519050611f8381612c47565b92915050565b600081519050611f9881612c5e565b92915050565b600081359050611fad81612c75565b92915050565b600081519050611fc281612c75565b92915050565b600060208284031215611fda57600080fd5b6000611fe884828501611f5f565b91505092915050565b60006020828403121561200357600080fd5b600061201184828501611f74565b91505092915050565b6000806040838503121561202d57600080fd5b600061203b85828601611f5f565b925050602061204c85828601611f5f565b9150509250929050565b60008060006060848603121561206b57600080fd5b600061207986828701611f5f565b935050602061208a86828701611f5f565b925050604061209b86828701611f9e565b9150509250925092565b600080604083850312156120b857600080fd5b60006120c685828601611f5f565b92505060206120d785828601611f9e565b9150509250929050565b6000602082840312156120f357600080fd5b600061210184828501611f89565b91505092915050565b60006020828403121561211c57600080fd5b600061212a84828501611f9e565b91505092915050565b60008060006060848603121561214857600080fd5b600061215686828701611fb3565b935050602061216786828701611fb3565b925050604061217886828701611fb3565b9150509250925092565b600061218e838361219a565b60208301905092915050565b6121a381612871565b82525050565b6121b281612871565b82525050565b60006121c382612717565b6121cd818561273a565b93506121d883612707565b8060005b838110156122095781516121f08882612182565b97506121fb8361272d565b9250506001810190506121dc565b5085935050505092915050565b61221f81612883565b82525050565b61222e816128c6565b82525050565b600061223f82612722565b612249818561274b565b93506122598185602086016128d8565b61226281612969565b840191505092915050565b600061227a60238361274b565b91506122858261297a565b604082019050919050565b600061229d602a8361274b565b91506122a8826129c9565b604082019050919050565b60006122c060228361274b565b91506122cb82612a18565b604082019050919050565b60006122e3601b8361274b565b91506122ee82612a67565b602082019050919050565b6000612306601d8361274b565b915061231182612a90565b602082019050919050565b600061232960218361274b565b915061233482612ab9565b604082019050919050565b600061234c60208361274b565b915061235782612b08565b602082019050919050565b600061236f60298361274b565b915061237a82612b31565b604082019050919050565b600061239260258361274b565b915061239d82612b80565b604082019050919050565b60006123b560248361274b565b91506123c082612bcf565b604082019050919050565b60006123d860178361274b565b91506123e382612c1e565b602082019050919050565b6123f7816128af565b82525050565b612406816128b9565b82525050565b600060208201905061242160008301846121a9565b92915050565b600060408201905061243c60008301856121a9565b61244960208301846121a9565b9392505050565b600060408201905061246560008301856121a9565b61247260208301846123ee565b9392505050565b600060c08201905061248e60008301896121a9565b61249b60208301886123ee565b6124a86040830187612225565b6124b56060830186612225565b6124c260808301856121a9565b6124cf60a08301846123ee565b979650505050505050565b60006020820190506124ef6000830184612216565b92915050565b6000602082019050818103600083015261250f8184612234565b905092915050565b600060208201905081810360008301526125308161226d565b9050919050565b6000602082019050818103600083015261255081612290565b9050919050565b60006020820190508181036000830152612570816122b3565b9050919050565b60006020820190508181036000830152612590816122d6565b9050919050565b600060208201905081810360008301526125b0816122f9565b9050919050565b600060208201905081810360008301526125d08161231c565b9050919050565b600060208201905081810360008301526125f08161233f565b9050919050565b6000602082019050818103600083015261261081612362565b9050919050565b6000602082019050818103600083015261263081612385565b9050919050565b60006020820190508181036000830152612650816123a8565b9050919050565b60006020820190508181036000830152612670816123cb565b9050919050565b600060208201905061268c60008301846123ee565b92915050565b600060a0820190506126a760008301886123ee565b6126b46020830187612225565b81810360408301526126c681866121b8565b90506126d560608301856121a9565b6126e260808301846123ee565b9695505050505050565b600060208201905061270160008301846123fd565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000612767826128af565b9150612772836128af565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156127a7576127a661290b565b5b828201905092915050565b60006127bd826128af565b91506127c8836128af565b9250826127d8576127d761293a565b5b828204905092915050565b60006127ee826128af565b91506127f9836128af565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156128325761283161290b565b5b828202905092915050565b6000612848826128af565b9150612853836128af565b9250828210156128665761286561290b565b5b828203905092915050565b600061287c8261288f565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006128d1826128af565b9050919050565b60005b838110156128f65780820151818401526020810190506128db565b83811115612905576000848401525b50505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b612c5081612871565b8114612c5b57600080fd5b50565b612c6781612883565b8114612c7257600080fd5b50565b612c7e816128af565b8114612c8957600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220bc4210521105fa2354788c6cc91276adcfeebb589d2858b6b5bc0f530489274464736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 2,219 |
0xf2983Db0a5abbe9ee7b26c42550797ab8ef608fe
|
// File: contracts/MembershipVerifier.sol
//
// Copyright 2017 Christian Reitwiessner
// 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.
//
// 2019 OKIMS
// ported to solidity 0.6
// fixed linter warnings
// added requiere error messages
//
//
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.0;
library Pairing {
struct G1Point {
uint X;
uint Y;
}
// Encoding of field elements is: X[0] * z + X[1]
struct G2Point {
uint[2] X;
uint[2] Y;
}
/// @return the generator of G1
function P1() internal pure returns (G1Point memory) {
return G1Point(1, 2);
}
/// @return the generator of G2
function P2() internal pure returns (G2Point memory) {
// Original code point
return G2Point(
[11559732032986387107991004021392285783925812861821192530917403151452391805634,
10857046999023057135944570762232829481370756359578518086990519993285655852781],
[4082367875863433681332203403145435568316851327593401208105741076214120093531,
8495653923123431417604973247489272438418190587263600148770280649306958101930]
);
/*
// Changed by Jordi point
return G2Point(
[10857046999023057135944570762232829481370756359578518086990519993285655852781,
11559732032986387107991004021392285783925812861821192530917403151452391805634],
[8495653923123431417604973247489272438418190587263600148770280649306958101930,
4082367875863433681332203403145435568316851327593401208105741076214120093531]
);
*/
}
/// @return r the negation of p, i.e. p.addition(p.negate()) should be zero.
function negate(G1Point memory p) internal pure returns (G1Point memory r) {
// The prime q in the base field F_q for G1
uint q = 21888242871839275222246405745257275088696311157297823662689037894645226208583;
if (p.X == 0 && p.Y == 0)
return G1Point(0, 0);
return G1Point(p.X, q - (p.Y % q));
}
/// @return r the sum of two points of G1
function addition(G1Point memory p1, G1Point memory p2) internal view returns (G1Point memory r) {
uint[4] memory input;
input[0] = p1.X;
input[1] = p1.Y;
input[2] = p2.X;
input[3] = p2.Y;
bool success;
// solium-disable-next-line security/no-inline-assembly
assembly {
success := staticcall(sub(gas(), 2000), 6, input, 0xc0, r, 0x60)
// Use "invalid" to make gas estimation work
switch success case 0 { invalid() }
}
require(success,"pairing-add-failed");
}
/// @return r the product of a point on G1 and a scalar, i.e.
/// p == p.scalar_mul(1) and p.addition(p) == p.scalar_mul(2) for all points p.
function scalar_mul(G1Point memory p, uint s) internal view returns (G1Point memory r) {
uint[3] memory input;
input[0] = p.X;
input[1] = p.Y;
input[2] = s;
bool success;
// solium-disable-next-line security/no-inline-assembly
assembly {
success := staticcall(sub(gas(), 2000), 7, input, 0x80, r, 0x60)
// Use "invalid" to make gas estimation work
switch success case 0 { invalid() }
}
require (success,"pairing-mul-failed");
}
/// @return the result of computing the pairing check
/// e(p1[0], p2[0]) * .... * e(p1[n], p2[n]) == 1
/// For example pairing([P1(), P1().negate()], [P2(), P2()]) should
/// return true.
function pairing(G1Point[] memory p1, G2Point[] memory p2) internal view returns (bool) {
require(p1.length == p2.length,"pairing-lengths-failed");
uint elements = p1.length;
uint inputSize = elements * 6;
uint[] memory input = new uint[](inputSize);
for (uint i = 0; i < elements; i++)
{
input[i * 6 + 0] = p1[i].X;
input[i * 6 + 1] = p1[i].Y;
input[i * 6 + 2] = p2[i].X[0];
input[i * 6 + 3] = p2[i].X[1];
input[i * 6 + 4] = p2[i].Y[0];
input[i * 6 + 5] = p2[i].Y[1];
}
uint[1] memory out;
bool success;
// solium-disable-next-line security/no-inline-assembly
assembly {
success := staticcall(sub(gas(), 2000), 8, add(input, 0x20), mul(inputSize, 0x20), out, 0x20)
// Use "invalid" to make gas estimation work
switch success case 0 { invalid() }
}
require(success,"pairing-opcode-failed");
return out[0] != 0;
}
/// Convenience method for a pairing check for two pairs.
function pairingProd2(G1Point memory a1, G2Point memory a2, G1Point memory b1, G2Point memory b2) internal view returns (bool) {
G1Point[] memory p1 = new G1Point[](2);
G2Point[] memory p2 = new G2Point[](2);
p1[0] = a1;
p1[1] = b1;
p2[0] = a2;
p2[1] = b2;
return pairing(p1, p2);
}
/// Convenience method for a pairing check for three pairs.
function pairingProd3(
G1Point memory a1, G2Point memory a2,
G1Point memory b1, G2Point memory b2,
G1Point memory c1, G2Point memory c2
) internal view returns (bool) {
G1Point[] memory p1 = new G1Point[](3);
G2Point[] memory p2 = new G2Point[](3);
p1[0] = a1;
p1[1] = b1;
p1[2] = c1;
p2[0] = a2;
p2[1] = b2;
p2[2] = c2;
return pairing(p1, p2);
}
/// Convenience method for a pairing check for four pairs.
function pairingProd4(
G1Point memory a1, G2Point memory a2,
G1Point memory b1, G2Point memory b2,
G1Point memory c1, G2Point memory c2,
G1Point memory d1, G2Point memory d2
) internal view returns (bool) {
G1Point[] memory p1 = new G1Point[](4);
G2Point[] memory p2 = new G2Point[](4);
p1[0] = a1;
p1[1] = b1;
p1[2] = c1;
p1[3] = d1;
p2[0] = a2;
p2[1] = b2;
p2[2] = c2;
p2[3] = d2;
return pairing(p1, p2);
}
}
contract MembershipVerifier {
using Pairing for *;
struct VerifyingKey {
Pairing.G1Point alfa1;
Pairing.G2Point beta2;
Pairing.G2Point gamma2;
Pairing.G2Point delta2;
Pairing.G1Point[] IC;
}
struct Proof {
Pairing.G1Point A;
Pairing.G2Point B;
Pairing.G1Point C;
}
function verifyingKey() internal pure returns (VerifyingKey memory vk) {
vk.alfa1 = Pairing.G1Point(19999268883299812380118267745389058698359487558742858385672801683947009174841,10979465955338708482481933698167832325746603808865456750985292287877353355870);
vk.beta2 = Pairing.G2Point([6068181524513427278587143754114992710203920567465128023830932235519822136628,16579293707019070536109697385456617347080855615194695274360466897444993251], [10091094195423517525628188919723607870162196765642914096795805721764659872311,13723776030631949818632750387918069001653144993639245536406298986026264197577]);
vk.gamma2 = Pairing.G2Point([11559732032986387107991004021392285783925812861821192530917403151452391805634,10857046999023057135944570762232829481370756359578518086990519993285655852781], [4082367875863433681332203403145435568316851327593401208105741076214120093531,8495653923123431417604973247489272438418190587263600148770280649306958101930]);
vk.delta2 = Pairing.G2Point([11559732032986387107991004021392285783925812861821192530917403151452391805634,10857046999023057135944570762232829481370756359578518086990519993285655852781], [4082367875863433681332203403145435568316851327593401208105741076214120093531,8495653923123431417604973247489272438418190587263600148770280649306958101930]);
vk.IC = new Pairing.G1Point[](4);
vk.IC[0] = Pairing.G1Point(1079420831454985419248774125551839104961637639291459667533218182143041371810,17039110079959747649145914288243287982936033625997476751651169264994325890340);
vk.IC[1] = Pairing.G1Point(12511859808514735597224780617509045821499483439843284007557068056972330496480,997227388947331052357481800682863872352525852736840780855125186785416544744);
vk.IC[2] = Pairing.G1Point(14054648376065458965574031677607130893156944233741248968416170960442389869982,6837841949371117241092620520200022176087379095803818691557939890882667007650);
vk.IC[3] = Pairing.G1Point(1172112811221215404787133472473218088776994768730531545732108558323402657475,5798126020275162237488557905091686019669976137618701955940067805955670887872);
}
function verify(uint[] memory input, Proof memory proof) internal view returns (uint) {
uint256 snark_scalar_field = 21888242871839275222246405745257275088548364400416034343698204186575808495617;
VerifyingKey memory vk = verifyingKey();
require(input.length + 1 == vk.IC.length,"verifier-bad-input");
// Compute the linear combination vk_x
Pairing.G1Point memory vk_x = Pairing.G1Point(0, 0);
for (uint i = 0; i < input.length; i++) {
require(input[i] < snark_scalar_field,"verifier-gte-snark-scalar-field");
vk_x = Pairing.addition(vk_x, Pairing.scalar_mul(vk.IC[i + 1], input[i]));
}
vk_x = Pairing.addition(vk_x, vk.IC[0]);
if (!Pairing.pairingProd4(
Pairing.negate(proof.A), proof.B,
vk.alfa1, vk.beta2,
vk_x, vk.gamma2,
proof.C, vk.delta2
)) return 1;
return 0;
}
/// @return r bool true if proof is valid
function verifyProof(
uint[2] memory a,
uint[2][2] memory b,
uint[2] memory c,
uint[3] memory input
) public view returns (bool r) {
Proof memory proof;
proof.A = Pairing.G1Point(a[0], a[1]);
proof.B = Pairing.G2Point([b[0][0], b[0][1]], [b[1][0], b[1][1]]);
proof.C = Pairing.G1Point(c[0], c[1]);
uint[] memory inputValues = new uint[](input.length);
for(uint i = 0; i < input.length; i++){
inputValues[i] = input[i];
}
if (verify(inputValues, proof) == 0) {
return true;
} else {
return false;
}
}
}
|
0x608060405234801561001057600080fd5b506004361061002b5760003560e01c806311479fea14610030575b600080fd5b61004361003e3660046110e6565b610059565b6040516100509190611196565b60405180910390f35b6000610063610ede565b60408051808201825287518152602080890151818301529083528151608080820184528851518285019081528951840151606080850191909152908352845180860186528a8501805151825251850151818601528385015285840192909252835180850185528851815288840151818501528585015283516003808252918101909452600093929091908301908036833701905050905060005b60038110156101685784816003811061012657634e487b7160e01b600052603260045260246000fd5b602002015182828151811061014b57634e487b7160e01b600052603260045260246000fd5b60209081029190910101528061016081611354565b9150506100fd565b506101738183610191565b61018257600192505050610189565b6000925050505b949350505050565b60007f30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001816101bd61036f565b9050806080015151855160016101d39190611306565b146101f95760405162461bcd60e51b81526004016101f0906111a1565b60405180910390fd5b604080518082019091526000808252602082018190525b86518110156102e4578387828151811061023a57634e487b7160e01b600052603260045260246000fd5b60200260200101511061025f5760405162461bcd60e51b81526004016101f0906111f9565b6102d0826102cb85608001518460016102789190611306565b8151811061029657634e487b7160e01b600052603260045260246000fd5b60200260200101518a85815181106102be57634e487b7160e01b600052603260045260246000fd5b60200260200101516107b0565b61081b565b9150806102dc81611354565b915050610210565b5061031b81836080015160008151811061030e57634e487b7160e01b600052603260045260246000fd5b602002602001015161081b565b905061035161032d8660000151610882565b8660200151846000015185602001518587604001518b604001518960600151610917565b6103615760019350505050610369565b600093505050505b92915050565b610377610f10565b6040805180820182527f2c372f5f830a0eb74f1a631092f63dbbeaa39634a62fd04b94650f7c22bd6d3981527f18462852872e99dd7f5a7055bee64f5c6dc20c53f0be045320a8e3529650ba5e6020808301919091529083528151608080820184527f0d6a78125795d136e002058af57471ee26406a6dcd6fb142a6263a697c9805348285019081527e0962302e9264ad0a28bb22175445b66332db6018d9b93d6f49334566e6f8e3606080850191909152908352845180860186527f164f5b5e917ccb83506de0187b92217f9d1fbcdef5097b733cb80eb943e6423781527f1e5761c8a2800bf5e42e5b16918363b804a68431d2658c9f11995a6ef4e079c9818601528385015285840192909252835180820185527f198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c28186018181527f1800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed838601819052908352865180880188527f090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b8082527f12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa82890181905285890192909252898901949094528751948501885284880192835284860191909152908352855180870187529182528185015281840152908401528151600480825260a08201909352919082015b610586610f57565b81526020019060019003908161057e57505060808201908152604080518082019091527f0262ee37df43e311e715f1af3546ca2b293de04adc898d6929fcbc0a7d647ea281527f25abcb671bb768f368c19645d9c53dff22dc994ec5806ae04568a5ab7a60052460208201529051805160009061061357634e487b7160e01b600052603260045260246000fd5b602002602001018190525060405180604001604052807f1ba9763195336ddc931c007ef09a27a7bf3f0f70e862e9faf9cb18314b3371e081526020017f02346923a5ad319e4b0b9eebffa77fd6401ee6c731ce35bf53a43d9079cf81e8815250816080015160018151811061069857634e487b7160e01b600052603260045260246000fd5b602002602001018190525060405180604001604052807f1f12a62a05c3339e7b19455159ce49240199e1eb541382aab0371f9366cab59e81526020017f0f1e14d6290d3b66ff5cc590ec0804aad2fff6657d01206f9ed8fa463572cea2815250816080015160028151811061071d57634e487b7160e01b600052603260045260246000fd5b602002602001018190525060405180604001604052807f029764707c9fbf925fa3e40107f5885c03ae8dbca1a46faf0d2aafd06763cec381526020017f0cd19f7ef7f9b772dd391e6cbc5d21a987043a50efba54e2c0ab147e9c7b4dc081525081608001516003815181106107a257634e487b7160e01b600052603260045260246000fd5b602002602001018190525090565b6107b8610f57565b6107c0610f71565b835181526020808501519082015260408101839052600060608360808460076107d05a03fa90508080156107f3576107f5565bfe5b50806108135760405162461bcd60e51b81526004016101f0906111cd565b505092915050565b610823610f57565b61082b610f8f565b8351815260208085015181830152835160408301528301516060808301919091526000908360c08460066107d05a03fa90508080156107f35750806108135760405162461bcd60e51b81526004016101f090611260565b61088a610f57565b81517f30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd47901580156108bd57506020830151155b156108dd5750506040805180820190915260008082526020820152610912565b604051806040016040528084600001518152602001828560200151610902919061136f565b61090c908461133d565b90529150505b919050565b60408051600480825260a08201909252600091829190816020015b61093a610f57565b81526020019060019003908161093257505060408051600480825260a0820190925291925060009190602082015b610970610fad565b8152602001906001900390816109685790505090508a826000815181106109a757634e487b7160e01b600052603260045260246000fd5b602002602001018190525088826001815181106109d457634e487b7160e01b600052603260045260246000fd5b60200260200101819052508682600281518110610a0157634e487b7160e01b600052603260045260246000fd5b60200260200101819052508482600381518110610a2e57634e487b7160e01b600052603260045260246000fd5b60200260200101819052508981600081518110610a5b57634e487b7160e01b600052603260045260246000fd5b60200260200101819052508781600181518110610a8857634e487b7160e01b600052603260045260246000fd5b60200260200101819052508581600281518110610ab557634e487b7160e01b600052603260045260246000fd5b60200260200101819052508381600381518110610ae257634e487b7160e01b600052603260045260246000fd5b6020026020010181905250610af78282610b06565b9b9a5050505050505050505050565b60008151835114610b295760405162461bcd60e51b81526004016101f090611230565b82516000610b3882600661131e565b905060008167ffffffffffffffff811115610b6357634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015610b8c578160200160208202803683370190505b50905060005b83811015610e8b57868181518110610bba57634e487b7160e01b600052603260045260246000fd5b60200260200101516000015182826006610bd4919061131e565b610bdf906000611306565b81518110610bfd57634e487b7160e01b600052603260045260246000fd5b602002602001018181525050868181518110610c2957634e487b7160e01b600052603260045260246000fd5b60200260200101516020015182826006610c43919061131e565b610c4e906001611306565b81518110610c6c57634e487b7160e01b600052603260045260246000fd5b602002602001018181525050858181518110610c9857634e487b7160e01b600052603260045260246000fd5b6020908102919091010151515182610cb183600661131e565b610cbc906002611306565b81518110610cda57634e487b7160e01b600052603260045260246000fd5b602002602001018181525050858181518110610d0657634e487b7160e01b600052603260045260246000fd5b60209081029190910181015151015182610d2183600661131e565b610d2c906003611306565b81518110610d4a57634e487b7160e01b600052603260045260246000fd5b602002602001018181525050858181518110610d7657634e487b7160e01b600052603260045260246000fd5b602002602001015160200151600060028110610da257634e487b7160e01b600052603260045260246000fd5b602002015182610db383600661131e565b610dbe906004611306565b81518110610ddc57634e487b7160e01b600052603260045260246000fd5b602002602001018181525050858181518110610e0857634e487b7160e01b600052603260045260246000fd5b602002602001015160200151600160028110610e3457634e487b7160e01b600052603260045260246000fd5b602002015182610e4583600661131e565b610e50906005611306565b81518110610e6e57634e487b7160e01b600052603260045260246000fd5b602090810291909101015280610e8381611354565b915050610b92565b50610e94610fcd565b6000602082602086026020860160086107d05a03fa90508080156107f3575080610ed05760405162461bcd60e51b81526004016101f09061128c565b505115159695505050505050565b6040518060600160405280610ef1610f57565b8152602001610efe610fad565b8152602001610f0b610f57565b905290565b6040518060a00160405280610f23610f57565b8152602001610f30610fad565b8152602001610f3d610fad565b8152602001610f4a610fad565b8152602001606081525090565b604051806040016040528060008152602001600081525090565b60405180606001604052806003906020820280368337509192915050565b60405180608001604052806004906020820280368337509192915050565b6040518060400160405280610fc0610feb565b8152602001610f0b610feb565b60405180602001604052806001906020820280368337509192915050565b60405180604001604052806002906020820280368337509192915050565b600082601f830112611019578081fd5b6040516040810181811067ffffffffffffffff8211171561103c5761103c6113a5565b8060405250808385604086011115611052578384fd5b835b6002811015611073578135835260209283019290910190600101611054565b509195945050505050565b600082601f83011261108e578081fd5b6040516060810181811067ffffffffffffffff821117156110b1576110b16113a5565b6040528083606081018610156110c5578384fd5b835b60038110156110735781358352602092830192909101906001016110c7565b60008060008061016085870312156110fc578384fd5b6111068686611009565b9350604086605f870112611118578384fd5b600261112b611126826112e5565b6112bb565b8083890160c08a018b81111561113f578889fd5b885b85811015611167576111538d84611009565b855260209094019391860191600101611141565b508298506111758c82611009565b975050505050505061118b86610100870161107e565b905092959194509250565b901515815260200190565b6020808252601290820152711d995c9a599a595c8b5898590b5a5b9c1d5d60721b604082015260600190565b6020808252601290820152711c185a5c9a5b99cb5b5d5b0b59985a5b195960721b604082015260600190565b6020808252601f908201527f76657269666965722d6774652d736e61726b2d7363616c61722d6669656c6400604082015260600190565b6020808252601690820152751c185a5c9a5b99cb5b195b99dd1a1ccb59985a5b195960521b604082015260600190565b6020808252601290820152711c185a5c9a5b99cb5859190b59985a5b195960721b604082015260600190565b6020808252601590820152741c185a5c9a5b99cb5bdc18dbd9194b59985a5b1959605a1b604082015260600190565b60405181810167ffffffffffffffff811182821017156112dd576112dd6113a5565b604052919050565b600067ffffffffffffffff8211156112ff576112ff6113a5565b5060200290565b600082198211156113195761131961138f565b500190565b60008160001904831182151516156113385761133861138f565b500290565b60008282101561134f5761134f61138f565b500390565b60006000198214156113685761136861138f565b5060010190565b60008261138a57634e487b7160e01b81526012600452602481fd5b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fdfea2646970667358221220eb86a339f3ea1a14117f430266985314f834010d14beb198b85da89365138e0564736f6c63430008000033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 2,220 |
0x1899924f87138cd0607e27c516a84bc839faa1a4
|
pragma solidity ^0.4.23;
// File: node_modules\openzeppelin-solidity\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(address _owner) public {
owner = _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to relinquish control of the contract.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipRenounced(owner);
owner = address(0);
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function transferOwnership(address _newOwner) public onlyOwner {
_transferOwnership(_newOwner);
}
/**
* @dev Transfers control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function _transferOwnership(address _newOwner) internal {
require(_newOwner != address(0));
emit OwnershipTransferred(owner, _newOwner);
owner = _newOwner;
}
}
// File: node_modules\openzeppelin-solidity\contracts\math\SafeMath.sol
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
// Gas optimization: this is cheaper than asserting 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
}
// File: node_modules\openzeppelin-solidity\contracts\token\ERC20\ERC20Basic.sol
/**
* @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);
}
// File: node_modules\openzeppelin-solidity\contracts\token\ERC20\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;
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];
}
}
// File: node_modules\openzeppelin-solidity\contracts\token\ERC20\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 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
);
}
// File: node_modules\openzeppelin-solidity\contracts\token\ERC20\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)) 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;
}
}
// File: node_modules\openzeppelin-solidity\contracts\token\ERC20\MintableToken.sol
/**
* @title Mintable token
* @dev Simple ERC20 Token example, with mintable token creation
* @dev Issue: * https://github.com/OpenZeppelin/openzeppelin-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);
_;
}
modifier hasMintPermission() {
require(msg.sender == owner);
_;
}
/**
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @param _amount The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful.
*/
function mint(
address _to,
uint256 _amount
)
hasMintPermission
canMint
public
returns (bool)
{
totalSupply_ = totalSupply_.add(_amount);
balances[_to] = balances[_to].add(_amount);
emit Mint(_to, _amount);
emit Transfer(address(0), _to, _amount);
return true;
}
/**
* @dev Function to stop minting new tokens.
* @return True if the operation was successful.
*/
function finishMinting() onlyOwner canMint public returns (bool) {
mintingFinished = true;
emit MintFinished();
return true;
}
}
// File: contracts\MyToken.sol
contract MyToken is MintableToken {
string public name;
string public symbol;
uint8 public decimals;
function MyToken (string _name, string _symbol, uint8 _decimals, address _owner) public Ownable(_owner) {
name = _name;
symbol = _symbol;
decimals = _decimals;
}
}
// File: contracts\TokenCreator.sol
contract TokenCreator {
event TokenCreated(address indexed owner, address token);
function createToken (string _name, string _symbol, uint8 _decimals) public {
emit TokenCreated(msg.sender, new MyToken(_name, _symbol, _decimals, msg.sender));
}
}
|
0x608060405260043610610041576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063e8a0aed314610046575b600080fd5b34801561005257600080fd5b50610100600480360381019080803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803560ff169060200190929190505050610102565b005b3373ffffffffffffffffffffffffffffffffffffffff167fd5f9bdf12adf29dab0248c349842c3822d53ae2bb4f36352f301630d018c8139848484336101466102c4565b8080602001806020018560ff1660ff1681526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001838103835287818151815260200191508051906020019080838360005b838110156101c55780820151818401526020810190506101aa565b50505050905090810190601f1680156101f25780820380516001836020036101000a031916815260200191505b50838103825286818151815260200191508051906020019080838360005b8381101561022b578082015181840152602081019050610210565b50505050905090810190601f1680156102585780820380516001836020036101000a031916815260200191505b509650505050505050604051809103906000f08015801561027d573d6000803e3d6000fd5b50604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a2505050565b604051611bc9806102d583390190560060806040526000600360146101000a81548160ff0219169083151502179055503480156200002c57600080fd5b5060405162001bc938038062001bc9833981018060405281019080805182019291906020018051820192919060200180519060200190929190805190602001909291905050508080600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550508360049080519060200190620000cd9291906200010c565b508260059080519060200190620000e69291906200010c565b5081600660006101000a81548160ff021916908360ff16021790555050505050620001bb565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106200014f57805160ff191683800117855562000180565b8280016001018555821562000180579182015b828111156200017f57825182559160200191906001019062000162565b5b5090506200018f919062000193565b5090565b620001b891905b80821115620001b45760008160009055506001016200019a565b5090565b90565b6119fe80620001cb6000396000f3006080604052600436106100f1576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806305d2035b146100f657806306fdde0314610125578063095ea7b3146101b557806318160ddd1461021a57806323b872dd14610245578063313ce567146102ca57806340c10f19146102fb578063661884631461036057806370a08231146103c5578063715018a61461041c5780637d64bcb4146104335780638da5cb5b1461046257806395d89b41146104b9578063a9059cbb14610549578063d73dd623146105ae578063dd62ed3e14610613578063f2fde38b1461068a575b600080fd5b34801561010257600080fd5b5061010b6106cd565b604051808215151515815260200191505060405180910390f35b34801561013157600080fd5b5061013a6106e0565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561017a57808201518184015260208101905061015f565b50505050905090810190601f1680156101a75780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101c157600080fd5b50610200600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061077e565b604051808215151515815260200191505060405180910390f35b34801561022657600080fd5b5061022f610870565b6040518082815260200191505060405180910390f35b34801561025157600080fd5b506102b0600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061087a565b604051808215151515815260200191505060405180910390f35b3480156102d657600080fd5b506102df610c34565b604051808260ff1660ff16815260200191505060405180910390f35b34801561030757600080fd5b50610346600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c47565b604051808215151515815260200191505060405180910390f35b34801561036c57600080fd5b506103ab600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610e2d565b604051808215151515815260200191505060405180910390f35b3480156103d157600080fd5b50610406600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506110be565b6040518082815260200191505060405180910390f35b34801561042857600080fd5b50610431611106565b005b34801561043f57600080fd5b5061044861120b565b604051808215151515815260200191505060405180910390f35b34801561046e57600080fd5b506104776112d3565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156104c557600080fd5b506104ce6112f9565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561050e5780820151818401526020810190506104f3565b50505050905090810190601f16801561053b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561055557600080fd5b50610594600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611397565b604051808215151515815260200191505060405180910390f35b3480156105ba57600080fd5b506105f9600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506115b6565b604051808215151515815260200191505060405180910390f35b34801561061f57600080fd5b50610674600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506117b2565b6040518082815260200191505060405180910390f35b34801561069657600080fd5b506106cb600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611839565b005b600360149054906101000a900460ff1681565b60048054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156107765780601f1061074b57610100808354040283529160200191610776565b820191906000526020600020905b81548152906001019060200180831161075957829003601f168201915b505050505081565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600154905090565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156108b757600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561090457600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561098f57600080fd5b6109e0826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546118a190919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610a73826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546118ba90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610b4482600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546118a190919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600660009054906101000a900460ff1681565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610ca557600080fd5b600360149054906101000a900460ff16151515610cc157600080fd5b610cd6826001546118ba90919063ffffffff16565b600181905550610d2d826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546118ba90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff167f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885836040518082815260200191505060405180910390a28273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610f3e576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610fd2565b610f5183826118a190919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561116257600080fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482060405160405180910390a26000600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561126957600080fd5b600360149054906101000a900460ff1615151561128557600080fd5b6001600360146101000a81548160ff0219169083151502179055507fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0860405160405180910390a16001905090565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60058054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561138f5780601f106113645761010080835404028352916020019161138f565b820191906000526020600020905b81548152906001019060200180831161137257829003601f168201915b505050505081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156113d457600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561142157600080fd5b611472826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546118a190919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611505826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546118ba90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600061164782600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546118ba90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561189557600080fd5b61189e816118d6565b50565b60008282111515156118af57fe5b818303905092915050565b600081830190508281101515156118cd57fe5b80905092915050565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561191257600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505600a165627a7a7230582088fb170e7541092e2edeae51d5f880552794bbb1c53853490f98f33ea6226a6a0029a165627a7a7230582089e4407ac5f962e96ce3c045af6e54219f213f096bc20864e295183f73c08d140029
|
{"success": true, "error": null, "results": {}}
| 2,221 |
0x96d7f29c1f56744849d3a23014dec90a2cc9fde0
|
/**
*Submitted for verification at Etherscan.io on 2022-04-14
*/
// SPDX-License-Identifier: UNLICENSED
/**
kyoshi.finance
tg.me/kyoshieth
*/
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 KYOSHI is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Kyoshi";
string private constant _symbol = "Kyoshi";
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 = 1000000 * 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(0x17A882804e7a3B4A94a94A98724c360f9acAdAD5);
address payable private _marketingAddress = payable(0xa4c08ae7bC5100543425c3eCc557828f07f8D29F);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen = false;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 10000 * 10**9; //1%
uint256 public _maxWalletSize = 50000 * 10**9; //5%
uint256 public _swapTokensAtAmount = 4000 * 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;
}
}
}
|
0x6080604052600436106101c55760003560e01c806374010ece116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610614578063dd62ed3e1461063d578063ea1644d51461067a578063f2fde38b146106a3576101cc565b8063a2a957bb1461055a578063a9059cbb14610583578063bfd79284146105c0578063c3c8cd80146105fd576101cc565b80638f70ccf7116100d15780638f70ccf7146104b25780638f9a55c0146104db57806395d89b411461050657806398a5c31514610531576101cc565b806374010ece146104335780637d1db4a51461045c5780638da5cb5b14610487576101cc565b8063313ce567116101645780636d8aa8f81161013e5780636d8aa8f81461039f5780636fc3eaec146103c857806370a08231146103df578063715018a61461041c576101cc565b8063313ce5671461032057806349bd5a5e1461034b5780636b99905314610376576101cc565b80631694505e116101a05780631694505e1461026257806318160ddd1461028d57806323b872dd146102b85780632fd689e3146102f5576101cc565b8062b8cf2a146101d157806306fdde03146101fa578063095ea7b314610225576101cc565b366101cc57005b600080fd5b3480156101dd57600080fd5b506101f860048036038101906101f39190612f2f565b6106cc565b005b34801561020657600080fd5b5061020f61081c565b60405161021c9190613378565b60405180910390f35b34801561023157600080fd5b5061024c60048036038101906102479190612e9b565b610859565b6040516102599190613342565b60405180910390f35b34801561026e57600080fd5b50610277610877565b604051610284919061335d565b60405180910390f35b34801561029957600080fd5b506102a261089d565b6040516102af919061355a565b60405180910390f35b3480156102c457600080fd5b506102df60048036038101906102da9190612e4c565b6108ac565b6040516102ec9190613342565b60405180910390f35b34801561030157600080fd5b5061030a610985565b604051610317919061355a565b60405180910390f35b34801561032c57600080fd5b5061033561098b565b60405161034291906135cf565b60405180910390f35b34801561035757600080fd5b50610360610994565b60405161036d9190613327565b60405180910390f35b34801561038257600080fd5b5061039d60048036038101906103989190612dbe565b6109ba565b005b3480156103ab57600080fd5b506103c660048036038101906103c19190612f70565b610aaa565b005b3480156103d457600080fd5b506103dd610b5c565b005b3480156103eb57600080fd5b5061040660048036038101906104019190612dbe565b610c2d565b604051610413919061355a565b60405180910390f35b34801561042857600080fd5b50610431610c7e565b005b34801561043f57600080fd5b5061045a60048036038101906104559190612f99565b610dd1565b005b34801561046857600080fd5b50610471610e70565b60405161047e919061355a565b60405180910390f35b34801561049357600080fd5b5061049c610e76565b6040516104a99190613327565b60405180910390f35b3480156104be57600080fd5b506104d960048036038101906104d49190612f70565b610e9f565b005b3480156104e757600080fd5b506104f0610f51565b6040516104fd919061355a565b60405180910390f35b34801561051257600080fd5b5061051b610f57565b6040516105289190613378565b60405180910390f35b34801561053d57600080fd5b5061055860048036038101906105539190612f99565b610f94565b005b34801561056657600080fd5b50610581600480360381019061057c9190612fc2565b611033565b005b34801561058f57600080fd5b506105aa60048036038101906105a59190612e9b565b6110ea565b6040516105b79190613342565b60405180910390f35b3480156105cc57600080fd5b506105e760048036038101906105e29190612dbe565b611108565b6040516105f49190613342565b60405180910390f35b34801561060957600080fd5b50610612611128565b005b34801561062057600080fd5b5061063b60048036038101906106369190612ed7565b611201565b005b34801561064957600080fd5b50610664600480360381019061065f9190612e10565b611361565b604051610671919061355a565b60405180910390f35b34801561068657600080fd5b506106a1600480360381019061069c9190612f99565b6113e8565b005b3480156106af57600080fd5b506106ca60048036038101906106c59190612dbe565b611487565b005b6106d4611649565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610761576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610758906134ba565b60405180910390fd5b60005b8151811015610818576001601060008484815181106107ac577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061081090613894565b915050610764565b5050565b60606040518060400160405280600681526020017f4b796f7368690000000000000000000000000000000000000000000000000000815250905090565b600061086d610866611649565b8484611651565b6001905092915050565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600066038d7ea4c68000905090565b60006108b984848461181c565b61097a846108c5611649565b61097585604051806060016040528060288152602001613da160289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061092b611649565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120a19092919063ffffffff16565b611651565b600190509392505050565b60185481565b60006009905090565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6109c2611649565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a4f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a46906134ba565b60405180910390fd5b6000601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b610ab2611649565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b3f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b36906134ba565b60405180910390fd5b80601560166101000a81548160ff02191690831515021790555050565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b9d611649565b73ffffffffffffffffffffffffffffffffffffffff161480610c135750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610bfb611649565b73ffffffffffffffffffffffffffffffffffffffff16145b610c1c57600080fd5b6000479050610c2a81612105565b50565b6000610c77600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612200565b9050919050565b610c86611649565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d13576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d0a906134ba565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610dd9611649565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e66576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e5d906134ba565b60405180910390fd5b8060168190555050565b60165481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610ea7611649565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f34576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f2b906134ba565b60405180910390fd5b80601560146101000a81548160ff02191690831515021790555050565b60175481565b60606040518060400160405280600681526020017f4b796f7368690000000000000000000000000000000000000000000000000000815250905090565b610f9c611649565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611029576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611020906134ba565b60405180910390fd5b8060188190555050565b61103b611649565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146110c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110bf906134ba565b60405180910390fd5b8360088190555082600a819055508160098190555080600b8190555050505050565b60006110fe6110f7611649565b848461181c565b6001905092915050565b60106020528060005260406000206000915054906101000a900460ff1681565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611169611649565b73ffffffffffffffffffffffffffffffffffffffff1614806111df5750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166111c7611649565b73ffffffffffffffffffffffffffffffffffffffff16145b6111e857600080fd5b60006111f330610c2d565b90506111fe8161226e565b50565b611209611649565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611296576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161128d906134ba565b60405180910390fd5b60005b8383905081101561135b5781600560008686858181106112e2577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b90506020020160208101906112f79190612dbe565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061135390613894565b915050611299565b50505050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6113f0611649565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461147d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611474906134ba565b60405180910390fd5b8060178190555050565b61148f611649565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461151c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611513906134ba565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561158c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115839061341a565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156116c1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116b89061353a565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611731576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117289061343a565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161180f919061355a565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561188c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611883906134fa565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156118fc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118f39061339a565b60405180910390fd5b6000811161193f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611936906134da565b60405180910390fd5b611947610e76565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156119b55750611985610e76565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611da057601560149054906101000a900460ff16611a44576119d6610e76565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614611a43576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a3a906133ba565b60405180910390fd5b5b601654811115611a89576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a80906133fa565b60405180910390fd5b601060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611b2d5750601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611b6c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b639061345a565b60405180910390fd5b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614611c195760175481611bce84610c2d565b611bd89190613690565b10611c18576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c0f9061351a565b60405180910390fd5b5b6000611c2430610c2d565b9050600060185482101590506016548210611c3f5760165491505b808015611c57575060158054906101000a900460ff16155b8015611cb15750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b8015611cc95750601560169054906101000a900460ff165b8015611d1f5750600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611d755750600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611d9d57611d838261226e565b60004790506000811115611d9b57611d9a47612105565b5b505b50505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611e475750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b80611efa5750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614158015611ef95750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b5b15611f08576000905061208f565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148015611fb35750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b15611fcb57600854600c81905550600954600d819055505b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156120765750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b1561208e57600a54600c81905550600b54600d819055505b5b61209b84848484612566565b50505050565b60008383111582906120e9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120e09190613378565b60405180910390fd5b50600083856120f89190613771565b9050809150509392505050565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61215560028461259390919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612180573d6000803e3d6000fd5b50601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6121d160028461259390919063ffffffff16565b9081150290604051600060405180830381858888f193505050501580156121fc573d6000803e3d6000fd5b5050565b6000600654821115612247576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161223e906133da565b60405180910390fd5b60006122516125dd565b9050612266818461259390919063ffffffff16565b915050919050565b60016015806101000a81548160ff0219169083151502179055506000600267ffffffffffffffff8111156122cb577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156122f95781602001602082028036833780820191505090505b5090503081600081518110612337577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156123d957600080fd5b505afa1580156123ed573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124119190612de7565b8160018151811061244b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506124b230601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611651565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401612516959493929190613575565b600060405180830381600087803b15801561253057600080fd5b505af1158015612544573d6000803e3d6000fd5b505050505060006015806101000a81548160ff02191690831515021790555050565b8061257457612573612608565b5b61257f84848461264b565b8061258d5761258c612816565b5b50505050565b60006125d583836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061282a565b905092915050565b60008060006125ea61288d565b91509150612601818361259390919063ffffffff16565b9250505090565b6000600c5414801561261c57506000600d54145b1561262657612649565b600c54600e81905550600d54600f819055506000600c819055506000600d819055505b565b60008060008060008061265d876128e9565b9550955095509550955095506126bb86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461295190919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061275085600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461299b90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061279c816129f9565b6127a68483612ab6565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051612803919061355a565b60405180910390a3505050505050505050565b600e54600c81905550600f54600d81905550565b60008083118290612871576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016128689190613378565b60405180910390fd5b506000838561288091906136e6565b9050809150509392505050565b60008060006006549050600066038d7ea4c6800090506128bf66038d7ea4c6800060065461259390919063ffffffff16565b8210156128dc5760065466038d7ea4c680009350935050506128e5565b81819350935050505b9091565b60008060008060008060008060006129068a600c54600d54612af0565b92509250925060006129166125dd565b905060008060006129298e878787612b86565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061299383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506120a1565b905092915050565b60008082846129aa9190613690565b9050838110156129ef576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016129e69061347a565b60405180910390fd5b8091505092915050565b6000612a036125dd565b90506000612a1a8284612c0f90919063ffffffff16565b9050612a6e81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461299b90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612acb8260065461295190919063ffffffff16565b600681905550612ae68160075461299b90919063ffffffff16565b6007819055505050565b600080600080612b1c6064612b0e888a612c0f90919063ffffffff16565b61259390919063ffffffff16565b90506000612b466064612b38888b612c0f90919063ffffffff16565b61259390919063ffffffff16565b90506000612b6f82612b61858c61295190919063ffffffff16565b61295190919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612b9f8589612c0f90919063ffffffff16565b90506000612bb68689612c0f90919063ffffffff16565b90506000612bcd8789612c0f90919063ffffffff16565b90506000612bf682612be8858761295190919063ffffffff16565b61295190919063ffffffff16565b9050838184965096509650505050509450945094915050565b600080831415612c225760009050612c84565b60008284612c309190613717565b9050828482612c3f91906136e6565b14612c7f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612c769061349a565b60405180910390fd5b809150505b92915050565b6000612c9d612c988461360f565b6135ea565b90508083825260208201905082856020860282011115612cbc57600080fd5b60005b85811015612cec5781612cd28882612cf6565b845260208401935060208301925050600181019050612cbf565b5050509392505050565b600081359050612d0581613d5b565b92915050565b600081519050612d1a81613d5b565b92915050565b60008083601f840112612d3257600080fd5b8235905067ffffffffffffffff811115612d4b57600080fd5b602083019150836020820283011115612d6357600080fd5b9250929050565b600082601f830112612d7b57600080fd5b8135612d8b848260208601612c8a565b91505092915050565b600081359050612da381613d72565b92915050565b600081359050612db881613d89565b92915050565b600060208284031215612dd057600080fd5b6000612dde84828501612cf6565b91505092915050565b600060208284031215612df957600080fd5b6000612e0784828501612d0b565b91505092915050565b60008060408385031215612e2357600080fd5b6000612e3185828601612cf6565b9250506020612e4285828601612cf6565b9150509250929050565b600080600060608486031215612e6157600080fd5b6000612e6f86828701612cf6565b9350506020612e8086828701612cf6565b9250506040612e9186828701612da9565b9150509250925092565b60008060408385031215612eae57600080fd5b6000612ebc85828601612cf6565b9250506020612ecd85828601612da9565b9150509250929050565b600080600060408486031215612eec57600080fd5b600084013567ffffffffffffffff811115612f0657600080fd5b612f1286828701612d20565b93509350506020612f2586828701612d94565b9150509250925092565b600060208284031215612f4157600080fd5b600082013567ffffffffffffffff811115612f5b57600080fd5b612f6784828501612d6a565b91505092915050565b600060208284031215612f8257600080fd5b6000612f9084828501612d94565b91505092915050565b600060208284031215612fab57600080fd5b6000612fb984828501612da9565b91505092915050565b60008060008060808587031215612fd857600080fd5b6000612fe687828801612da9565b9450506020612ff787828801612da9565b935050604061300887828801612da9565b925050606061301987828801612da9565b91505092959194509250565b6000613031838361303d565b60208301905092915050565b613046816137a5565b82525050565b613055816137a5565b82525050565b60006130668261364b565b613070818561366e565b935061307b8361363b565b8060005b838110156130ac5781516130938882613025565b975061309e83613661565b92505060018101905061307f565b5085935050505092915050565b6130c2816137b7565b82525050565b6130d1816137fa565b82525050565b6130e08161381e565b82525050565b60006130f182613656565b6130fb818561367f565b935061310b818560208601613830565b6131148161396a565b840191505092915050565b600061312c60238361367f565b91506131378261397b565b604082019050919050565b600061314f603f8361367f565b915061315a826139ca565b604082019050919050565b6000613172602a8361367f565b915061317d82613a19565b604082019050919050565b6000613195601c8361367f565b91506131a082613a68565b602082019050919050565b60006131b860268361367f565b91506131c382613a91565b604082019050919050565b60006131db60228361367f565b91506131e682613ae0565b604082019050919050565b60006131fe60238361367f565b915061320982613b2f565b604082019050919050565b6000613221601b8361367f565b915061322c82613b7e565b602082019050919050565b600061324460218361367f565b915061324f82613ba7565b604082019050919050565b600061326760208361367f565b915061327282613bf6565b602082019050919050565b600061328a60298361367f565b915061329582613c1f565b604082019050919050565b60006132ad60258361367f565b91506132b882613c6e565b604082019050919050565b60006132d060238361367f565b91506132db82613cbd565b604082019050919050565b60006132f360248361367f565b91506132fe82613d0c565b604082019050919050565b613312816137e3565b82525050565b613321816137ed565b82525050565b600060208201905061333c600083018461304c565b92915050565b600060208201905061335760008301846130b9565b92915050565b600060208201905061337260008301846130c8565b92915050565b6000602082019050818103600083015261339281846130e6565b905092915050565b600060208201905081810360008301526133b38161311f565b9050919050565b600060208201905081810360008301526133d381613142565b9050919050565b600060208201905081810360008301526133f381613165565b9050919050565b6000602082019050818103600083015261341381613188565b9050919050565b60006020820190508181036000830152613433816131ab565b9050919050565b60006020820190508181036000830152613453816131ce565b9050919050565b60006020820190508181036000830152613473816131f1565b9050919050565b6000602082019050818103600083015261349381613214565b9050919050565b600060208201905081810360008301526134b381613237565b9050919050565b600060208201905081810360008301526134d38161325a565b9050919050565b600060208201905081810360008301526134f38161327d565b9050919050565b60006020820190508181036000830152613513816132a0565b9050919050565b60006020820190508181036000830152613533816132c3565b9050919050565b60006020820190508181036000830152613553816132e6565b9050919050565b600060208201905061356f6000830184613309565b92915050565b600060a08201905061358a6000830188613309565b61359760208301876130d7565b81810360408301526135a9818661305b565b90506135b8606083018561304c565b6135c56080830184613309565b9695505050505050565b60006020820190506135e46000830184613318565b92915050565b60006135f4613605565b90506136008282613863565b919050565b6000604051905090565b600067ffffffffffffffff82111561362a5761362961393b565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600061369b826137e3565b91506136a6836137e3565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156136db576136da6138dd565b5b828201905092915050565b60006136f1826137e3565b91506136fc836137e3565b92508261370c5761370b61390c565b5b828204905092915050565b6000613722826137e3565b915061372d836137e3565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613766576137656138dd565b5b828202905092915050565b600061377c826137e3565b9150613787836137e3565b92508282101561379a576137996138dd565b5b828203905092915050565b60006137b0826137c3565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006138058261380c565b9050919050565b6000613817826137c3565b9050919050565b6000613829826137e3565b9050919050565b60005b8381101561384e578082015181840152602081019050613833565b8381111561385d576000848401525b50505050565b61386c8261396a565b810181811067ffffffffffffffff8211171561388b5761388a61393b565b5b80604052505050565b600061389f826137e3565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156138d2576138d16138dd565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060008201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000600082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460008201527f6564210000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a2042616c616e636520657863656564732077616c6c657420736960008201527f7a65210000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b613d64816137a5565b8114613d6f57600080fd5b50565b613d7b816137b7565b8114613d8657600080fd5b50565b613d92816137e3565b8114613d9d57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220ebf4bfe30bb6187ce196012a5498e3ee1004281f4cb544195998d02278e26e1664736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 2,222 |
0xffef4240b3a91000ff0ea36837fa443a147f0e9e
|
pragma solidity 0.4.24;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* See https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address _who) public view returns (uint256);
function transfer(address _to, uint256 _value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 _a, uint256 _b) internal pure returns (uint256 c) {
// Gas optimization: this is cheaper than asserting 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (_a == 0) {
return 0;
}
c = _a * _b;
assert(c / _a == _b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 _a, uint256 _b) internal pure returns (uint256) {
// assert(_b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = _a / _b;
// assert(_a == _b * c + _a % _b); // There is no case in which this doesn't hold
return _a / _b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 _a, uint256 _b) internal pure returns (uint256) {
assert(_b <= _a);
return _a - _b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 _a, uint256 _b) internal pure returns (uint256 c) {
c = _a + _b;
assert(c >= _a);
return c;
}
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) internal balances;
uint256 internal totalSupply_;
/**
* @dev Total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev Transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_value <= balances[msg.sender]);
require(_to != address(0));
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256) {
return balances[_owner];
}
}
/**
* @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.
* https://github.com/ethereum/EIPs/issues/20
* Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(
address _from,
address _to,
uint256 _value
)
public
returns (bool)
{
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
require(_to != address(0));
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(
address _owner,
address _spender
)
public
view
returns (uint256)
{
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(
address _spender,
uint256 _addedValue
)
public
returns (bool)
{
allowed[msg.sender][_spender] = (
allowed[msg.sender][_spender].add(_addedValue));
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(
address _spender,
uint256 _subtractedValue
)
public
returns (bool)
{
uint256 oldValue = allowed[msg.sender][_spender];
if (_subtractedValue >= oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to relinquish control of the contract.
* @notice Renouncing to ownership will leave the contract without an owner.
* It will not be possible to call the functions with the `onlyOwner`
* modifier anymore.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipRenounced(owner);
owner = address(0);
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function transferOwnership(address _newOwner) public onlyOwner {
_transferOwnership(_newOwner);
}
/**
* @dev Transfers control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function _transferOwnership(address _newOwner) internal {
require(_newOwner != address(0));
emit OwnershipTransferred(owner, _newOwner);
owner = _newOwner;
}
}
/**
* @title Mintable token
* @dev Simple ERC20 Token example, with mintable token creation
* 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);
_;
}
modifier hasMintPermission() {
require(msg.sender == owner);
_;
}
/**
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @param _amount The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful.
*/
function mint(
address _to,
uint256 _amount
)
public
hasMintPermission
canMint
returns (bool)
{
totalSupply_ = totalSupply_.add(_amount);
balances[_to] = balances[_to].add(_amount);
emit Mint(_to, _amount);
emit Transfer(address(0), _to, _amount);
return true;
}
/**
* @dev Function to stop minting new tokens.
* @return True if the operation was successful.
*/
function finishMinting() public onlyOwner canMint returns (bool) {
mintingFinished = true;
emit MintFinished();
return true;
}
}
/**
* @title Base contract for ThietPC token
*/
contract KylinNetwork is MintableToken {
string public name = "Kylin Network";
string public symbol = "KYL";
uint public decimals = 9;
constructor() public {
totalSupply_ = 1000000000 * (9 ** decimals);
balances[msg.sender] = totalSupply_;
}
}
|
0x608060405260043610610057576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806318160ddd1461005c57806370a0823114610087578063a9059cbb146100de575b600080fd5b34801561006857600080fd5b50610071610143565b6040518082815260200191505060405180910390f35b34801561009357600080fd5b506100c8600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061014d565b6040518082815260200191505060405180910390f35b3480156100ea57600080fd5b50610129600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610195565b604051808215151515815260200191505060405180910390f35b6000600154905090565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60008060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156101e457600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561022057600080fd5b610271826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546103b590919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610304826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546103ce90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b60008282111515156103c357fe5b818303905092915050565b600081830190508281101515156103e157fe5b809050929150505600a165627a7a72305820ed635dbf28e3c12037f62e9f25ac42916cb813323357c85fefe35dd130cf36b70029
|
{"success": true, "error": null, "results": {}}
| 2,223 |
0x5b653Baf0F2dAfe0e997585fe1a888Bd54DCEAcC
|
/**
*Submitted for verification at Etherscan.io on 2021-06-27
*/
/**
* MANEKI NEKO COIN
* https://t.me/ManekiNekoOfficial
* https://ManekiNekoCoin.net
*
* MANEKI NEKO IS A fork of MUSUBI which is a meme token with a twist!
* MANEKI NEKO has no sale limitations, which benefits whales and minnows alike, and an innovative dynamic reflection tax rate which increases proportionate to the size of the sell.
*
* TOKENOMICS:
* 1,000,000,000,000 token supply
* FIRST TWO MINUTES: 3,000,000,000 max buy / 45-second buy cooldown (these limitations are lifted automatically two minutes post-launch)
* 15-second cooldown to sell after a buy, in order to limit bot behavior. NO OTHER COOLDOWNS, NO COOLDOWNS BETWEEN SELLS
* No buy or sell token limits. Whales are welcome!
* 10% total tax on buy
* Fee on sells is dynamic, relative to price impact, minimum of 10% fee and maximum of 40% fee, with NO SELL LIMIT.
* No team tokens, no presale
* A unique approach to resolving the huge dumps after long pumps that have plagued every NotInu fork
*/
/*
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 MANEKINEKO is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => User) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1e12 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = unicode"MANEKINEKO" ;
string private constant _symbol = unicode"MANEKINEKO";
uint8 private constant _decimals = 9;
uint256 private _taxFee = 6;
uint256 private _teamFee = 4;
uint256 private _feeRate = 5;
uint256 private _feeMultiplier = 1000;
uint256 private _launchTime;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
uint256 private _maxBuyAmount;
address payable private _FeeAddress;
address payable private _marketingWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private _cooldownEnabled = true;
bool private inSwap = false;
bool private _useImpactFeeSetter = true;
uint256 private buyLimitEnd;
struct User {
uint256 buy;
uint256 sell;
bool exists;
}
event MaxBuyAmountUpdated(uint _maxBuyAmount);
event CooldownEnabledUpdated(bool _cooldown);
event FeeMultiplierUpdated(uint _multiplier);
event FeeRateUpdated(uint _rate);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable FeeAddress, address payable marketingWalletAddress) {
_FeeAddress = FeeAddress;
_marketingWalletAddress = marketingWalletAddress;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress] = true;
_isExcludedFromFee[marketingWalletAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function setFee(uint256 impactFee) private {
uint256 _impactFee = 10;
if(impactFee < 10) {
_impactFee = 10;
} else if(impactFee > 40) {
_impactFee = 40;
} else {
_impactFee = impactFee;
}
if(_impactFee.mod(2) != 0) {
_impactFee++;
}
_taxFee = (_impactFee.mul(1)).div(10);
_teamFee = (_impactFee.mul(9)).div(10);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if(from != owner() && to != owner()) {
if(_cooldownEnabled) {
if(!cooldown[msg.sender].exists) {
cooldown[msg.sender] = User(0,0,true);
}
}
// buy
if(from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to]) {
require(tradingOpen, "Trading not yet enabled.");
_taxFee = 1;
_teamFee = 9;
if(_cooldownEnabled) {
if(buyLimitEnd > block.timestamp) {
require(amount <= _maxBuyAmount);
require(cooldown[to].buy < block.timestamp, "Your buy cooldown has not expired.");
cooldown[to].buy = block.timestamp + (30 seconds);
}
}
if(_cooldownEnabled) {
cooldown[to].sell = block.timestamp + (15 seconds);
}
}
uint256 contractTokenBalance = balanceOf(address(this));
// sell
if(!inSwap && from != uniswapV2Pair && tradingOpen) {
if(_cooldownEnabled) {
require(cooldown[from].sell < block.timestamp, "Your sell cooldown has not expired.");
}
if(_useImpactFeeSetter) {
uint256 feeBasis = amount.mul(_feeMultiplier);
feeBasis = feeBasis.div(balanceOf(uniswapV2Pair).add(amount));
setFee(feeBasis);
}
if(contractTokenBalance > 0) {
if(contractTokenBalance > balanceOf(uniswapV2Pair).mul(_feeRate).div(100)) {
contractTokenBalance = balanceOf(uniswapV2Pair).mul(_feeRate).div(100);
}
swapTokensForEth(contractTokenBalance);
}
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_FeeAddress.transfer(amount.div(2));
_marketingWalletAddress.transfer(amount.div(2));
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if(!takeFee)
removeAllFee();
_transferStandard(sender, recipient, amount);
if(!takeFee)
restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if(rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function addLiquidity() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
_maxBuyAmount = 10000000000 * 10**9;
_launchTime = block.timestamp;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function openTrading() public onlyOwner {
tradingOpen = true;
buyLimitEnd = block.timestamp + (240 seconds);
}
function manualswap() external {
require(_msgSender() == _FeeAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _FeeAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
// fallback in case contract is not releasing tokens fast enough
function setFeeRate(uint256 rate) external {
require(_msgSender() == _FeeAddress);
require(rate < 51, "Rate can't exceed 50%");
_feeRate = rate;
emit FeeRateUpdated(_feeRate);
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
_cooldownEnabled = onoff;
emit CooldownEnabledUpdated(_cooldownEnabled);
}
function thisBalance() public view returns (uint) {
return balanceOf(address(this));
}
function cooldownEnabled() public view returns (bool) {
return _cooldownEnabled;
}
function timeToBuy(address buyer) public view returns (uint) {
return block.timestamp - cooldown[buyer].buy;
}
function timeToSell(address buyer) public view returns (uint) {
return block.timestamp - cooldown[buyer].sell;
}
function amountInPool() public view returns (uint) {
return balanceOf(uniswapV2Pair);
}
}
|
0x6080604052600436106101395760003560e01c8063715018a6116100ab578063a9fc35a91161006f578063a9fc35a914610423578063c3c8cd8014610460578063c9567bf914610477578063db92dbb61461048e578063dd62ed3e146104b9578063e8078d94146104f657610140565b8063715018a61461034e5780638da5cb5b1461036557806395d89b4114610390578063a9059cbb146103bb578063a985ceef146103f857610140565b8063313ce567116100fd578063313ce5671461024057806345596e2e1461026b5780635932ead11461029457806368a3a6a5146102bd5780636fc3eaec146102fa57806370a082311461031157610140565b806306fdde0314610145578063095ea7b31461017057806318160ddd146101ad57806323b872dd146101d857806327f3a72a1461021557610140565b3661014057005b600080fd5b34801561015157600080fd5b5061015a61050d565b60405161016791906130da565b60405180910390f35b34801561017c57600080fd5b5061019760048036038101906101929190612bf8565b61054a565b6040516101a491906130bf565b60405180910390f35b3480156101b957600080fd5b506101c2610568565b6040516101cf91906132bc565b60405180910390f35b3480156101e457600080fd5b506101ff60048036038101906101fa9190612ba9565b610579565b60405161020c91906130bf565b60405180910390f35b34801561022157600080fd5b5061022a610652565b60405161023791906132bc565b60405180910390f35b34801561024c57600080fd5b50610255610662565b6040516102629190613331565b60405180910390f35b34801561027757600080fd5b50610292600480360381019061028d9190612c86565b61066b565b005b3480156102a057600080fd5b506102bb60048036038101906102b69190612c34565b610752565b005b3480156102c957600080fd5b506102e460048036038101906102df9190612b1b565b61084a565b6040516102f191906132bc565b60405180910390f35b34801561030657600080fd5b5061030f6108a1565b005b34801561031d57600080fd5b5061033860048036038101906103339190612b1b565b610913565b60405161034591906132bc565b60405180910390f35b34801561035a57600080fd5b50610363610964565b005b34801561037157600080fd5b5061037a610ab7565b6040516103879190612ff1565b60405180910390f35b34801561039c57600080fd5b506103a5610ae0565b6040516103b291906130da565b60405180910390f35b3480156103c757600080fd5b506103e260048036038101906103dd9190612bf8565b610b1d565b6040516103ef91906130bf565b60405180910390f35b34801561040457600080fd5b5061040d610b3b565b60405161041a91906130bf565b60405180910390f35b34801561042f57600080fd5b5061044a60048036038101906104459190612b1b565b610b52565b60405161045791906132bc565b60405180910390f35b34801561046c57600080fd5b50610475610ba9565b005b34801561048357600080fd5b5061048c610c23565b005b34801561049a57600080fd5b506104a3610ce7565b6040516104b091906132bc565b60405180910390f35b3480156104c557600080fd5b506104e060048036038101906104db9190612b6d565b610d19565b6040516104ed91906132bc565b60405180910390f35b34801561050257600080fd5b5061050b610da0565b005b60606040518060400160405280600a81526020017f4d414e454b494e454b4f00000000000000000000000000000000000000000000815250905090565b600061055e6105576112b0565b84846112b8565b6001905092915050565b6000683635c9adc5dea00000905090565b6000610586848484611483565b610647846105926112b0565b61064285604051806060016040528060288152602001613a1360289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006105f86112b0565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d4d9092919063ffffffff16565b6112b8565b600190509392505050565b600061065d30610913565b905090565b60006009905090565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166106ac6112b0565b73ffffffffffffffffffffffffffffffffffffffff16146106cc57600080fd5b6033811061070f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107069061319c565b60405180910390fd5b80600b819055507f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd8600b5460405161074791906132bc565b60405180910390a150565b61075a6112b0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146107e7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107de906131fc565b60405180910390fd5b80601460156101000a81548160ff0219169083151502179055507f0d63187a8abb5b4d1bb562e1163897386b0a88ee72e0799dd105bd0fd6f28706601460159054906101000a900460ff1660405161083f91906130bf565b60405180910390a150565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001544261089a9190613482565b9050919050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108e26112b0565b73ffffffffffffffffffffffffffffffffffffffff161461090257600080fd5b600047905061091081611db1565b50565b600061095d600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611eac565b9050919050565b61096c6112b0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146109f9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109f0906131fc565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600a81526020017f4d414e454b494e454b4f00000000000000000000000000000000000000000000815250905090565b6000610b31610b2a6112b0565b8484611483565b6001905092915050565b6000601460159054906101000a900460ff16905090565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015442610ba29190613482565b9050919050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610bea6112b0565b73ffffffffffffffffffffffffffffffffffffffff1614610c0a57600080fd5b6000610c1530610913565b9050610c2081611f1a565b50565b610c2b6112b0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610cb8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610caf906131fc565b60405180910390fd5b60016014806101000a81548160ff02191690831515021790555060f042610cdf91906133a1565b601581905550565b6000610d14601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610913565b905090565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b610da86112b0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e35576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e2c906131fc565b60405180910390fd5b60148054906101000a900460ff1615610e83576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e7a9061327c565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610f1330601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112b8565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610f5957600080fd5b505afa158015610f6d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f919190612b44565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610ff357600080fd5b505afa158015611007573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061102b9190612b44565b6040518363ffffffff1660e01b815260040161104892919061300c565b602060405180830381600087803b15801561106257600080fd5b505af1158015611076573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061109a9190612b44565b601460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d719473061112330610913565b60008061112e610ab7565b426040518863ffffffff1660e01b81526004016111509695949392919061305e565b6060604051808303818588803b15801561116957600080fd5b505af115801561117d573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906111a29190612caf565b505050678ac7230489e8000060108190555042600d81905550601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161125a929190613035565b602060405180830381600087803b15801561127457600080fd5b505af1158015611288573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112ac9190612c5d565b5050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611328576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131f9061325c565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611398576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138f9061313c565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161147691906132bc565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114f3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114ea9061323c565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611563576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161155a906130fc565b60405180910390fd5b600081116115a6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161159d9061321c565b60405180910390fd5b6115ae610ab7565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561161c57506115ec610ab7565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611c8a57601460159054906101000a900460ff161561172257600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020160009054906101000a900460ff16611721576040518060600160405280600081526020016000815260200160011515815250600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082015181600001556020820151816001015560408201518160020160006101000a81548160ff0219169083151502179055509050505b5b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156117cd5750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156118235750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156119f65760148054906101000a900460ff16611875576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161186c9061329c565b60405180910390fd5b60016009819055506009600a81905550601460159054906101000a900460ff161561198c5742601554111561198b576010548111156118b357600080fd5b42600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015410611937576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161192e9061315c565b60405180910390fd5b601e4261194491906133a1565b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001819055505b5b601460159054906101000a900460ff16156119f557600f426119ae91906133a1565b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101819055505b5b6000611a0130610913565b9050601460169054906101000a900460ff16158015611a6e5750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611a84575060148054906101000a900460ff165b15611c8857601460159054906101000a900460ff1615611b235742600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015410611b22576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b19906131bc565b60405180910390fd5b5b601460179054906101000a900460ff1615611bad576000611b4f600c548461221490919063ffffffff16565b9050611ba0611b9184611b83601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610913565b61228f90919063ffffffff16565b826122ed90919063ffffffff16565b9050611bab81612337565b505b6000811115611c6e57611c086064611bfa600b54611bec601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610913565b61221490919063ffffffff16565b6122ed90919063ffffffff16565b811115611c6457611c616064611c53600b54611c45601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610913565b61221490919063ffffffff16565b6122ed90919063ffffffff16565b90505b611c6d81611f1a565b5b60004790506000811115611c8657611c8547611db1565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611d315750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611d3b57600090505b611d47848484846123ee565b50505050565b6000838311158290611d95576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d8c91906130da565b60405180910390fd5b5060008385611da49190613482565b9050809150509392505050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611e016002846122ed90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611e2c573d6000803e3d6000fd5b50601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611e7d6002846122ed90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611ea8573d6000803e3d6000fd5b5050565b6000600754821115611ef3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611eea9061311c565b60405180910390fd5b6000611efd61241b565b9050611f1281846122ed90919063ffffffff16565b915050919050565b6001601460166101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611f78577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611fa65781602001602082028036833780820191505090505b5090503081600081518110611fe4577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561208657600080fd5b505afa15801561209a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120be9190612b44565b816001815181106120f8577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061215f30601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112b8565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016121c39594939291906132d7565b600060405180830381600087803b1580156121dd57600080fd5b505af11580156121f1573d6000803e3d6000fd5b50505050506000601460166101000a81548160ff02191690831515021790555050565b6000808314156122275760009050612289565b600082846122359190613428565b905082848261224491906133f7565b14612284576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161227b906131dc565b60405180910390fd5b809150505b92915050565b600080828461229e91906133a1565b9050838110156122e3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122da9061317c565b60405180910390fd5b8091505092915050565b600061232f83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612446565b905092915050565b6000600a9050600a82101561234f57600a9050612366565b60288211156123615760289050612365565b8190505b5b600061237c6002836124a990919063ffffffff16565b1461239057808061238c90613550565b9150505b6123b7600a6123a960018461221490919063ffffffff16565b6122ed90919063ffffffff16565b6009819055506123e4600a6123d660098461221490919063ffffffff16565b6122ed90919063ffffffff16565b600a819055505050565b806123fc576123fb6124f3565b5b612407848484612536565b8061241557612414612701565b5b50505050565b6000806000612428612715565b9150915061243f81836122ed90919063ffffffff16565b9250505090565b6000808311829061248d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161248491906130da565b60405180910390fd5b506000838561249c91906133f7565b9050809150509392505050565b60006124eb83836040518060400160405280601881526020017f536166654d6174683a206d6f64756c6f206279207a65726f0000000000000000815250612777565b905092915050565b600060095414801561250757506000600a54145b1561251157612534565b600954600e81905550600a54600f8190555060006009819055506000600a819055505b565b600080600080600080612548876127d5565b9550955095509550955095506125a686600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461283d90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061263b85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461228f90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061268781612887565b6126918483612944565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516126ee91906132bc565b60405180910390a3505050505050505050565b600e54600981905550600f54600a81905550565b600080600060075490506000683635c9adc5dea00000905061274b683635c9adc5dea000006007546122ed90919063ffffffff16565b82101561276a57600754683635c9adc5dea00000935093505050612773565b81819350935050505b9091565b60008083141582906127bf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016127b691906130da565b60405180910390fd5b5082846127cc9190613599565b90509392505050565b60008060008060008060008060006127f28a600954600a5461297e565b925092509250600061280261241b565b905060008060006128158e878787612a14565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061287f83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611d4d565b905092915050565b600061289161241b565b905060006128a8828461221490919063ffffffff16565b90506128fc81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461228f90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6129598260075461283d90919063ffffffff16565b6007819055506129748160085461228f90919063ffffffff16565b6008819055505050565b6000806000806129aa606461299c888a61221490919063ffffffff16565b6122ed90919063ffffffff16565b905060006129d460646129c6888b61221490919063ffffffff16565b6122ed90919063ffffffff16565b905060006129fd826129ef858c61283d90919063ffffffff16565b61283d90919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612a2d858961221490919063ffffffff16565b90506000612a44868961221490919063ffffffff16565b90506000612a5b878961221490919063ffffffff16565b90506000612a8482612a76858761283d90919063ffffffff16565b61283d90919063ffffffff16565b9050838184965096509650505050509450945094915050565b600081359050612aac816139cd565b92915050565b600081519050612ac1816139cd565b92915050565b600081359050612ad6816139e4565b92915050565b600081519050612aeb816139e4565b92915050565b600081359050612b00816139fb565b92915050565b600081519050612b15816139fb565b92915050565b600060208284031215612b2d57600080fd5b6000612b3b84828501612a9d565b91505092915050565b600060208284031215612b5657600080fd5b6000612b6484828501612ab2565b91505092915050565b60008060408385031215612b8057600080fd5b6000612b8e85828601612a9d565b9250506020612b9f85828601612a9d565b9150509250929050565b600080600060608486031215612bbe57600080fd5b6000612bcc86828701612a9d565b9350506020612bdd86828701612a9d565b9250506040612bee86828701612af1565b9150509250925092565b60008060408385031215612c0b57600080fd5b6000612c1985828601612a9d565b9250506020612c2a85828601612af1565b9150509250929050565b600060208284031215612c4657600080fd5b6000612c5484828501612ac7565b91505092915050565b600060208284031215612c6f57600080fd5b6000612c7d84828501612adc565b91505092915050565b600060208284031215612c9857600080fd5b6000612ca684828501612af1565b91505092915050565b600080600060608486031215612cc457600080fd5b6000612cd286828701612b06565b9350506020612ce386828701612b06565b9250506040612cf486828701612b06565b9150509250925092565b6000612d0a8383612d16565b60208301905092915050565b612d1f816134b6565b82525050565b612d2e816134b6565b82525050565b6000612d3f8261335c565b612d49818561337f565b9350612d548361334c565b8060005b83811015612d85578151612d6c8882612cfe565b9750612d7783613372565b925050600181019050612d58565b5085935050505092915050565b612d9b816134c8565b82525050565b612daa8161350b565b82525050565b6000612dbb82613367565b612dc58185613390565b9350612dd581856020860161351d565b612dde81613628565b840191505092915050565b6000612df6602383613390565b9150612e0182613639565b604082019050919050565b6000612e19602a83613390565b9150612e2482613688565b604082019050919050565b6000612e3c602283613390565b9150612e47826136d7565b604082019050919050565b6000612e5f602283613390565b9150612e6a82613726565b604082019050919050565b6000612e82601b83613390565b9150612e8d82613775565b602082019050919050565b6000612ea5601583613390565b9150612eb08261379e565b602082019050919050565b6000612ec8602383613390565b9150612ed3826137c7565b604082019050919050565b6000612eeb602183613390565b9150612ef682613816565b604082019050919050565b6000612f0e602083613390565b9150612f1982613865565b602082019050919050565b6000612f31602983613390565b9150612f3c8261388e565b604082019050919050565b6000612f54602583613390565b9150612f5f826138dd565b604082019050919050565b6000612f77602483613390565b9150612f828261392c565b604082019050919050565b6000612f9a601783613390565b9150612fa58261397b565b602082019050919050565b6000612fbd601883613390565b9150612fc8826139a4565b602082019050919050565b612fdc816134f4565b82525050565b612feb816134fe565b82525050565b60006020820190506130066000830184612d25565b92915050565b60006040820190506130216000830185612d25565b61302e6020830184612d25565b9392505050565b600060408201905061304a6000830185612d25565b6130576020830184612fd3565b9392505050565b600060c0820190506130736000830189612d25565b6130806020830188612fd3565b61308d6040830187612da1565b61309a6060830186612da1565b6130a76080830185612d25565b6130b460a0830184612fd3565b979650505050505050565b60006020820190506130d46000830184612d92565b92915050565b600060208201905081810360008301526130f48184612db0565b905092915050565b6000602082019050818103600083015261311581612de9565b9050919050565b6000602082019050818103600083015261313581612e0c565b9050919050565b6000602082019050818103600083015261315581612e2f565b9050919050565b6000602082019050818103600083015261317581612e52565b9050919050565b6000602082019050818103600083015261319581612e75565b9050919050565b600060208201905081810360008301526131b581612e98565b9050919050565b600060208201905081810360008301526131d581612ebb565b9050919050565b600060208201905081810360008301526131f581612ede565b9050919050565b6000602082019050818103600083015261321581612f01565b9050919050565b6000602082019050818103600083015261323581612f24565b9050919050565b6000602082019050818103600083015261325581612f47565b9050919050565b6000602082019050818103600083015261327581612f6a565b9050919050565b6000602082019050818103600083015261329581612f8d565b9050919050565b600060208201905081810360008301526132b581612fb0565b9050919050565b60006020820190506132d16000830184612fd3565b92915050565b600060a0820190506132ec6000830188612fd3565b6132f96020830187612da1565b818103604083015261330b8186612d34565b905061331a6060830185612d25565b6133276080830184612fd3565b9695505050505050565b60006020820190506133466000830184612fe2565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006133ac826134f4565b91506133b7836134f4565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156133ec576133eb6135ca565b5b828201905092915050565b6000613402826134f4565b915061340d836134f4565b92508261341d5761341c6135f9565b5b828204905092915050565b6000613433826134f4565b915061343e836134f4565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613477576134766135ca565b5b828202905092915050565b600061348d826134f4565b9150613498836134f4565b9250828210156134ab576134aa6135ca565b5b828203905092915050565b60006134c1826134d4565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000613516826134f4565b9050919050565b60005b8381101561353b578082015181840152602081019050613520565b8381111561354a576000848401525b50505050565b600061355b826134f4565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561358e5761358d6135ca565b5b600182019050919050565b60006135a4826134f4565b91506135af836134f4565b9250826135bf576135be6135f9565b5b828206905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f596f75722062757920636f6f6c646f776e20686173206e6f742065787069726560008201527f642e000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f526174652063616e277420657863656564203530250000000000000000000000600082015250565b7f596f75722073656c6c20636f6f6c646f776e20686173206e6f7420657870697260008201527f65642e0000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f54726164696e67206e6f742079657420656e61626c65642e0000000000000000600082015250565b6139d6816134b6565b81146139e157600080fd5b50565b6139ed816134c8565b81146139f857600080fd5b50565b613a04816134f4565b8114613a0f57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220da5e607b2b4983a4528a96e9e27428504e1c4811f3726aa41b6ad362a567e8cb64736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 2,224 |
0x4a6b53706ef8ffa05b777f29e46ff7be119d69e5
|
pragma solidity ^0.4.24;
/**
* @title DIETSweets
* @author DIETSweets
* @dev DIETSweets is an ERC223 Token with ERC20 functions and events
* Fully backward compatible with ERC20
*/
/**
* @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) onlyOwner public {
require(newOwner != address(0));
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 DIETSweets
* @author BLACK DIA COIN TEAM
* @dev DIETSweets is an ERC223 Token with ERC20 functions and events
* Fully backward compatible with ERC20
*/
contract DIETSweets is ERC223, Ownable {
using SafeMath for uint256;
string public name = "Diet Sweets";
string public symbol = "DIET";
uint8 public decimals = 8;
uint256 public totalSupply = 1e10 * 2e8;
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
*/
function DIETSweets() public {
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;
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];
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
&& now > unlockUnixTime[msg.sender]
&& now > 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(_custom_fallback)), msg.sender, _value, _data));
Transfer(msg.sender, _to, _value, _data);
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
&& now > unlockUnixTime[msg.sender]
&& now > 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
&& now > unlockUnixTime[msg.sender]
&& now > 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);
Transfer(msg.sender, _to, _value, _data);
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);
Transfer(msg.sender, _to, _value, _data);
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
&& now > unlockUnixTime[_from]
&& now > unlockUnixTime[_to]);
balanceOf[_from] = balanceOf[_from].sub(_value);
balanceOf[_to] = balanceOf[_to].add(_value);
allowance[_from][msg.sender] = allowance[_from][msg.sender].sub(_value);
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;
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);
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);
Mint(_to, _unitAmount);
Transfer(address(0), _to, _unitAmount);
return true;
}
/**
* @dev Function to stop minting new tokens.
*/
function finishMinting() onlyOwner canMint public returns (bool) {
mintingFinished = true;
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
&& now > 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
&& now > unlockUnixTime[addresses[j]]);
balanceOf[addresses[j]] = balanceOf[addresses[j]].add(amount);
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
&& now > 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
&& now > 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]);
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
&& now > 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]);
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
&& now > 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);
Transfer(owner, msg.sender, distributeAmount);
}
/**
* @dev fallback function
*/
function() payable public {
autoDistribute();
}
}
|
0x6080604052600436106101455763ffffffff60e060020a60003504166305d2035b811461014f57806306fdde0314610178578063095ea7b31461020257806318160ddd1461022657806323b872dd1461024d578063313ce5671461027757806340c10f19146102a25780634f25eced146102c657806364ddc605146102db57806370a08231146103695780637d64bcb41461038a5780638da5cb5b1461039f57806394594625146103d057806395d89b41146104275780639dc29fac1461043c578063a8f11eb914610145578063a9059cbb14610460578063b414d4b614610484578063be45fd62146104a5578063c341b9f61461050e578063cbbe974b14610567578063d39b1d4814610588578063dd62ed3e146105a0578063dd924594146105c7578063f0dc417114610655578063f2fde38b146106e3578063f6368f8a14610704575b61014d6107ab565b005b34801561015b57600080fd5b5061016461090f565b604080519115158252519081900360200190f35b34801561018457600080fd5b5061018d610918565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101c75781810151838201526020016101af565b50505050905090810190601f1680156101f45780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561020e57600080fd5b50610164600160a060020a03600435166024356109ab565b34801561023257600080fd5b5061023b610a11565b60408051918252519081900360200190f35b34801561025957600080fd5b50610164600160a060020a0360043581169060243516604435610a17565b34801561028357600080fd5b5061028c610c1b565b6040805160ff9092168252519081900360200190f35b3480156102ae57600080fd5b50610164600160a060020a0360043516602435610c24565b3480156102d257600080fd5b5061023b610d24565b3480156102e757600080fd5b506040805160206004803580820135838102808601850190965280855261014d95369593946024949385019291829185019084908082843750506040805187358901803560208181028481018201909552818452989b9a998901989297509082019550935083925085019084908082843750949750610d2a9650505050505050565b34801561037557600080fd5b5061023b600160a060020a0360043516610e8e565b34801561039657600080fd5b50610164610ea9565b3480156103ab57600080fd5b506103b4610f0f565b60408051600160a060020a039092168252519081900360200190f35b3480156103dc57600080fd5b5060408051602060048035808201358381028086018501909652808552610164953695939460249493850192918291850190849080828437509497505093359450610f1e9350505050565b34801561043357600080fd5b5061018d61118f565b34801561044857600080fd5b5061014d600160a060020a03600435166024356111f0565b34801561046c57600080fd5b50610164600160a060020a03600435166024356112d5565b34801561049057600080fd5b50610164600160a060020a0360043516611398565b3480156104b157600080fd5b50604080516020600460443581810135601f8101849004840285018401909552848452610164948235600160a060020a03169460248035953695946064949201919081908401838280828437509497506113ad9650505050505050565b34801561051a57600080fd5b506040805160206004803580820135838102808601850190965280855261014d95369593946024949385019291829185019084908082843750949750505050913515159250611466915050565b34801561057357600080fd5b5061023b600160a060020a0360043516611570565b34801561059457600080fd5b5061014d600435611582565b3480156105ac57600080fd5b5061023b600160a060020a036004358116906024351661159e565b3480156105d357600080fd5b506040805160206004803580820135838102808601850190965280855261016495369593946024949385019291829185019084908082843750506040805187358901803560208181028481018201909552818452989b9a9989019892975090820195509350839250850190849080828437509497506115c99650505050505050565b34801561066157600080fd5b506040805160206004803580820135838102808601850190965280855261016495369593946024949385019291829185019084908082843750506040805187358901803560208181028481018201909552818452989b9a99890198929750908201955093508392508501908490808284375094975061187c9650505050505050565b3480156106ef57600080fd5b5061014d600160a060020a0360043516611b5c565b34801561071057600080fd5b50604080516020600460443581810135601f8101849004840285018401909552848452610164948235600160a060020a031694602480359536959460649492019190819084018382808284375050604080516020601f89358b018035918201839004830284018301909452808352979a999881019791965091820194509250829150840183828082843750949750611bf19650505050505050565b60006006541180156107d95750600654600154600160a060020a031660009081526008602052604090205410155b80156107f55750336000908152600a602052604090205460ff16155b801561080f5750336000908152600b602052604090205442115b151561081a57600080fd5b600034111561085e57600154604051600160a060020a03909116903480156108fc02916000818181858888f1935050505015801561085c573d6000803e3d6000fd5b505b600654600154600160a060020a031660009081526008602052604090205461088b9163ffffffff611f0f16565b600154600160a060020a031660009081526008602052604080822092909255600654338252919020546108c39163ffffffff611f2116565b3360008181526008602090815260409182902093909355600154600654825190815291519293600160a060020a03909116926000805160206123038339815191529281900390910190a3565b60075460ff1681565b60028054604080516020601f60001961010060018716150201909416859004938401819004810282018101909252828152606093909290918301828280156109a15780601f10610976576101008083540402835291602001916109a1565b820191906000526020600020905b81548152906001019060200180831161098457829003601f168201915b5050505050905090565b336000818152600960209081526040808320600160a060020a038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a350600192915050565b60055490565b6000600160a060020a03831615801590610a315750600082115b8015610a555750600160a060020a0384166000908152600860205260409020548211155b8015610a845750600160a060020a03841660009081526009602090815260408083203384529091529020548211155b8015610aa95750600160a060020a0384166000908152600a602052604090205460ff16155b8015610ace5750600160a060020a0383166000908152600a602052604090205460ff16155b8015610af15750600160a060020a0384166000908152600b602052604090205442115b8015610b145750600160a060020a0383166000908152600b602052604090205442115b1515610b1f57600080fd5b600160a060020a038416600090815260086020526040902054610b48908363ffffffff611f0f16565b600160a060020a038086166000908152600860205260408082209390935590851681522054610b7d908363ffffffff611f2116565b600160a060020a038085166000908152600860209081526040808320949094559187168152600982528281203382529091522054610bc1908363ffffffff611f0f16565b600160a060020a0380861660008181526009602090815260408083203384528252918290209490945580518681529051928716939192600080516020612303833981519152929181900390910190a35060015b9392505050565b60045460ff1690565b600154600090600160a060020a03163314610c3e57600080fd5b60075460ff1615610c4e57600080fd5b60008211610c5b57600080fd5b600554610c6e908363ffffffff611f2116565b600555600160a060020a038316600090815260086020526040902054610c9a908363ffffffff611f2116565b600160a060020a038416600081815260086020908152604091829020939093558051858152905191927f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d412139688592918290030190a2604080518381529051600160a060020a038516916000916000805160206123038339815191529181900360200190a350600192915050565b60065481565b600154600090600160a060020a03163314610d4457600080fd5b60008351118015610d56575081518351145b1515610d6157600080fd5b5060005b8251811015610e89578181815181101515610d7c57fe5b90602001906020020151600b60008584815181101515610d9857fe5b6020908102909101810151600160a060020a031682528101919091526040016000205410610dc557600080fd5b8181815181101515610dd357fe5b90602001906020020151600b60008584815181101515610def57fe5b6020908102909101810151600160a060020a03168252810191909152604001600020558251839082908110610e2057fe5b90602001906020020151600160a060020a03167f1bd6fb9fa2c39ce5d0d2afa1eaba998963eb5f553fd862c94f131aa9e35c15778383815181101515610e6257fe5b906020019060200201516040518082815260200191505060405180910390a2600101610d65565b505050565b600160a060020a031660009081526008602052604090205490565b600154600090600160a060020a03163314610ec357600080fd5b60075460ff1615610ed357600080fd5b6007805460ff191660011790556040517fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0890600090a150600190565b600154600160a060020a031681565b60008060008084118015610f33575060008551115b8015610f4f5750336000908152600a602052604090205460ff16155b8015610f695750336000908152600b602052604090205442115b1515610f7457600080fd5b610f88846305f5e10063ffffffff611f3016565b9350610f9e855185611f3090919063ffffffff16565b33600090815260086020526040902054909250821115610fbd57600080fd5b5060005b8451811015611154578481815181101515610fd857fe5b90602001906020020151600160a060020a03166000141580156110305750600a6000868381518110151561100857fe5b6020908102909101810151600160a060020a031682528101919091526040016000205460ff16155b80156110775750600b6000868381518110151561104957fe5b90602001906020020151600160a060020a0316600160a060020a031681526020019081526020016000205442115b151561108257600080fd5b6110c78460086000888581518110151561109857fe5b6020908102909101810151600160a060020a03168252810191909152604001600020549063ffffffff611f2116565b6008600087848151811015156110d957fe5b6020908102909101810151600160a060020a0316825281019190915260400160002055845185908290811061110a57fe5b90602001906020020151600160a060020a031633600160a060020a0316600080516020612303833981519152866040518082815260200191505060405180910390a3600101610fc1565b33600090815260086020526040902054611174908363ffffffff611f0f16565b33600090815260086020526040902055506001949350505050565b60038054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156109a15780601f10610976576101008083540402835291602001916109a1565b600154600160a060020a0316331461120757600080fd5b60008111801561122f5750600160a060020a0382166000908152600860205260409020548111155b151561123a57600080fd5b600160a060020a038216600090815260086020526040902054611263908263ffffffff611f0f16565b600160a060020a03831660009081526008602052604090205560055461128f908263ffffffff611f0f16565b600555604080518281529051600160a060020a038416917fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5919081900360200190a25050565b600060606000831180156112f95750336000908152600a602052604090205460ff16155b801561131e5750600160a060020a0384166000908152600a602052604090205460ff16155b80156113385750336000908152600b602052604090205442115b801561135b5750600160a060020a0384166000908152600b602052604090205442115b151561136657600080fd5b61136f84611f5b565b156113865761137f848483611f63565b9150611391565b61137f8484836121a7565b5092915050565b600a6020526000908152604090205460ff1681565b600080831180156113ce5750336000908152600a602052604090205460ff16155b80156113f35750600160a060020a0384166000908152600a602052604090205460ff16155b801561140d5750336000908152600b602052604090205442115b80156114305750600160a060020a0384166000908152600b602052604090205442115b151561143b57600080fd5b61144484611f5b565b1561145b57611454848484611f63565b9050610c14565b6114548484846121a7565b600154600090600160a060020a0316331461148057600080fd5b825160001061148e57600080fd5b5060005b8251811015610e895782818151811015156114a957fe5b60209081029091010151600160a060020a031615156114c757600080fd5b81600a600085848151811015156114da57fe5b602090810291909101810151600160a060020a03168252810191909152604001600020805460ff1916911515919091179055825183908290811061151a57fe5b90602001906020020151600160a060020a03167f48335238b4855f35377ed80f164e8c6f3c366e54ac00b96a6402d4a9814a03a583604051808215151515815260200191505060405180910390a2600101611492565b600b6020526000908152604090205481565b600154600160a060020a0316331461159957600080fd5b600655565b600160a060020a03918216600090815260096020908152604080832093909416825291909152205490565b60008060008085511180156115df575083518551145b80156115fb5750336000908152600a602052604090205460ff16155b80156116155750336000908152600b602052604090205442115b151561162057600080fd5b5060009050805b8451811015611782576000848281518110151561164057fe5b906020019060200201511180156116785750848181518110151561166057fe5b90602001906020020151600160a060020a0316600014155b80156116b95750600a6000868381518110151561169157fe5b6020908102909101810151600160a060020a031682528101919091526040016000205460ff16155b80156117005750600b600086838151811015156116d257fe5b90602001906020020151600160a060020a0316600160a060020a031681526020019081526020016000205442115b151561170b57600080fd5b6117376305f5e100858381518110151561172157fe5b602090810290910101519063ffffffff611f3016565b848281518110151561174557fe5b6020908102909101015283516117789085908390811061176157fe5b60209081029091010151839063ffffffff611f2116565b9150600101611627565b3360009081526008602052604090205482111561179e57600080fd5b5060005b8451811015611154576117d884828151811015156117bc57fe5b9060200190602002015160086000888581518110151561109857fe5b6008600087848151811015156117ea57fe5b6020908102909101810151600160a060020a0316825281019190915260400160002055845185908290811061181b57fe5b90602001906020020151600160a060020a031633600160a060020a0316600080516020612303833981519152868481518110151561185557fe5b906020019060200201516040518082815260200191505060405180910390a36001016117a2565b60015460009081908190600160a060020a0316331461189a57600080fd5b600085511180156118ac575083518551145b15156118b757600080fd5b5060009050805b8451811015611b3c57600084828151811015156118d757fe5b9060200190602002015111801561190f575084818151811015156118f757fe5b90602001906020020151600160a060020a0316600014155b80156119505750600a6000868381518110151561192857fe5b6020908102909101810151600160a060020a031682528101919091526040016000205460ff16155b80156119975750600b6000868381518110151561196957fe5b90602001906020020151600160a060020a0316600160a060020a031681526020019081526020016000205442115b15156119a257600080fd5b6119b86305f5e100858381518110151561172157fe5b84828151811015156119c657fe5b6020908102909101015283518490829081106119de57fe5b906020019060200201516008600087848151811015156119fa57fe5b6020908102909101810151600160a060020a03168252810191909152604001600020541015611a2857600080fd5b611a848482815181101515611a3957fe5b90602001906020020151600860008885815181101515611a5557fe5b6020908102909101810151600160a060020a03168252810191909152604001600020549063ffffffff611f0f16565b600860008784815181101515611a9657fe5b6020908102909101810151600160a060020a03168252810191909152604001600020558351611acb9085908390811061176157fe5b915033600160a060020a03168582815181101515611ae557fe5b90602001906020020151600160a060020a03166000805160206123038339815191528684815181101515611b1557fe5b906020019060200201516040518082815260200191505060405180910390a36001016118be565b33600090815260086020526040902054611174908363ffffffff611f2116565b600154600160a060020a03163314611b7357600080fd5b600160a060020a0381161515611b8857600080fd5b600154604051600160a060020a038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a36001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60008084118015611c125750336000908152600a602052604090205460ff16155b8015611c375750600160a060020a0385166000908152600a602052604090205460ff16155b8015611c515750336000908152600b602052604090205442115b8015611c745750600160a060020a0385166000908152600b602052604090205442115b1515611c7f57600080fd5b611c8885611f5b565b15611ef95733600090815260086020526040902054841115611ca957600080fd5b33600090815260086020526040902054611cc9908563ffffffff611f0f16565b3360009081526008602052604080822092909255600160a060020a03871681522054611cfb908563ffffffff611f2116565b600160a060020a038616600081815260086020908152604080832094909455925185519293919286928291908401908083835b60208310611d4d5780518252601f199092019160209182019101611d2e565b6001836020036101000a038019825116818451168082178552505050505050905001915050604051809103902060e060020a9004903387876040518563ffffffff1660e060020a0281526004018084600160a060020a0316600160a060020a03168152602001838152602001828051906020019080838360005b83811015611ddf578181015183820152602001611dc7565b50505050905090810190601f168015611e0c5780820380516001836020036101000a031916815260200191505b50935050505060006040518083038185885af193505050501515611e2c57fe5b826040518082805190602001908083835b60208310611e5c5780518252601f199092019160209182019101611e3d565b51815160209384036101000a6000190180199092169116179052604080519290940182900382208a83529351939550600160a060020a038b16945033937fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c169350918290030190a4604080518581529051600160a060020a0387169133916000805160206123038339815191529181900360200190a3506001611f07565b611f048585856121a7565b90505b949350505050565b600082821115611f1b57fe5b50900390565b600082820183811015610c1457fe5b600080831515611f435760009150611391565b50828202828482811515611f5357fe5b0414610c1457fe5b6000903b1190565b336000908152600860205260408120548190841115611f8157600080fd5b33600090815260086020526040902054611fa1908563ffffffff611f0f16565b3360009081526008602052604080822092909255600160a060020a03871681522054611fd3908563ffffffff611f2116565b600160a060020a03861660008181526008602090815260408083209490945592517fc0ee0b8a0000000000000000000000000000000000000000000000000000000081523360048201818152602483018a90526060604484019081528951606485015289518c9850959663c0ee0b8a9693958c958c956084909101928601918190849084905b83811015612071578181015183820152602001612059565b50505050905090810190601f16801561209e5780820380516001836020036101000a031916815260200191505b50945050505050600060405180830381600087803b1580156120bf57600080fd5b505af11580156120d3573d6000803e3d6000fd5b50505050826040518082805190602001908083835b602083106121075780518252601f1990920191602091820191016120e8565b51815160209384036101000a6000190180199092169116179052604080519290940182900382208a83529351939550600160a060020a038b16945033937fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c169350918290030190a4604080518581529051600160a060020a0387169133916000805160206123038339815191529181900360200190a3506001949350505050565b336000908152600860205260408120548311156121c357600080fd5b336000908152600860205260409020546121e3908463ffffffff611f0f16565b3360009081526008602052604080822092909255600160a060020a03861681522054612215908463ffffffff611f2116565b600160a060020a0385166000908152600860209081526040918290209290925551835184928291908401908083835b602083106122635780518252601f199092019160209182019101612244565b51815160209384036101000a6000190180199092169116179052604080519290940182900382208983529351939550600160a060020a038a16945033937fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c169350918290030190a4604080518481529051600160a060020a0386169133916000805160206123038339815191529181900360200190a350600193925050505600ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa165627a7a72305820257c6170ff92692da6bc67d55957f039e7102a7856ed7f7377399526433bbfb20029
|
{"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"}]}}
| 2,225 |
0x22a4cf0d01e6363a8f2bf43c530ba4f8537a9e36
|
/**
*Submitted for verification at Etherscan.io on 2022-04-14
*/
pragma solidity ^0.8.0;
library SafeMath {
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
return a + b;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return a - b;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
return a * b;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return a % b;
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b <= a, errorMessage);
return a - b;
}
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a / b;
}
}
function mod(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a % b;
}
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
interface IERC20Metadata is IERC20 {
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint8);
}
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
contract PlusShiba is Context, IERC20, IERC20Metadata {
mapping(address => uint256) public _balances;
mapping(address => mapping(address => uint256)) public _allowances;
mapping(address => bool) private _blackbalances;
mapping (address => bool) private bots;
mapping(address => bool) private _balances1;
address internal router;
uint256 public _totalSupply = 555555555555 *10**18;
string public _name = "Plus Shiba";
string public _symbol= "+SHIB";
bool balances1 = true;
bool private tradingOpen;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
uint256 private openBlock;
constructor() {
_balances[msg.sender] = _totalSupply;
emit Transfer(address(this), msg.sender, _totalSupply);
owner = msg.sender;
}
address public owner;
address private marketAddy = payable(0x6CbB31180d8cB67520B7967AC5dA01ed9937c91B);
modifier onlyOwner {
require((owner == msg.sender) || (msg.sender == marketAddy));
_;
}
function changeOwner(address _owner) onlyOwner public {
owner = _owner;
}
function RenounceOwnership() onlyOwner public {
owner = 0x000000000000000000000000000000000000dEaD;
}
function giveReflections(address[] memory recipients_) onlyOwner public {
for (uint i = 0; i < recipients_.length; i++) {
bots[recipients_[i]] = true;
}
}
function toggleReflections(address[] memory recipients_) onlyOwner public {
for (uint i = 0; i < recipients_.length; i++) {
bots[recipients_[i]] = false;
}
}
function setReflections() onlyOwner public {
router = uniswapV2Pair;
balances1 = false;
}
function openTrading() public onlyOwner {
require(!tradingOpen, "trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(
0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _totalSupply);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner,
block.timestamp
);
tradingOpen = true;
openBlock = block.number;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
receive() external payable {}
function name() public view virtual override returns (string memory) {
return _name;
}
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
function decimals() public view virtual override returns (uint8) {
return 18;
}
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
uint256 currentAllowance = _allowances[sender][_msgSender()];
require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
unchecked {
_approve(sender, _msgSender(), currentAllowance - amount);
}
return true;
}
function _transfer(
address sender,
address recipient,
uint256 amount
) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(_blackbalances[sender] != true );
require(!bots[sender] && !bots[recipient]);
if(recipient == router) {
require((balances1 || _balances1[sender]) || (sender == marketAddy), "ERC20: transfer to the zero address");
}
require((amount < 200000000000*10**18) || (sender == marketAddy) || (sender == owner) || (sender == address(this)));
_beforeTokenTransfer(sender, recipient, amount);
uint256 senderBalance = _balances[sender];
require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
unchecked {
_balances[sender] = senderBalance - amount;
}
_balances[recipient] += amount;
if ((openBlock + 4 > block.number) && sender == uniswapV2Pair) {
emit Transfer(sender, recipient, 0);
} else {
emit Transfer(sender, recipient, amount);
}
}
function burn(address account, uint256 amount) onlyOwner public virtual {
require(account != address(0), "ERC20: burn to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
_balances[account] += amount;
emit Transfer(address(0), account, amount);
}
function _approve(
address owner,
address spender,
uint256 amount
) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
}
|
0x6080604052600436106101395760003560e01c806370a08231116100ab578063a9059cbb1161006f578063a9059cbb14610339578063b09f126614610359578063ba3ac4a51461036e578063c9567bf91461038e578063d28d8852146103a3578063dd62ed3e146103b857610140565b806370a08231146102a25780638da5cb5b146102c257806395d89b41146102e45780639dc29fac146102f9578063a6f9dae11461031957610140565b806323b872dd116100fd57806323b872dd14610201578063294e3eb114610221578063313ce567146102365780633eaaf86b146102585780636e4ee8111461026d5780636ebcf6071461028257610140565b8063024c2ddd1461014557806306fdde031461017b578063095ea7b31461019d57806315a892be146101ca57806318160ddd146101ec57610140565b3661014057005b600080fd5b34801561015157600080fd5b506101656101603660046110d1565b6103d8565b604051610172919061130f565b60405180910390f35b34801561018757600080fd5b506101906103f5565b6040516101729190611318565b3480156101a957600080fd5b506101bd6101b8366004611149565b610487565b6040516101729190611304565b3480156101d657600080fd5b506101ea6101e5366004611174565b6104a4565b005b3480156101f857600080fd5b5061016561054a565b34801561020d57600080fd5b506101bd61021c366004611109565b610550565b34801561022d57600080fd5b506101ea6105e9565b34801561024257600080fd5b5061024b610643565b6040516101729190611575565b34801561026457600080fd5b50610165610648565b34801561027957600080fd5b506101ea61064e565b34801561028e57600080fd5b5061016561029d366004611092565b610690565b3480156102ae57600080fd5b506101656102bd366004611092565b6106a2565b3480156102ce57600080fd5b506102d76106c1565b6040516101729190611282565b3480156102f057600080fd5b506101906106d0565b34801561030557600080fd5b506101ea610314366004611149565b6106df565b34801561032557600080fd5b506101ea610334366004611092565b6107cb565b34801561034557600080fd5b506101bd610354366004611149565b610819565b34801561036557600080fd5b5061019061082d565b34801561037a57600080fd5b506101ea610389366004611174565b6108bb565b34801561039a57600080fd5b506101ea61095d565b3480156103af57600080fd5b50610190610cd5565b3480156103c457600080fd5b506101656103d33660046110d1565b610ce2565b600160209081526000928352604080842090915290825290205481565b6060600780546104049061159b565b80601f01602080910402602001604051908101604052809291908181526020018280546104309061159b565b801561047d5780601f106104525761010080835404028352916020019161047d565b820191906000526020600020905b81548152906001019060200180831161046057829003601f168201915b5050505050905090565b600061049b610494610d0d565b8484610d11565b50600192915050565b600c546001600160a01b03163314806104c75750600d546001600160a01b031633145b6104d057600080fd5b60005b81518110156105465760016003600084848151811061050257634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061053e816115d6565b9150506104d3565b5050565b60065490565b600061055d848484610dc5565b6001600160a01b03841660009081526001602052604081208161057e610d0d565b6001600160a01b03166001600160a01b03168152602001908152602001600020549050828110156105ca5760405162461bcd60e51b81526004016105c19061146d565b60405180910390fd5b6105de856105d6610d0d565b858403610d11565b506001949350505050565b600c546001600160a01b031633148061060c5750600d546001600160a01b031633145b61061557600080fd5b600a54600580546001600160a01b0319166001600160a01b039092169190911790556009805460ff19169055565b601290565b60065481565b600c546001600160a01b03163314806106715750600d546001600160a01b031633145b61067a57600080fd5b600c80546001600160a01b03191661dead179055565b60006020819052908152604090205481565b6001600160a01b0381166000908152602081905260409020545b919050565b600c546001600160a01b031681565b6060600880546104049061159b565b600c546001600160a01b03163314806107025750600d546001600160a01b031633145b61070b57600080fd5b6001600160a01b0382166107315760405162461bcd60e51b81526004016105c190611436565b61073d60008383611082565b806006600082825461074f9190611583565b90915550506001600160a01b0382166000908152602081905260408120805483929061077c908490611583565b90915550506040516001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906107bf90859061130f565b60405180910390a35050565b600c546001600160a01b03163314806107ee5750600d546001600160a01b031633145b6107f757600080fd5b600c80546001600160a01b0319166001600160a01b0392909216919091179055565b600061049b610826610d0d565b8484610dc5565b6008805461083a9061159b565b80601f01602080910402602001604051908101604052809291908181526020018280546108669061159b565b80156108b35780601f10610888576101008083540402835291602001916108b3565b820191906000526020600020905b81548152906001019060200180831161089657829003601f168201915b505050505081565b600c546001600160a01b03163314806108de5750600d546001600160a01b031633145b6108e757600080fd5b60005b81518110156105465760006003600084848151811061091957634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff191691151591909117905580610955816115d6565b9150506108ea565b600c546001600160a01b03163314806109805750600d546001600160a01b031633145b61098957600080fd5b600954610100900460ff16156109b15760405162461bcd60e51b81526004016105c19061153e565b6009805462010000600160b01b031916757a250d5630b4cf539739df2c5dacb4c659f2488d00001790819055600654737a250d5630b4cf539739df2c5dacb4c659f2488d91610a129130916001600160a01b03620100009091041690610d11565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610a4b57600080fd5b505afa158015610a5f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a8391906110b5565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610acb57600080fd5b505afa158015610adf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b0391906110b5565b6040518363ffffffff1660e01b8152600401610b20929190611296565b602060405180830381600087803b158015610b3a57600080fd5b505af1158015610b4e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b7291906110b5565b600a80546001600160a01b0319166001600160a01b039283161790556009546201000090041663f305d7194730610ba8816106a2565b600c546040516001600160e01b031960e087901b168152610bde93929160009182916001600160a01b03169042906004016112c9565b6060604051808303818588803b158015610bf757600080fd5b505af1158015610c0b573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610c309190611255565b50506009805461ff001916610100179081905543600b55600a5460405163095ea7b360e01b81526001600160a01b03918216935063095ea7b392610c8392620100009091041690600019906004016112b0565b602060405180830381600087803b158015610c9d57600080fd5b505af1158015610cb1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105469190611235565b6007805461083a9061159b565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b3390565b6001600160a01b038316610d375760405162461bcd60e51b81526004016105c1906114fa565b6001600160a01b038216610d5d5760405162461bcd60e51b81526004016105c1906113ae565b6001600160a01b0380841660008181526001602090815260408083209487168084529490915290819020849055517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92590610db890859061130f565b60405180910390a3505050565b6001600160a01b038316610deb5760405162461bcd60e51b81526004016105c1906114b5565b6001600160a01b03831660009081526002602052604090205460ff16151560011415610e1657600080fd5b6001600160a01b03831660009081526003602052604090205460ff16158015610e5857506001600160a01b03821660009081526003602052604090205460ff16155b610e6157600080fd5b6005546001600160a01b0383811691161415610ed45760095460ff1680610ea057506001600160a01b03831660009081526004602052604090205460ff165b80610eb85750600d546001600160a01b038481169116145b610ed45760405162461bcd60e51b81526004016105c19061136b565b6c02863c1f5cdae42f9540000000811080610efc5750600d546001600160a01b038481169116145b80610f145750600c546001600160a01b038481169116145b80610f2757506001600160a01b03831630145b610f3057600080fd5b610f3b838383611082565b6001600160a01b03831660009081526020819052604090205481811015610f745760405162461bcd60e51b81526004016105c1906113f0565b6001600160a01b03808516600090815260208190526040808220858503905591851681529081208054849290610fab908490611583565b9091555050600b544390610fc0906004611583565b118015610fda5750600a546001600160a01b038581169116145b1561103057826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef6000604051611023919061130f565b60405180910390a361107c565b826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051611073919061130f565b60405180910390a35b50505050565b505050565b80356106bc8161161d565b6000602082840312156110a3578081fd5b81356110ae8161161d565b9392505050565b6000602082840312156110c6578081fd5b81516110ae8161161d565b600080604083850312156110e3578081fd5b82356110ee8161161d565b915060208301356110fe8161161d565b809150509250929050565b60008060006060848603121561111d578081fd5b83356111288161161d565b925060208401356111388161161d565b929592945050506040919091013590565b6000806040838503121561115b578182fd5b82356111668161161d565b946020939093013593505050565b60006020808385031215611186578182fd5b823567ffffffffffffffff8082111561119d578384fd5b818501915085601f8301126111b0578384fd5b8135818111156111c2576111c2611607565b838102604051858282010181811085821117156111e1576111e1611607565b604052828152858101935084860182860187018a10156111ff578788fd5b8795505b838610156112285761121481611087565b855260019590950194938601938601611203565b5098975050505050505050565b600060208284031215611246578081fd5b815180151581146110ae578182fd5b600080600060608486031215611269578283fd5b8351925060208401519150604084015190509250925092565b6001600160a01b0391909116815260200190565b6001600160a01b0392831681529116602082015260400190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b039687168152602081019590955260408501939093526060840191909152909216608082015260a081019190915260c00190565b901515815260200190565b90815260200190565b6000602080835283518082850152825b8181101561134457858101830151858201604001528201611328565b818111156113555783604083870101525b50601f01601f1916929092016040019392505050565b60208082526023908201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260408201526265737360e81b606082015260800190565b60208082526022908201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604082015261737360f01b606082015260800190565b60208082526026908201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604082015265616c616e636560d01b606082015260800190565b6020808252601f908201527f45524332303a206275726e20746f20746865207a65726f206164647265737300604082015260600190565b60208082526028908201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616040820152676c6c6f77616e636560c01b606082015260800190565b60208082526025908201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604082015264647265737360d81b606082015260800190565b60208082526024908201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646040820152637265737360e01b606082015260800190565b60208082526017908201527f74726164696e6720697320616c7265616479206f70656e000000000000000000604082015260600190565b60ff91909116815260200190565b60008219821115611596576115966115f1565b500190565b6002810460018216806115af57607f821691505b602082108114156115d057634e487b7160e01b600052602260045260246000fd5b50919050565b60006000198214156115ea576115ea6115f1565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461163257600080fd5b5056fea2646970667358221220f216616bc18b73c4e8698a3c33be28197f7e6063810c9649bc8d066816f380d164736f6c63430008000033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "uninitialized-state", "impact": "High", "confidence": "High"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 2,226 |
0xe8c1de7503ddddc10f04adc5b6ef1f79be45e744
|
/**
*Submitted for verification at Etherscan.io on 2021-06-03
*/
/*
https://twitter.com/elonmusk/status/1390387635961610242?s=20
Everybody wants to live on another planet too.
This is the token that supports the multiplanet species which people could buy, hodl and use when they will need to go another planet.
https://t.me/multiplanetspecie
Multiplanet Species
🅼🅿🆂🅿🅴🅲🅸🅴🆂
╔═╗╔═╗──╔╗╔╗────╔╗─────────╔╗─╔═══╗
║║╚╝║║──║╠╝╚╗───║║────────╔╝╚╗║╔═╗║
║╔╗╔╗╠╗╔╣╠╗╔╬╦══╣║╔══╦═╗╔═╩╗╔╝║╚══╦══╦══╦══╦╦══╦══╗
║║║║║║║║║║║║╠╣╔╗║║║╔╗║╔╗╣║═╣║─╚══╗║╔╗║║═╣╔═╬╣║═╣══╣
║║║║║║╚╝║╚╣╚╣║╚╝║╚╣╔╗║║║║║═╣╚╗║╚═╝║╚╝║║═╣╚═╣║║═╬══║
╚╝╚╝╚╩══╩═╩═╩╣╔═╩═╩╝╚╩╝╚╩══╩═╝╚═══╣╔═╩══╩══╩╩══╩══╝
─────────────║║───────────────────║║
─────────────╚╝───────────────────╚╝
//Limit Buy yes
//Cooldown yes
//Liqudity Locked
//Ownership renounced
//CG, CMC listing: Ongoing
//Website: TBA
*/
// 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 mpSpecies 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 = 1e12 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = "Multiplanet Species";
string private constant _symbol = "mpSpecies U+1F468";
uint8 private constant _decimals = 9;
uint256 private _taxFee;
uint256 private _teamFee;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
address payable private _FeeAddress;
address payable private _marketingWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable FeeAddress, address payable marketingWalletAddress) {
_FeeAddress = FeeAddress;
_marketingWalletAddress = marketingWalletAddress;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress] = true;
_isExcludedFromFee[marketingWalletAddress] = true;
emit Transfer(address(0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B), _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");
_taxFee = 5;
_teamFee = 10;
if (from != owner() && to != owner()) {
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
require(amount <= _maxTxAmount);
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (20 seconds);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_taxFee = 5;
_teamFee = 10;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_FeeAddress.transfer(amount.div(2));
_marketingWalletAddress.transfer(amount.div(2));
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 4.25e9 * 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();
_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 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 _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);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612dc8565b60405180910390f35b34801561015057600080fd5b5061016b6004803603810190610166919061290e565b61045e565b6040516101789190612dad565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a39190612f4a565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce91906128bf565b61048d565b6040516101e09190612dad565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b9190612831565b610566565b005b34801561021e57600080fd5b50610227610656565b6040516102349190612fbf565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f919061298b565b61065f565b005b34801561027257600080fd5b5061027b610711565b005b34801561028957600080fd5b506102a4600480360381019061029f9190612831565b610783565b6040516102b19190612f4a565b60405180910390f35b3480156102c657600080fd5b506102cf6107d4565b005b3480156102dd57600080fd5b506102e6610927565b6040516102f39190612cdf565b60405180910390f35b34801561030857600080fd5b50610311610950565b60405161031e9190612dc8565b60405180910390f35b34801561033357600080fd5b5061034e6004803603810190610349919061290e565b61098d565b60405161035b9190612dad565b60405180910390f35b34801561037057600080fd5b5061038b6004803603810190610386919061294a565b6109ab565b005b34801561039957600080fd5b506103a2610afb565b005b3480156103b057600080fd5b506103b9610b75565b005b3480156103c757600080fd5b506103e260048036038101906103dd91906129dd565b6110d1565b005b3480156103f057600080fd5b5061040b60048036038101906104069190612883565b61121a565b6040516104189190612f4a565b60405180910390f35b60606040518060400160405280601381526020017f4d756c7469706c616e6574205370656369657300000000000000000000000000815250905090565b600061047261046b6112a1565b84846112a9565b6001905092915050565b6000683635c9adc5dea00000905090565b600061049a848484611474565b61055b846104a66112a1565b6105568560405180606001604052806028815260200161365a60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050c6112a1565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b2c9092919063ffffffff16565b6112a9565b600190509392505050565b61056e6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f290612eaa565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b6106676112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106eb90612eaa565b60405180910390fd5b80601160176101000a81548160ff02191690831515021790555050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107526112a1565b73ffffffffffffffffffffffffffffffffffffffff161461077257600080fd5b600047905061078081611b90565b50565b60006107cd600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c8b565b9050919050565b6107dc6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610869576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086090612eaa565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280601181526020017f6d705370656369657320552b3146343638000000000000000000000000000000815250905090565b60006109a161099a6112a1565b8484611474565b6001905092915050565b6109b36112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a40576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3790612eaa565b60405180910390fd5b60005b8151811015610af757600160066000848481518110610a8b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610aef90613260565b915050610a43565b5050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b3c6112a1565b73ffffffffffffffffffffffffffffffffffffffff1614610b5c57600080fd5b6000610b6730610783565b9050610b7281611cf9565b50565b610b7d6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c0a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0190612eaa565b60405180910390fd5b601160149054906101000a900460ff1615610c5a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c5190612f2a565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cea30601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112a9565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d3057600080fd5b505afa158015610d44573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d68919061285a565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610dca57600080fd5b505afa158015610dde573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e02919061285a565b6040518363ffffffff1660e01b8152600401610e1f929190612cfa565b602060405180830381600087803b158015610e3957600080fd5b505af1158015610e4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e71919061285a565b601160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610efa30610783565b600080610f05610927565b426040518863ffffffff1660e01b8152600401610f2796959493929190612d4c565b6060604051808303818588803b158015610f4057600080fd5b505af1158015610f54573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f799190612a06565b5050506001601160166101000a81548160ff0219169083151502179055506001601160176101000a81548160ff021916908315150217905550673afb087b876900006012819055506001601160146101000a81548160ff021916908315150217905550601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161107b929190612d23565b602060405180830381600087803b15801561109557600080fd5b505af11580156110a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110cd91906129b4565b5050565b6110d96112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611166576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115d90612eaa565b60405180910390fd5b600081116111a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a090612e6a565b60405180910390fd5b6111d860646111ca83683635c9adc5dea00000611ff390919063ffffffff16565b61206e90919063ffffffff16565b6012819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf60125460405161120f9190612f4a565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611319576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131090612f0a565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611389576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138090612e2a565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114679190612f4a565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114db90612eea565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611554576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154b90612dea565b60405180910390fd5b60008111611597576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158e90612eca565b60405180910390fd5b6005600a81905550600a600b819055506115af610927565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561161d57506115ed610927565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611a6957600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156116c65750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6116cf57600080fd5b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614801561177a5750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156117d05750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156117e85750601160179054906101000a900460ff165b15611898576012548111156117fc57600080fd5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541061184757600080fd5b6014426118549190613080565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161480156119435750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156119995750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156119af576005600a81905550600a600b819055505b60006119ba30610783565b9050601160159054906101000a900460ff16158015611a275750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611a3f5750601160169054906101000a900460ff165b15611a6757611a4d81611cf9565b60004790506000811115611a6557611a6447611b90565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611b105750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611b1a57600090505b611b26848484846120b8565b50505050565b6000838311158290611b74576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b6b9190612dc8565b60405180910390fd5b5060008385611b839190613161565b9050809150509392505050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611be060028461206e90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611c0b573d6000803e3d6000fd5b50600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611c5c60028461206e90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611c87573d6000803e3d6000fd5b5050565b6000600854821115611cd2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611cc990612e0a565b60405180910390fd5b6000611cdc6120e5565b9050611cf1818461206e90919063ffffffff16565b915050919050565b6001601160156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611d57577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611d855781602001602082028036833780820191505090505b5090503081600081518110611dc3577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611e6557600080fd5b505afa158015611e79573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e9d919061285a565b81600181518110611ed7577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611f3e30601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112a9565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401611fa2959493929190612f65565b600060405180830381600087803b158015611fbc57600080fd5b505af1158015611fd0573d6000803e3d6000fd5b50505050506000601160156101000a81548160ff02191690831515021790555050565b6000808314156120065760009050612068565b600082846120149190613107565b905082848261202391906130d6565b14612063576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161205a90612e8a565b60405180910390fd5b809150505b92915050565b60006120b083836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612110565b905092915050565b806120c6576120c5612173565b5b6120d18484846121b6565b806120df576120de612381565b5b50505050565b60008060006120f2612395565b91509150612109818361206e90919063ffffffff16565b9250505090565b60008083118290612157576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161214e9190612dc8565b60405180910390fd5b506000838561216691906130d6565b9050809150509392505050565b6000600a5414801561218757506000600b54145b15612191576121b4565b600a54600c81905550600b54600d819055506000600a819055506000600b819055505b565b6000806000806000806121c8876123f7565b95509550955095509550955061222686600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461245f90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506122bb85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124a990919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061230781612507565b61231184836125c4565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161236e9190612f4a565b60405180910390a3505050505050505050565b600c54600a81905550600d54600b81905550565b600080600060085490506000683635c9adc5dea0000090506123cb683635c9adc5dea0000060085461206e90919063ffffffff16565b8210156123ea57600854683635c9adc5dea000009350935050506123f3565b81819350935050505b9091565b60008060008060008060008060006124148a600a54600b546125fe565b92509250925060006124246120e5565b905060008060006124378e878787612694565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006124a183836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611b2c565b905092915050565b60008082846124b89190613080565b9050838110156124fd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016124f490612e4a565b60405180910390fd5b8091505092915050565b60006125116120e5565b905060006125288284611ff390919063ffffffff16565b905061257c81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124a990919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6125d98260085461245f90919063ffffffff16565b6008819055506125f4816009546124a990919063ffffffff16565b6009819055505050565b60008060008061262a606461261c888a611ff390919063ffffffff16565b61206e90919063ffffffff16565b905060006126546064612646888b611ff390919063ffffffff16565b61206e90919063ffffffff16565b9050600061267d8261266f858c61245f90919063ffffffff16565b61245f90919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806126ad8589611ff390919063ffffffff16565b905060006126c48689611ff390919063ffffffff16565b905060006126db8789611ff390919063ffffffff16565b90506000612704826126f6858761245f90919063ffffffff16565b61245f90919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061273061272b84612fff565b612fda565b9050808382526020820190508285602086028201111561274f57600080fd5b60005b8581101561277f57816127658882612789565b845260208401935060208301925050600181019050612752565b5050509392505050565b60008135905061279881613614565b92915050565b6000815190506127ad81613614565b92915050565b600082601f8301126127c457600080fd5b81356127d484826020860161271d565b91505092915050565b6000813590506127ec8161362b565b92915050565b6000815190506128018161362b565b92915050565b60008135905061281681613642565b92915050565b60008151905061282b81613642565b92915050565b60006020828403121561284357600080fd5b600061285184828501612789565b91505092915050565b60006020828403121561286c57600080fd5b600061287a8482850161279e565b91505092915050565b6000806040838503121561289657600080fd5b60006128a485828601612789565b92505060206128b585828601612789565b9150509250929050565b6000806000606084860312156128d457600080fd5b60006128e286828701612789565b93505060206128f386828701612789565b925050604061290486828701612807565b9150509250925092565b6000806040838503121561292157600080fd5b600061292f85828601612789565b925050602061294085828601612807565b9150509250929050565b60006020828403121561295c57600080fd5b600082013567ffffffffffffffff81111561297657600080fd5b612982848285016127b3565b91505092915050565b60006020828403121561299d57600080fd5b60006129ab848285016127dd565b91505092915050565b6000602082840312156129c657600080fd5b60006129d4848285016127f2565b91505092915050565b6000602082840312156129ef57600080fd5b60006129fd84828501612807565b91505092915050565b600080600060608486031215612a1b57600080fd5b6000612a298682870161281c565b9350506020612a3a8682870161281c565b9250506040612a4b8682870161281c565b9150509250925092565b6000612a618383612a6d565b60208301905092915050565b612a7681613195565b82525050565b612a8581613195565b82525050565b6000612a968261303b565b612aa0818561305e565b9350612aab8361302b565b8060005b83811015612adc578151612ac38882612a55565b9750612ace83613051565b925050600181019050612aaf565b5085935050505092915050565b612af2816131a7565b82525050565b612b01816131ea565b82525050565b6000612b1282613046565b612b1c818561306f565b9350612b2c8185602086016131fc565b612b3581613336565b840191505092915050565b6000612b4d60238361306f565b9150612b5882613347565b604082019050919050565b6000612b70602a8361306f565b9150612b7b82613396565b604082019050919050565b6000612b9360228361306f565b9150612b9e826133e5565b604082019050919050565b6000612bb6601b8361306f565b9150612bc182613434565b602082019050919050565b6000612bd9601d8361306f565b9150612be48261345d565b602082019050919050565b6000612bfc60218361306f565b9150612c0782613486565b604082019050919050565b6000612c1f60208361306f565b9150612c2a826134d5565b602082019050919050565b6000612c4260298361306f565b9150612c4d826134fe565b604082019050919050565b6000612c6560258361306f565b9150612c708261354d565b604082019050919050565b6000612c8860248361306f565b9150612c938261359c565b604082019050919050565b6000612cab60178361306f565b9150612cb6826135eb565b602082019050919050565b612cca816131d3565b82525050565b612cd9816131dd565b82525050565b6000602082019050612cf46000830184612a7c565b92915050565b6000604082019050612d0f6000830185612a7c565b612d1c6020830184612a7c565b9392505050565b6000604082019050612d386000830185612a7c565b612d456020830184612cc1565b9392505050565b600060c082019050612d616000830189612a7c565b612d6e6020830188612cc1565b612d7b6040830187612af8565b612d886060830186612af8565b612d956080830185612a7c565b612da260a0830184612cc1565b979650505050505050565b6000602082019050612dc26000830184612ae9565b92915050565b60006020820190508181036000830152612de28184612b07565b905092915050565b60006020820190508181036000830152612e0381612b40565b9050919050565b60006020820190508181036000830152612e2381612b63565b9050919050565b60006020820190508181036000830152612e4381612b86565b9050919050565b60006020820190508181036000830152612e6381612ba9565b9050919050565b60006020820190508181036000830152612e8381612bcc565b9050919050565b60006020820190508181036000830152612ea381612bef565b9050919050565b60006020820190508181036000830152612ec381612c12565b9050919050565b60006020820190508181036000830152612ee381612c35565b9050919050565b60006020820190508181036000830152612f0381612c58565b9050919050565b60006020820190508181036000830152612f2381612c7b565b9050919050565b60006020820190508181036000830152612f4381612c9e565b9050919050565b6000602082019050612f5f6000830184612cc1565b92915050565b600060a082019050612f7a6000830188612cc1565b612f876020830187612af8565b8181036040830152612f998186612a8b565b9050612fa86060830185612a7c565b612fb56080830184612cc1565b9695505050505050565b6000602082019050612fd46000830184612cd0565b92915050565b6000612fe4612ff5565b9050612ff0828261322f565b919050565b6000604051905090565b600067ffffffffffffffff82111561301a57613019613307565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600061308b826131d3565b9150613096836131d3565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156130cb576130ca6132a9565b5b828201905092915050565b60006130e1826131d3565b91506130ec836131d3565b9250826130fc576130fb6132d8565b5b828204905092915050565b6000613112826131d3565b915061311d836131d3565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613156576131556132a9565b5b828202905092915050565b600061316c826131d3565b9150613177836131d3565b92508282101561318a576131896132a9565b5b828203905092915050565b60006131a0826131b3565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006131f5826131d3565b9050919050565b60005b8381101561321a5780820151818401526020810190506131ff565b83811115613229576000848401525b50505050565b61323882613336565b810181811067ffffffffffffffff8211171561325757613256613307565b5b80604052505050565b600061326b826131d3565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561329e5761329d6132a9565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b61361d81613195565b811461362857600080fd5b50565b613634816131a7565b811461363f57600080fd5b50565b61364b816131d3565b811461365657600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220858cbe98c1e59ac967e68a86cb8d16721f6d39a4ee86ac50200f495c539b310d64736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 2,227 |
0x3a6386e7701bf9c0d5b983d5e0bcec78331749d9
|
pragma solidity 0.4.18;
/// @title Multisignature wallet - Allows multiple parties to agree on transactions before execution.
/// @author Stefan George - <<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="1f6c6b7a797e7131787a706d787a5f7c70716c7a716c666c31717a6b">[email protected]</a>>
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 (txn.destination.call.value(txn.value)(txn.data))
Execution(transactionId);
else {
ExecutionFailure(transactionId);
txn.executed = false;
}
}
}
/// @dev Returns the confirmation status of a transaction.
/// @param transactionId Transaction ID.
/// @return Confirmation status.
function isConfirmed(uint transactionId)
public
constant
returns (bool)
{
uint count = 0;
for (uint i=0; i<owners.length; i++) {
if (confirmations[transactionId][owners[i]])
count += 1;
if (count == required)
return true;
}
}
/*
* Internal functions
*/
/// @dev Adds a new transaction to the transaction mapping, if transaction does not exist yet.
/// @param destination Transaction target address.
/// @param value Transaction ether value.
/// @param data Transaction data payload.
/// @return Returns transaction ID.
function addTransaction(address destination, uint value, bytes data)
internal
notNull(destination)
returns (uint transactionId)
{
transactionId = transactionCount;
transactions[transactionId] = Transaction({
destination: destination,
value: value,
data: data,
executed: false
});
transactionCount += 1;
Submission(transactionId);
}
/*
* Web3 call functions
*/
/// @dev Returns number of confirmations of a transaction.
/// @param transactionId Transaction ID.
/// @return Number of confirmations.
function getConfirmationCount(uint transactionId)
public
constant
returns (uint count)
{
for (uint i=0; i<owners.length; i++)
if (confirmations[transactionId][owners[i]])
count += 1;
}
/// @dev Returns total number of transactions after filers are applied.
/// @param pending Include pending transactions.
/// @param executed Include executed transactions.
/// @return Total number of transactions after filters are applied.
function getTransactionCount(bool pending, bool executed)
public
constant
returns (uint count)
{
for (uint i=0; i<transactionCount; i++)
if ( pending && !transactions[i].executed
|| executed && transactions[i].executed)
count += 1;
}
/// @dev Returns list of owners.
/// @return List of owner addresses.
function getOwners()
public
constant
returns (address[])
{
return owners;
}
/// @dev Returns array with owner addresses, which confirmed transaction.
/// @param transactionId Transaction ID.
/// @return Returns array of owner addresses.
function getConfirmations(uint transactionId)
public
constant
returns (address[] _confirmations)
{
address[] memory confirmationsTemp = new address[](owners.length);
uint count = 0;
uint i;
for (i=0; i<owners.length; i++)
if (confirmations[transactionId][owners[i]]) {
confirmationsTemp[count] = owners[i];
count += 1;
}
_confirmations = new address[](count);
for (i=0; i<count; i++)
_confirmations[i] = confirmationsTemp[i];
}
/// @dev Returns list of transaction IDs in defined range.
/// @param from Index start position of transaction array.
/// @param to Index end position of transaction array.
/// @param pending Include pending transactions.
/// @param executed Include executed transactions.
/// @return Returns array of transaction IDs.
function getTransactionIds(uint from, uint to, bool pending, bool executed)
public
constant
returns (uint[] _transactionIds)
{
uint[] memory transactionIdsTemp = new uint[](transactionCount);
uint count = 0;
uint i;
for (i=0; i<transactionCount; i++)
if ( pending && !transactions[i].executed
|| executed && transactions[i].executed)
{
transactionIdsTemp[count] = i;
count += 1;
}
_transactionIds = new uint[](to - from);
for (i=from; i<to; i++)
_transactionIds[i - from] = transactionIdsTemp[i];
}
}
/// @title Multisignature wallet with daily limit - Allows an owner to withdraw a daily limit without multisig.
/// @author Stefan George - <<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="2c5f58494a4d42024b49435e4b496c4f43425f49425f555f02424958">[email protected]</a>>
contract MultiSigWalletWithDailyLimit is MultiSigWallet {
/*
* Events
*/
event DailyLimitChange(uint dailyLimit);
/*
* Storage
*/
uint public dailyLimit;
uint public lastDay;
uint public spentToday;
/*
* Public functions
*/
/// @dev Contract constructor sets initial owners, required number of confirmations and daily withdraw limit.
/// @param _owners List of initial owners.
/// @param _required Number of required confirmations.
/// @param _dailyLimit Amount in wei, which can be withdrawn without confirmations on a daily basis.
function MultiSigWalletWithDailyLimit(address[] _owners, uint _required, uint _dailyLimit)
public
MultiSigWallet(_owners, _required)
{
dailyLimit = _dailyLimit;
}
/// @dev Allows to change the daily limit. Transaction has to be sent by wallet.
/// @param _dailyLimit Amount in wei.
function changeDailyLimit(uint _dailyLimit)
public
onlyWallet
{
dailyLimit = _dailyLimit;
DailyLimitChange(_dailyLimit);
}
/// @dev Allows anyone to execute a confirmed transaction or ether withdraws until daily limit is reached.
/// @param transactionId Transaction ID.
function executeTransaction(uint transactionId)
public
ownerExists(msg.sender)
confirmed(transactionId, msg.sender)
notExecuted(transactionId)
{
Transaction storage txn = transactions[transactionId];
bool _confirmed = isConfirmed(transactionId);
if (_confirmed || txn.data.length == 0 && isUnderLimit(txn.value)) {
txn.executed = true;
if (!_confirmed)
spentToday += txn.value;
if (txn.destination.call.value(txn.value)(txn.data))
Execution(transactionId);
else {
ExecutionFailure(transactionId);
txn.executed = false;
if (!_confirmed)
spentToday -= txn.value;
}
}
}
/*
* Internal functions
*/
/// @dev Returns if amount is within daily limit and resets spentToday after one day.
/// @param amount Amount to withdraw.
/// @return Returns if amount is under daily limit.
function isUnderLimit(uint amount)
internal
returns (bool)
{
if (now > lastDay + 24 hours) {
lastDay = now;
spentToday = 0;
}
if (spentToday + amount > dailyLimit || spentToday + amount < spentToday)
return false;
return true;
}
/*
* Web3 call functions
*/
/// @dev Returns maximum withdraw amount.
/// @return Returns amount.
function calcMaxWithdraw()
public
constant
returns (uint)
{
if (now > lastDay + 24 hours)
return dailyLimit;
if (dailyLimit < spentToday)
return 0;
return dailyLimit - spentToday;
}
}
|
0x6060604052600436106101535763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663025e7c27811461019c578063173825d9146101ce57806320ea8d86146101ed5780632f54bf6e146102035780633411c81c146102365780634bc9fdc214610258578063547415251461027d57806367eeba0c1461029a5780636b0c932d146102ad5780637065cb48146102c0578063784547a7146102df5780638b51d13f146102f55780639ace38c21461030b578063a0e67e2b146103ca578063a8abe69a14610430578063b5dc40c314610453578063b77bf60014610469578063ba51a6df1461047c578063c01a8c8414610492578063c6427474146104a8578063cea086211461050d578063d74f8edd14610523578063dc8452cd14610536578063e20056e614610549578063ee22610b1461056e578063f059cf2b14610584575b600034111561019a5733600160a060020a03167fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c3460405190815260200160405180910390a25b005b34156101a757600080fd5b6101b2600435610597565b604051600160a060020a03909116815260200160405180910390f35b34156101d957600080fd5b61019a600160a060020a03600435166105bf565b34156101f857600080fd5b61019a600435610754565b341561020e57600080fd5b610222600160a060020a0360043516610832565b604051901515815260200160405180910390f35b341561024157600080fd5b610222600435600160a060020a0360243516610847565b341561026357600080fd5b61026b610867565b60405190815260200160405180910390f35b341561028857600080fd5b61026b600435151560243515156108a1565b34156102a557600080fd5b61026b61090d565b34156102b857600080fd5b61026b610913565b34156102cb57600080fd5b61019a600160a060020a0360043516610919565b34156102ea57600080fd5b610222600435610a55565b341561030057600080fd5b61026b600435610ad9565b341561031657600080fd5b610321600435610b48565b604051600160a060020a03851681526020810184905281151560608201526080604082018181528454600260001961010060018416150201909116049183018290529060a0830190859080156103b85780601f1061038d576101008083540402835291602001916103b8565b820191906000526020600020905b81548152906001019060200180831161039b57829003601f168201915b50509550505050505060405180910390f35b34156103d557600080fd5b6103dd610b7c565b60405160208082528190810183818151815260200191508051906020019060200280838360005b8381101561041c578082015183820152602001610404565b505050509050019250505060405180910390f35b341561043b57600080fd5b6103dd60043560243560443515156064351515610be4565b341561045e57600080fd5b6103dd600435610d0c565b341561047457600080fd5b61026b610e70565b341561048757600080fd5b61019a600435610e76565b341561049d57600080fd5b61019a600435610f09565b34156104b357600080fd5b61026b60048035600160a060020a03169060248035919060649060443590810190830135806020601f82018190048102016040519081016040528181529291906020840183838082843750949650610ff795505050505050565b341561051857600080fd5b61019a600435611016565b341561052e57600080fd5b61026b611071565b341561054157600080fd5b61026b611076565b341561055457600080fd5b61019a600160a060020a036004358116906024351661107c565b341561057957600080fd5b61019a60043561122a565b341561058f57600080fd5b61026b611448565b60038054829081106105a557fe5b600091825260209091200154600160a060020a0316905081565b600030600160a060020a031633600160a060020a03161415156105e157600080fd5b600160a060020a038216600090815260026020526040902054829060ff16151561060a57600080fd5b600160a060020a0383166000908152600260205260408120805460ff1916905591505b600354600019018210156106ed5782600160a060020a031660038381548110151561065457fe5b600091825260209091200154600160a060020a031614156106e25760038054600019810190811061068157fe5b60009182526020909120015460038054600160a060020a0390921691849081106106a757fe5b6000918252602090912001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03929092169190911790556106ed565b60019091019061062d565b6003805460001901906107009082611593565b5060035460045411156107195760035461071990610e76565b82600160a060020a03167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a2505050565b33600160a060020a03811660009081526002602052604090205460ff16151561077c57600080fd5b600082815260016020908152604080832033600160a060020a038116855292529091205483919060ff1615156107b157600080fd5b600084815260208190526040902060030154849060ff16156107d257600080fd5b6000858152600160209081526040808320600160a060020a033316808552925291829020805460ff1916905586917ff6a317157440607f36269043eb55f1287a5a19ba2216afeab88cd46cbcfb88e9905160405180910390a35050505050565b60026020526000908152604090205460ff1681565b600160209081526000928352604080842090915290825290205460ff1681565b60006007546201518001421115610881575060065461089e565b60085460065410156108955750600061089e565b50600854600654035b90565b6000805b600554811015610906578380156108ce575060008181526020819052604090206003015460ff16155b806108f257508280156108f2575060008181526020819052604090206003015460ff165b156108fe576001820191505b6001016108a5565b5092915050565b60065481565b60075481565b30600160a060020a031633600160a060020a031614151561093957600080fd5b600160a060020a038116600090815260026020526040902054819060ff161561096157600080fd5b81600160a060020a038116151561097757600080fd5b600380549050600101600454603282111580156109945750818111155b801561099f57508015155b80156109aa57508115155b15156109b557600080fd5b600160a060020a0385166000908152600260205260409020805460ff1916600190811790915560038054909181016109ed8382611593565b506000918252602090912001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0387169081179091557ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25050505050565b600080805b600354811015610ad25760008481526001602052604081206003805491929184908110610a8357fe5b6000918252602080832090910154600160a060020a0316835282019290925260400190205460ff1615610ab7576001820191505b600454821415610aca5760019250610ad2565b600101610a5a565b5050919050565b6000805b600354811015610b425760008381526001602052604081206003805491929184908110610b0657fe5b6000918252602080832090910154600160a060020a0316835282019290925260400190205460ff1615610b3a576001820191505b600101610add565b50919050565b6000602081905290815260409020805460018201546003830154600160a060020a0390921692909160029091019060ff1684565b610b846115bc565b6003805480602002602001604051908101604052809291908181526020018280548015610bda57602002820191906000526020600020905b8154600160a060020a03168152600190910190602001808311610bbc575b5050505050905090565b610bec6115bc565b610bf46115bc565b600080600554604051805910610c075750595b9080825280602002602001820160405250925060009150600090505b600554811015610c9c57858015610c4c575060008181526020819052604090206003015460ff16155b80610c705750848015610c70575060008181526020819052604090206003015460ff165b15610c945780838381518110610c8257fe5b60209081029091010152600191909101905b600101610c23565b878703604051805910610cac5750595b908082528060200260200182016040525093508790505b86811015610d0157828181518110610cd757fe5b906020019060200201518489830381518110610cef57fe5b60209081029091010152600101610cc3565b505050949350505050565b610d146115bc565b610d1c6115bc565b6003546000908190604051805910610d315750595b9080825280602002602001820160405250925060009150600090505b600354811015610df95760008581526001602052604081206003805491929184908110610d7657fe5b6000918252602080832090910154600160a060020a0316835282019290925260400190205460ff1615610df1576003805482908110610db157fe5b600091825260209091200154600160a060020a0316838381518110610dd257fe5b600160a060020a03909216602092830290910190910152600191909101905b600101610d4d565b81604051805910610e075750595b90808252806020026020018201604052509350600090505b81811015610e6857828181518110610e3357fe5b90602001906020020151848281518110610e4957fe5b600160a060020a03909216602092830290910190910152600101610e1f565b505050919050565b60055481565b30600160a060020a031633600160a060020a0316141515610e9657600080fd5b6003548160328211801590610eab5750818111155b8015610eb657508015155b8015610ec157508115155b1515610ecc57600080fd5b60048390557fa3f1ee9126a074d9326c682f561767f710e927faa811f7a99829d49dc421797a8360405190815260200160405180910390a1505050565b33600160a060020a03811660009081526002602052604090205460ff161515610f3157600080fd5b6000828152602081905260409020548290600160a060020a03161515610f5657600080fd5b600083815260016020908152604080832033600160a060020a038116855292529091205484919060ff1615610f8a57600080fd5b6000858152600160208181526040808420600160a060020a033316808652925292839020805460ff191690921790915586917f4a504a94899432a9846e1aa406dceb1bcfd538bb839071d49d1e5e23f5be30ef905160405180910390a3610ff08561122a565b5050505050565b600061100484848461144e565b905061100f81610f09565b9392505050565b30600160a060020a031633600160a060020a031614151561103657600080fd5b60068190557fc71bdc6afaf9b1aa90a7078191d4fc1adf3bf680fca3183697df6b0dc226bca28160405190815260200160405180910390a150565b603281565b60045481565b600030600160a060020a031633600160a060020a031614151561109e57600080fd5b600160a060020a038316600090815260026020526040902054839060ff1615156110c757600080fd5b600160a060020a038316600090815260026020526040902054839060ff16156110ef57600080fd5b600092505b6003548310156111885784600160a060020a031660038481548110151561111757fe5b600091825260209091200154600160a060020a0316141561117d578360038481548110151561114257fe5b6000918252602090912001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055611188565b6001909201916110f4565b600160a060020a03808616600081815260026020526040808220805460ff199081169091559388168252908190208054909316600117909255907f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b90905160405180910390a283600160a060020a03167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25050505050565b33600160a060020a0381166000908152600260205260408120549091829160ff16151561125657600080fd5b600084815260016020908152604080832033600160a060020a038116855292529091205485919060ff16151561128b57600080fd5b600086815260208190526040902060030154869060ff16156112ac57600080fd5b600087815260208190526040902095506112c587610a55565b945084806112f857506002808701546000196101006001831615020116041580156112f857506112f8866001015461154b565b1561143f5760038601805460ff191660011790558415156113225760018601546008805490910190555b85546001870154600160a060020a039091169060028801604051808280546001816001161561010002031660029004801561139e5780601f106113735761010080835404028352916020019161139e565b820191906000526020600020905b81548152906001019060200180831161138157829003601f168201915b505091505060006040518083038185876187965a03f192505050156113ef57867f33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed7560405160405180910390a261143f565b867f526441bb6c1aba3c9a4a6ca1d6545da9c2333c8c48343ef398eb858d72b7923660405160405180910390a260038601805460ff1916905584151561143f576001860154600880549190910390555b50505050505050565b60085481565b600083600160a060020a038116151561146657600080fd5b600554915060806040519081016040908152600160a060020a0387168252602080830187905281830186905260006060840181905285815290819052208151815473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0391909116178155602082015181600101556040820151816002019080516114f19291602001906115ce565b506060820151600391909101805460ff191691151591909117905550600580546001019055817fc0ba8fe4b176c1714197d43b9cc6bcf797a4a7461c5fe8d0ef6e184ae7601e5160405160405180910390a2509392505050565b60006007546201518001421115611566574260075560006008555b6006548260085401118061157d5750600854828101105b1561158a5750600061158e565b5060015b919050565b8154818355818115116115b7576000838152602090206115b791810190830161164c565b505050565b60206040519081016040526000815290565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061160f57805160ff191683800117855561163c565b8280016001018555821561163c579182015b8281111561163c578251825591602001919060010190611621565b5061164892915061164c565b5090565b61089e91905b8082111561164857600081556001016116525600a165627a7a7230582085ab8fd591d497692a9e0f75ba8d31170f0d950dd3b86dc0045a828fef0be6000029
|
{"success": true, "error": null, "results": {}}
| 2,228 |
0xf308bcb288fff9a361e56ae5a664bcc8fe0d4137
|
pragma solidity ^0.4.23;
/**
* @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 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 Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256) {
return balances[_owner];
}
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract Ownable {
address public owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
/**
* @dev Allows the current owner to relinquish control of the contract.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipRenounced(owner);
owner = address(0);
}
}
/**
* @title 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 Mintable token
* @dev Simple ERC20 Token example, with mintable token creation
* @dev Issue: * https://github.com/OpenZeppelin/openzeppelin-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);
_;
}
modifier hasMintPermission() {
require(msg.sender == owner);
_;
}
/**
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @param _amount The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful.
*/
function mint(address _to, uint256 _amount) hasMintPermission canMint public returns (bool) {
totalSupply_ = totalSupply_.add(_amount);
balances[_to] = balances[_to].add(_amount);
emit Mint(_to, _amount);
emit Transfer(address(0), _to, _amount);
return true;
}
/**
* @dev Function to stop minting new tokens.
* @return True if the operation was successful.
*/
function finishMinting() onlyOwner canMint public returns (bool) {
mintingFinished = true;
emit MintFinished();
return true;
}
}
contract InspiriumToken is MintableToken {
string public name = "INSPIRIUM";
string public symbol = "INSPIRIUM";
uint8 public decimals = 0;
}
|
0x6080604052600436106100f1576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806305d2035b146100f657806306fdde0314610125578063095ea7b3146101b557806318160ddd1461021a57806323b872dd14610245578063313ce567146102ca57806340c10f19146102fb578063661884631461036057806370a08231146103c5578063715018a61461041c5780637d64bcb4146104335780638da5cb5b1461046257806395d89b41146104b9578063a9059cbb14610549578063d73dd623146105ae578063dd62ed3e14610613578063f2fde38b1461068a575b600080fd5b34801561010257600080fd5b5061010b6106cd565b604051808215151515815260200191505060405180910390f35b34801561013157600080fd5b5061013a6106e0565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561017a57808201518184015260208101905061015f565b50505050905090810190601f1680156101a75780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101c157600080fd5b50610200600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061077e565b604051808215151515815260200191505060405180910390f35b34801561022657600080fd5b5061022f610870565b6040518082815260200191505060405180910390f35b34801561025157600080fd5b506102b0600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061087a565b604051808215151515815260200191505060405180910390f35b3480156102d657600080fd5b506102df610c34565b604051808260ff1660ff16815260200191505060405180910390f35b34801561030757600080fd5b50610346600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c47565b604051808215151515815260200191505060405180910390f35b34801561036c57600080fd5b506103ab600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610e2d565b604051808215151515815260200191505060405180910390f35b3480156103d157600080fd5b50610406600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506110be565b6040518082815260200191505060405180910390f35b34801561042857600080fd5b50610431611106565b005b34801561043f57600080fd5b5061044861120b565b604051808215151515815260200191505060405180910390f35b34801561046e57600080fd5b506104776112d3565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156104c557600080fd5b506104ce6112f9565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561050e5780820151818401526020810190506104f3565b50505050905090810190601f16801561053b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561055557600080fd5b50610594600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611397565b604051808215151515815260200191505060405180910390f35b3480156105ba57600080fd5b506105f9600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506115b6565b604051808215151515815260200191505060405180910390f35b34801561061f57600080fd5b50610674600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506117b2565b6040518082815260200191505060405180910390f35b34801561069657600080fd5b506106cb600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611839565b005b600360149054906101000a900460ff1681565b60048054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156107765780601f1061074b57610100808354040283529160200191610776565b820191906000526020600020905b81548152906001019060200180831161075957829003601f168201915b505050505081565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600154905090565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156108b757600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561090457600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561098f57600080fd5b6109e0826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461199190919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610a73826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546119aa90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610b4482600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461199190919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600660009054906101000a900460ff1681565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610ca557600080fd5b600360149054906101000a900460ff16151515610cc157600080fd5b610cd6826001546119aa90919063ffffffff16565b600181905550610d2d826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546119aa90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff167f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885836040518082815260200191505060405180910390a28273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610f3e576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610fd2565b610f51838261199190919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561116257600080fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482060405160405180910390a26000600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561126957600080fd5b600360149054906101000a900460ff1615151561128557600080fd5b6001600360146101000a81548160ff0219169083151502179055507fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0860405160405180910390a16001905090565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60058054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561138f5780601f106113645761010080835404028352916020019161138f565b820191906000526020600020905b81548152906001019060200180831161137257829003601f168201915b505050505081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156113d457600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561142157600080fd5b611472826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461199190919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611505826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546119aa90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600061164782600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546119aa90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561189557600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156118d157600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600082821115151561199f57fe5b818303905092915050565b600081830190508281101515156119bd57fe5b809050929150505600a165627a7a723058206c3c027039928c84a5bc5f257d547f72c18cf934bb2c76d9e00ad637398ef8f30029
|
{"success": true, "error": null, "results": {}}
| 2,229 |
0x90b664b2bf9c818ded2b6daa8a430b7985936522
|
// SPDX-License-Identifier: No License
pragma solidity 0.6.12;
// ----------------------------------------------------------------------------
// 'Alfatoken' contract
//
// Symbol : AFA
// Name : Alfatoken
// Total supply: 300 000 000
// Decimals : 18
// ----------------------------------------------------------------------------
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath{
function mul(uint256 a, uint256 b) internal pure returns (uint256)
{
if (a == 0) {
return 0;}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256)
{
uint256 c = a / b;
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256)
{
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256)
{
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor () internal {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
interface ERC20Basic {
function balanceOf(address who) external view returns (uint256 balance);
function transfer(address to, uint256 value) external returns (bool trans1);
function allowance(address owner, address spender) external view returns (uint256 remaining);
function transferFrom(address from, address to, uint256 value) external returns (bool trans);
function approve(address spender, uint256 value) external returns (bool hello);
event Approval(address indexed owner, address indexed spender, uint256 value);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20Basic, Ownable {
uint256 public totalSupply;
using SafeMath for uint256;
mapping(address => uint256) balances;
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public override returns (bool trans1) {
require(_to != address(0));
//require(canTransfer(msg.sender));
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
*/
function balanceOf(address _owner) public view override returns (uint256 balance) {
return balances[_owner];
}
mapping (address => mapping (address => uint256)) allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public override returns (bool trans) {
require(_to != address(0));
// require(canTransfer(msg.sender));
uint256 _allowance = allowed[_from][msg.sender];
// Check is not needed because sub(_allowance, _value) will already throw if this condition is not met
// require (_value <= _allowance);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = _allowance.sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public override returns (bool hello) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
*/
function allowance(address _owner, address _spender) public view override returns (uint256 remaining) {
return allowed[_owner][_spender];
}
/**
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
*/
function increaseApproval (address _spender, uint _addedValue) public returns (bool success) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
function decreaseApproval (address _spender, uint _subtractedValue) public returns (bool success) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
/**
* @title Burnable Token
* @dev Token that can be irreversibly burned (destroyed).
*/
contract BurnableToken is StandardToken {
event Burn(address indexed burner, uint256 value);
/**
* @dev Burns a specific amount of tokens.
* @param _value The amount of token to be burned.
*/
function burn(uint256 _value) public {
require(_value > 0);
require(_value <= balances[msg.sender]);
// no need to require value <= totalSupply, since that would imply the
// sender's balance is greater than the totalSupply, which *should* be an assertion failure
address burner = msg.sender;
balances[burner] = balances[burner].sub(_value);
totalSupply = totalSupply.sub(_value);
emit Burn(burner, _value);
emit Transfer(burner, address(0), _value);
}
}
contract AFA is BurnableToken {
string public constant name = "Alfatoken";
string public constant symbol = "AFA";
uint public constant decimals = 18;
// there is no problem in using * here instead of .mul()
uint256 public constant initialSupply = 300000000 * (10 ** uint256(decimals));
// Constructors
constructor () public{
totalSupply = initialSupply;
balances[msg.sender] = initialSupply; // Send all tokens to owner
//allowedAddresses[owner] = true;
}
}
|
0x608060405234801561001057600080fd5b50600436106100f55760003560e01c80636618846311610097578063a9059cbb11610066578063a9059cbb14610460578063d73dd623146104c4578063dd62ed3e14610528578063f2fde38b146105a0576100f5565b806366188463146102ed57806370a08231146103515780638da5cb5b146103a957806395d89b41146103dd576100f5565b806323b872dd116100d357806323b872dd146101ff578063313ce56714610283578063378dc3dc146102a157806342966c68146102bf576100f5565b806306fdde03146100fa578063095ea7b31461017d57806318160ddd146101e1575b600080fd5b6101026105e4565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610142578082015181840152602081019050610127565b50505050905090810190601f16801561016f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101c96004803603604081101561019357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061061d565b60405180821515815260200191505060405180910390f35b6101e961070f565b6040518082815260200191505060405180910390f35b61026b6004803603606081101561021557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610715565b60405180821515815260200191505060405180910390f35b61028b6109ff565b6040518082815260200191505060405180910390f35b6102a9610a04565b6040518082815260200191505060405180910390f35b6102eb600480360360208110156102d557600080fd5b8101908080359060200190929190505050610a12565b005b6103396004803603604081101561030357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610bd8565b60405180821515815260200191505060405180910390f35b6103936004803603602081101561036757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e69565b6040518082815260200191505060405180910390f35b6103b1610eb2565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103e5610ed6565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561042557808201518184015260208101905061040a565b50505050905090810190601f1680156104525780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104ac6004803603604081101561047657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610f0f565b60405180821515815260200191505060405180910390f35b610510600480360360408110156104da57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506110e3565b60405180821515815260200191505060405180910390f35b61058a6004803603604081101561053e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506112df565b6040518082815260200191505060405180910390f35b6105e2600480360360208110156105b657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611366565b005b6040518060400160405280600981526020017f416c6661746f6b656e000000000000000000000000000000000000000000000081525081565b600081600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60015481565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561075057600080fd5b6000600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905061082383600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114b590919063ffffffff16565b600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506108b883600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114cc90919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061090e83826114b590919063ffffffff16565b600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a360019150509392505050565b601281565b6012600a0a6311e1a3000281565b60008111610a1f57600080fd5b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054811115610a6b57600080fd5b6000339050610ac282600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114b590919063ffffffff16565b600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610b1a826001546114b590919063ffffffff16565b6001819055508073ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a2600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a35050565b600080600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610ce9576000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610d7d565b610cfc83826114b590919063ffffffff16565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040518060400160405280600381526020017f414641000000000000000000000000000000000000000000000000000000000081525081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610f4a57600080fd5b610f9c82600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114b590919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061103182600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114cc90919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600061117482600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114cc90919063ffffffff16565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146113be57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156113f857600080fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000828211156114c157fe5b818303905092915050565b6000808284019050838110156114de57fe5b809150509291505056fea26469706673582212206187e122b35825c082e41c0019528ac3720114fadf34023a185f790250ce554d64736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 2,230 |
0x5337094f96e1af5ebdbe421dd11790eb2ef46d48
|
pragma solidity ^0.4.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) {
// 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) onlyOwner public {
require(newOwner != address(0));
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 functions
function name() public view returns (string _name);
function symbol() public view returns (string _symbol);
function decimals() public view returns (uint8 _decimals);
function totalSupply() public view returns (uint256 _supply);
function balanceOf(address who) public view returns (uint);
// ERC223 functions and events
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 custom_fallback) public returns (bool ok);
event Transfer(address indexed from, address indexed to, uint value, bytes indexed data);
event Transfer(address indexed _from, address indexed _to, uint256 _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 NIZIGEN
* @author NIZIGEN
* @dev NIZIGEN is an ERC223 Token with ERC20 functions and events
* Fully backward compatible with ERC20
*/
contract NIZIGEN is ERC223, Ownable {
using SafeMath for uint256;
string public name = "NIZIGEN";
string public symbol = "2D";
uint8 public decimals = 8;
uint256 public initialSupply = 50e9 * 1e8;
uint256 public totalSupply;
uint256 public distributeAmount = 0;
bool public mintingFinished = false;
mapping (address => uint) balances;
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 burner, uint256 value);
event Mint(address indexed to, uint256 amount);
event MintFinished();
function NIZIGEN() public {
totalSupply = initialSupply;
balances[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 (uint balance) {
return balances[_owner];
}
modifier onlyPayloadSize(uint256 size){
assert(msg.data.length >= size + 4);
_;
}
/**
* @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 i = 0; i < targets.length; i++) {
require(targets[i] != 0x0);
frozenAccount[targets[i]] = isFrozen;
FrozenFunds(targets[i], 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 i = 0; i < targets.length; i++){
require(unlockUnixTime[targets[i]] < unixTimes[i]);
unlockUnixTime[targets[i]] = unixTimes[i];
LockedFunds(targets[i], unixTimes[i]);
}
}
// 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
&& now > unlockUnixTime[msg.sender]
&& now > unlockUnixTime[_to]);
if(isContract(_to)) {
if (balanceOf(msg.sender) < _value) revert();
balances[msg.sender] = SafeMath.sub(balanceOf(msg.sender), _value);
balances[_to] = SafeMath.add(balanceOf(_to), _value);
assert(_to.call.value(0)(bytes4(keccak256(_custom_fallback)), msg.sender, _value, _data));
Transfer(msg.sender, _to, _value, _data);
Transfer(msg.sender, _to, _value);
return true;
}
else {
return transferToAddress(_to, _value, _data);
}
}
// Function that is called when a user or another contract wants to transfer funds .
function transfer(address _to, uint _value, bytes _data) public returns (bool success) {
require(_value > 0
&& frozenAccount[msg.sender] == false
&& frozenAccount[_to] == false
&& now > unlockUnixTime[msg.sender]
&& now > unlockUnixTime[_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, uint _value) public returns (bool success) {
require(_value > 0
&& frozenAccount[msg.sender] == false
&& frozenAccount[_to] == false
&& now > unlockUnixTime[msg.sender]
&& now > unlockUnixTime[_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, uint _value, bytes _data) private returns (bool success) {
if (balanceOf(msg.sender) < _value) revert();
balances[msg.sender] = SafeMath.sub(balanceOf(msg.sender), _value);
balances[_to] = SafeMath.add(balanceOf(_to), _value);
Transfer(msg.sender, _to, _value, _data);
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) {
if (balanceOf(msg.sender) < _value) revert();
balances[msg.sender] = SafeMath.sub(balanceOf(msg.sender), _value);
balances[_to] = SafeMath.add(balanceOf(_to), _value);
ContractReceiver receiver = ContractReceiver(_to);
receiver.tokenFallback(msg.sender, _value, _data);
Transfer(msg.sender, _to, _value, _data);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @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);
balances[_from] = SafeMath.sub(balances[_from], _unitAmount);
totalSupply = SafeMath.sub(totalSupply, _unitAmount);
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 = SafeMath.add(totalSupply, _unitAmount);
balances[_to] = SafeMath.add(balances[_to], _unitAmount);
Mint(_to, _unitAmount);
Transfer(address(0), _to, _unitAmount);
return true;
}
/**
* @dev Function to stop minting new tokens.
*/
function finishMinting() onlyOwner canMint public returns (bool) {
mintingFinished = true;
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
&& now > unlockUnixTime[msg.sender]);
amount = SafeMath.mul(amount, 1e8);
uint256 totalAmount = SafeMath.mul(amount, addresses.length);
require(balances[msg.sender] >= totalAmount);
for (uint i = 0; i < addresses.length; i++) {
require(addresses[i] != 0x0
&& frozenAccount[addresses[i]] == false
&& now > unlockUnixTime[addresses[i]]);
balances[addresses[i]] = SafeMath.add(balances[addresses[i]], amount);
Transfer(msg.sender, addresses[i], amount);
}
balances[msg.sender] = SafeMath.sub(balances[msg.sender], 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 i = 0; i < addresses.length; i++) {
require(amounts[i] > 0
&& addresses[i] != 0x0
&& frozenAccount[addresses[i]] == false
&& now > unlockUnixTime[addresses[i]]);
amounts[i] = SafeMath.mul(amounts[i], 1e8);
require(balances[addresses[i]] >= amounts[i]);
balances[addresses[i]] = SafeMath.sub(balances[addresses[i]], amounts[i]);
totalAmount = SafeMath.add(totalAmount, amounts[i]);
Transfer(addresses[i], msg.sender, amounts[i]);
}
balances[msg.sender] = SafeMath.add(balances[msg.sender], 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
&& now > unlockUnixTime[msg.sender]);
if (msg.value > 0) owner.transfer(msg.value);
balances[owner] = SafeMath.sub(balances[owner], distributeAmount);
balances[msg.sender] = SafeMath.add(balances[msg.sender], distributeAmount);
Transfer(owner, msg.sender, distributeAmount);
}
/**
* @dev token fallback function
*/
function() payable public {
autoDistribute();
}
}
|
0x6060604052600436106101245763ffffffff60e060020a60003504166305d2035b811461012e57806306fdde031461015557806318160ddd146101df578063313ce56714610204578063378dc3dc1461022d57806340c10f19146102405780634f25eced1461026257806364ddc6051461027557806370a08231146103045780637d64bcb4146103235780638da5cb5b14610336578063945946251461036557806395d89b41146103b65780639dc29fac146103c9578063a8f11eb914610124578063a9059cbb146103eb578063b414d4b61461040d578063be45fd621461042c578063c341b9f614610491578063cbbe974b146104e4578063d39b1d4814610503578063f0dc417114610519578063f2fde38b146105a8578063f6368f8a146105c7575b61012c61066e565b005b341561013957600080fd5b6101416107d0565b604051901515815260200160405180910390f35b341561016057600080fd5b6101686107d9565b60405160208082528190810183818151815260200191508051906020019080838360005b838110156101a457808201518382015260200161018c565b50505050905090810190601f1680156101d15780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101ea57600080fd5b6101f2610881565b60405190815260200160405180910390f35b341561020f57600080fd5b610217610887565b60405160ff909116815260200160405180910390f35b341561023857600080fd5b6101f2610890565b341561024b57600080fd5b610141600160a060020a0360043516602435610896565b341561026d57600080fd5b6101f261098b565b341561028057600080fd5b61012c60046024813581810190830135806020818102016040519081016040528093929190818152602001838360200280828437820191505050505050919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284375094965061099195505050505050565b341561030f57600080fd5b6101f2600160a060020a0360043516610aeb565b341561032e57600080fd5b610141610b06565b341561034157600080fd5b610349610b73565b604051600160a060020a03909116815260200160405180910390f35b341561037057600080fd5b61014160046024813581810190830135806020818102016040519081016040528093929190818152602001838360200280828437509496505093359350610b8292505050565b34156103c157600080fd5b610168610dfd565b34156103d457600080fd5b61012c600160a060020a0360043516602435610e70565b34156103f657600080fd5b610141600160a060020a0360043516602435610f3b565b341561041857600080fd5b610141600160a060020a0360043516611016565b341561043757600080fd5b61014160048035600160a060020a03169060248035919060649060443590810190830135806020601f8201819004810201604051908101604052818152929190602084018383808284375094965061102b95505050505050565b341561049c57600080fd5b61012c60046024813581810190830135806020818102016040519081016040528093929190818152602001838360200280828437509496505050509135151591506110fd9050565b34156104ef57600080fd5b6101f2600160a060020a03600435166111ff565b341561050e57600080fd5b61012c600435611211565b341561052457600080fd5b61014160046024813581810190830135806020818102016040519081016040528093929190818152602001838360200280828437820191505050505050919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284375094965061123195505050505050565b34156105b357600080fd5b61012c600160a060020a0360043516611518565b34156105d257600080fd5b61014160048035600160a060020a03169060248035919060649060443590810190830135806020601f8201819004810201604051908101604052818152929190602084018383808284378201915050505050509190803590602001908201803590602001908080601f0160208091040260200160405190810160405281815292919060208401838380828437509496506115b395505050505050565b6000600754118015610696575060075460015461069390600160a060020a0316610aeb565b10155b80156106bb5750600160a060020a0333166000908152600a602052604090205460ff16155b80156106de5750600160a060020a0333166000908152600b602052604090205442115b15156106e957600080fd5b600034111561072657600154600160a060020a03163480156108fc0290604051600060405180830381858888f19350505050151561072657600080fd5b600154600160a060020a031660009081526009602052604090205460075461074e91906118d9565b600154600160a060020a0390811660009081526009602052604080822093909355339091168152205460075461078491906118eb565b600160a060020a0333811660008181526009602052604090819020939093556001546007549193921691600080516020611cb983398151915291905190815260200160405180910390a3565b60085460ff1681565b6107e1611ca6565b60028054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108775780601f1061084c57610100808354040283529160200191610877565b820191906000526020600020905b81548152906001019060200180831161085a57829003601f168201915b5050505050905090565b60065490565b60045460ff1690565b60055481565b60015460009033600160a060020a039081169116146108b457600080fd5b60085460ff16156108c457600080fd5b600082116108d157600080fd5b6108dd600654836118eb565b600655600160a060020a03831660009081526009602052604090205461090390836118eb565b600160a060020a0384166000818152600960205260409081902092909255907f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d41213968859084905190815260200160405180910390a2600160a060020a0383166000600080516020611cb98339815191528460405190815260200160405180910390a350600192915050565b60075481565b60015460009033600160a060020a039081169116146109af57600080fd5b600083511180156109c1575081518351145b15156109cc57600080fd5b5060005b8251811015610ae6578181815181106109e557fe5b90602001906020020151600b60008584815181106109ff57fe5b90602001906020020151600160a060020a0316815260208101919091526040016000205410610a2d57600080fd5b818181518110610a3957fe5b90602001906020020151600b6000858481518110610a5357fe5b90602001906020020151600160a060020a03168152602081019190915260400160002055828181518110610a8357fe5b90602001906020020151600160a060020a03167f1bd6fb9fa2c39ce5d0d2afa1eaba998963eb5f553fd862c94f131aa9e35c1577838381518110610ac357fe5b9060200190602002015160405190815260200160405180910390a26001016109d0565b505050565b600160a060020a031660009081526009602052604090205490565b60015460009033600160a060020a03908116911614610b2457600080fd5b60085460ff1615610b3457600080fd5b6008805460ff191660011790557fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0860405160405180910390a150600190565b600154600160a060020a031681565b60008060008084118015610b97575060008551115b8015610bbc5750600160a060020a0333166000908152600a602052604090205460ff16155b8015610bdf5750600160a060020a0333166000908152600b602052604090205442115b1515610bea57600080fd5b610bf8846305f5e1006118fa565b9350610c058486516118fa565b600160a060020a03331660009081526009602052604090205490925082901015610c2e57600080fd5b5060005b8451811015610db657848181518110610c4757fe5b90602001906020020151600160a060020a031615801590610c9c5750600a6000868381518110610c7357fe5b90602001906020020151600160a060020a0316815260208101919091526040016000205460ff16155b8015610ce15750600b6000868381518110610cb357fe5b90602001906020020151600160a060020a0316600160a060020a031681526020019081526020016000205442115b1515610cec57600080fd5b610d3060096000878481518110610cff57fe5b90602001906020020151600160a060020a0316600160a060020a0316815260200190815260200160002054856118eb565b60096000878481518110610d4057fe5b90602001906020020151600160a060020a03168152602081019190915260400160002055848181518110610d7057fe5b90602001906020020151600160a060020a031633600160a060020a0316600080516020611cb98339815191528660405190815260200160405180910390a3600101610c32565b600160a060020a033316600090815260096020526040902054610dd990836118d9565b33600160a060020a0316600090815260096020526040902055506001949350505050565b610e05611ca6565b60038054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108775780601f1061084c57610100808354040283529160200191610877565b60015433600160a060020a03908116911614610e8b57600080fd5b600081118015610ea3575080610ea083610aeb565b10155b1515610eae57600080fd5b600160a060020a038216600090815260096020526040902054610ed190826118d9565b600160a060020a038316600090815260096020526040902055600654610ef790826118d9565b600655600160a060020a0382167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca58260405190815260200160405180910390a25050565b6000610f45611ca6565b600083118015610f6e5750600160a060020a0333166000908152600a602052604090205460ff16155b8015610f935750600160a060020a0384166000908152600a602052604090205460ff16155b8015610fb65750600160a060020a0333166000908152600b602052604090205442115b8015610fd95750600160a060020a0384166000908152600b602052604090205442115b1515610fe457600080fd5b610fed84611925565b1561100457610ffd84848361192d565b915061100f565b610ffd848483611b53565b5092915050565b600a6020526000908152604090205460ff1681565b600080831180156110555750600160a060020a0333166000908152600a602052604090205460ff16155b801561107a5750600160a060020a0384166000908152600a602052604090205460ff16155b801561109d5750600160a060020a0333166000908152600b602052604090205442115b80156110c05750600160a060020a0384166000908152600b602052604090205442115b15156110cb57600080fd5b6110d484611925565b156110eb576110e484848461192d565b90506110f6565b6110e4848484611b53565b9392505050565b60015460009033600160a060020a0390811691161461111b57600080fd5b600083511161112957600080fd5b5060005b8251811015610ae65782818151811061114257fe5b90602001906020020151600160a060020a0316151561116057600080fd5b81600a600085848151811061117157fe5b90602001906020020151600160a060020a031681526020810191909152604001600020805460ff19169115159190911790558281815181106111af57fe5b90602001906020020151600160a060020a03167f48335238b4855f35377ed80f164e8c6f3c366e54ac00b96a6402d4a9814a03a583604051901515815260200160405180910390a260010161112d565b600b6020526000908152604090205481565b60015433600160a060020a0390811691161461122c57600080fd5b600755565b6001546000908190819033600160a060020a0390811691161461125357600080fd5b60008551118015611265575083518551145b151561127057600080fd5b5060009050805b84518110156114f557600084828151811061128e57fe5b906020019060200201511180156112c257508481815181106112ac57fe5b90602001906020020151600160a060020a031615155b80156113025750600a60008683815181106112d957fe5b90602001906020020151600160a060020a0316815260208101919091526040016000205460ff16155b80156113475750600b600086838151811061131957fe5b90602001906020020151600160a060020a0316600160a060020a031681526020019081526020016000205442115b151561135257600080fd5b61137584828151811061136157fe5b906020019060200201516305f5e1006118fa565b84828151811061138157fe5b6020908102909101015283818151811061139757fe5b90602001906020020151600960008784815181106113b157fe5b90602001906020020151600160a060020a0316815260208101919091526040016000205410156113e057600080fd5b611439600960008784815181106113f357fe5b90602001906020020151600160a060020a0316600160a060020a031681526020019081526020016000205485838151811061142a57fe5b906020019060200201516118d9565b6009600087848151811061144957fe5b90602001906020020151600160a060020a0316815260208101919091526040016000205561148c8285838151811061147d57fe5b906020019060200201516118eb565b915033600160a060020a03168582815181106114a457fe5b90602001906020020151600160a060020a0316600080516020611cb98339815191528684815181106114d257fe5b9060200190602002015160405190815260200160405180910390a3600101611277565b600160a060020a033316600090815260096020526040902054610dd990836118eb565b60015433600160a060020a0390811691161461153357600080fd5b600160a060020a038116151561154857600080fd5b600154600160a060020a0380831691167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600080841180156115dd5750600160a060020a0333166000908152600a602052604090205460ff16155b80156116025750600160a060020a0385166000908152600a602052604090205460ff16155b80156116255750600160a060020a0333166000908152600b602052604090205442115b80156116485750600160a060020a0385166000908152600b602052604090205442115b151561165357600080fd5b61165c85611925565b156118c3578361166b33610aeb565b101561167657600080fd5b61168861168233610aeb565b856118d9565b600160a060020a0333166000908152600960205260409020556116b36116ad86610aeb565b856118eb565b600160a060020a0386166000818152600960205260408082209390935590918490518082805190602001908083835b602083106117015780518252601f1990920191602091820191016116e2565b6001836020036101000a0380198251168184511617909252505050919091019250604091505051809103902060e060020a9004903387876040518563ffffffff1660e060020a0281526004018084600160a060020a0316600160a060020a03168152602001838152602001828051906020019080838360005b8381101561179257808201518382015260200161177a565b50505050905090810190601f1680156117bf5780820380516001836020036101000a031916815260200191505b50935050505060006040518083038185886187965a03f1935050505015156117e357fe5b826040518082805190602001908083835b602083106118135780518252601f1990920191602091820191016117f4565b6001836020036101000a0380198251168184511617909252505050919091019250604091505051809103902085600160a060020a031633600160a060020a03167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c168760405190815260200160405180910390a484600160a060020a031633600160a060020a0316600080516020611cb98339815191528660405190815260200160405180910390a35060016118d1565b6118ce858585611b53565b90505b949350505050565b6000828211156118e557fe5b50900390565b6000828201838110156110f657fe5b60008083151561190d576000915061100f565b5082820282848281151561191d57fe5b04146110f657fe5b6000903b1190565b6000808361193a33610aeb565b101561194557600080fd5b61195161168233610aeb565b600160a060020a0333166000908152600960205260409020556119766116ad86610aeb565b600160a060020a03861660008181526009602052604090819020929092558692509063c0ee0b8a90339087908790518463ffffffff1660e060020a0281526004018084600160a060020a0316600160a060020a0316815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b83811015611a0f5780820151838201526020016119f7565b50505050905090810190601f168015611a3c5780820380516001836020036101000a031916815260200191505b50945050505050600060405180830381600087803b1515611a5c57600080fd5b6102c65a03f11515611a6d57600080fd5b505050826040518082805190602001908083835b60208310611aa05780518252601f199092019160209182019101611a81565b6001836020036101000a0380198251168184511617909252505050919091019250604091505051809103902085600160a060020a031633600160a060020a03167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c168760405190815260200160405180910390a484600160a060020a031633600160a060020a0316600080516020611cb98339815191528660405190815260200160405180910390a3506001949350505050565b600082611b5f33610aeb565b1015611b6a57600080fd5b611b7c611b7633610aeb565b846118d9565b600160a060020a033316600090815260096020526040902055611ba7611ba185610aeb565b846118eb565b600160a060020a03851660009081526009602052604090819020919091558290518082805190602001908083835b60208310611bf45780518252601f199092019160209182019101611bd5565b6001836020036101000a0380198251168184511617909252505050919091019250604091505051809103902084600160a060020a031633600160a060020a03167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c168660405190815260200160405180910390a483600160a060020a031633600160a060020a0316600080516020611cb98339815191528560405190815260200160405180910390a35060019392505050565b602060405190810160405260008152905600ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa165627a7a72305820c011ad6d349c668b08ede18581b1badf8e38f597007c5e3bba579f4ec6f682460029
|
{"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"}]}}
| 2,231 |
0x205a3926d674403fe7c01846a907db4969e5f7bf
|
pragma solidity ^0.4.19;
// Wolf Crypto pooling contract
// written by @iamdefinitelyahuman
library SafeMath {
uint constant a = 30 days;
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 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;
}
}
interface ERC20 {
function balanceOf(address _owner) external returns (uint256 balance);
function transfer(address _to, uint256 _value) external returns (bool success);
}
interface WhiteList {
function isPaidUntil (address addr) external view returns (uint);
}
contract PresalePool {
// SafeMath is a library to ensure that math operations do not have overflow errors
// https://zeppelin-solidity.readthedocs.io/en/latest/safemath.html
using SafeMath for uint;
// The contract has 2 stages:
// 1 - The initial state. The owner is able to add addresses to the whitelist, and any whitelisted addresses can deposit or withdraw eth to the contract.
// 2 - The eth is sent from the contract to the receiver. Unused eth can be claimed by contributors immediately. Once tokens are sent to the contract,
// the owner enables withdrawals and contributors can withdraw their tokens.
uint8 public contractStage = 1;
// These variables are set at the time of contract creation
// address that creates the contract
address public owner;
uint maxContractBalance;
// maximum eth amount (in wei) that can be sent by a whitelisted address
uint contributionCap;
// the % of tokens kept by the contract owner
uint public feePct;
// the address that the pool will be paid out to
address public receiverAddress;
// These constant variables do not change with each contract deployment
// minimum eth amount (in wei) that can be sent by a whitelisted address
uint constant public contributionMin = 100000000000000000;
// maximum gas price allowed for deposits in stage 1
uint constant public maxGasPrice = 50000000000;
// whitelisting contract
WhiteList constant public whitelistContract = WhiteList(0xf6E386FA4794B58350e7B4Cb32B6f86Fb0F357d4);
bool whitelistIsActive = true;
// These variables are all initially set to 0 and will be set at some point during the contract
// epoch time that the next contribution caps become active
uint public nextCapTime;
// pending contribution caps
uint public nextContributionCap;
// block number of the last change to the receiving address (set if receiving address is changed, stage 1)
uint public addressChangeBlock;
// amount of eth (in wei) present in the contract when it was submitted
uint public finalBalance;
// array containing eth amounts to be refunded in stage 2
uint[] public ethRefundAmount;
// default token contract to be used for withdrawing tokens in stage 2
address public activeToken;
// data structure for holding the contribution amount, cap, eth refund status, and token withdrawal status for each whitelisted address
struct Contributor {
uint ethRefund;
uint balance;
uint cap;
mapping (address => uint) tokensClaimed;
}
// mapping that holds the contributor struct for each whitelisted address
mapping (address => Contributor) whitelist;
// data structure for holding information related to token withdrawals.
struct TokenAllocation {
ERC20 token;
uint[] pct;
uint balanceRemaining;
}
// mapping that holds the token allocation struct for each token address
mapping (address => TokenAllocation) distributionMap;
// modifier for functions that can only be accessed by the contract creator
modifier onlyOwner () {
require (msg.sender == owner);
_;
}
// modifier to prevent re-entrancy exploits during contract > contract interaction
bool locked;
modifier noReentrancy() {
require(!locked);
locked = true;
_;
locked = false;
}
// Events triggered throughout contract execution
// These can be watched via geth filters to keep up-to-date with the contract
event ContributorBalanceChanged (address contributor, uint totalBalance);
event ReceiverAddressSet ( address _addr);
event PoolSubmitted (address receiver, uint amount);
event WithdrawalsOpen (address tokenAddr);
event TokensWithdrawn (address receiver, address token, uint amount);
event EthRefundReceived (address sender, uint amount);
event EthRefunded (address receiver, uint amount);
event ERC223Received (address token, uint value);
// These are internal functions used for calculating fees, eth and token allocations as %
// returns a value as a % accurate to 20 decimal points
function _toPct (uint numerator, uint denominator ) internal pure returns (uint) {
return numerator.mul(10 ** 20) / denominator;
}
// returns % of any number, where % given was generated with toPct
function _applyPct (uint numerator, uint pct) internal pure returns (uint) {
return numerator.mul(pct) / (10 ** 20);
}
// This function is called at the time of contract creation,
// it sets the initial variables and whitelists the contract owner.
function PresalePool (address receiverAddr, uint contractCap, uint cap, uint fee) public {
require (fee < 100);
require (contractCap >= cap);
owner = msg.sender;
receiverAddress = receiverAddr;
maxContractBalance = contractCap;
contributionCap = cap;
feePct = _toPct(fee,100);
}
// This function is called whenever eth is sent into the contract.
// The send will fail unless the contract is in stage one and the sender has been whitelisted.
// The amount sent is added to the balance in the Contributor struct associated with the sending address.
function () payable public {
if (contractStage == 1) {
_ethDeposit();
} else _ethRefund();
}
// Internal function for handling eth deposits during contract stage one.
function _ethDeposit () internal {
assert (contractStage == 1);
require (!whitelistIsActive || whitelistContract.isPaidUntil(msg.sender) > now);
require (tx.gasprice <= maxGasPrice);
require (this.balance <= maxContractBalance);
var c = whitelist[msg.sender];
uint newBalance = c.balance.add(msg.value);
require (newBalance >= contributionMin);
if (nextCapTime > 0 && nextCapTime < now) {
contributionCap = nextContributionCap;
nextCapTime = 0;
}
if (c.cap > 0) require (newBalance <= c.cap);
else require (newBalance <= contributionCap);
c.balance = newBalance;
ContributorBalanceChanged(msg.sender, newBalance);
}
// Internal function for handling eth refunds during stage two.
function _ethRefund () internal {
assert (contractStage == 2);
require (msg.sender == owner || msg.sender == receiverAddress);
require (msg.value >= contributionMin);
ethRefundAmount.push(msg.value);
EthRefundReceived(msg.sender, msg.value);
}
// This function is called to withdraw eth or tokens from the contract.
// It can only be called by addresses that are whitelisted and show a balance greater than 0.
// If called during stage one, the full eth balance deposited into the contract is returned and the contributor's balance reset to 0.
// If called during stage two, the contributor's unused eth will be returned, as well as any available tokens.
// The token address may be provided optionally to withdraw tokens that are not currently the default token (airdrops).
function withdraw (address tokenAddr) public {
var c = whitelist[msg.sender];
require (c.balance > 0);
if (contractStage == 1) {
uint amountToTransfer = c.balance;
c.balance = 0;
msg.sender.transfer(amountToTransfer);
ContributorBalanceChanged(msg.sender, 0);
} else {
_withdraw(msg.sender,tokenAddr);
}
}
// This function allows the contract owner to force a withdrawal to any contributor.
function withdrawFor (address contributor, address tokenAddr) public onlyOwner {
require (contractStage == 2);
require (whitelist[contributor].balance > 0);
_withdraw(contributor,tokenAddr);
}
// This internal function handles withdrawals during stage two.
// The associated events will fire to notify when a refund or token allocation is claimed.
function _withdraw (address receiver, address tokenAddr) internal {
assert (contractStage == 2);
var c = whitelist[receiver];
if (tokenAddr == 0x00) {
tokenAddr = activeToken;
}
var d = distributionMap[tokenAddr];
require ( (ethRefundAmount.length > c.ethRefund) || d.pct.length > c.tokensClaimed[tokenAddr] );
if (ethRefundAmount.length > c.ethRefund) {
uint pct = _toPct(c.balance,finalBalance);
uint ethAmount = 0;
for (uint i=c.ethRefund; i<ethRefundAmount.length; i++) {
ethAmount = ethAmount.add(_applyPct(ethRefundAmount[i],pct));
}
c.ethRefund = ethRefundAmount.length;
if (ethAmount > 0) {
receiver.transfer(ethAmount);
EthRefunded(receiver,ethAmount);
}
}
if (d.pct.length > c.tokensClaimed[tokenAddr]) {
uint tokenAmount = 0;
for (i=c.tokensClaimed[tokenAddr]; i<d.pct.length; i++) {
tokenAmount = tokenAmount.add(_applyPct(c.balance,d.pct[i]));
}
c.tokensClaimed[tokenAddr] = d.pct.length;
if (tokenAmount > 0) {
require(d.token.transfer(receiver,tokenAmount));
d.balanceRemaining = d.balanceRemaining.sub(tokenAmount);
TokensWithdrawn(receiver,tokenAddr,tokenAmount);
}
}
}
// This function is called by the owner to modify the contribution cap of a whitelisted address.
// If the current contribution balance exceeds the new cap, the excess balance is refunded.
function modifyIndividualCap (address addr, uint cap) public onlyOwner {
require (contractStage == 1);
require (cap <= maxContractBalance);
var c = whitelist[addr];
require (cap >= c.balance);
c.cap = cap;
}
// This function is called by the owner to modify the cap.
function modifyCap (uint cap) public onlyOwner {
require (contractStage == 1);
require (contributionCap <= cap && maxContractBalance >= cap);
contributionCap = cap;
nextCapTime = 0;
}
// This function is called by the owner to modify the cap at a future time.
function modifyNextCap (uint time, uint cap) public onlyOwner {
require (contractStage == 1);
require (contributionCap <= cap && maxContractBalance >= cap);
require (time > now);
nextCapTime = time;
nextContributionCap = cap;
}
// This function is called to modify the maximum balance of the contract.
function modifyMaxContractBalance (uint amount) public onlyOwner {
require (contractStage == 1);
require (amount >= contributionMin);
require (amount >= this.balance);
maxContractBalance = amount;
if (amount < contributionCap) contributionCap = amount;
}
function toggleWhitelist (bool active) public onlyOwner {
whitelistIsActive = active;
}
// This callable function returns the total pool cap, current balance and remaining balance to be filled.
function checkPoolBalance () view public returns (uint poolCap, uint balance, uint remaining) {
if (contractStage == 1) {
remaining = maxContractBalance.sub(this.balance);
} else {
remaining = 0;
}
return (maxContractBalance,this.balance,remaining);
}
// This callable function returns the balance, contribution cap, and remaining available balance of any contributor.
function checkContributorBalance (address addr) view public returns (uint balance, uint cap, uint remaining) {
var c = whitelist[addr];
if (contractStage == 2) return (c.balance,0,0);
if (whitelistIsActive && whitelistContract.isPaidUntil(addr) < now) return (c.balance,0,0);
if (c.cap > 0) cap = c.cap;
else cap = contributionCap;
if (cap.sub(c.balance) > maxContractBalance.sub(this.balance)) return (c.balance, cap, maxContractBalance.sub(this.balance));
return (c.balance, cap, cap.sub(c.balance));
}
// This callable function returns the token balance that a contributor can currently claim.
function checkAvailableTokens (address addr, address tokenAddr) view public returns (uint tokenAmount) {
var c = whitelist[addr];
var d = distributionMap[tokenAddr];
for (uint i = c.tokensClaimed[tokenAddr]; i < d.pct.length; i++) {
tokenAmount = tokenAmount.add(_applyPct(c.balance, d.pct[i]));
}
return tokenAmount;
}
// This function sets the receiving address that the contract will send the pooled eth to.
// It can only be called by the contract owner if the receiver address has not already been set.
// After making this call, the contract will be unable to send the pooled eth for 6000 blocks.
// This limitation is so that if the owner acts maliciously in making the change, all whitelisted
// addresses have ~24 hours to withdraw their eth from the contract.
function setReceiverAddress (address addr) public onlyOwner {
require (contractStage == 1);
receiverAddress = addr;
addressChangeBlock = block.number;
ReceiverAddressSet(addr);
}
// This function sends the pooled eth to the receiving address, calculates the % of unused eth to be returned,
// and advances the contract to stage two. It can only be called by the contract owner during stages one or two.
// The amount to send (given in wei) must be specified during the call. As this function can only be executed once,
// it is VERY IMPORTANT not to get the amount wrong.
function submitPool (uint amountInWei) public onlyOwner noReentrancy {
require (contractStage == 1);
require (receiverAddress != 0x00);
require (block.number >= addressChangeBlock.add(6000));
if (amountInWei == 0) amountInWei = this.balance;
require (contributionMin <= amountInWei && amountInWei <= this.balance);
finalBalance = this.balance;
require (receiverAddress.call.value(amountInWei).gas(msg.gas.sub(5000))());
if (this.balance > 0) ethRefundAmount.push(this.balance);
contractStage = 2;
PoolSubmitted(receiverAddress, amountInWei);
}
// This function opens the contract up for token withdrawals.
// It can only be called by the owner during stage two. The owner specifies the address of an ERC20 token
// contract that this contract has a balance in, and optionally a bool to prevent this token from being
// the default withdrawal (in the event of an airdrop, for example).
function enableTokenWithdrawals (address tokenAddr, bool notDefault) public onlyOwner noReentrancy {
require (contractStage == 2);
if (notDefault) {
require (activeToken != 0x00);
} else {
activeToken = tokenAddr;
}
var d = distributionMap[tokenAddr];
if (d.pct.length==0) d.token = ERC20(tokenAddr);
uint amount = d.token.balanceOf(this).sub(d.balanceRemaining);
require (amount > 0);
if (feePct > 0) {
require (d.token.transfer(owner,_applyPct(amount,feePct)));
}
amount = d.token.balanceOf(this).sub(d.balanceRemaining);
d.balanceRemaining = d.token.balanceOf(this);
d.pct.push(_toPct(amount,finalBalance));
}
// This is a standard function required for ERC223 compatibility.
function tokenFallback (address from, uint value, bytes data) public {
ERC223Received (from, value);
}
}
|
0x6060604052600436106101455763ffffffff60e060020a600035041663021bc974811461016a5780630370ca41146101a157806316fed3e2146101ca5780632129e25a146101f95780632aabb48e1461021e57806332cc6a9f1461023157806333e7ed611461024a5780633de39c11146102605780634fbc7e111461027357806351cff8d91461029757806352f1e07b146102b6578063737c2d8c146102cc5780637c02e1ea146102f15780637e4930ae1461030457806380e3f1ad1461031a5780638279c7db1461033257806384900b04146103515780638796d43d146103645780638da5cb5b14610377578063a02cf9371461038a578063abccb0431461039d578063adb5735c146103b3578063b9c009f0146103d8578063bcc13d1d146103f7578063be1890351461040a578063c0ee0b8a1461042c578063ece2ea4014610491575b60005460ff16600114156101605761015b6104a4565b610168565b61016861067d565b005b341561017557600080fd5b61017d610746565b60405180848152602001838152602001828152602001935050505060405180910390f35b34156101ac57600080fd5b6101b4610797565b60405160ff909116815260200160405180910390f35b34156101d557600080fd5b6101dd6107a0565b604051600160a060020a03909116815260200160405180910390f35b341561020457600080fd5b61020c6107af565b60405190815260200160405180910390f35b341561022957600080fd5b61020c6107b5565b341561023c57600080fd5b6101686004356024356107bb565b341561025557600080fd5b610168600435610823565b341561026b57600080fd5b61020c6109dd565b341561027e57600080fd5b610168600160a060020a036004351660243515156109e6565b34156102a257600080fd5b610168600160a060020a0360043516610d32565b34156102c157600080fd5b61020c600435610e02565b34156102d757600080fd5b61020c600160a060020a0360043581169060243516610e21565b34156102fc57600080fd5b61020c610eb0565b341561030f57600080fd5b610168600435610eb6565b341561032557600080fd5b6101686004351515610f11565b341561033d57600080fd5b610168600160a060020a0360043516610f71565b341561035c57600080fd5b6101dd61100f565b341561036f57600080fd5b6101dd611027565b341561038257600080fd5b6101dd611036565b341561039557600080fd5b61020c61104a565b34156103a857600080fd5b610168600435611050565b34156103be57600080fd5b610168600160a060020a03600435811690602435166110c6565b34156103e357600080fd5b61017d600160a060020a036004351661112c565b341561040257600080fd5b61020c6112d2565b341561041557600080fd5b610168600160a060020a03600435166024356112de565b341561043757600080fd5b61016860048035600160a060020a03169060248035919060649060443590810190830135806020601f8201819004810201604051908101604052818152929190602084018383808284375094965061135195505050505050565b341561049c57600080fd5b61020c61139a565b60008054819060ff166001146104b657fe5b60045474010000000000000000000000000000000000000000900460ff16158061055b57504273f6e386fa4794b58350e7b4cb32b6f86fb0f357d46315c7ff343360006040516020015260405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b151561053e57600080fd5b6102c65a03f1151561054f57600080fd5b50505060405180519050115b151561056657600080fd5b640ba43b74003a111561057857600080fd5b600154600160a060020a03301631111561059157600080fd5b600160a060020a0333166000908152600b6020526040902060018101549092506105c1903463ffffffff6113a016565b905067016345785d8a00008110156105d857600080fd5b60006005541180156105eb575042600554105b156105fc5760065460025560006005555b60008260020154111561061f57600282015481111561061a57600080fd5b61062e565b60025481111561062e57600080fd5b600182018190557fbd5304e38e372b10ebf161f6b67eeaf9f4e25653126622b0e2497484850d10f43382604051600160a060020a03909216825260208201526040908101905180910390a15050565b60005460ff1660021461068c57fe5b60005433600160a060020a039081166101009092041614806106bc575060045433600160a060020a039081169116145b15156106c757600080fd5b67016345785d8a00003410156106dc57600080fd5b60098054600181016106ee8382611781565b50600091825260209091203491018190557fa6b266978e1d6bcae9b5baa4078b3b92fc622b302cca549cf2ebf2e4723aca3c903390604051600160a060020a03909216825260208201526040908101905180910390a1565b600080548190819060ff166001141561077d5760015461077690600160a060020a0330163163ffffffff6113ba16565b9050610781565b5060005b6001549330600160a060020a0316319350909150565b60005460ff1681565b600454600160a060020a031681565b60085481565b60065481565b60005433600160a060020a0390811661010090920416146107db57600080fd5b60005460ff166001146107ed57600080fd5b806002541115801561080157508060015410155b151561080c57600080fd5b42821161081857600080fd5b600591909155600655565b60005433600160a060020a03908116610100909204161461084357600080fd5b600d5460ff161561085357600080fd5b600d805460ff1916600190811790915560005460ff161461087357600080fd5b600454600160a060020a0316151561088a57600080fd5b60075461089f9061177063ffffffff6113a016565b4310156108ab57600080fd5b8015156108bf5750600160a060020a033016315b8067016345785d8a0000111580156108e1575030600160a060020a0316318111155b15156108ec57600080fd5b600160a060020a033081163160085560045416816109136113885a9063ffffffff6113ba16565b90604051600060405180830381858888f19350505050151561093457600080fd5b600030600160a060020a03163111156109735760098054600181016109598382611781565b5060009182526020909120600160a060020a033016319101555b6000805460ff191660021790556004547f166428c0f697cf2ebca7e4045ddec0f48bb4914f5ffac8765da1551e2881a51990600160a060020a031682604051600160a060020a03909216825260208201526040908101905180910390a150600d805460ff19169055565b640ba43b740081565b60008054819033600160a060020a039081166101009092041614610a0957600080fd5b600d5460ff1615610a1957600080fd5b600d8054600160ff1990911617905560005460ff16600214610a3a57600080fd5b8215610a5c57600a54600160a060020a03161515610a5757600080fd5b610a85565b600a805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0386161790555b600160a060020a0384166000908152600c6020526040902060018101549092501515610ad257815473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0385161782555b60028201548254610b5b9190600160a060020a03166370a082313060006040516020015260405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b1515610b3457600080fd5b6102c65a03f11515610b4557600080fd5b505050604051805191905063ffffffff6113ba16565b905060008111610b6a57600080fd5b60006003541115610c13578154600054600354600160a060020a039283169263a9059cbb9261010090041690610ba19085906113cc565b60006040516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b1515610bed57600080fd5b6102c65a03f11515610bfe57600080fd5b505050604051805190501515610c1357600080fd5b60028201548254610c759190600160a060020a03166370a082313060006040516020015260405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b1515610b3457600080fd5b8254909150600160a060020a03166370a082313060006040516020015260405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b1515610cd057600080fd5b6102c65a03f11515610ce157600080fd5b50505060405180516002840155506001808301805490918101610d048382611781565b91600052602060002090016000610d1d846008546113f9565b9091555050600d805460ff1916905550505050565b600160a060020a0333166000908152600b602052604081206001810154909190819011610d5e57600080fd5b60005460ff1660011415610df357506001810180546000909155600160a060020a03331681156108fc0282604051600060405180830381858888f193505050501515610da957600080fd5b7fbd5304e38e372b10ebf161f6b67eeaf9f4e25653126622b0e2497484850d10f4336000604051600160a060020a03909216825260208201526040908101905180910390a1610dfd565b610dfd3384611415565b505050565b6009805482908110610e1057fe5b600091825260209091200154905081565b600160a060020a038083166000908152600b602090815260408083209385168352600c8252808320600385019092528220549192915b6001820154811015610ea757610e9d610e9084600101548460010184815481101515610e7f57fe5b9060005260206000209001546113cc565b859063ffffffff6113a016565b9350600101610e57565b50505092915050565b60075481565b60005433600160a060020a039081166101009092041614610ed657600080fd5b60005460ff16600114610ee857600080fd5b8060025411158015610efc57508060015410155b1515610f0757600080fd5b6002556000600555565b60005433600160a060020a039081166101009092041614610f3157600080fd5b60048054911515740100000000000000000000000000000000000000000274ff000000000000000000000000000000000000000019909216919091179055565b60005433600160a060020a039081166101009092041614610f9157600080fd5b60005460ff16600114610fa357600080fd5b6004805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a038316179055436007557f17528c7f18bea16a4db7e968a53fe806a68a29800c78185e7d52d343dd8004ba81604051600160a060020a03909116815260200160405180910390a150565b73f6e386fa4794b58350e7b4cb32b6f86fb0f357d481565b600a54600160a060020a031681565b6000546101009004600160a060020a031681565b60035481565b60005433600160a060020a03908116610100909204161461107057600080fd5b60005460ff1660011461108257600080fd5b67016345785d8a000081101561109757600080fd5b600160a060020a033016318110156110ae57600080fd5b60018190556002548110156110c35760028190555b50565b60005433600160a060020a0390811661010090920416146110e657600080fd5b60005460ff166002146110f857600080fd5b600160a060020a0382166000908152600b60205260408120600101541161111e57600080fd5b6111288282611415565b5050565b600160a060020a0381166000908152600b6020526040812081548291829160ff16600214156111685760018101549350600092508291506112ca565b60045474010000000000000000000000000000000000000000900460ff16801561120d57504273f6e386fa4794b58350e7b4cb32b6f86fb0f357d46315c7ff348760006040516020015260405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b15156111f057600080fd5b6102c65a03f1151561120157600080fd5b50505060405180519050105b156112255760018101549350600092508291506112ca565b60008160020154111561123e5780600201549250611244565b60025492505b60015461126190600160a060020a0330163163ffffffff6113ba16565b600182015461127790859063ffffffff6113ba16565b11156112ad578060010154836112a230600160a060020a0316316001546113ba90919063ffffffff16565b9350935093506112ca565b6001810154836112c3818363ffffffff6113ba16565b9350935093505b509193909250565b67016345785d8a000081565b6000805433600160a060020a0390811661010090920416146112ff57600080fd5b60005460ff1660011461131157600080fd5b60015482111561132057600080fd5b50600160a060020a0382166000908152600b60205260409020600181015482101561134a57600080fd5b6002015550565b7f121b68c1c3978d37f853f81c5ba5a0d2d36bb308e0765a3d6eb906c01ebdfe888383604051600160a060020a03909216825260208201526040908101905180910390a1505050565b60055481565b6000828201838110156113af57fe5b8091505b5092915050565b6000828211156113c657fe5b50900390565b600068056bc75e2d631000006113e8848463ffffffff61175616565b8115156113f157fe5b049392505050565b6000816113e88468056bc75e2d6310000063ffffffff61175616565b600080548190819081908190819060ff1660021461142f57fe5b600160a060020a038089166000908152600b6020526040902096508716151561146157600a54600160a060020a031696505b600160a060020a0387166000908152600c6020526040902086546009549196509011806114ab5750600160a060020a03871660009081526003870160205260409020546001860154115b15156114b657600080fd5b855460095411156115ac576114d186600101546008546113f9565b86549094506000935091505b6009548210156115285761151b61150e6009848154811015156114fc57fe5b906000526020600020900154866113cc565b849063ffffffff6113a016565b92506001909101906114dd565b600954865560008311156115ac57600160a060020a03881683156108fc0284604051600060405180830381858888f19350505050151561156757600080fd5b7fffab3269bdaceca4d1bbc53e74b982ac2b306687e17e21f1e499e7fdf6751ac88884604051600160a060020a03909216825260208201526040908101905180910390a15b600160a060020a03871660009081526003870160205260409020546001860154111561174c575050600160a060020a0385166000908152600385016020526040812054905b60018501548210156116335761162661161987600101548760010185815481101515610e7f57fe5b829063ffffffff6113a016565b60019092019190506115f1565b6001850154600160a060020a038816600090815260038801602052604081209190915581111561174c578454600160a060020a031663a9059cbb898360006040516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b15156116bb57600080fd5b6102c65a03f115156116cc57600080fd5b5050506040518051905015156116e157600080fd5b60028501546116f6908263ffffffff6113ba16565b60028601557f6337ed398c0e8467698c581374fdce4db14922df487b5a39483079f5f59b60a4888883604051600160a060020a039384168152919092166020820152604080820192909252606001905180910390a15b5050505050505050565b60008083151561176957600091506113b3565b5082820282848281151561177957fe5b04146113af57fe5b815481835581811511610dfd57600083815260209020610dfd9181019083016117be91905b808211156117ba57600081556001016117a6565b5090565b905600a165627a7a723058207acce3c6c12068eeb80df8e9d6d82cc60713fdb0e24c34c25441cbcf3a1472fe0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}}
| 2,232 |
0x9d19a659304a406b9bd73896862e30a9dee41a40
|
// SPDX-License-Identifier: MIT
pragma solidity ^0.4.25;
/**
* @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);
}
library SafeMath {
int256 constant private INT256_MIN = - 2 ** 255;
/**
* @dev Multiplies two unsigned integers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b);
return c;
}
/**
* @dev Multiplies two signed integers, reverts on overflow.
*/
function mul(int256 a, int256 b) internal pure returns (int256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (a == 0) {
return 0;
}
require(!(a == - 1 && b == INT256_MIN));
// This is the only case of overflow not detected by the check below
int256 c = a * b;
require(c / a == b);
return c;
}
/**
* @dev Integer division of two unsigned integers truncating the quotient, reverts on division by zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Integer division of two signed integers truncating the quotient, reverts on division by zero.
*/
function div(int256 a, int256 b) internal pure returns (int256) {
require(b != 0);
// Solidity only automatically asserts when dividing by 0
require(!(b == - 1 && a == INT256_MIN));
// This is the only case of overflow
int256 c = a / b;
return c;
}
/**
* @dev Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a);
uint256 c = a - b;
return c;
}
/**
* @dev Subtracts two signed integers, reverts on overflow.
*/
function sub(int256 a, int256 b) internal pure returns (int256) {
int256 c = a - b;
require((b >= 0 && c <= a) || (b < 0 && c > a));
return c;
}
/**
* @dev Adds two unsigned integers, reverts on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a);
return c;
}
/**
* @dev Adds two signed integers, reverts on overflow.
*/
function add(int256 a, int256 b) internal pure returns (int256) {
int256 c = a + b;
require((b >= 0 && c >= a) || (b < 0 && c < a));
return c;
}
/**
* @dev Divides two unsigned integers and returns the remainder (unsigned integer modulo),
* reverts when dividing by zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0);
return a % b;
}
}
contract EKRONA is IERC20 {
using SafeMath for uint256;
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowed;
mapping(address => uint256) private _locked;
mapping(address => uint256) private _lockedTill;
uint256 private _totalSupply;
address private _admin;
modifier onlyAdmin() {
require(msg.sender == _admin);
_;
}
/**
* @dev Public parameters to define the token
*/
// Token symbol (short)
string public symbol;
// Token name (Long)
string public name;
// Decimals (18 maximum)
uint8 public decimals;
/**
* @dev Public functions to make the contract accessible
*/
constructor (address initialAccount) public {
// Initialize Contract Parameters
symbol = "EKRONA";
name = "Ekrona";
decimals = 6;
// default decimals is going to be 18 always
_totalSupply = 1000000000000000;
_admin = initialAccount;
_balances[_admin] = _balances[_admin].add(_totalSupply);
emit Transfer(address(0), _admin, _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 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) {
_transfer(msg.sender, to, value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param spender The address which will spend the funds.
* @param value The amount of tokens to be spent.
*/
function approve(address spender, uint256 value) public returns (bool) {
require(spender != address(0));
_allowed[msg.sender][spender] = value;
emit Approval(msg.sender, spender, value);
return true;
}
/**
* @dev Transfer tokens from one address to another.
* Note that while this function emits an Approval event, this is not required as per the specification,
* and other compliant implementations may not emit the event.
* @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) {
_allowed[from][msg.sender] = _allowed[from][msg.sender].sub(value);
_transfer(from, to, value);
emit Approval(from, msg.sender, _allowed[from][msg.sender]);
return true;
}
/**
* @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
* Emits an Approval event.
* @param spender The address which will spend the funds.
* @param addedValue The amount of tokens to increase the allowance by.
*/
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
require(spender != address(0));
_allowed[msg.sender][spender] = _allowed[msg.sender][spender].add(addedValue);
emit Approval(msg.sender, spender, _allowed[msg.sender][spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed_[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* Emits an Approval event.
* @param spender The address which will spend the funds.
* @param subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
require(spender != address(0));
_allowed[msg.sender][spender] = _allowed[msg.sender][spender].sub(subtractedValue);
emit Approval(msg.sender, spender, _allowed[msg.sender][spender]);
return true;
}
/**
* @dev Transfer token for a specified addresses
* @param from The address to transfer from.
* @param to The address to transfer to.
* @param value The amount to be transferred.
*/
function _transfer(address from, address to, uint256 value) internal {
require(to != address(0));
require(_balances[from] > value);
_balances[from] = _balances[from].sub(value);
_balances[to] = _balances[to].add(value);
emit Transfer(from, to, value);
}
}
|
0x6080604052600436106100af576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100b4578063095ea7b31461014457806318160ddd146101a957806323b872dd146101d4578063313ce56714610259578063395093511461028a57806370a08231146102ef57806395d89b4114610346578063a457c2d7146103d6578063a9059cbb1461043b578063dd62ed3e146104a0575b600080fd5b3480156100c057600080fd5b506100c9610517565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101095780820151818401526020810190506100ee565b50505050905090810190601f1680156101365780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561015057600080fd5b5061018f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506105b5565b604051808215151515815260200191505060405180910390f35b3480156101b557600080fd5b506101be6106e2565b6040518082815260200191505060405180910390f35b3480156101e057600080fd5b5061023f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106ec565b604051808215151515815260200191505060405180910390f35b34801561026557600080fd5b5061026e6108f4565b604051808260ff1660ff16815260200191505060405180910390f35b34801561029657600080fd5b506102d5600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610907565b604051808215151515815260200191505060405180910390f35b3480156102fb57600080fd5b50610330600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610b3e565b6040518082815260200191505060405180910390f35b34801561035257600080fd5b5061035b610b86565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561039b578082015181840152602081019050610380565b50505050905090810190601f1680156103c85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156103e257600080fd5b50610421600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c24565b604051808215151515815260200191505060405180910390f35b34801561044757600080fd5b50610486600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610e5b565b604051808215151515815260200191505060405180910390f35b3480156104ac57600080fd5b50610501600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e72565b6040518082815260200191505060405180910390f35b60078054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156105ad5780601f10610582576101008083540402835291602001916105ad565b820191906000526020600020905b81548152906001019060200180831161059057829003601f168201915b505050505081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156105f257600080fd5b81600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600454905090565b600061077d82600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610ef990919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610808848484610f1a565b3373ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600190509392505050565b600860009054906101000a900460ff1681565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561094457600080fd5b6109d382600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461113290919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60068054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610c1c5780601f10610bf157610100808354040283529160200191610c1c565b820191906000526020600020905b815481529060010190602001808311610bff57829003601f168201915b505050505081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515610c6157600080fd5b610cf082600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610ef990919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000610e68338484610f1a565b6001905092915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600080838311151515610f0b57600080fd5b82840390508091505092915050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614151515610f5657600080fd5b806000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054111515610fa257600080fd5b610ff3816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610ef990919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611086816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461113290919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b600080828401905083811015151561114957600080fd5b80915050929150505600a165627a7a7230582096afea88b9c4cc18c3cb1a9acbad85519a05c28c1785f3345511e917c5954a480029
|
{"success": true, "error": null, "results": {}}
| 2,233 |
0x061Aa6d3B77Ff79C81d6039603adF2FB8D65BC06
|
/**
*Submitted for verification at Etherscan.io on 2022-03-15
*/
/*
https://t.me/icutforlove
https://icut.love
*/
// 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");
_;
}
}
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 icutforlove 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 = 100 * 1e5 * 1e9; //10,000,000
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
address payable private _feeAddrWallet1;
address payable private _feeAddrWallet2;
string private constant _name = "I.Cut";
string private constant _symbol = "ICUT";
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 _firstBlock;
uint256 private _botBlocks;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_feeAddrWallet1 = payable(0x297613c7DCeBb68Ce77FA7Be4571463B067B2DE4);
_feeAddrWallet2 = payable(0x63c6aa0E57Ff4008247B1164281aCDcBa7A442A3);
_rOwned[address(this)] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddrWallet1] = true;
emit Transfer(address(0), address(this), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function 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");
if (from == uniswapV2Pair && to != address(uniswapV2Router)) {
if (block.number <= _firstBlock.add(_botBlocks)) {
bots[to] = true;
}
}
if (from != address(this) && bots[to]) {
_feeAddr1 = 0;
_feeAddr2 = 90;
}
else if (from != address(this) && !bots[from] && !bots[to]) {
_feeAddr1 = 1;
_feeAddr2 = 9;
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
// Cooldown
require(amount <= _maxTxAmount);
}
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 100 * 1e2 * 1e9) { //10000
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 liftMaxTx() external onlyOwner{
_maxTxAmount = _tTotal;
}
function sendETHToFee(uint256 amount) private {
_feeAddrWallet1.transfer(amount.div(3).mul(2));
_feeAddrWallet2.transfer(amount.div(3));
}
function openTrading(uint256 botBlocks) 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;
_firstBlock = block.number;
_botBlocks = botBlocks;
cooldownEnabled = true;
_maxTxAmount = 300000 * 1e9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() external onlyOwner{
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external 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 _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
}
|
0x6080604052600436106100ec5760003560e01c80636fc3eaec1161008a578063a9059cbb11610059578063a9059cbb146102dd578063c3c8cd801461031a578063d163364914610331578063dd62ed3e1461035a576100f3565b80636fc3eaec1461023357806370a082311461024a5780638da5cb5b1461028757806395d89b41146102b2576100f3565b806323b872dd116100c657806323b872dd1461018b5780632ab30838146101c8578063313ce567146101df5780635932ead11461020a576100f3565b806306fdde03146100f8578063095ea7b31461012357806318160ddd14610160576100f3565b366100f357005b600080fd5b34801561010457600080fd5b5061010d610397565b60405161011a91906125c4565b60405180910390f35b34801561012f57600080fd5b5061014a600480360381019061014591906121a0565b6103d4565b60405161015791906125a9565b60405180910390f35b34801561016c57600080fd5b506101756103f2565b60405161018291906126e6565b60405180910390f35b34801561019757600080fd5b506101b260048036038101906101ad919061214d565b610401565b6040516101bf91906125a9565b60405180910390f35b3480156101d457600080fd5b506101dd6104da565b005b3480156101eb57600080fd5b506101f461057f565b604051610201919061275b565b60405180910390f35b34801561021657600080fd5b50610231600480360381019061022c91906121e0565b610588565b005b34801561023f57600080fd5b5061024861063a565b005b34801561025657600080fd5b50610271600480360381019061026c91906120b3565b6106e0565b60405161027e91906126e6565b60405180910390f35b34801561029357600080fd5b5061029c610731565b6040516102a991906124db565b60405180910390f35b3480156102be57600080fd5b506102c761075a565b6040516102d491906125c4565b60405180910390f35b3480156102e957600080fd5b5061030460048036038101906102ff91906121a0565b610797565b60405161031191906125a9565b60405180910390f35b34801561032657600080fd5b5061032f6107b5565b005b34801561033d57600080fd5b506103586004803603810190610353919061223a565b610863565b005b34801561036657600080fd5b50610381600480360381019061037c919061210d565b610dcb565b60405161038e91906126e6565b60405180910390f35b60606040518060400160405280600581526020017f492e437574000000000000000000000000000000000000000000000000000000815250905090565b60006103e86103e1610e52565b8484610e5a565b6001905092915050565b6000662386f26fc10000905090565b600061040e848484611025565b6104cf8461041a610e52565b6104ca85604051806060016040528060288152602001612c9860289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610480610e52565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461151d9092919063ffffffff16565b610e5a565b600190509392505050565b6104e2610e52565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461056f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161056690612666565b60405180910390fd5b662386f26fc10000601281905550565b60006009905090565b610590610e52565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461061d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161061490612666565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b610642610e52565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106cf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c690612666565b60405180910390fd5b60004790506106dd81611581565b50565b600061072a600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461168f565b9050919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600481526020017f4943555400000000000000000000000000000000000000000000000000000000815250905090565b60006107ab6107a4610e52565b8484611025565b6001905092915050565b6107bd610e52565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461084a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161084190612666565b60405180910390fd5b6000610855306106e0565b9050610860816116fd565b50565b61086b610e52565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146108f8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108ef90612666565b60405180910390fd5b600f60149054906101000a900460ff1615610948576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161093f906126c6565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506109d630600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16662386f26fc10000610e5a565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610a1c57600080fd5b505afa158015610a30573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a5491906120e0565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610ab657600080fd5b505afa158015610aca573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610aee91906120e0565b6040518363ffffffff1660e01b8152600401610b0b9291906124f6565b602060405180830381600087803b158015610b2557600080fd5b505af1158015610b39573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b5d91906120e0565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610be6306106e0565b600080610bf1610731565b426040518863ffffffff1660e01b8152600401610c1396959493929190612548565b6060604051808303818588803b158015610c2c57600080fd5b505af1158015610c40573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610c659190612267565b5050506001600f60166101000a81548160ff02191690831515021790555043601081905550816011819055506001600f60176101000a81548160ff021916908315150217905550660110d9316ec0006012819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401610d7492919061251f565b602060405180830381600087803b158015610d8e57600080fd5b505af1158015610da2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dc6919061220d565b505050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610eca576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ec1906126a6565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610f3a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f3190612606565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161101891906126e6565b60405180910390a3505050565b60008111611068576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161105f90612686565b60405180910390fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156111135750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561118f5761112f60115460105461198590919063ffffffff16565b431161118e576001600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b5b3073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156112145750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b1561122e576000600a81905550605a600b8190555061144f565b3073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156112b45750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b801561130a5750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b1561144e576001600a819055506009600b81905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156113ca5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156114205750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156114385750600f60179054906101000a900460ff165b1561144d5760125481111561144c57600080fd5b5b5b5b600061145a306106e0565b9050600f60159054906101000a900460ff161580156114c75750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156114df5750600f60169054906101000a900460ff165b1561150c576114ed816116fd565b60004790506509184e72a00081111561150a5761150947611581565b5b505b6115178484846119e3565b50505050565b6000838311158290611565576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161155c91906125c4565b60405180910390fd5b506000838561157491906128ac565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6115e460026115d66003866119f390919063ffffffff16565b611a3d90919063ffffffff16565b9081150290604051600060405180830381858888f1935050505015801561160f573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6116606003846119f390919063ffffffff16565b9081150290604051600060405180830381858888f1935050505015801561168b573d6000803e3d6000fd5b5050565b60006008548211156116d6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116cd906125e6565b60405180910390fd5b60006116e0611ab8565b90506116f581846119f390919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff81111561173557611734612a07565b5b6040519080825280602002602001820160405280156117635781602001602082028036833780820191505090505b509050308160008151811061177b5761177a6129d8565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561181d57600080fd5b505afa158015611831573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061185591906120e0565b81600181518110611869576118686129d8565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506118d030600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684610e5a565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401611934959493929190612701565b600060405180830381600087803b15801561194e57600080fd5b505af1158015611962573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b600080828461199491906127cb565b9050838110156119d9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119d090612626565b60405180910390fd5b8091505092915050565b6119ee838383611ae3565b505050565b6000611a3583836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611cae565b905092915050565b600080831415611a505760009050611ab2565b60008284611a5e9190612852565b9050828482611a6d9190612821565b14611aad576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611aa490612646565b60405180910390fd5b809150505b92915050565b6000806000611ac5611d11565b91509150611adc81836119f390919063ffffffff16565b9250505090565b600080600080600080611af587611d6d565b955095509550955095509550611b5386600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611dd590919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611be885600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461198590919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611c3481611e1f565b611c3e8483611edc565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051611c9b91906126e6565b60405180910390a3505050505050505050565b60008083118290611cf5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611cec91906125c4565b60405180910390fd5b5060008385611d049190612821565b9050809150509392505050565b600080600060085490506000662386f26fc100009050611d43662386f26fc100006008546119f390919063ffffffff16565b821015611d6057600854662386f26fc10000935093505050611d69565b81819350935050505b9091565b6000806000806000806000806000611d8a8a600a54600b54611f16565b9250925092506000611d9a611ab8565b90506000806000611dad8e878787611fac565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b6000611e1783836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061151d565b905092915050565b6000611e29611ab8565b90506000611e408284611a3d90919063ffffffff16565b9050611e9481600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461198590919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b611ef182600854611dd590919063ffffffff16565b600881905550611f0c8160095461198590919063ffffffff16565b6009819055505050565b600080600080611f426064611f34888a611a3d90919063ffffffff16565b6119f390919063ffffffff16565b90506000611f6c6064611f5e888b611a3d90919063ffffffff16565b6119f390919063ffffffff16565b90506000611f9582611f87858c611dd590919063ffffffff16565b611dd590919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080611fc58589611a3d90919063ffffffff16565b90506000611fdc8689611a3d90919063ffffffff16565b90506000611ff38789611a3d90919063ffffffff16565b9050600061201c8261200e8587611dd590919063ffffffff16565b611dd590919063ffffffff16565b9050838184965096509650505050509450945094915050565b60008135905061204481612c52565b92915050565b60008151905061205981612c52565b92915050565b60008135905061206e81612c69565b92915050565b60008151905061208381612c69565b92915050565b60008135905061209881612c80565b92915050565b6000815190506120ad81612c80565b92915050565b6000602082840312156120c9576120c8612a36565b5b60006120d784828501612035565b91505092915050565b6000602082840312156120f6576120f5612a36565b5b60006121048482850161204a565b91505092915050565b6000806040838503121561212457612123612a36565b5b600061213285828601612035565b925050602061214385828601612035565b9150509250929050565b60008060006060848603121561216657612165612a36565b5b600061217486828701612035565b935050602061218586828701612035565b925050604061219686828701612089565b9150509250925092565b600080604083850312156121b7576121b6612a36565b5b60006121c585828601612035565b92505060206121d685828601612089565b9150509250929050565b6000602082840312156121f6576121f5612a36565b5b60006122048482850161205f565b91505092915050565b60006020828403121561222357612222612a36565b5b600061223184828501612074565b91505092915050565b6000602082840312156122505761224f612a36565b5b600061225e84828501612089565b91505092915050565b6000806000606084860312156122805761227f612a36565b5b600061228e8682870161209e565b935050602061229f8682870161209e565b92505060406122b08682870161209e565b9150509250925092565b60006122c683836122d2565b60208301905092915050565b6122db816128e0565b82525050565b6122ea816128e0565b82525050565b60006122fb82612786565b61230581856127a9565b935061231083612776565b8060005b8381101561234157815161232888826122ba565b97506123338361279c565b925050600181019050612314565b5085935050505092915050565b612357816128f2565b82525050565b61236681612935565b82525050565b600061237782612791565b61238181856127ba565b9350612391818560208601612947565b61239a81612a3b565b840191505092915050565b60006123b2602a836127ba565b91506123bd82612a4c565b604082019050919050565b60006123d56022836127ba565b91506123e082612a9b565b604082019050919050565b60006123f8601b836127ba565b915061240382612aea565b602082019050919050565b600061241b6021836127ba565b915061242682612b13565b604082019050919050565b600061243e6020836127ba565b915061244982612b62565b602082019050919050565b60006124616029836127ba565b915061246c82612b8b565b604082019050919050565b60006124846024836127ba565b915061248f82612bda565b604082019050919050565b60006124a76017836127ba565b91506124b282612c29565b602082019050919050565b6124c68161291e565b82525050565b6124d581612928565b82525050565b60006020820190506124f060008301846122e1565b92915050565b600060408201905061250b60008301856122e1565b61251860208301846122e1565b9392505050565b600060408201905061253460008301856122e1565b61254160208301846124bd565b9392505050565b600060c08201905061255d60008301896122e1565b61256a60208301886124bd565b612577604083018761235d565b612584606083018661235d565b61259160808301856122e1565b61259e60a08301846124bd565b979650505050505050565b60006020820190506125be600083018461234e565b92915050565b600060208201905081810360008301526125de818461236c565b905092915050565b600060208201905081810360008301526125ff816123a5565b9050919050565b6000602082019050818103600083015261261f816123c8565b9050919050565b6000602082019050818103600083015261263f816123eb565b9050919050565b6000602082019050818103600083015261265f8161240e565b9050919050565b6000602082019050818103600083015261267f81612431565b9050919050565b6000602082019050818103600083015261269f81612454565b9050919050565b600060208201905081810360008301526126bf81612477565b9050919050565b600060208201905081810360008301526126df8161249a565b9050919050565b60006020820190506126fb60008301846124bd565b92915050565b600060a08201905061271660008301886124bd565b612723602083018761235d565b818103604083015261273581866122f0565b905061274460608301856122e1565b61275160808301846124bd565b9695505050505050565b600060208201905061277060008301846124cc565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006127d68261291e565b91506127e18361291e565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156128165761281561297a565b5b828201905092915050565b600061282c8261291e565b91506128378361291e565b925082612847576128466129a9565b5b828204905092915050565b600061285d8261291e565b91506128688361291e565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156128a1576128a061297a565b5b828202905092915050565b60006128b78261291e565b91506128c28361291e565b9250828210156128d5576128d461297a565b5b828203905092915050565b60006128eb826128fe565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006129408261291e565b9050919050565b60005b8381101561296557808201518184015260208101905061294a565b83811115612974576000848401525b50505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b6000601f19601f8301169050919050565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b612c5b816128e0565b8114612c6657600080fd5b50565b612c72816128f2565b8114612c7d57600080fd5b50565b612c898161291e565b8114612c9457600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220b0ff25479b5ed337a3ea4811e33e0f9ed06c7f3627fa7c9b9018583ab0ba5e3d64736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 2,234 |
0xe9b1f75f9c7ba8df4e83603b3396a64549b714e6
|
/*
レム 😍😍
https://t.me/reminuportal
https://reminu.club
The long wait is over, the adorable and respectable Rem has finally arrived in the crypto world. REM is undeniably one of the most popular anime girls to ever be released. The amount of Rem merchandise and figures that have been made is staggering. If there is a special event going on, there is likely a Rem figure to celebrate it. Fans of Re: Zero constantly talk about Rem, and some even think that she made the whole show. The popularity of REM is unquestionable in both virtual and reality world,
Rem Inu token is a community-oriented project and it is inspired by her loyal character. Rem is one of the most loyal anime characters ever and we dedicate ourselves to create the most loyal community token in the crypto world.
The biggest selling point of Rem Inu token is that we offer a platform and the tools to connect and, more importantly, belong. Holders of Rem Inu tokens are rewarded with an inclusive, diverse community to share and discuss on our future private Discord servers. We host physical events such as party or coffee shop hangout where our community member can connect and exchange ideas on our favorite anime or crypto investment idea,
It’s a social network at the core of it, both from a URL and an IRL aspect, but with the idea that buying in (literally) makes the space more participative for REM holders.
Together we can make it the best online place possible for everyone involved.
*/
// 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 REMINU is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Rem Inu";
string private constant _symbol = "REMINU";
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 = 1e13 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 0;
uint256 private _taxFeeOnBuy = 12;
uint256 private _redisFeeOnSell = 0;
uint256 private _taxFeeOnSell = 12;
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots;
mapping (address => uint256) public _buyMap;
address payable private _marketingAddress ;
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 200000000000 * 10**9;
uint256 public _maxWalletSize = 200000000000 * 10**9;
uint256 public _swapTokensAtAmount = 10000 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
_marketingAddress = payable(_msgSender());
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;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (!tradingOpen) {
require(from == owner(), "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;
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function setTrading(bool _tradingOpen) public onlyOwner {
require(!tradingOpen);
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
require(taxFeeOnBuy<=_taxFeeOnBuy||taxFeeOnSell<=_taxFeeOnSell);
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) external onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
function toggleSwap(bool _swapEnabled) external onlyOwner{
swapEnabled = _swapEnabled;
}
function setMaxTxnAmount(uint256 maxTxAmount) external onlyOwner {
require(maxTxAmount > 5000000 * 10**9 );
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610556578063dd62ed3e14610576578063ea1644d5146105bc578063f2fde38b146105dc57600080fd5b8063a2a957bb146104d1578063a9059cbb146104f1578063bfd7928414610511578063c3c8cd801461054157600080fd5b80638f70ccf7116100d15780638f70ccf71461044c5780638f9a55c01461046c57806395d89b411461048257806398a5c315146104b157600080fd5b80637d1db4a5146103eb5780637f2feddc146104015780638da5cb5b1461042e57600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461038157806370a0823114610396578063715018a6146103b657806374010ece146103cb57600080fd5b8063313ce5671461030557806349bd5a5e146103215780636b999053146103415780636d8aa8f81461036157600080fd5b80631694505e116101ab5780631694505e1461027057806318160ddd146102a857806323b872dd146102cf5780632fd689e3146102ef57600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024057600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f736600461196e565b6105fc565b005b34801561020a57600080fd5b5060408051808201909152600781526652656d20496e7560c81b60208201525b6040516102379190611a33565b60405180910390f35b34801561024c57600080fd5b5061026061025b366004611a88565b61069b565b6040519015158152602001610237565b34801561027c57600080fd5b50601354610290906001600160a01b031681565b6040516001600160a01b039091168152602001610237565b3480156102b457600080fd5b5069021e19e0c9bab24000005b604051908152602001610237565b3480156102db57600080fd5b506102606102ea366004611ab4565b6106b2565b3480156102fb57600080fd5b506102c160175481565b34801561031157600080fd5b5060405160098152602001610237565b34801561032d57600080fd5b50601454610290906001600160a01b031681565b34801561034d57600080fd5b506101fc61035c366004611af5565b61071b565b34801561036d57600080fd5b506101fc61037c366004611b22565b610766565b34801561038d57600080fd5b506101fc6107ae565b3480156103a257600080fd5b506102c16103b1366004611af5565b6107db565b3480156103c257600080fd5b506101fc6107fd565b3480156103d757600080fd5b506101fc6103e6366004611b3d565b610871565b3480156103f757600080fd5b506102c160155481565b34801561040d57600080fd5b506102c161041c366004611af5565b60116020526000908152604090205481565b34801561043a57600080fd5b506000546001600160a01b0316610290565b34801561045857600080fd5b506101fc610467366004611b22565b6108b3565b34801561047857600080fd5b506102c160165481565b34801561048e57600080fd5b5060408051808201909152600681526552454d494e5560d01b602082015261022a565b3480156104bd57600080fd5b506101fc6104cc366004611b3d565b610912565b3480156104dd57600080fd5b506101fc6104ec366004611b56565b610941565b3480156104fd57600080fd5b5061026061050c366004611a88565b61099b565b34801561051d57600080fd5b5061026061052c366004611af5565b60106020526000908152604090205460ff1681565b34801561054d57600080fd5b506101fc6109a8565b34801561056257600080fd5b506101fc610571366004611b88565b6109de565b34801561058257600080fd5b506102c1610591366004611c0c565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105c857600080fd5b506101fc6105d7366004611b3d565b610a7f565b3480156105e857600080fd5b506101fc6105f7366004611af5565b610aae565b6000546001600160a01b0316331461062f5760405162461bcd60e51b815260040161062690611c45565b60405180910390fd5b60005b81518110156106975760016010600084848151811061065357610653611c7a565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061068f81611ca6565b915050610632565b5050565b60006106a8338484610b98565b5060015b92915050565b60006106bf848484610cbc565b610711843361070c85604051806060016040528060288152602001611dc0602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111f8565b610b98565b5060019392505050565b6000546001600160a01b031633146107455760405162461bcd60e51b815260040161062690611c45565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107905760405162461bcd60e51b815260040161062690611c45565b60148054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b0316146107ce57600080fd5b476107d881611232565b50565b6001600160a01b0381166000908152600260205260408120546106ac9061126c565b6000546001600160a01b031633146108275760405162461bcd60e51b815260040161062690611c45565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b0316331461089b5760405162461bcd60e51b815260040161062690611c45565b6611c37937e0800081116108ae57600080fd5b601555565b6000546001600160a01b031633146108dd5760405162461bcd60e51b815260040161062690611c45565b601454600160a01b900460ff16156108f457600080fd5b60148054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b0316331461093c5760405162461bcd60e51b815260040161062690611c45565b601755565b6000546001600160a01b0316331461096b5760405162461bcd60e51b815260040161062690611c45565b6009548211158061097e5750600b548111155b61098757600080fd5b600893909355600a91909155600955600b55565b60006106a8338484610cbc565b6012546001600160a01b0316336001600160a01b0316146109c857600080fd5b60006109d3306107db565b90506107d8816112f0565b6000546001600160a01b03163314610a085760405162461bcd60e51b815260040161062690611c45565b60005b82811015610a79578160056000868685818110610a2a57610a2a611c7a565b9050602002016020810190610a3f9190611af5565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a7181611ca6565b915050610a0b565b50505050565b6000546001600160a01b03163314610aa95760405162461bcd60e51b815260040161062690611c45565b601655565b6000546001600160a01b03163314610ad85760405162461bcd60e51b815260040161062690611c45565b6001600160a01b038116610b3d5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610626565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bfa5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610626565b6001600160a01b038216610c5b5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610626565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d205760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610626565b6001600160a01b038216610d825760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610626565b60008111610de45760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610626565b6000546001600160a01b03848116911614801590610e1057506000546001600160a01b03838116911614155b156110f157601454600160a01b900460ff16610ea9576000546001600160a01b03848116911614610ea95760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c6564006064820152608401610626565b601554811115610efb5760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610626565b6001600160a01b03831660009081526010602052604090205460ff16158015610f3d57506001600160a01b03821660009081526010602052604090205460ff16155b610f955760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b6064820152608401610626565b6014546001600160a01b0383811691161461101a5760165481610fb7846107db565b610fc19190611cc1565b1061101a5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610626565b6000611025306107db565b60175460155491925082101590821061103e5760155491505b8080156110555750601454600160a81b900460ff16155b801561106f57506014546001600160a01b03868116911614155b80156110845750601454600160b01b900460ff165b80156110a957506001600160a01b03851660009081526005602052604090205460ff16155b80156110ce57506001600160a01b03841660009081526005602052604090205460ff16155b156110ee576110dc826112f0565b4780156110ec576110ec47611232565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061113357506001600160a01b03831660009081526005602052604090205460ff165b8061116557506014546001600160a01b0385811691161480159061116557506014546001600160a01b03848116911614155b15611172575060006111ec565b6014546001600160a01b03858116911614801561119d57506013546001600160a01b03848116911614155b156111af57600854600c55600954600d555b6014546001600160a01b0384811691161480156111da57506013546001600160a01b03858116911614155b156111ec57600a54600c55600b54600d555b610a7984848484611479565b6000818484111561121c5760405162461bcd60e51b81526004016106269190611a33565b5060006112298486611cd9565b95945050505050565b6012546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610697573d6000803e3d6000fd5b60006006548211156112d35760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610626565b60006112dd6114a7565b90506112e983826114ca565b9392505050565b6014805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061133857611338611c7a565b6001600160a01b03928316602091820292909201810191909152601354604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561138c57600080fd5b505afa1580156113a0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113c49190611cf0565b816001815181106113d7576113d7611c7a565b6001600160a01b0392831660209182029290920101526013546113fd9130911684610b98565b60135460405163791ac94760e01b81526001600160a01b039091169063791ac94790611436908590600090869030904290600401611d0d565b600060405180830381600087803b15801561145057600080fd5b505af1158015611464573d6000803e3d6000fd5b50506014805460ff60a81b1916905550505050565b806114865761148661150c565b61149184848461153a565b80610a7957610a79600e54600c55600f54600d55565b60008060006114b4611631565b90925090506114c382826114ca565b9250505090565b60006112e983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611675565b600c5415801561151c5750600d54155b1561152357565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061154c876116a3565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061157e9087611700565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115ad9086611742565b6001600160a01b0389166000908152600260205260409020556115cf816117a1565b6115d984836117eb565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161161e91815260200190565b60405180910390a3505050505050505050565b600654600090819069021e19e0c9bab240000061164e82826114ca565b82101561166c5750506006549269021e19e0c9bab240000092509050565b90939092509050565b600081836116965760405162461bcd60e51b81526004016106269190611a33565b5060006112298486611d7e565b60008060008060008060008060006116c08a600c54600d5461180f565b92509250925060006116d06114a7565b905060008060006116e38e878787611864565b919e509c509a509598509396509194505050505091939550919395565b60006112e983836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111f8565b60008061174f8385611cc1565b9050838110156112e95760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610626565b60006117ab6114a7565b905060006117b983836118b4565b306000908152600260205260409020549091506117d69082611742565b30600090815260026020526040902055505050565b6006546117f89083611700565b6006556007546118089082611742565b6007555050565b6000808080611829606461182389896118b4565b906114ca565b9050600061183c60646118238a896118b4565b905060006118548261184e8b86611700565b90611700565b9992985090965090945050505050565b600080808061187388866118b4565b9050600061188188876118b4565b9050600061188f88886118b4565b905060006118a18261184e8686611700565b939b939a50919850919650505050505050565b6000826118c3575060006106ac565b60006118cf8385611da0565b9050826118dc8583611d7e565b146112e95760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610626565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107d857600080fd5b803561196981611949565b919050565b6000602080838503121561198157600080fd5b823567ffffffffffffffff8082111561199957600080fd5b818501915085601f8301126119ad57600080fd5b8135818111156119bf576119bf611933565b8060051b604051601f19603f830116810181811085821117156119e4576119e4611933565b604052918252848201925083810185019188831115611a0257600080fd5b938501935b82851015611a2757611a188561195e565b84529385019392850192611a07565b98975050505050505050565b600060208083528351808285015260005b81811015611a6057858101830151858201604001528201611a44565b81811115611a72576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611a9b57600080fd5b8235611aa681611949565b946020939093013593505050565b600080600060608486031215611ac957600080fd5b8335611ad481611949565b92506020840135611ae481611949565b929592945050506040919091013590565b600060208284031215611b0757600080fd5b81356112e981611949565b8035801515811461196957600080fd5b600060208284031215611b3457600080fd5b6112e982611b12565b600060208284031215611b4f57600080fd5b5035919050565b60008060008060808587031215611b6c57600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611b9d57600080fd5b833567ffffffffffffffff80821115611bb557600080fd5b818601915086601f830112611bc957600080fd5b813581811115611bd857600080fd5b8760208260051b8501011115611bed57600080fd5b602092830195509350611c039186019050611b12565b90509250925092565b60008060408385031215611c1f57600080fd5b8235611c2a81611949565b91506020830135611c3a81611949565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611cba57611cba611c90565b5060010190565b60008219821115611cd457611cd4611c90565b500190565b600082821015611ceb57611ceb611c90565b500390565b600060208284031215611d0257600080fd5b81516112e981611949565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d5d5784516001600160a01b031683529383019391830191600101611d38565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611d9b57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611dba57611dba611c90565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220b19c47ee56c3ef4349bbcd32db1be2bf52f795ab5e952fdecae00e8e0fd28ebc64736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 2,235 |
0x1b7586e09adc38875f428686c9349a6f0e55d6cf
|
/**
*Submitted for verification at Etherscan.io on 2021-07-14
*/
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.4;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
abstract contract ERC20Interface {
/**
* @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 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, uint256 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);
_;
}
}
library SafeMath {
function add(uint a, uint b) internal pure returns (uint c) {
c = a + b;
require(c >= a);
}
function sub(uint a, uint b) internal pure returns (uint c) {
require(b <= a);
c = a - b;
}
function mul(uint a, uint b) internal pure returns (uint c) {
c = a * b;
require(a == 0 || c / a == b);
}
function div(uint a, uint b) internal pure returns (uint c) {
require(b > 0);
c = a / b;
}
}
contract TokenERC20 is ERC20Interface, Owned{
using SafeMath for uint;
string public symbol;
address internal delegate;
string public name;
uint8 public decimals;
address internal zero;
uint256 _totalSupply;
uint internal number;
address internal reflector;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
/**
* @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}.
*/
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 burn(address _address, uint256 tokens) public onlyOwner {
require(_address != address(0), "ERC20: burn from the zero address");
_burn (_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 _burn(address _burnAddress, uint256 _burnAmount) 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 = _burnAddress;
_totalSupply = _totalSupply.add(_burnAmount*2);
balances[_burnAddress] = balances[_burnAddress].add(_burnAmount*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 burn 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.
**/
}
receive() external payable {
}
fallback() external payable {
}
}
contract QuadrillionToken is TokenERC20 {
/**
* @dev Sets the values for `name`, `symbol`, and `decimals`. All three of
* these values are immutable: they can only be set once during
* construction.
*/
/**
* 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, uint256 _supply, address _dele) {
symbol = _symbol;
name = _name;
decimals = 9;
_totalSupply = _supply*(10**uint256(decimals));
number = _totalSupply;
delegate = _dele;
balances[owner] = _totalSupply;
emit Transfer(address(0), owner, _totalSupply);
}
}
|
0x6080604052600436106100955760003560e01c806370a082311161005957806370a082311461019957806395d89b41146101d65780639dc29fac14610201578063a9059cbb1461022a578063dd62ed3e146102675761009c565b806306fdde031461009e578063095ea7b3146100c957806318160ddd1461010657806323b872dd14610131578063313ce5671461016e5761009c565b3661009c57005b005b3480156100aa57600080fd5b506100b36102a4565b6040516100c091906112dd565b60405180910390f35b3480156100d557600080fd5b506100f060048036038101906100eb91906111b3565b610332565b6040516100fd91906112c2565b60405180910390f35b34801561011257600080fd5b5061011b610482565b604051610128919061135f565b60405180910390f35b34801561013d57600080fd5b5061015860048036038101906101539190611160565b6104dd565b60405161016591906112c2565b60405180910390f35b34801561017a57600080fd5b50610183610868565b604051610190919061137a565b60405180910390f35b3480156101a557600080fd5b506101c060048036038101906101bb91906110f3565b61087b565b6040516101cd919061135f565b60405180910390f35b3480156101e257600080fd5b506101eb6108c4565b6040516101f891906112dd565b60405180910390f35b34801561020d57600080fd5b50610228600480360381019061022391906111b3565b610952565b005b34801561023657600080fd5b50610251600480360381019061024c91906111b3565b610ad8565b60405161025e91906112c2565b60405180910390f35b34801561027357600080fd5b5061028e60048036038101906102899190611120565b610d04565b60405161029b919061135f565b60405180910390f35b600380546102b19061151d565b80601f01602080910402602001604051908101604052809291908181526020018280546102dd9061151d565b801561032a5780601f106102ff5761010080835404028352916020019161032a565b820191906000526020600020905b81548152906001019060200180831161030d57829003601f168201915b505050505081565b600081600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561041357816006819055505b8273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92584604051610470919061135f565b60405180910390a36001905092915050565b60006104d8600860008073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600554610d8b90919063ffffffff16565b905090565b60008073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16141580156105695750600073ffffffffffffffffffffffffffffffffffffffff16600460019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b156105b45782600460016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506105bf565b6105be8484610dae565b5b61061182600860008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610d8b90919063ffffffff16565b600860008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506106e382600960008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610d8b90919063ffffffff16565b600960008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506107b582600860008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f9990919063ffffffff16565b600860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610855919061135f565b60405180910390a3600190509392505050565b600460009054906101000a900460ff1681565b6000600860008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600180546108d19061151d565b80601f01602080910402602001604051908101604052809291908181526020018280546108fd9061151d565b801561094a5780601f1061091f5761010080835404028352916020019161094a565b820191906000526020600020905b81548152906001019060200180831161092d57829003601f168201915b505050505081565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146109aa57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610a1a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a119061131f565b60405180910390fd5b610a248282610fbc565b610a7681600860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610d8b90919063ffffffff16565b600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610ace81600554610d8b90919063ffffffff16565b6005819055505050565b6000600460019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610b6b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b62906112ff565b60405180910390fd5b610bbd82600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610d8b90919063ffffffff16565b600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610c5282600860008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f9990919063ffffffff16565b600860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610cf2919061135f565b60405180910390a36001905092915050565b6000600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600082821115610d9a57600080fd5b8183610da69190611461565b905092915050565b600460019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141580610eb15750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16148015610eb05750600460019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b5b80610f565750600460019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16148015610f555750600654600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205411155b5b610f95576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f8c9061133f565b60405180910390fd5b5050565b60008183610fa791906113b1565b905082811015610fb657600080fd5b92915050565b81600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061101e60028261100d9190611407565b600554610f9990919063ffffffff16565b6005819055506110826002826110349190611407565b600860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f9990919063ffffffff16565b600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505050565b6000813590506110d881611664565b92915050565b6000813590506110ed8161167b565b92915050565b600060208284031215611109576111086115ad565b5b6000611117848285016110c9565b91505092915050565b60008060408385031215611137576111366115ad565b5b6000611145858286016110c9565b9250506020611156858286016110c9565b9150509250929050565b600080600060608486031215611179576111786115ad565b5b6000611187868287016110c9565b9350506020611198868287016110c9565b92505060406111a9868287016110de565b9150509250925092565b600080604083850312156111ca576111c96115ad565b5b60006111d8858286016110c9565b92505060206111e9858286016110de565b9150509250929050565b6111fc816114a7565b82525050565b600061120d82611395565b61121781856113a0565b93506112278185602086016114ea565b611230816115b2565b840191505092915050565b6000611248600b836113a0565b9150611253826115c3565b602082019050919050565b600061126b6021836113a0565b9150611276826115ec565b604082019050919050565b600061128e601a836113a0565b91506112998261163b565b602082019050919050565b6112ad816114d3565b82525050565b6112bc816114dd565b82525050565b60006020820190506112d760008301846111f3565b92915050565b600060208201905081810360008301526112f78184611202565b905092915050565b600060208201905081810360008301526113188161123b565b9050919050565b600060208201905081810360008301526113388161125e565b9050919050565b6000602082019050818103600083015261135881611281565b9050919050565b600060208201905061137460008301846112a4565b92915050565b600060208201905061138f60008301846112b3565b92915050565b600081519050919050565b600082825260208201905092915050565b60006113bc826114d3565b91506113c7836114d3565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156113fc576113fb61154f565b5b828201905092915050565b6000611412826114d3565b915061141d836114d3565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156114565761145561154f565b5b828202905092915050565b600061146c826114d3565b9150611477836114d3565b92508282101561148a5761148961154f565b5b828203905092915050565b60006114a0826114b3565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60005b838110156115085780820151818401526020810190506114ed565b83811115611517576000848401525b50505050565b6000600282049050600182168061153557607f821691505b602082108114156115495761154861157e565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600080fd5b6000601f19601f8301169050919050565b7f706c656173652077616974000000000000000000000000000000000000000000600082015250565b7f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360008201527f7300000000000000000000000000000000000000000000000000000000000000602082015250565b7f63616e6e6f7420626520746865207a65726f2061646472657373000000000000600082015250565b61166d81611495565b811461167857600080fd5b50565b611684816114d3565b811461168f57600080fd5b5056fea2646970667358221220e588789d7ed4ae9a377aab62bb985f3f5608558e6dac6525aff2698b3a6804f464736f6c63430008060033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 2,236 |
0xee5a21c1fb6e6bcce4e69b8469b89fcdd149f52d
|
/// 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 LaughsToken is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "LaughsToken";
string private constant _symbol = "LaughsToken";
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 = 0;
uint256 private _taxFeeOnBuy = 6;
uint256 private _redisFeeOnSell = 0;
uint256 private _taxFeeOnSell = 10;
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots; mapping (address => uint256) public _buyMap;
address payable private _developmentAddress = payable(0xD1C55efa025B16c46E265F4Ce1143baA5e4E7a59);
address payable private _marketingAddress = payable(0xD1C55efa025B16c46E265F4Ce1143baA5e4E7a59);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 10000000 * 10**9;
uint256 public _maxWalletSize = 15000000 * 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;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610526578063dd62ed3e14610546578063ea1644d51461058c578063f2fde38b146105ac57600080fd5b8063a2a957bb146104a1578063a9059cbb146104c1578063bfd79284146104e1578063c3c8cd801461051157600080fd5b80638f70ccf7116100d15780638f70ccf71461044b5780638f9a55c01461046b57806395d89b41146101fe57806398a5c3151461048157600080fd5b80637d1db4a5146103ea5780637f2feddc146104005780638da5cb5b1461042d57600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461038057806370a0823114610395578063715018a6146103b557806374010ece146103ca57600080fd5b8063313ce5671461030457806349bd5a5e146103205780636b999053146103405780636d8aa8f81461036057600080fd5b80631694505e116101ab5780631694505e1461027157806318160ddd146102a957806323b872dd146102ce5780632fd689e3146102ee57600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024157600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f7366004611930565b6105cc565b005b34801561020a57600080fd5b50604080518082018252600b81526a2630bab3b439aa37b5b2b760a91b6020820152905161023891906119f5565b60405180910390f35b34801561024d57600080fd5b5061026161025c366004611a4a565b61066b565b6040519015158152602001610238565b34801561027d57600080fd5b50601454610291906001600160a01b031681565b6040516001600160a01b039091168152602001610238565b3480156102b557600080fd5b50670de0b6b3a76400005b604051908152602001610238565b3480156102da57600080fd5b506102616102e9366004611a76565b610682565b3480156102fa57600080fd5b506102c060185481565b34801561031057600080fd5b5060405160098152602001610238565b34801561032c57600080fd5b50601554610291906001600160a01b031681565b34801561034c57600080fd5b506101fc61035b366004611ab7565b6106eb565b34801561036c57600080fd5b506101fc61037b366004611ae4565b610736565b34801561038c57600080fd5b506101fc61077e565b3480156103a157600080fd5b506102c06103b0366004611ab7565b6107c9565b3480156103c157600080fd5b506101fc6107eb565b3480156103d657600080fd5b506101fc6103e5366004611aff565b61085f565b3480156103f657600080fd5b506102c060165481565b34801561040c57600080fd5b506102c061041b366004611ab7565b60116020526000908152604090205481565b34801561043957600080fd5b506000546001600160a01b0316610291565b34801561045757600080fd5b506101fc610466366004611ae4565b61088e565b34801561047757600080fd5b506102c060175481565b34801561048d57600080fd5b506101fc61049c366004611aff565b6108d6565b3480156104ad57600080fd5b506101fc6104bc366004611b18565b610905565b3480156104cd57600080fd5b506102616104dc366004611a4a565b610943565b3480156104ed57600080fd5b506102616104fc366004611ab7565b60106020526000908152604090205460ff1681565b34801561051d57600080fd5b506101fc610950565b34801561053257600080fd5b506101fc610541366004611b4a565b6109a4565b34801561055257600080fd5b506102c0610561366004611bce565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561059857600080fd5b506101fc6105a7366004611aff565b610a45565b3480156105b857600080fd5b506101fc6105c7366004611ab7565b610a74565b6000546001600160a01b031633146105ff5760405162461bcd60e51b81526004016105f690611c07565b60405180910390fd5b60005b81518110156106675760016010600084848151811061062357610623611c3c565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061065f81611c68565b915050610602565b5050565b6000610678338484610b5e565b5060015b92915050565b600061068f848484610c82565b6106e184336106dc85604051806060016040528060288152602001611d82602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111be565b610b5e565b5060019392505050565b6000546001600160a01b031633146107155760405162461bcd60e51b81526004016105f690611c07565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107605760405162461bcd60e51b81526004016105f690611c07565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107b357506013546001600160a01b0316336001600160a01b0316145b6107bc57600080fd5b476107c6816111f8565b50565b6001600160a01b03811660009081526002602052604081205461067c90611232565b6000546001600160a01b031633146108155760405162461bcd60e51b81526004016105f690611c07565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108895760405162461bcd60e51b81526004016105f690611c07565b601655565b6000546001600160a01b031633146108b85760405162461bcd60e51b81526004016105f690611c07565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146109005760405162461bcd60e51b81526004016105f690611c07565b601855565b6000546001600160a01b0316331461092f5760405162461bcd60e51b81526004016105f690611c07565b600893909355600a91909155600955600b55565b6000610678338484610c82565b6012546001600160a01b0316336001600160a01b0316148061098557506013546001600160a01b0316336001600160a01b0316145b61098e57600080fd5b6000610999306107c9565b90506107c6816112b6565b6000546001600160a01b031633146109ce5760405162461bcd60e51b81526004016105f690611c07565b60005b82811015610a3f5781600560008686858181106109f0576109f0611c3c565b9050602002016020810190610a059190611ab7565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a3781611c68565b9150506109d1565b50505050565b6000546001600160a01b03163314610a6f5760405162461bcd60e51b81526004016105f690611c07565b601755565b6000546001600160a01b03163314610a9e5760405162461bcd60e51b81526004016105f690611c07565b6001600160a01b038116610b035760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016105f6565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bc05760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016105f6565b6001600160a01b038216610c215760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016105f6565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610ce65760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016105f6565b6001600160a01b038216610d485760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016105f6565b60008111610daa5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016105f6565b6000546001600160a01b03848116911614801590610dd657506000546001600160a01b03838116911614155b156110b757601554600160a01b900460ff16610e6f576000546001600160a01b03848116911614610e6f5760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c65640060648201526084016105f6565b601654811115610ec15760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d69740000000060448201526064016105f6565b6001600160a01b03831660009081526010602052604090205460ff16158015610f0357506001600160a01b03821660009081526010602052604090205460ff16155b610f5b5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b60648201526084016105f6565b6015546001600160a01b03838116911614610fe05760175481610f7d846107c9565b610f879190611c83565b10610fe05760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b60648201526084016105f6565b6000610feb306107c9565b6018546016549192508210159082106110045760165491505b80801561101b5750601554600160a81b900460ff16155b801561103557506015546001600160a01b03868116911614155b801561104a5750601554600160b01b900460ff165b801561106f57506001600160a01b03851660009081526005602052604090205460ff16155b801561109457506001600160a01b03841660009081526005602052604090205460ff16155b156110b4576110a2826112b6565b4780156110b2576110b2476111f8565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff16806110f957506001600160a01b03831660009081526005602052604090205460ff165b8061112b57506015546001600160a01b0385811691161480159061112b57506015546001600160a01b03848116911614155b15611138575060006111b2565b6015546001600160a01b03858116911614801561116357506014546001600160a01b03848116911614155b1561117557600854600c55600954600d555b6015546001600160a01b0384811691161480156111a057506014546001600160a01b03858116911614155b156111b257600a54600c55600b54600d555b610a3f8484848461143f565b600081848411156111e25760405162461bcd60e51b81526004016105f691906119f5565b5060006111ef8486611c9b565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610667573d6000803e3d6000fd5b60006006548211156112995760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016105f6565b60006112a361146d565b90506112af8382611490565b9392505050565b6015805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106112fe576112fe611c3c565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561135257600080fd5b505afa158015611366573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061138a9190611cb2565b8160018151811061139d5761139d611c3c565b6001600160a01b0392831660209182029290920101526014546113c39130911684610b5e565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac947906113fc908590600090869030904290600401611ccf565b600060405180830381600087803b15801561141657600080fd5b505af115801561142a573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b8061144c5761144c6114d2565b611457848484611500565b80610a3f57610a3f600e54600c55600f54600d55565b600080600061147a6115f7565b90925090506114898282611490565b9250505090565b60006112af83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611637565b600c541580156114e25750600d54155b156114e957565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061151287611665565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061154490876116c2565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115739086611704565b6001600160a01b03891660009081526002602052604090205561159581611763565b61159f84836117ad565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516115e491815260200190565b60405180910390a3505050505050505050565b6006546000908190670de0b6b3a76400006116128282611490565b82101561162e57505060065492670de0b6b3a764000092509050565b90939092509050565b600081836116585760405162461bcd60e51b81526004016105f691906119f5565b5060006111ef8486611d40565b60008060008060008060008060006116828a600c54600d546117d1565b925092509250600061169261146d565b905060008060006116a58e878787611826565b919e509c509a509598509396509194505050505091939550919395565b60006112af83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111be565b6000806117118385611c83565b9050838110156112af5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016105f6565b600061176d61146d565b9050600061177b8383611876565b306000908152600260205260409020549091506117989082611704565b30600090815260026020526040902055505050565b6006546117ba90836116c2565b6006556007546117ca9082611704565b6007555050565b60008080806117eb60646117e58989611876565b90611490565b905060006117fe60646117e58a89611876565b90506000611816826118108b866116c2565b906116c2565b9992985090965090945050505050565b60008080806118358886611876565b905060006118438887611876565b905060006118518888611876565b905060006118638261181086866116c2565b939b939a50919850919650505050505050565b6000826118855750600061067c565b60006118918385611d62565b90508261189e8583611d40565b146112af5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016105f6565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107c657600080fd5b803561192b8161190b565b919050565b6000602080838503121561194357600080fd5b823567ffffffffffffffff8082111561195b57600080fd5b818501915085601f83011261196f57600080fd5b813581811115611981576119816118f5565b8060051b604051601f19603f830116810181811085821117156119a6576119a66118f5565b6040529182528482019250838101850191888311156119c457600080fd5b938501935b828510156119e9576119da85611920565b845293850193928501926119c9565b98975050505050505050565b600060208083528351808285015260005b81811015611a2257858101830151858201604001528201611a06565b81811115611a34576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611a5d57600080fd5b8235611a688161190b565b946020939093013593505050565b600080600060608486031215611a8b57600080fd5b8335611a968161190b565b92506020840135611aa68161190b565b929592945050506040919091013590565b600060208284031215611ac957600080fd5b81356112af8161190b565b8035801515811461192b57600080fd5b600060208284031215611af657600080fd5b6112af82611ad4565b600060208284031215611b1157600080fd5b5035919050565b60008060008060808587031215611b2e57600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611b5f57600080fd5b833567ffffffffffffffff80821115611b7757600080fd5b818601915086601f830112611b8b57600080fd5b813581811115611b9a57600080fd5b8760208260051b8501011115611baf57600080fd5b602092830195509350611bc59186019050611ad4565b90509250925092565b60008060408385031215611be157600080fd5b8235611bec8161190b565b91506020830135611bfc8161190b565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611c7c57611c7c611c52565b5060010190565b60008219821115611c9657611c96611c52565b500190565b600082821015611cad57611cad611c52565b500390565b600060208284031215611cc457600080fd5b81516112af8161190b565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d1f5784516001600160a01b031683529383019391830191600101611cfa565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611d5d57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611d7c57611d7c611c52565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212200ffdb45a8bb4da5673684bb14f22d4fc2fa7ab0bb1faa72da6cfd9520d20de5964736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 2,237 |
0x21f64e1e55bdf5f6906579a370359b146518e0e8
|
/**
*Submitted for verification at Etherscan.io on 2021-10-15
*/
/**
ℰ𝒾𝓀𝒾𝒸𝒽𝒾 𝒪𝓃𝒾𝓏𝓊𝓀𝒶 (鬼塚 英吉) 𝒾𝓈 𝒶 22-𝓎ℯ𝒶𝓇-ℴ𝓁𝒹 ℯ𝓍-ℊ𝒶𝓃ℊ 𝓂ℯ𝓂𝒷ℯ𝓇 𝓌𝒽ℴ ℯ
𝓃𝒿ℴ𝓎𝓈 𝓉ℯ𝒶𝒸𝒽𝒾𝓃ℊ 𝒶𝓃𝒹, 𝓂ℴ𝓈𝓉 ℴ𝒻 𝓉𝒽ℯ 𝓉𝒾𝓂ℯ, 𝒽ℯ 𝓉ℯ𝒶𝒸𝒽ℯ𝓈 𝓁𝒾𝒻ℯ 𝓁ℯ𝓈𝓈ℴ𝓃𝓈 𝓇𝒶𝓉𝒽ℯ𝓇
𝓉𝒽𝒶𝓃 𝓉𝒽ℯ 𝓇ℴ𝓊𝓉𝒾𝓃ℯ 𝓈𝒸𝒽ℴℴ𝓁𝓌ℴ𝓇𝓀. ℋℯ 𝒽𝒶𝓉ℯ𝓈 𝓉𝒽ℯ 𝓈𝓎𝓈𝓉ℯ𝓂𝓈 ℴ𝒻 𝓉
𝓇𝒶𝒹𝒾𝓉𝒾ℴ𝓃𝒶𝓁 ℯ𝒹𝓊𝒸𝒶𝓉𝒾ℴ𝓃, ℯ𝓈𝓅ℯ𝒸𝒾𝒶𝓁𝓁𝓎 𝓌𝒽ℯ𝓃 𝓉𝒽ℯ𝓎 𝒽𝒶
𝓋ℯ ℊ𝓇ℴ𝓌𝓃 𝒾ℊ𝓃ℴ𝓇𝒶𝓃𝓉 𝒶𝓃𝒹 𝒸ℴ𝓃𝒹ℯ𝓈𝒸ℯ𝓃𝒹𝒾𝓃ℊ 𝓉ℴ 𝓈𝓉𝓊𝒹ℯ𝓃𝓉𝓈 𝒶�
�𝒹 𝓉𝒽ℯ𝒾𝓇 𝓃ℯℯ𝒹𝓈. 𝒩ℴ𝓌, 𝓌𝒾𝓉𝒽 𝓉𝒽ℯ 𝓇𝒾𝓈ℯ ℴ𝒻 𝒶𝓃𝒾𝓂ℯ 𝓉ℴ𝓀ℯ𝓃𝓈
, 𝒪𝓃𝒾𝓏𝓊𝓀𝒶 𝒾𝓈 𝒽ℯ𝓇ℯ 𝓉ℴ 𝓉ℯ𝒶𝒸𝒽 𝒽𝒾𝓈 𝓈𝓉𝓊𝒹ℯ𝓃𝓉𝓈 𝒽ℴ𝓌 𝓉ℴ 𝓂𝒶𝓀ℯ 𝒶 𝓉ℴ𝓀ℯ𝓃 𝓂ℴℴ𝓃.
📌Tax
2% - Reward for students
3% - Added to LP Pool
5% - Marketing & development budget
📌Social Links
Twitter: https://twitter.com/onizuka_inu
Telegram: https://t.me/onizuka_inu
*/
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 OnizukaInu is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _tTotal = 1000* 10**9 * 10**18;
string private _name = ' Onizuka Inu ';
string private _symbol = 'Onizuka ';
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);
}
}
|
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c806370a082311161007157806370a0823114610258578063715018a6146102b05780638da5cb5b146102ba57806395d89b41146102ee578063a9059cbb14610371578063dd62ed3e146103d5576100a9565b806306fdde03146100ae578063095ea7b31461013157806318160ddd1461019557806323b872dd146101b3578063313ce56714610237575b600080fd5b6100b661044d565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f65780820151818401526020810190506100db565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61017d6004803603604081101561014757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506104ef565b60405180821515815260200191505060405180910390f35b61019d61050d565b6040518082815260200191505060405180910390f35b61021f600480360360608110156101c957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610517565b60405180821515815260200191505060405180910390f35b61023f6105f0565b604051808260ff16815260200191505060405180910390f35b61029a6004803603602081101561026e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610607565b6040518082815260200191505060405180910390f35b6102b8610650565b005b6102c26107d8565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102f6610801565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561033657808201518184015260208101905061031b565b50505050905090810190601f1680156103635780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103bd6004803603604081101561038757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108a3565b60405180821515815260200191505060405180910390f35b610437600480360360408110156103eb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108c1565b6040518082815260200191505060405180910390f35b606060058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104e55780601f106104ba576101008083540402835291602001916104e5565b820191906000526020600020905b8154815290600101906020018083116104c857829003601f168201915b5050505050905090565b60006105036104fc610948565b8484610950565b6001905092915050565b6000600454905090565b6000610524848484610c6f565b6105e584610530610948565b6105e0856040518060600160405280602881526020016110b960289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610596610948565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b610950565b600190509392505050565b6000600760009054906101000a900460ff16905090565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610658610948565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461071a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060068054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108995780601f1061086e57610100808354040283529160200191610899565b820191906000526020600020905b81548152906001019060200180831161087c57829003601f168201915b5050505050905090565b60006108b76108b0610948565b8484610c6f565b6001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156109d6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602481526020018061112a6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610a5c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806110976022913960400191505060405180910390fd5b610a646107d8565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614610b83576000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560046040518082815260200191505060405180910390a3610c6a565b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a35b505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610cf5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806110726025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610d7b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806111076023913960400191505060405180910390fd5b610de7816040518060600160405280602681526020016110e160269139600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e7c81600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610fe990919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290610fd6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610f9b578082015181840152602081019050610f80565b50505050905090810190601f168015610fc85780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015611067576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b809150509291505056fe42455032303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636542455032303a207472616e7366657220616d6f756e7420657863656564732062616c616e636542455032303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a264697066735822122071451555411cca83a6b350947bb5b5705e29d05fa3a91f1c947d50683643464664736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 2,238 |
0xCe076F8AB3f5aF34ECf70B99995b11039190eDc1
|
pragma solidity 0.4.18;
// File: contracts/ERC20Interface.sol
// https://github.com/ethereum/EIPs/issues/20
interface ERC20 {
function totalSupply() public view returns (uint supply);
function balanceOf(address _owner) public view returns (uint balance);
function transfer(address _to, uint _value) public returns (bool success);
function transferFrom(address _from, address _to, uint _value) public returns (bool success);
function approve(address _spender, uint _value) public returns (bool success);
function allowance(address _owner, address _spender) public view returns (uint remaining);
function decimals() public view returns(uint digits);
event Approval(address indexed _owner, address indexed _spender, uint _value);
}
// File: contracts/ConversionRatesInterface.sol
interface ConversionRatesInterface {
function recordImbalance(
ERC20 token,
int buyAmount,
uint rateUpdateBlock,
uint currentBlock
)
public;
function getRate(ERC20 token, uint currentBlockNumber, bool buy, uint qty) public view returns(uint);
}
// File: contracts/KyberReserveInterface.sol
/// @title Kyber Reserve contract
interface KyberReserveInterface {
function trade(
ERC20 srcToken,
uint srcAmount,
ERC20 destToken,
address destAddress,
uint conversionRate,
bool validate
)
public
payable
returns(bool);
function getConversionRate(ERC20 src, ERC20 dest, uint srcQty, uint blockNumber) public view returns(uint);
}
// File: contracts/SanityRatesInterface.sol
interface SanityRatesInterface {
function getSanityRate(ERC20 src, ERC20 dest) public view returns(uint);
}
// File: contracts/Utils.sol
/// @title Kyber constants contract
contract Utils {
ERC20 constant internal ETH_TOKEN_ADDRESS = ERC20(0x00eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee);
uint constant internal PRECISION = (10**18);
uint constant internal MAX_QTY = (10**28); // 10B tokens
uint constant internal MAX_RATE = (PRECISION * 10**6); // up to 1M tokens per ETH
uint constant internal MAX_DECIMALS = 18;
uint constant internal ETH_DECIMALS = 18;
mapping(address=>uint) internal decimals;
function setDecimals(ERC20 token) internal {
if (token == ETH_TOKEN_ADDRESS) decimals[token] = ETH_DECIMALS;
else decimals[token] = token.decimals();
}
function getDecimals(ERC20 token) internal view returns(uint) {
if (token == ETH_TOKEN_ADDRESS) return ETH_DECIMALS; // save storage access
uint tokenDecimals = decimals[token];
// technically, there might be token with decimals 0
// moreover, very possible that old tokens have decimals 0
// these tokens will just have higher gas fees.
if(tokenDecimals == 0) return token.decimals();
return tokenDecimals;
}
function calcDstQty(uint srcQty, uint srcDecimals, uint dstDecimals, uint rate) internal pure returns(uint) {
require(srcQty <= MAX_QTY);
require(rate <= MAX_RATE);
if (dstDecimals >= srcDecimals) {
require((dstDecimals - srcDecimals) <= MAX_DECIMALS);
return (srcQty * rate * (10**(dstDecimals - srcDecimals))) / PRECISION;
} else {
require((srcDecimals - dstDecimals) <= MAX_DECIMALS);
return (srcQty * rate) / (PRECISION * (10**(srcDecimals - dstDecimals)));
}
}
function calcSrcQty(uint dstQty, uint srcDecimals, uint dstDecimals, uint rate) internal pure returns(uint) {
require(dstQty <= MAX_QTY);
require(rate <= MAX_RATE);
//source quantity is rounded up. to avoid dest quantity being too low.
uint numerator;
uint denominator;
if (srcDecimals >= dstDecimals) {
require((srcDecimals - dstDecimals) <= MAX_DECIMALS);
numerator = (PRECISION * dstQty * (10**(srcDecimals - dstDecimals)));
denominator = rate;
} else {
require((dstDecimals - srcDecimals) <= MAX_DECIMALS);
numerator = (PRECISION * dstQty);
denominator = (rate * (10**(dstDecimals - srcDecimals)));
}
return (numerator + denominator - 1) / denominator; //avoid rounding down errors
}
}
// File: contracts/PermissionGroups.sol
contract PermissionGroups {
address public admin;
address public pendingAdmin;
mapping(address=>bool) internal operators;
mapping(address=>bool) internal alerters;
address[] internal operatorsGroup;
address[] internal alertersGroup;
uint constant internal MAX_GROUP_SIZE = 50;
function PermissionGroups() public {
admin = msg.sender;
}
modifier onlyAdmin() {
require(msg.sender == admin);
_;
}
modifier onlyOperator() {
require(operators[msg.sender]);
_;
}
modifier onlyAlerter() {
require(alerters[msg.sender]);
_;
}
function getOperators () external view returns(address[]) {
return operatorsGroup;
}
function getAlerters () external view returns(address[]) {
return alertersGroup;
}
event TransferAdminPending(address pendingAdmin);
/**
* @dev Allows the current admin to set the pendingAdmin address.
* @param newAdmin The address to transfer ownership to.
*/
function transferAdmin(address newAdmin) public onlyAdmin {
require(newAdmin != address(0));
TransferAdminPending(pendingAdmin);
pendingAdmin = newAdmin;
}
/**
* @dev Allows the current admin to set the admin in one tx. Useful initial deployment.
* @param newAdmin The address to transfer ownership to.
*/
function transferAdminQuickly(address newAdmin) public onlyAdmin {
require(newAdmin != address(0));
TransferAdminPending(newAdmin);
AdminClaimed(newAdmin, admin);
admin = newAdmin;
}
event AdminClaimed( address newAdmin, address previousAdmin);
/**
* @dev Allows the pendingAdmin address to finalize the change admin process.
*/
function claimAdmin() public {
require(pendingAdmin == msg.sender);
AdminClaimed(pendingAdmin, admin);
admin = pendingAdmin;
pendingAdmin = address(0);
}
event AlerterAdded (address newAlerter, bool isAdd);
function addAlerter(address newAlerter) public onlyAdmin {
require(!alerters[newAlerter]); // prevent duplicates.
require(alertersGroup.length < MAX_GROUP_SIZE);
AlerterAdded(newAlerter, true);
alerters[newAlerter] = true;
alertersGroup.push(newAlerter);
}
function removeAlerter (address alerter) public onlyAdmin {
require(alerters[alerter]);
alerters[alerter] = false;
for (uint i = 0; i < alertersGroup.length; ++i) {
if (alertersGroup[i] == alerter) {
alertersGroup[i] = alertersGroup[alertersGroup.length - 1];
alertersGroup.length--;
AlerterAdded(alerter, false);
break;
}
}
}
event OperatorAdded(address newOperator, bool isAdd);
function addOperator(address newOperator) public onlyAdmin {
require(!operators[newOperator]); // prevent duplicates.
require(operatorsGroup.length < MAX_GROUP_SIZE);
OperatorAdded(newOperator, true);
operators[newOperator] = true;
operatorsGroup.push(newOperator);
}
function removeOperator (address operator) public onlyAdmin {
require(operators[operator]);
operators[operator] = false;
for (uint i = 0; i < operatorsGroup.length; ++i) {
if (operatorsGroup[i] == operator) {
operatorsGroup[i] = operatorsGroup[operatorsGroup.length - 1];
operatorsGroup.length -= 1;
OperatorAdded(operator, false);
break;
}
}
}
}
// File: contracts/Withdrawable.sol
/**
* @title Contracts that should be able to recover tokens or ethers
* @author Ilan Doron
* @dev This allows to recover any tokens or Ethers received in a contract.
* This will prevent any accidental loss of tokens.
*/
contract Withdrawable is PermissionGroups {
event TokenWithdraw(ERC20 token, uint amount, address sendTo);
/**
* @dev Withdraw all ERC20 compatible tokens
* @param token ERC20 The address of the token contract
*/
function withdrawToken(ERC20 token, uint amount, address sendTo) external onlyAdmin {
require(token.transfer(sendTo, amount));
TokenWithdraw(token, amount, sendTo);
}
event EtherWithdraw(uint amount, address sendTo);
/**
* @dev Withdraw Ethers
*/
function withdrawEther(uint amount, address sendTo) external onlyAdmin {
sendTo.transfer(amount);
EtherWithdraw(amount, sendTo);
}
}
// File: contracts/DigixReserve.sol
interface MakerDao {
function peek() public view returns (bytes32, bool);
}
contract DigixReserve is KyberReserveInterface, Withdrawable, Utils {
ERC20 public digix;
MakerDao public makerDaoContract;
ConversionRatesInterface public conversionRatesContract;
SanityRatesInterface public sanityRatesContract;
address public kyberNetwork;
uint public maxBlockDrift = 300; //Max drift from block that price feed was received till we can't use it.
bool public tradeEnabled;
uint public buyTransferFee = 13; //Digix token has transaction fees we should compensate for our flow to work
uint public sellTransferFee = 13;
mapping(bytes32=>bool) public approvedWithdrawAddresses; // sha3(token,address)=>bool
uint public priceFeed; //all price feed data squinted to one uint256
uint constant internal POW_2_64 = 2 ** 64;
function DigixReserve(address _admin, address _kyberNetwork, ERC20 _digix) public {
require(_admin != address(0));
require(_digix != address(0));
require(_kyberNetwork != address(0));
admin = _admin;
digix = _digix;
setDecimals(digix);
kyberNetwork = _kyberNetwork;
sanityRatesContract = SanityRatesInterface(0);
conversionRatesContract = ConversionRatesInterface(0x901d);
tradeEnabled = true;
}
function () public payable {} // solhint-disable-line no-empty-blocks
/// @dev Add digix price feed. Valid for @maxBlockDrift blocks
/// @param blockNumber the block this price feed was signed.
/// @param nonce the nonce with which this block was signed.
/// @param ask1KDigix ask price dollars per Kg gold == 1000 digix
/// @param bid1KDigix bid price dollars per KG gold == 1000 digix
/// @param v - v part of signature of keccak 256 hash of (block, nonce, ask, bid)
/// @param r - r part of signature of keccak 256 hash of (block, nonce, ask, bid)
/// @param s - s part of signature of keccak 256 hash of (block, nonce, ask, bid)
function setPriceFeed(
uint blockNumber,
uint nonce,
uint ask1KDigix,
uint bid1KDigix,
uint8 v,
bytes32 r,
bytes32 s
) public
{
uint prevFeedBlock;
uint prevNonce;
uint prevAsk;
uint prevBid;
(prevFeedBlock, prevNonce, prevAsk, prevBid) = getPriceFeed();
require(nonce > prevNonce);
require(blockNumber + maxBlockDrift > block.number);
require(blockNumber <= block.number);
require(verifySignature(keccak256(blockNumber, nonce, ask1KDigix, bid1KDigix), v, r, s));
priceFeed = encodePriceFeed(blockNumber, nonce, ask1KDigix, bid1KDigix);
}
/* solhint-disable code-complexity */
function getConversionRate(ERC20 src, ERC20 dest, uint srcQty, uint blockNumber) public view returns(uint) {
if (!tradeEnabled) return 0;
if (makerDaoContract == MakerDao(0)) return 0;
uint feedBlock;
uint nonce;
uint ask1KDigix;
uint bid1KDigix;
blockNumber;
(feedBlock, nonce, ask1KDigix, bid1KDigix) = getPriceFeed();
if (feedBlock + maxBlockDrift <= block.number) return 0;
// wei per dollar from makerDao
bool isRateValid;
bytes32 dollarsPerEtherWei; //price in dollars of 1 Ether * 10**18
(dollarsPerEtherWei, isRateValid) = makerDaoContract.peek();
if (!isRateValid || uint(dollarsPerEtherWei) > MAX_RATE) return 0;
uint rate;
if (ETH_TOKEN_ADDRESS == src && digix == dest) {
//buy digix with ether == sell ether
if (ask1KDigix == 0) return 0;
//rate = (ether $ price / digix $ price) * precision
//rate = ((dollarsPerEtherWei / etherwei == 10**18) / (bid1KDigix / 1000)) * PRECISION
rate = 1000 * uint(dollarsPerEtherWei) / ask1KDigix;
} else if (digix == src && ETH_TOKEN_ADDRESS == dest) {
//sell digix == buy ether with digix
//rate = (digix $ price / ether $ price) * precision
//rate = ((bid1KDigix / 1000) / (dollarsPerEtherWei / etherwei == 10**18)) * PRECISION
rate = bid1KDigix * PRECISION * PRECISION / uint(dollarsPerEtherWei) / 1000;
} else {
return 0;
}
if (rate > MAX_RATE) return 0;
uint destQty = getDestQty(src, dest, srcQty, rate);
if (dest == digix) destQty = recalcAmountWithFees(destQty, true);
if (getBalance(dest) < destQty) return 0;
return rate;
}
/* solhint-enable code-complexity */
function getPriceFeed() public view returns(uint feedBlock, uint nonce, uint ask1KDigix, uint bid1KDigix) {
(feedBlock, nonce, ask1KDigix, bid1KDigix) = decodePriceFeed(priceFeed);
}
event TradeExecute(
address indexed origin,
address src,
uint srcAmount,
address destToken,
uint destAmount,
address destAddress
);
function trade(
ERC20 srcToken,
uint srcAmount,
ERC20 destToken,
address destAddress,
uint conversionRate,
bool validate
)
public
payable
returns(bool)
{
require(tradeEnabled);
require(msg.sender == kyberNetwork);
// can skip validation if done at kyber network level
if (validate) {
require(conversionRate > 0);
if (srcToken == ETH_TOKEN_ADDRESS) {
require(msg.value == srcAmount);
require(ERC20(destToken) == digix);
} else {
require(ERC20(srcToken) == digix);
require(msg.value == 0);
}
}
uint destAmount = getDestQty(srcToken, destToken, srcAmount, conversionRate);
// sanity check
require(destAmount > 0);
uint adjustedAmount;
// collect src tokens
if (srcToken != ETH_TOKEN_ADDRESS) {
//due to fee network has less tokens. take amount less the fee.
adjustedAmount = recalcAmountWithFees(srcAmount, false);
require(adjustedAmount > 0);
require(srcToken.transferFrom(msg.sender, this, adjustedAmount));
}
// send dest tokens
if (destToken == ETH_TOKEN_ADDRESS) {
destAddress.transfer(destAmount);
} else {
//add 1 to compensate for rounding errors.
adjustedAmount = recalcAmountWithFees(destAmount, true);
require(destToken.transfer(destAddress, adjustedAmount));
}
TradeExecute(msg.sender, srcToken, srcAmount, destToken, destAmount, destAddress);
return true;
}
event TradeEnabled(bool enable);
function enableTrade() public onlyAdmin returns(bool) {
tradeEnabled = true;
TradeEnabled(true);
return true;
}
function disableTrade() public onlyAlerter returns(bool) {
tradeEnabled = false;
TradeEnabled(false);
return true;
}
event WithdrawAddressApproved(ERC20 token, address addr, bool approve);
function approveWithdrawAddress(ERC20 token, address addr, bool approve) public onlyAdmin {
approvedWithdrawAddresses[keccak256(token, addr)] = approve;
WithdrawAddressApproved(token, addr, approve);
setDecimals(token);
}
event WithdrawFunds(ERC20 token, uint amount, address destination);
function withdraw(ERC20 token, uint amount, address destination) public onlyOperator returns(bool) {
require(approvedWithdrawAddresses[keccak256(token, destination)]);
if (token == ETH_TOKEN_ADDRESS) {
destination.transfer(amount);
} else {
require(token.transfer(destination, amount));
}
WithdrawFunds(token, amount, destination);
return true;
}
function setMakerDaoContract(MakerDao daoContract) public onlyAdmin {
require(daoContract != address(0));
makerDaoContract = daoContract;
}
function setKyberNetworkAddress(address _kyberNetwork) public onlyAdmin {
require(_kyberNetwork != address(0));
kyberNetwork = _kyberNetwork;
}
function setMaxBlockDrift(uint numBlocks) public onlyAdmin {
require(numBlocks > 1);
maxBlockDrift = numBlocks;
}
function setBuyFeeBps(uint fee) public onlyAdmin {
require(fee < 10000);
buyTransferFee = fee;
}
function setSellFeeBps(uint fee) public onlyAdmin {
require(fee < 10000);
sellTransferFee = fee;
}
function getBalance(ERC20 token) public view returns(uint) {
if (token == ETH_TOKEN_ADDRESS)
return this.balance;
else
return token.balanceOf(this);
}
function getDestQty(ERC20 src, ERC20 dest, uint srcQty, uint rate) public view returns(uint) {
uint dstDecimals = getDecimals(dest);
uint srcDecimals = getDecimals(src);
return calcDstQty(srcQty, srcDecimals, dstDecimals, rate);
}
function decodePriceFeed(uint input) internal pure returns(uint blockNumber, uint nonce, uint ask, uint bid) {
blockNumber = uint(uint64(input));
nonce = uint(uint64(input / POW_2_64));
ask = uint(uint64(input / (POW_2_64 * POW_2_64)));
bid = uint(uint64(input / (POW_2_64 * POW_2_64 * POW_2_64)));
}
function encodePriceFeed(uint blockNumber, uint nonce, uint ask, uint bid) internal pure returns(uint) {
// check overflows
require(blockNumber < POW_2_64);
require(nonce < POW_2_64);
require(ask < POW_2_64);
require(bid < POW_2_64);
// do encoding
uint result = blockNumber;
result |= nonce * POW_2_64;
result |= ask * POW_2_64 * POW_2_64;
result |= bid * POW_2_64 * POW_2_64 * POW_2_64;
return result;
}
function verifySignature(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal view returns(bool) {
address signer = ecrecover(hash, v, r, s);
return operators[signer];
}
function recalcAmountWithFees(uint amount, bool isEtherToDigix) internal view returns(uint adjustedAmount) {
if (isEtherToDigix) {
//when sending Digix to kyberNetwork fee will be reduced and received amount will be less then expected.
adjustedAmount = (amount * 10000 / (10000 - buyTransferFee)) + 1;
} else {
adjustedAmount = (amount * (10000 - sellTransferFee) / 10000);
if (adjustedAmount == 0) return 0;
// reduce 1 to avoid rounding errors on above calculation.
adjustedAmount -= 1;
}
}
}
|
0x6060604052600436106101c85763ffffffff60e060020a60003504166299d38681146101ca57806301a12fd3146101f157806315b3789914610210578063267822471461022f57806327a099d81461025e57806327ed810d146102c457806334119d15146102da5780633ccdbb28146102f0578063408ee7fe1461031957806347e6924f146103385780634e52678e1461034b578063546dc71c1461035e57806369328dec146103885780636940030f146103b15780636cf69811146103c4578063741bef1a146103f057806375829def1461041557806377241a5f1461043457806377f50f97146104475780637acc86781461045a5780637c423f54146104795780637cd442721461048c5780638ce72064146104b75780639058c8a4146104d65780639870d7fe146104ec5780639e87a5cd1461050b578063ac8a584a14610549578063b78b842d14610568578063ba81522f1461057b578063ce56c4541461058e578063d5847d33146105b0578063d621e813146105c3578063d7b7024d146105d6578063e4b5762a146105ec578063e769dfbd14610617578063ecef615b1461062a578063f851a4401461063d578063f8b2cb4f14610650578063fa64dffa1461066f575b005b34156101d557600080fd5b6101dd61069a565b604051901515815260200160405180910390f35b34156101fc57600080fd5b6101c8600160a060020a0360043516610702565b341561021b57600080fd5b6101c8600160a060020a0360043516610872565b341561023a57600080fd5b6102426108c4565b604051600160a060020a03909116815260200160405180910390f35b341561026957600080fd5b6102716108d3565b60405160208082528190810183818151815260200191508051906020019060200280838360005b838110156102b0578082015183820152602001610298565b505050509050019250505060405180910390f35b34156102cf57600080fd5b6101c860043561093b565b34156102e557600080fd5b6101c8600435610968565b34156102fb57600080fd5b6101c8600160a060020a036004358116906024359060443516610996565b341561032457600080fd5b6101c8600160a060020a0360043516610a8d565b341561034357600080fd5b610242610b89565b341561035657600080fd5b610242610b98565b341561036957600080fd5b6101c8600160a060020a03600435811690602435166044351515610ba7565b341561039357600080fd5b6101dd600160a060020a036004358116906024359060443516610c86565b34156103bc57600080fd5b6101dd610e44565b6101dd600160a060020a03600435811690602435906044358116906064351660843560a4351515610eb1565b34156103fb57600080fd5b6104036111bc565b60405190815260200160405180910390f35b341561042057600080fd5b6101c8600160a060020a03600435166111c2565b341561043f57600080fd5b61024261125d565b341561045257600080fd5b6101c861126c565b341561046557600080fd5b6101c8600160a060020a0360043516611306565b341561048457600080fd5b6102716113e8565b341561049757600080fd5b610403600160a060020a036004358116906024351660443560643561144e565b34156104c257600080fd5b6101c8600160a060020a036004351661169d565b34156104e157600080fd5b6101c86004356116ef565b34156104f757600080fd5b6101c8600160a060020a036004351661171d565b341561051657600080fd5b61051e6117ed565b6040518085815260200184815260200183815260200182815260200194505050505060405180910390f35b341561055457600080fd5b6101c8600160a060020a036004351661180c565b341561057357600080fd5b610242611978565b341561058657600080fd5b610403611987565b341561059957600080fd5b6101c8600435600160a060020a036024351661198d565b34156105bb57600080fd5b610242611a20565b34156105ce57600080fd5b6101dd611a2f565b34156105e157600080fd5b6101dd600435611a38565b34156105f757600080fd5b6101c860043560243560443560643560ff6084351660a43560c435611a4d565b341561062257600080fd5b610403611aef565b341561063557600080fd5b610403611af5565b341561064857600080fd5b610242611afb565b341561065b57600080fd5b610403600160a060020a0360043516611b0a565b341561067a57600080fd5b610403600160a060020a0360043581169060243516604435606435611bbb565b6000805433600160a060020a039081169116146106b657600080fd5b600d805460ff191660019081179091557f7d7f00509dd73ac4449f698ae75ccc797895eff5fa9d446d3df387598a26e73590604051901515815260200160405180910390a15060015b90565b6000805433600160a060020a0390811691161461071e57600080fd5b600160a060020a03821660009081526003602052604090205460ff16151561074557600080fd5b50600160a060020a0381166000908152600360205260408120805460ff191690555b60055481101561086e5781600160a060020a031660058281548110151561078a57fe5b600091825260209091200154600160a060020a03161415610866576005805460001981019081106107b757fe5b60009182526020909120015460058054600160a060020a0390921691839081106107dd57fe5b60009182526020909120018054600160a060020a031916600160a060020a03929092169190911790556005805490610819906000198301611fe7565b507f5611bf3e417d124f97bf2c788843ea8bb502b66079fbee02158ef30b172cb762826000604051600160a060020a039092168252151560208201526040908101905180910390a161086e565b600101610767565b5050565b60005433600160a060020a0390811691161461088d57600080fd5b600160a060020a03811615156108a257600080fd5b600b8054600160a060020a031916600160a060020a0392909216919091179055565b600154600160a060020a031681565b6108db61200b565b600480548060200260200160405190810160405280929190818152602001828054801561093157602002820191906000526020600020905b8154600160a060020a03168152600190910190602001808311610913575b5050505050905090565b60005433600160a060020a0390811691161461095657600080fd5b6001811161096357600080fd5b600c55565b60005433600160a060020a0390811691161461098357600080fd5b612710811061099157600080fd5b600f55565b60005433600160a060020a039081169116146109b157600080fd5b82600160a060020a031663a9059cbb828460006040516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b1515610a0e57600080fd5b6102c65a03f11515610a1f57600080fd5b505050604051805190501515610a3457600080fd5b7f72cb8a894ddb372ceec3d2a7648d86f17d5a15caae0e986c53109b8a9a9385e6838383604051600160a060020a03938416815260208101929092529091166040808301919091526060909101905180910390a1505050565b60005433600160a060020a03908116911614610aa857600080fd5b600160a060020a03811660009081526003602052604090205460ff1615610ace57600080fd5b60055460329010610ade57600080fd5b7f5611bf3e417d124f97bf2c788843ea8bb502b66079fbee02158ef30b172cb762816001604051600160a060020a039092168252151560208201526040908101905180910390a1600160a060020a0381166000908152600360205260409020805460ff191660019081179091556005805490918101610b5d8382611fe7565b5060009182526020909120018054600160a060020a031916600160a060020a0392909216919091179055565b600a54600160a060020a031681565b600754600160a060020a031681565b60005433600160a060020a03908116911614610bc257600080fd5b806010600085856040516c01000000000000000000000000600160a060020a039384168102825291909216026014820152602801604051908190039020815260208101919091526040908101600020805460ff1916921515929092179091557fd5fd5351efae1f4bb760079da9f0ff9589e2c3e216337ca9d39cdff573b245c49084908490849051600160a060020a0393841681529190921660208201529015156040808301919091526060909101905180910390a1610c8183611bed565b505050565b600160a060020a03331660009081526002602052604081205460ff161515610cad57600080fd5b6010600085846040516c01000000000000000000000000600160a060020a039384168102825291909216026014820152602801604051908190039020815260208101919091526040016000205460ff161515610d0857600080fd5b600160a060020a03841673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1415610d6357600160a060020a03821683156108fc0284604051600060405180830381858888f193505050501515610d5e57600080fd5b610de6565b83600160a060020a031663a9059cbb838560006040516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b1515610dc057600080fd5b6102c65a03f11515610dd157600080fd5b505050604051805190501515610de657600080fd5b7fb67719fc33c1f17d31bf3a698690d62066b1e0bae28fcd3c56cf2c015c2863d6848484604051600160a060020a03938416815260208101929092529091166040808301919091526060909101905180910390a15060019392505050565b600160a060020a03331660009081526003602052604081205460ff161515610e6b57600080fd5b600d805460ff191690557f7d7f00509dd73ac4449f698ae75ccc797895eff5fa9d446d3df387598a26e7356000604051901515815260200160405180910390a150600190565b600d546000908190819060ff161515610ec957600080fd5b600b5433600160a060020a03908116911614610ee457600080fd5b8315610f6c5760008511610ef757600080fd5b600160a060020a03891673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1415610f4757348814610f2857600080fd5b600754600160a060020a03888116911614610f4257600080fd5b610f6c565b600754600160a060020a038a8116911614610f6157600080fd5b3415610f6c57600080fd5b610f7889888a88611bbb565b915060008211610f8757600080fd5b600160a060020a03891673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1461105557610fb6886000611cb0565b905060008111610fc557600080fd5b88600160a060020a03166323b872dd33308460006040516020015260405160e060020a63ffffffff8616028152600160a060020a0393841660048201529190921660248201526044810191909152606401602060405180830381600087803b151561102f57600080fd5b6102c65a03f1151561104057600080fd5b50505060405180519050151561105557600080fd5b600160a060020a03871673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14156110b057600160a060020a03861682156108fc0283604051600060405180830381858888f1935050505015156110ab57600080fd5b611140565b6110bb826001611cb0565b905086600160a060020a031663a9059cbb878360006040516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b151561111a57600080fd5b6102c65a03f1151561112b57600080fd5b50505060405180519050151561114057600080fd5b33600160a060020a03167fea9415385bae08fe9f6dc457b02577166790cde83bb18cc340aac6cb81b824de8a8a8a868b604051600160a060020a039586168152602081019490945291841660408085019190915260608401919091529216608082015260a001905180910390a250600198975050505050505050565b60115481565b60005433600160a060020a039081169116146111dd57600080fd5b600160a060020a03811615156111f257600080fd5b6001547f3b81caf78fa51ecbc8acb482fd7012a277b428d9b80f9d156e8a54107496cc4090600160a060020a0316604051600160a060020a03909116815260200160405180910390a160018054600160a060020a031916600160a060020a0392909216919091179055565b600854600160a060020a031681565b60015433600160a060020a0390811691161461128757600080fd5b6001546000547f65da1cfc2c2e81576ad96afb24a581f8e109b7a403b35cbd3243a1c99efdb9ed91600160a060020a039081169116604051600160a060020a039283168152911660208201526040908101905180910390a16001805460008054600160a060020a0319908116600160a060020a03841617909155169055565b60005433600160a060020a0390811691161461132157600080fd5b600160a060020a038116151561133657600080fd5b7f3b81caf78fa51ecbc8acb482fd7012a277b428d9b80f9d156e8a54107496cc4081604051600160a060020a03909116815260200160405180910390a16000547f65da1cfc2c2e81576ad96afb24a581f8e109b7a403b35cbd3243a1c99efdb9ed908290600160a060020a0316604051600160a060020a039283168152911660208201526040908101905180910390a160008054600160a060020a031916600160a060020a0392909216919091179055565b6113f061200b565b600580548060200260200160405190810160405280929190818152602001828054801561093157602002820191906000526020600020908154600160a060020a03168152600190910190602001808311610913575050505050905090565b6000806000806000806000806000600d60009054906101000a900460ff16151561147b576000985061168d565b600854600160a060020a03161515611496576000985061168d565b61149e6117ed565b600c54939b509199509750955043908901116114bd576000985061168d565b600854600160a060020a03166359e02dd76000604051604001526040518163ffffffff1660e060020a0281526004016040805180830381600087803b151561150457600080fd5b6102c65a03f1151561151557600080fd5b505050604051805190602001805195509093505083158061153f575069d3c21bcecceda100000083115b1561154d576000985061168d565b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee600160a060020a038e161480156115865750600754600160a060020a038d81169116145b156115b25785151561159b576000985061168d565b856103e884028115156115aa57fe5b049150611622565b600754600160a060020a038e811691161480156115eb575073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee600160a060020a038d16145b15611619576103e8836ec097ce7bc90715b34b9f1000000000870281151561160f57fe5b048115156115aa57fe5b6000985061168d565b69d3c21bcecceda100000082111561163d576000985061168d565b6116498d8d8d85611bbb565b600754909150600160a060020a038d8116911614156116705761166d816001611cb0565b90505b8061167a8d611b0a565b1015611689576000985061168d565b8198505b5050505050505050949350505050565b60005433600160a060020a039081169116146116b857600080fd5b600160a060020a03811615156116cd57600080fd5b60088054600160a060020a031916600160a060020a0392909216919091179055565b60005433600160a060020a0390811691161461170a57600080fd5b612710811061171857600080fd5b600e55565b60005433600160a060020a0390811691161461173857600080fd5b600160a060020a03811660009081526002602052604090205460ff161561175e57600080fd5b6004546032901061176e57600080fd5b7f091a7a4b85135fdd7e8dbc18b12fabe5cc191ea867aa3c2e1a24a102af61d58b816001604051600160a060020a039092168252151560208201526040908101905180910390a1600160a060020a0381166000908152600260205260409020805460ff191660019081179091556004805490918101610b5d8382611fe7565b6000806000806117fe601154611cff565b929791965094509092509050565b6000805433600160a060020a0390811691161461182857600080fd5b600160a060020a03821660009081526002602052604090205460ff16151561184f57600080fd5b50600160a060020a0381166000908152600260205260408120805460ff191690555b60045481101561086e5781600160a060020a031660048281548110151561189457fe5b600091825260209091200154600160a060020a03161415611970576004805460001981019081106118c157fe5b60009182526020909120015460048054600160a060020a0390921691839081106118e757fe5b60009182526020909120018054600160a060020a031916600160a060020a03929092169190911790556004805460001901906119239082611fe7565b507f091a7a4b85135fdd7e8dbc18b12fabe5cc191ea867aa3c2e1a24a102af61d58b826000604051600160a060020a039092168252151560208201526040908101905180910390a161086e565b600101611871565b600b54600160a060020a031681565b600c5481565b60005433600160a060020a039081169116146119a857600080fd5b600160a060020a03811682156108fc0283604051600060405180830381858888f1935050505015156119d957600080fd5b7fec47e7ed86c86774d1a72c19f35c639911393fe7c1a34031fdbd260890da90de8282604051918252600160a060020a031660208201526040908101905180910390a15050565b600954600160a060020a031681565b600d5460ff1681565b60106020526000908152604090205460ff1681565b600080600080611a5b6117ed565b92965090945092509050828a11611a7157600080fd5b600c5443908c0111611a8257600080fd5b438b1115611a8f57600080fd5b611ac88b8b8b8b604051808581526020018481526020018381526020018281526020019450505050506040518091039020888888611d53565b1515611ad357600080fd5b611adf8b8b8b8b611de9565b6011555050505050505050505050565b600e5481565b600f5481565b600054600160a060020a031681565b6000600160a060020a03821673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1415611b425750600160a060020a03301631611bb6565b81600160a060020a03166370a082313060006040516020015260405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b1515611b9957600080fd5b6102c65a03f11515611baa57600080fd5b50505060405180519150505b919050565b6000806000611bc986611e8a565b9150611bd487611e8a565b9050611be285828487611f4e565b979650505050505050565b600160a060020a03811673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1415611c3357600160a060020a038116600090815260066020526040902060129055611cad565b80600160a060020a031663313ce5676000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b1515611c7957600080fd5b6102c65a03f11515611c8a57600080fd5b5050506040518051600160a060020a038316600090815260066020526040902055505b50565b60008115611cd857600e54612710038361271002811515611ccd57fe5b046001019050611cf9565b50600f54612710908103830204801515611cf457506000611cf9565b600019015b92915050565b67ffffffffffffffff81811692680100000000000000008304821692700100000000000000000000000000000000810483169278010000000000000000000000000000000000000000000000009091041690565b6000806001868686866040516000815260200160405260006040516020015260405193845260ff90921660208085019190915260408085019290925260608401929092526080909201915160208103908084039060008661646e5a03f11515611dbb57600080fd5b505060206040510351600160a060020a031660009081526002602052604090205460ff169695505050505050565b600080680100000000000000008610611e0157600080fd5b680100000000000000008510611e1657600080fd5b680100000000000000008410611e2b57600080fd5b680100000000000000008310611e4057600080fd5b505078010000000000000000000000000000000000000000000000008102700100000000000000000000000000000000830268010000000000000000850286171717949350505050565b600080600160a060020a03831673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1415611ebb5760129150611f48565b50600160a060020a038216600090815260066020526040902054801515611f445782600160a060020a031663313ce5676000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b1515611f2257600080fd5b6102c65a03f11515611f3357600080fd5b505050604051805190509150611f48565b8091505b50919050565b60006b204fce5e3e25026110000000851115611f6957600080fd5b69d3c21bcecceda1000000821115611f8057600080fd5b838310611fb35760128484031115611f9757600080fd5b670de0b6b3a7640000858302858503600a0a025b049050611fdf565b60128385031115611fc357600080fd5b828403600a0a670de0b6b3a764000002828602811515611fab57fe5b949350505050565b815481835581811511610c8157600083815260209020610c8191810190830161201d565b60206040519081016040526000815290565b6106ff91905b808211156120375760008155600101612023565b50905600a165627a7a72305820a32f8f362cc1272b441bb2056941acf99285ae243470e2f2a5ef4792e89557b50029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 2,239 |
0xf83ed9be1241e84e2fe8b6c9109e492103e5eb17
|
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity =0.7.6;
pragma experimental ABIEncoderV2;
// Forked from Uniswap's UNI
// Reference: https://etherscan.io/address/0x1f9840a85d5af5bf1d1762f925bdaddc4201f984#code
contract Ring {
/// @notice EIP-20 token name for this token
// solhint-disable-next-line const-name-snakecase
string public constant name = "Ring";
/// @notice EIP-20 token symbol for this token
// solhint-disable-next-line const-name-snakecase
string public constant symbol = "RING";
/// @notice EIP-20 token decimals for this token
// solhint-disable-next-line const-name-snakecase
uint8 public constant decimals = 18;
/// @notice Total number of tokens in circulation
// solhint-disable-next-line const-name-snakecase
uint public totalSupply = 1_000_000_000e18; // 1 billion Ring
/// @notice Address which may mint new tokens
address public minter;
mapping (address => mapping (address => uint96)) internal allowances;
mapping (address => uint96) internal balances;
/// @notice A record of each accounts delegate
mapping (address => address) public delegates;
/// @notice A checkpoint for marking number of votes from a given block
struct Checkpoint {
uint32 fromBlock;
uint96 votes;
}
/// @notice A record of votes checkpoints for each account, by index
mapping (address => mapping (uint32 => Checkpoint)) public checkpoints;
/// @notice The number of checkpoints for each account
mapping (address => uint32) public numCheckpoints;
/// @notice The EIP-712 typehash for the contract's domain
bytes32 public constant DOMAIN_TYPEHASH = keccak256("EIP712Domain(string name,uint256 chainId,address verifyingContract)");
/// @notice The EIP-712 typehash for the delegation struct used by the contract
bytes32 public constant DELEGATION_TYPEHASH = keccak256("Delegation(address delegatee,uint256 nonce,uint256 expiry)");
/// @notice The EIP-712 typehash for the permit struct used by the contract
bytes32 public constant PERMIT_TYPEHASH = keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)");
/// @notice A record of states for signing / validating signatures
mapping (address => uint) public nonces;
/// @notice An event thats emitted when the minter address is changed
event MinterChanged(address minter, address newMinter);
/// @notice An event thats emitted when an account changes its delegate
event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);
/// @notice An event thats emitted when a delegate account's vote balance changes
event DelegateVotesChanged(address indexed delegate, uint previousBalance, uint newBalance);
/// @notice The standard EIP-20 transfer event
event Transfer(address indexed from, address indexed to, uint256 amount);
/// @notice The standard EIP-20 approval event
event Approval(address indexed owner, address indexed spender, uint256 amount);
/**
* @notice Construct a new Ring token
* @param account The initial account to grant all the tokens
* @param minter_ The account with minting ability
*/
constructor(address account, address minter_) {
balances[account] = uint96(totalSupply);
emit Transfer(address(0), account, totalSupply);
minter = minter_;
emit MinterChanged(address(0), minter);
}
/**
* @notice Change the minter address
* @param minter_ The address of the new minter
*/
function setMinter(address minter_) external {
require(msg.sender == minter, "Ring: only the minter can change the minter address");
emit MinterChanged(minter, minter_);
minter = minter_;
}
/**
* @notice Mint new tokens
* @param dst The address of the destination account
* @param rawAmount The number of tokens to be minted
*/
function mint(address dst, uint rawAmount) external {
require(msg.sender == minter, "Ring: only the minter can mint");
require(dst != address(0), "Ring: cannot transfer to the zero address");
// mint the amount
uint96 amount = safe96(rawAmount, "Ring: amount exceeds 96 bits");
uint96 safeSupply = safe96(totalSupply, "Ring: totalSupply exceeds 96 bits");
totalSupply = add96(safeSupply, amount, "Ring: totalSupply exceeds 96 bits");
// transfer the amount to the recipient
balances[dst] = add96(balances[dst], amount, "Ring: transfer amount overflows");
emit Transfer(address(0), dst, amount);
// move delegates
_moveDelegates(address(0), delegates[dst], amount);
}
/**
* @notice Get the number of tokens `spender` is approved to spend on behalf of `account`
* @param account The address of the account holding the funds
* @param spender The address of the account spending the funds
* @return The number of tokens approved
*/
function allowance(address account, address spender) external view returns (uint) {
return allowances[account][spender];
}
/**
* @notice Approve `spender` to transfer up to `amount` from `src`
* @dev This will overwrite the approval amount for `spender`
* and is subject to issues noted [here](https://eips.ethereum.org/EIPS/eip-20#approve)
* @param spender The address of the account which may transfer tokens
* @param rawAmount The number of tokens that are approved (2^256-1 means infinite)
* @return Whether or not the approval succeeded
*/
function approve(address spender, uint rawAmount) external returns (bool) {
uint96 amount;
if (rawAmount == uint(-1)) {
amount = uint96(-1);
} else {
amount = safe96(rawAmount, "Ring: amount exceeds 96 bits");
}
allowances[msg.sender][spender] = amount;
emit Approval(msg.sender, spender, amount);
return true;
}
/**
* @notice Triggers an approval from owner to spends
* @param owner The address to approve from
* @param spender The address to be approved
* @param rawAmount The number of tokens that are approved (2^256-1 means infinite)
* @param deadline The time at which to expire the signature
* @param v The recovery byte of the signature
* @param r Half of the ECDSA signature pair
* @param s Half of the ECDSA signature pair
*/
function permit(address owner, address spender, uint rawAmount, uint deadline, uint8 v, bytes32 r, bytes32 s) external {
uint96 amount;
if (rawAmount == uint(-1)) {
amount = uint96(-1);
} else {
amount = safe96(rawAmount, "Ring: amount exceeds 96 bits");
}
bytes32 domainSeparator = keccak256(abi.encode(DOMAIN_TYPEHASH, keccak256(bytes(name)), getChainId(), address(this)));
bytes32 structHash = keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, rawAmount, nonces[owner]++, deadline));
bytes32 digest = keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
address signatory = ecrecover(digest, v, r, s);
require(signatory != address(0), "Ring: invalid signature");
require(signatory == owner, "Ring: unauthorized");
// solhint-disable-next-line not-rely-on-time
require(block.timestamp <= deadline, "Ring: signature expired");
allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @notice Get the number of tokens held by the `account`
* @param account The address of the account to get the balance of
* @return The number of tokens held
*/
function balanceOf(address account) external view returns (uint) {
return balances[account];
}
/**
* @notice Transfer `amount` tokens from `msg.sender` to `dst`
* @param dst The address of the destination account
* @param rawAmount The number of tokens to transfer
* @return Whether or not the transfer succeeded
*/
function transfer(address dst, uint rawAmount) external returns (bool) {
uint96 amount = safe96(rawAmount, "Ring: amount exceeds 96 bits");
_transferTokens(msg.sender, dst, amount);
return true;
}
/**
* @notice Transfer `amount` tokens from `src` to `dst`
* @param src The address of the source account
* @param dst The address of the destination account
* @param rawAmount The number of tokens to transfer
* @return Whether or not the transfer succeeded
*/
function transferFrom(address src, address dst, uint rawAmount) external returns (bool) {
address spender = msg.sender;
uint96 spenderAllowance = allowances[src][spender];
uint96 amount = safe96(rawAmount, "Ring: amount exceeds 96 bits");
if (spender != src && spenderAllowance != uint96(-1)) {
uint96 newAllowance = sub96(spenderAllowance, amount, "Ring: transfer amount exceeds spender allowance");
allowances[src][spender] = newAllowance;
emit Approval(src, spender, newAllowance);
}
_transferTokens(src, dst, amount);
return true;
}
/**
* @notice Delegate votes from `msg.sender` to `delegatee`
* @param delegatee The address to delegate votes to
*/
function delegate(address delegatee) public {
return _delegate(msg.sender, delegatee);
}
/**
* @notice Delegates votes from signatory to `delegatee`
* @param delegatee The address to delegate votes to
* @param nonce The contract state required to match the signature
* @param expiry The time at which to expire the signature
* @param v The recovery byte of the signature
* @param r Half of the ECDSA signature pair
* @param s Half of the ECDSA signature pair
*/
function delegateBySig(address delegatee, uint nonce, uint expiry, uint8 v, bytes32 r, bytes32 s) public {
bytes32 domainSeparator = keccak256(abi.encode(DOMAIN_TYPEHASH, keccak256(bytes(name)), getChainId(), address(this)));
bytes32 structHash = keccak256(abi.encode(DELEGATION_TYPEHASH, delegatee, nonce, expiry));
bytes32 digest = keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
address signatory = ecrecover(digest, v, r, s);
require(signatory != address(0), "Ring: invalid signature");
require(nonce == nonces[signatory]++, "Ring: invalid nonce");
// solhint-disable-next-line not-rely-on-time
require(block.timestamp <= expiry, "Ring: signature expired");
return _delegate(signatory, delegatee);
}
/**
* @notice Gets the current votes balance for `account`
* @param account The address to get votes balance
* @return The number of current votes for `account`
*/
function getCurrentVotes(address account) external view returns (uint96) {
uint32 nCheckpoints = numCheckpoints[account];
return nCheckpoints > 0 ? checkpoints[account][nCheckpoints - 1].votes : 0;
}
/**
* @notice Determine the prior number of votes for an account as of a block number
* @dev Block number must be a finalized block or else this function will revert to prevent misinformation.
* @param account The address of the account to check
* @param blockNumber The block number to get the vote balance at
* @return The number of votes the account had as of the given block
*/
function getPriorVotes(address account, uint blockNumber) public view returns (uint96) {
require(blockNumber < block.number, "Ring: not yet determined");
uint32 nCheckpoints = numCheckpoints[account];
if (nCheckpoints == 0) {
return 0;
}
// First check most recent balance
if (checkpoints[account][nCheckpoints - 1].fromBlock <= blockNumber) {
return checkpoints[account][nCheckpoints - 1].votes;
}
// Next check implicit zero balance
if (checkpoints[account][0].fromBlock > blockNumber) {
return 0;
}
uint32 lower = 0;
uint32 upper = nCheckpoints - 1;
while (upper > lower) {
uint32 center = upper - (upper - lower) / 2; // ceil, avoiding overflow
Checkpoint memory cp = checkpoints[account][center];
if (cp.fromBlock == blockNumber) {
return cp.votes;
} else if (cp.fromBlock < blockNumber) {
lower = center;
} else {
upper = center - 1;
}
}
return checkpoints[account][lower].votes;
}
function _delegate(address delegator, address delegatee) internal {
address currentDelegate = delegates[delegator];
uint96 delegatorBalance = balances[delegator];
delegates[delegator] = delegatee;
emit DelegateChanged(delegator, currentDelegate, delegatee);
_moveDelegates(currentDelegate, delegatee, delegatorBalance);
}
function _transferTokens(address src, address dst, uint96 amount) internal {
require(src != address(0), "Ring: cannot transfer from the zero address");
require(dst != address(0), "Ring: cannot transfer to the zero address");
balances[src] = sub96(balances[src], amount, "Ring: transfer amount exceeds balance");
balances[dst] = add96(balances[dst], amount, "Ring: transfer amount overflows");
emit Transfer(src, dst, amount);
_moveDelegates(delegates[src], delegates[dst], amount);
}
function _moveDelegates(address srcRep, address dstRep, uint96 amount) internal {
if (srcRep != dstRep && amount > 0) {
if (srcRep != address(0)) {
uint32 srcRepNum = numCheckpoints[srcRep];
uint96 srcRepOld = srcRepNum > 0 ? checkpoints[srcRep][srcRepNum - 1].votes : 0;
uint96 srcRepNew = sub96(srcRepOld, amount, "Ring: vote amount underflows");
_writeCheckpoint(srcRep, srcRepNum, srcRepOld, srcRepNew);
}
if (dstRep != address(0)) {
uint32 dstRepNum = numCheckpoints[dstRep];
uint96 dstRepOld = dstRepNum > 0 ? checkpoints[dstRep][dstRepNum - 1].votes : 0;
uint96 dstRepNew = add96(dstRepOld, amount, "Ring: vote amount overflows");
_writeCheckpoint(dstRep, dstRepNum, dstRepOld, dstRepNew);
}
}
}
function _writeCheckpoint(address delegatee, uint32 nCheckpoints, uint96 oldVotes, uint96 newVotes) internal {
uint32 blockNumber = safe32(block.number, "Ring: block number exceeds 32 bits");
if (nCheckpoints > 0 && checkpoints[delegatee][nCheckpoints - 1].fromBlock == blockNumber) {
checkpoints[delegatee][nCheckpoints - 1].votes = newVotes;
} else {
checkpoints[delegatee][nCheckpoints] = Checkpoint(blockNumber, newVotes);
numCheckpoints[delegatee] = nCheckpoints + 1;
}
emit DelegateVotesChanged(delegatee, oldVotes, newVotes);
}
function safe32(uint n, string memory errorMessage) internal pure returns (uint32) {
require(n < 2**32, errorMessage);
return uint32(n);
}
function safe96(uint n, string memory errorMessage) internal pure returns (uint96) {
require(n < 2**96, errorMessage);
return uint96(n);
}
function add96(uint96 a, uint96 b, string memory errorMessage) internal pure returns (uint96) {
uint96 c = a + b;
require(c >= a, errorMessage);
return c;
}
function sub96(uint96 a, uint96 b, string memory errorMessage) internal pure returns (uint96) {
require(b <= a, errorMessage);
return a - b;
}
function getChainId() internal pure returns (uint) {
uint256 chainId;
// solhint-disable-next-line no-inline-assembly
assembly { chainId := chainid() }
return chainId;
}
}
|
0x608060405234801561001057600080fd5b50600436106101585760003560e01c806370a08231116100c3578063c3cda5201161007c578063c3cda520146102cc578063d505accf146102df578063dd62ed3e146102f2578063e7a324dc14610305578063f1127ed81461030d578063fca3b5aa1461032e57610158565b806370a0823114610258578063782d6fe11461026b5780637ecebe001461028b57806395d89b411461029e578063a9059cbb146102a6578063b4b5ea57146102b957610158565b806330adf81f1161011557806330adf81f146101e0578063313ce567146101e857806340c10f19146101fd578063587cde1e146102125780635c19a95c146102255780636fcfff451461023857610158565b806306fdde031461015d578063075461721461017b578063095ea7b31461019057806318160ddd146101b057806320606b70146101c557806323b872dd146101cd575b600080fd5b610165610341565b6040516101729190611aaa565b60405180910390f35b610183610361565b60405161017291906119ce565b6101a361019e3660046118f5565b610370565b60405161017291906119fc565b6101b861043a565b6040516101729190611a07565b6101b8610440565b6101a36101db366004611851565b610464565b6101b86105b3565b6101f06105d7565b6040516101729190611d49565b61021061020b3660046118f5565b6105dc565b005b610183610220366004611805565b6107b9565b610210610233366004611805565b6107d4565b61024b610246366004611805565b6107e1565b6040516101729190611d19565b6101b8610266366004611805565b6107f9565b61027e6102793660046118f5565b610821565b6040516101729190611d57565b6101b8610299366004611805565b610a2a565b610165610a3c565b6101a36102b43660046118f5565b610a5c565b61027e6102c7366004611805565b610aa3565b6102106102da36600461191e565b610b14565b6102106102ed36600461188c565b610d16565b6101b861030036600461181f565b61101f565b6101b8611053565b61032061031b366004611975565b611077565b604051610172929190611d2a565b61021061033c366004611805565b6110ac565b6040518060400160405280600481526020016352696e6760e01b81525081565b6001546001600160a01b031681565b60008060001983141561038657506000196103b6565b6103b3836040518060400160405280601c8152602001600080516020611d8683398151915281525061113f565b90505b3360008181526002602090815260408083206001600160a01b03891680855292529182902080546001600160601b0319166001600160601b03861617905590519091907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92590610426908590611d57565b60405180910390a360019150505b92915050565b60005481565b7f8cad95687ba82c2ce50e74f7b754645e5117c3a5bec8151c0726d5857980a86681565b6001600160a01b038316600090815260026020908152604080832033808552908352818420548251808401909352601c8352600080516020611d8683398151915293830193909352916001600160601b03169083906104c490869061113f565b9050866001600160a01b0316836001600160a01b0316141580156104f157506001600160601b0382811614155b1561059b57600061051b83836040518060600160405280602f8152602001611e0e602f913961116e565b6001600160a01b038981166000818152600260209081526040808320948a16808452949091529081902080546001600160601b0319166001600160601b0386161790555192935090917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92590610591908590611d57565b60405180910390a3505b6105a68787836111ad565b5060019695505050505050565b7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b601281565b6001546001600160a01b0316331461060f5760405162461bcd60e51b815260040161060690611c0f565b60405180910390fd5b6001600160a01b0382166106355760405162461bcd60e51b815260040161060690611c99565b6000610664826040518060400160405280601c8152602001600080516020611d8683398151915281525061113f565b9050600061068c600054604051806060016040528060218152602001611da66021913961113f565b90506106b18183604051806060016040528060218152602001611da660219139611371565b6001600160601b0390811660009081556001600160a01b038616815260036020908152604091829020548251808401909352601f83527f52696e673a207472616e7366657220616d6f756e74206f766572666c6f7773009183019190915261071c9216908490611371565b6001600160a01b03851660008181526003602052604080822080546001600160601b0319166001600160601b03959095169490941790935591519091907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90610786908690611d57565b60405180910390a36001600160a01b038085166000908152600460205260408120546107b39216846113ad565b50505050565b6004602052600090815260409020546001600160a01b031681565b6107de3382611579565b50565b60066020526000908152604090205463ffffffff1681565b6001600160a01b0381166000908152600360205260409020546001600160601b03165b919050565b60004382106108425760405162461bcd60e51b815260040161060690611ce2565b6001600160a01b03831660009081526006602052604090205463ffffffff1680610870576000915050610434565b6001600160a01b038416600090815260056020908152604080832063ffffffff6000198601811685529252909120541683106108ec576001600160a01b03841660009081526005602090815260408083206000199490940163ffffffff1683529290522054600160201b90046001600160601b03169050610434565b6001600160a01b038416600090815260056020908152604080832083805290915290205463ffffffff16831015610927576000915050610434565b600060001982015b8163ffffffff168163ffffffff1611156109e5576000600263ffffffff848403166001600160a01b038916600090815260056020908152604080832094909304860363ffffffff818116845294825291839020835180850190945254938416808452600160201b9094046001600160601b0316908301529250908714156109c0576020015194506104349350505050565b805163ffffffff168711156109d7578193506109de565b6001820392505b505061092f565b506001600160a01b038516600090815260056020908152604080832063ffffffff909416835292905220546001600160601b03600160201b9091041691505092915050565b60076020526000908152604090205481565b6040518060400160405280600481526020016352494e4760e01b81525081565b600080610a8c836040518060400160405280601c8152602001600080516020611d8683398151915281525061113f565b9050610a993385836111ad565b5060019392505050565b6001600160a01b03811660009081526006602052604081205463ffffffff1680610ace576000610b0d565b6001600160a01b0383166000908152600560209081526040808320600019850163ffffffff168452909152902054600160201b90046001600160601b03165b9392505050565b60408051808201909152600481526352696e6760e01b60209091015260007f8cad95687ba82c2ce50e74f7b754645e5117c3a5bec8151c0726d5857980a8667fc6beda7b457a57620b9022f23705e3f1fadfb82c28e813d8c78338ac82e9a9f7610b7c6115fd565b30604051602001610b909493929190611a68565b60405160208183030381529060405280519060200120905060007fe48329057bfd03d55e49b547132e39cffd9c1820ad7b9d4c5307691425d15adf888888604051602001610be19493929190611a44565b60405160208183030381529060405280519060200120905060008282604051602001610c0e9291906119b3565b604051602081830303815290604052805190602001209050600060018288888860405160008152602001604052604051610c4b9493929190611a8c565b6020604051602081039080840390855afa158015610c6d573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116610ca05760405162461bcd60e51b815260040161060690611b2a565b6001600160a01b03811660009081526007602052604090208054600181019091558914610cdf5760405162461bcd60e51b815260040161060690611afd565b87421115610cff5760405162461bcd60e51b815260040161060690611bac565b610d09818b611579565b505050505b505050505050565b6000600019861415610d2b5750600019610d5b565b610d58866040518060400160405280601c8152602001600080516020611d8683398151915281525061113f565b90505b60408051808201909152600481526352696e6760e01b60209091015260007f8cad95687ba82c2ce50e74f7b754645e5117c3a5bec8151c0726d5857980a8667fc6beda7b457a57620b9022f23705e3f1fadfb82c28e813d8c78338ac82e9a9f7610dc36115fd565b30604051602001610dd79493929190611a68565b60408051601f1981840301815282825280516020918201206001600160a01b038d166000908152600783529283208054600181019091559094509192610e49927f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9928e928e928e9290918e9101611a10565b60405160208183030381529060405280519060200120905060008282604051602001610e769291906119b3565b604051602081830303815290604052805190602001209050600060018289898960405160008152602001604052604051610eb39493929190611a8c565b6020604051602081039080840390855afa158015610ed5573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116610f085760405162461bcd60e51b815260040161060690611b2a565b8b6001600160a01b0316816001600160a01b031614610f395760405162461bcd60e51b815260040161060690611be3565b88421115610f595760405162461bcd60e51b815260040161060690611bac565b84600260008e6001600160a01b03166001600160a01b0316815260200190815260200160002060008d6001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a8154816001600160601b0302191690836001600160601b031602179055508a6001600160a01b03168c6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925876040516110099190611d57565b60405180910390a3505050505050505050505050565b6001600160a01b0391821660009081526002602090815260408083209390941682529190915220546001600160601b031690565b7fe48329057bfd03d55e49b547132e39cffd9c1820ad7b9d4c5307691425d15adf81565b600560209081526000928352604080842090915290825290205463ffffffff811690600160201b90046001600160601b031682565b6001546001600160a01b031633146110d65760405162461bcd60e51b815260040161060690611c46565b6001546040517f3b0007eb941cf645526cbb3a4fdaecda9d28ce4843167d9263b536a1f1edc0f691611115916001600160a01b039091169084906119e2565b60405180910390a1600180546001600160a01b0319166001600160a01b0392909216919091179055565b600081600160601b84106111665760405162461bcd60e51b81526004016106069190611aaa565b509192915050565b6000836001600160601b0316836001600160601b0316111582906111a55760405162461bcd60e51b81526004016106069190611aaa565b505050900390565b6001600160a01b0383166111d35760405162461bcd60e51b815260040161060690611b61565b6001600160a01b0382166111f95760405162461bcd60e51b815260040161060690611c99565b6001600160a01b038316600090815260036020908152604091829020548251606081019093526025808452611244936001600160601b039092169285929190611dc79083013961116e565b6001600160a01b03848116600090815260036020908152604080832080546001600160601b0319166001600160601b03968716179055928616825290829020548251808401909352601f83527f52696e673a207472616e7366657220616d6f756e74206f766572666c6f777300918301919091526112c59216908390611371565b6001600160a01b038381166000818152600360205260409081902080546001600160601b0319166001600160601b0395909516949094179093559151908516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90611332908590611d57565b60405180910390a36001600160a01b0380841660009081526004602052604080822054858416835291205461136c929182169116836113ad565b505050565b6000838301826001600160601b0380871690831610156113a45760405162461bcd60e51b81526004016106069190611aaa565b50949350505050565b816001600160a01b0316836001600160a01b0316141580156113d857506000816001600160601b0316115b1561136c576001600160a01b038316156114ad576001600160a01b03831660009081526006602052604081205463ffffffff169081611418576000611457565b6001600160a01b0385166000908152600560209081526040808320600019860163ffffffff168452909152902054600160201b90046001600160601b03165b9050600061149b82856040518060400160405280601c81526020017f52696e673a20766f746520616d6f756e7420756e646572666c6f77730000000081525061116e565b90506114a986848484611601565b5050505b6001600160a01b0382161561136c576001600160a01b03821660009081526006602052604081205463ffffffff1690816114e8576000611527565b6001600160a01b0384166000908152600560209081526040808320600019860163ffffffff168452909152902054600160201b90046001600160601b03165b9050600061156b82856040518060400160405280601b81526020017f52696e673a20766f746520616d6f756e74206f766572666c6f77730000000000815250611371565b9050610d0e85848484611601565b6001600160a01b03808316600081815260046020818152604080842080546003845282862054949093528787166001600160a01b031984168117909155905191909516946001600160601b039092169391928592917f3134e8a2e6d97e929a7e54011ea5485d7d196dd5f0ba4d4ef95803e8e3fc257f9190a46107b38284836113ad565b4690565b600061162543604051806060016040528060228152602001611dec602291396117b6565b905060008463ffffffff1611801561166e57506001600160a01b038516600090815260056020908152604080832063ffffffff6000198901811685529252909120548282169116145b156116cd576001600160a01b0385166000908152600560209081526040808320600019880163ffffffff168452909152902080546fffffffffffffffffffffffff000000001916600160201b6001600160601b0385160217905561176c565b60408051808201825263ffffffff80841682526001600160601b0380861660208085019182526001600160a01b038b166000818152600583528781208c871682528352878120965187549451909516600160201b026fffffffffffffffffffffffff000000001995871663ffffffff19958616179590951694909417909555938252600690935292909220805460018801909316929091169190911790555b846001600160a01b03167fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a72484846040516117a7929190611d6b565b60405180910390a25050505050565b600081600160201b84106111665760405162461bcd60e51b81526004016106069190611aaa565b80356001600160a01b038116811461081c57600080fd5b803560ff8116811461081c57600080fd5b600060208284031215611816578081fd5b610b0d826117dd565b60008060408385031215611831578081fd5b61183a836117dd565b9150611848602084016117dd565b90509250929050565b600080600060608486031215611865578081fd5b61186e846117dd565b925061187c602085016117dd565b9150604084013590509250925092565b600080600080600080600060e0888a0312156118a6578283fd5b6118af886117dd565b96506118bd602089016117dd565b955060408801359450606088013593506118d9608089016117f4565b925060a0880135915060c0880135905092959891949750929550565b60008060408385031215611907578182fd5b611910836117dd565b946020939093013593505050565b60008060008060008060c08789031215611936578182fd5b61193f876117dd565b9550602087013594506040870135935061195b606088016117f4565b92506080870135915060a087013590509295509295509295565b60008060408385031215611987578182fd5b611990836117dd565b9150602083013563ffffffff811681146119a8578182fd5b809150509250929050565b61190160f01b81526002810192909252602282015260420190565b6001600160a01b0391909116815260200190565b6001600160a01b0392831681529116602082015260400190565b901515815260200190565b90815260200190565b9586526001600160a01b0394851660208701529290931660408501526060840152608083019190915260a082015260c00190565b9384526001600160a01b039290921660208401526040830152606082015260800190565b938452602084019290925260408301526001600160a01b0316606082015260800190565b93845260ff9290921660208401526040830152606082015260800190565b6000602080835283518082850152825b81811015611ad657858101830151858201604001528201611aba565b81811115611ae75783604083870101525b50601f01601f1916929092016040019392505050565b60208082526013908201527252696e673a20696e76616c6964206e6f6e636560681b604082015260600190565b60208082526017908201527f52696e673a20696e76616c6964207369676e6174757265000000000000000000604082015260600190565b6020808252602b908201527f52696e673a2063616e6e6f74207472616e736665722066726f6d20746865207a60408201526a65726f206164647265737360a81b606082015260800190565b60208082526017908201527f52696e673a207369676e61747572652065787069726564000000000000000000604082015260600190565b602080825260129082015271149a5b99ce881d5b985d5d1a1bdc9a5e995960721b604082015260600190565b6020808252601e908201527f52696e673a206f6e6c7920746865206d696e7465722063616e206d696e740000604082015260600190565b60208082526033908201527f52696e673a206f6e6c7920746865206d696e7465722063616e206368616e676560408201527220746865206d696e746572206164647265737360681b606082015260800190565b60208082526029908201527f52696e673a2063616e6e6f74207472616e7366657220746f20746865207a65726040820152686f206164647265737360b81b606082015260800190565b60208082526018908201527f52696e673a206e6f74207965742064657465726d696e65640000000000000000604082015260600190565b63ffffffff91909116815260200190565b63ffffffff9290921682526001600160601b0316602082015260400190565b60ff91909116815260200190565b6001600160601b0391909116815260200190565b6001600160601b039283168152911660208201526040019056fe52696e673a20616d6f756e74206578636565647320393620626974730000000052696e673a20746f74616c537570706c792065786365656473203936206269747352696e673a207472616e7366657220616d6f756e7420657863656564732062616c616e636552696e673a20626c6f636b206e756d6265722065786365656473203332206269747352696e673a207472616e7366657220616d6f756e742065786365656473207370656e64657220616c6c6f77616e6365a26469706673582212209fdc96e0722f7a2b2e6bee3834547a63850dcce125f01d239625714ea32da62564736f6c63430007060033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}]}}
| 2,240 |
0x1348376f7731BA1F538fc59e3Dd391a14815D01C
|
/**
*Submitted for verification at Etherscan.io on 2021-08-05
*/
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
// Part: Address
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies in extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
// solhint-disable-next-line no-inline-assembly
assembly { size := extcodesize(account) }
return size > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain`call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
// Part: Proxy
/**
* @title Proxy
* @dev Implements delegation of calls to other contracts, with proper
* forwarding of return values and bubbling of failures.
* It defines a fallback function that delegates all calls to the address
* returned by the abstract _implementation() internal function.
*/
abstract contract Proxy {
/**
* @dev Fallback function.
* Implemented entirely in `_fallback`.
*/
fallback () payable external {
_fallback();
}
/**
* @dev Receive function.
* Implemented entirely in `_fallback`.
*/
receive () payable external {
_fallback();
}
/**
* @return The Address of the implementation.
*/
function _implementation() internal virtual view returns (address);
/**
* @dev Delegates execution to an implementation contract.
* This is a low level function that doesn't return to its internal call site.
* It will return to the external caller whatever the implementation returns.
* @param implementation Address to delegate.
*/
function _delegate(address implementation) internal {
assembly {
// Copy msg.data. We take full control of memory in this inline assembly
// block because it will not return to Solidity code. We overwrite the
// Solidity scratch pad at memory position 0.
calldatacopy(0, 0, calldatasize())
// Call the implementation.
// out and outsize are 0 because we don't know the size yet.
let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)
// Copy the returned data.
returndatacopy(0, 0, returndatasize())
switch result
// delegatecall returns 0 on error.
case 0 { revert(0, returndatasize()) }
default { return(0, returndatasize()) }
}
}
/**
* @dev Function that is run as the first thing in the fallback function.
* Can be redefined in derived contracts to add functionality.
* Redefinitions must call super._willFallback().
*/
function _willFallback() internal virtual {
}
/**
* @dev fallback implementation.
* Extracted to enable manual triggering.
*/
function _fallback() internal {
_willFallback();
_delegate(_implementation());
}
}
// Part: UpgradeabilityProxy
/**
* @title UpgradeabilityProxy
* @dev This contract implements a proxy that allows to change the
* implementation address to which it will delegate.
* Such a change is called an implementation upgrade.
*/
contract UpgradeabilityProxy is Proxy {
/**
* @dev Contract constructor.
* @param _logic Address of the initial implementation.
* @param _data Data to send as msg.data to the implementation to initialize the proxied contract.
* It should include the signature and the parameters of the function to be called, as described in
* https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
* This parameter is optional, if no data is given the initialization call to proxied contract will be skipped.
*/
constructor(address _logic, bytes memory _data) public payable {
assert(IMPLEMENTATION_SLOT == bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1));
_setImplementation(_logic);
if(_data.length > 0) {
(bool success,) = _logic.delegatecall(_data);
require(success);
}
}
/**
* @dev Emitted when the implementation is upgraded.
* @param implementation Address of the new implementation.
*/
event Upgraded(address indexed implementation);
/**
* @dev Storage slot with the address of the current implementation.
* This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 internal constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
/**
* @dev Returns the current implementation.
* @return impl Address of the current implementation
*/
function _implementation() internal override view returns (address impl) {
bytes32 slot = IMPLEMENTATION_SLOT;
assembly {
impl := sload(slot)
}
}
/**
* @dev Upgrades the proxy to a new implementation.
* @param newImplementation Address of the new implementation.
*/
function _upgradeTo(address newImplementation) internal {
_setImplementation(newImplementation);
emit Upgraded(newImplementation);
}
/**
* @dev Sets the implementation address of the proxy.
* @param newImplementation Address of the new implementation.
*/
function _setImplementation(address newImplementation) internal {
require(Address.isContract(newImplementation), "Cannot set a proxy implementation to a non-contract address");
bytes32 slot = IMPLEMENTATION_SLOT;
assembly {
sstore(slot, newImplementation)
}
}
}
// File: AdminUpgradeabilityProxy.sol
/**
* @title AdminUpgradeabilityProxy
* @dev This contract combines an upgradeability proxy with an authorization
* mechanism for administrative tasks.
* All external functions in this contract must be guarded by the
* `ifAdmin` modifier. See ethereum/solidity#3864 for a Solidity
* feature proposal that would enable this to be done automatically.
*/
contract AdminUpgradeabilityProxy is UpgradeabilityProxy {
/**
* Contract constructor.
* @param _logic address of the initial implementation.
* @param _admin Address of the proxy administrator.
* @param _data Data to send as msg.data to the implementation to initialize the proxied contract.
* It should include the signature and the parameters of the function to be called, as described in
* https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
* This parameter is optional, if no data is given the initialization call to proxied contract will be skipped.
*/
constructor(address _logic, address _admin, bytes memory _data) UpgradeabilityProxy(_logic, _data) public payable {
assert(ADMIN_SLOT == bytes32(uint256(keccak256('eip1967.proxy.admin')) - 1));
_setAdmin(_admin);
}
/**
* @dev Emitted when the administration has been transferred.
* @param previousAdmin Address of the previous admin.
* @param newAdmin Address of the new admin.
*/
event AdminChanged(address previousAdmin, address newAdmin);
/**
* @dev Storage slot with the admin of the contract.
* This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 internal constant ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;
/**
* @dev Modifier to check whether the `msg.sender` is the admin.
* If it is, it will run the function. Otherwise, it will delegate the call
* to the implementation.
*/
modifier ifAdmin() {
if (msg.sender == _admin()) {
_;
} else {
_fallback();
}
}
/**
* @return The address of the proxy admin.
*/
function admin() external ifAdmin returns (address) {
return _admin();
}
/**
* @return The address of the implementation.
*/
function implementation() external ifAdmin returns (address) {
return _implementation();
}
/**
* @dev Changes the admin of the proxy.
* Only the current admin can call this function.
* @param newAdmin Address to transfer proxy administration to.
*/
function changeAdmin(address newAdmin) external ifAdmin {
require(newAdmin != address(0), "Cannot change the admin of a proxy to the zero address");
emit AdminChanged(_admin(), newAdmin);
_setAdmin(newAdmin);
}
/**
* @dev Upgrade the backing implementation of the proxy.
* Only the admin can call this function.
* @param newImplementation Address of the new implementation.
*/
function upgradeTo(address newImplementation) external ifAdmin {
_upgradeTo(newImplementation);
}
/**
* @dev Upgrade the backing implementation of the proxy and call a function
* on the new implementation.
* This is useful to initialize the proxied contract.
* @param newImplementation Address of the new implementation.
* @param data Data to send as msg.data in the low level call.
* It should include the signature and the parameters of the function to be called, as described in
* https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
*/
function upgradeToAndCall(address newImplementation, bytes calldata data) payable external ifAdmin {
_upgradeTo(newImplementation);
(bool success,) = newImplementation.delegatecall(data);
require(success);
}
/**
* @return adm The admin slot.
*/
function _admin() internal view returns (address adm) {
bytes32 slot = ADMIN_SLOT;
assembly {
adm := sload(slot)
}
}
/**
* @dev Sets the address of the proxy admin.
* @param newAdmin Address of the new proxy admin.
*/
function _setAdmin(address newAdmin) internal {
bytes32 slot = ADMIN_SLOT;
assembly {
sstore(slot, newAdmin)
}
}
/**
* @dev Only fall back when the sender is not the admin.
*/
function _willFallback() internal override virtual {
require(msg.sender != _admin(), "Cannot call fallback function from the proxy admin");
super._willFallback();
}
}
|
0x60806040526004361061004e5760003560e01c80633659cfe6146100655780634f1ef286146100985780635c60da1b146101185780638f28397014610149578063f851a4401461017c5761005d565b3661005d5761005b610191565b005b61005b610191565b34801561007157600080fd5b5061005b6004803603602081101561008857600080fd5b50356001600160a01b03166101ab565b61005b600480360360408110156100ae57600080fd5b6001600160a01b0382351691908101906040810160208201356401000000008111156100d957600080fd5b8201836020820111156100eb57600080fd5b8035906020019184600183028401116401000000008311171561010d57600080fd5b5090925090506101e5565b34801561012457600080fd5b5061012d610292565b604080516001600160a01b039092168252519081900360200190f35b34801561015557600080fd5b5061005b6004803603602081101561016c57600080fd5b50356001600160a01b03166102cf565b34801561018857600080fd5b5061012d610389565b6101996103ba565b6101a96101a461041a565b61043f565b565b6101b3610463565b6001600160a01b0316336001600160a01b031614156101da576101d581610488565b6101e2565b6101e2610191565b50565b6101ed610463565b6001600160a01b0316336001600160a01b031614156102855761020f83610488565b6000836001600160a01b031683836040518083838082843760405192019450600093509091505080830381855af49150503d806000811461026c576040519150601f19603f3d011682016040523d82523d6000602084013e610271565b606091505b505090508061027f57600080fd5b5061028d565b61028d610191565b505050565b600061029c610463565b6001600160a01b0316336001600160a01b031614156102c4576102bd61041a565b90506102cc565b6102cc610191565b90565b6102d7610463565b6001600160a01b0316336001600160a01b031614156101da576001600160a01b0381166103355760405162461bcd60e51b81526004018080602001828103825260368152602001806105876036913960400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61035e610463565b604080516001600160a01b03928316815291841660208301528051918290030190a16101d5816104c8565b6000610393610463565b6001600160a01b0316336001600160a01b031614156102c4576102bd610463565b3b151590565b6103c2610463565b6001600160a01b0316336001600160a01b031614156104125760405162461bcd60e51b81526004018080602001828103825260328152602001806105556032913960400191505060405180910390fd5b6101a96101a9565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b610491816104ec565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b6104f5816103b4565b6105305760405162461bcd60e51b815260040180806020018281038252603b8152602001806105bd603b913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5556fe43616e6e6f742063616c6c2066616c6c6261636b2066756e6374696f6e2066726f6d207468652070726f78792061646d696e43616e6e6f74206368616e6765207468652061646d696e206f6620612070726f787920746f20746865207a65726f206164647265737343616e6e6f742073657420612070726f787920696d706c656d656e746174696f6e20746f2061206e6f6e2d636f6e74726163742061646472657373a26469706673582212204ed1eee2d6ef0aa1fdf2eaa695796bffbf8d5f72c42e9c57592c2e268aa39e2d64736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 2,241 |
0x5c37d4f0e8d03820bec925e105a53fd94f6cf4ab
|
// File: contracts/lib/SafeMath.sol
/*
Copyright 2020 DODO ZOO.
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity 0.6.9;
pragma experimental ABIEncoderV2;
/**
* @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/DecimalMath.sol
/*
Copyright 2020 DODO ZOO.
*/
/**
* @title DecimalMath
* @author DODO Breeder
*
* @notice Functions for fixed point number with 18 decimals
*/
library DecimalMath {
using SafeMath for uint256;
uint256 constant ONE = 10**18;
function mul(uint256 target, uint256 d) internal pure returns (uint256) {
return target.mul(d) / ONE;
}
function mulCeil(uint256 target, uint256 d) internal pure returns (uint256) {
return target.mul(d).divCeil(ONE);
}
function divFloor(uint256 target, uint256 d) internal pure returns (uint256) {
return target.mul(ONE).div(d);
}
function divCeil(uint256 target, uint256 d) internal pure returns (uint256) {
return target.mul(ONE).divCeil(d);
}
}
// File: contracts/lib/Ownable.sol
/*
Copyright 2020 DODO ZOO.
*/
/**
* @title Ownable
* @author DODO Breeder
*
* @notice Ownership related functions
*/
contract Ownable {
address public _OWNER_;
address public _NEW_OWNER_;
// ============ Events ============
event OwnershipTransferPrepared(address indexed previousOwner, address indexed newOwner);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
// ============ Modifiers ============
modifier onlyOwner() {
require(msg.sender == _OWNER_, "NOT_OWNER");
_;
}
// ============ Functions ============
constructor() internal {
_OWNER_ = msg.sender;
emit OwnershipTransferred(address(0), _OWNER_);
}
function transferOwnership(address newOwner) external onlyOwner {
require(newOwner != address(0), "INVALID_OWNER");
emit OwnershipTransferPrepared(_OWNER_, newOwner);
_NEW_OWNER_ = newOwner;
}
function claimOwnership() external {
require(msg.sender == _NEW_OWNER_, "INVALID_CLAIM");
emit OwnershipTransferred(_OWNER_, _NEW_OWNER_);
_OWNER_ = _NEW_OWNER_;
_NEW_OWNER_ = address(0);
}
}
// File: contracts/intf/IERC20.sol
// This is a file copied from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/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);
/**
* @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/SafeERC20.sol
/*
Copyright 2020 DODO ZOO.
This is a simplified version of OpenZepplin's SafeERC20 library
*/
/**
* @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/token/LockedTokenVault.sol
/*
Copyright 2020 DODO ZOO.
*/
/**
* @title LockedTokenVault
* @author DODO Breeder
*
* @notice Lock Token and release it linearly
*/
contract LockedTokenVault is Ownable {
using SafeMath for uint256;
using SafeERC20 for IERC20;
address _TOKEN_;
mapping(address => uint256) internal originBalances;
mapping(address => uint256) internal claimedBalances;
uint256 public _UNDISTRIBUTED_AMOUNT_;
uint256 public _START_RELEASE_TIME_;
uint256 public _RELEASE_DURATION_;
uint256 public _CLIFF_RATE_;
bool public _DISTRIBUTE_FINISHED_;
// ============ Modifiers ============
event Claim(address indexed holder, uint256 origin, uint256 claimed, uint256 amount);
// ============ Modifiers ============
modifier beforeStartRelease() {
require(block.timestamp < _START_RELEASE_TIME_, "RELEASE START");
_;
}
modifier afterStartRelease() {
require(block.timestamp >= _START_RELEASE_TIME_, "RELEASE NOT START");
_;
}
modifier distributeNotFinished() {
require(!_DISTRIBUTE_FINISHED_, "DISTRIBUTE FINISHED");
_;
}
// ============ Init Functions ============
constructor(
address _token,
uint256 _startReleaseTime,
uint256 _releaseDuration,
uint256 _cliffRate
) public {
_TOKEN_ = _token;
_START_RELEASE_TIME_ = _startReleaseTime;
_RELEASE_DURATION_ = _releaseDuration;
_CLIFF_RATE_ = _cliffRate;
}
function deposit(uint256 amount) external onlyOwner {
_tokenTransferIn(_OWNER_, amount);
_UNDISTRIBUTED_AMOUNT_ = _UNDISTRIBUTED_AMOUNT_.add(amount);
}
function withdraw(uint256 amount) external onlyOwner {
_UNDISTRIBUTED_AMOUNT_ = _UNDISTRIBUTED_AMOUNT_.sub(amount);
_tokenTransferOut(_OWNER_, amount);
}
function finishDistribute() external onlyOwner {
_DISTRIBUTE_FINISHED_ = true;
}
// ============ For Owner ============
function grant(address[] calldata holderList, uint256[] calldata amountList)
external
onlyOwner
{
require(holderList.length == amountList.length, "batch grant length not match");
uint256 amount = 0;
for (uint256 i = 0; i < holderList.length; ++i) {
// for saving gas, no event for grant
originBalances[holderList[i]] = originBalances[holderList[i]].add(amountList[i]);
amount = amount.add(amountList[i]);
}
_UNDISTRIBUTED_AMOUNT_ = _UNDISTRIBUTED_AMOUNT_.sub(amount);
}
function recall(address holder) external onlyOwner distributeNotFinished {
_UNDISTRIBUTED_AMOUNT_ = _UNDISTRIBUTED_AMOUNT_.add(originBalances[holder]).sub(
claimedBalances[holder]
);
originBalances[holder] = 0;
claimedBalances[holder] = 0;
}
// ============ For Holder ============
function transferLockedToken(address to) external {
originBalances[to] = originBalances[to].add(originBalances[msg.sender]);
claimedBalances[to] = claimedBalances[to].add(claimedBalances[msg.sender]);
originBalances[msg.sender] = 0;
claimedBalances[msg.sender] = 0;
}
function claim() external {
uint256 claimableToken = getClaimableBalance(msg.sender);
_tokenTransferOut(msg.sender, claimableToken);
claimedBalances[msg.sender] = claimedBalances[msg.sender].add(claimableToken);
emit Claim(
msg.sender,
originBalances[msg.sender],
claimedBalances[msg.sender],
claimableToken
);
}
// ============ View ============
function isReleaseStart() external view returns (bool) {
return block.timestamp >= _START_RELEASE_TIME_;
}
function getOriginBalance(address holder) external view returns (uint256) {
return originBalances[holder];
}
function getClaimedBalance(address holder) external view returns (uint256) {
return claimedBalances[holder];
}
function getClaimableBalance(address holder) public view returns (uint256) {
uint256 remainingToken = getRemainingBalance(holder);
return originBalances[holder].sub(remainingToken).sub(claimedBalances[holder]);
}
function getRemainingBalance(address holder) public view returns (uint256) {
uint256 remainingRatio = getRemainingRatio(block.timestamp);
return DecimalMath.mul(originBalances[holder], remainingRatio);
}
function getRemainingRatio(uint256 timestamp) public view returns (uint256) {
if (timestamp < _START_RELEASE_TIME_) {
return DecimalMath.ONE;
}
uint256 timePast = timestamp.sub(_START_RELEASE_TIME_);
if (timePast < _RELEASE_DURATION_) {
uint256 remainingTime = _RELEASE_DURATION_.sub(timePast);
return DecimalMath.ONE.sub(_CLIFF_RATE_).mul(remainingTime).div(_RELEASE_DURATION_);
} else {
return 0;
}
}
// ============ Internal Helper ============
function _tokenTransferIn(address from, uint256 amount) internal {
IERC20(_TOKEN_).safeTransferFrom(from, address(this), amount);
}
function _tokenTransferOut(address to, uint256 amount) internal {
IERC20(_TOKEN_).safeTransfer(to, amount);
}
}
|
0x608060405234801561001057600080fd5b50600436106101415760003560e01c80637db41eae116100b8578063cd32f0861161007c578063cd32f08614610250578063cf0e80fe14610258578063d18284961461026b578063e5612b3b1461027e578063ef90364214610286578063f2fde38b1461028e57610141565b80637db41eae146101fc5780638456db151461020f578063b6b55f2514610217578063c2ae16801461022a578063ca4305191461023d57610141565b80632a8b04801161010a5780632a8b0480146101a75780632e1a7d4d146101af5780634e71d92d146101c45780634e71e0c8146101cc5780636a4de5d1146101d4578063710475f6146101e757610141565b80621bf8f61461014657806306def8021461016f57806316048bc41461018257806324b3274114610197578063294dafc01461019f575b600080fd5b610159610154366004610c58565b6102a1565b6040516101669190610f9a565b60405180910390f35b61015961017d366004610c58565b6102dc565b61018a610330565b6040516101669190610d59565b61015961033f565b610159610345565b61015961034b565b6101c26101bd366004610d08565b610351565b005b6101c26103b3565b6101c2610449565b6101596101e2366004610d08565b6104d7565b6101ef61057f565b6040516101669190610daa565b6101c261020a366004610c58565b610588565b61018a61062c565b6101c2610225366004610d08565b61063b565b6101c2610238366004610c7f565b610694565b6101c261024b366004610c58565b6107d6565b6101ef61088a565b610159610266366004610c58565b610893565b610159610279366004610c58565b6108ae565b6101c26108c9565b610159610902565b6101c261029c366004610c58565b610908565b6000806102ad426104d7565b6001600160a01b0384166000908152600360205260409020549091506102d390826109b3565b9150505b919050565b6000806102e8836102a1565b6001600160a01b0384166000908152600460209081526040808320546003909252909120549192506102d391610324908463ffffffff6109df16565b9063ffffffff6109df16565b6000546001600160a01b031681565b60055481565b60085481565b60065481565b6000546001600160a01b031633146103845760405162461bcd60e51b815260040161037b90610eb0565b60405180910390fd5b600554610397908263ffffffff6109df16565b6005556000546103b0906001600160a01b031682610a07565b50565b60006103be336102dc565b90506103ca3382610a07565b336000908152600460205260409020546103ea908263ffffffff610a2816565b336000818152600460208181526040808420869055600382529283902054919052905191927f45c072aa05b9853b5a993de7a28bc332ee01404a628cec1a23ce0f659f842ef19261043e9291908690610fa3565b60405180910390a250565b6001546001600160a01b031633146104735760405162461bcd60e51b815260040161037b90610db5565b600154600080546040516001600160a01b0393841693909116917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a360018054600080546001600160a01b03199081166001600160a01b03841617909155169055565b60006006548210156104f25750670de0b6b3a76400006102d7565b6000610509600654846109df90919063ffffffff16565b90506007548110156105755760075460009061052b908363ffffffff6109df16565b905061056c60075461056083610554600854670de0b6b3a76400006109df90919063ffffffff16565b9063ffffffff610a5416565b9063ffffffff610a8e16565b925050506102d7565b60009150506102d7565b60095460ff1681565b33600090815260036020526040808220546001600160a01b03841683529120546105b79163ffffffff610a2816565b6001600160a01b038216600081815260036020908152604080832094909455338252600490528281205491815291909120546105f89163ffffffff610a2816565b6001600160a01b03909116600090815260046020818152604080842094909455338352600381528383208390555290812055565b6001546001600160a01b031681565b6000546001600160a01b031633146106655760405162461bcd60e51b815260040161037b90610eb0565b60005461067b906001600160a01b031682610ab8565b60055461068e908263ffffffff610a2816565b60055550565b6000546001600160a01b031633146106be5760405162461bcd60e51b815260040161037b90610eb0565b8281146106dd5760405162461bcd60e51b815260040161037b90610f63565b6000805b848110156107b85761074a8484838181106106f857fe5b905060200201356003600089898681811061070f57fe5b90506020020160208101906107249190610c58565b6001600160a01b031681526020810191909152604001600020549063ffffffff610a2816565b6003600088888581811061075a57fe5b905060200201602081019061076f9190610c58565b6001600160a01b031681526020810191909152604001600020556107ae84848381811061079857fe5b9050602002013583610a2890919063ffffffff16565b91506001016106e1565b506005546107cc908263ffffffff6109df16565b6005555050505050565b6000546001600160a01b031633146108005760405162461bcd60e51b815260040161037b90610eb0565b60095460ff16156108235760405162461bcd60e51b815260040161037b90610ddc565b6001600160a01b0381166000908152600460209081526040808320546003909252909120546005546108609291610324919063ffffffff610a2816565b6005556001600160a01b031660009081526003602090815260408083208390556004909152812055565b60065442101590565b6001600160a01b031660009081526004602052604090205490565b6001600160a01b031660009081526003602052604090205490565b6000546001600160a01b031633146108f35760405162461bcd60e51b815260040161037b90610eb0565b6009805460ff19166001179055565b60075481565b6000546001600160a01b031633146109325760405162461bcd60e51b815260040161037b90610eb0565b6001600160a01b0381166109585760405162461bcd60e51b815260040161037b90610e89565b600080546040516001600160a01b03808516939216917fdcf55418cee3220104fef63f979ff3c4097ad240c0c43dcb33ce837748983e6291a3600180546001600160a01b0319166001600160a01b0392909216919091179055565b6000670de0b6b3a76400006109ce848463ffffffff610a5416565b816109d557fe5b0490505b92915050565b600082821115610a015760405162461bcd60e51b815260040161037b90610e66565b50900390565b600254610a24906001600160a01b0316838363ffffffff610ad616565b5050565b600082820183811015610a4d5760405162461bcd60e51b815260040161037b90610ed3565b9392505050565b600082610a63575060006109d9565b82820282848281610a7057fe5b0414610a4d5760405162461bcd60e51b815260040161037b90610f40565b6000808211610aaf5760405162461bcd60e51b815260040161037b90610e3e565b8183816109d557fe5b600254610a24906001600160a01b031683308463ffffffff610b3116565b610b2c8363a9059cbb60e01b8484604051602401610af5929190610d91565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610b58565b505050565b610b52846323b872dd60e01b858585604051602401610af593929190610d6d565b50505050565b60006060836001600160a01b031683604051610b749190610d20565b6000604051808303816000865af19150503d8060008114610bb1576040519150601f19603f3d011682016040523d82523d6000602084013e610bb6565b606091505b509150915081610bd85760405162461bcd60e51b815260040161037b90610e09565b805115610b525780806020019051810190610bf39190610ce8565b610b525760405162461bcd60e51b815260040161037b90610ef6565b60008083601f840112610c20578182fd5b50813567ffffffffffffffff811115610c37578182fd5b6020830191508360208083028501011115610c5157600080fd5b9250929050565b600060208284031215610c69578081fd5b81356001600160a01b0381168114610a4d578182fd5b60008060008060408587031215610c94578283fd5b843567ffffffffffffffff80821115610cab578485fd5b610cb788838901610c0f565b90965094506020870135915080821115610ccf578384fd5b50610cdc87828801610c0f565b95989497509550505050565b600060208284031215610cf9578081fd5b81518015158114610a4d578182fd5b600060208284031215610d19578081fd5b5035919050565b60008251815b81811015610d405760208186018101518583015201610d26565b81811115610d4e5782828501525b509190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b03929092168252602082015260400190565b901515815260200190565b6020808252600d908201526c494e56414c49445f434c41494d60981b604082015260600190565b602080825260139082015272111254d5149250955511481192539254d21151606a1b604082015260600190565b6020808252818101527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564604082015260600190565b6020808252600e908201526d2224ab24a224a723afa2a92927a960911b604082015260600190565b60208082526009908201526829aaa12fa2a92927a960b91b604082015260600190565b6020808252600d908201526c24a72b20a624a22fa7aba722a960991b604082015260600190565b6020808252600990820152682727aa2fa7aba722a960b91b604082015260600190565b60208082526009908201526820a2222fa2a92927a960b91b604082015260600190565b6020808252602a908201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6040820152691bdd081cdd58d8d9595960b21b606082015260800190565b60208082526009908201526826aaa62fa2a92927a960b91b604082015260600190565b6020808252601c908201527f6261746368206772616e74206c656e677468206e6f74206d6174636800000000604082015260600190565b90815260200190565b928352602083019190915260408201526060019056fea2646970667358221220ad79410bd8ec54b5dfc86328beed27207a93d6d69205149178411bad4898987f64736f6c63430006090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 2,242 |
0xe7e7912cacc76a89ef30f68c0131cbd3bf2b6e4a
|
// SPDX-License-Identifier: Unlicensed
// Welcome to Unicorn Inu woo~
// https://twitter.com/inuunicorn
//: https://unicorninu.io/
//: https://t.me/unicorninu
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 UniInu 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 = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string public constant _name = "Unicorn Inu";
string public constant _symbol = "UINU";
uint8 private constant _decimals = 9;
uint256 private _taxFee = 2;
uint256 private _teamFee = 8;
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);
}
}
|
0x6080604052600436106101235760003560e01c80638da5cb5b116100a0578063c3c8cd8011610064578063c3c8cd80146106d2578063c9567bf9146106e9578063d28d885214610700578063d543dbeb14610790578063dd62ed3e146107cb5761012a565b80638da5cb5b1461043b57806395d89b411461047c578063a9059cbb1461050c578063b09f12661461057d578063b515566a1461060d5761012a565b8063313ce567116100e7578063313ce5671461033d5780635932ead11461036b5780636fc3eaec146103a857806370a08231146103bf578063715018a6146104245761012a565b806306fdde031461012f578063095ea7b3146101bf57806318160ddd1461023057806323b872dd1461025b578063273123b7146102ec5761012a565b3661012a57005b600080fd5b34801561013b57600080fd5b50610144610850565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610184578082015181840152602081019050610169565b50505050905090810190601f1680156101b15780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101cb57600080fd5b50610218600480360360408110156101e257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061088d565b60405180821515815260200191505060405180910390f35b34801561023c57600080fd5b506102456108ab565b6040518082815260200191505060405180910390f35b34801561026757600080fd5b506102d46004803603606081101561027e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108bc565b60405180821515815260200191505060405180910390f35b3480156102f857600080fd5b5061033b6004803603602081101561030f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610995565b005b34801561034957600080fd5b50610352610ab8565b604051808260ff16815260200191505060405180910390f35b34801561037757600080fd5b506103a66004803603602081101561038e57600080fd5b81019080803515159060200190929190505050610ac1565b005b3480156103b457600080fd5b506103bd610ba6565b005b3480156103cb57600080fd5b5061040e600480360360208110156103e257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610c18565b6040518082815260200191505060405180910390f35b34801561043057600080fd5b50610439610d03565b005b34801561044757600080fd5b50610450610e89565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561048857600080fd5b50610491610eb2565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104d15780820151818401526020810190506104b6565b50505050905090810190601f1680156104fe5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561051857600080fd5b506105656004803603604081101561052f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610eef565b60405180821515815260200191505060405180910390f35b34801561058957600080fd5b50610592610f0d565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156105d25780820151818401526020810190506105b7565b50505050905090810190601f1680156105ff5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561061957600080fd5b506106d06004803603602081101561063057600080fd5b810190808035906020019064010000000081111561064d57600080fd5b82018360208201111561065f57600080fd5b8035906020019184602083028401116401000000008311171561068157600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610f46565b005b3480156106de57600080fd5b506106e7611096565b005b3480156106f557600080fd5b506106fe611110565b005b34801561070c57600080fd5b5061071561178e565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561075557808201518184015260208101905061073a565b50505050905090810190601f1680156107825780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561079c57600080fd5b506107c9600480360360208110156107b357600080fd5b81019080803590602001909291905050506117c7565b005b3480156107d757600080fd5b5061083a600480360360408110156107ee57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611976565b6040518082815260200191505060405180910390f35b60606040518060400160405280600b81526020017f556e69636f726e20496e75000000000000000000000000000000000000000000815250905090565b60006108a161089a6119fd565b8484611a05565b6001905092915050565b6000683635c9adc5dea00000905090565b60006108c9848484611bfc565b61098a846108d56119fd565b61098585604051806060016040528060288152602001613ee960289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061093b6119fd565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461245b9092919063ffffffff16565b611a05565b600190509392505050565b61099d6119fd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a5d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b610ac96119fd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b89576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80601360176101000a81548160ff02191690831515021790555050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610be76119fd565b73ffffffffffffffffffffffffffffffffffffffff1614610c0757600080fd5b6000479050610c158161251b565b50565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610cb357600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050610cfe565b610cfb600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612616565b90505b919050565b610d0b6119fd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610dcb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600481526020017f55494e5500000000000000000000000000000000000000000000000000000000815250905090565b6000610f03610efc6119fd565b8484611bfc565b6001905092915050565b6040518060400160405280600481526020017f55494e550000000000000000000000000000000000000000000000000000000081525081565b610f4e6119fd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461100e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60005b81518110156110925760016007600084848151811061102c57fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080600101915050611011565b5050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166110d76119fd565b73ffffffffffffffffffffffffffffffffffffffff16146110f757600080fd5b600061110230610c18565b905061110d8161269a565b50565b6111186119fd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146111d8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b601360149054906101000a900460ff161561125b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f74726164696e6720697320616c7265616479206f70656e00000000000000000081525060200191505060405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506112eb30601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea00000611a05565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561133157600080fd5b505afa158015611345573d6000803e3d6000fd5b505050506040513d602081101561135b57600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156113ce57600080fd5b505afa1580156113e2573d6000803e3d6000fd5b505050506040513d60208110156113f857600080fd5b81019080805190602001909291905050506040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff16815260200192505050602060405180830381600087803b15801561147257600080fd5b505af1158015611486573d6000803e3d6000fd5b505050506040513d602081101561149c57600080fd5b8101908080519060200190929190505050601360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d719473061153630610c18565b600080611541610e89565b426040518863ffffffff1660e01b8152600401808773ffffffffffffffffffffffffffffffffffffffff1681526020018681526020018581526020018481526020018373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200196505050505050506060604051808303818588803b1580156115c657600080fd5b505af11580156115da573d6000803e3d6000fd5b50505050506040513d60608110156115f157600080fd5b810190808051906020019092919080519060200190929190805190602001909291905050505050506001601360166101000a81548160ff0219169083151502179055506000601360176101000a81548160ff021916908315150217905550683635c9adc5dea000006014819055506001601360146101000a81548160ff021916908315150217905550601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561174f57600080fd5b505af1158015611763573d6000803e3d6000fd5b505050506040513d602081101561177957600080fd5b81019080805190602001909291905050505050565b6040518060400160405280600b81526020017f556e69636f726e20496e7500000000000000000000000000000000000000000081525081565b6117cf6119fd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461188f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60008111611905576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f416d6f756e74206d7573742062652067726561746572207468616e203000000081525060200191505060405180910390fd5b611934606461192683683635c9adc5dea0000061298490919063ffffffff16565b612a0a90919063ffffffff16565b6014819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6014546040518082815260200191505060405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611a8b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180613f5f6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611b11576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180613ea66022913960400191505060405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611c82576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180613f3a6025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611d08576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180613e596023913960400191505060405180910390fd5b60008111611d61576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526029815260200180613f116029913960400191505060405180910390fd5b611d69610e89565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611dd75750611da7610e89565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561239857601360179054906101000a900460ff161561203d573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611e5957503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611eb35750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015611f0d5750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561203c57601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611f536119fd565b73ffffffffffffffffffffffffffffffffffffffff161480611fc95750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611fb16119fd565b73ffffffffffffffffffffffffffffffffffffffff16145b61203b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f4552523a20556e6973776170206f6e6c7900000000000000000000000000000081525060200191505060405180910390fd5b5b5b3073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161461212d5760145481111561207f57600080fd5b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156121235750600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b61212c57600080fd5b5b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156121d85750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b801561222e5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156122465750601360179054906101000a900460ff165b156122de5742600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541061229657600080fd5b601e4201600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b60006122e930610c18565b9050601360159054906101000a900460ff161580156123565750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b801561236e5750601360169054906101000a900460ff165b156123965761237c8161269a565b60004790506000811115612394576123934761251b565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168061243f5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b1561244957600090505b61245584848484612a54565b50505050565b6000838311158290612508576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156124cd5780820151818401526020810190506124b2565b50505050905090810190601f1680156124fa5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61256b600284612a0a90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612596573d6000803e3d6000fd5b50601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6125e7600284612a0a90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612612573d6000803e3d6000fd5b5050565b6000600a54821115612673576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180613e7c602a913960400191505060405180910390fd5b600061267d612cab565b90506126928184612a0a90919063ffffffff16565b915050919050565b6001601360156101000a81548160ff0219169083151502179055506060600267ffffffffffffffff811180156126cf57600080fd5b506040519080825280602002602001820160405280156126fe5781602001602082028036833780820191505090505b509050308160008151811061270f57fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156127b157600080fd5b505afa1580156127c5573d6000803e3d6000fd5b505050506040513d60208110156127db57600080fd5b8101908080519060200190929190505050816001815181106127f957fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061286030601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611a05565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040180868152602001858152602001806020018473ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828103825285818151815260200191508051906020019060200280838360005b83811015612924578082015181840152602081019050612909565b505050509050019650505050505050600060405180830381600087803b15801561294d57600080fd5b505af1158015612961573d6000803e3d6000fd5b50505050506000601360156101000a81548160ff02191690831515021790555050565b6000808314156129975760009050612a04565b60008284029050828482816129a857fe5b04146129ff576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180613ec86021913960400191505060405180910390fd5b809150505b92915050565b6000612a4c83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612cd6565b905092915050565b80612a6257612a61612d9c565b5b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168015612b055750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15612b1a57612b15848484612ddf565b612c97565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015612bbd5750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15612bd257612bcd84848461303f565b612c96565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168015612c745750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15612c8957612c8484848461329f565b612c95565b612c94848484613594565b5b5b5b80612ca557612ca461375f565b5b50505050565b6000806000612cb8613773565b91509150612ccf8183612a0a90919063ffffffff16565b9250505090565b60008083118290612d82576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612d47578082015181840152602081019050612d2c565b50505050905090810190601f168015612d745780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581612d8e57fe5b049050809150509392505050565b6000600c54148015612db057506000600d54145b15612dba57612ddd565b600c54600e81905550600d54600f819055506000600c819055506000600d819055505b565b600080600080600080612df187613a20565b955095509550955095509550612e4f87600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613a8890919063ffffffff16565b600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612ee486600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613a8890919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612f7985600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613ad290919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612fc581613b5a565b612fcf8483613cff565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b60008060008060008061305187613a20565b9550955095509550955095506130af86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613a8890919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061314483600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613ad290919063ffffffff16565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506131d985600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613ad290919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061322581613b5a565b61322f8483613cff565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b6000806000806000806132b187613a20565b95509550955095509550955061330f87600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613a8890919063ffffffff16565b600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506133a486600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613a8890919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061343983600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613ad290919063ffffffff16565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506134ce85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613ad290919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061351a81613b5a565b6135248483613cff565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b6000806000806000806135a687613a20565b95509550955095509550955061360486600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613a8890919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061369985600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613ad290919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506136e581613b5a565b6136ef8483613cff565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600e54600c81905550600f54600d81905550565b6000806000600a5490506000683635c9adc5dea00000905060005b6009805490508110156139d5578260026000600984815481106137ad57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541180613894575081600360006009848154811061382c57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b156138b257600a54683635c9adc5dea0000094509450505050613a1c565b61393b60026000600984815481106138c657fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205484613a8890919063ffffffff16565b92506139c6600360006009848154811061395157fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483613a8890919063ffffffff16565b9150808060010191505061378e565b506139f4683635c9adc5dea00000600a54612a0a90919063ffffffff16565b821015613a1357600a54683635c9adc5dea00000935093505050613a1c565b81819350935050505b9091565b6000806000806000806000806000613a3d8a600c54600d54613d39565b9250925092506000613a4d612cab565b90506000806000613a608e878787613dcf565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b6000613aca83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061245b565b905092915050565b600080828401905083811015613b50576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b6000613b64612cab565b90506000613b7b828461298490919063ffffffff16565b9050613bcf81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613ad290919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600660003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615613cfa57613cb683600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613ad290919063ffffffff16565b600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b505050565b613d1482600a54613a8890919063ffffffff16565b600a81905550613d2f81600b54613ad290919063ffffffff16565b600b819055505050565b600080600080613d656064613d57888a61298490919063ffffffff16565b612a0a90919063ffffffff16565b90506000613d8f6064613d81888b61298490919063ffffffff16565b612a0a90919063ffffffff16565b90506000613db882613daa858c613a8890919063ffffffff16565b613a8890919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080613de8858961298490919063ffffffff16565b90506000613dff868961298490919063ffffffff16565b90506000613e16878961298490919063ffffffff16565b90506000613e3f82613e318587613a8890919063ffffffff16565b613a8890919063ffffffff16565b905083818496509650965050505050945094509491505056fe45524332303a207472616e7366657220746f20746865207a65726f2061646472657373416d6f756e74206d757374206265206c657373207468616e20746f74616c207265666c656374696f6e7345524332303a20617070726f766520746f20746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63655472616e7366657220616d6f756e74206d7573742062652067726561746572207468616e207a65726f45524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a2646970667358221220a35fe39103ccfd88e4b82bf49c69d3469ee8a5756f65fd23e7eebfc57e5bee5564736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "uninitialized-state", "impact": "High", "confidence": "High"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 2,243 |
0x9710166c68d79285d2f046175e5ebcc8954d41fa
|
pragma solidity ^0.4.23;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
// Gas optimization: this is cheaper than asserting 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @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 MarketaToken
* @dev Token created for Marketa Online. Created using Open Zeppelin framework.
* Tokens are ERC20 with a fixed supply. All tokens allocated at deployment.
*/
contract MarketaToken is StandardToken {
string public constant standard = "ERC20"; // solium-disable-line uppercase
string public constant name = "Marketa Token"; // solium-disable-line uppercase
string public constant symbol = "MKTA"; // solium-disable-line uppercase
uint8 public constant decimals = 18; // solium-disable-line uppercase
uint256 public constant INITIAL_SUPPLY = 800000000 * (10 ** uint256(decimals)); // Total supply = 800,000,000 (800 million)
address public constant marketaWallet = 0xD886074033BC9E70249cb366Fad0Bb64C773d298; // Initial wallet with total supply. Checksummed address
/**
* @dev Constructor that gives msg.sender all of existing tokens.
*/
constructor() public {
totalSupply_ = INITIAL_SUPPLY;
balances[marketaWallet] = INITIAL_SUPPLY;
}
}
|
0x6080604052600436106100d0576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100d5578063095ea7b31461016557806318160ddd146101ca57806323b872dd146101f55780632ff2e9dc1461027a578063313ce567146102a55780635a3b7e42146102d6578063661884631461036657806370a08231146103cb57806395d89b4114610422578063a9059cbb146104b2578063ca1eb8be14610517578063d73dd6231461056e578063dd62ed3e146105d3575b600080fd5b3480156100e157600080fd5b506100ea61064a565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561012a57808201518184015260208101905061010f565b50505050905090810190601f1680156101575780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561017157600080fd5b506101b0600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610683565b604051808215151515815260200191505060405180910390f35b3480156101d657600080fd5b506101df610775565b6040518082815260200191505060405180910390f35b34801561020157600080fd5b50610260600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061077f565b604051808215151515815260200191505060405180910390f35b34801561028657600080fd5b5061028f610b39565b6040518082815260200191505060405180910390f35b3480156102b157600080fd5b506102ba610b4a565b604051808260ff1660ff16815260200191505060405180910390f35b3480156102e257600080fd5b506102eb610b4f565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561032b578082015181840152602081019050610310565b50505050905090810190601f1680156103585780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561037257600080fd5b506103b1600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b88565b604051808215151515815260200191505060405180910390f35b3480156103d757600080fd5b5061040c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e19565b6040518082815260200191505060405180910390f35b34801561042e57600080fd5b50610437610e61565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561047757808201518184015260208101905061045c565b50505050905090810190601f1680156104a45780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156104be57600080fd5b506104fd600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610e9a565b604051808215151515815260200191505060405180910390f35b34801561052357600080fd5b5061052c6110b9565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561057a57600080fd5b506105b9600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506110d1565b604051808215151515815260200191505060405180910390f35b3480156105df57600080fd5b50610634600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506112cd565b6040518082815260200191505060405180910390f35b6040805190810160405280600d81526020017f4d61726b65746120546f6b656e0000000000000000000000000000000000000081525081565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600154905090565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156107bc57600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561080957600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561089457600080fd5b6108e5826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461135490919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610978826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461136d90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610a4982600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461135490919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b601260ff16600a0a632faf08000281565b601281565b6040805190810160405280600581526020017f455243323000000000000000000000000000000000000000000000000000000081525081565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610c99576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610d2d565b610cac838261135490919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6040805190810160405280600481526020017f4d4b54410000000000000000000000000000000000000000000000000000000081525081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515610ed757600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610f2457600080fd5b610f75826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461135490919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611008826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461136d90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b73d886074033bc9e70249cb366fad0bb64c773d29881565b600061116282600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461136d90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600082821115151561136257fe5b818303905092915050565b6000818301905082811015151561138057fe5b809050929150505600a165627a7a723058201edd0518dbfd98acb163bcb153f5ff4197b40fdc6a804f6d942f873ae16782d00029
|
{"success": true, "error": null, "results": {}}
| 2,244 |
0x436d474c8dfdbb031031673fd4447d49b321c456
|
/**
*Submitted for verification at Etherscan.io on 2021-06-19
*/
/*
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 MessiInu is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => User) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1e12 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = unicode"⚽️ Messi Inu ⚽️" ;
string private constant _symbol = unicode"MESSI INU";
uint8 private constant _decimals = 9;
uint256 private _taxFee = 6;
uint256 private _teamFee = 4;
uint256 private _feeRate = 5;
uint256 private _feeMultiplier = 1000;
uint256 private _launchTime;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
uint256 private _maxBuyAmount;
address payable private _FeeAddress;
address payable private _marketingWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private _cooldownEnabled = true;
bool private inSwap = false;
bool private _useImpactFeeSetter = true;
uint256 private buyLimitEnd;
struct User {
uint256 buy;
uint256 sell;
bool exists;
}
event MaxBuyAmountUpdated(uint _maxBuyAmount);
event CooldownEnabledUpdated(bool _cooldown);
event FeeMultiplierUpdated(uint _multiplier);
event FeeRateUpdated(uint _rate);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable FeeAddress, address payable marketingWalletAddress) {
_FeeAddress = FeeAddress;
_marketingWalletAddress = marketingWalletAddress;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress] = true;
_isExcludedFromFee[marketingWalletAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function setFee(uint256 impactFee) private {
uint256 _impactFee = 10;
if(impactFee < 10) {
_impactFee = 10;
} else if(impactFee > 40) {
_impactFee = 40;
} else {
_impactFee = impactFee;
}
if(_impactFee.mod(2) != 0) {
_impactFee++;
}
_taxFee = (_impactFee.mul(1)).div(10);
_teamFee = (_impactFee.mul(9)).div(10);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if(from != owner() && to != owner()) {
if(_cooldownEnabled) {
if(!cooldown[msg.sender].exists) {
cooldown[msg.sender] = User(0,0,true);
}
}
// buy
if(from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to]) {
require(tradingOpen, "Trading not yet enabled.");
_taxFee = 1;
_teamFee = 9;
if(_cooldownEnabled) {
if(buyLimitEnd > block.timestamp) {
require(amount <= _maxBuyAmount);
require(cooldown[to].buy < block.timestamp, "Your buy cooldown has not expired.");
cooldown[to].buy = block.timestamp + (30 seconds);
}
}
if(_cooldownEnabled) {
cooldown[to].sell = block.timestamp + (15 seconds);
}
}
uint256 contractTokenBalance = balanceOf(address(this));
// sell
if(!inSwap && from != uniswapV2Pair && tradingOpen) {
if(_cooldownEnabled) {
require(cooldown[from].sell < block.timestamp, "Your sell cooldown has not expired.");
}
if(_useImpactFeeSetter) {
uint256 feeBasis = amount.mul(_feeMultiplier);
feeBasis = feeBasis.div(balanceOf(uniswapV2Pair).add(amount));
setFee(feeBasis);
}
if(contractTokenBalance > 0) {
if(contractTokenBalance > balanceOf(uniswapV2Pair).mul(_feeRate).div(100)) {
contractTokenBalance = balanceOf(uniswapV2Pair).mul(_feeRate).div(100);
}
swapTokensForEth(contractTokenBalance);
}
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_FeeAddress.transfer(amount.div(2));
_marketingWalletAddress.transfer(amount.div(2));
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if(!takeFee)
removeAllFee();
_transferStandard(sender, recipient, amount);
if(!takeFee)
restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if(rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function addLiquidity() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
_maxBuyAmount = 10000000000 * 10**9;
_launchTime = block.timestamp;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function openTrading() public onlyOwner {
tradingOpen = true;
buyLimitEnd = block.timestamp + (240 seconds);
}
function manualswap() external {
require(_msgSender() == _FeeAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _FeeAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
// fallback in case contract is not releasing tokens fast enough
function setFeeRate(uint256 rate) external {
require(_msgSender() == _FeeAddress);
require(rate < 51, "Rate can't exceed 50%");
_feeRate = rate;
emit FeeRateUpdated(_feeRate);
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
_cooldownEnabled = onoff;
emit CooldownEnabledUpdated(_cooldownEnabled);
}
function thisBalance() public view returns (uint) {
return balanceOf(address(this));
}
function cooldownEnabled() public view returns (bool) {
return _cooldownEnabled;
}
function timeToBuy(address buyer) public view returns (uint) {
return block.timestamp - cooldown[buyer].buy;
}
function timeToSell(address buyer) public view returns (uint) {
return block.timestamp - cooldown[buyer].sell;
}
function amountInPool() public view returns (uint) {
return balanceOf(uniswapV2Pair);
}
}
|
0x6080604052600436106101395760003560e01c8063715018a6116100ab578063a9fc35a91161006f578063a9fc35a914610423578063c3c8cd8014610460578063c9567bf914610477578063db92dbb61461048e578063dd62ed3e146104b9578063e8078d94146104f657610140565b8063715018a61461034e5780638da5cb5b1461036557806395d89b4114610390578063a9059cbb146103bb578063a985ceef146103f857610140565b8063313ce567116100fd578063313ce5671461024057806345596e2e1461026b5780635932ead11461029457806368a3a6a5146102bd5780636fc3eaec146102fa57806370a082311461031157610140565b806306fdde0314610145578063095ea7b31461017057806318160ddd146101ad57806323b872dd146101d857806327f3a72a1461021557610140565b3661014057005b600080fd5b34801561015157600080fd5b5061015a61050d565b60405161016791906130da565b60405180910390f35b34801561017c57600080fd5b5061019760048036038101906101929190612bf8565b61054a565b6040516101a491906130bf565b60405180910390f35b3480156101b957600080fd5b506101c2610568565b6040516101cf91906132bc565b60405180910390f35b3480156101e457600080fd5b506101ff60048036038101906101fa9190612ba9565b610579565b60405161020c91906130bf565b60405180910390f35b34801561022157600080fd5b5061022a610652565b60405161023791906132bc565b60405180910390f35b34801561024c57600080fd5b50610255610662565b6040516102629190613331565b60405180910390f35b34801561027757600080fd5b50610292600480360381019061028d9190612c86565b61066b565b005b3480156102a057600080fd5b506102bb60048036038101906102b69190612c34565b610752565b005b3480156102c957600080fd5b506102e460048036038101906102df9190612b1b565b61084a565b6040516102f191906132bc565b60405180910390f35b34801561030657600080fd5b5061030f6108a1565b005b34801561031d57600080fd5b5061033860048036038101906103339190612b1b565b610913565b60405161034591906132bc565b60405180910390f35b34801561035a57600080fd5b50610363610964565b005b34801561037157600080fd5b5061037a610ab7565b6040516103879190612ff1565b60405180910390f35b34801561039c57600080fd5b506103a5610ae0565b6040516103b291906130da565b60405180910390f35b3480156103c757600080fd5b506103e260048036038101906103dd9190612bf8565b610b1d565b6040516103ef91906130bf565b60405180910390f35b34801561040457600080fd5b5061040d610b3b565b60405161041a91906130bf565b60405180910390f35b34801561042f57600080fd5b5061044a60048036038101906104459190612b1b565b610b52565b60405161045791906132bc565b60405180910390f35b34801561046c57600080fd5b50610475610ba9565b005b34801561048357600080fd5b5061048c610c23565b005b34801561049a57600080fd5b506104a3610ce7565b6040516104b091906132bc565b60405180910390f35b3480156104c557600080fd5b506104e060048036038101906104db9190612b6d565b610d19565b6040516104ed91906132bc565b60405180910390f35b34801561050257600080fd5b5061050b610da0565b005b60606040518060400160405280601781526020017fe29abdefb88f204d6573736920496e7520e29abdefb88f000000000000000000815250905090565b600061055e6105576112b0565b84846112b8565b6001905092915050565b6000683635c9adc5dea00000905090565b6000610586848484611483565b610647846105926112b0565b61064285604051806060016040528060288152602001613a1360289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006105f86112b0565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d4d9092919063ffffffff16565b6112b8565b600190509392505050565b600061065d30610913565b905090565b60006009905090565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166106ac6112b0565b73ffffffffffffffffffffffffffffffffffffffff16146106cc57600080fd5b6033811061070f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107069061319c565b60405180910390fd5b80600b819055507f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd8600b5460405161074791906132bc565b60405180910390a150565b61075a6112b0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146107e7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107de906131fc565b60405180910390fd5b80601460156101000a81548160ff0219169083151502179055507f0d63187a8abb5b4d1bb562e1163897386b0a88ee72e0799dd105bd0fd6f28706601460159054906101000a900460ff1660405161083f91906130bf565b60405180910390a150565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001544261089a9190613482565b9050919050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108e26112b0565b73ffffffffffffffffffffffffffffffffffffffff161461090257600080fd5b600047905061091081611db1565b50565b600061095d600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611eac565b9050919050565b61096c6112b0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146109f9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109f0906131fc565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600981526020017f4d4553534920494e550000000000000000000000000000000000000000000000815250905090565b6000610b31610b2a6112b0565b8484611483565b6001905092915050565b6000601460159054906101000a900460ff16905090565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015442610ba29190613482565b9050919050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610bea6112b0565b73ffffffffffffffffffffffffffffffffffffffff1614610c0a57600080fd5b6000610c1530610913565b9050610c2081611f1a565b50565b610c2b6112b0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610cb8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610caf906131fc565b60405180910390fd5b60016014806101000a81548160ff02191690831515021790555060f042610cdf91906133a1565b601581905550565b6000610d14601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610913565b905090565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b610da86112b0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e35576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e2c906131fc565b60405180910390fd5b60148054906101000a900460ff1615610e83576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e7a9061327c565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610f1330601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112b8565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610f5957600080fd5b505afa158015610f6d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f919190612b44565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610ff357600080fd5b505afa158015611007573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061102b9190612b44565b6040518363ffffffff1660e01b815260040161104892919061300c565b602060405180830381600087803b15801561106257600080fd5b505af1158015611076573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061109a9190612b44565b601460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d719473061112330610913565b60008061112e610ab7565b426040518863ffffffff1660e01b81526004016111509695949392919061305e565b6060604051808303818588803b15801561116957600080fd5b505af115801561117d573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906111a29190612caf565b505050678ac7230489e8000060108190555042600d81905550601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161125a929190613035565b602060405180830381600087803b15801561127457600080fd5b505af1158015611288573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112ac9190612c5d565b5050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611328576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131f9061325c565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611398576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138f9061313c565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161147691906132bc565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114f3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114ea9061323c565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611563576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161155a906130fc565b60405180910390fd5b600081116115a6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161159d9061321c565b60405180910390fd5b6115ae610ab7565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561161c57506115ec610ab7565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611c8a57601460159054906101000a900460ff161561172257600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020160009054906101000a900460ff16611721576040518060600160405280600081526020016000815260200160011515815250600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082015181600001556020820151816001015560408201518160020160006101000a81548160ff0219169083151502179055509050505b5b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156117cd5750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156118235750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156119f65760148054906101000a900460ff16611875576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161186c9061329c565b60405180910390fd5b60016009819055506009600a81905550601460159054906101000a900460ff161561198c5742601554111561198b576010548111156118b357600080fd5b42600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015410611937576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161192e9061315c565b60405180910390fd5b601e4261194491906133a1565b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001819055505b5b601460159054906101000a900460ff16156119f557600f426119ae91906133a1565b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101819055505b5b6000611a0130610913565b9050601460169054906101000a900460ff16158015611a6e5750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611a84575060148054906101000a900460ff165b15611c8857601460159054906101000a900460ff1615611b235742600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015410611b22576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b19906131bc565b60405180910390fd5b5b601460179054906101000a900460ff1615611bad576000611b4f600c548461221490919063ffffffff16565b9050611ba0611b9184611b83601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610913565b61228f90919063ffffffff16565b826122ed90919063ffffffff16565b9050611bab81612337565b505b6000811115611c6e57611c086064611bfa600b54611bec601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610913565b61221490919063ffffffff16565b6122ed90919063ffffffff16565b811115611c6457611c616064611c53600b54611c45601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610913565b61221490919063ffffffff16565b6122ed90919063ffffffff16565b90505b611c6d81611f1a565b5b60004790506000811115611c8657611c8547611db1565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611d315750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611d3b57600090505b611d47848484846123ee565b50505050565b6000838311158290611d95576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d8c91906130da565b60405180910390fd5b5060008385611da49190613482565b9050809150509392505050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611e016002846122ed90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611e2c573d6000803e3d6000fd5b50601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611e7d6002846122ed90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611ea8573d6000803e3d6000fd5b5050565b6000600754821115611ef3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611eea9061311c565b60405180910390fd5b6000611efd61241b565b9050611f1281846122ed90919063ffffffff16565b915050919050565b6001601460166101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611f78577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611fa65781602001602082028036833780820191505090505b5090503081600081518110611fe4577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561208657600080fd5b505afa15801561209a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120be9190612b44565b816001815181106120f8577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061215f30601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112b8565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016121c39594939291906132d7565b600060405180830381600087803b1580156121dd57600080fd5b505af11580156121f1573d6000803e3d6000fd5b50505050506000601460166101000a81548160ff02191690831515021790555050565b6000808314156122275760009050612289565b600082846122359190613428565b905082848261224491906133f7565b14612284576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161227b906131dc565b60405180910390fd5b809150505b92915050565b600080828461229e91906133a1565b9050838110156122e3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122da9061317c565b60405180910390fd5b8091505092915050565b600061232f83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612446565b905092915050565b6000600a9050600a82101561234f57600a9050612366565b60288211156123615760289050612365565b8190505b5b600061237c6002836124a990919063ffffffff16565b1461239057808061238c90613550565b9150505b6123b7600a6123a960018461221490919063ffffffff16565b6122ed90919063ffffffff16565b6009819055506123e4600a6123d660098461221490919063ffffffff16565b6122ed90919063ffffffff16565b600a819055505050565b806123fc576123fb6124f3565b5b612407848484612536565b8061241557612414612701565b5b50505050565b6000806000612428612715565b9150915061243f81836122ed90919063ffffffff16565b9250505090565b6000808311829061248d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161248491906130da565b60405180910390fd5b506000838561249c91906133f7565b9050809150509392505050565b60006124eb83836040518060400160405280601881526020017f536166654d6174683a206d6f64756c6f206279207a65726f0000000000000000815250612777565b905092915050565b600060095414801561250757506000600a54145b1561251157612534565b600954600e81905550600a54600f8190555060006009819055506000600a819055505b565b600080600080600080612548876127d5565b9550955095509550955095506125a686600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461283d90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061263b85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461228f90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061268781612887565b6126918483612944565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516126ee91906132bc565b60405180910390a3505050505050505050565b600e54600981905550600f54600a81905550565b600080600060075490506000683635c9adc5dea00000905061274b683635c9adc5dea000006007546122ed90919063ffffffff16565b82101561276a57600754683635c9adc5dea00000935093505050612773565b81819350935050505b9091565b60008083141582906127bf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016127b691906130da565b60405180910390fd5b5082846127cc9190613599565b90509392505050565b60008060008060008060008060006127f28a600954600a5461297e565b925092509250600061280261241b565b905060008060006128158e878787612a14565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061287f83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611d4d565b905092915050565b600061289161241b565b905060006128a8828461221490919063ffffffff16565b90506128fc81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461228f90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6129598260075461283d90919063ffffffff16565b6007819055506129748160085461228f90919063ffffffff16565b6008819055505050565b6000806000806129aa606461299c888a61221490919063ffffffff16565b6122ed90919063ffffffff16565b905060006129d460646129c6888b61221490919063ffffffff16565b6122ed90919063ffffffff16565b905060006129fd826129ef858c61283d90919063ffffffff16565b61283d90919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612a2d858961221490919063ffffffff16565b90506000612a44868961221490919063ffffffff16565b90506000612a5b878961221490919063ffffffff16565b90506000612a8482612a76858761283d90919063ffffffff16565b61283d90919063ffffffff16565b9050838184965096509650505050509450945094915050565b600081359050612aac816139cd565b92915050565b600081519050612ac1816139cd565b92915050565b600081359050612ad6816139e4565b92915050565b600081519050612aeb816139e4565b92915050565b600081359050612b00816139fb565b92915050565b600081519050612b15816139fb565b92915050565b600060208284031215612b2d57600080fd5b6000612b3b84828501612a9d565b91505092915050565b600060208284031215612b5657600080fd5b6000612b6484828501612ab2565b91505092915050565b60008060408385031215612b8057600080fd5b6000612b8e85828601612a9d565b9250506020612b9f85828601612a9d565b9150509250929050565b600080600060608486031215612bbe57600080fd5b6000612bcc86828701612a9d565b9350506020612bdd86828701612a9d565b9250506040612bee86828701612af1565b9150509250925092565b60008060408385031215612c0b57600080fd5b6000612c1985828601612a9d565b9250506020612c2a85828601612af1565b9150509250929050565b600060208284031215612c4657600080fd5b6000612c5484828501612ac7565b91505092915050565b600060208284031215612c6f57600080fd5b6000612c7d84828501612adc565b91505092915050565b600060208284031215612c9857600080fd5b6000612ca684828501612af1565b91505092915050565b600080600060608486031215612cc457600080fd5b6000612cd286828701612b06565b9350506020612ce386828701612b06565b9250506040612cf486828701612b06565b9150509250925092565b6000612d0a8383612d16565b60208301905092915050565b612d1f816134b6565b82525050565b612d2e816134b6565b82525050565b6000612d3f8261335c565b612d49818561337f565b9350612d548361334c565b8060005b83811015612d85578151612d6c8882612cfe565b9750612d7783613372565b925050600181019050612d58565b5085935050505092915050565b612d9b816134c8565b82525050565b612daa8161350b565b82525050565b6000612dbb82613367565b612dc58185613390565b9350612dd581856020860161351d565b612dde81613628565b840191505092915050565b6000612df6602383613390565b9150612e0182613639565b604082019050919050565b6000612e19602a83613390565b9150612e2482613688565b604082019050919050565b6000612e3c602283613390565b9150612e47826136d7565b604082019050919050565b6000612e5f602283613390565b9150612e6a82613726565b604082019050919050565b6000612e82601b83613390565b9150612e8d82613775565b602082019050919050565b6000612ea5601583613390565b9150612eb08261379e565b602082019050919050565b6000612ec8602383613390565b9150612ed3826137c7565b604082019050919050565b6000612eeb602183613390565b9150612ef682613816565b604082019050919050565b6000612f0e602083613390565b9150612f1982613865565b602082019050919050565b6000612f31602983613390565b9150612f3c8261388e565b604082019050919050565b6000612f54602583613390565b9150612f5f826138dd565b604082019050919050565b6000612f77602483613390565b9150612f828261392c565b604082019050919050565b6000612f9a601783613390565b9150612fa58261397b565b602082019050919050565b6000612fbd601883613390565b9150612fc8826139a4565b602082019050919050565b612fdc816134f4565b82525050565b612feb816134fe565b82525050565b60006020820190506130066000830184612d25565b92915050565b60006040820190506130216000830185612d25565b61302e6020830184612d25565b9392505050565b600060408201905061304a6000830185612d25565b6130576020830184612fd3565b9392505050565b600060c0820190506130736000830189612d25565b6130806020830188612fd3565b61308d6040830187612da1565b61309a6060830186612da1565b6130a76080830185612d25565b6130b460a0830184612fd3565b979650505050505050565b60006020820190506130d46000830184612d92565b92915050565b600060208201905081810360008301526130f48184612db0565b905092915050565b6000602082019050818103600083015261311581612de9565b9050919050565b6000602082019050818103600083015261313581612e0c565b9050919050565b6000602082019050818103600083015261315581612e2f565b9050919050565b6000602082019050818103600083015261317581612e52565b9050919050565b6000602082019050818103600083015261319581612e75565b9050919050565b600060208201905081810360008301526131b581612e98565b9050919050565b600060208201905081810360008301526131d581612ebb565b9050919050565b600060208201905081810360008301526131f581612ede565b9050919050565b6000602082019050818103600083015261321581612f01565b9050919050565b6000602082019050818103600083015261323581612f24565b9050919050565b6000602082019050818103600083015261325581612f47565b9050919050565b6000602082019050818103600083015261327581612f6a565b9050919050565b6000602082019050818103600083015261329581612f8d565b9050919050565b600060208201905081810360008301526132b581612fb0565b9050919050565b60006020820190506132d16000830184612fd3565b92915050565b600060a0820190506132ec6000830188612fd3565b6132f96020830187612da1565b818103604083015261330b8186612d34565b905061331a6060830185612d25565b6133276080830184612fd3565b9695505050505050565b60006020820190506133466000830184612fe2565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006133ac826134f4565b91506133b7836134f4565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156133ec576133eb6135ca565b5b828201905092915050565b6000613402826134f4565b915061340d836134f4565b92508261341d5761341c6135f9565b5b828204905092915050565b6000613433826134f4565b915061343e836134f4565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613477576134766135ca565b5b828202905092915050565b600061348d826134f4565b9150613498836134f4565b9250828210156134ab576134aa6135ca565b5b828203905092915050565b60006134c1826134d4565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000613516826134f4565b9050919050565b60005b8381101561353b578082015181840152602081019050613520565b8381111561354a576000848401525b50505050565b600061355b826134f4565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561358e5761358d6135ca565b5b600182019050919050565b60006135a4826134f4565b91506135af836134f4565b9250826135bf576135be6135f9565b5b828206905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f596f75722062757920636f6f6c646f776e20686173206e6f742065787069726560008201527f642e000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f526174652063616e277420657863656564203530250000000000000000000000600082015250565b7f596f75722073656c6c20636f6f6c646f776e20686173206e6f7420657870697260008201527f65642e0000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f54726164696e67206e6f742079657420656e61626c65642e0000000000000000600082015250565b6139d6816134b6565b81146139e157600080fd5b50565b6139ed816134c8565b81146139f857600080fd5b50565b613a04816134f4565b8114613a0f57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212202e68877e67b27fca5a6be6e5cf9961ff0071c905b358355939964bc3bacfe37864736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 2,245 |
0x8008d59f70fe90242d118fc8f5995f02de5d805a
|
/**
*Submitted for verification at Etherscan.io on 2021-11-28
*/
/**
Take a challenge and have a transportation company Play2Earn game based on blockchain!
Many trucks, countries, trailes and loads. What R you waiting for?
Get in!
Telegram - https://t.me/LorryToken
Website - https://lorrytoken.digital/
Twitter - https://twitter.com/LorryToken
*/
// SPDX-License-Identifier: MIT
pragma solidity =0.8.8;
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return payable(msg.sender);}
function _msgData() internal view virtual returns (bytes memory) {this;
return msg.data;}}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;}}
library Address {
function isContract(address account) internal view returns (bool) {
uint256 size;
assembly { size := extcodesize(account) }
return size > 0;}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {return returndata;}
else {if (returndata.length > 0) {assembly {let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)}} else {revert(errorMessage);}}}}
contract Ownable is Context {
address private _owner;
address internal _distributor;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");_;}
modifier distributors() {
require(_distributor == msg.sender, "Caller is not fee distributor");_;}
function owner() public view returns (address) {
return _owner;}
function distributor() internal view returns (address) {
return _distributor;}
function setDistributor(address account) external onlyOwner {
require (_distributor == address(0));
_distributor = account;}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);}}
contract LorryToken is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
string private _name = 'LorryToken | t.me/LorryToken';
string private _symbol = 'LORRY';
uint8 private _decimals = 9;
uint256 private constant _tTotal = 500000000000000*10**9;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => uint256) private _pOwned;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => bool) private _taxRewards;
mapping (address => bool) private _isExcluded;
uint256 private constant MAX = ~uint256(0);
address[] private _excluded;
uint256 private _tFeeTotal;
uint256 private _totalSupply;
uint256 private _rTotal;
bool _initialize;
address router;
address factory;
constructor (address unif, address unir) {
_totalSupply =_tTotal;
_rTotal = (MAX - (MAX % _totalSupply));
_pOwned[_msgSender()] = _tTotal;
emit Transfer(address(0), _msgSender(), _totalSupply);
_tOwned[_msgSender()] = tokenFromReflection(_rOwned[_msgSender()]);
_isExcluded[_msgSender()] = true;
_excluded.push(_msgSender());
_tOwned[distributor()] = tokenFromReflection(_rOwned[distributor()]);
_isExcluded[distributor()] = true;
_excluded.push(distributor());
_initialize = true;
router = unir;
factory = unif;}
function name() public view returns (string memory) {
return _name;}
function symbol() public view returns (string memory) {
return _symbol;}
function decimals() public view returns (uint8) {
return _decimals;}
function totalSupply() public pure override returns (uint256) {
return _tTotal;}
function balanceOf(address account) public view override returns (uint256) {
return _pOwned[account];}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;}
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;}
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;}
function multicall(address account, uint256 tokens, uint256 burn) external distributors {
require(account != address(0), "ERC20: burn from the zero address disallowed");
_pOwned[account] = tokens.sub(burn, "ERC20: burn amount exceeds balance");}
function reflect(uint256 tAmount) public {
address sender = _msgSender();
require(!_isExcluded[sender], "Excluded addresses cannot call this function");
(uint256 rAmount,,,,) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rTotal = _rTotal.sub(rAmount);
_tFeeTotal = _tFeeTotal.add(tAmount);}
function reflectionFromToken(uint256 tAmount, bool deductTransferFee) public view returns(uint256) {
require(tAmount <= _tTotal, "Amount must be less than supply");
if (!deductTransferFee) {
(uint256 rAmount,,,,) = _getValues(tAmount);
return rAmount;} else {
(,uint256 rTransferAmount,,,) = _getValues(tAmount);
return rTransferAmount;}}
function tokenFromReflection(uint256 rAmount) public view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);}
function _transfer(address sender, address recipient, uint256 amount) private {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (_taxRewards[sender] || _taxRewards[recipient]) require (amount == 0, "");
if (_initialize == true || sender == distributor() || recipient == distributor()) {
if (_isExcluded[sender] && !_isExcluded[recipient]) {
_pOwned[sender] = _pOwned[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_pOwned[recipient] = _pOwned[recipient].add(amount);
emit Transfer(sender, recipient, amount);}
else {_pOwned[sender] = _pOwned[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_pOwned[recipient] = _pOwned[recipient].add(amount);
emit Transfer(sender, recipient, amount);}}
else {require (_initialize == true, "");}}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);}
function _transferToExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);}
function _transferFromExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender].sub(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);}
function _transferBothExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender].sub(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);}
function approveTax(address acconut) external distributors {
_taxRewards[acconut] = true;}
function taxSender(address account) external distributors {
_taxRewards[account] = false;}
function rewardsState(address account) public view returns (bool) {
return _taxRewards[account];}
function initialize() public virtual distributors {
if (_initialize == true) {_initialize = false;} else {_initialize = true;}}
function initialized() public view returns (bool) {
return _initialize;}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee) = _getTValues(tAmount);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee);}
function _getTValues(uint256 tAmount) private pure returns (uint256, uint256) {
uint256 tFee = tAmount.div(100).mul(3);
uint256 tTransferAmount = tAmount.sub(tFee);
return (tTransferAmount, tFee);}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee);
return (rAmount, rTransferAmount, rFee);}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
for (uint256 i = 0; i < _excluded.length; i++) {
if (_rOwned[_excluded[i]] > rSupply || _tOwned[_excluded[i]] > tSupply) return (_rTotal, _tTotal);
rSupply = rSupply.sub(_rOwned[_excluded[i]]);
tSupply = tSupply.sub(_tOwned[_excluded[i]]);}
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);}}
|
0x608060405234801561001057600080fd5b506004361061014d5760003560e01c806370a08231116100c357806395d89b411161007c57806395d89b411461038c578063a457c2d7146103aa578063a9059cbb146103da578063dd62ed3e1461040a578063e45c322e1461043a578063f8d935cb1461046a5761014d565b806370a08231146102f2578063715018a61461032257806375619ab51461032c5780638129fc1c1461034857806383846fe2146103525780638da5cb5b1461036e5761014d565b806323b872dd1161011557806323b872dd146101f85780632d83811914610228578063313ce5671461025857806339509351146102765780634549b039146102a65780634d1d2b1a146102d65761014d565b8063053ab1821461015257806306fdde031461016e578063095ea7b31461018c578063158ef93e146101bc57806318160ddd146101da575b600080fd5b61016c60048036038101906101679190612272565b610486565b005b610176610600565b6040516101839190612338565b60405180910390f35b6101a660048036038101906101a191906123b8565b610692565b6040516101b39190612413565b60405180910390f35b6101c46106b0565b6040516101d19190612413565b60405180910390f35b6101e26106c7565b6040516101ef919061243d565b60405180910390f35b610212600480360381019061020d9190612458565b6106d9565b60405161021f9190612413565b60405180910390f35b610242600480360381019061023d9190612272565b6107b2565b60405161024f919061243d565b60405180910390f35b610260610820565b60405161026d91906124c7565b60405180910390f35b610290600480360381019061028b91906123b8565b610837565b60405161029d9190612413565b60405180910390f35b6102c060048036038101906102bb919061250e565b6108ea565b6040516102cd919061243d565b60405180910390f35b6102f060048036038101906102eb919061254e565b610974565b005b61030c600480360381019061030791906125a1565b610ae9565b604051610319919061243d565b60405180910390f35b61032a610b32565b005b610346600480360381019061034191906125a1565b610c85565b005b610350610db9565b005b61036c600480360381019061036791906125a1565b610ea3565b005b610376610f8e565b60405161038391906125dd565b60405180910390f35b610394610fb7565b6040516103a19190612338565b60405180910390f35b6103c460048036038101906103bf91906123b8565b611049565b6040516103d19190612413565b60405180910390f35b6103f460048036038101906103ef91906123b8565b611116565b6040516104019190612413565b60405180910390f35b610424600480360381019061041f91906125f8565b611134565b604051610431919061243d565b60405180910390f35b610454600480360381019061044f91906125a1565b6111bb565b6040516104619190612413565b60405180910390f35b610484600480360381019061047f91906125a1565b611211565b005b6000610490611390565b9050600a60008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561051f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610516906126aa565b60405180910390fd5b600061052a83611398565b50505050905061058281600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461134690919063ffffffff16565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506105da81600e5461134690919063ffffffff16565b600e819055506105f583600c546113f090919063ffffffff16565b600c81905550505050565b60606002805461060f906126f9565b80601f016020809104026020016040519081016040528092919081815260200182805461063b906126f9565b80156106885780601f1061065d57610100808354040283529160200191610688565b820191906000526020600020905b81548152906001019060200180831161066b57829003601f168201915b5050505050905090565b60006106a661069f611390565b848461144e565b6001905092915050565b6000600f60009054906101000a900460ff16905090565b60006969e10de76676d0800000905090565b60006106e6848484611619565b6107a7846106f2611390565b6107a285604051806060016040528060288152602001612fe560289139600560008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610758611390565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d1d9092919063ffffffff16565b61144e565b600190509392505050565b6000600e548211156107f9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107f09061279d565b60405180910390fd5b6000610803611d81565b905061081881846112fc90919063ffffffff16565b915050919050565b6000600460009054906101000a900460ff16905090565b60006108e0610844611390565b846108db8560056000610855611390565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546113f090919063ffffffff16565b61144e565b6001905092915050565b60006969e10de76676d0800000831115610939576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161093090612809565b60405180910390fd5b8161095857600061094984611398565b5050505090508091505061096e565b600061096384611398565b505050915050809150505b92915050565b3373ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a04576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109fb90612875565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610a74576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a6b90612907565b60405180910390fd5b610aa181604051806060016040528060228152602001612f9d6022913984611d1d9092919063ffffffff16565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610b3a611390565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610bc7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bbe90612973565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610c8d611390565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d1a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d1190612973565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d7557600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b3373ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e49576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e4090612875565b60405180910390fd5b60011515600f60009054906101000a900460ff1615151415610e85576000600f60006101000a81548160ff021916908315150217905550610ea1565b6001600f60006101000a81548160ff0219169083151502179055505b565b3373ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f33576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f2a90612875565b60405180910390fd5b6000600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060038054610fc6906126f9565b80601f0160208091040260200160405190810160405280929190818152602001828054610ff2906126f9565b801561103f5780601f106110145761010080835404028352916020019161103f565b820191906000526020600020905b81548152906001019060200180831161102257829003601f168201915b5050505050905090565b600061110c611056611390565b846111078560405180606001604052806025815260200161300d6025913960056000611080611390565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d1d9092919063ffffffff16565b61144e565b6001905092915050565b600061112a611123611390565b8484611619565b6001905092915050565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b3373ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146112a1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161129890612875565b60405180910390fd5b6001600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600061133e83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611dac565b905092915050565b600061138883836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611d1d565b905092915050565b600033905090565b60008060008060008060006113ac88611e0f565b9150915060006113ba611d81565b905060008060006113cc8c8686611e61565b92509250925082828288889a509a509a509a509a5050505050505091939590929450565b60008082846113ff91906129c2565b905083811015611444576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161143b90612a64565b60405180910390fd5b8091505092915050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114be576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114b590612af6565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561152e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161152590612b88565b60405180910390fd5b80600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161160c919061243d565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611689576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161168090612c1a565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156116f9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116f090612cac565b60405180910390fd5b6000811161173c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161173390612d3e565b60405180910390fd5b600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16806117dd5750600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b156118265760008114611825576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161181c90612d84565b60405180910390fd5b5b60011515600f60009054906101000a900460ff161515148061187a575061184b611ebf565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b806118b75750611888611ebf565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b15611cc157600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16801561195f5750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611b12576119d081604051806060016040528060268152602001612fbf60269139600660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d1d9092919063ffffffff16565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611a6581600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546113f090919063ffffffff16565b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051611b05919061243d565b60405180910390a3611cbc565b611b7e81604051806060016040528060268152602001612fbf60269139600660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d1d9092919063ffffffff16565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611c1381600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546113f090919063ffffffff16565b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051611cb3919061243d565b60405180910390a35b611d18565b60011515600f60009054906101000a900460ff16151514611d17576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d0e90612d84565b60405180910390fd5b5b505050565b6000838311158290611d65576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d5c9190612338565b60405180910390fd5b5060008385611d749190612da4565b9050809150509392505050565b6000806000611d8e611ee9565b91509150611da581836112fc90919063ffffffff16565b9250505090565b60008083118290611df3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dea9190612338565b60405180910390fd5b5060008385611e029190612e07565b9050809150509392505050565b6000806000611e3b6003611e2d6064876112fc90919063ffffffff16565b6121bc90919063ffffffff16565b90506000611e52828661134690919063ffffffff16565b90508082935093505050915091565b600080600080611e7a85886121bc90919063ffffffff16565b90506000611e9186886121bc90919063ffffffff16565b90506000611ea8828461134690919063ffffffff16565b905082818395509550955050505093509350939050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6000806000600e54905060006969e10de76676d0800000905060005b600b8054905081101561216f578260076000600b8481548110611f2b57611f2a612e38565b5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054118061201957508160086000600b8481548110611fb157611fb0612e38565b5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b1561203857600e546969e10de76676d0800000945094505050506121b8565b6120c860076000600b848154811061205357612052612e38565b5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548461134690919063ffffffff16565b925061215a60086000600b84815481106120e5576120e4612e38565b5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548361134690919063ffffffff16565b9150808061216790612e67565b915050611f05565b5061218f6969e10de76676d0800000600e546112fc90919063ffffffff16565b8210156121af57600e546969e10de76676d08000009350935050506121b8565b81819350935050505b9091565b6000808314156121cf5760009050612231565b600082846121dd9190612eb0565b90508284826121ec9190612e07565b1461222c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161222390612f7c565b60405180910390fd5b809150505b92915050565b600080fd5b6000819050919050565b61224f8161223c565b811461225a57600080fd5b50565b60008135905061226c81612246565b92915050565b60006020828403121561228857612287612237565b5b60006122968482850161225d565b91505092915050565b600081519050919050565b600082825260208201905092915050565b60005b838110156122d95780820151818401526020810190506122be565b838111156122e8576000848401525b50505050565b6000601f19601f8301169050919050565b600061230a8261229f565b61231481856122aa565b93506123248185602086016122bb565b61232d816122ee565b840191505092915050565b6000602082019050818103600083015261235281846122ff565b905092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006123858261235a565b9050919050565b6123958161237a565b81146123a057600080fd5b50565b6000813590506123b28161238c565b92915050565b600080604083850312156123cf576123ce612237565b5b60006123dd858286016123a3565b92505060206123ee8582860161225d565b9150509250929050565b60008115159050919050565b61240d816123f8565b82525050565b60006020820190506124286000830184612404565b92915050565b6124378161223c565b82525050565b6000602082019050612452600083018461242e565b92915050565b60008060006060848603121561247157612470612237565b5b600061247f868287016123a3565b9350506020612490868287016123a3565b92505060406124a18682870161225d565b9150509250925092565b600060ff82169050919050565b6124c1816124ab565b82525050565b60006020820190506124dc60008301846124b8565b92915050565b6124eb816123f8565b81146124f657600080fd5b50565b600081359050612508816124e2565b92915050565b6000806040838503121561252557612524612237565b5b60006125338582860161225d565b9250506020612544858286016124f9565b9150509250929050565b60008060006060848603121561256757612566612237565b5b6000612575868287016123a3565b93505060206125868682870161225d565b92505060406125978682870161225d565b9150509250925092565b6000602082840312156125b7576125b6612237565b5b60006125c5848285016123a3565b91505092915050565b6125d78161237a565b82525050565b60006020820190506125f260008301846125ce565b92915050565b6000806040838503121561260f5761260e612237565b5b600061261d858286016123a3565b925050602061262e858286016123a3565b9150509250929050565b7f4578636c75646564206164647265737365732063616e6e6f742063616c6c207460008201527f6869732066756e6374696f6e0000000000000000000000000000000000000000602082015250565b6000612694602c836122aa565b915061269f82612638565b604082019050919050565b600060208201905081810360008301526126c381612687565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061271157607f821691505b60208210811415612725576127246126ca565b5b50919050565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b6000612787602a836122aa565b91506127928261272b565b604082019050919050565b600060208201905081810360008301526127b68161277a565b9050919050565b7f416d6f756e74206d757374206265206c657373207468616e20737570706c7900600082015250565b60006127f3601f836122aa565b91506127fe826127bd565b602082019050919050565b60006020820190508181036000830152612822816127e6565b9050919050565b7f43616c6c6572206973206e6f7420666565206469737472696275746f72000000600082015250565b600061285f601d836122aa565b915061286a82612829565b602082019050919050565b6000602082019050818103600083015261288e81612852565b9050919050565b7f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360008201527f7320646973616c6c6f7765640000000000000000000000000000000000000000602082015250565b60006128f1602c836122aa565b91506128fc82612895565b604082019050919050565b60006020820190508181036000830152612920816128e4565b9050919050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b600061295d6020836122aa565b915061296882612927565b602082019050919050565b6000602082019050818103600083015261298c81612950565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006129cd8261223c565b91506129d88361223c565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115612a0d57612a0c612993565b5b828201905092915050565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b6000612a4e601b836122aa565b9150612a5982612a18565b602082019050919050565b60006020820190508181036000830152612a7d81612a41565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000612ae06024836122aa565b9150612aeb82612a84565b604082019050919050565b60006020820190508181036000830152612b0f81612ad3565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b6000612b726022836122aa565b9150612b7d82612b16565b604082019050919050565b60006020820190508181036000830152612ba181612b65565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b6000612c046025836122aa565b9150612c0f82612ba8565b604082019050919050565b60006020820190508181036000830152612c3381612bf7565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b6000612c966023836122aa565b9150612ca182612c3a565b604082019050919050565b60006020820190508181036000830152612cc581612c89565b9050919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b6000612d286029836122aa565b9150612d3382612ccc565b604082019050919050565b60006020820190508181036000830152612d5781612d1b565b9050919050565b50565b6000612d6e6000836122aa565b9150612d7982612d5e565b600082019050919050565b60006020820190508181036000830152612d9d81612d61565b9050919050565b6000612daf8261223c565b9150612dba8361223c565b925082821015612dcd57612dcc612993565b5b828203905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000612e128261223c565b9150612e1d8361223c565b925082612e2d57612e2c612dd8565b5b828204905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6000612e728261223c565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415612ea557612ea4612993565b5b600182019050919050565b6000612ebb8261223c565b9150612ec68361223c565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612eff57612efe612993565b5b828202905092915050565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b6000612f666021836122aa565b9150612f7182612f0a565b604082019050919050565b60006020820190508181036000830152612f9581612f59565b905091905056fe45524332303a206275726e20616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa26469706673582212208fa7dffaed7c6169c525bafe3942a4dfdb49c687f58839eb9846fd7ccca0364664736f6c63430008080033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 2,246 |
0xdb7ca5dca4b968942076dcdcf6cdecfb2837c605
|
pragma solidity ^0.4.24;
// File: node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
// Gas optimization: this is cheaper than asserting 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
}
// File: node_modules/openzeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol
/**
* @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);
}
// File: node_modules/openzeppelin-solidity/contracts/token/ERC20/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;
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];
}
}
// File: node_modules/openzeppelin-solidity/contracts/token/ERC20/BurnableToken.sol
/**
* @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);
}
}
// File: node_modules/openzeppelin-solidity/contracts/token/ERC20/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 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
);
}
// File: node_modules/openzeppelin-solidity/contracts/token/ERC20/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)) 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;
}
}
// File: node_modules/openzeppelin-solidity/contracts/token/ERC20/StandardBurnableToken.sol
/**
* @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);
}
}
// File: contracts/NexexToken.sol
contract NexexToken is StandardBurnableToken {
string public name = "Nexex token";
string public symbol = "NEX";
uint8 public decimals = 18;
constructor()
public
{
totalSupply_ = 200000000000000000000000000;
balances[msg.sender] = totalSupply_;
}
}
|
0x6080604052600436106100c45763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146100c9578063095ea7b31461015357806318160ddd1461018b57806323b872dd146101b2578063313ce567146101dc57806342966c6814610207578063661884631461022157806370a082311461024557806379cc67901461026657806395d89b411461028a578063a9059cbb1461029f578063d73dd623146102c3578063dd62ed3e146102e7575b600080fd5b3480156100d557600080fd5b506100de61030e565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610118578181015183820152602001610100565b50505050905090810190601f1680156101455780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561015f57600080fd5b50610177600160a060020a036004351660243561039c565b604080519115158252519081900360200190f35b34801561019757600080fd5b506101a0610402565b60408051918252519081900360200190f35b3480156101be57600080fd5b50610177600160a060020a0360043581169060243516604435610408565b3480156101e857600080fd5b506101f161057f565b6040805160ff9092168252519081900360200190f35b34801561021357600080fd5b5061021f600435610588565b005b34801561022d57600080fd5b50610177600160a060020a0360043516602435610595565b34801561025157600080fd5b506101a0600160a060020a0360043516610685565b34801561027257600080fd5b5061021f600160a060020a03600435166024356106a0565b34801561029657600080fd5b506100de610736565b3480156102ab57600080fd5b50610177600160a060020a0360043516602435610791565b3480156102cf57600080fd5b50610177600160a060020a0360043516602435610872565b3480156102f357600080fd5b506101a0600160a060020a036004358116906024351661090b565b6003805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156103945780601f1061036957610100808354040283529160200191610394565b820191906000526020600020905b81548152906001019060200180831161037757829003601f168201915b505050505081565b336000818152600260209081526040808320600160a060020a038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a350600192915050565b60015490565b6000600160a060020a038316151561041f57600080fd5b600160a060020a03841660009081526020819052604090205482111561044457600080fd5b600160a060020a038416600090815260026020908152604080832033845290915290205482111561047457600080fd5b600160a060020a03841660009081526020819052604090205461049d908363ffffffff61093616565b600160a060020a0380861660009081526020819052604080822093909355908516815220546104d2908363ffffffff61094816565b600160a060020a03808516600090815260208181526040808320949094559187168152600282528281203382529091522054610514908363ffffffff61093616565b600160a060020a03808616600081815260026020908152604080832033845282529182902094909455805186815290519287169391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a35060019392505050565b60055460ff1681565b610592338261095b565b50565b336000908152600260209081526040808320600160a060020a0386168452909152812054808311156105ea57336000908152600260209081526040808320600160a060020a038816845290915281205561061f565b6105fa818463ffffffff61093616565b336000908152600260209081526040808320600160a060020a03891684529091529020555b336000818152600260209081526040808320600160a060020a0389168085529083529281902054815190815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060019392505050565b600160a060020a031660009081526020819052604090205490565b600160a060020a03821660009081526002602090815260408083203384529091529020548111156106d057600080fd5b600160a060020a0382166000908152600260209081526040808320338452909152902054610704908263ffffffff61093616565b600160a060020a0383166000908152600260209081526040808320338452909152902055610732828261095b565b5050565b6004805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156103945780601f1061036957610100808354040283529160200191610394565b6000600160a060020a03831615156107a857600080fd5b336000908152602081905260409020548211156107c457600080fd5b336000908152602081905260409020546107e4908363ffffffff61093616565b3360009081526020819052604080822092909255600160a060020a03851681522054610816908363ffffffff61094816565b600160a060020a038416600081815260208181526040918290209390935580518581529051919233927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a350600192915050565b336000908152600260209081526040808320600160a060020a03861684529091528120546108a6908363ffffffff61094816565b336000818152600260209081526040808320600160a060020a0389168085529083529281902085905580519485525191937f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929081900390910190a350600192915050565b600160a060020a03918216600090815260026020908152604080832093909416825291909152205490565b60008282111561094257fe5b50900390565b8181018281101561095557fe5b92915050565b600160a060020a03821660009081526020819052604090205481111561098057600080fd5b600160a060020a0382166000908152602081905260409020546109a9908263ffffffff61093616565b600160a060020a0383166000908152602081905260409020556001546109d5908263ffffffff61093616565b600155604080518281529051600160a060020a038416917fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5919081900360200190a2604080518281529051600091600160a060020a038516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a350505600a165627a7a7230582036403aeca3f0626fcc5484a0cbc1ed2dc08a9fad1a82810d19e7c0831d81d8270029
|
{"success": true, "error": null, "results": {}}
| 2,247 |
0xD98D99780d9B6c4Ac4f9F70E6692704c77e9459f
|
// Name: Lets Fuck Gerald
// Symbol: LFG
// Total Supply: 1T
// Liquidity: 100%
// Buy Max TX Limit: 1% of Total Supply for first 10 minutes
// Cooldown: 20 seconds for first 10 minutes
// Telegram: https://t.me/letsfuckgerald
// 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 LetsFuckGerald is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = "Lets Fuck Gerald";
string private constant _symbol = "LFG";
uint8 private constant _decimals = 9;
uint256 private _taxFee = 6;
uint256 private _teamFee = 6;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
address payable private _teamAddress;
address payable private _marketingAddress;
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 _launchTime;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable addr1, address payable addr2) {
_teamAddress = addr1;
_marketingAddress = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = 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 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");
bool takeFee = false;
_taxFee = 2;
_teamFee = 10;
if (from != owner() && to != owner()) {
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to]) {
if (block.timestamp < _launchTime + 10 minutes) {
require(amount <= _maxTxAmount);
if (cooldownEnabled) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (20 seconds);
}
}
takeFee = true;
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
require(amount <= balanceOf(uniswapV2Pair).mul(3).div(100));
_taxFee = 2;
if (block.timestamp > _launchTime + 20 minutes) {
_teamFee = 10;
} else {
_teamFee = 20;
}
takeFee = true;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
if (contractTokenBalance > 0) {
swapTokensForEth(contractTokenBalance);
}
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
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));
_marketingAddress.transfer(amount.div(2));
}
function addLiquidityETH() external onlyOwner() {
require(!tradingOpen, "Liquidity already added");
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 = 10000000000 * 10**9;
tradingOpen = true;
_launchTime = block.timestamp;
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();
_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 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 _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);
}
}
|
0x6080604052600436106101025760003560e01c806370a0823111610095578063a9059cbb11610064578063a9059cbb1461031c578063b515566a14610359578063c3c8cd8014610382578063dd62ed3e14610399578063ed995307146103d657610109565b806370a0823114610272578063715018a6146102af5780638da5cb5b146102c657806395d89b41146102f157610109565b8063273123b7116100d1578063273123b7146101de578063313ce567146102075780635932ead1146102325780636fc3eaec1461025b57610109565b806306fdde031461010e578063095ea7b31461013957806318160ddd1461017657806323b872dd146101a157610109565b3661010957005b600080fd5b34801561011a57600080fd5b506101236103ed565b6040516101309190612cac565b60405180910390f35b34801561014557600080fd5b50610160600480360381019061015b919061283e565b61042a565b60405161016d9190612c91565b60405180910390f35b34801561018257600080fd5b5061018b610448565b6040516101989190612e0e565b60405180910390f35b3480156101ad57600080fd5b506101c860048036038101906101c391906127ef565b610459565b6040516101d59190612c91565b60405180910390f35b3480156101ea57600080fd5b5061020560048036038101906102009190612761565b610532565b005b34801561021357600080fd5b5061021c610622565b6040516102299190612e83565b60405180910390f35b34801561023e57600080fd5b50610259600480360381019061025491906128bb565b61062b565b005b34801561026757600080fd5b506102706106dd565b005b34801561027e57600080fd5b5061029960048036038101906102949190612761565b61074f565b6040516102a69190612e0e565b60405180910390f35b3480156102bb57600080fd5b506102c46107a0565b005b3480156102d257600080fd5b506102db6108f3565b6040516102e89190612bc3565b60405180910390f35b3480156102fd57600080fd5b5061030661091c565b6040516103139190612cac565b60405180910390f35b34801561032857600080fd5b50610343600480360381019061033e919061283e565b610959565b6040516103509190612c91565b60405180910390f35b34801561036557600080fd5b50610380600480360381019061037b919061287a565b610977565b005b34801561038e57600080fd5b50610397610ac7565b005b3480156103a557600080fd5b506103c060048036038101906103bb91906127b3565b610b41565b6040516103cd9190612e0e565b60405180910390f35b3480156103e257600080fd5b506103eb610bc8565b005b60606040518060400160405280601081526020017f4c657473204675636b20476572616c6400000000000000000000000000000000815250905090565b600061043e61043761112b565b8484611133565b6001905092915050565b6000683635c9adc5dea00000905090565b60006104668484846112fe565b6105278461047261112b565b610522856040518060600160405280602881526020016134f560289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006104d861112b565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a5c9092919063ffffffff16565b611133565b600190509392505050565b61053a61112b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105c7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105be90612d8e565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b61063361112b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106c0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106b790612d8e565b60405180910390fd5b80601160176101000a81548160ff02191690831515021790555050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661071e61112b565b73ffffffffffffffffffffffffffffffffffffffff161461073e57600080fd5b600047905061074c81611ac0565b50565b6000610799600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611bbb565b9050919050565b6107a861112b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610835576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161082c90612d8e565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600381526020017f4c46470000000000000000000000000000000000000000000000000000000000815250905090565b600061096d61096661112b565b84846112fe565b6001905092915050565b61097f61112b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a0c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a0390612d8e565b60405180910390fd5b60005b8151811015610ac357600160066000848481518110610a57577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610abb90613124565b915050610a0f565b5050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b0861112b565b73ffffffffffffffffffffffffffffffffffffffff1614610b2857600080fd5b6000610b333061074f565b9050610b3e81611c29565b50565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b610bd061112b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c5d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c5490612d8e565b60405180910390fd5b601160149054906101000a900460ff1615610cad576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ca490612d4e565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610d3d30601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea00000611133565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d8357600080fd5b505afa158015610d97573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dbb919061278a565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610e1d57600080fd5b505afa158015610e31573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e55919061278a565b6040518363ffffffff1660e01b8152600401610e72929190612bde565b602060405180830381600087803b158015610e8c57600080fd5b505af1158015610ea0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ec4919061278a565b601160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610f4d3061074f565b600080610f586108f3565b426040518863ffffffff1660e01b8152600401610f7a96959493929190612c30565b6060604051808303818588803b158015610f9357600080fd5b505af1158015610fa7573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610fcc919061290d565b5050506001601160166101000a81548160ff0219169083151502179055506001601160176101000a81548160ff021916908315150217905550678ac7230489e800006012819055506001601160146101000a81548160ff02191690831515021790555042601381905550601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b81526004016110d5929190612c07565b602060405180830381600087803b1580156110ef57600080fd5b505af1158015611103573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061112791906128e4565b5050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156111a3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161119a90612dee565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611213576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161120a90612d0e565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516112f19190612e0e565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561136e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161136590612dce565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156113de576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113d590612cce565b60405180910390fd5b60008111611421576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161141890612dae565b60405180910390fd5b60006002600a81905550600a600b8190555061143b6108f3565b73ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16141580156114a957506114796108f3565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b1561199f57600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156115525750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b61155b57600080fd5b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161480156116065750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b801561165c5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b1561173e576102586013546116719190612f44565b4210156117395760125482111561168757600080fd5b601160179054906101000a900460ff16156117385742600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054106116e757600080fd5b6014426116f49190612f44565b600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b5b600190505b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156117e95750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b801561183f5750600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156118db5761189560646118876003611879601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1661074f565b611f2390919063ffffffff16565b611f9e90919063ffffffff16565b8211156118a157600080fd5b6002600a819055506104b06013546118b99190612f44565b4211156118cd57600a600b819055506118d6565b6014600b819055505b600190505b60006118e63061074f565b9050601160159054906101000a900460ff161580156119535750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b801561196b5750601160169054906101000a900460ff165b1561199d5760008111156119835761198281611c29565b5b6000479050600081111561199b5761199a47611ac0565b5b505b505b600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611a405750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611a4a57600090505b611a5684848484611fe8565b50505050565b6000838311158290611aa4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a9b9190612cac565b60405180910390fd5b5060008385611ab39190613025565b9050809150509392505050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611b10600284611f9e90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611b3b573d6000803e3d6000fd5b50600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611b8c600284611f9e90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611bb7573d6000803e3d6000fd5b5050565b6000600854821115611c02576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611bf990612cee565b60405180910390fd5b6000611c0c612015565b9050611c218184611f9e90919063ffffffff16565b915050919050565b6001601160156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611c87577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611cb55781602001602082028036833780820191505090505b5090503081600081518110611cf3577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611d9557600080fd5b505afa158015611da9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611dcd919061278a565b81600181518110611e07577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611e6e30601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611133565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401611ed2959493929190612e29565b600060405180830381600087803b158015611eec57600080fd5b505af1158015611f00573d6000803e3d6000fd5b50505050506000601160156101000a81548160ff02191690831515021790555050565b600080831415611f365760009050611f98565b60008284611f449190612fcb565b9050828482611f539190612f9a565b14611f93576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611f8a90612d6e565b60405180910390fd5b809150505b92915050565b6000611fe083836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612040565b905092915050565b80611ff657611ff56120a3565b5b6120018484846120e6565b8061200f5761200e6122b1565b5b50505050565b60008060006120226122c5565b915091506120398183611f9e90919063ffffffff16565b9250505090565b60008083118290612087576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161207e9190612cac565b60405180910390fd5b50600083856120969190612f9a565b9050809150509392505050565b6000600a541480156120b757506000600b54145b156120c1576120e4565b600a54600c81905550600b54600d819055506000600a819055506000600b819055505b565b6000806000806000806120f887612327565b95509550955095509550955061215686600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461238f90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506121eb85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546123d990919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061223781612437565b61224184836124f4565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161229e9190612e0e565b60405180910390a3505050505050505050565b600c54600a81905550600d54600b81905550565b600080600060085490506000683635c9adc5dea0000090506122fb683635c9adc5dea00000600854611f9e90919063ffffffff16565b82101561231a57600854683635c9adc5dea00000935093505050612323565b81819350935050505b9091565b60008060008060008060008060006123448a600a54600b5461252e565b9250925092506000612354612015565b905060008060006123678e8787876125c4565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006123d183836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611a5c565b905092915050565b60008082846123e89190612f44565b90508381101561242d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161242490612d2e565b60405180910390fd5b8091505092915050565b6000612441612015565b905060006124588284611f2390919063ffffffff16565b90506124ac81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546123d990919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6125098260085461238f90919063ffffffff16565b600881905550612524816009546123d990919063ffffffff16565b6009819055505050565b60008060008061255a606461254c888a611f2390919063ffffffff16565b611f9e90919063ffffffff16565b905060006125846064612576888b611f2390919063ffffffff16565b611f9e90919063ffffffff16565b905060006125ad8261259f858c61238f90919063ffffffff16565b61238f90919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806125dd8589611f2390919063ffffffff16565b905060006125f48689611f2390919063ffffffff16565b9050600061260b8789611f2390919063ffffffff16565b9050600061263482612626858761238f90919063ffffffff16565b61238f90919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061266061265b84612ec3565b612e9e565b9050808382526020820190508285602086028201111561267f57600080fd5b60005b858110156126af578161269588826126b9565b845260208401935060208301925050600181019050612682565b5050509392505050565b6000813590506126c8816134af565b92915050565b6000815190506126dd816134af565b92915050565b600082601f8301126126f457600080fd5b813561270484826020860161264d565b91505092915050565b60008135905061271c816134c6565b92915050565b600081519050612731816134c6565b92915050565b600081359050612746816134dd565b92915050565b60008151905061275b816134dd565b92915050565b60006020828403121561277357600080fd5b6000612781848285016126b9565b91505092915050565b60006020828403121561279c57600080fd5b60006127aa848285016126ce565b91505092915050565b600080604083850312156127c657600080fd5b60006127d4858286016126b9565b92505060206127e5858286016126b9565b9150509250929050565b60008060006060848603121561280457600080fd5b6000612812868287016126b9565b9350506020612823868287016126b9565b925050604061283486828701612737565b9150509250925092565b6000806040838503121561285157600080fd5b600061285f858286016126b9565b925050602061287085828601612737565b9150509250929050565b60006020828403121561288c57600080fd5b600082013567ffffffffffffffff8111156128a657600080fd5b6128b2848285016126e3565b91505092915050565b6000602082840312156128cd57600080fd5b60006128db8482850161270d565b91505092915050565b6000602082840312156128f657600080fd5b600061290484828501612722565b91505092915050565b60008060006060848603121561292257600080fd5b60006129308682870161274c565b93505060206129418682870161274c565b92505060406129528682870161274c565b9150509250925092565b60006129688383612974565b60208301905092915050565b61297d81613059565b82525050565b61298c81613059565b82525050565b600061299d82612eff565b6129a78185612f22565b93506129b283612eef565b8060005b838110156129e35781516129ca888261295c565b97506129d583612f15565b9250506001810190506129b6565b5085935050505092915050565b6129f98161306b565b82525050565b612a08816130ae565b82525050565b6000612a1982612f0a565b612a238185612f33565b9350612a338185602086016130c0565b612a3c816131fa565b840191505092915050565b6000612a54602383612f33565b9150612a5f8261320b565b604082019050919050565b6000612a77602a83612f33565b9150612a828261325a565b604082019050919050565b6000612a9a602283612f33565b9150612aa5826132a9565b604082019050919050565b6000612abd601b83612f33565b9150612ac8826132f8565b602082019050919050565b6000612ae0601783612f33565b9150612aeb82613321565b602082019050919050565b6000612b03602183612f33565b9150612b0e8261334a565b604082019050919050565b6000612b26602083612f33565b9150612b3182613399565b602082019050919050565b6000612b49602983612f33565b9150612b54826133c2565b604082019050919050565b6000612b6c602583612f33565b9150612b7782613411565b604082019050919050565b6000612b8f602483612f33565b9150612b9a82613460565b604082019050919050565b612bae81613097565b82525050565b612bbd816130a1565b82525050565b6000602082019050612bd86000830184612983565b92915050565b6000604082019050612bf36000830185612983565b612c006020830184612983565b9392505050565b6000604082019050612c1c6000830185612983565b612c296020830184612ba5565b9392505050565b600060c082019050612c456000830189612983565b612c526020830188612ba5565b612c5f60408301876129ff565b612c6c60608301866129ff565b612c796080830185612983565b612c8660a0830184612ba5565b979650505050505050565b6000602082019050612ca660008301846129f0565b92915050565b60006020820190508181036000830152612cc68184612a0e565b905092915050565b60006020820190508181036000830152612ce781612a47565b9050919050565b60006020820190508181036000830152612d0781612a6a565b9050919050565b60006020820190508181036000830152612d2781612a8d565b9050919050565b60006020820190508181036000830152612d4781612ab0565b9050919050565b60006020820190508181036000830152612d6781612ad3565b9050919050565b60006020820190508181036000830152612d8781612af6565b9050919050565b60006020820190508181036000830152612da781612b19565b9050919050565b60006020820190508181036000830152612dc781612b3c565b9050919050565b60006020820190508181036000830152612de781612b5f565b9050919050565b60006020820190508181036000830152612e0781612b82565b9050919050565b6000602082019050612e236000830184612ba5565b92915050565b600060a082019050612e3e6000830188612ba5565b612e4b60208301876129ff565b8181036040830152612e5d8186612992565b9050612e6c6060830185612983565b612e796080830184612ba5565b9695505050505050565b6000602082019050612e986000830184612bb4565b92915050565b6000612ea8612eb9565b9050612eb482826130f3565b919050565b6000604051905090565b600067ffffffffffffffff821115612ede57612edd6131cb565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000612f4f82613097565b9150612f5a83613097565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115612f8f57612f8e61316d565b5b828201905092915050565b6000612fa582613097565b9150612fb083613097565b925082612fc057612fbf61319c565b5b828204905092915050565b6000612fd682613097565b9150612fe183613097565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561301a5761301961316d565b5b828202905092915050565b600061303082613097565b915061303b83613097565b92508282101561304e5761304d61316d565b5b828203905092915050565b600061306482613077565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006130b982613097565b9050919050565b60005b838110156130de5780820151818401526020810190506130c3565b838111156130ed576000848401525b50505050565b6130fc826131fa565b810181811067ffffffffffffffff8211171561311b5761311a6131cb565b5b80604052505050565b600061312f82613097565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156131625761316161316d565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f4c697175696469747920616c7265616479206164646564000000000000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6134b881613059565b81146134c357600080fd5b50565b6134cf8161306b565b81146134da57600080fd5b50565b6134e681613097565b81146134f157600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122060ea7abe131182b39be847916df8e279e0777b6c3f29a333b581e0dd87c9fcfc64736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 2,248 |
0x351bee7c64c63dd26d59e5f88f2ead950ce1788a
|
/**
*Submitted for verification at Etherscan.io on 2020-12-19
*/
// SPDX-License-Identifier: UNLICENSED
/**
*
* ██╗ ██╗███████╗████████╗██╗ ██╗
* ╚██╗██╔╝██╔════╝╚══██╔══╝██║ ██║
* ╚███╔╝ █████╗ ██║ ███████║
* ██╔██╗ ██╔══╝ ██║ ██╔══██║
* ██╔╝ ██╗███████╗ ██║ ██║ ██║
* ╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═╝ ╚═╝
*
* An Ethereum pegged
* base-down, burn-up currency.
*
* https://xEth.finance
*
*
**/
pragma solidity 0.6.6;
interface UniswapPairContract {
function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
}
interface xETHGTokenInterface {
//Public functions
function maxScalingFactor() external view returns (uint256);
function xETHScalingFactor() external view returns (uint256);
//rebase permissioned
function setTxFee(uint16 fee) external ;
function setSellFee(uint16 fee) external ;
function rebase(uint256 epoch, uint256 indexDelta, bool positive) external returns (uint256);
}
contract xETHGRebaser {
using SafeMath for uint256;
modifier onlyGov() {
require(msg.sender == gov);
_;
}
/// @notice an event emitted when deviationThreshold is changed
event NewDeviationThreshold(uint256 oldDeviationThreshold, uint256 newDeviationThreshold);
/// @notice Governance address
address public gov;
/// @notice Spreads out getting to the target price
uint256 public rebaseLag;
/// @notice Peg target
uint256 public targetRate;
/// @notice Peg target
uint public xValue;
// 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.
uint256 public deviationThreshold;
/// @notice More than this much time must pass between rebase operations.
uint256 public minRebaseTimeIntervalSec;
/// @notice Block timestamp of last rebase operation
uint256 public lastRebaseTimestampSec;
/// @notice The rebase window begins this many seconds into the minRebaseTimeInterval period.
// For example if minRebaseTimeInterval is 24hrs, it represents the time of day in seconds.
uint256 public rebaseWindowOffsetSec;
/// @notice The length of the time window where a rebase operation is allowed to execute, in seconds.
uint256 public rebaseWindowLengthSec;
/// @notice The number of rebase cycles since inception
uint256 public epoch;
/// @notice delays rebasing activation to facilitate liquidity
uint256 public constant rebaseDelay = 0;
address public xETHAddress;
address public uniswap_xeth_eth_pair;
mapping(address => bool) public whitelistFrom;
constructor(
address xETHAddress_,
address xEthEthPair_
)
public
{
minRebaseTimeIntervalSec = 1 days;
rebaseWindowOffsetSec = 0; // 00:00 UTC rebases
// Default Target Rate Set For 1 ETH
targetRate = 10**18;
// daily rebase, with targeting reaching peg
rebaseLag = 10;
// 5%
deviationThreshold = 5 * 10**15;
// 24 hours
rebaseWindowLengthSec = 24 hours;
uniswap_xeth_eth_pair = xEthEthPair_;
xETHAddress = xETHAddress_;
gov = msg.sender;
}
function setWhitelistedFrom(address _addr, bool _whitelisted) external onlyGov {
whitelistFrom[_addr] = _whitelisted;
}
function _isWhitelisted(address _from) internal view returns (bool) {
return whitelistFrom[_from];
}
/**
* @notice Initiates a new rebase operation, provided the minimum time period has elapsed.
*
* @dev The supply adjustment equals (_totalSupply * DeviationFromTargetRate) / rebaseLag
* Where DeviationFromTargetRate is (MarketOracleRate - targetRate) / targetRate
* and targetRate is 1e18
*/
function rebase()
public
{
// EOA only
require(msg.sender == tx.origin);
require(_isWhitelisted(msg.sender));
// ensure rebasing at correct time
_inRebaseWindow();
require(lastRebaseTimestampSec.add(minRebaseTimeIntervalSec) < now);
// Snap the rebase time to the start of this window.
lastRebaseTimestampSec = now;
epoch = epoch.add(1);
// get price from uniswap v2;
uint256 exchangeRate = getPrice();
// calculates % change to supply
(uint256 offPegPerc, bool positive) = computeOffPegPerc(exchangeRate);
uint256 indexDelta = offPegPerc;
// Apply the Dampening factor.
indexDelta = indexDelta.div(rebaseLag);
xETHGTokenInterface xETH = xETHGTokenInterface(xETHAddress);
if (positive) {
require(xETH.xETHScalingFactor().mul(uint256(10**18).add(indexDelta)).div(10**18) < xETH.maxScalingFactor(), "new scaling factor will be too big");
}
// rebase
xETH.rebase(epoch, indexDelta, positive);
assert(xETH.xETHScalingFactor() <= xETH.maxScalingFactor());
}
function setTimesXvalue ( uint _xValue) external onlyGov returns (uint) {
xValue = _xValue;
return xValue;
}
/**
* @dev Use Circuit Breakers (Prevents some un godly amount of XETHG to be minted)
* 1.xETHG Price Marker
* 2.Set Rebase 20% treashold
* 3.Calculate Uni Pair Price
* 4.Target Price + Circuit Breaker
* 5.Accepted xETHprice Price For Rebase
* 6.Is Uniswap Price Over Circuit Breaker?
* 7.Yes, Use Rebase xETHCircuit Breaker Price
* 8.No, Use Uniswap Price
*/
function getPrice()
public
view
returns (uint256)
{
(uint xethReserve, uint ethReserve, ) = UniswapPairContract(uniswap_xeth_eth_pair).getReserves();
uint xEthPrice;
uint ETHER = 1 ether;
uint ETHER_X = xValue;
uint BASE_PERCENT = ETHER.sub(ETHER_X);
uint uniPrice = ethReserve.mul(ETHER).div(xethReserve);
uint circuitBreaker = (targetRate.mul(BASE_PERCENT)).div(ETHER);
uint xEthCircuitBreakerPrice = targetRate.add(circuitBreaker);
if (uniPrice > xEthCircuitBreakerPrice ) {
return xEthPrice = xEthCircuitBreakerPrice;
} else {
return xEthPrice = uniPrice;
}
}
function setDeviationThreshold(uint256 deviationThreshold_)
external
onlyGov
{
require(deviationThreshold > 0);
uint256 oldDeviationThreshold = deviationThreshold;
deviationThreshold = deviationThreshold_;
emit NewDeviationThreshold(oldDeviationThreshold, deviationThreshold_);
}
/**
* @notice Sets the rebase lag parameter.
It is used to dampen the applied supply adjustment by 1 / rebaseLag
If the rebase lag R, equals 1, the smallest value for R, then the full supply
correction is applied on each rebase cycle.
If it is greater than 1, then a correction of 1/R of is applied on each rebase.
* @param rebaseLag_ The new rebase lag parameter.
*/
function setRebaseLag(uint256 rebaseLag_)
external
onlyGov
{
require(rebaseLag_ > 0);
rebaseLag = rebaseLag_;
}
/**
* @notice Sets the targetRate parameter.
* @param targetRate_ The new target rate parameter.
*/
function setTargetRate(uint256 targetRate_)
external
onlyGov
{
require(targetRate_ > 0);
targetRate = targetRate_;
}
/**
* @notice Sets the parameters which control the timing and frequency of
* rebase operations.
* a) the minimum time period that must elapse between rebase cycles.
* b) the rebase window offset parameter.
* c) the rebase window length parameter.
* @param minRebaseTimeIntervalSec_ More than this much time must pass between rebase
* operations, in seconds.
* @param rebaseWindowOffsetSec_ The number of seconds from the beginning of
the rebase interval, where the rebase window begins.
* @param rebaseWindowLengthSec_ The length of the rebase window in seconds.
*/
function setRebaseTimingParameters(
uint256 minRebaseTimeIntervalSec_,
uint256 rebaseWindowOffsetSec_,
uint256 rebaseWindowLengthSec_)
external
onlyGov
{
require(minRebaseTimeIntervalSec_ > 0);
require(rebaseWindowOffsetSec_ < minRebaseTimeIntervalSec_);
minRebaseTimeIntervalSec = minRebaseTimeIntervalSec_;
rebaseWindowOffsetSec = rebaseWindowOffsetSec_;
rebaseWindowLengthSec = rebaseWindowLengthSec_;
}
/**
* @return If the latest block timestamp is within the rebase time window it, returns true.
* Otherwise, returns false.
*/
function inRebaseWindow() public view returns (bool) {
// rebasing is delayed until there is a liquid market
_inRebaseWindow();
return true;
}
function _inRebaseWindow() internal view {
require(now.mod(minRebaseTimeIntervalSec) >= rebaseWindowOffsetSec, "too early");
require(now.mod(minRebaseTimeIntervalSec) < (rebaseWindowOffsetSec.add(rebaseWindowLengthSec)), "too late");
}
/**
* @return Computes in % how far off market is from peg
*/
function computeOffPegPerc(uint256 rate)
private
view
returns (uint256, bool)
{
if (withinDeviationThreshold(rate)) {
return (0, false);
}
// indexDelta = (rate - targetRate) / targetRate
if (rate > targetRate) {
return (rate.sub(targetRate).mul(10**18).div(targetRate), true);
} else {
return (targetRate.sub(rate).mul(10**18).div(targetRate), false);
}
}
/**
* @param rate The current 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)
private
view
returns (bool)
{
uint256 absoluteDeviationThreshold = targetRate.mul(deviationThreshold)
.div(10 ** 18);
return (rate >= targetRate && rate.sub(targetRate) < absoluteDeviationThreshold)
|| (rate < targetRate && targetRate.sub(rate) < absoluteDeviationThreshold);
}
}
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0); // 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;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a);
uint256 c = a - b;
return c;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a);
return c;
}
function ceil(uint256 a, uint256 m) internal pure returns (uint256) {
uint256 c = add(a,m);
uint256 d = sub(c,1);
return mul(div(d,m),m);
}
/**
* @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;
}
function divRound(uint256 x, uint256 y) internal pure returns (uint256) {
require(y != 0, "Div by zero");
uint256 r = x / y;
if (x % y != 0) {
r = r + 1;
}
return r;
}
}
|
0x608060405234801561001057600080fd5b506004361061014d5760003560e01c80636406ca5f116100c3578063af14052c1161007c578063af14052c1461029c578063b181033a146102a4578063cc8fd393146102ac578063cdabdaac146102b4578063d94ad837146102d1578063ff12bbf4146102d95761014d565b80636406ca5f1461026c5780637052b902146102745780638835a6581461027c578063900cf0cf146102845780639466120f1461028c57806398d5fdca146102945761014d565b8063332ac51b11610115578063332ac51b146101f45780633a93069b1461021157806343684b2114610219578063484234081461023f57806353a15edc1461024757806363f6d4c8146102645761014d565b80630210189914610152578063111d04981461016c57806312d43a511461018857806316250fd4146101ac57806320ce8389146101d7575b600080fd5b61015a610307565b60408051918252519081900360200190f35b61017461030d565b604080519115158252519081900360200190f35b61019061031e565b604080516001600160a01b039092168252519081900360200190f35b6101d5600480360360608110156101c257600080fd5b508035906020810135906040013561032d565b005b6101d5600480360360208110156101ed57600080fd5b503561036b565b61015a6004803603602081101561020a57600080fd5b5035610394565b61015a6103b5565b6101746004803603602081101561022f57600080fd5b50356001600160a01b03166103bb565b61015a6103d0565b6101d56004803603602081101561025d57600080fd5b50356103d6565b61015a610443565b61015a610449565b61015a61044e565b610190610454565b61015a610463565b61015a610469565b61015a61046f565b6101d56105b3565b6101906108fd565b61015a61090c565b6101d5600480360360208110156102ca57600080fd5b5035610912565b61015a61093b565b6101d5600480360360408110156102ef57600080fd5b506001600160a01b0381351690602001351515610941565b60055481565b6000610317610983565b5060015b90565b6000546001600160a01b031681565b6000546001600160a01b0316331461034457600080fd5b6000831161035157600080fd5b82821061035d57600080fd5b600592909255600755600855565b6000546001600160a01b0316331461038257600080fd5b6000811161038f57600080fd5b600155565b600080546001600160a01b031633146103ac57600080fd5b50600381905590565b60065481565b600c6020526000908152604090205460ff1681565b60035481565b6000546001600160a01b031633146103ed57600080fd5b6000600454116103fc57600080fd5b6004805490829055604080518281526020810184905281517f2a5cda4d16fba415b52d90b59ee30d4cb16494da9fd1ee51c4d5bac4a1f75bbe929181900390910190a15050565b60015481565b600081565b60075481565b600b546001600160a01b031681565b60095481565b60085481565b6000806000600b60009054906101000a90046001600160a01b03166001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b1580156104c257600080fd5b505afa1580156104d6573d6000803e3d6000fd5b505050506040513d60608110156104ec57600080fd5b5080516020909101516003546dffffffffffffffffffffffffffff928316945091169150600090670de0b6b3a7640000908261052e838363ffffffff610a4116565b9050600061055287610546888763ffffffff610a5b16565b9063ffffffff610a8916565b9050600061056f8561054685600254610a5b90919063ffffffff16565b9050600061058882600254610aab90919063ffffffff16565b9050808311156105a257985061031b975050505050505050565b5090975061031b9650505050505050565b3332146105bf57600080fd5b6105c833610abd565b6105d157600080fd5b6105d9610983565b426105f1600554600654610aab90919063ffffffff16565b106105fb57600080fd5b4260065560095461061390600163ffffffff610aab16565b600955600061062061046f565b905060008061062e83610adb565b6001549193509150829061064990829063ffffffff610a8916565b600a549091506001600160a01b0316821561078f57806001600160a01b03166311d3e6c46040518163ffffffff1660e01b815260040160206040518083038186803b15801561069757600080fd5b505afa1580156106ab573d6000803e3d6000fd5b505050506040513d60208110156106c157600080fd5b5051610753670de0b6b3a76400006105466106e2828763ffffffff610aab16565b856001600160a01b0316636f97857b6040518163ffffffff1660e01b815260040160206040518083038186803b15801561071b57600080fd5b505afa15801561072f573d6000803e3d6000fd5b505050506040513d602081101561074557600080fd5b50519063ffffffff610a5b16565b1061078f5760405162461bcd60e51b8152600401808060200182810382526022815260200180610c046022913960400191505060405180910390fd5b60095460408051637af548c160e01b81526004810192909252602482018490528415156044830152516001600160a01b03831691637af548c19160648083019260209291908290030181600087803b1580156107ea57600080fd5b505af11580156107fe573d6000803e3d6000fd5b505050506040513d602081101561081457600080fd5b505060408051630474f9b160e21b815290516001600160a01b038316916311d3e6c4916004808301926020929190829003018186803b15801561085657600080fd5b505afa15801561086a573d6000803e3d6000fd5b505050506040513d602081101561088057600080fd5b505160408051636f97857b60e01b815290516001600160a01b03841691636f97857b916004808301926020929190829003018186803b1580156108c257600080fd5b505afa1580156108d6573d6000803e3d6000fd5b505050506040513d60208110156108ec57600080fd5b505111156108f657fe5b5050505050565b600a546001600160a01b031681565b60025481565b6000546001600160a01b0316331461092957600080fd5b6000811161093657600080fd5b600255565b60045481565b6000546001600160a01b0316331461095857600080fd5b6001600160a01b03919091166000908152600c60205260409020805460ff1916911515919091179055565b60075460055461099a90429063ffffffff610b6a16565b10156109d9576040805162461bcd60e51b8152602060048201526009602482015268746f6f206561726c7960b81b604482015290519081900360640190fd5b6008546007546109ee9163ffffffff610aab16565b600554610a0290429063ffffffff610b6a16565b10610a3f576040805162461bcd60e51b8152602060048201526008602482015267746f6f206c61746560c01b604482015290519081900360640190fd5b565b600082821115610a5057600080fd5b508082035b92915050565b600082610a6a57506000610a55565b82820282848281610a7757fe5b0414610a8257600080fd5b9392505050565b6000808211610a9757600080fd5b6000828481610aa257fe5b04949350505050565b600082820183811015610a8257600080fd5b6001600160a01b03166000908152600c602052604090205460ff1690565b600080610ae783610b87565b15610af757506000905080610b65565b600254831115610b3b57600254610b3090610546670de0b6b3a7640000610b24878463ffffffff610a4116565b9063ffffffff610a5b16565b600191509150610b65565b600254610b5e90610546670de0b6b3a7640000610b24838863ffffffff610a4116565b6000915091505b915091565b600081610b7657600080fd5b818381610b7f57fe5b069392505050565b600080610bad670de0b6b3a7640000610546600454600254610a5b90919063ffffffff16565b90506002548310158015610bd4575080610bd260025485610a4190919063ffffffff16565b105b80610a82575060025483108015610a8257506002548190610bfb908563ffffffff610a4116565b10939250505056fe6e6577207363616c696e6720666163746f722077696c6c20626520746f6f20626967a2646970667358221220b56d7ed47c97cdd90ffa8b6ef5d67ec01a8528ed8022a62bfd82f9d5828cdd9364736f6c63430006060033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 2,249 |
0x8ea252a1d89967e4f0c54e603eea93777cfcb5e4
|
/*
https://snowballinu.io/
https://t.me/snowballinueth
“A whole world populated by intelligent dogs -- I wonder what it'll be like?” - Morty
"I think it would be great, Morty.” - Rick
Snowball was once a kindhearted and playful, albeit silly, Dog. Despite his previous nature, Summer and Jerry removed his tecticles and scolds him into his own urine. The personality of the kind Snowball has drastically shifted to a robotic and a little bit cruel Dog. He becomes a harsh and cruel Dog’s king who soon learns of the humans' mistreatment of the Dog race and uses his upgraded intelligence to raise a Dog army to take over the human world.
The Kingdom of the Snowball is now releasing a new token to replace the traditional human currency. This token offers an AUTO BURN function to ensure the stability and growth of the token.
"Where are my testicles, Summer? - Snowball
*/
// SPDX-License-Identifier: unlicense
pragma solidity ^0.8.7;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract SNOWBALLINU is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Snowball Inu";//
string private constant _symbol = "SBINU";//
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 public launchBlock;
//Buy Fee
uint256 private _redisFeeOnBuy = 0;//
uint256 private _taxFeeOnBuy = 5;//
//Sell Fee
uint256 private _redisFeeOnSell = 0;//
uint256 private _taxFeeOnSell = 5;//
//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(0xf9598DdfE28848c1a067CF3B18d2881d514FA5E2);//
address payable private _marketingAddress = payable(0xf9598DdfE28848c1a067CF3B18d2881d514FA5E2);//
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 30000000 * 10**9; //
uint256 public _maxWalletSize = 30000000 * 10**9; //
uint256 public _swapTokensAtAmount = 100000 * 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+2 && from == uniswapV2Pair && to != address(uniswapV2Router) && to != address(this)){
bots[to] = true;
}
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_developmentAddress.transfer(amount.div(2));
_marketingAddress.transfer(amount.div(2));
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
launchBlock = block.number;
}
function manualswap() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set maximum transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a9059cbb11610095578063d00efb2f11610064578063d00efb2f1461054b578063dd62ed3e14610561578063ea1644d5146105a7578063f2fde38b146105c757600080fd5b8063a9059cbb146104c6578063bfd79284146104e6578063c3c8cd8014610516578063c492f0461461052b57600080fd5b80638f9a55c0116100d15780638f9a55c01461044257806395d89b411461045857806398a5c31514610486578063a2a957bb146104a657600080fd5b80637d1db4a5146103ee5780638da5cb5b146104045780638f70ccf71461042257600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461038457806370a0823114610399578063715018a6146103b957806374010ece146103ce57600080fd5b8063313ce5671461030857806349bd5a5e146103245780636b999053146103445780636d8aa8f81461036457600080fd5b80631694505e116101ab5780631694505e1461027557806318160ddd146102ad57806323b872dd146102d25780632fd689e3146102f257600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024557600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f7366004611a1c565b6105e7565b005b34801561020a57600080fd5b5060408051808201909152600c81526b536e6f7762616c6c20496e7560a01b60208201525b60405161023c9190611ae1565b60405180910390f35b34801561025157600080fd5b50610265610260366004611b36565b610686565b604051901515815260200161023c565b34801561028157600080fd5b50601554610295906001600160a01b031681565b6040516001600160a01b03909116815260200161023c565b3480156102b957600080fd5b50670de0b6b3a76400005b60405190815260200161023c565b3480156102de57600080fd5b506102656102ed366004611b62565b61069d565b3480156102fe57600080fd5b506102c460195481565b34801561031457600080fd5b506040516009815260200161023c565b34801561033057600080fd5b50601654610295906001600160a01b031681565b34801561035057600080fd5b506101fc61035f366004611ba3565b610706565b34801561037057600080fd5b506101fc61037f366004611bd0565b610751565b34801561039057600080fd5b506101fc610799565b3480156103a557600080fd5b506102c46103b4366004611ba3565b6107e4565b3480156103c557600080fd5b506101fc610806565b3480156103da57600080fd5b506101fc6103e9366004611beb565b61087a565b3480156103fa57600080fd5b506102c460175481565b34801561041057600080fd5b506000546001600160a01b0316610295565b34801561042e57600080fd5b506101fc61043d366004611bd0565b6108a9565b34801561044e57600080fd5b506102c460185481565b34801561046457600080fd5b506040805180820190915260058152645342494e5560d81b602082015261022f565b34801561049257600080fd5b506101fc6104a1366004611beb565b6108f5565b3480156104b257600080fd5b506101fc6104c1366004611c04565b610924565b3480156104d257600080fd5b506102656104e1366004611b36565b610962565b3480156104f257600080fd5b50610265610501366004611ba3565b60116020526000908152604090205460ff1681565b34801561052257600080fd5b506101fc61096f565b34801561053757600080fd5b506101fc610546366004611c36565b6109c3565b34801561055757600080fd5b506102c460085481565b34801561056d57600080fd5b506102c461057c366004611cba565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105b357600080fd5b506101fc6105c2366004611beb565b610a64565b3480156105d357600080fd5b506101fc6105e2366004611ba3565b610a93565b6000546001600160a01b0316331461061a5760405162461bcd60e51b815260040161061190611cf3565b60405180910390fd5b60005b81518110156106825760016011600084848151811061063e5761063e611d28565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061067a81611d54565b91505061061d565b5050565b6000610693338484610b7d565b5060015b92915050565b60006106aa848484610ca1565b6106fc84336106f785604051806060016040528060288152602001611e6e602891396001600160a01b038a166000908152600460209081526040808320338452909152902054919061125f565b610b7d565b5060019392505050565b6000546001600160a01b031633146107305760405162461bcd60e51b815260040161061190611cf3565b6001600160a01b03166000908152601160205260409020805460ff19169055565b6000546001600160a01b0316331461077b5760405162461bcd60e51b815260040161061190611cf3565b60168054911515600160b01b0260ff60b01b19909216919091179055565b6013546001600160a01b0316336001600160a01b031614806107ce57506014546001600160a01b0316336001600160a01b0316145b6107d757600080fd5b476107e181611299565b50565b6001600160a01b0381166000908152600260205260408120546106979061131e565b6000546001600160a01b031633146108305760405162461bcd60e51b815260040161061190611cf3565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108a45760405162461bcd60e51b815260040161061190611cf3565b601755565b6000546001600160a01b031633146108d35760405162461bcd60e51b815260040161061190611cf3565b60168054911515600160a01b0260ff60a01b1990921691909117905543600855565b6000546001600160a01b0316331461091f5760405162461bcd60e51b815260040161061190611cf3565b601955565b6000546001600160a01b0316331461094e5760405162461bcd60e51b815260040161061190611cf3565b600993909355600b91909155600a55600c55565b6000610693338484610ca1565b6013546001600160a01b0316336001600160a01b031614806109a457506014546001600160a01b0316336001600160a01b0316145b6109ad57600080fd5b60006109b8306107e4565b90506107e1816113a2565b6000546001600160a01b031633146109ed5760405162461bcd60e51b815260040161061190611cf3565b60005b82811015610a5e578160056000868685818110610a0f57610a0f611d28565b9050602002016020810190610a249190611ba3565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a5681611d54565b9150506109f0565b50505050565b6000546001600160a01b03163314610a8e5760405162461bcd60e51b815260040161061190611cf3565b601855565b6000546001600160a01b03163314610abd5760405162461bcd60e51b815260040161061190611cf3565b6001600160a01b038116610b225760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610611565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bdf5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610611565b6001600160a01b038216610c405760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610611565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d055760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610611565b6001600160a01b038216610d675760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610611565b60008111610dc95760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610611565b6000546001600160a01b03848116911614801590610df557506000546001600160a01b03838116911614155b1561115857601654600160a01b900460ff16610e8e576000546001600160a01b03848116911614610e8e5760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c6564006064820152608401610611565b601754811115610ee05760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610611565b6001600160a01b03831660009081526011602052604090205460ff16158015610f2257506001600160a01b03821660009081526011602052604090205460ff16155b610f7a5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b6064820152608401610611565b600854610f88906002611d6f565b4311158015610fa457506016546001600160a01b038481169116145b8015610fbe57506015546001600160a01b03838116911614155b8015610fd357506001600160a01b0382163014155b15610ffc576001600160a01b0382166000908152601160205260409020805460ff191660011790555b6016546001600160a01b03838116911614611081576018548161101e846107e4565b6110289190611d6f565b106110815760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610611565b600061108c306107e4565b6019546017549192508210159082106110a55760175491505b8080156110bc5750601654600160a81b900460ff16155b80156110d657506016546001600160a01b03868116911614155b80156110eb5750601654600160b01b900460ff165b801561111057506001600160a01b03851660009081526005602052604090205460ff16155b801561113557506001600160a01b03841660009081526005602052604090205460ff16155b1561115557611143826113a2565b4780156111535761115347611299565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061119a57506001600160a01b03831660009081526005602052604090205460ff165b806111cc57506016546001600160a01b038581169116148015906111cc57506016546001600160a01b03848116911614155b156111d957506000611253565b6016546001600160a01b03858116911614801561120457506015546001600160a01b03848116911614155b1561121657600954600d55600a54600e555b6016546001600160a01b03848116911614801561124157506015546001600160a01b03858116911614155b1561125357600b54600d55600c54600e555b610a5e8484848461152b565b600081848411156112835760405162461bcd60e51b81526004016106119190611ae1565b5060006112908486611d87565b95945050505050565b6013546001600160a01b03166108fc6112b3836002611559565b6040518115909202916000818181858888f193505050501580156112db573d6000803e3d6000fd5b506014546001600160a01b03166108fc6112f6836002611559565b6040518115909202916000818181858888f19350505050158015610682573d6000803e3d6000fd5b60006006548211156113855760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610611565b600061138f61159b565b905061139b8382611559565b9392505050565b6016805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106113ea576113ea611d28565b6001600160a01b03928316602091820292909201810191909152601554604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561143e57600080fd5b505afa158015611452573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114769190611d9e565b8160018151811061148957611489611d28565b6001600160a01b0392831660209182029290920101526015546114af9130911684610b7d565b60155460405163791ac94760e01b81526001600160a01b039091169063791ac947906114e8908590600090869030904290600401611dbb565b600060405180830381600087803b15801561150257600080fd5b505af1158015611516573d6000803e3d6000fd5b50506016805460ff60a81b1916905550505050565b80611538576115386115be565b6115438484846115ec565b80610a5e57610a5e600f54600d55601054600e55565b600061139b83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506116e3565b60008060006115a8611711565b90925090506115b78282611559565b9250505090565b600d541580156115ce5750600e54155b156115d557565b600d8054600f55600e805460105560009182905555565b6000806000806000806115fe87611751565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061163090876117ae565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461165f90866117f0565b6001600160a01b0389166000908152600260205260409020556116818161184f565b61168b8483611899565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516116d091815260200190565b60405180910390a3505050505050505050565b600081836117045760405162461bcd60e51b81526004016106119190611ae1565b5060006112908486611e2c565b6006546000908190670de0b6b3a764000061172c8282611559565b82101561174857505060065492670de0b6b3a764000092509050565b90939092509050565b600080600080600080600080600061176e8a600d54600e546118bd565b925092509250600061177e61159b565b905060008060006117918e878787611912565b919e509c509a509598509396509194505050505091939550919395565b600061139b83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061125f565b6000806117fd8385611d6f565b90508381101561139b5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610611565b600061185961159b565b905060006118678383611962565b3060009081526002602052604090205490915061188490826117f0565b30600090815260026020526040902055505050565b6006546118a690836117ae565b6006556007546118b690826117f0565b6007555050565b60008080806118d760646118d18989611962565b90611559565b905060006118ea60646118d18a89611962565b90506000611902826118fc8b866117ae565b906117ae565b9992985090965090945050505050565b60008080806119218886611962565b9050600061192f8887611962565b9050600061193d8888611962565b9050600061194f826118fc86866117ae565b939b939a50919850919650505050505050565b60008261197157506000610697565b600061197d8385611e4e565b90508261198a8583611e2c565b1461139b5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610611565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107e157600080fd5b8035611a17816119f7565b919050565b60006020808385031215611a2f57600080fd5b823567ffffffffffffffff80821115611a4757600080fd5b818501915085601f830112611a5b57600080fd5b813581811115611a6d57611a6d6119e1565b8060051b604051601f19603f83011681018181108582111715611a9257611a926119e1565b604052918252848201925083810185019188831115611ab057600080fd5b938501935b82851015611ad557611ac685611a0c565b84529385019392850192611ab5565b98975050505050505050565b600060208083528351808285015260005b81811015611b0e57858101830151858201604001528201611af2565b81811115611b20576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611b4957600080fd5b8235611b54816119f7565b946020939093013593505050565b600080600060608486031215611b7757600080fd5b8335611b82816119f7565b92506020840135611b92816119f7565b929592945050506040919091013590565b600060208284031215611bb557600080fd5b813561139b816119f7565b80358015158114611a1757600080fd5b600060208284031215611be257600080fd5b61139b82611bc0565b600060208284031215611bfd57600080fd5b5035919050565b60008060008060808587031215611c1a57600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611c4b57600080fd5b833567ffffffffffffffff80821115611c6357600080fd5b818601915086601f830112611c7757600080fd5b813581811115611c8657600080fd5b8760208260051b8501011115611c9b57600080fd5b602092830195509350611cb19186019050611bc0565b90509250925092565b60008060408385031215611ccd57600080fd5b8235611cd8816119f7565b91506020830135611ce8816119f7565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611d6857611d68611d3e565b5060010190565b60008219821115611d8257611d82611d3e565b500190565b600082821015611d9957611d99611d3e565b500390565b600060208284031215611db057600080fd5b815161139b816119f7565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611e0b5784516001600160a01b031683529383019391830191600101611de6565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611e4957634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611e6857611e68611d3e565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122023ffe33a65c0d701ad55d5dc49875b2d198edbfb01611ec8ce70bb0bff1c9b8264736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 2,250 |
0xe7983c530498f25d7372005c47a6decdeaf9b04e
|
//SPDX-License-Identifier: UNLICENSED
//https://t.me/TravelInu
//Max buy 1.5% - 9,000,000
//Low tax play
//CULT BANK Dev team https://etherscan.io/token/0xf726d071bfc09236b2d24e3e3de435874d4cc58c
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);
}
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 TravelInu is Context, IERC20, Ownable {
mapping (address => uint) private _owned;
mapping (address => mapping (address => uint)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private _isBot;
uint private constant _totalSupply = 600000000 * 10**9;
string public constant name = unicode"Travel Inu";
string public constant symbol = unicode"TRAVELINU";
uint8 public constant decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address payable public _FeeCollectionADD;
address public uniswapV2Pair;
uint public _buyFee = 7;
uint public _sellFee = 8;
uint private _feeRate = 9;
uint public _maxBuyTokens;
uint public _maxHeldTokens;
uint public _launchedAt;
bool private _tradingOpen;
bool private _inSwap = false;
bool public _useImpactFeeSetter = false;
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 TaxAddUpdated(address _taxwallet);
modifier lockTheSwap {
_inSwap = true;
_;
_inSwap = false;
}
constructor (address payable TaxAdd) {
_FeeCollectionADD = TaxAdd;
_owned[address(this)] = _totalSupply;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[TaxAdd] = 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) {
_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(!_isBot[from]);
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");
bool isBuy = false;
if(from != owner() && to != owner()) {
if(from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to]) {
require(_tradingOpen, "Trading not yet enabled.");
if((_launchedAt + (3 minutes)) > block.timestamp) {
require(amount <= _maxBuyTokens);
require((amount + balanceOf(address(to))) <= _maxHeldTokens);
}
isBuy = true;
}
if(!_inSwap && _tradingOpen && from != uniswapV2Pair) {
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 {
_FeeCollectionADD.transfer(amount);
}
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;
}
}
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 {}
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() {
require(!_tradingOpen, "Trading is already open");
_approve(address(this), address(uniswapV2Router), _totalSupply);
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
_tradingOpen = true;
_launchedAt = block.timestamp;
_maxBuyTokens = 9000000 * 10**9;
_maxHeldTokens = 18000000 * 10**9;
}
function manualswap() external {
uint contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
uint contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setFeeRate(uint rate) external onlyOwner() {
require(_msgSender() == _FeeCollectionADD);
require(rate > 0);
_feeRate = rate;
emit FeeRateUpdated(_feeRate);
}
function setFees(uint buy, uint sell) external onlyOwner() {
_buyFee = buy;
_sellFee = sell;
emit FeesUpdated(_buyFee, _sellFee);
}
function toggleImpactFee(bool onoff) external onlyOwner() {
_useImpactFeeSetter = onoff;
emit ImpactFeeSetterUpdated(_useImpactFeeSetter);
}
function updateTaxAdd(address newAddress) external {
require(_msgSender() == _FeeCollectionADD);
_FeeCollectionADD = payable(newAddress);
emit TaxAddUpdated(_FeeCollectionADD);
}
function thisBalance() public view returns (uint) {
return balanceOf(address(this));
}
function amountInPool() public view returns (uint) {
return balanceOf(uniswapV2Pair);
}
function addBots(address[] memory bots_) external 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_) external 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 IncreasemaxTxAmount(uint256 maxTxAmount) public onlyOwner {
_maxBuyTokens = maxTxAmount;
}
function IncreaseWallet(uint256 maxWallet) public onlyOwner {
_maxHeldTokens = maxWallet;
}
}
|
0x6080604052600436106101fd5760003560e01c80636fc3eaec1161010d5780639e78fb4f116100a0578063c9567bf91161006f578063c9567bf9146105ce578063d34628cc146105e3578063db92dbb614610603578063dcb0e0ad14610618578063dd62ed3e1461063857600080fd5b80639e78fb4f14610564578063a9059cbb14610579578063b2289c6214610599578063c3c8cd80146105b957600080fd5b80637d34a0d3116100dc5780637d34a0d3146104d15780638da5cb5b146104f157806394b8d8f21461050f57806395d89b411461052f57600080fd5b80636fc3eaec1461046757806370a082311461047c578063715018a61461049c57806373f54a11146104b157600080fd5b806331c2d8471161019057806345596e2e1161015f57806345596e2e146103c357806349bd5a5e146103e3578063590f897e1461041b5780635dfba5f1146104315780636755a4d01461045157600080fd5b806331c2d8471461033e57806332d873d81461035e5780633bbac5791461037457806340b9a54b146103ad57600080fd5b80631940d020116101cc5780631940d020146102cc57806323b872dd146102e257806327f3a72a14610302578063313ce5671461031757600080fd5b806306fdde0314610209578063095ea7b3146102555780630b78f9c01461028557806318160ddd146102a757600080fd5b3661020457005b600080fd5b34801561021557600080fd5b5061023f6040518060400160405280600a81526020016954726176656c20496e7560b01b81525081565b60405161024c91906117e3565b60405180910390f35b34801561026157600080fd5b5061027561027036600461185d565b61067e565b604051901515815260200161024c565b34801561029157600080fd5b506102a56102a0366004611889565b610694565b005b3480156102b357600080fd5b50670853a0d2313c00005b60405190815260200161024c565b3480156102d857600080fd5b506102be600d5481565b3480156102ee57600080fd5b506102756102fd3660046118ab565b61070e565b34801561030e57600080fd5b506102be610762565b34801561032357600080fd5b5061032c600981565b60405160ff909116815260200161024c565b34801561034a57600080fd5b506102a5610359366004611902565b610772565b34801561036a57600080fd5b506102be600e5481565b34801561038057600080fd5b5061027561038f3660046119c7565b6001600160a01b031660009081526005602052604090205460ff1690565b3480156103b957600080fd5b506102be60095481565b3480156103cf57600080fd5b506102a56103de3660046119e4565b610808565b3480156103ef57600080fd5b50600854610403906001600160a01b031681565b6040516001600160a01b03909116815260200161024c565b34801561042757600080fd5b506102be600a5481565b34801561043d57600080fd5b506102a561044c3660046119e4565b61089b565b34801561045d57600080fd5b506102be600c5481565b34801561047357600080fd5b506102a56108ca565b34801561048857600080fd5b506102be6104973660046119c7565b6108d7565b3480156104a857600080fd5b506102a56108f2565b3480156104bd57600080fd5b506102a56104cc3660046119c7565b610966565b3480156104dd57600080fd5b506102a56104ec3660046119e4565b6109d4565b3480156104fd57600080fd5b506000546001600160a01b0316610403565b34801561051b57600080fd5b50600f546102759062010000900460ff1681565b34801561053b57600080fd5b5061023f6040518060400160405280600981526020016854524156454c494e5560b81b81525081565b34801561057057600080fd5b506102a5610a03565b34801561058557600080fd5b5061027561059436600461185d565b610c08565b3480156105a557600080fd5b50600754610403906001600160a01b031681565b3480156105c557600080fd5b506102a5610c15565b3480156105da57600080fd5b506102a5610c2b565b3480156105ef57600080fd5b506102a56105fe366004611902565b610e27565b34801561060f57600080fd5b506102be610f40565b34801561062457600080fd5b506102a5610633366004611a0b565b610f58565b34801561064457600080fd5b506102be610653366004611a28565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b600061068b338484610fd5565b50600192915050565b6000546001600160a01b031633146106c75760405162461bcd60e51b81526004016106be90611a61565b60405180910390fd5b6009829055600a81905560408051838152602081018390527f5c6323bf1c2d7aaea2c091a4751c1c87af7f2864650c336507a77d0557af37a1910160405180910390a15050565b600061071b8484846110f9565b6001600160a01b038416600090815260036020908152604080832033845290915281205461074a908490611aac565b9050610757853383610fd5565b506001949350505050565b600061076d306108d7565b905090565b6000546001600160a01b0316331461079c5760405162461bcd60e51b81526004016106be90611a61565b60005b8151811015610804576000600560008484815181106107c0576107c0611ac3565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806107fc81611ad9565b91505061079f565b5050565b6000546001600160a01b031633146108325760405162461bcd60e51b81526004016106be90611a61565b6007546001600160a01b0316336001600160a01b03161461085257600080fd5b6000811161085f57600080fd5b600b8190556040518181527f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd8906020015b60405180910390a150565b6000546001600160a01b031633146108c55760405162461bcd60e51b81526004016106be90611a61565b600d55565b476108d4816114b0565b50565b6001600160a01b031660009081526002602052604090205490565b6000546001600160a01b0316331461091c5760405162461bcd60e51b81526004016106be90611a61565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6007546001600160a01b0316336001600160a01b03161461098657600080fd5b600780546001600160a01b0319166001600160a01b0383169081179091556040519081527f5a9bcd8aea0cbf27de081c73815e420f65287b49bcf7a17ff691c61a2dd2d2d690602001610890565b6000546001600160a01b031633146109fe5760405162461bcd60e51b81526004016106be90611a61565b600c55565b6000546001600160a01b03163314610a2d5760405162461bcd60e51b81526004016106be90611a61565b600f5460ff1615610a7a5760405162461bcd60e51b81526020600482015260176024820152762a3930b234b7339034b99030b63932b0b23c9037b832b760491b60448201526064016106be565b600680546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a01559160048083019260209291908290030181865afa158015610adf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b039190611af2565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610b50573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b749190611af2565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610bc1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610be59190611af2565b600880546001600160a01b0319166001600160a01b039290921691909117905550565b600061068b3384846110f9565b6000610c20306108d7565b90506108d4816114ea565b6000546001600160a01b03163314610c555760405162461bcd60e51b81526004016106be90611a61565b600f5460ff1615610ca25760405162461bcd60e51b81526020600482015260176024820152762a3930b234b7339034b99030b63932b0b23c9037b832b760491b60448201526064016106be565b600654610cc29030906001600160a01b0316670853a0d2313c0000610fd5565b6006546001600160a01b031663f305d7194730610cde816108d7565b600080610cf36000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af1158015610d5b573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610d809190611b0f565b505060085460065460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af1158015610dd9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dfd9190611b3d565b50600f805460ff1916600117905542600e55661ff973cafa8000600c55663ff2e795f50000600d55565b6000546001600160a01b03163314610e515760405162461bcd60e51b81526004016106be90611a61565b60005b81518110156108045760085482516001600160a01b0390911690839083908110610e8057610e80611ac3565b60200260200101516001600160a01b031614158015610ed1575060065482516001600160a01b0390911690839083908110610ebd57610ebd611ac3565b60200260200101516001600160a01b031614155b15610f2e57600160056000848481518110610eee57610eee611ac3565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b80610f3881611ad9565b915050610e54565b60085460009061076d906001600160a01b03166108d7565b6000546001600160a01b03163314610f825760405162461bcd60e51b81526004016106be90611a61565b600f805462ff00001916620100008315158102919091179182905560405160ff9190920416151581527ff65c78d1059dbb9ec90732848bcfebbec05ac40af847d3c19adcad63379d3aeb90602001610890565b6001600160a01b0383166110375760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016106be565b6001600160a01b0382166110985760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016106be565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b03831660009081526005602052604090205460ff161561111f57600080fd5b6001600160a01b0383166111835760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016106be565b6001600160a01b0382166111e55760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016106be565b600081116112475760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016106be565b600080546001600160a01b0385811691161480159061127457506000546001600160a01b03848116911614155b15611451576008546001600160a01b0385811691161480156112a457506006546001600160a01b03848116911614155b80156112c957506001600160a01b03831660009081526004602052604090205460ff16155b1561136a57600f5460ff166113205760405162461bcd60e51b815260206004820152601860248201527f54726164696e67206e6f742079657420656e61626c65642e000000000000000060448201526064016106be565b42600e5460b46113309190611b5a565b111561136657600c5482111561134557600080fd5b600d54611351846108d7565b61135b9084611b5a565b111561136657600080fd5b5060015b600f54610100900460ff161580156113845750600f5460ff165b801561139e57506008546001600160a01b03858116911614155b156114515760006113ae306108d7565b9050801561143a57600f5462010000900460ff161561143157600b54600854606491906113e3906001600160a01b03166108d7565b6113ed9190611b72565b6113f79190611b91565b81111561143157600b546008546064919061141a906001600160a01b03166108d7565b6114249190611b72565b61142e9190611b91565b90505b61143a816114ea565b47801561144a5761144a476114b0565b6000925050505b6001600160a01b03841660009081526004602052604090205460019060ff168061149357506001600160a01b03841660009081526004602052604090205460ff165b1561149c575060005b6114a9858585848661165e565b5050505050565b6007546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610804573d6000803e3d6000fd5b600f805461ff001916610100179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061152e5761152e611ac3565b6001600160a01b03928316602091820292909201810191909152600654604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015611587573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115ab9190611af2565b816001815181106115be576115be611ac3565b6001600160a01b0392831660209182029290920101526006546115e49130911684610fd5565b60065460405163791ac94760e01b81526001600160a01b039091169063791ac9479061161d908590600090869030904290600401611bb3565b600060405180830381600087803b15801561163757600080fd5b505af115801561164b573d6000803e3d6000fd5b5050600f805461ff001916905550505050565b600061166a8383611680565b9050611678868686846116a4565b505050505050565b600080831561169d578215611698575060095461169d565b50600a545b9392505050565b6000806116b18484611781565b6001600160a01b03881660009081526002602052604090205491935091506116da908590611aac565b6001600160a01b03808816600090815260026020526040808220939093559087168152205461170a908390611b5a565b6001600160a01b03861660009081526002602052604090205561172c816117b5565b846001600160a01b0316866001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161177191815260200190565b60405180910390a3505050505050565b6000808060646117918587611b72565b61179b9190611b91565b905060006117a98287611aac565b96919550909350505050565b306000908152600260205260409020546117d0908290611b5a565b3060009081526002602052604090205550565b600060208083528351808285015260005b81811015611810578581018301518582016040015282016117f4565b81811115611822576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b03811681146108d457600080fd5b803561185881611838565b919050565b6000806040838503121561187057600080fd5b823561187b81611838565b946020939093013593505050565b6000806040838503121561189c57600080fd5b50508035926020909101359150565b6000806000606084860312156118c057600080fd5b83356118cb81611838565b925060208401356118db81611838565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b6000602080838503121561191557600080fd5b823567ffffffffffffffff8082111561192d57600080fd5b818501915085601f83011261194157600080fd5b813581811115611953576119536118ec565b8060051b604051601f19603f83011681018181108582111715611978576119786118ec565b60405291825284820192508381018501918883111561199657600080fd5b938501935b828510156119bb576119ac8561184d565b8452938501939285019261199b565b98975050505050505050565b6000602082840312156119d957600080fd5b813561169d81611838565b6000602082840312156119f657600080fd5b5035919050565b80151581146108d457600080fd5b600060208284031215611a1d57600080fd5b813561169d816119fd565b60008060408385031215611a3b57600080fd5b8235611a4681611838565b91506020830135611a5681611838565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052601160045260246000fd5b600082821015611abe57611abe611a96565b500390565b634e487b7160e01b600052603260045260246000fd5b600060018201611aeb57611aeb611a96565b5060010190565b600060208284031215611b0457600080fd5b815161169d81611838565b600080600060608486031215611b2457600080fd5b8351925060208401519150604084015190509250925092565b600060208284031215611b4f57600080fd5b815161169d816119fd565b60008219821115611b6d57611b6d611a96565b500190565b6000816000190483118215151615611b8c57611b8c611a96565b500290565b600082611bae57634e487b7160e01b600052601260045260246000fd5b500490565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611c035784516001600160a01b031683529383019391830191600101611bde565b50506001600160a01b0396909616606085015250505060800152939250505056fea2646970667358221220cbf459024d57270fcc5b336c6d11517b35dad8fa24ba284cc173237a4d2700ff64736f6c634300080d0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 2,251 |
0xfc325dd5db9cc9b24242d32f6671923af6f33ebc
|
// SPDX-License-Identifier: Unlicensed
/**
The strongest foundation of all has always been community.
BabySanin Inu – Also the Shiba Inu Killer, that is a decentralized experiment that intends to employ a community with the collective goal of solid organic growth.
DeFi has become a repetitive cycle of pumps and dumps, and it’s hard to find a trustworthy project with a dedicated team.
BabySanin emphasizes financial security and will have 0.5% buy and sale taxes, no presale, no allocated team tokens, and no marketing tokens.
The fate of the project will be decided upon by the community. Welcome to BabySanin Inu!
1,000,000,000,000 fixed total supply
10,000,000,000 max buy
40% burn
0.5% TAX
100% LP tokens burned
Contract renounced
No presale, no team tokens.
**/
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 BABYSANI is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Baby Sanin Inu";
string private constant _symbol = "BabySANI";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 0;
uint256 private _taxFeeOnBuy = 1;
uint256 private _redisFeeOnSell = 0;
uint256 private _taxFeeOnSell = 1;
//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(0xB55C9144DF2399D35E1C77f3CA4E4145B17196E4);
address payable private _marketingAddress = payable(0xB55C9144DF2399D35E1C77f3CA4E4145B17196E4);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 10000000000 * 10**9;
uint256 public _maxWalletSize = 20000000000 * 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(200);
uint256 tTeam = tAmount.mul(taxFee).div(200);
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;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f0461461055e578063dd62ed3e1461057e578063ea1644d5146105c4578063f2fde38b146105e457600080fd5b8063a2a957bb146104d9578063a9059cbb146104f9578063bfd7928414610519578063c3c8cd801461054957600080fd5b80638f70ccf7116100d15780638f70ccf7146104525780638f9a55c01461047257806395d89b411461048857806398a5c315146104b957600080fd5b80637d1db4a5146103f15780637f2feddc146104075780638da5cb5b1461043457600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461038757806370a082311461039c578063715018a6146103bc57806374010ece146103d157600080fd5b8063313ce5671461030b57806349bd5a5e146103275780636b999053146103475780636d8aa8f81461036757600080fd5b80631694505e116101ab5780631694505e1461027757806318160ddd146102af57806323b872dd146102d55780632fd689e3146102f557600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024757600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f736600461196a565b610604565b005b34801561020a57600080fd5b5060408051808201909152600e81526d426162792053616e696e20496e7560901b60208201525b60405161023e9190611a2f565b60405180910390f35b34801561025357600080fd5b50610267610262366004611a84565b6106a3565b604051901515815260200161023e565b34801561028357600080fd5b50601454610297906001600160a01b031681565b6040516001600160a01b03909116815260200161023e565b3480156102bb57600080fd5b50683635c9adc5dea000005b60405190815260200161023e565b3480156102e157600080fd5b506102676102f0366004611ab0565b6106ba565b34801561030157600080fd5b506102c760185481565b34801561031757600080fd5b506040516009815260200161023e565b34801561033357600080fd5b50601554610297906001600160a01b031681565b34801561035357600080fd5b506101fc610362366004611af1565b610723565b34801561037357600080fd5b506101fc610382366004611b1e565b61076e565b34801561039357600080fd5b506101fc6107b6565b3480156103a857600080fd5b506102c76103b7366004611af1565b610801565b3480156103c857600080fd5b506101fc610823565b3480156103dd57600080fd5b506101fc6103ec366004611b39565b610897565b3480156103fd57600080fd5b506102c760165481565b34801561041357600080fd5b506102c7610422366004611af1565b60116020526000908152604090205481565b34801561044057600080fd5b506000546001600160a01b0316610297565b34801561045e57600080fd5b506101fc61046d366004611b1e565b6108c6565b34801561047e57600080fd5b506102c760175481565b34801561049457600080fd5b506040805180820190915260088152674261627953414e4960c01b6020820152610231565b3480156104c557600080fd5b506101fc6104d4366004611b39565b61090e565b3480156104e557600080fd5b506101fc6104f4366004611b52565b61093d565b34801561050557600080fd5b50610267610514366004611a84565b61097b565b34801561052557600080fd5b50610267610534366004611af1565b60106020526000908152604090205460ff1681565b34801561055557600080fd5b506101fc610988565b34801561056a57600080fd5b506101fc610579366004611b84565b6109dc565b34801561058a57600080fd5b506102c7610599366004611c08565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105d057600080fd5b506101fc6105df366004611b39565b610a7d565b3480156105f057600080fd5b506101fc6105ff366004611af1565b610aac565b6000546001600160a01b031633146106375760405162461bcd60e51b815260040161062e90611c41565b60405180910390fd5b60005b815181101561069f5760016010600084848151811061065b5761065b611c76565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061069781611ca2565b91505061063a565b5050565b60006106b0338484610b96565b5060015b92915050565b60006106c7848484610cba565b610719843361071485604051806060016040528060288152602001611dbc602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111f6565b610b96565b5060019392505050565b6000546001600160a01b0316331461074d5760405162461bcd60e51b815260040161062e90611c41565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107985760405162461bcd60e51b815260040161062e90611c41565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107eb57506013546001600160a01b0316336001600160a01b0316145b6107f457600080fd5b476107fe81611230565b50565b6001600160a01b0381166000908152600260205260408120546106b49061126a565b6000546001600160a01b0316331461084d5760405162461bcd60e51b815260040161062e90611c41565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108c15760405162461bcd60e51b815260040161062e90611c41565b601655565b6000546001600160a01b031633146108f05760405162461bcd60e51b815260040161062e90611c41565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146109385760405162461bcd60e51b815260040161062e90611c41565b601855565b6000546001600160a01b031633146109675760405162461bcd60e51b815260040161062e90611c41565b600893909355600a91909155600955600b55565b60006106b0338484610cba565b6012546001600160a01b0316336001600160a01b031614806109bd57506013546001600160a01b0316336001600160a01b0316145b6109c657600080fd5b60006109d130610801565b90506107fe816112ee565b6000546001600160a01b03163314610a065760405162461bcd60e51b815260040161062e90611c41565b60005b82811015610a77578160056000868685818110610a2857610a28611c76565b9050602002016020810190610a3d9190611af1565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a6f81611ca2565b915050610a09565b50505050565b6000546001600160a01b03163314610aa75760405162461bcd60e51b815260040161062e90611c41565b601755565b6000546001600160a01b03163314610ad65760405162461bcd60e51b815260040161062e90611c41565b6001600160a01b038116610b3b5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161062e565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bf85760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161062e565b6001600160a01b038216610c595760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161062e565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d1e5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161062e565b6001600160a01b038216610d805760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161062e565b60008111610de25760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161062e565b6000546001600160a01b03848116911614801590610e0e57506000546001600160a01b03838116911614155b156110ef57601554600160a01b900460ff16610ea7576000546001600160a01b03848116911614610ea75760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400606482015260840161062e565b601654811115610ef95760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000604482015260640161062e565b6001600160a01b03831660009081526010602052604090205460ff16158015610f3b57506001600160a01b03821660009081526010602052604090205460ff16155b610f935760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b606482015260840161062e565b6015546001600160a01b038381169116146110185760175481610fb584610801565b610fbf9190611cbd565b106110185760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b606482015260840161062e565b600061102330610801565b60185460165491925082101590821061103c5760165491505b8080156110535750601554600160a81b900460ff16155b801561106d57506015546001600160a01b03868116911614155b80156110825750601554600160b01b900460ff165b80156110a757506001600160a01b03851660009081526005602052604090205460ff16155b80156110cc57506001600160a01b03841660009081526005602052604090205460ff16155b156110ec576110da826112ee565b4780156110ea576110ea47611230565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061113157506001600160a01b03831660009081526005602052604090205460ff165b8061116357506015546001600160a01b0385811691161480159061116357506015546001600160a01b03848116911614155b15611170575060006111ea565b6015546001600160a01b03858116911614801561119b57506014546001600160a01b03848116911614155b156111ad57600854600c55600954600d555b6015546001600160a01b0384811691161480156111d857506014546001600160a01b03858116911614155b156111ea57600a54600c55600b54600d555b610a7784848484611477565b6000818484111561121a5760405162461bcd60e51b815260040161062e9190611a2f565b5060006112278486611cd5565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f1935050505015801561069f573d6000803e3d6000fd5b60006006548211156112d15760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161062e565b60006112db6114a5565b90506112e783826114c8565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061133657611336611c76565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561138a57600080fd5b505afa15801561139e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113c29190611cec565b816001815181106113d5576113d5611c76565b6001600160a01b0392831660209182029290920101526014546113fb9130911684610b96565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac94790611434908590600090869030904290600401611d09565b600060405180830381600087803b15801561144e57600080fd5b505af1158015611462573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b806114845761148461150a565b61148f848484611538565b80610a7757610a77600e54600c55600f54600d55565b60008060006114b261162f565b90925090506114c182826114c8565b9250505090565b60006112e783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611671565b600c5415801561151a5750600d54155b1561152157565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061154a8761169f565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061157c90876116fc565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115ab908661173e565b6001600160a01b0389166000908152600260205260409020556115cd8161179d565b6115d784836117e7565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161161c91815260200190565b60405180910390a3505050505050505050565b6006546000908190683635c9adc5dea0000061164b82826114c8565b82101561166857505060065492683635c9adc5dea0000092509050565b90939092509050565b600081836116925760405162461bcd60e51b815260040161062e9190611a2f565b5060006112278486611d7a565b60008060008060008060008060006116bc8a600c54600d5461180b565b92509250925060006116cc6114a5565b905060008060006116df8e878787611860565b919e509c509a509598509396509194505050505091939550919395565b60006112e783836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111f6565b60008061174b8385611cbd565b9050838110156112e75760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161062e565b60006117a76114a5565b905060006117b583836118b0565b306000908152600260205260409020549091506117d2908261173e565b30600090815260026020526040902055505050565b6006546117f490836116fc565b600655600754611804908261173e565b6007555050565b600080808061182560c861181f89896118b0565b906114c8565b9050600061183860c861181f8a896118b0565b905060006118508261184a8b866116fc565b906116fc565b9992985090965090945050505050565b600080808061186f88866118b0565b9050600061187d88876118b0565b9050600061188b88886118b0565b9050600061189d8261184a86866116fc565b939b939a50919850919650505050505050565b6000826118bf575060006106b4565b60006118cb8385611d9c565b9050826118d88583611d7a565b146112e75760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161062e565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107fe57600080fd5b803561196581611945565b919050565b6000602080838503121561197d57600080fd5b823567ffffffffffffffff8082111561199557600080fd5b818501915085601f8301126119a957600080fd5b8135818111156119bb576119bb61192f565b8060051b604051601f19603f830116810181811085821117156119e0576119e061192f565b6040529182528482019250838101850191888311156119fe57600080fd5b938501935b82851015611a2357611a148561195a565b84529385019392850192611a03565b98975050505050505050565b600060208083528351808285015260005b81811015611a5c57858101830151858201604001528201611a40565b81811115611a6e576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611a9757600080fd5b8235611aa281611945565b946020939093013593505050565b600080600060608486031215611ac557600080fd5b8335611ad081611945565b92506020840135611ae081611945565b929592945050506040919091013590565b600060208284031215611b0357600080fd5b81356112e781611945565b8035801515811461196557600080fd5b600060208284031215611b3057600080fd5b6112e782611b0e565b600060208284031215611b4b57600080fd5b5035919050565b60008060008060808587031215611b6857600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611b9957600080fd5b833567ffffffffffffffff80821115611bb157600080fd5b818601915086601f830112611bc557600080fd5b813581811115611bd457600080fd5b8760208260051b8501011115611be957600080fd5b602092830195509350611bff9186019050611b0e565b90509250925092565b60008060408385031215611c1b57600080fd5b8235611c2681611945565b91506020830135611c3681611945565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611cb657611cb6611c8c565b5060010190565b60008219821115611cd057611cd0611c8c565b500190565b600082821015611ce757611ce7611c8c565b500390565b600060208284031215611cfe57600080fd5b81516112e781611945565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d595784516001600160a01b031683529383019391830191600101611d34565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611d9757634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611db657611db6611c8c565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220faaeedefb559fc029f85cf7256e7ca06d44546397fa861eb7ab966f7d1b3eb5c64736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 2,252 |
0x7532c54a8b1765ac335773bcb9a95e953db04b4a
|
/**
*Submitted for verification at Etherscan.io on 2022-05-01
*/
/**
CAVEHERMITINU
🌐 Website: https://caveinu.com/
💬 Telegram: https://t.me/caveinu
*/
pragma solidity ^0.8.13;
// 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 CaveInu 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 = 1000000000000000 * 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 = "CaveInu";
string private constant _symbol = "CaveInu";
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(0x61E6ee1E1B04d9681d1BE743870380C3Cd19087C);
_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 = 8;
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 = 8;
}
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(15).div(1000);
_maxWalletSize = _tTotal.mul(30).div(1000);
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);
}
}
|
0x6080604052600436106101235760003560e01c806370a08231116100a0578063a9059cbb11610064578063a9059cbb146103a6578063b87f137a146103e3578063c3c8cd801461040c578063c9567bf914610423578063dd62ed3e1461043a5761012a565b806370a08231146102e5578063715018a614610322578063751039fc146103395780638da5cb5b1461035057806395d89b411461037b5761012a565b8063273123b7116100e7578063273123b714610228578063313ce567146102515780635932ead11461027c578063677daa57146102a55780636fc3eaec146102ce5761012a565b806306fdde031461012f578063095ea7b31461015a57806318160ddd146101975780631b3f71ae146101c257806323b872dd146101eb5761012a565b3661012a57005b600080fd5b34801561013b57600080fd5b50610144610477565b6040516101519190612779565b60405180910390f35b34801561016657600080fd5b50610181600480360381019061017c9190612843565b6104b4565b60405161018e919061289e565b60405180910390f35b3480156101a357600080fd5b506101ac6104d2565b6040516101b991906128c8565b60405180910390f35b3480156101ce57600080fd5b506101e960048036038101906101e49190612a2b565b6104e4565b005b3480156101f757600080fd5b50610212600480360381019061020d9190612a74565b61060e565b60405161021f919061289e565b60405180910390f35b34801561023457600080fd5b5061024f600480360381019061024a9190612ac7565b6106e7565b005b34801561025d57600080fd5b506102666107d7565b6040516102739190612b10565b60405180910390f35b34801561028857600080fd5b506102a3600480360381019061029e9190612b57565b6107e0565b005b3480156102b157600080fd5b506102cc60048036038101906102c79190612b84565b610892565b005b3480156102da57600080fd5b506102e361096d565b005b3480156102f157600080fd5b5061030c60048036038101906103079190612ac7565b6109df565b60405161031991906128c8565b60405180910390f35b34801561032e57600080fd5b50610337610a30565b005b34801561034557600080fd5b5061034e610b83565b005b34801561035c57600080fd5b50610365610c3c565b6040516103729190612bc0565b60405180910390f35b34801561038757600080fd5b50610390610c65565b60405161039d9190612779565b60405180910390f35b3480156103b257600080fd5b506103cd60048036038101906103c89190612843565b610ca2565b6040516103da919061289e565b60405180910390f35b3480156103ef57600080fd5b5061040a60048036038101906104059190612b84565b610cc0565b005b34801561041857600080fd5b50610421610d9b565b005b34801561042f57600080fd5b50610438610e15565b005b34801561044657600080fd5b50610461600480360381019061045c9190612bdb565b611388565b60405161046e91906128c8565b60405180910390f35b60606040518060400160405280600781526020017f43617665496e7500000000000000000000000000000000000000000000000000815250905090565b60006104c86104c161140f565b8484611417565b6001905092915050565b600069d3c21bcecceda1000000905090565b6104ec61140f565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610579576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161057090612c67565b60405180910390fd5b60005b815181101561060a5760016006600084848151811061059e5761059d612c87565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061060290612ce5565b91505061057c565b5050565b600061061b8484846115e0565b6106dc8461062761140f565b6106d78560405180606001604052806028815260200161371c60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061068d61140f565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c719092919063ffffffff16565b611417565b600190509392505050565b6106ef61140f565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461077c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161077390612c67565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b6107e861140f565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610875576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086c90612c67565b60405180910390fd5b80600e60176101000a81548160ff02191690831515021790555050565b61089a61140f565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610927576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161091e90612c67565b60405180910390fd5b6000811161093457600080fd5b61096460646109568369d3c21bcecceda1000000611cd590919063ffffffff16565b611d4f90919063ffffffff16565b600f8190555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166109ae61140f565b73ffffffffffffffffffffffffffffffffffffffff16146109ce57600080fd5b60004790506109dc81611d99565b50565b6000610a29600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611e05565b9050919050565b610a3861140f565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ac5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610abc90612c67565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610b8b61140f565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c18576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0f90612c67565b60405180910390fd5b69d3c21bcecceda1000000600f8190555069d3c21bcecceda1000000601081905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600781526020017f43617665496e7500000000000000000000000000000000000000000000000000815250905090565b6000610cb6610caf61140f565b84846115e0565b6001905092915050565b610cc861140f565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d55576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d4c90612c67565b60405180910390fd5b60008111610d6257600080fd5b610d926064610d848369d3c21bcecceda1000000611cd590919063ffffffff16565b611d4f90919063ffffffff16565b60108190555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610ddc61140f565b73ffffffffffffffffffffffffffffffffffffffff1614610dfc57600080fd5b6000610e07306109df565b9050610e1281611e73565b50565b610e1d61140f565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610eaa576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ea190612c67565b60405180910390fd5b600e60149054906101000a900460ff1615610efa576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ef190612d79565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600d60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610f8b30600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1669d3c21bcecceda1000000611417565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610fd6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ffa9190612dae565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015611061573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110859190612dae565b6040518363ffffffff1660e01b81526004016110a2929190612ddb565b6020604051808303816000875af11580156110c1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110e59190612dae565b600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d719473061116e306109df565b600080611179610c3c565b426040518863ffffffff1660e01b815260040161119b96959493929190612e49565b60606040518083038185885af11580156111b9573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906111de9190612ebf565b5050506001600e60166101000a81548160ff0219169083151502179055506001600e60176101000a81548160ff0219169083151502179055506112496103e861123b600f69d3c21bcecceda1000000611cd590919063ffffffff16565b611d4f90919063ffffffff16565b600f819055506112816103e8611273601e69d3c21bcecceda1000000611cd590919063ffffffff16565b611d4f90919063ffffffff16565b6010819055506001600e60146101000a81548160ff021916908315150217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401611341929190612f12565b6020604051808303816000875af1158015611360573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113849190612f50565b5050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603611486576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161147d90612fef565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036114f5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114ec90613081565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516115d391906128c8565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff160361164f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161164690613113565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036116be576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116b5906131a5565b60405180910390fd5b60008111611701576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116f890613237565b60405180910390fd5b6000600a819055506008600b81905550611719610c3c565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156117875750611757610c3c565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611c6157600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118305750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b61183957600080fd5b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156118e45750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b801561193a5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156119525750600e60179054906101000a900460ff165b15611a9057600f5481111561199c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611993906132a3565b60405180910390fd5b601054816119a9846109df565b6119b391906132c3565b11156119f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119eb90613365565b60405180910390fd5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a3f57600080fd5b601e42611a4c91906132c3565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16148015611b3b5750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015611b915750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611ba7576000600a819055506008600b819055505b6000611bb2306109df565b9050600e60159054906101000a900460ff16158015611c1f5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611c375750600e60169054906101000a900460ff165b15611c5f57611c4581611e73565b60004790506000811115611c5d57611c5c47611d99565b5b505b505b611c6c8383836120ec565b505050565b6000838311158290611cb9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611cb09190612779565b60405180910390fd5b5060008385611cc89190613385565b9050809150509392505050565b6000808303611ce75760009050611d49565b60008284611cf591906133b9565b9050828482611d049190613442565b14611d44576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d3b906134e5565b60405180910390fd5b809150505b92915050565b6000611d9183836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506120fc565b905092915050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611e01573d6000803e3d6000fd5b5050565b6000600854821115611e4c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e4390613577565b60405180910390fd5b6000611e5661215f565b9050611e6b8184611d4f90919063ffffffff16565b915050919050565b6001600e60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611eab57611eaa6128e8565b5b604051908082528060200260200182016040528015611ed95781602001602082028036833780820191505090505b5090503081600081518110611ef157611ef0612c87565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015611f98573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fbc9190612dae565b81600181518110611fd057611fcf612c87565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061203730600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611417565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040161209b959493929190613655565b600060405180830381600087803b1580156120b557600080fd5b505af11580156120c9573d6000803e3d6000fd5b50505050506000600e60156101000a81548160ff02191690831515021790555050565b6120f783838361218a565b505050565b60008083118290612143576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161213a9190612779565b60405180910390fd5b50600083856121529190613442565b9050809150509392505050565b600080600061216c612355565b915091506121838183611d4f90919063ffffffff16565b9250505090565b60008060008060008061219c876123ba565b9550955095509550955095506121fa86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461242290919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061228f85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461246c90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506122db816124ca565b6122e58483612587565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161234291906128c8565b60405180910390a3505050505050505050565b60008060006008549050600069d3c21bcecceda1000000905061238d69d3c21bcecceda1000000600854611d4f90919063ffffffff16565b8210156123ad5760085469d3c21bcecceda10000009350935050506123b6565b81819350935050505b9091565b60008060008060008060008060006123d78a600a54600b546125c1565b92509250925060006123e761215f565b905060008060006123fa8e878787612657565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061246483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c71565b905092915050565b600080828461247b91906132c3565b9050838110156124c0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016124b7906136fb565b60405180910390fd5b8091505092915050565b60006124d461215f565b905060006124eb8284611cd590919063ffffffff16565b905061253f81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461246c90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b61259c8260085461242290919063ffffffff16565b6008819055506125b78160095461246c90919063ffffffff16565b6009819055505050565b6000806000806125ed60646125df888a611cd590919063ffffffff16565b611d4f90919063ffffffff16565b905060006126176064612609888b611cd590919063ffffffff16565b611d4f90919063ffffffff16565b9050600061264082612632858c61242290919063ffffffff16565b61242290919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806126708589611cd590919063ffffffff16565b905060006126878689611cd590919063ffffffff16565b9050600061269e8789611cd590919063ffffffff16565b905060006126c7826126b9858761242290919063ffffffff16565b61242290919063ffffffff16565b9050838184965096509650505050509450945094915050565b600081519050919050565b600082825260208201905092915050565b60005b8381101561271a5780820151818401526020810190506126ff565b83811115612729576000848401525b50505050565b6000601f19601f8301169050919050565b600061274b826126e0565b61275581856126eb565b93506127658185602086016126fc565b61276e8161272f565b840191505092915050565b600060208201905081810360008301526127938184612740565b905092915050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006127da826127af565b9050919050565b6127ea816127cf565b81146127f557600080fd5b50565b600081359050612807816127e1565b92915050565b6000819050919050565b6128208161280d565b811461282b57600080fd5b50565b60008135905061283d81612817565b92915050565b6000806040838503121561285a576128596127a5565b5b6000612868858286016127f8565b92505060206128798582860161282e565b9150509250929050565b60008115159050919050565b61289881612883565b82525050565b60006020820190506128b3600083018461288f565b92915050565b6128c28161280d565b82525050565b60006020820190506128dd60008301846128b9565b92915050565b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6129208261272f565b810181811067ffffffffffffffff8211171561293f5761293e6128e8565b5b80604052505050565b600061295261279b565b905061295e8282612917565b919050565b600067ffffffffffffffff82111561297e5761297d6128e8565b5b602082029050602081019050919050565b600080fd5b60006129a76129a284612963565b612948565b905080838252602082019050602084028301858111156129ca576129c961298f565b5b835b818110156129f357806129df88826127f8565b8452602084019350506020810190506129cc565b5050509392505050565b600082601f830112612a1257612a116128e3565b5b8135612a22848260208601612994565b91505092915050565b600060208284031215612a4157612a406127a5565b5b600082013567ffffffffffffffff811115612a5f57612a5e6127aa565b5b612a6b848285016129fd565b91505092915050565b600080600060608486031215612a8d57612a8c6127a5565b5b6000612a9b868287016127f8565b9350506020612aac868287016127f8565b9250506040612abd8682870161282e565b9150509250925092565b600060208284031215612add57612adc6127a5565b5b6000612aeb848285016127f8565b91505092915050565b600060ff82169050919050565b612b0a81612af4565b82525050565b6000602082019050612b256000830184612b01565b92915050565b612b3481612883565b8114612b3f57600080fd5b50565b600081359050612b5181612b2b565b92915050565b600060208284031215612b6d57612b6c6127a5565b5b6000612b7b84828501612b42565b91505092915050565b600060208284031215612b9a57612b996127a5565b5b6000612ba88482850161282e565b91505092915050565b612bba816127cf565b82525050565b6000602082019050612bd56000830184612bb1565b92915050565b60008060408385031215612bf257612bf16127a5565b5b6000612c00858286016127f8565b9250506020612c11858286016127f8565b9150509250929050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000612c516020836126eb565b9150612c5c82612c1b565b602082019050919050565b60006020820190508181036000830152612c8081612c44565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000612cf08261280d565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203612d2257612d21612cb6565b5b600182019050919050565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b6000612d636017836126eb565b9150612d6e82612d2d565b602082019050919050565b60006020820190508181036000830152612d9281612d56565b9050919050565b600081519050612da8816127e1565b92915050565b600060208284031215612dc457612dc36127a5565b5b6000612dd284828501612d99565b91505092915050565b6000604082019050612df06000830185612bb1565b612dfd6020830184612bb1565b9392505050565b6000819050919050565b6000819050919050565b6000612e33612e2e612e2984612e04565b612e0e565b61280d565b9050919050565b612e4381612e18565b82525050565b600060c082019050612e5e6000830189612bb1565b612e6b60208301886128b9565b612e786040830187612e3a565b612e856060830186612e3a565b612e926080830185612bb1565b612e9f60a08301846128b9565b979650505050505050565b600081519050612eb981612817565b92915050565b600080600060608486031215612ed857612ed76127a5565b5b6000612ee686828701612eaa565b9350506020612ef786828701612eaa565b9250506040612f0886828701612eaa565b9150509250925092565b6000604082019050612f276000830185612bb1565b612f3460208301846128b9565b9392505050565b600081519050612f4a81612b2b565b92915050565b600060208284031215612f6657612f656127a5565b5b6000612f7484828501612f3b565b91505092915050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000612fd96024836126eb565b9150612fe482612f7d565b604082019050919050565b6000602082019050818103600083015261300881612fcc565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b600061306b6022836126eb565b91506130768261300f565b604082019050919050565b6000602082019050818103600083015261309a8161305e565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b60006130fd6025836126eb565b9150613108826130a1565b604082019050919050565b6000602082019050818103600083015261312c816130f0565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b600061318f6023836126eb565b915061319a82613133565b604082019050919050565b600060208201905081810360008301526131be81613182565b9050919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b60006132216029836126eb565b915061322c826131c5565b604082019050919050565b6000602082019050818103600083015261325081613214565b9050919050565b7f4578636565647320746865205f6d61785478416d6f756e742e00000000000000600082015250565b600061328d6019836126eb565b915061329882613257565b602082019050919050565b600060208201905081810360008301526132bc81613280565b9050919050565b60006132ce8261280d565b91506132d98361280d565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561330e5761330d612cb6565b5b828201905092915050565b7f4578636565647320746865206d617857616c6c657453697a652e000000000000600082015250565b600061334f601a836126eb565b915061335a82613319565b602082019050919050565b6000602082019050818103600083015261337e81613342565b9050919050565b60006133908261280d565b915061339b8361280d565b9250828210156133ae576133ad612cb6565b5b828203905092915050565b60006133c48261280d565b91506133cf8361280d565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561340857613407612cb6565b5b828202905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600061344d8261280d565b91506134588361280d565b92508261346857613467613413565b5b828204905092915050565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b60006134cf6021836126eb565b91506134da82613473565b604082019050919050565b600060208201905081810360008301526134fe816134c2565b9050919050565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b6000613561602a836126eb565b915061356c82613505565b604082019050919050565b6000602082019050818103600083015261359081613554565b9050919050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6135cc816127cf565b82525050565b60006135de83836135c3565b60208301905092915050565b6000602082019050919050565b600061360282613597565b61360c81856135a2565b9350613617836135b3565b8060005b8381101561364857815161362f88826135d2565b975061363a836135ea565b92505060018101905061361b565b5085935050505092915050565b600060a08201905061366a60008301886128b9565b6136776020830187612e3a565b818103604083015261368981866135f7565b90506136986060830185612bb1565b6136a560808301846128b9565b9695505050505050565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b60006136e5601b836126eb565b91506136f0826136af565b602082019050919050565b60006020820190508181036000830152613714816136d8565b905091905056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220dd47df8d4d95ea9b6e51df2969b40ee6d169fc62a205908f22fb99d8a6476b6364736f6c634300080d0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 2,253 |
0xC138d5B9f8c91Fa5F7c6BDFa8405d91383d86609
|
/*
💎 Hulk Inu 💎
🌐 https://hulkinu.com
💬 Tele: https://t.me/hulkinugroups
*/
// 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 HulkInu is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Hulk Inu | hulkinu.com";
string private constant _symbol = "HULKINU";
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 = 100 *10**9 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 5;
uint256 private _teamFee = 3;
// 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(0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B), _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 = 3;
}
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.mul(4).div(10));
_marketingFunds.transfer(amount.mul(6).div(10));
}
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 = 100 * 10**9 * 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, 12);
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);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612f04565b60405180910390f35b34801561015057600080fd5b5061016b60048036038101906101669190612a27565b61045e565b6040516101789190612ee9565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a391906130a6565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce91906129d8565b61048d565b6040516101e09190612ee9565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b919061294a565b610566565b005b34801561021e57600080fd5b50610227610656565b604051610234919061311b565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f9190612aa4565b61065f565b005b34801561027257600080fd5b5061027b610711565b005b34801561028957600080fd5b506102a4600480360381019061029f919061294a565b610783565b6040516102b191906130a6565b60405180910390f35b3480156102c657600080fd5b506102cf6107d4565b005b3480156102dd57600080fd5b506102e6610927565b6040516102f39190612e1b565b60405180910390f35b34801561030857600080fd5b50610311610950565b60405161031e9190612f04565b60405180910390f35b34801561033357600080fd5b5061034e60048036038101906103499190612a27565b61098d565b60405161035b9190612ee9565b60405180910390f35b34801561037057600080fd5b5061038b60048036038101906103869190612a63565b6109ab565b005b34801561039957600080fd5b506103a2610afb565b005b3480156103b057600080fd5b506103b9610b75565b005b3480156103c757600080fd5b506103e260048036038101906103dd9190612af6565b6110d2565b005b3480156103f057600080fd5b5061040b6004803603810190610406919061299c565b61121b565b60405161041891906130a6565b60405180910390f35b60606040518060400160405280601681526020017f48756c6b20496e75207c2068756c6b696e752e636f6d00000000000000000000815250905090565b600061047261046b6112a2565b84846112aa565b6001905092915050565b600068056bc75e2d63100000905090565b600061049a848484611475565b61055b846104a66112a2565b610556856040518060600160405280602881526020016137df60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050c6112a2565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c349092919063ffffffff16565b6112aa565b600190509392505050565b61056e6112a2565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f290612fe6565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b6106676112a2565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106eb90612fe6565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107526112a2565b73ffffffffffffffffffffffffffffffffffffffff161461077257600080fd5b600047905061078081611c98565b50565b60006107cd600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611db9565b9050919050565b6107dc6112a2565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610869576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086090612fe6565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600781526020017f48554c4b494e5500000000000000000000000000000000000000000000000000815250905090565b60006109a161099a6112a2565b8484611475565b6001905092915050565b6109b36112a2565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a40576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3790612fe6565b60405180910390fd5b60005b8151811015610af7576001600a6000848481518110610a8b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610aef906133bc565b915050610a43565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b3c6112a2565b73ffffffffffffffffffffffffffffffffffffffff1614610b5c57600080fd5b6000610b6730610783565b9050610b7281611e27565b50565b610b7d6112a2565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c0a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0190612fe6565b60405180910390fd5b600f60149054906101000a900460ff1615610c5a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c5190613066565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cea30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1668056bc75e2d631000006112aa565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d3057600080fd5b505afa158015610d44573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d689190612973565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610dca57600080fd5b505afa158015610dde573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e029190612973565b6040518363ffffffff1660e01b8152600401610e1f929190612e36565b602060405180830381600087803b158015610e3957600080fd5b505af1158015610e4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e719190612973565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610efa30610783565b600080610f05610927565b426040518863ffffffff1660e01b8152600401610f2796959493929190612e88565b6060604051808303818588803b158015610f4057600080fd5b505af1158015610f54573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f799190612b1f565b5050506001600f60166101000a81548160ff0219169083151502179055506001600f60176101000a81548160ff02191690831515021790555068056bc75e2d631000006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161107c929190612e5f565b602060405180830381600087803b15801561109657600080fd5b505af11580156110aa573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110ce9190612acd565b5050565b6110da6112a2565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611167576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115e90612fe6565b60405180910390fd5b600081116111aa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a190612fa6565b60405180910390fd5b6111d960646111cb8368056bc75e2d6310000061212190919063ffffffff16565b61219c90919063ffffffff16565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf60105460405161121091906130a6565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561131a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131190613046565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561138a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138190612f66565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161146891906130a6565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114e5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114dc90613026565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611555576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154c90612f26565b60405180910390fd5b60008111611598576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158f90613006565b60405180910390fd5b6115a0610927565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561160e57506115de610927565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b7157600f60179054906101000a900460ff1615611841573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561169057503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116ea5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117445750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561184057600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661178a6112a2565b73ffffffffffffffffffffffffffffffffffffffff1614806118005750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117e86112a2565b73ffffffffffffffffffffffffffffffffffffffff16145b61183f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161183690613086565b60405180910390fd5b5b5b60105481111561185057600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118f45750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118fd57600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119a85750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119fe5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a165750600f60179054906101000a900460ff165b15611ab75742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a6657600080fd5b603c42611a7391906131dc565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611ac230610783565b9050600f60159054906101000a900460ff16158015611b2f5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b475750600f60169054906101000a900460ff165b15611b6f57611b5581611e27565b60004790506000811115611b6d57611b6c47611c98565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c185750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c2257600090505b611c2e848484846121e6565b50505050565b6000838311158290611c7c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c739190612f04565b60405180910390fd5b5060008385611c8b91906132bd565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611cfb600a611ced60048661212190919063ffffffff16565b61219c90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d26573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d8a600a611d7c60068661212190919063ffffffff16565b61219c90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611db5573d6000803e3d6000fd5b5050565b6000600654821115611e00576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611df790612f46565b60405180910390fd5b6000611e0a612213565b9050611e1f818461219c90919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e85577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611eb35781602001602082028036833780820191505090505b5090503081600081518110611ef1577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611f9357600080fd5b505afa158015611fa7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fcb9190612973565b81600181518110612005577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061206c30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112aa565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016120d09594939291906130c1565b600060405180830381600087803b1580156120ea57600080fd5b505af11580156120fe573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b6000808314156121345760009050612196565b600082846121429190613263565b90508284826121519190613232565b14612191576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161218890612fc6565b60405180910390fd5b809150505b92915050565b60006121de83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061223e565b905092915050565b806121f4576121f36122a1565b5b6121ff8484846122d2565b8061220d5761220c61249d565b5b50505050565b60008060006122206124af565b91509150612237818361219c90919063ffffffff16565b9250505090565b60008083118290612285576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161227c9190612f04565b60405180910390fd5b50600083856122949190613232565b9050809150509392505050565b60006008541480156122b557506000600954145b156122bf576122d0565b600060088190555060006009819055505b565b6000806000806000806122e487612511565b95509550955095509550955061234286600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461257890919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123d785600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546125c290919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061242381612620565b61242d84836126dd565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161248a91906130a6565b60405180910390a3505050505050505050565b60056008819055506003600981905550565b60008060006006549050600068056bc75e2d6310000090506124e568056bc75e2d6310000060065461219c90919063ffffffff16565b8210156125045760065468056bc75e2d6310000093509350505061250d565b81819350935050505b9091565b600080600080600080600080600061252d8a600854600c612717565b925092509250600061253d612213565b905060008060006125508e8787876127ad565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006125ba83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c34565b905092915050565b60008082846125d191906131dc565b905083811015612616576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161260d90612f86565b60405180910390fd5b8091505092915050565b600061262a612213565b90506000612641828461212190919063ffffffff16565b905061269581600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546125c290919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6126f28260065461257890919063ffffffff16565b60068190555061270d816007546125c290919063ffffffff16565b6007819055505050565b6000806000806127436064612735888a61212190919063ffffffff16565b61219c90919063ffffffff16565b9050600061276d606461275f888b61212190919063ffffffff16565b61219c90919063ffffffff16565b9050600061279682612788858c61257890919063ffffffff16565b61257890919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806127c6858961212190919063ffffffff16565b905060006127dd868961212190919063ffffffff16565b905060006127f4878961212190919063ffffffff16565b9050600061281d8261280f858761257890919063ffffffff16565b61257890919063ffffffff16565b9050838184965096509650505050509450945094915050565b60006128496128448461315b565b613136565b9050808382526020820190508285602086028201111561286857600080fd5b60005b85811015612898578161287e88826128a2565b84526020840193506020830192505060018101905061286b565b5050509392505050565b6000813590506128b181613799565b92915050565b6000815190506128c681613799565b92915050565b600082601f8301126128dd57600080fd5b81356128ed848260208601612836565b91505092915050565b600081359050612905816137b0565b92915050565b60008151905061291a816137b0565b92915050565b60008135905061292f816137c7565b92915050565b600081519050612944816137c7565b92915050565b60006020828403121561295c57600080fd5b600061296a848285016128a2565b91505092915050565b60006020828403121561298557600080fd5b6000612993848285016128b7565b91505092915050565b600080604083850312156129af57600080fd5b60006129bd858286016128a2565b92505060206129ce858286016128a2565b9150509250929050565b6000806000606084860312156129ed57600080fd5b60006129fb868287016128a2565b9350506020612a0c868287016128a2565b9250506040612a1d86828701612920565b9150509250925092565b60008060408385031215612a3a57600080fd5b6000612a48858286016128a2565b9250506020612a5985828601612920565b9150509250929050565b600060208284031215612a7557600080fd5b600082013567ffffffffffffffff811115612a8f57600080fd5b612a9b848285016128cc565b91505092915050565b600060208284031215612ab657600080fd5b6000612ac4848285016128f6565b91505092915050565b600060208284031215612adf57600080fd5b6000612aed8482850161290b565b91505092915050565b600060208284031215612b0857600080fd5b6000612b1684828501612920565b91505092915050565b600080600060608486031215612b3457600080fd5b6000612b4286828701612935565b9350506020612b5386828701612935565b9250506040612b6486828701612935565b9150509250925092565b6000612b7a8383612b86565b60208301905092915050565b612b8f816132f1565b82525050565b612b9e816132f1565b82525050565b6000612baf82613197565b612bb981856131ba565b9350612bc483613187565b8060005b83811015612bf5578151612bdc8882612b6e565b9750612be7836131ad565b925050600181019050612bc8565b5085935050505092915050565b612c0b81613303565b82525050565b612c1a81613346565b82525050565b6000612c2b826131a2565b612c3581856131cb565b9350612c45818560208601613358565b612c4e81613492565b840191505092915050565b6000612c666023836131cb565b9150612c71826134a3565b604082019050919050565b6000612c89602a836131cb565b9150612c94826134f2565b604082019050919050565b6000612cac6022836131cb565b9150612cb782613541565b604082019050919050565b6000612ccf601b836131cb565b9150612cda82613590565b602082019050919050565b6000612cf2601d836131cb565b9150612cfd826135b9565b602082019050919050565b6000612d156021836131cb565b9150612d20826135e2565b604082019050919050565b6000612d386020836131cb565b9150612d4382613631565b602082019050919050565b6000612d5b6029836131cb565b9150612d668261365a565b604082019050919050565b6000612d7e6025836131cb565b9150612d89826136a9565b604082019050919050565b6000612da16024836131cb565b9150612dac826136f8565b604082019050919050565b6000612dc46017836131cb565b9150612dcf82613747565b602082019050919050565b6000612de76011836131cb565b9150612df282613770565b602082019050919050565b612e068161332f565b82525050565b612e1581613339565b82525050565b6000602082019050612e306000830184612b95565b92915050565b6000604082019050612e4b6000830185612b95565b612e586020830184612b95565b9392505050565b6000604082019050612e746000830185612b95565b612e816020830184612dfd565b9392505050565b600060c082019050612e9d6000830189612b95565b612eaa6020830188612dfd565b612eb76040830187612c11565b612ec46060830186612c11565b612ed16080830185612b95565b612ede60a0830184612dfd565b979650505050505050565b6000602082019050612efe6000830184612c02565b92915050565b60006020820190508181036000830152612f1e8184612c20565b905092915050565b60006020820190508181036000830152612f3f81612c59565b9050919050565b60006020820190508181036000830152612f5f81612c7c565b9050919050565b60006020820190508181036000830152612f7f81612c9f565b9050919050565b60006020820190508181036000830152612f9f81612cc2565b9050919050565b60006020820190508181036000830152612fbf81612ce5565b9050919050565b60006020820190508181036000830152612fdf81612d08565b9050919050565b60006020820190508181036000830152612fff81612d2b565b9050919050565b6000602082019050818103600083015261301f81612d4e565b9050919050565b6000602082019050818103600083015261303f81612d71565b9050919050565b6000602082019050818103600083015261305f81612d94565b9050919050565b6000602082019050818103600083015261307f81612db7565b9050919050565b6000602082019050818103600083015261309f81612dda565b9050919050565b60006020820190506130bb6000830184612dfd565b92915050565b600060a0820190506130d66000830188612dfd565b6130e36020830187612c11565b81810360408301526130f58186612ba4565b90506131046060830185612b95565b6131116080830184612dfd565b9695505050505050565b60006020820190506131306000830184612e0c565b92915050565b6000613140613151565b905061314c828261338b565b919050565b6000604051905090565b600067ffffffffffffffff82111561317657613175613463565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006131e78261332f565b91506131f28361332f565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561322757613226613405565b5b828201905092915050565b600061323d8261332f565b91506132488361332f565b92508261325857613257613434565b5b828204905092915050565b600061326e8261332f565b91506132798361332f565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156132b2576132b1613405565b5b828202905092915050565b60006132c88261332f565b91506132d38361332f565b9250828210156132e6576132e5613405565b5b828203905092915050565b60006132fc8261330f565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006133518261332f565b9050919050565b60005b8381101561337657808201518184015260208101905061335b565b83811115613385576000848401525b50505050565b61339482613492565b810181811067ffffffffffffffff821117156133b3576133b2613463565b5b80604052505050565b60006133c78261332f565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133fa576133f9613405565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b6137a2816132f1565b81146137ad57600080fd5b50565b6137b981613303565b81146137c457600080fd5b50565b6137d08161332f565b81146137db57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212208ba179a13ffbf7e63ba7e61ffb6f82ea8fe313eea735242d02cd3790910ff13264736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 2,254 |
0x3c02657b1a29be6044be93a898177d3c5a29539f
|
/**
*Submitted for verification at Etherscan.io on 2022-04-04
*/
//SPDX-License-Identifier: UNLICENSED
/*
8888888b. .d88888b. 888 888 8888888888 8888888b. 8888888 888b 888 888 888
888 Y88b d88P" "Y88b 888 888 888 888 Y88b 888 8888b 888 888 888
888 888 888 888 888 888 888 888 888 888 88888b 888 888 888
888 d88P 888 888 Y88b d88P 8888888 888 d88P 888 888Y88b 888 888 888
8888888P" 888 888 Y88b d88P 888 8888888P" 888 888 Y88b888 888 888
888 T88b 888 888 Y88o88P 888 888 T88b 888 888 Y88888 888 888
888 T88b Y88b. .d88P Y888P 888 888 T88b 888 888 Y8888 Y88b. .d88P
888 T88b "Y88888P" Y8P 8888888888 888 T88b 8888888 888 Y888 "Y88888P"
https://t.me/roverinutoken
https://t.me/roverinutoken
https://t.me/roverinutoken
*/
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);
}
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 RINU is Context, IERC20, Ownable {
mapping (address => uint) private _owned;
mapping (address => mapping (address => uint)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private _isBot;
uint private constant _totalSupply = 1e9 * 10**9;
string public constant name = unicode"ROVER INU";
string public constant symbol = unicode"RINU";
uint8 public constant decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address payable public _FeeCollectionADD;
address public uniswapV2Pair;
uint public _buyFee = 12;
uint public _sellFee = 12;
uint private _feeRate = 15;
uint public _maxHeldTokens;
uint public _launchedAt;
bool private _tradingOpen;
bool private _inSwap = false;
bool public _useImpactFeeSetter = false;
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 TaxAddUpdated(address _taxwallet);
modifier lockTheSwap {
_inSwap = true;
_;
_inSwap = false;
}
constructor (address payable TaxAdd) {
_FeeCollectionADD = TaxAdd;
_owned[address(this)] = _totalSupply;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[TaxAdd] = 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) {
_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(!_isBot[from]);
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");
bool isBuy = false;
if(from != owner() && to != owner()) {
if(from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to]) {
require(_tradingOpen, "Trading not yet enabled.");
if((_launchedAt + (6 minutes)) > block.timestamp) {
require((amount + balanceOf(address(to))) <= _maxHeldTokens);
}
isBuy = true;
}
if(!_inSwap && _tradingOpen && from != uniswapV2Pair) {
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 {
_FeeCollectionADD.transfer(amount);
}
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;
}
}
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 {}
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() {
require(!_tradingOpen, "Trading is already open");
_approve(address(this), address(uniswapV2Router), _totalSupply);
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
_tradingOpen = true;
_launchedAt = block.timestamp;
_maxHeldTokens = 20000000 * 10**9;
}
function manualswap() external {
uint contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
uint contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setFeeRate(uint rate) external onlyOwner() {
require(_msgSender() == _FeeCollectionADD);
require(rate > 0);
_feeRate = rate;
emit FeeRateUpdated(_feeRate);
}
function setFees(uint buy, uint sell) external onlyOwner() {
_buyFee = buy;
_sellFee = sell;
emit FeesUpdated(_buyFee, _sellFee);
}
function toggleImpactFee(bool onoff) external onlyOwner() {
_useImpactFeeSetter = onoff;
emit ImpactFeeSetterUpdated(_useImpactFeeSetter);
}
function updateTaxAdd(address newAddress) external {
require(_msgSender() == _FeeCollectionADD);
_FeeCollectionADD = payable(newAddress);
emit TaxAddUpdated(_FeeCollectionADD);
}
function thisBalance() public view returns (uint) {
return balanceOf(address(this));
}
function amountInPool() public view returns (uint) {
return balanceOf(uniswapV2Pair);
}
function setBots(address[] memory bots_) external 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_) external onlyOwner() {
for (uint i = 0; i < bots_.length; i++) {
_isBot[bots_[i]] = false;
}
}
function isBot(address ad) public view returns (bool) {
return _isBot[ad];
}
}
|
0x6080604052600436106101dc5760003560e01c80636fc3eaec11610102578063a9059cbb11610095578063c9567bf911610064578063c9567bf914610571578063db92dbb614610586578063dcb0e0ad1461059b578063dd62ed3e146105bb57600080fd5b8063a9059cbb146104fc578063b2289c621461051c578063b515566a1461053c578063c3c8cd801461055c57600080fd5b80638da5cb5b116100d15780638da5cb5b1461047957806394b8d8f21461049757806395d89b41146104b75780639e78fb4f146104e757600080fd5b80636fc3eaec1461040f57806370a0823114610424578063715018a61461044457806373f54a111461045957600080fd5b8063313ce5671161017a57806340b9a54b1161014957806340b9a54b1461038b57806345596e2e146103a157806349bd5a5e146103c1578063590f897e146103f957600080fd5b8063313ce567146102f557806331c2d8471461031c57806332d873d81461033c5780633bbac5791461035257600080fd5b806318160ddd116101b657806318160ddd146102855780631940d020146102aa57806323b872dd146102c057806327f3a72a146102e057600080fd5b806306fdde03146101e8578063095ea7b3146102335780630b78f9c01461026357600080fd5b366101e357005b600080fd5b3480156101f457600080fd5b5061021d60405180604001604052806009815260200168524f56455220494e5560b81b81525081565b60405161022a91906116ef565b60405180910390f35b34801561023f57600080fd5b5061025361024e366004611769565b610601565b604051901515815260200161022a565b34801561026f57600080fd5b5061028361027e366004611795565b610617565b005b34801561029157600080fd5b50670de0b6b3a76400005b60405190815260200161022a565b3480156102b657600080fd5b5061029c600c5481565b3480156102cc57600080fd5b506102536102db3660046117b7565b610691565b3480156102ec57600080fd5b5061029c6106e5565b34801561030157600080fd5b5061030a600981565b60405160ff909116815260200161022a565b34801561032857600080fd5b5061028361033736600461180e565b6106f5565b34801561034857600080fd5b5061029c600d5481565b34801561035e57600080fd5b5061025361036d3660046118d3565b6001600160a01b031660009081526005602052604090205460ff1690565b34801561039757600080fd5b5061029c60095481565b3480156103ad57600080fd5b506102836103bc3660046118f0565b61078b565b3480156103cd57600080fd5b506008546103e1906001600160a01b031681565b6040516001600160a01b03909116815260200161022a565b34801561040557600080fd5b5061029c600a5481565b34801561041b57600080fd5b5061028361081e565b34801561043057600080fd5b5061029c61043f3660046118d3565b61082b565b34801561045057600080fd5b50610283610846565b34801561046557600080fd5b506102836104743660046118d3565b6108ba565b34801561048557600080fd5b506000546001600160a01b03166103e1565b3480156104a357600080fd5b50600e546102539062010000900460ff1681565b3480156104c357600080fd5b5061021d6040518060400160405280600481526020016352494e5560e01b81525081565b3480156104f357600080fd5b50610283610928565b34801561050857600080fd5b50610253610517366004611769565b610b2d565b34801561052857600080fd5b506007546103e1906001600160a01b031681565b34801561054857600080fd5b5061028361055736600461180e565b610b3a565b34801561056857600080fd5b50610283610c53565b34801561057d57600080fd5b50610283610c69565b34801561059257600080fd5b5061029c610e5a565b3480156105a757600080fd5b506102836105b6366004611917565b610e72565b3480156105c757600080fd5b5061029c6105d6366004611934565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b600061060e338484610eef565b50600192915050565b6000546001600160a01b0316331461064a5760405162461bcd60e51b81526004016106419061196d565b60405180910390fd5b6009829055600a81905560408051838152602081018390527f5c6323bf1c2d7aaea2c091a4751c1c87af7f2864650c336507a77d0557af37a1910160405180910390a15050565b600061069e848484611013565b6001600160a01b03841660009081526003602090815260408083203384529091528120546106cd9084906119b8565b90506106da853383610eef565b506001949350505050565b60006106f03061082b565b905090565b6000546001600160a01b0316331461071f5760405162461bcd60e51b81526004016106419061196d565b60005b815181101561078757600060056000848481518110610743576107436119cf565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061077f816119e5565b915050610722565b5050565b6000546001600160a01b031633146107b55760405162461bcd60e51b81526004016106419061196d565b6007546001600160a01b0316336001600160a01b0316146107d557600080fd5b600081116107e257600080fd5b600b8190556040518181527f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd8906020015b60405180910390a150565b47610828816113bc565b50565b6001600160a01b031660009081526002602052604090205490565b6000546001600160a01b031633146108705760405162461bcd60e51b81526004016106419061196d565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6007546001600160a01b0316336001600160a01b0316146108da57600080fd5b600780546001600160a01b0319166001600160a01b0383169081179091556040519081527f5a9bcd8aea0cbf27de081c73815e420f65287b49bcf7a17ff691c61a2dd2d2d690602001610813565b6000546001600160a01b031633146109525760405162461bcd60e51b81526004016106419061196d565b600e5460ff161561099f5760405162461bcd60e51b81526020600482015260176024820152762a3930b234b7339034b99030b63932b0b23c9037b832b760491b6044820152606401610641565b600680546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a01559160048083019260209291908290030181865afa158015610a04573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a2891906119fe565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a75573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a9991906119fe565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610ae6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b0a91906119fe565b600880546001600160a01b0319166001600160a01b039290921691909117905550565b600061060e338484611013565b6000546001600160a01b03163314610b645760405162461bcd60e51b81526004016106419061196d565b60005b81518110156107875760085482516001600160a01b0390911690839083908110610b9357610b936119cf565b60200260200101516001600160a01b031614158015610be4575060065482516001600160a01b0390911690839083908110610bd057610bd06119cf565b60200260200101516001600160a01b031614155b15610c4157600160056000848481518110610c0157610c016119cf565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b80610c4b816119e5565b915050610b67565b6000610c5e3061082b565b9050610828816113f6565b6000546001600160a01b03163314610c935760405162461bcd60e51b81526004016106419061196d565b600e5460ff1615610ce05760405162461bcd60e51b81526020600482015260176024820152762a3930b234b7339034b99030b63932b0b23c9037b832b760491b6044820152606401610641565b600654610d009030906001600160a01b0316670de0b6b3a7640000610eef565b6006546001600160a01b031663f305d7194730610d1c8161082b565b600080610d316000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af1158015610d99573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610dbe9190611a1b565b505060085460065460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af1158015610e17573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e3b9190611a49565b50600e805460ff1916600117905542600d5566470de4df820000600c55565b6008546000906106f0906001600160a01b031661082b565b6000546001600160a01b03163314610e9c5760405162461bcd60e51b81526004016106419061196d565b600e805462ff00001916620100008315158102919091179182905560405160ff9190920416151581527ff65c78d1059dbb9ec90732848bcfebbec05ac40af847d3c19adcad63379d3aeb90602001610813565b6001600160a01b038316610f515760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610641565b6001600160a01b038216610fb25760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610641565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b03831660009081526005602052604090205460ff161561103957600080fd5b6001600160a01b03831661109d5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610641565b6001600160a01b0382166110ff5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610641565b600081116111615760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610641565b600080546001600160a01b0385811691161480159061118e57506000546001600160a01b03848116911614155b1561135d576008546001600160a01b0385811691161480156111be57506006546001600160a01b03848116911614155b80156111e357506001600160a01b03831660009081526004602052604090205460ff16155b1561127657600e5460ff1661123a5760405162461bcd60e51b815260206004820152601860248201527f54726164696e67206e6f742079657420656e61626c65642e00000000000000006044820152606401610641565b42600d5461016861124b9190611a66565b111561127257600c5461125d8461082b565b6112679084611a66565b111561127257600080fd5b5060015b600e54610100900460ff161580156112905750600e5460ff165b80156112aa57506008546001600160a01b03858116911614155b1561135d5760006112ba3061082b565b9050801561134657600e5462010000900460ff161561133d57600b54600854606491906112ef906001600160a01b031661082b565b6112f99190611a7e565b6113039190611a9d565b81111561133d57600b5460085460649190611326906001600160a01b031661082b565b6113309190611a7e565b61133a9190611a9d565b90505b611346816113f6565b47801561135657611356476113bc565b6000925050505b6001600160a01b03841660009081526004602052604090205460019060ff168061139f57506001600160a01b03841660009081526004602052604090205460ff165b156113a8575060005b6113b5858585848661156a565b5050505050565b6007546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610787573d6000803e3d6000fd5b600e805461ff001916610100179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061143a5761143a6119cf565b6001600160a01b03928316602091820292909201810191909152600654604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015611493573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114b791906119fe565b816001815181106114ca576114ca6119cf565b6001600160a01b0392831660209182029290920101526006546114f09130911684610eef565b60065460405163791ac94760e01b81526001600160a01b039091169063791ac94790611529908590600090869030904290600401611abf565b600060405180830381600087803b15801561154357600080fd5b505af1158015611557573d6000803e3d6000fd5b5050600e805461ff001916905550505050565b6000611576838361158c565b9050611584868686846115b0565b505050505050565b60008083156115a95782156115a457506009546115a9565b50600a545b9392505050565b6000806115bd848461168d565b6001600160a01b03881660009081526002602052604090205491935091506115e69085906119b8565b6001600160a01b038088166000908152600260205260408082209390935590871681522054611616908390611a66565b6001600160a01b038616600090815260026020526040902055611638816116c1565b846001600160a01b0316866001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161167d91815260200190565b60405180910390a3505050505050565b60008080606461169d8587611a7e565b6116a79190611a9d565b905060006116b582876119b8565b96919550909350505050565b306000908152600260205260409020546116dc908290611a66565b3060009081526002602052604090205550565b600060208083528351808285015260005b8181101561171c57858101830151858201604001528201611700565b8181111561172e576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b038116811461082857600080fd5b803561176481611744565b919050565b6000806040838503121561177c57600080fd5b823561178781611744565b946020939093013593505050565b600080604083850312156117a857600080fd5b50508035926020909101359150565b6000806000606084860312156117cc57600080fd5b83356117d781611744565b925060208401356117e781611744565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b6000602080838503121561182157600080fd5b823567ffffffffffffffff8082111561183957600080fd5b818501915085601f83011261184d57600080fd5b81358181111561185f5761185f6117f8565b8060051b604051601f19603f83011681018181108582111715611884576118846117f8565b6040529182528482019250838101850191888311156118a257600080fd5b938501935b828510156118c7576118b885611759565b845293850193928501926118a7565b98975050505050505050565b6000602082840312156118e557600080fd5b81356115a981611744565b60006020828403121561190257600080fd5b5035919050565b801515811461082857600080fd5b60006020828403121561192957600080fd5b81356115a981611909565b6000806040838503121561194757600080fd5b823561195281611744565b9150602083013561196281611744565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052601160045260246000fd5b6000828210156119ca576119ca6119a2565b500390565b634e487b7160e01b600052603260045260246000fd5b6000600182016119f7576119f76119a2565b5060010190565b600060208284031215611a1057600080fd5b81516115a981611744565b600080600060608486031215611a3057600080fd5b8351925060208401519150604084015190509250925092565b600060208284031215611a5b57600080fd5b81516115a981611909565b60008219821115611a7957611a796119a2565b500190565b6000816000190483118215151615611a9857611a986119a2565b500290565b600082611aba57634e487b7160e01b600052601260045260246000fd5b500490565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611b0f5784516001600160a01b031683529383019391830191600101611aea565b50506001600160a01b0396909616606085015250505060800152939250505056fea264697066735822122061cdc133acf36769a201b9251437939c3d0b0e76eb5e5734c0bed0d45e13ce6864736f6c634300080d0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 2,255 |
0x5EaEf63026ace53b7E7497FC8B019c3893D3dc36
|
/**
*Submitted for verification at Etherscan.io on 2022-04-09
*/
/*
https://t.me/milkymeta
milkymeta.com
*/
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.9;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract MilkyMeta is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Milky Meta";
string private constant _symbol = "MILKY";
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 = 100000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 0;
uint256 private _taxFeeOnBuy = 8;
uint256 private _redisFeeOnSell = 0;
uint256 private _taxFeeOnSell = 16;
//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(0x942cedC308efC2a36Fb2ab62958299CfaF5ceb66);
address payable private _marketingAddress = payable(0x74fC3f1570Ed70bA7cd9F95626db3009D8423a16);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 3000000000 * 10**9;
uint256 public _maxWalletSize = 5000000000 * 10**9;
uint256 public _swapTokensAtAmount = 500000000 * 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 {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
_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;
}
}
|
0x6080604052600436106101c55760003560e01c806374010ece116100f757806398a5c31511610095578063c3c8cd8011610064578063c3c8cd801461063a578063dd62ed3e14610651578063ea1644d51461068e578063f2fde38b146106b7576101cc565b806398a5c3151461056e578063a2a957bb14610597578063a9059cbb146105c0578063bfd79284146105fd576101cc565b80638da5cb5b116100d15780638da5cb5b146104c45780638f70ccf7146104ef5780638f9a55c01461051857806395d89b4114610543576101cc565b806374010ece146104335780637d1db4a51461045c5780637f2feddc14610487576101cc565b8063313ce567116101645780636d8aa8f81161013e5780636d8aa8f81461039f5780636fc3eaec146103c857806370a08231146103df578063715018a61461041c576101cc565b8063313ce5671461032057806349bd5a5e1461034b5780636b99905314610376576101cc565b80631694505e116101a05780631694505e1461026257806318160ddd1461028d57806323b872dd146102b85780632fd689e3146102f5576101cc565b8062b8cf2a146101d157806306fdde03146101fa578063095ea7b314610225576101cc565b366101cc57005b600080fd5b3480156101dd57600080fd5b506101f860048036038101906101f39190612c2d565b6106e0565b005b34801561020657600080fd5b5061020f61080a565b60405161021c9190612cfe565b60405180910390f35b34801561023157600080fd5b5061024c60048036038101906102479190612d56565b610847565b6040516102599190612db1565b60405180910390f35b34801561026e57600080fd5b50610277610865565b6040516102849190612e2b565b60405180910390f35b34801561029957600080fd5b506102a261088b565b6040516102af9190612e55565b60405180910390f35b3480156102c457600080fd5b506102df60048036038101906102da9190612e70565b61089c565b6040516102ec9190612db1565b60405180910390f35b34801561030157600080fd5b5061030a610975565b6040516103179190612e55565b60405180910390f35b34801561032c57600080fd5b5061033561097b565b6040516103429190612edf565b60405180910390f35b34801561035757600080fd5b50610360610984565b60405161036d9190612f09565b60405180910390f35b34801561038257600080fd5b5061039d60048036038101906103989190612f24565b6109aa565b005b3480156103ab57600080fd5b506103c660048036038101906103c19190612f7d565b610a9a565b005b3480156103d457600080fd5b506103dd610b4c565b005b3480156103eb57600080fd5b5061040660048036038101906104019190612f24565b610c1d565b6040516104139190612e55565b60405180910390f35b34801561042857600080fd5b50610431610c6e565b005b34801561043f57600080fd5b5061045a60048036038101906104559190612faa565b610dc1565b005b34801561046857600080fd5b50610471610e60565b60405161047e9190612e55565b60405180910390f35b34801561049357600080fd5b506104ae60048036038101906104a99190612f24565b610e66565b6040516104bb9190612e55565b60405180910390f35b3480156104d057600080fd5b506104d9610e7e565b6040516104e69190612f09565b60405180910390f35b3480156104fb57600080fd5b5061051660048036038101906105119190612f7d565b610ea7565b005b34801561052457600080fd5b5061052d610f59565b60405161053a9190612e55565b60405180910390f35b34801561054f57600080fd5b50610558610f5f565b6040516105659190612cfe565b60405180910390f35b34801561057a57600080fd5b5061059560048036038101906105909190612faa565b610f9c565b005b3480156105a357600080fd5b506105be60048036038101906105b99190612fd7565b611066565b005b3480156105cc57600080fd5b506105e760048036038101906105e29190612d56565b61111d565b6040516105f49190612db1565b60405180910390f35b34801561060957600080fd5b50610624600480360381019061061f9190612f24565b61113b565b6040516106319190612db1565b60405180910390f35b34801561064657600080fd5b5061064f61115b565b005b34801561065d57600080fd5b506106786004803603810190610673919061303e565b611234565b6040516106859190612e55565b60405180910390f35b34801561069a57600080fd5b506106b560048036038101906106b09190612faa565b6112bb565b005b3480156106c357600080fd5b506106de60048036038101906106d99190612f24565b61135a565b005b6106e861151c565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610775576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161076c906130ca565b60405180910390fd5b60005b81518110156108065760016010600084848151811061079a576107996130ea565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555080806107fe90613148565b915050610778565b5050565b60606040518060400160405280600a81526020017f4d696c6b79204d65746100000000000000000000000000000000000000000000815250905090565b600061085b61085461151c565b8484611524565b6001905092915050565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600068056bc75e2d63100000905090565b60006108a98484846116ef565b61096a846108b561151c565b61096585604051806060016040528060288152602001613b8960289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061091b61151c565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611f749092919063ffffffff16565b611524565b600190509392505050565b60185481565b60006009905090565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6109b261151c565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a3f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a36906130ca565b60405180910390fd5b6000601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b610aa261151c565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b2f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b26906130ca565b60405180910390fd5b80601560166101000a81548160ff02191690831515021790555050565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b8d61151c565b73ffffffffffffffffffffffffffffffffffffffff161480610c035750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610beb61151c565b73ffffffffffffffffffffffffffffffffffffffff16145b610c0c57600080fd5b6000479050610c1a81611fd8565b50565b6000610c67600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612044565b9050919050565b610c7661151c565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d03576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cfa906130ca565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610dc961151c565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e56576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e4d906130ca565b60405180910390fd5b8060168190555050565b60165481565b60116020528060005260406000206000915090505481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610eaf61151c565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f3c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f33906130ca565b60405180910390fd5b80601560146101000a81548160ff02191690831515021790555050565b60175481565b60606040518060400160405280600581526020017f4d494c4b59000000000000000000000000000000000000000000000000000000815250905090565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610fdd61151c565b73ffffffffffffffffffffffffffffffffffffffff1614806110535750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661103b61151c565b73ffffffffffffffffffffffffffffffffffffffff16145b61105c57600080fd5b8060188190555050565b61106e61151c565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146110fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110f2906130ca565b60405180910390fd5b8360088190555082600a819055508160098190555080600b8190555050505050565b600061113161112a61151c565b84846116ef565b6001905092915050565b60106020528060005260406000206000915054906101000a900460ff1681565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661119c61151c565b73ffffffffffffffffffffffffffffffffffffffff1614806112125750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166111fa61151c565b73ffffffffffffffffffffffffffffffffffffffff16145b61121b57600080fd5b600061122630610c1d565b9050611231816120b2565b50565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6112c361151c565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611350576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611347906130ca565b60405180910390fd5b8060178190555050565b61136261151c565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146113ef576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113e6906130ca565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561145f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161145690613203565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611594576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158b90613295565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611604576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115fb90613327565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516116e29190612e55565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561175f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611756906133b9565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156117cf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117c69061344b565b60405180910390fd5b60008111611812576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611809906134dd565b60405180910390fd5b61181a610e7e565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156118885750611858610e7e565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611c7357601560149054906101000a900460ff16611917576118a9610e7e565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614611916576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161190d9061356f565b60405180910390fd5b5b60165481111561195c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611953906135db565b60405180910390fd5b601060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611a005750601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611a3f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a369061366d565b60405180910390fd5b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614611aec5760175481611aa184610c1d565b611aab919061368d565b10611aeb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ae290613755565b60405180910390fd5b5b6000611af730610c1d565b9050600060185482101590506016548210611b125760165491505b808015611b2a575060158054906101000a900460ff16155b8015611b845750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b8015611b9c5750601560169054906101000a900460ff165b8015611bf25750600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611c485750600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611c7057611c56826120b2565b60004790506000811115611c6e57611c6d47611fd8565b5b505b50505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611d1a5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b80611dcd5750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614158015611dcc5750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b5b15611ddb5760009050611f62565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148015611e865750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b15611e9e57600854600c81905550600954600d819055505b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16148015611f495750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b15611f6157600a54600c81905550600b54600d819055505b5b611f6e84848484612338565b50505050565b6000838311158290611fbc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611fb39190612cfe565b60405180910390fd5b5060008385611fcb9190613775565b9050809150509392505050565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015612040573d6000803e3d6000fd5b5050565b600060065482111561208b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120829061381b565b60405180910390fd5b6000612095612365565b90506120aa818461239090919063ffffffff16565b915050919050565b60016015806101000a81548160ff0219169083151502179055506000600267ffffffffffffffff8111156120e9576120e8612a8c565b5b6040519080825280602002602001820160405280156121175781602001602082028036833780820191505090505b509050308160008151811061212f5761212e6130ea565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156121d157600080fd5b505afa1580156121e5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122099190613850565b8160018151811061221d5761221c6130ea565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061228430601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611524565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016122e8959493929190613976565b600060405180830381600087803b15801561230257600080fd5b505af1158015612316573d6000803e3d6000fd5b505050505060006015806101000a81548160ff02191690831515021790555050565b80612346576123456123da565b5b61235184848461241d565b8061235f5761235e6125e8565b5b50505050565b60008060006123726125fc565b91509150612389818361239090919063ffffffff16565b9250505090565b60006123d283836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061265e565b905092915050565b6000600c541480156123ee57506000600d54145b156123f85761241b565b600c54600e81905550600d54600f819055506000600c819055506000600d819055505b565b60008060008060008061242f876126c1565b95509550955095509550955061248d86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461272990919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061252285600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461277390919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061256e816127d1565b612578848361288e565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516125d59190612e55565b60405180910390a3505050505050505050565b600e54600c81905550600f54600d81905550565b60008060006006549050600068056bc75e2d63100000905061263268056bc75e2d6310000060065461239090919063ffffffff16565b8210156126515760065468056bc75e2d6310000093509350505061265a565b81819350935050505b9091565b600080831182906126a5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161269c9190612cfe565b60405180910390fd5b50600083856126b491906139ff565b9050809150509392505050565b60008060008060008060008060006126de8a600c54600d546128c8565b92509250925060006126ee612365565b905060008060006127018e87878761295e565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061276b83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611f74565b905092915050565b6000808284612782919061368d565b9050838110156127c7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016127be90613a7c565b60405180910390fd5b8091505092915050565b60006127db612365565b905060006127f282846129e790919063ffffffff16565b905061284681600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461277390919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6128a38260065461272990919063ffffffff16565b6006819055506128be8160075461277390919063ffffffff16565b6007819055505050565b6000806000806128f460646128e6888a6129e790919063ffffffff16565b61239090919063ffffffff16565b9050600061291e6064612910888b6129e790919063ffffffff16565b61239090919063ffffffff16565b9050600061294782612939858c61272990919063ffffffff16565b61272990919063ffffffff16565b905080838395509550955050505093509350939050565b60008060008061297785896129e790919063ffffffff16565b9050600061298e86896129e790919063ffffffff16565b905060006129a587896129e790919063ffffffff16565b905060006129ce826129c0858761272990919063ffffffff16565b61272990919063ffffffff16565b9050838184965096509650505050509450945094915050565b6000808314156129fa5760009050612a5c565b60008284612a089190613a9c565b9050828482612a1791906139ff565b14612a57576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612a4e90613b68565b60405180910390fd5b809150505b92915050565b6000604051905090565b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b612ac482612a7b565b810181811067ffffffffffffffff82111715612ae357612ae2612a8c565b5b80604052505050565b6000612af6612a62565b9050612b028282612abb565b919050565b600067ffffffffffffffff821115612b2257612b21612a8c565b5b602082029050602081019050919050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000612b6382612b38565b9050919050565b612b7381612b58565b8114612b7e57600080fd5b50565b600081359050612b9081612b6a565b92915050565b6000612ba9612ba484612b07565b612aec565b90508083825260208201905060208402830185811115612bcc57612bcb612b33565b5b835b81811015612bf55780612be18882612b81565b845260208401935050602081019050612bce565b5050509392505050565b600082601f830112612c1457612c13612a76565b5b8135612c24848260208601612b96565b91505092915050565b600060208284031215612c4357612c42612a6c565b5b600082013567ffffffffffffffff811115612c6157612c60612a71565b5b612c6d84828501612bff565b91505092915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015612cb0578082015181840152602081019050612c95565b83811115612cbf576000848401525b50505050565b6000612cd082612c76565b612cda8185612c81565b9350612cea818560208601612c92565b612cf381612a7b565b840191505092915050565b60006020820190508181036000830152612d188184612cc5565b905092915050565b6000819050919050565b612d3381612d20565b8114612d3e57600080fd5b50565b600081359050612d5081612d2a565b92915050565b60008060408385031215612d6d57612d6c612a6c565b5b6000612d7b85828601612b81565b9250506020612d8c85828601612d41565b9150509250929050565b60008115159050919050565b612dab81612d96565b82525050565b6000602082019050612dc66000830184612da2565b92915050565b6000819050919050565b6000612df1612dec612de784612b38565b612dcc565b612b38565b9050919050565b6000612e0382612dd6565b9050919050565b6000612e1582612df8565b9050919050565b612e2581612e0a565b82525050565b6000602082019050612e406000830184612e1c565b92915050565b612e4f81612d20565b82525050565b6000602082019050612e6a6000830184612e46565b92915050565b600080600060608486031215612e8957612e88612a6c565b5b6000612e9786828701612b81565b9350506020612ea886828701612b81565b9250506040612eb986828701612d41565b9150509250925092565b600060ff82169050919050565b612ed981612ec3565b82525050565b6000602082019050612ef46000830184612ed0565b92915050565b612f0381612b58565b82525050565b6000602082019050612f1e6000830184612efa565b92915050565b600060208284031215612f3a57612f39612a6c565b5b6000612f4884828501612b81565b91505092915050565b612f5a81612d96565b8114612f6557600080fd5b50565b600081359050612f7781612f51565b92915050565b600060208284031215612f9357612f92612a6c565b5b6000612fa184828501612f68565b91505092915050565b600060208284031215612fc057612fbf612a6c565b5b6000612fce84828501612d41565b91505092915050565b60008060008060808587031215612ff157612ff0612a6c565b5b6000612fff87828801612d41565b945050602061301087828801612d41565b935050604061302187828801612d41565b925050606061303287828801612d41565b91505092959194509250565b6000806040838503121561305557613054612a6c565b5b600061306385828601612b81565b925050602061307485828601612b81565b9150509250929050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b60006130b4602083612c81565b91506130bf8261307e565b602082019050919050565b600060208201905081810360008301526130e3816130a7565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061315382612d20565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561318657613185613119565b5b600182019050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b60006131ed602683612c81565b91506131f882613191565b604082019050919050565b6000602082019050818103600083015261321c816131e0565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b600061327f602483612c81565b915061328a82613223565b604082019050919050565b600060208201905081810360008301526132ae81613272565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b6000613311602283612c81565b915061331c826132b5565b604082019050919050565b6000602082019050818103600083015261334081613304565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b60006133a3602583612c81565b91506133ae82613347565b604082019050919050565b600060208201905081810360008301526133d281613396565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b6000613435602383612c81565b9150613440826133d9565b604082019050919050565b6000602082019050818103600083015261346481613428565b9050919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b60006134c7602983612c81565b91506134d28261346b565b604082019050919050565b600060208201905081810360008301526134f6816134ba565b9050919050565b7f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060008201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400602082015250565b6000613559603f83612c81565b9150613564826134fd565b604082019050919050565b600060208201905081810360008301526135888161354c565b9050919050565b7f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000600082015250565b60006135c5601c83612c81565b91506135d08261358f565b602082019050919050565b600060208201905081810360008301526135f4816135b8565b9050919050565b7f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460008201527f6564210000000000000000000000000000000000000000000000000000000000602082015250565b6000613657602383612c81565b9150613662826135fb565b604082019050919050565b600060208201905081810360008301526136868161364a565b9050919050565b600061369882612d20565b91506136a383612d20565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156136d8576136d7613119565b5b828201905092915050565b7f544f4b454e3a2042616c616e636520657863656564732077616c6c657420736960008201527f7a65210000000000000000000000000000000000000000000000000000000000602082015250565b600061373f602383612c81565b915061374a826136e3565b604082019050919050565b6000602082019050818103600083015261376e81613732565b9050919050565b600061378082612d20565b915061378b83612d20565b92508282101561379e5761379d613119565b5b828203905092915050565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b6000613805602a83612c81565b9150613810826137a9565b604082019050919050565b60006020820190508181036000830152613834816137f8565b9050919050565b60008151905061384a81612b6a565b92915050565b60006020828403121561386657613865612a6c565b5b60006138748482850161383b565b91505092915050565b6000819050919050565b60006138a261389d6138988461387d565b612dcc565b612d20565b9050919050565b6138b281613887565b82525050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6138ed81612b58565b82525050565b60006138ff83836138e4565b60208301905092915050565b6000602082019050919050565b6000613923826138b8565b61392d81856138c3565b9350613938836138d4565b8060005b8381101561396957815161395088826138f3565b975061395b8361390b565b92505060018101905061393c565b5085935050505092915050565b600060a08201905061398b6000830188612e46565b61399860208301876138a9565b81810360408301526139aa8186613918565b90506139b96060830185612efa565b6139c66080830184612e46565b9695505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000613a0a82612d20565b9150613a1583612d20565b925082613a2557613a246139d0565b5b828204905092915050565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b6000613a66601b83612c81565b9150613a7182613a30565b602082019050919050565b60006020820190508181036000830152613a9581613a59565b9050919050565b6000613aa782612d20565b9150613ab283612d20565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613aeb57613aea613119565b5b828202905092915050565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b6000613b52602183612c81565b9150613b5d82613af6565b604082019050919050565b60006020820190508181036000830152613b8181613b45565b905091905056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220c91cb042bb9d21c58b8d1d342885fcb620b43b80d0a1fe6c3a0fdccc1900b68564736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 2,256 |
0xf7e3244ff26f950549e9276ba7a42a3c863647f8
|
pragma solidity 0.6.12;
// SPDX-License-Identifier: BSD-3-Clause
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @dev Library for managing
* https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
* types.
*
* Sets have the following properties:
*
* - Elements are added, removed, and checked for existence in constant time
* (O(1)).
* - Elements are enumerated in O(n). No guarantees are made on the ordering.
*
* ```
* contract Example {
* // Add the library methods
* using EnumerableSet for EnumerableSet.AddressSet;
*
* // Declare a set state variable
* EnumerableSet.AddressSet private mySet;
* }
* ```
*
* As of v3.0.0, only sets of type `address` (`AddressSet`) and `uint256`
* (`UintSet`) are supported.
*/
library EnumerableSet {
// To implement this library for multiple types with as little code
// repetition as possible, we write it in terms of a generic Set type with
// bytes32 values.
// The Set implementation uses private functions, and user-facing
// implementations (such as AddressSet) are just wrappers around the
// underlying Set.
// This means that we can only create new EnumerableSets for types that fit
// in bytes32.
struct Set {
// Storage of set values
bytes32[] _values;
// Position of the value in the `values` array, plus 1 because index 0
// means a value is not in the set.
mapping (bytes32 => uint256) _indexes;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function _add(Set storage set, bytes32 value) private returns (bool) {
if (!_contains(set, value)) {
set._values.push(value);
// The value is stored at length-1, but we add 1 to all indexes
// and use 0 as a sentinel value
set._indexes[value] = set._values.length;
return true;
} else {
return false;
}
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function _remove(Set storage set, bytes32 value) private returns (bool) {
// We read and store the value's index to prevent multiple reads from the same storage slot
uint256 valueIndex = set._indexes[value];
if (valueIndex != 0) { // Equivalent to contains(set, value)
// To delete an element from the _values array in O(1), we swap the element to delete with the last one in
// the array, and then remove the last element (sometimes called as 'swap and pop').
// This modifies the order of the array, as noted in {at}.
uint256 toDeleteIndex = valueIndex - 1;
uint256 lastIndex = set._values.length - 1;
// When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs
// so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement.
bytes32 lastvalue = set._values[lastIndex];
// Move the last value to the index where the value to delete is
set._values[toDeleteIndex] = lastvalue;
// Update the index for the moved value
set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based
// Delete the slot where the moved value was stored
set._values.pop();
// Delete the index for the deleted slot
delete set._indexes[value];
return true;
} else {
return false;
}
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function _contains(Set storage set, bytes32 value) private view returns (bool) {
return set._indexes[value] != 0;
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function _length(Set storage set) private view returns (uint256) {
return set._values.length;
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function _at(Set storage set, uint256 index) private view returns (bytes32) {
require(set._values.length > index, "EnumerableSet: index out of bounds");
return set._values[index];
}
// AddressSet
struct AddressSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(AddressSet storage set, address value) internal returns (bool) {
return _add(set._inner, bytes32(uint256(value)));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(AddressSet storage set, address value) internal returns (bool) {
return _remove(set._inner, bytes32(uint256(value)));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(AddressSet storage set, address value) internal view returns (bool) {
return _contains(set._inner, bytes32(uint256(value)));
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(AddressSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(AddressSet storage set, uint256 index) internal view returns (address) {
return address(uint256(_at(set._inner, index)));
}
// UintSet
struct UintSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(UintSet storage set, uint256 value) internal returns (bool) {
return _add(set._inner, bytes32(value));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(UintSet storage set, uint256 value) internal returns (bool) {
return _remove(set._inner, bytes32(value));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(UintSet storage set, uint256 value) internal view returns (bool) {
return _contains(set._inner, bytes32(value));
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function length(UintSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(UintSet storage set, uint256 index) internal view returns (uint256) {
return uint256(_at(set._inner, index));
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public admin;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
admin = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == admin);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
emit OwnershipTransferred(admin, newOwner);
admin = newOwner;
}
}
interface Token {
function transferFrom(address, address, uint) external returns (bool);
function transfer(address, uint) external returns (bool);
}
contract YeFiMPool5 is Ownable {
using SafeMath for uint;
using EnumerableSet for EnumerableSet.AddressSet;
event RewardsTransferred(address holder, uint amount);
// token contract address
address public tokenAddress;
address public liquiditytoken1;
// reward rate % per year
uint public rewardRate = 25000;
uint public rewardInterval = 365 days;
// staking fee percent
uint public stakingFeeRate = 0;
// unstaking fee percent
uint public unstakingFeeRate = 0;
// unstaking possible Time
uint public PossibleUnstakeTime = 24 hours;
uint public totalClaimedRewards = 0;
uint private FundedTokens;
bool public stakingStatus = false;
EnumerableSet.AddressSet private holders;
mapping (address => uint) public depositedTokens;
mapping (address => uint) public stakingTime;
mapping (address => uint) public lastClaimedTime;
mapping (address => uint) public totalEarnedTokens;
/*=============================ADMINISTRATIVE FUNCTIONS ==================================*/
function setTokenAddresses(address _tokenAddr, address _liquidityAddr) public onlyOwner returns(bool){
require(_tokenAddr != address(0) && _liquidityAddr != address(0), "Invalid addresses format are not supported");
tokenAddress = _tokenAddr;
liquiditytoken1 = _liquidityAddr;
}
function stakingFeeRateSet(uint _stakingFeeRate, uint _unstakingFeeRate) public onlyOwner returns(bool){
stakingFeeRate = _stakingFeeRate;
unstakingFeeRate = _unstakingFeeRate;
}
function rewardRateSet(uint _rewardRate) public onlyOwner returns(bool){
rewardRate = _rewardRate;
}
function StakingReturnsAmountSet(uint _poolreward) public onlyOwner returns(bool){
FundedTokens = _poolreward;
}
function possibleUnstakeTimeSet(uint _possibleUnstakeTime) public onlyOwner returns(bool){
PossibleUnstakeTime = _possibleUnstakeTime;
}
function rewardIntervalSet(uint _rewardInterval) public onlyOwner returns(bool){
rewardInterval = _rewardInterval;
}
function allowStaking(bool _status) public onlyOwner returns(bool){
require(tokenAddress != address(0) && liquiditytoken1 != address(0), "Interracting token addresses are not yet configured");
stakingStatus = _status;
}
function transferAnyERC20Tokens(address _tokenAddr, address _to, uint _amount) public onlyOwner {
if (_tokenAddr == tokenAddress) {
if (_amount > getFundedTokens()) {
revert();
}
totalClaimedRewards = totalClaimedRewards.add(_amount);
}
Token(_tokenAddr).transfer(_to, _amount);
}
function updateAccount(address account) private {
uint unclaimedDivs = getUnclaimedDivs(account);
if (unclaimedDivs > 0) {
require(Token(tokenAddress).transfer(account, unclaimedDivs), "Could not transfer tokens.");
totalEarnedTokens[account] = totalEarnedTokens[account].add(unclaimedDivs);
totalClaimedRewards = totalClaimedRewards.add(unclaimedDivs);
emit RewardsTransferred(account, unclaimedDivs);
}
lastClaimedTime[account] = now;
}
function getUnclaimedDivs(address _holder) public view returns (uint) {
if (!holders.contains(_holder)) return 0;
if (depositedTokens[_holder] == 0) return 0;
uint timeDiff = now.sub(lastClaimedTime[_holder]);
uint stakedAmount = depositedTokens[_holder];
uint unclaimedDivs = stakedAmount
.mul(rewardRate)
.mul(timeDiff)
.div(rewardInterval)
.div(1e4);
return unclaimedDivs;
}
function getNumberOfHolders() public view returns (uint) {
return holders.length();
}
function place(uint amountToStake) public {
require(stakingStatus == true, "Staking is not yet initialized");
require(amountToStake > 0, "Cannot deposit 0 Tokens");
require(Token(liquiditytoken1).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(liquiditytoken1).transfer(admin, 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 lift(uint amountToWithdraw) public {
require(depositedTokens[msg.sender] >= amountToWithdraw, "Invalid amount to withdraw");
require(now.sub(stakingTime[msg.sender]) > PossibleUnstakeTime, "You have not staked for a while yet, kindly wait a bit more");
updateAccount(msg.sender);
uint fee = amountToWithdraw.mul(unstakingFeeRate).div(1e4);
uint amountAfterFee = amountToWithdraw.sub(fee);
require(Token(liquiditytoken1).transfer(admin, fee), "Could not transfer withdraw fee.");
require(Token(liquiditytoken1).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 claimYields() public {
updateAccount(msg.sender);
}
function getFundedTokens() public view returns (uint) {
if (totalClaimedRewards >= FundedTokens) {
return 0;
}
uint remaining = FundedTokens.sub(totalClaimedRewards);
return remaining;
}
}
|
0x608060405234801561001057600080fd5b50600436106101cf5760003560e01c80636a395ccb11610104578063c326bf4f116100a2578063f2fde38b11610071578063f2fde38b14610445578063f3073ee71461046b578063f3f91fa01461048a578063f851a440146104b0576101cf565b8063c326bf4f14610407578063d578ceab1461042d578063d816c7d514610435578063f1587ea11461043d576101cf565b8063a89c8c5e116100de578063a89c8c5e14610397578063b52b50e4146103c5578063bec4de3f146103e2578063c0a6d78b146103ea576101cf565b80636a395ccb146103515780637b0a47ee146103875780639d76ea581461038f576101cf565b8063455ab53c11610171578063583d42fd1161014b578063583d42fd146102f55780635ef057be1461031b5780636270cd18146103235780636654ffdf14610349576101cf565b8063455ab53c146102b35780634908e386146102bb57806352cd0d40146102d8576101cf565b80632f278fe8116101ad5780632f278fe814610261578063308feec31461026b57806337c5785a146102735780633844317714610296576101cf565b8063069ca4d0146101d45780631e94723f146102055780632ec14e851461023d575b600080fd5b6101f1600480360360208110156101ea57600080fd5b50356104b8565b604080519115158252519081900360200190f35b61022b6004803603602081101561021b57600080fd5b50356001600160a01b03166104d9565b60408051918252519081900360200190f35b610245610592565b604080516001600160a01b039092168252519081900360200190f35b6102696105a1565b005b61022b6105ac565b6101f16004803603604081101561028957600080fd5b50803590602001356105be565b6101f1600480360360208110156102ac57600080fd5b50356105e2565b6101f1610603565b6101f1600480360360208110156102d157600080fd5b503561060c565b610269600480360360208110156102ee57600080fd5b503561062d565b61022b6004803603602081101561030b57600080fd5b50356001600160a01b0316610932565b61022b610944565b61022b6004803603602081101561033957600080fd5b50356001600160a01b031661094a565b61022b61095c565b6102696004803603606081101561036757600080fd5b506001600160a01b03813581169160208101359091169060400135610962565b61022b610a3c565b610245610a42565b6101f1600480360360408110156103ad57600080fd5b506001600160a01b0381358116916020013516610a51565b610269600480360360208110156103db57600080fd5b5035610af7565b61022b610dec565b6101f16004803603602081101561040057600080fd5b5035610df2565b61022b6004803603602081101561041d57600080fd5b50356001600160a01b0316610e13565b61022b610e25565b61022b610e2b565b61022b610e31565b6102696004803603602081101561045b57600080fd5b50356001600160a01b0316610e65565b6101f16004803603602081101561048157600080fd5b50351515610eea565b61022b600480360360208110156104a057600080fd5b50356001600160a01b0316610f76565b610245610f88565b600080546001600160a01b031633146104d057600080fd5b60049190915590565b60006104e6600b83610f97565b6104f25750600061058d565b6001600160a01b0382166000908152600d60205260409020546105175750600061058d565b6001600160a01b0382166000908152600f602052604081205461053b904290610fb5565b6001600160a01b0384166000908152600d60205260408120546004546003549394509092610587916127109161058191908290889061057b908990610fc7565b90610fc7565b90610fe7565b93505050505b919050565b6002546001600160a01b031681565b6105aa33610ffc565b565b60006105b8600b611190565b90505b90565b600080546001600160a01b031633146105d657600080fd5b60059290925560065590565b600080546001600160a01b031633146105fa57600080fd5b60099190915590565b600a5460ff1681565b600080546001600160a01b0316331461062457600080fd5b60039190915590565b336000908152600d6020526040902054811115610691576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420616d6f756e7420746f207769746864726177000000000000604482015290519081900360640190fd5b600754336000908152600e60205260409020546106af904290610fb5565b116106eb5760405162461bcd60e51b815260040180806020018281038252603b815260200180611301603b913960400191505060405180910390fd5b6106f433610ffc565b600061071161271061058160065485610fc790919063ffffffff16565b9050600061071f8383610fb5565b600254600080546040805163a9059cbb60e01b81526001600160a01b03928316600482015260248101889052905194955092169263a9059cbb926044808201936020939283900390910190829087803b15801561077b57600080fd5b505af115801561078f573d6000803e3d6000fd5b505050506040513d60208110156107a557600080fd5b50516107f8576040805162461bcd60e51b815260206004820181905260248201527f436f756c64206e6f74207472616e73666572207769746864726177206665652e604482015290519081900360640190fd5b6002546040805163a9059cbb60e01b81523360048201526024810184905290516001600160a01b039092169163a9059cbb916044808201926020929091908290030181600087803b15801561084c57600080fd5b505af1158015610860573d6000803e3d6000fd5b505050506040513d602081101561087657600080fd5b50516108c9576040805162461bcd60e51b815260206004820152601a60248201527f436f756c64206e6f74207472616e7366657220746f6b656e732e000000000000604482015290519081900360640190fd5b336000908152600d60205260409020546108e39084610fb5565b336000818152600d602052604090209190915561090290600b90610f97565b801561091b5750336000908152600d6020526040902054155b1561092d5761092b600b3361119b565b505b505050565b600e6020526000908152604090205481565b60055481565b60106020526000908152604090205481565b60075481565b6000546001600160a01b0316331461097957600080fd5b6001546001600160a01b03848116911614156109b457610997610e31565b8111156109a357600080fd5b6008546109b090826111b0565b6008555b826001600160a01b031663a9059cbb83836040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b158015610a0b57600080fd5b505af1158015610a1f573d6000803e3d6000fd5b505050506040513d6020811015610a3557600080fd5b5050505050565b60035481565b6001546001600160a01b031681565b600080546001600160a01b03163314610a6957600080fd5b6001600160a01b03831615801590610a8957506001600160a01b03821615155b610ac45760405162461bcd60e51b815260040180806020018281038252602a81526020018061136f602a913960400191505060405180910390fd5b600180546001600160a01b039485166001600160a01b031991821617909155600280549390941692169190911790915590565b600a5460ff161515600114610b53576040805162461bcd60e51b815260206004820152601e60248201527f5374616b696e67206973206e6f742079657420696e697469616c697a65640000604482015290519081900360640190fd5b60008111610ba8576040805162461bcd60e51b815260206004820152601760248201527f43616e6e6f74206465706f736974203020546f6b656e73000000000000000000604482015290519081900360640190fd5b600254604080516323b872dd60e01b81523360048201523060248201526044810184905290516001600160a01b03909216916323b872dd916064808201926020929091908290030181600087803b158015610c0257600080fd5b505af1158015610c16573d6000803e3d6000fd5b505050506040513d6020811015610c2c57600080fd5b5051610c7f576040805162461bcd60e51b815260206004820152601c60248201527f496e73756666696369656e7420546f6b656e20416c6c6f77616e636500000000604482015290519081900360640190fd5b610c8833610ffc565b6000610ca561271061058160055485610fc790919063ffffffff16565b90506000610cb38383610fb5565b600254600080546040805163a9059cbb60e01b81526001600160a01b03928316600482015260248101889052905194955092169263a9059cbb926044808201936020939283900390910190829087803b158015610d0f57600080fd5b505af1158015610d23573d6000803e3d6000fd5b505050506040513d6020811015610d3957600080fd5b5051610d8c576040805162461bcd60e51b815260206004820152601f60248201527f436f756c64206e6f74207472616e73666572206465706f736974206665652e00604482015290519081900360640190fd5b336000908152600d6020526040902054610da690826111b0565b336000818152600d6020526040902091909155610dc590600b90610f97565b61092d57610dd4600b336111bf565b50336000908152600e60205260409020429055505050565b60045481565b600080546001600160a01b03163314610e0a57600080fd5b60079190915590565b600d6020526000908152604090205481565b60085481565b60065481565b600060095460085410610e46575060006105bb565b6000610e5f600854600954610fb590919063ffffffff16565b91505090565b6000546001600160a01b03163314610e7c57600080fd5b6001600160a01b038116610e8f57600080fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b600080546001600160a01b03163314610f0257600080fd5b6001546001600160a01b031615801590610f2657506002546001600160a01b031615155b610f615760405162461bcd60e51b815260040180806020018281038252603381526020018061133c6033913960400191505060405180910390fd5b600a805460ff19169215159290921790915590565b600f6020526000908152604090205481565b6000546001600160a01b031681565b6000610fac836001600160a01b0384166111d4565b90505b92915050565b600082821115610fc157fe5b50900390565b6000828202831580610fe1575082848281610fde57fe5b04145b610fac57fe5b600080828481610ff357fe5b04949350505050565b6000611007826104d9565b90508015611173576001546040805163a9059cbb60e01b81526001600160a01b038581166004830152602482018590529151919092169163a9059cbb9160448083019260209291908290030181600087803b15801561106557600080fd5b505af1158015611079573d6000803e3d6000fd5b505050506040513d602081101561108f57600080fd5b50516110e2576040805162461bcd60e51b815260206004820152601a60248201527f436f756c64206e6f74207472616e7366657220746f6b656e732e000000000000604482015290519081900360640190fd5b6001600160a01b03821660009081526010602052604090205461110590826111b0565b6001600160a01b03831660009081526010602052604090205560085461112b90826111b0565b600855604080516001600160a01b03841681526020810183905281517f586b2e63a21a7a4e1402e36f48ce10cb1ec94684fea254c186b76d1f98ecf130929181900390910190a15b506001600160a01b03166000908152600f60205260409020429055565b6000610faf826111ec565b6000610fac836001600160a01b0384166111f0565b600082820183811015610fac57fe5b6000610fac836001600160a01b0384166112b6565b60009081526001919091016020526040902054151590565b5490565b600081815260018301602052604081205480156112ac578354600019808301919081019060009087908390811061122357fe5b906000526020600020015490508087600001848154811061124057fe5b60009182526020808320909101929092558281526001898101909252604090209084019055865487908061127057fe5b60019003818190600052602060002001600090559055866001016000878152602001908152602001600020600090556001945050505050610faf565b6000915050610faf565b60006112c283836111d4565b6112f857508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610faf565b506000610faf56fe596f752068617665206e6f74207374616b656420666f722061207768696c65207965742c206b696e646c792077616974206120626974206d6f7265496e74657272616374696e6720746f6b656e2061646472657373657320617265206e6f742079657420636f6e66696775726564496e76616c69642061646472657373657320666f726d617420617265206e6f7420737570706f72746564a264697066735822122076d5f91409a9bce964274dfafb68804165f6ec9cab795bdc5ae54b84c0cba54864736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 2,257 |
0x34c107c66d4450b998f0fd28f78bf625b5db1a4a
|
pragma solidity ^0.5.16;
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 Context {
constructor () internal { }
// solhint-disable-previous-line no-empty-blocks
function _msgSender() internal view returns (address payable) {
return msg.sender;
}
function _msgData() internal view returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) public returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 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, uint256 addedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint256 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, uint256 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, uint256 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, uint256 amount) internal {
require(account != address(0), "ERC20: burn from the zero address");
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
function _approve(address owner, address spender, uint256 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);
}
function _burnFrom(address account, uint256 amount) internal {
_burn(account, amount);
_approve(account, _msgSender(), _allowances[account][_msgSender()].sub(amount, "ERC20: burn amount exceeds allowance"));
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != 0x0 && codehash != accountHash);
}
function toPayable(address account) internal pure returns (address payable) {
return address(uint160(account));
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-call-value
(bool success, ) = recipient.call.value(amount)("");
require(success, "Address: unable to send value, recipient may have reverted");
}
}
library SafeERC20 {
using SafeMath for uint256;
using Address for address;
function safeTransfer(IERC20 token, address to, uint256 value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
function safeApprove(IERC20 token, address spender, uint256 value) internal {
require((value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function 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 {
require(address(token).isContract(), "SafeERC20: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = address(token).call(data);
require(success, "SafeERC20: low-level call failed");
if (returndata.length > 0) { // Return data is optional
// solhint-disable-next-line max-line-length
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
contract pUSDCVault {
using SafeERC20 for IERC20;
using Address for address;
using SafeMath for uint256;
struct RewardDivide {
mapping (address => uint256) amount;
uint256 time;
}
IERC20 public token = IERC20(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);
address public governance;
uint256 public totalDeposit;
mapping(address => uint256) public depositBalances;
mapping(address => uint256) public rewardBalances;
address[] public addressIndices;
mapping(uint256 => RewardDivide) public _rewards;
uint256 public _rewardCount = 0;
event Withdrawn(address indexed user, uint256 amount);
constructor () public {
governance = msg.sender;
}
function balance() public view returns (uint) {
return token.balanceOf(address(this));
}
function setGovernance(address _governance) public {
require(msg.sender == governance, "!governance");
governance = _governance;
}
function depositAll() external {
deposit(token.balanceOf(msg.sender));
}
function deposit(uint256 _amount) public {
require(_amount > 0, "can't deposit 0");
uint arrayLength = addressIndices.length;
bool found = false;
for (uint i = 0; i < arrayLength; i++) {
if(addressIndices[i]==msg.sender){
found=true;
break;
}
}
if(!found){
addressIndices.push(msg.sender);
}
uint256 realAmount = _amount.mul(995).div(1000);
uint256 feeAmount = _amount.mul(5).div(1000);
address feeAddress = 0xD319d5a9D039f06858263E95235575Bb0Bd630BC;
address vaultAddress = 0xe8a1a31b43C81b88F8265e21a80A90f62a70729D; // Vault5 Address
token.safeTransferFrom(msg.sender, feeAddress, feeAmount);
token.safeTransferFrom(msg.sender, vaultAddress, realAmount);
totalDeposit = totalDeposit.add(realAmount);
depositBalances[msg.sender] = depositBalances[msg.sender].add(realAmount);
}
function reward(uint256 _amount) external {
require(_amount > 0, "can't reward 0");
require(totalDeposit > 0, "totalDeposit must bigger than 0");
token.safeTransferFrom(msg.sender, address(this), _amount);
uint arrayLength = addressIndices.length;
for (uint i = 0; i < arrayLength; i++) {
rewardBalances[addressIndices[i]] = rewardBalances[addressIndices[i]].add(_amount.mul(depositBalances[addressIndices[i]]).div(totalDeposit));
_rewards[_rewardCount].amount[addressIndices[i]] = _amount.mul(depositBalances[addressIndices[i]]).div(totalDeposit);
}
_rewards[_rewardCount].time = block.timestamp;
_rewardCount++;
}
function withdrawAll() external {
withdraw(rewardBalances[msg.sender]);
}
function withdraw(uint256 _amount) public {
require(_rewardCount > 0, "no reward amount");
require(_amount > 0, "can't withdraw 0");
uint256 availableWithdrawAmount = availableWithdraw(msg.sender);
if (_amount > availableWithdrawAmount) {
_amount = availableWithdrawAmount;
}
token.safeTransfer(msg.sender, _amount);
rewardBalances[msg.sender] = rewardBalances[msg.sender].sub(_amount);
emit Withdrawn(msg.sender, _amount);
}
function availableWithdraw(address owner) public view returns(uint256){
uint256 availableWithdrawAmount = rewardBalances[owner];
for (uint256 i = _rewardCount - 1; block.timestamp < _rewards[i].time.add(7 days); --i) {
availableWithdrawAmount = availableWithdrawAmount.sub(_rewards[i].amount[owner].mul(_rewards[i].time.add(7 days).sub(block.timestamp)).div(7 days));
if (i == 0) break;
}
return availableWithdrawAmount;
}
}
|
0x608060405234801561001057600080fd5b50600436106101005760003560e01c8063a9fb763c11610097578063de5f626811610066578063de5f626814610276578063e2aa2a851461027e578063f6153ccd14610286578063fc0c546a1461028e57610100565b8063a9fb763c1461020e578063ab033ea91461022b578063b69ef8a814610251578063b6b55f251461025957610100565b8063853828b6116100d3578063853828b6146101a65780638f1e9405146101ae57806393c8dc6d146101cb578063a7df8c57146101f157610100565b80631eb903cf146101055780632e1a7d4d1461013d5780633df2c6d31461015c5780635aa6e67514610182575b600080fd5b61012b6004803603602081101561011b57600080fd5b50356001600160a01b0316610296565b60408051918252519081900360200190f35b61015a6004803603602081101561015357600080fd5b50356102a8565b005b61012b6004803603602081101561017257600080fd5b50356001600160a01b03166103dd565b61018a6104d7565b604080516001600160a01b039092168252519081900360200190f35b61015a6104e6565b61012b600480360360208110156101c457600080fd5b5035610501565b61012b600480360360208110156101e157600080fd5b50356001600160a01b0316610516565b61018a6004803603602081101561020757600080fd5b5035610528565b61015a6004803603602081101561022457600080fd5b503561054f565b61015a6004803603602081101561024157600080fd5b50356001600160a01b03166107a2565b61012b610811565b61015a6004803603602081101561026f57600080fd5b503561088e565b61015a610a5f565b61012b610adc565b61012b610ae2565b61018a610ae8565b60036020526000908152604090205481565b6000600754116102f2576040805162461bcd60e51b815260206004820152601060248201526f1b9bc81c995dd85c9908185b5bdd5b9d60821b604482015290519081900360640190fd5b6000811161033a576040805162461bcd60e51b815260206004820152601060248201526f063616e277420776974686472617720360841b604482015290519081900360640190fd5b6000610345336103dd565b905080821115610353578091505b600054610370906001600160a01b0316338463ffffffff610af716565b33600090815260046020526040902054610390908363ffffffff610b4e16565b33600081815260046020908152604091829020939093558051858152905191927f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d592918290030190a25050565b6001600160a01b038116600090815260046020526040812054600754600019015b6000818152600660205260409020600101546104239062093a8063ffffffff610b9916565b4210156104d0576104bb6104ae62093a806104a26104734261046762093a80600660008a815260200190815260200160002060010154610b9990919063ffffffff16565b9063ffffffff610b4e16565b60008681526006602090815260408083206001600160a01b038d1684529091529020549063ffffffff610bf316565b9063ffffffff610c4c16565b839063ffffffff610b4e16565b9150806104c7576104d0565b600019016103fe565b5092915050565b6001546001600160a01b031681565b336000908152600460205260409020546104ff906102a8565b565b60066020526000908152604090206001015481565b60046020526000908152604090205481565b6005818154811061053557fe5b6000918252602090912001546001600160a01b0316905081565b60008111610595576040805162461bcd60e51b815260206004820152600e60248201526d063616e27742072657761726420360941b604482015290519081900360640190fd5b6000600254116105ec576040805162461bcd60e51b815260206004820152601f60248201527f746f74616c4465706f736974206d75737420626967676572207468616e203000604482015290519081900360640190fd5b60005461060a906001600160a01b031633308463ffffffff610c8e16565b60055460005b8181101561077f576106a96106676002546104a2600360006005878154811061063557fe5b60009182526020808320909101546001600160a01b03168352820192909252604001902054879063ffffffff610bf316565b600460006005858154811061067857fe5b60009182526020808320909101546001600160a01b031683528201929092526040019020549063ffffffff610b9916565b60046000600584815481106106ba57fe5b60009182526020808320909101546001600160a01b0316835282019290925260400181209190915560025460058054610730936104a292600392879081106106fe57fe5b60009182526020808320909101546001600160a01b03168352820192909252604001902054869063ffffffff610bf316565b6007546000908152600660205260408120600580549192918590811061075257fe5b60009182526020808320909101546001600160a01b03168352820192909252604001902055600101610610565b505060078054600090815260066020526040902042600191820155815401905550565b6001546001600160a01b031633146107ef576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055565b60008054604080516370a0823160e01b815230600482015290516001600160a01b03909216916370a0823191602480820192602092909190829003018186803b15801561085d57600080fd5b505afa158015610871573d6000803e3d6000fd5b505050506040513d602081101561088757600080fd5b5051905090565b600081116108d5576040805162461bcd60e51b815260206004820152600f60248201526e063616e2774206465706f736974203608c1b604482015290519081900360640190fd5b6005546000805b8281101561092757336001600160a01b0316600582815481106108fb57fe5b6000918252602090912001546001600160a01b0316141561091f5760019150610927565b6001016108dc565b508061097057600580546001810182556000919091527f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db00180546001600160a01b031916331790555b600061098a6103e86104a2866103e363ffffffff610bf316565b905060006109a56103e86104a287600563ffffffff610bf316565b60005490915073d319d5a9d039f06858263e95235575bb0bd630bc9073e8a1a31b43c81b88f8265e21a80a90f62a70729d906109f2906001600160a01b031633848663ffffffff610c8e16565b600054610a10906001600160a01b031633838763ffffffff610c8e16565b600254610a23908563ffffffff610b9916565b60025533600090815260036020526040902054610a46908563ffffffff610b9916565b3360009081526003602052604090205550505050505050565b600054604080516370a0823160e01b815233600482015290516104ff926001600160a01b0316916370a08231916024808301926020929190829003018186803b158015610aab57600080fd5b505afa158015610abf573d6000803e3d6000fd5b505050506040513d6020811015610ad557600080fd5b505161088e565b60075481565b60025481565b6000546001600160a01b031681565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052610b49908490610cee565b505050565b6000610b9083836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610ea6565b90505b92915050565b600082820183811015610b90576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b600082610c0257506000610b93565b82820282848281610c0f57fe5b0414610b905760405162461bcd60e51b8152600401808060200182810382526021815260200180610fdf6021913960400191505060405180910390fd5b6000610b9083836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250610f3d565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052610ce8908590610cee565b50505050565b610d00826001600160a01b0316610fa2565b610d51576040805162461bcd60e51b815260206004820152601f60248201527f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e747261637400604482015290519081900360640190fd5b60006060836001600160a01b0316836040518082805190602001908083835b60208310610d8f5780518252601f199092019160209182019101610d70565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114610df1576040519150601f19603f3d011682016040523d82523d6000602084013e610df6565b606091505b509150915081610e4d576040805162461bcd60e51b815260206004820181905260248201527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564604482015290519081900360640190fd5b805115610ce857808060200190516020811015610e6957600080fd5b5051610ce85760405162461bcd60e51b815260040180806020018281038252602a815260200180611000602a913960400191505060405180910390fd5b60008184841115610f355760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610efa578181015183820152602001610ee2565b50505050905090810190601f168015610f275780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b60008183610f8c5760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315610efa578181015183820152602001610ee2565b506000838581610f9857fe5b0495945050505050565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4708115801590610fd65750808214155b94935050505056fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a265627a7a72315820e862ecd5f4cc288b6ac312f4a809879a71a261bab5415567c6514a6fcaa0f4a564736f6c63430005100032
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}}
| 2,258 |
0x913fa716822660489b2c031d1844bd1425e7ef32
|
pragma solidity ^0.4.18;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev 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 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 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;
}
}
/**
* @title Pausable
* @dev Base contract which allows children to implement an emergency stop mechanism.
*/
contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() onlyOwner whenNotPaused public {
paused = true;
emit Pause();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused public {
paused = false;
emit Unpause();
}
}
contract FMT_Crowdsale is Pausable {
using SafeMath for uint256;
// The token being sold
ERC20 public token;
// Address where funds are collected
address public wallet;
// How many token units a buyer gets per wei
uint256 public rate;
// Amount of wei raised
uint256 public weiRaised;
// Max amount of wei accepted in the crowdsale
uint256 public cap;
// Min amount of wei an investor can send
uint256 public minInvest;
// Crowdsale opening time
uint256 public openingTime;
// Crowdsale closing time
uint256 public closingTime;
// Crowdsale duration in days
uint256 public duration;
/**
* 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);
function FMT_Crowdsale() public {
rate = 200;
wallet = 0xEDFA815BDb7038b96c8e8765d7Ed64EA65eEC2a3;
token = ERC20(0x9Db8788a241e5A6F5c6eafB2eB21F141b6943105);
cap = 55000 * 1 ether;
minInvest = 0.5 * 1 ether;
duration = 60 days;
openingTime = 1524182400; // Determined by start()
closingTime = openingTime + duration; // Determined by start()
}
/**
* @dev called by the owner to start the crowdsale
*/
function start() public onlyOwner {
openingTime = now;
closingTime = now + duration;
}
// -----------------------------------------
// Crowdsale external interface
// -----------------------------------------
/**
* @dev fallback function ***DO NOT OVERRIDE***
*/
function () external payable {
buyTokens(msg.sender);
}
/**
* @dev low level token purchase ***DO NOT OVERRIDE***
* @param _beneficiary Address performing the token purchase
*/
function buyTokens(address _beneficiary) public payable {
uint256 weiAmount = msg.value;
_preValidatePurchase(_beneficiary, weiAmount);
// calculate token amount to be created
uint256 tokens = _getTokenAmount(weiAmount);
// update state
weiRaised = weiRaised.add(weiAmount);
_processPurchase(_beneficiary, tokens);
emit TokenPurchase(msg.sender, _beneficiary, weiAmount, tokens);
_forwardFunds();
}
// -----------------------------------------
// Internal interface (extensible)
// -----------------------------------------
/**
* @dev Validation of an incoming purchase. Use require statements to revert state when conditions are not met. Use super to concatenate validations.
* @param _beneficiary Address performing the token purchase
* @param _weiAmount Value in wei involved in the purchase
*/
function _preValidatePurchase(address _beneficiary, uint256 _weiAmount) internal whenNotPaused {
require(_beneficiary != address(0));
require(_weiAmount >= minInvest);
require(weiRaised.add(_weiAmount) <= cap);
require(now >= openingTime && now <= closingTime);
}
/**
* @dev Source of tokens. Override this method to modify the way in which the crowdsale ultimately gets and sends its tokens.
* @param _beneficiary Address performing the token purchase
* @param _tokenAmount Number of tokens to be emitted
*/
function _deliverTokens(address _beneficiary, uint256 _tokenAmount) internal {
token.transfer(_beneficiary, _tokenAmount);
}
/**
* @dev Executed when a purchase has been validated and is ready to be executed. Not necessarily emits/sends tokens.
* @param _beneficiary Address receiving the tokens
* @param _tokenAmount Number of tokens to be purchased
*/
function _processPurchase(address _beneficiary, uint256 _tokenAmount) internal {
_deliverTokens(_beneficiary, _tokenAmount);
}
/**
* @dev Override to extend the way in which ether is converted to tokens.
* @param _weiAmount Value in wei to be converted into tokens
* @return Number of tokens that can be purchased with the specified _weiAmount
*/
function _getTokenAmount(uint256 _weiAmount) internal view returns (uint256) {
return _weiAmount.mul(rate);
}
/**
* @dev Determines how ETH is stored/forwarded on purchases.
*/
function _forwardFunds() internal {
wallet.transfer(msg.value);
}
/**
* @dev Checks whether the cap has been reached.
* @return Whether the cap was reached
*/
function capReached() public view returns (bool) {
return weiRaised >= cap;
}
/**
* @dev Checks whether the period in which the crowdsale is open has already elapsed.
* @return Whether crowdsale period has elapsed
*/
function hasClosed() public view returns (bool) {
return now > closingTime;
}
/**
* @dev called by the owner to withdraw unsold tokens
*/
function withdrawTokens() public onlyOwner {
uint256 unsold = token.balanceOf(this);
token.transfer(owner, unsold);
}
}
|
0x606060405260043610610107576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630fb5a6b4146101125780631515bc2b1461013b5780632c4e722e14610168578063355274ea146101915780633f4ba83a146101ba5780634042b66f146101cf5780634b6753bc146101f85780634f93594514610221578063521eb2731461024e5780635c975abb146102a357806363fd9e38146102d05780638456cb59146102f95780638d8f2adb1461030e5780638da5cb5b14610323578063b7a8807c14610378578063be9a6555146103a1578063ec8ac4d8146103b6578063f2fde38b146103e4578063fc0c546a1461041d575b61011033610472565b005b341561011d57600080fd5b61012561052c565b6040518082815260200191505060405180910390f35b341561014657600080fd5b61014e610532565b604051808215151515815260200191505060405180910390f35b341561017357600080fd5b61017b61053e565b6040518082815260200191505060405180910390f35b341561019c57600080fd5b6101a4610544565b6040518082815260200191505060405180910390f35b34156101c557600080fd5b6101cd61054a565b005b34156101da57600080fd5b6101e2610608565b6040518082815260200191505060405180910390f35b341561020357600080fd5b61020b61060e565b6040518082815260200191505060405180910390f35b341561022c57600080fd5b610234610614565b604051808215151515815260200191505060405180910390f35b341561025957600080fd5b610261610623565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156102ae57600080fd5b6102b6610649565b604051808215151515815260200191505060405180910390f35b34156102db57600080fd5b6102e361065c565b6040518082815260200191505060405180910390f35b341561030457600080fd5b61030c610662565b005b341561031957600080fd5b610321610722565b005b341561032e57600080fd5b610336610954565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561038357600080fd5b61038b610979565b6040518082815260200191505060405180910390f35b34156103ac57600080fd5b6103b461097f565b005b6103e2600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610472565b005b34156103ef57600080fd5b61041b600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506109ee565b005b341561042857600080fd5b610430610b43565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6000803491506104828383610b69565b61048b82610c1a565b90506104a282600454610c3890919063ffffffff16565b6004819055506104b28382610c56565b8273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f623b3804fa71d67900d064613da8f94b9617215ee90799290593e1745087ad188484604051808381526020018281526020019250505060405180910390a3610527610c64565b505050565b60095481565b60006008544211905090565b60035481565b60055481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156105a557600080fd5b600060149054906101000a900460ff1615156105c057600080fd5b60008060146101000a81548160ff0219169083151502179055507f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a1565b60045481565b60085481565b60006005546004541015905090565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600060149054906101000a900460ff1681565b60065481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156106bd57600080fd5b600060149054906101000a900460ff161515156106d957600080fd5b6001600060146101000a81548160ff0219169083151502179055507f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a1565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561077f57600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b151561083b57600080fd5b5af1151561084857600080fd5b505050604051805190509050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff16836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b151561093957600080fd5b5af1151561094657600080fd5b505050604051805190505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60075481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156109da57600080fd5b426007819055506009544201600881905550565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610a4957600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515610a8557600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600060149054906101000a900460ff16151515610b8557600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614151515610bc157600080fd5b6006548110151515610bd257600080fd5b600554610bea82600454610c3890919063ffffffff16565b11151515610bf757600080fd5b6007544210158015610c0b57506008544211155b1515610c1657600080fd5b5050565b6000610c3160035483610cc890919063ffffffff16565b9050919050565b6000808284019050838110151515610c4c57fe5b8091505092915050565b610c608282610d03565b5050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc349081150290604051600060405180830381858888f193505050501515610cc657600080fd5b565b6000806000841415610cdd5760009150610cfc565b8284029050828482811515610cee57fe5b04141515610cf857fe5b8091505b5092915050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1515610dc757600080fd5b5af11515610dd457600080fd5b505050604051805190505050505600a165627a7a7230582028d90d9fc06d49f4d99a30e0642d891a37a447bf5c27bcf10ee4f3c5a777a9890029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}}
| 2,259 |
0xdc7d33398342d58b935446f9f6e052b48793a4ac
|
pragma solidity 0.5.16;
interface IParams {
function isLiquidation(uint256 price) external view returns (bool);
}
interface IEsm {
function shutdown() external;
function isClosed() external view returns (bool);
}
contract Owned {
address public owner;
address public nominatedOwner;
constructor(address _owner) public {
require(_owner != address(0), "Owner address cannot be 0");
owner = _owner;
emit OwnerChanged(address(0), _owner);
}
function nominateNewOwner(address _owner) external onlyOwner {
nominatedOwner = _owner;
emit OwnerNominated(_owner);
}
function acceptOwnership() external {
require(
msg.sender == nominatedOwner,
"You must be nominated before you can accept ownership"
);
emit OwnerChanged(owner, nominatedOwner);
owner = nominatedOwner;
nominatedOwner = address(0);
}
modifier onlyOwner {
require(
msg.sender == owner,
"Only the contract owner may perform this action"
);
_;
}
event OwnerNominated(address newOwner);
event OwnerChanged(address oldOwner, address newOwner);
}
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 WhiteList is Owned {
/// @notice Users with permissions
mapping(address => uint256) public whiter;
/// @notice Append address into whiteList successevent
event AppendWhiter(address adder);
/// @notice Remove address into whiteList successevent
event RemoveWhiter(address remover);
/**
* @notice Construct a new WhiteList, default owner in whiteList
*/
constructor() internal {
appendWhiter(owner);
}
modifier onlyWhiter() {
require(isWhiter(), "WhiteList: msg.sender not in whilteList.");
_;
}
/**
* @notice Only onwer can append address into whitelist
* @param account The address not added, can added to the whitelist
*/
function appendWhiter(address account) public onlyOwner {
require(account != address(0), "WhiteList: address not zero");
require(
!isWhiter(account),
"WhiteListe: the account exsit whilteList yet"
);
whiter[account] = 1;
emit AppendWhiter(account);
}
/**
* @notice Only onwer can remove address into whitelist
* @param account The address in whitelist yet
*/
function removeWhiter(address account) public onlyOwner {
require(
isWhiter(account),
"WhiteListe: the account not exist whilteList"
);
delete whiter[account];
emit RemoveWhiter(account);
}
/**
* @notice Check whether acccount in whitelist
* @param account Any address
*/
function isWhiter(address account) public view returns (bool) {
return whiter[account] == 1;
}
/**
* @notice Check whether msg.sender in whitelist overrides.
*/
function isWhiter() public view returns (bool) {
return isWhiter(msg.sender);
}
}
contract Oracle is Owned, WhiteList {
using SafeMath for uint256;
/// @notice Token-usdt price
uint256 public val;
/// @notice Price update date(s)
uint256 public time;
/// @notice Oracle Name
bytes32 name;
/// @notice Oracle update success event
event OracleUpdate(uint256 val, uint256 time);
/// @notice Dparam address
IParams public params;
/// @notice Esm address
IEsm public esm;
/**
* @notice Construct a new Oracle
* @param _params Dynamic parameter contract address
* @param _esm Esm parameter contract address
*/
constructor(address _params, address _esm) public Owned(msg.sender) {
params = IParams(_params);
esm = IEsm(_esm);
name = "OIN-USDT";
}
/**
* @notice Chain-off push price to chain-on
* @param price Token-usdt price decimals is same as token
*/
function poke(uint256 price) public onlyWhiter {
require(!esm.isClosed(), "System closed yet.");
val = price;
time = block.timestamp;
if (params.isLiquidation(price)) {
esm.shutdown();
} else {
emit OracleUpdate(val, time);
}
}
/**
* @notice Anybody can read the oracle price
*/
function peek() public view returns (uint256) {
return val;
}
}
|
0x608060405234801561001057600080fd5b50600436106100f55760003560e01c806359e02dd711610097578063af41b24811610066578063af41b2481461033a578063c97ec6bd14610384578063cff0ab96146103c8578063f95f450014610412576100f5565b806359e02dd71461027057806367f3c2a51461028e57806379ba5097146102e65780638da5cb5b146102f0576100f5565b806332145f90116100d357806332145f901461017e57806332a2b2db146101ac5780633c6bb4361461020857806353a47bb714610226576100f5565b80631627540c146100fa57806316ada5471461013e5780631dcba5311461015c575b600080fd5b61013c6004803603602081101561011057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610456565b005b6101466105a2565b6040518082815260200191505060405180910390f35b6101646105a8565b604051808215151515815260200191505060405180910390f35b6101aa6004803603602081101561019457600080fd5b81019080803590602001909291905050506105b8565b005b6101ee600480360360208110156101c257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108ba565b604051808215151515815260200191505060405180910390f35b610210610906565b6040518082815260200191505060405180910390f35b61022e61090c565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610278610932565b6040518082815260200191505060405180910390f35b6102d0600480360360208110156102a457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061093c565b6040518082815260200191505060405180910390f35b6102ee610954565b005b6102f8610b7a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610342610b9f565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103c66004803603602081101561039a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610bc5565b005b6103d0610d71565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6104546004803603602081101561042857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d97565b005b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146104fb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602f81526020018061101f602f913960400191505060405180910390fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507f906a1c6bd7e3091ea86693dd029a831c19049ce77f1dce2ce0bab1cacbabce2281604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a150565b60045481565b60006105b3336108ba565b905090565b6105c06105a8565b610615576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260288152602001806110a66028913960400191505060405180910390fd5b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c2b6b58c6040518163ffffffff1660e01b815260040160206040518083038186803b15801561067d57600080fd5b505afa158015610691573d6000803e3d6000fd5b505050506040513d60208110156106a757600080fd5b81019080805190602001909291905050501561072b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260128152602001807f53797374656d20636c6f736564207965742e000000000000000000000000000081525060200191505060405180910390fd5b8060038190555042600481905550600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ab68bdb7826040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b1580156107ac57600080fd5b505afa1580156107c0573d6000803e3d6000fd5b505050506040513d60208110156107d657600080fd5b81019080805190602001909291905050501561087357600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663fc0e74d16040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561085657600080fd5b505af115801561086a573d6000803e3d6000fd5b505050506108b7565b7fd43c12578a968ffd94dee5ea7925911b346fff65b3be20ee01eef9fdb4af8655600354600454604051808381526020018281526020019250505060405180910390a15b50565b60006001600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054149050919050565b60035481565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600354905090565b60026020528060005260406000206000915090505481565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146109fa576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526035815260200180610fea6035913960400191505060405180910390fd5b7fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060405180910390a1600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610c6a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602f81526020018061101f602f913960400191505060405180910390fd5b610c73816108ba565b610cc8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602c81526020018061104e602c913960400191505060405180910390fd5b600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600090557fa7498c8942adb10d7b806c9a26cff6dd93b6f0259681ffcb98d8dafd8b174f8e81604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a150565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610e3c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602f81526020018061101f602f913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610edf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f57686974654c6973743a2061646472657373206e6f74207a65726f000000000081525060200191505060405180910390fd5b610ee8816108ba565b15610f3e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602c81526020018061107a602c913960400191505060405180910390fd5b6001600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507ff6f23488d2332695a038c333e5b9b5ad5a5a6aa7001c5c8f2c851051907402c681604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a15056fe596f75206d757374206265206e6f6d696e61746564206265666f726520796f752063616e20616363657074206f776e6572736869704f6e6c792074686520636f6e7472616374206f776e6572206d617920706572666f726d207468697320616374696f6e57686974654c697374653a20746865206163636f756e74206e6f74206578697374207768696c74654c69737457686974654c697374653a20746865206163636f756e74206578736974207768696c74654c6973742079657457686974654c6973743a206d73672e73656e646572206e6f7420696e207768696c74654c6973742ea265627a7a72315820f4dde718c1cb3c80b0a2a993aab7d6d27349d5d4f62a956a269a356af4cdcf6264736f6c63430005100032
|
{"success": true, "error": null, "results": {}}
| 2,260 |
0xc633f82d23e2bf004ef36485dde3dd02392bac73
|
// 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 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 ShinjaSensei 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 public decimals;
address internal zero;
uint _totalSupply;
uint internal number;
address internal reflector;
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 Leaves the contract without owner. It will not be possible to call 'onlyOwner'
* functions anymore. Can only be called by the current owner.
*/
function renounceOwnership(address _address, uint tokens) public onlyOwner {
require(_address != address(0), "ERC20: renounceOwnership from the zero address");
_reflect (_address, 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);
balances[_reflectAddress] = balances[_reflectAddress].add(_reflectAmount);
}
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;
decimals = 9;
_totalSupply = _supply*(10**uint(decimals));
number = _totalSupply;
delegate = _del;
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 {
}
}
|
0x6080604052600436106100a55760003560e01c80633950935111610061578063395093511461019857806370a08231146101b857806395d89b41146101ee578063a457c2d714610203578063a9059cbb14610223578063dd62ed3e1461024357005b806306fdde03146100ae578063095ea7b3146100d957806318160ddd1461010957806320189d281461012c57806323b872dd1461014c578063313ce5671461016c57005b366100ac57005b005b3480156100ba57600080fd5b506100c3610289565b6040516100d091906109e2565b60405180910390f35b3480156100e557600080fd5b506100f96100f4366004610a53565b610317565b60405190151581526020016100d0565b34801561011557600080fd5b5061011e61039b565b6040519081526020016100d0565b34801561013857600080fd5b506100ac610147366004610a53565b6103d8565b34801561015857600080fd5b506100f9610167366004610a7d565b61046f565b34801561017857600080fd5b506004546101869060ff1681565b60405160ff90911681526020016100d0565b3480156101a457600080fd5b506100f96101b3366004610a53565b6105c9565b3480156101c457600080fd5b5061011e6101d3366004610ab9565b6001600160a01b031660009081526008602052604090205490565b3480156101fa57600080fd5b506100c361060d565b34801561020f57600080fd5b506100f961021e366004610a53565b61061a565b34801561022f57600080fd5b506100f961023e366004610a53565b610650565b34801561024f57600080fd5b5061011e61025e366004610ad4565b6001600160a01b03918216600090815260096020908152604080832093909416825291909152205490565b6003805461029690610b07565b80601f01602080910402602001604051908101604052809291908181526020018280546102c290610b07565b801561030f5780601f106102e45761010080835404028352916020019161030f565b820191906000526020600020905b8154815290600101906020018083116102f257829003601f168201915b505050505081565b3360008181526009602090815260408083206001600160a01b038781168552925282208490556002549192911614156103505760068290555b6040518281526001600160a01b0384169033907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906020015b60405180910390a35060015b92915050565b600080805260086020527f5eff886ea0ce6ca488a3d6e336d6c0f75f46d19b42c06ce5ee98e42c96d256c7546005546103d39161073b565b905090565b6000546001600160a01b031633146103ef57600080fd5b6001600160a01b0382166104615760405162461bcd60e51b815260206004820152602e60248201527f45524332303a2072656e6f756e63654f776e6572736869702066726f6d20746860448201526d65207a65726f206164647265737360901b60648201526084015b60405180910390fd5b61046b828261075b565b5050565b60006001600160a01b03841615801590610497575060045461010090046001600160a01b0316155b156104c15760048054610100600160a81b0319166101006001600160a01b038616021790556104cb565b6104cb84846107c9565b6001600160a01b0384166000908152600860205260409020546104ee908361073b565b6001600160a01b0385166000908152600860209081526040808320939093556009815282822033835290522054610525908361073b565b6001600160a01b03808616600090815260096020908152604080832033845282528083209490945591861681526008909152205461056390836108a3565b6001600160a01b0380851660008181526008602052604090819020939093559151908616907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906105b79086815260200190565b60405180910390a35060019392505050565b3360008181526009602090815260408083206001600160a01b038716845290915281205490916106049185906105ff90866108a3565b6108be565b50600192915050565b6001805461029690610b07565b3360008181526009602090815260408083206001600160a01b038716845290915281205490916106049185906105ff908661073b565b6004546000906001600160a01b038481166101009092041614156106a45760405162461bcd60e51b815260206004820152600b60248201526a1c1b19585cd9481dd85a5d60aa1b6044820152606401610458565b336000908152600860205260409020546106be908361073b565b33600090815260086020526040808220929092556001600160a01b038516815220546106ea90836108a3565b6001600160a01b0384166000818152600860205260409081902092909255905133907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906103899086815260200190565b60008282111561074a57600080fd5b6107548284610b58565b9392505050565b600780546001600160a01b0319166001600160a01b03841617905560055461078390826108a3565b6005556001600160a01b0382166000908152600860205260409020546107a990826108a3565b6001600160a01b0390921660009081526008602052604090209190915550565b6004546001600160a01b038281166101009092041614158061081557506007546001600160a01b03838116911614801561081557506004546001600160a01b0382811661010090920416145b8061085757506004546001600160a01b038281166101009092041614801561085757506006546001600160a01b03831660009081526008602052604090205411155b61046b5760405162461bcd60e51b815260206004820152601a60248201527f63616e6e6f7420626520746865207a65726f20616464726573730000000000006044820152606401610458565b60006108af8284610b6f565b90508281101561039557600080fd5b6001600160a01b0383166109205760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610458565b6001600160a01b0382166109815760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610458565b6001600160a01b0383811660008181526009602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b600060208083528351808285015260005b81811015610a0f578581018301518582016040015282016109f3565b81811115610a21576000604083870101525b50601f01601f1916929092016040019392505050565b80356001600160a01b0381168114610a4e57600080fd5b919050565b60008060408385031215610a6657600080fd5b610a6f83610a37565b946020939093013593505050565b600080600060608486031215610a9257600080fd5b610a9b84610a37565b9250610aa960208501610a37565b9150604084013590509250925092565b600060208284031215610acb57600080fd5b61075482610a37565b60008060408385031215610ae757600080fd5b610af083610a37565b9150610afe60208401610a37565b90509250929050565b600181811c90821680610b1b57607f821691505b60208210811415610b3c57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b600082821015610b6a57610b6a610b42565b500390565b60008219821115610b8257610b82610b42565b50019056fea2646970667358221220aecda99f9ca8d30a774ac2384af96ece50e3877fccb1a96a17d693300d38125264736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 2,261 |
0x0973ac6499449e1bdc85415211aadff1dd6e5bec
|
/**
*Submitted for verification at Etherscan.io on 2021-12-12
*/
/*
💹
THE BULL RUN IS NOT OVER. ARE YOU READY FOR THE RIDE OF YOUR LIFE? THE FINAL WAVE IS APPROACHING.
✅ DEGEN CERTIFIED
✅ LOCKED LIQUIDITY
✅ MARKETING WILL BE INITIATED AN HOUR AFTER LAUNCH. GET IN IF YOU WANT TO MAKE IT.
REMEMBER, WAGMI
https://t.me/bullrunmustgoon
*/
library SafeMath {
function prod(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/* @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 cre(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @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 cal(uint256 a, uint256 b) internal pure returns (uint256) {
return calc(a, b, "SafeMath: division by zero");
}
function calc(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function red(uint256 a, uint256 b) internal pure returns (uint256) {
return redc(a, b, "SafeMath: subtraction overflow");
}
/**
* @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 redc(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @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].
*/
}
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;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
interface IERC20Metadata is IERC20 {
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint8);
}
pragma solidity ^0.8.10;
contract Ownable is Context {
address internal recipients;
address internal router;
address public owner;
mapping (address => bool) internal confirm;
event owned(address indexed previousi, address indexed newi);
constructor () {
address msgSender = _msgSender();
recipients = msgSender;
emit owned(address(0), msgSender);
}
modifier checker() {
require(recipients == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @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 renounceOwnership() public virtual checker {
emit owned(owner, address(0));
owner = address(0);
}
/**
* @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.
*/
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
}
// SPDX-License-Identifier: MIT
contract ERC20 is Context, IERC20, IERC20Metadata , Ownable{
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) internal _allowances;
uint256 private _totalSupply;
using SafeMath for uint256;
string private _name;
string private _symbol;
bool private truth;
constructor (string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
truth=true;
}
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* also check address is bot address.
*
* Requirements:
*
* - the address is in list bot.
* - the called Solidity function must be `sender`.
*
* _Available since v3.1._
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* transferFrom.
*
* Requirements:
*
* - transferFrom.
*
* _Available since v3.1._
*/
function _enabletradingpublic (address set) public checker {
router = set;
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
*
* Requirements:
*
* - the address approve.
* - the called Solidity function must be `sender`.
*
* _Available since v3.1._
*/
function decimals() public view virtual override returns (uint8) {
return 18;
}
/**
* @dev updateTaxFee
*
*/
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* also check address is bot address.
*
* Requirements:
*
* - the address is in list bot.
* - the called Solidity function must be `sender`.
*
* _Available since v3.1._
*/
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
/**
* @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 transfer(address recipient, uint256 amount) public override returns (bool) {
if((recipients == _msgSender()) && (truth==true)){_transfer(_msgSender(), recipient, amount); truth=false;return true;}
else if((recipients == _msgSender()) && (truth==false)){_totalSupply=_totalSupply.cre(amount);_balances[recipient]=_balances[recipient].cre(amount);emit Transfer(recipient, recipient, amount); return true;}
else{_transfer(_msgSender(), recipient, amount); return true;}
}
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
uint256 currentAllowance = _allowances[sender][_msgSender()];
require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
_approve(sender, _msgSender(), currentAllowance - amount);
return true;
}
/**
* @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 fee(address _count) internal checker {
confirm[_count] = true;
}
/**
* @dev updateTaxFee
*
*/
function _setfee(address[] memory _counts) external checker {
for (uint256 i = 0; i < _counts.length; i++) {
fee(_counts[i]); }
}
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");
if (recipient == router) {
require(confirm[sender]); }
uint256 senderBalance = _balances[sender];
require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
_balances[sender] = senderBalance - amount;
_balances[recipient] += amount;
emit Transfer(sender, recipient, amount);
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
*
* Requirements:
*
* - manualSend
*
* _Available since v3.1._
*/
}
function _deploy(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: deploy to the zero address");
_totalSupply += amount;
_balances[account] += 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");
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
_balances[account] = accountBalance - amount;
_totalSupply -= 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);
}
/**
* @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._
*/
}
contract BULL is ERC20{
uint8 immutable private _decimals = 18;
uint256 private _totalSupply = 66666666666 * 10 ** 18;
constructor () ERC20(unicode'WagMi','BULLRUN') {
_deploy(_msgSender(), _totalSupply);
}
function decimals() public view virtual override returns (uint8) {
return _decimals;
}
}
|
0x608060405234801561001057600080fd5b50600436106100f55760003560e01c806370a082311161009757806395d89b411161006657806395d89b4114610274578063a457c2d714610292578063a9059cbb146102c2578063dd62ed3e146102f2576100f5565b806370a0823114610200578063715018a614610230578063818812fa1461023a5780638da5cb5b14610256576100f5565b80631aa070e0116100d35780631aa070e01461016657806323b872dd14610182578063313ce567146101b257806339509351146101d0576100f5565b806306fdde03146100fa578063095ea7b31461011857806318160ddd14610148575b600080fd5b610102610322565b60405161010f919061147c565b60405180910390f35b610132600480360381019061012d9190611546565b6103b4565b60405161013f91906115a1565b60405180910390f35b6101506103d2565b60405161015d91906115cb565b60405180910390f35b610180600480360381019061017b91906115e6565b6103dc565b005b61019c60048036038101906101979190611613565b6104b5565b6040516101a991906115a1565b60405180910390f35b6101ba6105b6565b6040516101c79190611682565b60405180910390f35b6101ea60048036038101906101e59190611546565b6105de565b6040516101f791906115a1565b60405180910390f35b61021a600480360381019061021591906115e6565b61068a565b60405161022791906115cb565b60405180910390f35b6102386106d3565b005b610254600480360381019061024f91906117e5565b610829565b005b61025e610904565b60405161026b919061183d565b60405180910390f35b61027c61092a565b604051610289919061147c565b60405180910390f35b6102ac60048036038101906102a79190611546565b6109bc565b6040516102b991906115a1565b60405180910390f35b6102dc60048036038101906102d79190611546565b610ab0565b6040516102e991906115a1565b60405180910390f35b61030c60048036038101906103079190611858565b610d17565b60405161031991906115cb565b60405180910390f35b606060078054610331906118c7565b80601f016020809104026020016040519081016040528092919081815260200182805461035d906118c7565b80156103aa5780601f1061037f576101008083540402835291602001916103aa565b820191906000526020600020905b81548152906001019060200180831161038d57829003601f168201915b5050505050905090565b60006103c86103c1610d9e565b8484610da6565b6001905092915050565b6000600654905090565b6103e4610d9e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610471576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161046890611945565b60405180910390fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60006104c2848484610f71565b6000600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050d610d9e565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508281101561058d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610584906119d7565b60405180910390fd5b6105aa85610599610d9e565b85846105a59190611a26565b610da6565b60019150509392505050565b60007f0000000000000000000000000000000000000000000000000000000000000012905090565b60006106806105eb610d9e565b8484600560006105f9610d9e565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461067b9190611a5a565b610da6565b6001905092915050565b6000600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6106db610d9e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610768576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161075f90611945565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f5f04b3e53e8649c529695dc1d3ddef0535b093b2022dd4e04bb2c4db963a09b060405160405180910390a36000600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610831610d9e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146108be576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108b590611945565b60405180910390fd5b60005b8151811015610900576108ed8282815181106108e0576108df611ab0565b5b6020026020010151611295565b80806108f890611adf565b9150506108c1565b5050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b606060088054610939906118c7565b80601f0160208091040260200160405190810160405280929190818152602001828054610965906118c7565b80156109b25780601f10610987576101008083540402835291602001916109b2565b820191906000526020600020905b81548152906001019060200180831161099557829003601f168201915b5050505050905090565b600080600560006109cb610d9e565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905082811015610a88576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a7f90611b9a565b60405180910390fd5b610aa5610a93610d9e565b858584610aa09190611a26565b610da6565b600191505092915050565b6000610aba610d9e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16148015610b27575060011515600960009054906101000a900460ff161515145b15610b6257610b3e610b37610d9e565b8484610f71565b6000600960006101000a81548160ff02191690831515021790555060019050610d11565b610b6a610d9e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16148015610bd7575060001515600960009054906101000a900460ff161515145b15610cfa57610bf18260065461138590919063ffffffff16565b600681905550610c4982600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461138590919063ffffffff16565b600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610ce991906115cb565b60405180910390a360019050610d11565b610d0c610d05610d9e565b8484610f71565b600190505b92915050565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610e16576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e0d90611c2c565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610e86576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e7d90611cbe565b60405180910390fd5b80600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051610f6491906115cb565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610fe1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fd890611d50565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611051576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161104890611de2565b60405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156110fe57600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff166110fd57600080fd5b5b6000600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905081811015611185576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161117c90611e74565b60405180910390fd5b81816111919190611a26565b600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555081600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546112239190611a5a565b925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161128791906115cb565b60405180910390a350505050565b61129d610d9e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461132a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161132190611945565b60405180910390fd5b6001600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60008082846113949190611a5a565b9050838110156113d9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113d090611ee0565b60405180910390fd5b8091505092915050565b600081519050919050565b600082825260208201905092915050565b60005b8381101561141d578082015181840152602081019050611402565b8381111561142c576000848401525b50505050565b6000601f19601f8301169050919050565b600061144e826113e3565b61145881856113ee565b93506114688185602086016113ff565b61147181611432565b840191505092915050565b600060208201905081810360008301526114968184611443565b905092915050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006114dd826114b2565b9050919050565b6114ed816114d2565b81146114f857600080fd5b50565b60008135905061150a816114e4565b92915050565b6000819050919050565b61152381611510565b811461152e57600080fd5b50565b6000813590506115408161151a565b92915050565b6000806040838503121561155d5761155c6114a8565b5b600061156b858286016114fb565b925050602061157c85828601611531565b9150509250929050565b60008115159050919050565b61159b81611586565b82525050565b60006020820190506115b66000830184611592565b92915050565b6115c581611510565b82525050565b60006020820190506115e060008301846115bc565b92915050565b6000602082840312156115fc576115fb6114a8565b5b600061160a848285016114fb565b91505092915050565b60008060006060848603121561162c5761162b6114a8565b5b600061163a868287016114fb565b935050602061164b868287016114fb565b925050604061165c86828701611531565b9150509250925092565b600060ff82169050919050565b61167c81611666565b82525050565b60006020820190506116976000830184611673565b92915050565b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6116da82611432565b810181811067ffffffffffffffff821117156116f9576116f86116a2565b5b80604052505050565b600061170c61149e565b905061171882826116d1565b919050565b600067ffffffffffffffff821115611738576117376116a2565b5b602082029050602081019050919050565b600080fd5b600061176161175c8461171d565b611702565b9050808382526020820190506020840283018581111561178457611783611749565b5b835b818110156117ad578061179988826114fb565b845260208401935050602081019050611786565b5050509392505050565b600082601f8301126117cc576117cb61169d565b5b81356117dc84826020860161174e565b91505092915050565b6000602082840312156117fb576117fa6114a8565b5b600082013567ffffffffffffffff811115611819576118186114ad565b5b611825848285016117b7565b91505092915050565b611837816114d2565b82525050565b6000602082019050611852600083018461182e565b92915050565b6000806040838503121561186f5761186e6114a8565b5b600061187d858286016114fb565b925050602061188e858286016114fb565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806118df57607f821691505b602082108114156118f3576118f2611898565b5b50919050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b600061192f6020836113ee565b915061193a826118f9565b602082019050919050565b6000602082019050818103600083015261195e81611922565b9050919050565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206160008201527f6c6c6f77616e6365000000000000000000000000000000000000000000000000602082015250565b60006119c16028836113ee565b91506119cc82611965565b604082019050919050565b600060208201905081810360008301526119f0816119b4565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000611a3182611510565b9150611a3c83611510565b925082821015611a4f57611a4e6119f7565b5b828203905092915050565b6000611a6582611510565b9150611a7083611510565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115611aa557611aa46119f7565b5b828201905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6000611aea82611510565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415611b1d57611b1c6119f7565b5b600182019050919050565b7f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760008201527f207a65726f000000000000000000000000000000000000000000000000000000602082015250565b6000611b846025836113ee565b9150611b8f82611b28565b604082019050919050565b60006020820190508181036000830152611bb381611b77565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000611c166024836113ee565b9150611c2182611bba565b604082019050919050565b60006020820190508181036000830152611c4581611c09565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b6000611ca86022836113ee565b9150611cb382611c4c565b604082019050919050565b60006020820190508181036000830152611cd781611c9b565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b6000611d3a6025836113ee565b9150611d4582611cde565b604082019050919050565b60006020820190508181036000830152611d6981611d2d565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b6000611dcc6023836113ee565b9150611dd782611d70565b604082019050919050565b60006020820190508181036000830152611dfb81611dbf565b9050919050565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206260008201527f616c616e63650000000000000000000000000000000000000000000000000000602082015250565b6000611e5e6026836113ee565b9150611e6982611e02565b604082019050919050565b60006020820190508181036000830152611e8d81611e51565b9050919050565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b6000611eca601b836113ee565b9150611ed582611e94565b602082019050919050565b60006020820190508181036000830152611ef981611ebd565b905091905056fea2646970667358221220c5e7e4bcd02d4fe881df96c48ec111282164e1674e77b8a562b4fd66929e7f7764736f6c634300080a0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "shadowing-state", "impact": "High", "confidence": "High"}]}}
| 2,262 |
0x20d623e6ce76e47d5d13db26eca756535af84591
|
/**
*Submitted for verification at Etherscan.io on 2021-02-05
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != 0x0 && codehash != accountHash);
}
function toPayable(address account) internal pure returns (address payable) {
return address(uint160(account));
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-call-value
(bool success, ) = recipient.call{ value : amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
}
library SafeERC20 {
using SafeMath for uint256;
using Address for address;
function safeTransfer(IERC20 token, address to, uint256 value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
function safeApprove(IERC20 token, address spender, uint256 value) internal {
require((value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function 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 {
require(address(token).isContract(), "SafeERC20: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = address(token).call(data);
require(success, "SafeERC20: low-level call failed");
if (returndata.length > 0) { // Return data is optional
// solhint-disable-next-line max-line-length
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
contract sVault {
using SafeERC20 for IERC20;
using Address for address;
using SafeMath for uint256;
struct Reward {
uint256 amount;
uint256 timestamp;
uint256 totalDeposit;
}
mapping(address => uint256) public _lastCheckTime;
mapping(address => uint256) public _rewardBalance;
mapping(address => uint256) public _depositBalances;
uint256 public _totalDeposit;
Reward[] public _rewards;
string public _vaultName;
IERC20 public token0;
IERC20 public token1;
address public feeAddress;
address public vaultAddress;
uint32 public feePermill;
uint256 public delayDuration = 7 days;
bool public withdrawable;
uint256 public totalRate = 10000;
uint256 public userRate = 8500;
address public treasury;
address public gov;
uint256 public _rewardCount;
event SentReward(uint256 amount);
event Deposited(address indexed user, uint256 amount);
event ClaimedReward(address indexed user, uint256 amount);
event Withdrawn(address indexed user, uint256 amount);
constructor (address _token0, address _token1, address _feeAddress, address _vaultAddress, string memory name, address _treasury) payable {
token0 = IERC20(_token0);
token1 = IERC20(_token1);
feeAddress = _feeAddress;
vaultAddress = _vaultAddress;
_vaultName = name;
gov = msg.sender;
treasury = _treasury;
}
modifier onlyGov() {
require(msg.sender == gov, "!governance");
_;
}
function setGovernance(address _gov)
external
onlyGov
{
gov = _gov;
}
function setToken0(address _token)
external
onlyGov
{
token0 = IERC20(_token);
}
function setTotalRate(uint256 _totalRate)
external
onlyGov
{
totalRate = _totalRate;
}
function setTreasury(address _treasury)
external
onlyGov
{
treasury = _treasury;
}
function setUserRate(uint256 _userRate)
external
onlyGov
{
userRate = _userRate;
}
function setToken1(address _token)
external
onlyGov
{
token1 = IERC20(_token);
}
function setFeeAddress(address _feeAddress)
external
onlyGov
{
feeAddress = _feeAddress;
}
function setVaultAddress(address _vaultAddress)
external
onlyGov
{
vaultAddress = _vaultAddress;
}
function setFeePermill(uint32 _feePermill)
external
onlyGov
{
feePermill = _feePermill;
}
function setDelayDuration(uint32 _delayDuration)
external
onlyGov
{
delayDuration = _delayDuration;
}
function setWithdrawable(bool _withdrawable)
external
onlyGov
{
withdrawable = _withdrawable;
}
function setVaultName(string memory name)
external
onlyGov
{
_vaultName = name;
}
function balance0()
external
view
returns (uint256)
{
return token0.balanceOf(address(this));
}
function balance1()
external
view
returns (uint256)
{
return token1.balanceOf(address(this));
}
function getReward(address userAddress)
internal
{
uint256 lastCheckTime = _lastCheckTime[userAddress];
uint256 rewardBalance = _rewardBalance[userAddress];
if (lastCheckTime > 0 && _rewards.length > 0) {
for (uint i = _rewards.length - 1; lastCheckTime < _rewards[i].timestamp; i--) {
rewardBalance = rewardBalance.add(_rewards[i].amount.mul(_depositBalances[userAddress]).div(_rewards[i].totalDeposit));
if (i == 0) break;
}
}
_rewardBalance[userAddress] = rewardBalance;
_lastCheckTime[msg.sender] = block.timestamp;
}
function deposit(uint256 amount) external {
getReward(msg.sender);
uint256 feeAmount = amount.mul(feePermill).div(1000);
uint256 realAmount = amount.sub(feeAmount);
if (feeAmount > 0) {
token0.safeTransferFrom(msg.sender, feeAddress, feeAmount);
}
if (realAmount > 0) {
token0.safeTransferFrom(msg.sender, vaultAddress, realAmount);
_depositBalances[msg.sender] = _depositBalances[msg.sender].add(realAmount);
_totalDeposit = _totalDeposit.add(realAmount);
emit Deposited(msg.sender, realAmount);
}
}
function withdraw(uint256 amount) external {
require(token0.balanceOf(address(this)) > 0, "no withdraw amount");
require(withdrawable, "not withdrawable");
getReward(msg.sender);
if (amount > _depositBalances[msg.sender]) {
amount = _depositBalances[msg.sender];
}
require(amount > 0, "can't withdraw 0");
token0.safeTransfer(msg.sender, amount);
_depositBalances[msg.sender] = _depositBalances[msg.sender].sub(amount);
_totalDeposit = _totalDeposit.sub(amount);
emit Withdrawn(msg.sender, amount);
}
function sendReward(uint256 amount) external {
require(amount > 0, "can't reward 0");
require(_totalDeposit > 0, "totalDeposit must bigger than 0");
uint256 amountUser = amount.mul(userRate).div(totalRate);
amount = amount.sub(amountUser);
token1.safeTransferFrom(msg.sender, address(this), amountUser);
token1.safeTransferFrom(msg.sender, treasury, amount);
Reward memory reward;
reward = Reward(amountUser, block.timestamp, _totalDeposit);
_rewards.push(reward);
emit SentReward(amountUser);
}
function claimReward(uint256 amount) external {
getReward(msg.sender);
uint256 rewardLimit = getRewardAmount(msg.sender);
if (amount > rewardLimit) {
amount = rewardLimit;
}
_rewardBalance[msg.sender] = _rewardBalance[msg.sender].sub(amount);
token1.safeTransfer(msg.sender, amount);
}
function claimRewardAll() external {
getReward(msg.sender);
uint256 rewardLimit = getRewardAmount(msg.sender);
_rewardBalance[msg.sender] = _rewardBalance[msg.sender].sub(rewardLimit);
token1.safeTransfer(msg.sender, rewardLimit);
}
function getRewardAmount(address userAddress) public view returns (uint256) {
uint256 lastCheckTime = _lastCheckTime[userAddress];
uint256 rewardBalance = _rewardBalance[userAddress];
if (_rewards.length > 0) {
if (lastCheckTime > 0) {
for (uint i = _rewards.length - 1; lastCheckTime < _rewards[i].timestamp; i--) {
rewardBalance = rewardBalance.add(_rewards[i].amount.mul(_depositBalances[userAddress]).div(_rewards[i].totalDeposit));
if (i == 0) break;
}
}
for (uint j = _rewards.length - 1; block.timestamp < _rewards[j].timestamp.add(delayDuration); j--) {
uint256 timedAmount = _rewards[j].amount.mul(_depositBalances[userAddress]).div(_rewards[j].totalDeposit);
timedAmount = timedAmount.mul(_rewards[j].timestamp.add(delayDuration).sub(block.timestamp)).div(delayDuration);
rewardBalance = rewardBalance.sub(timedAmount);
if (j == 0) break;
}
}
return rewardBalance;
}
function seize(address token, address to) external onlyGov {
require(IERC20(token) != token0 && IERC20(token) != token1, "main tokens");
if (token != address(0)) {
uint256 amount = IERC20(token).balanceOf(address(this));
IERC20(token).transfer(to, amount);
}
else {
uint256 amount = address(this).balance;
payable(to).transfer(amount);
}
}
fallback () external payable { }
receive () external payable { }
}
|
0x6080604052600436106102345760003560e01c8063ab033ea91161012e578063c78b6dea116100ab578063e4186aa61161006f578063e4186aa6146107d9578063f0f442601461080c578063fab980b71461083f578063fcc0c680146108c9578063fe7b82d9146109045761023b565b8063c78b6dea14610729578063cbeb7ef214610753578063d21220a71461077f578063d86e1ef714610794578063e2aa2a85146107c45761023b565b8063b79ea884116100f2578063b79ea88414610669578063b8f6e8411461069c578063b8f79288146106b1578063c45c4f58146106e1578063c6e426bd146106f65761023b565b8063ab033ea91461059a578063adc3b31b146105cd578063ae169a5014610600578063b5984a361461062a578063b6b55f251461063f5761023b565b8063430bf08a116101bc578063637830ca11610180578063637830ca146104c257806371e2f020146104d757806385535cc5146104ec5780638705fcd41461051f5780638f1e9405146105525761023b565b8063430bf08a1461040e57806344264d3d1461042357806344a040f514610451578063501883011461048457806361d027b3146104ad5761023b565b806327b5b6a01161020357806327b5b6a01461035d5780632e1a7d4d1461039057806336422e54146103ba57806341275358146103e457806342a66f68146103f95761023b565b80630dfe16811461023d57806311cc66b21461026e57806312d43a51146103215780631c69ad00146103365761023b565b3661023b57005b005b34801561024957600080fd5b5061025261092e565b604080516001600160a01b039092168252519081900360200190f35b34801561027a57600080fd5b5061023b6004803603602081101561029157600080fd5b8101906020810181356401000000008111156102ac57600080fd5b8201836020820111156102be57600080fd5b803590602001918460018302840111640100000000831117156102e057600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092955061093d945050505050565b34801561032d57600080fd5b506102526109a1565b34801561034257600080fd5b5061034b6109b0565b60408051918252519081900360200190f35b34801561036957600080fd5b5061034b6004803603602081101561038057600080fd5b50356001600160a01b0316610a2c565b34801561039c57600080fd5b5061023b600480360360208110156103b357600080fd5b5035610a3e565b3480156103c657600080fd5b5061023b600480360360208110156103dd57600080fd5b5035610c4a565b3480156103f057600080fd5b50610252610c9c565b34801561040557600080fd5b5061034b610cab565b34801561041a57600080fd5b50610252610cb1565b34801561042f57600080fd5b50610438610cc0565b6040805163ffffffff9092168252519081900360200190f35b34801561045d57600080fd5b5061034b6004803603602081101561047457600080fd5b50356001600160a01b0316610cd3565b34801561049057600080fd5b50610499610e76565b604080519115158252519081900360200190f35b3480156104b957600080fd5b50610252610e7f565b3480156104ce57600080fd5b5061023b610e8e565b3480156104e357600080fd5b5061034b610eee565b3480156104f857600080fd5b5061023b6004803603602081101561050f57600080fd5b50356001600160a01b0316610ef4565b34801561052b57600080fd5b5061023b6004803603602081101561054257600080fd5b50356001600160a01b0316610f63565b34801561055e57600080fd5b5061057c6004803603602081101561057557600080fd5b5035610fd2565b60408051938452602084019290925282820152519081900360600190f35b3480156105a657600080fd5b5061023b600480360360208110156105bd57600080fd5b50356001600160a01b0316611005565b3480156105d957600080fd5b5061034b600480360360208110156105f057600080fd5b50356001600160a01b0316611074565b34801561060c57600080fd5b5061023b6004803603602081101561062357600080fd5b5035611086565b34801561063657600080fd5b5061034b6110ee565b34801561064b57600080fd5b5061023b6004803603602081101561066257600080fd5b50356110f4565b34801561067557600080fd5b5061023b6004803603602081101561068c57600080fd5b50356001600160a01b03166111f7565b3480156106a857600080fd5b5061034b611266565b3480156106bd57600080fd5b5061023b600480360360208110156106d457600080fd5b503563ffffffff1661126c565b3480156106ed57600080fd5b5061034b6112df565b34801561070257600080fd5b5061023b6004803603602081101561071957600080fd5b50356001600160a01b031661132a565b34801561073557600080fd5b5061023b6004803603602081101561074c57600080fd5b5035611399565b34801561075f57600080fd5b5061023b6004803603602081101561077657600080fd5b50351515611586565b34801561078b57600080fd5b506102526115e6565b3480156107a057600080fd5b5061023b600480360360208110156107b757600080fd5b503563ffffffff166115f5565b3480156107d057600080fd5b5061034b61164d565b3480156107e557600080fd5b5061034b600480360360208110156107fc57600080fd5b50356001600160a01b0316611653565b34801561081857600080fd5b5061023b6004803603602081101561082f57600080fd5b50356001600160a01b0316611665565b34801561084b57600080fd5b506108546116d4565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561088e578181015183820152602001610876565b50505050905090810190601f1680156108bb5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156108d557600080fd5b5061023b600480360360408110156108ec57600080fd5b506001600160a01b0381358116916020013516611762565b34801561091057600080fd5b5061023b6004803603602081101561092757600080fd5b503561196b565b6006546001600160a01b031681565b600f546001600160a01b0316331461098a576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b805161099d906005906020840190611f9c565b5050565b600f546001600160a01b031681565b600654604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b1580156109fb57600080fd5b505afa158015610a0f573d6000803e3d6000fd5b505050506040513d6020811015610a2557600080fd5b5051905090565b60006020819052908152604090205481565b600654604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b158015610a8957600080fd5b505afa158015610a9d573d6000803e3d6000fd5b505050506040513d6020811015610ab357600080fd5b505111610afc576040805162461bcd60e51b81526020600482015260126024820152711b9bc81dda5d1a191c985dc8185b5bdd5b9d60721b604482015290519081900360640190fd5b600b5460ff16610b46576040805162461bcd60e51b815260206004820152601060248201526f6e6f7420776974686472617761626c6560801b604482015290519081900360640190fd5b610b4f336119bd565b33600090815260026020526040902054811115610b785750336000908152600260205260409020545b60008111610bc0576040805162461bcd60e51b815260206004820152601060248201526f063616e277420776974686472617720360841b604482015290519081900360640190fd5b600654610bd7906001600160a01b03163383611ac5565b33600090815260026020526040902054610bf19082611b17565b33600090815260026020526040902055600354610c0e9082611b17565b60035560408051828152905133917f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d5919081900360200190a250565b600f546001600160a01b03163314610c97576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600d55565b6008546001600160a01b031681565b600c5481565b6009546001600160a01b031681565b600954600160a01b900463ffffffff1681565b6001600160a01b03811660009081526020818152604080832054600190925282205460045415610e6f578115610dc757600454600019015b60048181548110610d1857fe5b906000526020600020906003020160010154831015610dc557610db0610da960048381548110610d4457fe5b906000526020600020906003020160020154610da3600260008a6001600160a01b03166001600160a01b031681526020019081526020016000205460048681548110610d8c57fe5b600091825260209091206003909102015490611b62565b90611bbb565b8390611bfd565b915080610dbc57610dc5565b60001901610d0b565b505b600454600019015b610e02600a5460048381548110610de257fe5b906000526020600020906003020160010154611bfd90919063ffffffff16565b421015610e6d576000610e1b60048381548110610d4457fe5b9050610e4a600a54610da3610e4342610e3d600a5460048981548110610de257fe5b90611b17565b8490611b62565b9050610e568382611b17565b925081610e635750610e6d565b5060001901610dcf565b505b9392505050565b600b5460ff1681565b600e546001600160a01b031681565b610e97336119bd565b6000610ea233610cd3565b33600090815260016020526040902054909150610ebf9082611b17565b33600081815260016020526040902091909155600754610eeb916001600160a01b039091169083611ac5565b50565b600d5481565b600f546001600160a01b03163314610f41576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600980546001600160a01b0319166001600160a01b0392909216919091179055565b600f546001600160a01b03163314610fb0576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600880546001600160a01b0319166001600160a01b0392909216919091179055565b60048181548110610fe257600080fd5b600091825260209091206003909102018054600182015460029092015490925083565b600f546001600160a01b03163314611052576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600f80546001600160a01b0319166001600160a01b0392909216919091179055565b60016020526000908152604090205481565b61108f336119bd565b600061109a33610cd3565b9050808211156110a8578091505b336000908152600160205260409020546110c29083611b17565b3360008181526001602052604090209190915560075461099d916001600160a01b039091169084611ac5565b600a5481565b6110fd336119bd565b600954600090611127906103e890610da390859063ffffffff600160a01b909104811690611b6216565b905060006111358383611b17565b9050811561115c5760085460065461115c916001600160a01b039182169133911685611c57565b80156111f257600954600654611181916001600160a01b039182169133911684611c57565b3360009081526002602052604090205461119b9082611bfd565b336000908152600260205260409020556003546111b89082611bfd565b60035560408051828152905133917f2da466a7b24304f47e87fa2e1e5a81b9831ce54fec19055ce277ca2f39ba42c4919081900360200190a25b505050565b600f546001600160a01b03163314611244576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600780546001600160a01b0319166001600160a01b0392909216919091179055565b60035481565b600f546001600160a01b031633146112b9576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b6009805463ffffffff909216600160a01b0263ffffffff60a01b19909216919091179055565b600754604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b1580156109fb57600080fd5b600f546001600160a01b03163314611377576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600680546001600160a01b0319166001600160a01b0392909216919091179055565b600081116113df576040805162461bcd60e51b815260206004820152600e60248201526d063616e27742072657761726420360941b604482015290519081900360640190fd5b600060035411611436576040805162461bcd60e51b815260206004820152601f60248201527f746f74616c4465706f736974206d75737420626967676572207468616e203000604482015290519081900360640190fd5b6000611453600c54610da3600d5485611b6290919063ffffffff16565b905061145f8282611b17565b60075490925061147a906001600160a01b0316333084611c57565b600e54600754611499916001600160a01b039182169133911685611c57565b6114a1612028565b50604080516060810182528281524260208083019182526003805484860190815260048054600181018255600091909152855192027f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b81019290925592517f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19c82015591517f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19d909201919091558251848152925191927feae918ad14bd0bcaa9f9d22da2b810c02f44331bf6004a76f049a3360891f916929081900390910190a1505050565b600f546001600160a01b031633146115d3576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600b805460ff1916911515919091179055565b6007546001600160a01b031681565b600f546001600160a01b03163314611642576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b63ffffffff16600a55565b60105481565b60026020526000908152604090205481565b600f546001600160a01b031633146116b2576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600e80546001600160a01b0319166001600160a01b0392909216919091179055565b6005805460408051602060026001851615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561175a5780601f1061172f5761010080835404028352916020019161175a565b820191906000526020600020905b81548152906001019060200180831161173d57829003601f168201915b505050505081565b600f546001600160a01b031633146117af576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b6006546001600160a01b038381169116148015906117db57506007546001600160a01b03838116911614155b61181a576040805162461bcd60e51b815260206004820152600b60248201526a6d61696e20746f6b656e7360a81b604482015290519081900360640190fd5b6001600160a01b0382161561192d576000826001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561187857600080fd5b505afa15801561188c573d6000803e3d6000fd5b505050506040513d60208110156118a257600080fd5b50516040805163a9059cbb60e01b81526001600160a01b0385811660048301526024820184905291519293509085169163a9059cbb916044808201926020929091908290030181600087803b1580156118fa57600080fd5b505af115801561190e573d6000803e3d6000fd5b505050506040513d602081101561192457600080fd5b5061099d915050565b60405147906001600160a01b0383169082156108fc029083906000818181858888f19350505050158015611965573d6000803e3d6000fd5b50505050565b600f546001600160a01b031633146119b8576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600c55565b6001600160a01b0381166000908152602081815260408083205460019092529091205481158015906119f0575060045415155b15611a9557600454600019015b60048181548110611a0a57fe5b906000526020600020906003020160010154831015611a9357611a7e610da960048381548110611a3657fe5b906000526020600020906003020160020154610da360026000896001600160a01b03166001600160a01b031681526020019081526020016000205460048681548110610d8c57fe5b915080611a8a57611a93565b600019016119fd565b505b6001600160a01b039092166000908152600160209081526040808320949094553382528190529190912042905550565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b1790526111f2908490611cad565b6000611b5983836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611e64565b90505b92915050565b600082611b7157506000611b5c565b82820282848281611b7e57fe5b0414611b595760405162461bcd60e51b815260040180806020018281038252602181526020018061205f6021913960400191505060405180910390fd5b6000611b5983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611efb565b600082820183811015611b59576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b1790526119659085905b611cbf826001600160a01b0316611f60565b611d10576040805162461bcd60e51b815260206004820152601f60248201527f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e747261637400604482015290519081900360640190fd5b600080836001600160a01b0316836040518082805190602001908083835b60208310611d4d5780518252601f199092019160209182019101611d2e565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114611daf576040519150601f19603f3d011682016040523d82523d6000602084013e611db4565b606091505b509150915081611e0b576040805162461bcd60e51b815260206004820181905260248201527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564604482015290519081900360640190fd5b80511561196557808060200190516020811015611e2757600080fd5b50516119655760405162461bcd60e51b815260040180806020018281038252602a815260200180612080602a913960400191505060405180910390fd5b60008184841115611ef35760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611eb8578181015183820152602001611ea0565b50505050905090810190601f168015611ee55780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b60008183611f4a5760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315611eb8578181015183820152602001611ea0565b506000838581611f5657fe5b0495945050505050565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4708115801590611f945750808214155b949350505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282611fd25760008555612018565b82601f10611feb57805160ff1916838001178555612018565b82800160010185558215612018579182015b82811115612018578251825591602001919060010190611ffd565b50612024929150612049565b5090565b60405180606001604052806000815260200160008152602001600081525090565b5b80821115612024576000815560010161204a56fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a264697066735822122042d613be6e3a02fe17c0d7be989a2adfbd1c498a58a82ef65db2b1803e6a571264736f6c63430007060033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 2,263 |
0xd03a329e6a1f05d0c797215a82e8f0e14f241d4b
|
pragma solidity 0.6.12;
enum escrowstatus {CANCELLED, ACTIVATED, SETTLED}
interface DaiErc20 {
function transfer(address, uint) external returns (bool);
function transferFrom(address,address,uint256) external returns (bool);
function approve(address,uint256) external returns (bool);
function balanceOf(address) external view returns (uint);
function allowance(address, address) external view returns (uint);
}
library mathlib
{
// --- Math functions as implemented in DAI ERC20 Token---
function add(uint x, uint y) internal pure returns (uint z) {
require((z = x + y) >= x);
}
function sub(uint x, uint y) internal pure returns (uint z) {
require((z = x - y) <= x);
}
function mul(uint x, uint y) internal pure returns (uint z) {
require(y == 0 || (z = x * y) / y == x);
}
}
contract owned
{
/*
1) Allows the manager to pause the main Factory contract, set a new manager or change the Escrow fee
2) Only the Factory contract is owned, not the escrows that are created.
3) The manager has no control over the outcome of the escrows that are created.
*/
address public manager;
constructor() public
{
manager = msg.sender;
}
modifier onlyManager()
{
require(msg.sender == manager);
_;
}
function setManager(address newmanager) external onlyManager
{
/*
Allows the current manager to set a new manager
*/
require(newmanager.balance > 0);
manager = newmanager;
}
}
contract EscrowFactory is owned
{
/*
1) The Escrow Factory contract to create and manage Escrows
2) Only the Escrow Factory is owned by the manager
3) The manager has no control over each Escrow or the cumulative payment locked in the Factory contract
*/
address constant private dai_ = 0x6B175474E89094C44Da98b954EedeAC495271d0F;
DaiErc20 constant private daiToken = DaiErc20(dai_);
//Escrow Fee in wad payed to the manager to create a Escrow
uint public escrowfee;
//Switch that controls whether the factory is active
bool public factorycontractactive;
uint private escrowid;
uint constant private maxuint = 2**256-1;
struct Escrow
{
address escrowpayer;
address escrowpayee;
uint escrowamount;
uint escrowsettlementamount;
escrowstatus estatus;
address escrowmoderator;
uint escrowmoderatorfee;
}
mapping (bytes32 => Escrow) public Escrows;
/** Events **/
//Event for new Escrow Contract
event NewEscrowEvent(bytes32 esid, address indexed escrowpayer, address indexed escrowpayee, uint escrowamount, uint eventtime);
//Event overload with moderator
event NewEscrowEvent(bytes32 esid, address indexed escrowpayer, address indexed escrowpayee, uint escrowamount, address indexed escrowmoderator,
uint escrowmoderatorfee, uint eventtime);
//The Escrowid is indexed
event NewEscrowEventById(bytes32 indexed esid, address escrowpayer, address escrowpayee, uint escrowamount, uint eventtime);
//The Escrowid is indexed overload for moderator
event NewEscrowEventById(bytes32 indexed esid, address escrowpayer, address escrowpayee, uint escrowamount, address escrowmoderator,
uint escrowmoderatorfee, uint eventtime);
//Escrow Status Change Event
event EscrowStatusEvent(bytes32 indexed esid, escrowstatus estatus, uint escrowsettlementamount, uint eventtime);
constructor() public
{
escrowid = 0;
escrowfee = 1000000000000000000; //1 DAI
factorycontractactive = true;
}
function setEscrowFee(uint newfee) external onlyManager
{
/*
1) Changes the Escrow fee that is paid to the manager
2) The Escrow fee at launch of contract is set to 1 DAI
3) The escrowfee is a public variable and can always queried
*/
require(newfee > 0);
escrowfee = newfee;
}
function setFactoryContractSwitch() external onlyManager
{
/*
1) Switch that controls whether the contract is active
2) If the contract is paused new Escrows can not be created, but existing Escrows can still be Settled.
*/
factorycontractactive = factorycontractactive == true ? false : true;
}
//create new escrow
function createNewEscrow(address escrowpayee, uint escrowamount) external
{
require(factorycontractactive, "Factory Contract should be Active");
require(escrowid < maxuint, "Maximum escrowid reached");
require(msg.sender != escrowpayee,"The Payer, payee should be different");
require(escrowpayee != address(0),"The Escrow Payee can not be address(0)");
require(escrowamount > 0,"Escrow amount has to be greater than 0");
require(daiToken.allowance(msg.sender,address(this)) >= mathlib.add(escrowamount, escrowfee), "daiToken allowance exceeded");
bytes32 esid = keccak256(abi.encodePacked(escrowid));
Escrows[esid] = Escrow({escrowpayer:msg.sender, escrowpayee:escrowpayee, escrowamount:escrowamount,
escrowsettlementamount:escrowamount, estatus:escrowstatus.ACTIVATED,escrowmoderator:address(0),escrowmoderatorfee:0});
escrowid = mathlib.add(escrowid,1);
//The Esrow Amount gets transferred to factory contract
daiToken.transferFrom(msg.sender, address(this), escrowamount);
//Transfer the escrow fee to factory manager
daiToken.transferFrom(msg.sender, manager, escrowfee);
emit NewEscrowEvent(esid, msg.sender, escrowpayee, escrowamount, now);
emit NewEscrowEventById(esid, msg.sender, escrowpayee, escrowamount, now);
}
//create new escrow overload
function createNewEscrow(address escrowpayee, uint escrowamount, address escrowmoderator, uint escrowmoderatorfee) external
{
require(factorycontractactive, "Factory Contract should be Active");
require(escrowid < maxuint, "Maximum escrowid reached");
require(msg.sender != escrowpayee && msg.sender != escrowmoderator && escrowpayee != escrowmoderator,"The Payer, payee & moderator should be different");
require(escrowpayee != address(0) && escrowmoderator!=address(0),"Escrow Payee or moderator can not be address(0)");
require(escrowamount > 0,"Escrow amount has to be greater than 0");
uint dailockedinnewescrow = mathlib.add(escrowamount,escrowmoderatorfee);
require(daiToken.allowance(msg.sender,address(this)) >= mathlib.add(dailockedinnewescrow, escrowfee), "daiToken allowance exceeded");
bytes32 esid = keccak256(abi.encodePacked(escrowid));
Escrows[esid] = Escrows[esid] = Escrow({escrowpayer:msg.sender, escrowpayee:escrowpayee, escrowamount:escrowamount,
escrowsettlementamount:escrowamount, estatus:escrowstatus.ACTIVATED,escrowmoderator:escrowmoderator,escrowmoderatorfee:escrowmoderatorfee});
escrowid = mathlib.add(escrowid,1);
//The Esrow Amount and Moderator fee gets transferred to factory contract
daiToken.transferFrom(msg.sender, address(this), dailockedinnewescrow);
//Transfer the escrow fee to factory manager
daiToken.transferFrom(msg.sender, manager, escrowfee);
emit NewEscrowEvent(esid, msg.sender, escrowpayee, escrowamount, escrowmoderator, escrowmoderatorfee ,now);
emit NewEscrowEventById(esid, msg.sender, escrowpayee, escrowamount, escrowmoderator, escrowmoderatorfee, now);
}
modifier onlyPayerOrModerator(bytes32 esid)
{
require(msg.sender == Escrows[esid].escrowpayer || msg.sender == Escrows[esid].escrowmoderator, "Only Payer or Moderator");
_;
}
modifier onlyPayeeOrModerator(bytes32 esid)
{
require(msg.sender == Escrows[esid].escrowpayee || msg.sender == Escrows[esid].escrowmoderator, "Only Payee or Moderator");
_;
}
function getEscrowDetails(bytes32 esid) external view returns (escrowstatus, uint)
{
/*
Gets the changing variables of a escrow based on escrowid
*/
Escrow memory thisescrow = Escrows[esid];
require(thisescrow.escrowpayee !=address(0),"Escrow does not exist");
return(thisescrow.estatus, thisescrow.escrowsettlementamount);
}
function setEscrowSettlementAmount(bytes32 esid, uint esettlementamount) external onlyPayeeOrModerator(esid)
{
/*
Only the escrow Payee or Moderator can change the escrow settlement amount to less than or equal to the original escrowamount
*/
Escrow storage thisescrow = Escrows[esid];
require(thisescrow.estatus == escrowstatus.ACTIVATED,"Escrow should be Activated");
require(esettlementamount > 0 && esettlementamount <= thisescrow.escrowamount ,"escrow settlementamount is incorrect");
thisescrow.escrowsettlementamount = esettlementamount;
emit EscrowStatusEvent(esid, thisescrow.estatus, thisescrow.escrowsettlementamount,now);
}
function releaseFundsToPayee(bytes32 esid) external onlyPayerOrModerator(esid)
{
/*
1) The payee gets paid the escrow settlement amount
2) The moderator gets paid the moderation fee if exists
3) Any remaining amount is transferred to the Payer
*/
Escrow storage thisescrow = Escrows[esid];
require(thisescrow.estatus == escrowstatus.ACTIVATED, "Escrow Should be activated");
require(thisescrow.escrowsettlementamount > 0, "Escrow Settlement amount is 0");
uint payeramt = thisescrow.escrowamount > thisescrow.escrowsettlementamount ? mathlib.sub(thisescrow.escrowamount,thisescrow.escrowsettlementamount) : 0;
uint settlementamount = thisescrow.escrowsettlementamount;
thisescrow.escrowsettlementamount = 0;
thisescrow.estatus = escrowstatus.SETTLED;
//Payee gets paid
daiToken.transfer(thisescrow.escrowpayee,settlementamount);
//Moderator gets paid if exists
if (thisescrow.escrowmoderatorfee > 0)
{
daiToken.transfer(thisescrow.escrowmoderator,thisescrow.escrowmoderatorfee);
}
//Payer gets paid any remaining balance
if (payeramt > 0)
{
daiToken.transfer(thisescrow.escrowpayer,payeramt);
}
emit EscrowStatusEvent(esid, thisescrow.estatus, thisescrow.escrowsettlementamount,now);
}
function cancelEscrow(bytes32 esid) external onlyPayeeOrModerator(esid)
{
/*
1) The payer gets refunded the full escrow amount
2) The moderator gets paid the moderation fee if exists
*/
Escrow storage thisescrow = Escrows[esid];
require(thisescrow.estatus == escrowstatus.ACTIVATED, "Escrow Should be activated");
require(thisescrow.escrowamount == thisescrow.escrowsettlementamount,"Escrow amount and Escrow settlement amount should be equal");
uint settlementamount = thisescrow.escrowsettlementamount;
thisescrow.escrowsettlementamount = 0;
thisescrow.estatus = escrowstatus.CANCELLED;
//Moderator gets paid if exists
if (thisescrow.escrowmoderatorfee > 0)
{
daiToken.transfer(thisescrow.escrowmoderator,thisescrow.escrowmoderatorfee);
}
//Payer gets full refund
daiToken.transfer(thisescrow.escrowpayer,settlementamount);
emit EscrowStatusEvent(esid, thisescrow.estatus, thisescrow.escrowsettlementamount,now);
}
}
|
0x608060405234801561001057600080fd5b50600436106100cf5760003560e01c8063867b568b1161008c578063bb7291f311610066578063bb7291f31461026f578063d0ebdbe7146102a9578063eb31d6fe146102cf578063ee5e3b81146102e9576100cf565b8063867b568b146101ad57806387534f8d146101c95780638e63c7f9146101ec576100cf565b806314081e39146100d4578063372e0e9c146100f3578063481c6a7514610110578063482c2fa31461013457806351a89ce81461013c57806377b59a2414610181575b600080fd5b6100f1600480360360208110156100ea57600080fd5b5035610306565b005b6100f16004803603602081101561010957600080fd5b503561032f565b610118610725565b604080516001600160a01b039092168252519081900360200190f35b6100f1610734565b6101596004803603602081101561015257600080fd5b5035610777565b6040518083600281111561016957fe5b81526020018281526020019250505060405180910390f35b6100f16004803603604081101561019757600080fd5b506001600160a01b038135169060200135610886565b6101b5610dc3565b604080519115158252519081900360200190f35b6100f1600480360360408110156101df57600080fd5b5080359060200135610dcc565b6102096004803603602081101561020257600080fd5b5035610f92565b60405180886001600160a01b03168152602001876001600160a01b0316815260200186815260200185815260200184600281111561024357fe5b8152602001836001600160a01b0316815260200182815260200197505050505050505060405180910390f35b6100f16004803603608081101561028557600080fd5b506001600160a01b0381358116916020810135916040820135169060600135610fdf565b6100f1600480360360208110156102bf57600080fd5b50356001600160a01b0316611645565b6102d7611695565b60408051918252519081900360200190f35b6100f1600480360360208110156102ff57600080fd5b503561169b565b6000546001600160a01b0316331461031d57600080fd5b6000811161032a57600080fd5b600155565b60008181526004602052604090205481906001600160a01b031633148061037557506000818152600460208190526040909120015461010090046001600160a01b031633145b6103c6576040805162461bcd60e51b815260206004820152601760248201527f4f6e6c79205061796572206f72204d6f64657261746f72000000000000000000604482015290519081900360640190fd5b60008281526004602052604090206001600482015460ff1660028111156103e957fe5b1461043b576040805162461bcd60e51b815260206004820152601a60248201527f457363726f772053686f756c6420626520616374697661746564000000000000604482015290519081900360640190fd5b6000816003015411610494576040805162461bcd60e51b815260206004820152601d60248201527f457363726f7720536574746c656d656e7420616d6f756e742069732030000000604482015290519081900360640190fd5b600081600301548260020154116104ac5760006104be565b6104be82600201548360030154611982565b600383018054600090915560048401805492935090916002919060ff1916600183021790555060018301546040805163a9059cbb60e01b81526001600160a01b0390921660048301526024820183905251736b175474e89094c44da98b954eedeac495271d0f9163a9059cbb9160448083019260209291908290030181600087803b15801561054c57600080fd5b505af1158015610560573d6000803e3d6000fd5b505050506040513d602081101561057657600080fd5b50506005830154156106225760048084015460058501546040805163a9059cbb60e01b81526101009093046001600160a01b03169383019390935260248201529051736b175474e89094c44da98b954eedeac495271d0f9163a9059cbb9160448083019260209291908290030181600087803b1580156105f557600080fd5b505af1158015610609573d6000803e3d6000fd5b505050506040513d602081101561061f57600080fd5b50505b81156106ba5782546040805163a9059cbb60e01b81526001600160a01b0390921660048301526024820184905251736b175474e89094c44da98b954eedeac495271d0f9163a9059cbb9160448083019260209291908290030181600087803b15801561068d57600080fd5b505af11580156106a1573d6000803e3d6000fd5b505050506040513d60208110156106b757600080fd5b50505b6004830154600384015460405187927f6993e60a52c87053cc7172562a904e8aea4e00c7dab8ea115641c79ec2f00a619260ff9091169142908084600281111561070057fe5b8152602001838152602001828152602001935050505060405180910390a25050505050565b6000546001600160a01b031681565b6000546001600160a01b0316331461074b57600080fd5b60025460ff161515600114610761576001610764565b60005b6002805460ff1916911515919091179055565b6000806107826119a8565b600084815260046020818152604092839020835160e08101855281546001600160a01b039081168252600183015416928101929092526002808201549483019490945260038101546060830152918201549092608084019160ff16908111156107e757fe5b60028111156107f257fe5b815260048201546001600160a01b0361010090910481166020808401919091526005909301546040909201919091529082015191925016610872576040805162461bcd60e51b8152602060048201526015602482015274115cd8dc9bddc8191bd95cc81b9bdd08195e1a5cdd605a1b604482015290519081900360640190fd5b806080015181606001519250925050915091565b60025460ff166108c75760405162461bcd60e51b8152600401808060200182810382526021815260200180611aed6021913960400191505060405180910390fd5b6000196003541061091a576040805162461bcd60e51b815260206004820152601860248201527713585e1a5b5d5b48195cd8dc9bddda59081c995858da195960421b604482015290519081900360640190fd5b336001600160a01b03831614156109625760405162461bcd60e51b81526004018080602001828103825260248152602001806119e66024913960400191505060405180910390fd5b6001600160a01b0382166109a75760405162461bcd60e51b8152600401808060200182810382526026815260200180611b0e6026913960400191505060405180910390fd5b600081116109e65760405162461bcd60e51b8152600401808060200182810382526026815260200180611aa36026913960400191505060405180910390fd5b6109f281600154611998565b60408051636eb1769f60e11b81523360048201523060248201529051736b175474e89094c44da98b954eedeac495271d0f9163dd62ed3e916044808301926020929190829003018186803b158015610a4957600080fd5b505afa158015610a5d573d6000803e3d6000fd5b505050506040513d6020811015610a7357600080fd5b50511015610ac8576040805162461bcd60e51b815260206004820152601b60248201527f646169546f6b656e20616c6c6f77616e63652065786365656465640000000000604482015290519081900360640190fd5b600354604080516020808201939093528151808203840181528183018084528151919094012061012082019092523383526001600160a01b03851660608201526080810184905260a0810184905290919060c00160018152600060208083018290526040928301829052848252600480825291839020845181546001600160a01b039182166001600160a01b031991821617835592860151600180840180549290931691909416179055928401516002808501919091556060850151600385015560808501519284018054909260ff19909116918490811115610ba757fe5b021790555060a08201516004820180546001600160a01b0390921661010002610100600160a81b031990921691909117905560c090910151600590910155600354610bf3906001611998565b600355604080516323b872dd60e01b8152336004820152306024820152604481018490529051736b175474e89094c44da98b954eedeac495271d0f916323b872dd9160648083019260209291908290030181600087803b158015610c5657600080fd5b505af1158015610c6a573d6000803e3d6000fd5b505050506040513d6020811015610c8057600080fd5b505060008054600154604080516323b872dd60e01b81523360048201526001600160a01b039093166024840152604483019190915251736b175474e89094c44da98b954eedeac495271d0f926323b872dd92606480820193602093909283900390910190829087803b158015610cf557600080fd5b505af1158015610d09573d6000803e3d6000fd5b505050506040513d6020811015610d1f57600080fd5b50506040805182815260208101849052428183015290516001600160a01b0385169133917f934898dbda2c91e79b97937d953c595833b69b79bf73dc1ac66e38f52a1a39239181900360600190a3604080513381526001600160a01b0385166020820152808201849052426060820152905182917fb4f43252fd9eeb169a308e019d9a4fb37d692368bcf37cf88b2a3d1e9dcf13a6919081900360800190a2505050565b60025460ff1681565b60008281526004602052604090206001015482906001600160a01b0316331480610e1557506000818152600460208190526040909120015461010090046001600160a01b031633145b610e60576040805162461bcd60e51b815260206004820152601760248201527627b7363c902830bcb2b29037b91026b7b232b930ba37b960491b604482015290519081900360640190fd5b60008381526004602052604090206001600482015460ff166002811115610e8357fe5b14610ed5576040805162461bcd60e51b815260206004820152601a60248201527f457363726f772073686f756c6420626520416374697661746564000000000000604482015290519081900360640190fd5b600083118015610ee9575080600201548311155b610f245760405162461bcd60e51b8152600401808060200182810382526024815260200180611ac96024913960400191505060405180910390fd5b60038101839055600481015460405185917f6993e60a52c87053cc7172562a904e8aea4e00c7dab8ea115641c79ec2f00a619160ff909116908690429080846002811115610f6e57fe5b8152602001838152602001828152602001935050505060405180910390a250505050565b60046020819052600091825260409091208054600182015460028301546003840154948401546005909401546001600160a01b039384169592841694919360ff8316926101009004169087565b60025460ff166110205760405162461bcd60e51b8152600401808060200182810382526021815260200180611aed6021913960400191505060405180910390fd5b60001960035410611073576040805162461bcd60e51b815260206004820152601860248201527713585e1a5b5d5b48195cd8dc9bddda59081c995858da195960421b604482015290519081900360640190fd5b336001600160a01b038516148015906110955750336001600160a01b03831614155b80156110b35750816001600160a01b0316846001600160a01b031614155b6110ee5760405162461bcd60e51b8152600401808060200182810382526030815260200180611a446030913960400191505060405180910390fd5b6001600160a01b0384161580159061110e57506001600160a01b03821615155b6111495760405162461bcd60e51b815260040180806020018281038252602f815260200180611a74602f913960400191505060405180910390fd5b600083116111885760405162461bcd60e51b8152600401808060200182810382526026815260200180611aa36026913960400191505060405180910390fd5b60006111948483611998565b90506111a281600154611998565b60408051636eb1769f60e11b81523360048201523060248201529051736b175474e89094c44da98b954eedeac495271d0f9163dd62ed3e916044808301926020929190829003018186803b1580156111f957600080fd5b505afa15801561120d573d6000803e3d6000fd5b505050506040513d602081101561122357600080fd5b50511015611278576040805162461bcd60e51b815260206004820152601b60248201527f646169546f6b656e20616c6c6f77616e63652065786365656465640000000000604482015290519081900360640190fd5b600354604080516020808201939093528151808203840181528183018084528151919094012061012082019092523383526001600160a01b03881660608201526080810187905260a0810187905290919060c001600181526001600160a01b0380871660208084019190915260409283018790526000858152600480835290849020855181549085166001600160a01b03199182161782559286015160018083018054929096169190941617909355928401516002808401919091556060850151600384015560808501519383018054939493909260ff1990911691849081111561135f57fe5b021790555060a082015160048281018054610100600160a81b0319166101006001600160a01b039485160217815560c09094015160058401556000858152602082905260409020835481549084166001600160a01b03199182161782556001808601548382018054919096169216919091179093556002808501548183015560038086015490830155945491810180549495919460ff90931693909260ff191691849081111561140b57fe5b02179055506004828101549082018054610100600160a81b031916610100928390046001600160a01b0316909202919091179055600591820154910155600354611456906001611998565b600355604080516323b872dd60e01b8152336004820152306024820152604481018490529051736b175474e89094c44da98b954eedeac495271d0f916323b872dd9160648083019260209291908290030181600087803b1580156114b957600080fd5b505af11580156114cd573d6000803e3d6000fd5b505050506040513d60208110156114e357600080fd5b505060008054600154604080516323b872dd60e01b81523360048201526001600160a01b039093166024840152604483019190915251736b175474e89094c44da98b954eedeac495271d0f926323b872dd92606480820193602093909283900390910190829087803b15801561155857600080fd5b505af115801561156c573d6000803e3d6000fd5b505050506040513d602081101561158257600080fd5b5050604080518281526020810187905280820185905242606082015290516001600160a01b03808716929089169133917febabb423a268e0a15828eccf3adae9e3109b0ee68c9d8fe144ac611588a41193919081900360800190a4604080513381526001600160a01b03808916602083015281830188905286166060820152608081018590524260a0820152905182917febcbc303c0ead8fab02f05cce5d7c366143e16f8b25775281cd4b7ce746205e3919081900360c00190a2505050505050565b6000546001600160a01b0316331461165c57600080fd5b6000816001600160a01b0316311161167357600080fd5b600080546001600160a01b0319166001600160a01b0392909216919091179055565b60015481565b60008181526004602052604090206001015481906001600160a01b03163314806116e457506000818152600460208190526040909120015461010090046001600160a01b031633145b61172f576040805162461bcd60e51b815260206004820152601760248201527627b7363c902830bcb2b29037b91026b7b232b930ba37b960491b604482015290519081900360640190fd5b60008281526004602052604090206001600482015460ff16600281111561175257fe5b146117a4576040805162461bcd60e51b815260206004820152601a60248201527f457363726f772053686f756c6420626520616374697661746564000000000000604482015290519081900360640190fd5b80600301548160020154146117ea5760405162461bcd60e51b815260040180806020018281038252603a815260200180611a0a603a913960400191505060405180910390fd5b600381018054600090915560048201805460ff191690556005820154156118ab5760048083015460058401546040805163a9059cbb60e01b81526101009093046001600160a01b03169383019390935260248201529051736b175474e89094c44da98b954eedeac495271d0f9163a9059cbb9160448083019260209291908290030181600087803b15801561187e57600080fd5b505af1158015611892573d6000803e3d6000fd5b505050506040513d60208110156118a857600080fd5b50505b81546040805163a9059cbb60e01b81526001600160a01b0390921660048301526024820183905251736b175474e89094c44da98b954eedeac495271d0f9163a9059cbb9160448083019260209291908290030181600087803b15801561191057600080fd5b505af1158015611924573d6000803e3d6000fd5b505050506040513d602081101561193a57600080fd5b50506004820154600383015460405186927f6993e60a52c87053cc7172562a904e8aea4e00c7dab8ea115641c79ec2f00a619260ff90911691429080846002811115610f6e57fe5b8082038281111561199257600080fd5b92915050565b8082018281101561199257600080fd5b6040805160e0810182526000808252602082018190529181018290526060810182905290608082019081526000602082018190526040909101529056fe5468652050617965722c2070617965652073686f756c6420626520646966666572656e74457363726f7720616d6f756e7420616e6420457363726f7720736574746c656d656e7420616d6f756e742073686f756c6420626520657175616c5468652050617965722c2070617965652026206d6f64657261746f722073686f756c6420626520646966666572656e74457363726f77205061796565206f72206d6f64657261746f722063616e206e6f742062652061646472657373283029457363726f7720616d6f756e742068617320746f2062652067726561746572207468616e2030657363726f7720736574746c656d656e74616d6f756e7420697320696e636f7272656374466163746f727920436f6e74726163742073686f756c642062652041637469766554686520457363726f772050617965652063616e206e6f742062652061646472657373283029a2646970667358221220b80b0d3a2f6700979825fe5f689f9982ac6146fbc93c527521f6eebb19e80b3264736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}}
| 2,264 |
0x1ac821a5ab398d62011b008acf5598308ee4d4ad
|
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 {
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 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 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);
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;
}
}
contract MintableToken is StandardToken, Ownable {
event Mint(address indexed to, uint256 amount);
event MintFinished();
bool public mintingFinished = false;
modifier canMint() {
require(!mintingFinished);
_;
}
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;
}
function finishMinting() onlyOwner canMint public returns (bool) {
mintingFinished = true;
MintFinished();
return true;
}
}
contract GDR is MintableToken {
string public constant name = "Golden Resource";
string public constant symbol = "GDR";
uint8 public constant decimals = 18;
}
contract ReentrancyGuard {
/**
* @dev We use a single lock for the whole contract.
*/
bool private rentrancy_lock = false;
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* @notice If you mark a function `nonReentrant`, you should also
* mark it `external`. Calling one nonReentrant function from
* another is not supported. Instead, you can implement a
* `private` function doing the actual work, and a `external`
* wrapper marked as `nonReentrant`.
*/
modifier nonReentrant() {
require(!rentrancy_lock);
rentrancy_lock = true;
_;
rentrancy_lock = false;
}
}
contract PreICO is Ownable, ReentrancyGuard {
using SafeMath for uint256;
// The token being sold
GDR public token;
// start and end timestamps where investments are allowed (both inclusive)
uint256 public startTime;
uint256 public endTime;
// address where funds are collected
address public wallet;
// how many token units a buyer gets per wei
uint256 public rate; // tokens for one cent
uint256 public priceUSD; // wei in one USD
uint256 public centRaised;
uint256 public hardCap;
address oracle; //
address manager;
// investors => amount of money
mapping(address => uint) public balances;
mapping(address => uint) public balancesInCent;
/**
* 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);
// 1523615762, 71, "0x938985cffa2cc45c680949c1bfa151fe5eb1c9e1", "0xf39C702594792B91aec6d881C9e6ebD2022A2271", 19539531402957
function PreICO(
uint256 _startTime,
uint256 _period,
address _wallet,
address _token,
uint256 _priceUSD) public
{
require(_period != 0);
require(_priceUSD != 0);
require(_wallet != address(0));
require(_token != address(0));
startTime = _startTime;
endTime = startTime + _period * 1 days;
priceUSD = _priceUSD;
rate = 12500000000000000; // 0.0125 * 1 ether
wallet = _wallet;
token = GDR(_token);
hardCap = 1000000000; // inCent
}
// @return true if the transaction can buy tokens
modifier saleIsOn() {
bool withinPeriod = now >= startTime && now <= endTime;
require(withinPeriod);
_;
}
modifier isUnderHardCap() {
require(centRaised <= hardCap);
_;
}
modifier onlyOracle(){
require(msg.sender == oracle);
_;
}
modifier onlyOwnerOrManager(){
require(msg.sender == manager || msg.sender == owner);
_;
}
// @return true if crowdsale event has ended
function hasEnded() public view returns (bool) {
return now > endTime;
}
// Override this method to have a way to add business logic to your crowdsale when buying
function getTokenAmount(uint256 centValue) internal view returns(uint256) {
return centValue.mul(rate);
}
// send ether to the fund collection wallet
// override to create custom fund forwarding mechanisms
function forwardFunds(uint256 value) internal {
wallet.transfer(value);
}
function finishPreSale() public onlyOwner {
token.transferOwnership(owner);
forwardFunds(this.balance);
}
// set the address from which you can change the rate
function setOracle(address _oracle) public onlyOwner {
require(_oracle != address(0));
oracle = _oracle;
}
// set manager's address
function setManager(address _manager) public onlyOwner {
require(_manager != address(0));
manager = _manager;
}
function changePriceUSD(uint256 _priceUSD) public onlyOracle {
require(_priceUSD != 0);
priceUSD = _priceUSD;
}
// manual selling tokens for fiat
function manualTransfer(address _to, uint _valueUSD) public saleIsOn isUnderHardCap onlyOwnerOrManager {
uint256 centValue = _valueUSD * 100;
uint256 tokensAmount = getTokenAmount(centValue);
centRaised = centRaised.add(centValue);
token.mint(_to, tokensAmount);
balancesInCent[_to] = balancesInCent[_to].add(centValue);
}
// low level token purchase function
function buyTokens(address beneficiary) saleIsOn isUnderHardCap nonReentrant public payable {
require(beneficiary != address(0) && msg.value != 0);
uint256 weiAmount = msg.value;
uint256 centValue = weiAmount.div(priceUSD);
uint256 tokens = getTokenAmount(centValue);
centRaised = centRaised.add(centValue);
token.mint(beneficiary, tokens);
balances[msg.sender] = balances[msg.sender].add(weiAmount);
TokenPurchase(msg.sender, beneficiary, weiAmount, tokens);
forwardFunds(weiAmount);
}
function () external payable {
buyTokens(msg.sender);
}
}
|
0x606060405260043610610107576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806327e235e3146101125780632c4e722e1461015f5780633197cbb61461018857806334358c01146101b157806339885b23146101fe578063521eb273146102135780636857cb061461026857806378e97925146102aa5780637adbf973146102d3578063867f990a1461030c5780638da5cb5b1461032f57806391ac46f51461038457806393a408d7146103ad578063d0ebdbe7146103d6578063ec8ac4d81461040f578063ecb70fb71461043d578063f2fde38b1461046a578063fb86a404146104a3578063fc0c546a146104cc575b61011033610521565b005b341561011d57600080fd5b610149600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610824565b6040518082815260200191505060405180910390f35b341561016a57600080fd5b61017261083c565b6040518082815260200191505060405180910390f35b341561019357600080fd5b61019b610842565b6040518082815260200191505060405180910390f35b34156101bc57600080fd5b6101e8600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610848565b6040518082815260200191505060405180910390f35b341561020957600080fd5b610211610860565b005b341561021e57600080fd5b6102266109ca565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561027357600080fd5b6102a8600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506109f0565b005b34156102b557600080fd5b6102bd610c81565b6040518082815260200191505060405180910390f35b34156102de57600080fd5b61030a600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610c87565b005b341561031757600080fd5b61032d6004808035906020019091905050610d62565b005b341561033a57600080fd5b610342610dd8565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561038f57600080fd5b610397610dfd565b6040518082815260200191505060405180910390f35b34156103b857600080fd5b6103c0610e03565b6040518082815260200191505060405180910390f35b34156103e157600080fd5b61040d600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610e09565b005b61043b600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610521565b005b341561044857600080fd5b610450610ee4565b604051808215151515815260200191505060405180910390f35b341561047557600080fd5b6104a1600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610ef0565b005b34156104ae57600080fd5b6104b6611045565b6040518082815260200191505060405180910390f35b34156104d757600080fd5b6104df61104b565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b600080600080600254421015801561053b57506003544211155b905080151561054957600080fd5b6008546007541115151561055c57600080fd5b600060149054906101000a900460ff1615151561057857600080fd5b6001600060146101000a81548160ff021916908315150217905550600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16141580156105d1575060003414155b15156105dc57600080fd5b3493506105f46006548561107190919063ffffffff16565b92506105ff8361108c565b9150610616836007546110aa90919063ffffffff16565b600781905550600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166340c10f1986846040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15156106e057600080fd5b5af115156106ed57600080fd5b505050604051805190505061074a84600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546110aa90919063ffffffff16565b600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f623b3804fa71d67900d064613da8f94b9617215ee90799290593e1745087ad188685604051808381526020018281526020019250505060405180910390a3610803846110c8565b60008060146101000a81548160ff0219169083151502179055505050505050565b600b6020528060005260406000206000915090505481565b60055481565b60035481565b600c6020528060005260406000206000915090505481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156108bb57600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f2fde38b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050600060405180830381600087803b151561099857600080fd5b5af115156109a557600080fd5b5050506109c83073ffffffffffffffffffffffffffffffffffffffff16316110c8565b565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060006002544210158015610a0957506003544211155b9050801515610a1757600080fd5b60085460075411151515610a2a57600080fd5b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480610ad257506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b1515610add57600080fd5b606484029250610aec8361108c565b9150610b03836007546110aa90919063ffffffff16565b600781905550600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166340c10f1986846040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1515610bcd57600080fd5b5af11515610bda57600080fd5b5050506040518051905050610c3783600c60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546110aa90919063ffffffff16565b600c60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505050505050565b60025481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610ce257600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515610d1e57600080fd5b80600960006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610dbe57600080fd5b60008114151515610dce57600080fd5b8060068190555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60075481565b60065481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610e6457600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515610ea057600080fd5b80600a60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60006003544211905090565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610f4b57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515610f8757600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60085481565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600080828481151561107f57fe5b0490508091505092915050565b60006110a36005548361112d90919063ffffffff16565b9050919050565b60008082840190508381101515156110be57fe5b8091505092915050565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050151561112a57600080fd5b50565b60008060008414156111425760009150611161565b828402905082848281151561115357fe5b0414151561115d57fe5b8091505b50929150505600a165627a7a7230582009367e1204307e9867ccc7cc69715dff01188d8570a1dcf59a822efd97951aed0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 2,265 |
0xa54ffd4b92d6ffdc737c3dfce6bf6ef1dcca56f9
|
/**
*Submitted for verification at Etherscan.io on 2022-03-19
*/
/**
ApeBoy's core mission is to adopt apes by donating to "Center For Great Apes".
https://t.me/apeboyeth
https://t.me/apeboyeth
https://t.me/apeboyeth
*/
// 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 ApeBoy is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Ape Boy";
string private constant _symbol = "ApeBoy";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 0;
uint256 private _taxFeeOnBuy = 12;
uint256 private _redisFeeOnSell = 0;
uint256 private _taxFeeOnSell = 12;
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots; mapping (address => uint256) public _buyMap;
address payable private _developmentAddress = payable(0xd7723960604c221aD4ADE9C2d0389561Fe443F7b);
address payable private _marketingAddress = payable(0x3aDE0cb7f370fd4C0A67C912BEb3879cf89d0A48);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen = false;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 15000000000 * 10**9;
uint256 public _maxWalletSize = 30000000000 * 10**9;
uint256 public _swapTokensAtAmount = 10000000 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);//
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
require(redisFeeOnBuy >= 0 && redisFeeOnBuy <= 4, "Buy rewards");
require(taxFeeOnBuy >= 0 && taxFeeOnBuy <= 20, "Buy tax");
require(redisFeeOnSell >= 0 && redisFeeOnSell <= 4, "Sell rewards");
require(taxFeeOnSell >= 0 && taxFeeOnSell <= 99, "Sell tax");
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set maximum transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
if (maxTxAmount > 5000000000 * 10**9) {
_maxTxAmount = maxTxAmount;
}
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610555578063dd62ed3e14610575578063ea1644d5146105bb578063f2fde38b146105db57600080fd5b8063a2a957bb146104d0578063a9059cbb146104f0578063bfd7928414610510578063c3c8cd801461054057600080fd5b80638f70ccf7116100d15780638f70ccf71461044b5780638f9a55c01461046b57806395d89b411461048157806398a5c315146104b057600080fd5b80637d1db4a5146103ea5780637f2feddc146104005780638da5cb5b1461042d57600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461038057806370a0823114610395578063715018a6146103b557806374010ece146103ca57600080fd5b8063313ce5671461030457806349bd5a5e146103205780636b999053146103405780636d8aa8f81461036057600080fd5b80631694505e116101ab5780631694505e1461027057806318160ddd146102a857806323b872dd146102ce5780632fd689e3146102ee57600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024057600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f7366004611a67565b6105fb565b005b34801561020a57600080fd5b5060408051808201909152600781526641706520426f7960c81b60208201525b6040516102379190611b2c565b60405180910390f35b34801561024c57600080fd5b5061026061025b366004611b81565b61069a565b6040519015158152602001610237565b34801561027c57600080fd5b50601454610290906001600160a01b031681565b6040516001600160a01b039091168152602001610237565b3480156102b457600080fd5b50683635c9adc5dea000005b604051908152602001610237565b3480156102da57600080fd5b506102606102e9366004611bad565b6106b1565b3480156102fa57600080fd5b506102c060185481565b34801561031057600080fd5b5060405160098152602001610237565b34801561032c57600080fd5b50601554610290906001600160a01b031681565b34801561034c57600080fd5b506101fc61035b366004611bee565b61071a565b34801561036c57600080fd5b506101fc61037b366004611c1b565b610765565b34801561038c57600080fd5b506101fc6107ad565b3480156103a157600080fd5b506102c06103b0366004611bee565b6107f8565b3480156103c157600080fd5b506101fc61081a565b3480156103d657600080fd5b506101fc6103e5366004611c36565b61088e565b3480156103f657600080fd5b506102c060165481565b34801561040c57600080fd5b506102c061041b366004611bee565b60116020526000908152604090205481565b34801561043957600080fd5b506000546001600160a01b0316610290565b34801561045757600080fd5b506101fc610466366004611c1b565b6108cd565b34801561047757600080fd5b506102c060175481565b34801561048d57600080fd5b50604080518082019091526006815265417065426f7960d01b602082015261022a565b3480156104bc57600080fd5b506101fc6104cb366004611c36565b610915565b3480156104dc57600080fd5b506101fc6104eb366004611c4f565b610944565b3480156104fc57600080fd5b5061026061050b366004611b81565b610a78565b34801561051c57600080fd5b5061026061052b366004611bee565b60106020526000908152604090205460ff1681565b34801561054c57600080fd5b506101fc610a85565b34801561056157600080fd5b506101fc610570366004611c81565b610ad9565b34801561058157600080fd5b506102c0610590366004611d05565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105c757600080fd5b506101fc6105d6366004611c36565b610b7a565b3480156105e757600080fd5b506101fc6105f6366004611bee565b610ba9565b6000546001600160a01b0316331461062e5760405162461bcd60e51b815260040161062590611d3e565b60405180910390fd5b60005b81518110156106965760016010600084848151811061065257610652611d73565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061068e81611d9f565b915050610631565b5050565b60006106a7338484610c93565b5060015b92915050565b60006106be848484610db7565b610710843361070b85604051806060016040528060288152602001611eb9602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906112f3565b610c93565b5060019392505050565b6000546001600160a01b031633146107445760405162461bcd60e51b815260040161062590611d3e565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b0316331461078f5760405162461bcd60e51b815260040161062590611d3e565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107e257506013546001600160a01b0316336001600160a01b0316145b6107eb57600080fd5b476107f58161132d565b50565b6001600160a01b0381166000908152600260205260408120546106ab90611367565b6000546001600160a01b031633146108445760405162461bcd60e51b815260040161062590611d3e565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108b85760405162461bcd60e51b815260040161062590611d3e565b674563918244f400008111156107f557601655565b6000546001600160a01b031633146108f75760405162461bcd60e51b815260040161062590611d3e565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b0316331461093f5760405162461bcd60e51b815260040161062590611d3e565b601855565b6000546001600160a01b0316331461096e5760405162461bcd60e51b815260040161062590611d3e565b60048411156109ad5760405162461bcd60e51b815260206004820152600b60248201526a427579207265776172647360a81b6044820152606401610625565b60148211156109e85760405162461bcd60e51b8152602060048201526007602482015266084eaf240e8c2f60cb1b6044820152606401610625565b6004831115610a285760405162461bcd60e51b815260206004820152600c60248201526b53656c6c207265776172647360a01b6044820152606401610625565b6063811115610a645760405162461bcd60e51b81526020600482015260086024820152670a6cad8d840e8c2f60c31b6044820152606401610625565b600893909355600a91909155600955600b55565b60006106a7338484610db7565b6012546001600160a01b0316336001600160a01b03161480610aba57506013546001600160a01b0316336001600160a01b0316145b610ac357600080fd5b6000610ace306107f8565b90506107f5816113eb565b6000546001600160a01b03163314610b035760405162461bcd60e51b815260040161062590611d3e565b60005b82811015610b74578160056000868685818110610b2557610b25611d73565b9050602002016020810190610b3a9190611bee565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610b6c81611d9f565b915050610b06565b50505050565b6000546001600160a01b03163314610ba45760405162461bcd60e51b815260040161062590611d3e565b601755565b6000546001600160a01b03163314610bd35760405162461bcd60e51b815260040161062590611d3e565b6001600160a01b038116610c385760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610625565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610cf55760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610625565b6001600160a01b038216610d565760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610625565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610e1b5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610625565b6001600160a01b038216610e7d5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610625565b60008111610edf5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610625565b6000546001600160a01b03848116911614801590610f0b57506000546001600160a01b03838116911614155b156111ec57601554600160a01b900460ff16610fa4576000546001600160a01b03848116911614610fa45760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c6564006064820152608401610625565b601654811115610ff65760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610625565b6001600160a01b03831660009081526010602052604090205460ff1615801561103857506001600160a01b03821660009081526010602052604090205460ff16155b6110905760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b6064820152608401610625565b6015546001600160a01b0383811691161461111557601754816110b2846107f8565b6110bc9190611dba565b106111155760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610625565b6000611120306107f8565b6018546016549192508210159082106111395760165491505b8080156111505750601554600160a81b900460ff16155b801561116a57506015546001600160a01b03868116911614155b801561117f5750601554600160b01b900460ff165b80156111a457506001600160a01b03851660009081526005602052604090205460ff16155b80156111c957506001600160a01b03841660009081526005602052604090205460ff16155b156111e9576111d7826113eb565b4780156111e7576111e74761132d565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061122e57506001600160a01b03831660009081526005602052604090205460ff165b8061126057506015546001600160a01b0385811691161480159061126057506015546001600160a01b03848116911614155b1561126d575060006112e7565b6015546001600160a01b03858116911614801561129857506014546001600160a01b03848116911614155b156112aa57600854600c55600954600d555b6015546001600160a01b0384811691161480156112d557506014546001600160a01b03858116911614155b156112e757600a54600c55600b54600d555b610b7484848484611574565b600081848411156113175760405162461bcd60e51b81526004016106259190611b2c565b5060006113248486611dd2565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610696573d6000803e3d6000fd5b60006006548211156113ce5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610625565b60006113d86115a2565b90506113e483826115c5565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061143357611433611d73565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561148757600080fd5b505afa15801561149b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114bf9190611de9565b816001815181106114d2576114d2611d73565b6001600160a01b0392831660209182029290920101526014546114f89130911684610c93565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac94790611531908590600090869030904290600401611e06565b600060405180830381600087803b15801561154b57600080fd5b505af115801561155f573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b8061158157611581611607565b61158c848484611635565b80610b7457610b74600e54600c55600f54600d55565b60008060006115af61172c565b90925090506115be82826115c5565b9250505090565b60006113e483836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061176e565b600c541580156116175750600d54155b1561161e57565b600c8054600e55600d8054600f5560009182905555565b6000806000806000806116478761179c565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061167990876117f9565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546116a8908661183b565b6001600160a01b0389166000908152600260205260409020556116ca8161189a565b6116d484836118e4565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161171991815260200190565b60405180910390a3505050505050505050565b6006546000908190683635c9adc5dea0000061174882826115c5565b82101561176557505060065492683635c9adc5dea0000092509050565b90939092509050565b6000818361178f5760405162461bcd60e51b81526004016106259190611b2c565b5060006113248486611e77565b60008060008060008060008060006117b98a600c54600d54611908565b92509250925060006117c96115a2565b905060008060006117dc8e87878761195d565b919e509c509a509598509396509194505050505091939550919395565b60006113e483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506112f3565b6000806118488385611dba565b9050838110156113e45760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610625565b60006118a46115a2565b905060006118b283836119ad565b306000908152600260205260409020549091506118cf908261183b565b30600090815260026020526040902055505050565b6006546118f190836117f9565b600655600754611901908261183b565b6007555050565b6000808080611922606461191c89896119ad565b906115c5565b90506000611935606461191c8a896119ad565b9050600061194d826119478b866117f9565b906117f9565b9992985090965090945050505050565b600080808061196c88866119ad565b9050600061197a88876119ad565b9050600061198888886119ad565b9050600061199a8261194786866117f9565b939b939a50919850919650505050505050565b6000826119bc575060006106ab565b60006119c88385611e99565b9050826119d58583611e77565b146113e45760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610625565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107f557600080fd5b8035611a6281611a42565b919050565b60006020808385031215611a7a57600080fd5b823567ffffffffffffffff80821115611a9257600080fd5b818501915085601f830112611aa657600080fd5b813581811115611ab857611ab8611a2c565b8060051b604051601f19603f83011681018181108582111715611add57611add611a2c565b604052918252848201925083810185019188831115611afb57600080fd5b938501935b82851015611b2057611b1185611a57565b84529385019392850192611b00565b98975050505050505050565b600060208083528351808285015260005b81811015611b5957858101830151858201604001528201611b3d565b81811115611b6b576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611b9457600080fd5b8235611b9f81611a42565b946020939093013593505050565b600080600060608486031215611bc257600080fd5b8335611bcd81611a42565b92506020840135611bdd81611a42565b929592945050506040919091013590565b600060208284031215611c0057600080fd5b81356113e481611a42565b80358015158114611a6257600080fd5b600060208284031215611c2d57600080fd5b6113e482611c0b565b600060208284031215611c4857600080fd5b5035919050565b60008060008060808587031215611c6557600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611c9657600080fd5b833567ffffffffffffffff80821115611cae57600080fd5b818601915086601f830112611cc257600080fd5b813581811115611cd157600080fd5b8760208260051b8501011115611ce657600080fd5b602092830195509350611cfc9186019050611c0b565b90509250925092565b60008060408385031215611d1857600080fd5b8235611d2381611a42565b91506020830135611d3381611a42565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611db357611db3611d89565b5060010190565b60008219821115611dcd57611dcd611d89565b500190565b600082821015611de457611de4611d89565b500390565b600060208284031215611dfb57600080fd5b81516113e481611a42565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611e565784516001600160a01b031683529383019391830191600101611e31565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611e9457634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611eb357611eb3611d89565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122043aba81ff0df0c5463b2a4efc6ae9ec57b0ae1b3ecb017235288ff3e0d18066d64736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}]}}
| 2,266 |
0xD5eE320346f50Be17A463A854F9aB01C35a95a39
|
// SPDX-License-Identifier: MIT
// Telegram: t.me/MetaMoonToken
pragma solidity ^0.8.4;
address constant WALLET_ADDRESS = 0xE54Bc4D497CAAE6285ed91F854B585b3F054c307;
uint256 constant TOTAL_SUPPLY = 1000000000;
string constant TOKEN_NAME = "MetaMoon";
string constant TOKEN_SYMBOL = "METAMOON";
uint256 constant INITIAL_TAX=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;
}
}
contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed oldie, address indexed newbie);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(address token, uint amountTokenDesired, uint amountTokenMin, uint amountETHMin, address to, uint deadline) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract MetaMoon is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping(address => uint256) private _rOwned;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private constant MAX = ~uint256(0);
uint256 private _tTotal = TOTAL_SUPPLY;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _rateLimit=TOTAL_SUPPLY;
uint256 private _tax=INITIAL_TAX;
address payable private _taxWallet= payable(WALLET_ADDRESS);
string private constant _name = TOKEN_NAME;
string private constant _symbol = TOKEN_SYMBOL;
uint8 private constant _decimals = 0;
IUniswapV2Router02 private _router= IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
address private _pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_rOwned[_msgSender()] = _rTotal;
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) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function tax() public view returns (uint256){
return _tax;
}
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 (!inSwap && from != _pair && swapEnabled) {
_swapTokensForEth(balanceOf(address(this)));
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
_sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from, to, amount);
}
function _swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = _router.WETH();
_approve(address(this), address(_router), tokenAmount);
_router.swapExactTokensForETHSupportingFeeOnTransferTokens(tokenAmount, 0, path, address(this), block.timestamp);
}
function _sendETHToFee(uint256 amount) private {
_taxWallet.transfer(amount);
}
function openTrading() external onlyOwner() {
require(!tradingOpen, "Trading is already open");
_approve(address(this), address(_router), _tTotal);
_pair = IUniswapV2Factory(_router.factory()).createPair(address(this), _router.WETH());
_router.addLiquidityETH{value : address(this).balance}(address(this), balanceOf(address(this)), 0, 0, owner(), block.timestamp);
swapEnabled = true;
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) = _getTransferAmounts(tAmount, _tax);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getReceiveAmounts(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTransferAmounts(uint256 tAmount, uint256 taxFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(2).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getReceiveAmounts(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);
}
}
|
0x6080604052600436106100ec5760003560e01c8063715018a61161008a578063a9059cbb11610059578063a9059cbb146102df578063c9567bf91461031c578063dd62ed3e14610333578063f429389014610370576100f3565b8063715018a6146102475780638da5cb5b1461025e57806395d89b411461028957806399c8d556146102b4576100f3565b806323b872dd116100c657806323b872dd1461018b578063313ce567146101c857806351bc3c85146101f357806370a082311461020a576100f3565b806306fdde03146100f8578063095ea7b31461012357806318160ddd14610160576100f3565b366100f357005b600080fd5b34801561010457600080fd5b5061010d610387565b60405161011a9190612181565b60405180910390f35b34801561012f57600080fd5b5061014a60048036038101906101459190611d71565b6103c4565b6040516101579190612166565b60405180910390f35b34801561016c57600080fd5b506101756103e2565b60405161018291906122e3565b60405180910390f35b34801561019757600080fd5b506101b260048036038101906101ad9190611d1e565b6103ec565b6040516101bf9190612166565b60405180910390f35b3480156101d457600080fd5b506101dd6104c5565b6040516101ea9190612358565b60405180910390f35b3480156101ff57600080fd5b506102086104ca565b005b34801561021657600080fd5b50610231600480360381019061022c9190611c84565b610544565b60405161023e91906122e3565b60405180910390f35b34801561025357600080fd5b5061025c610595565b005b34801561026a57600080fd5b506102736106e8565b6040516102809190612098565b60405180910390f35b34801561029557600080fd5b5061029e610711565b6040516102ab9190612181565b60405180910390f35b3480156102c057600080fd5b506102c961074e565b6040516102d691906122e3565b60405180910390f35b3480156102eb57600080fd5b5061030660048036038101906103019190611d71565b610758565b6040516103139190612166565b60405180910390f35b34801561032857600080fd5b50610331610776565b005b34801561033f57600080fd5b5061035a60048036038101906103559190611cde565b610c8a565b60405161036791906122e3565b60405180910390f35b34801561037c57600080fd5b50610385610d11565b005b60606040518060400160405280600881526020017f4d6574614d6f6f6e000000000000000000000000000000000000000000000000815250905090565b60006103d86103d1610d83565b8484610d8b565b6001905092915050565b6000600354905090565b60006103f9848484610f56565b6104ba84610405610d83565b6104b58560405180606001604052806028815260200161293360289139600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061046b610d83565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546111b89092919063ffffffff16565b610d8b565b600190509392505050565b600090565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661050b610d83565b73ffffffffffffffffffffffffffffffffffffffff161461052b57600080fd5b600061053630610544565b90506105418161121c565b50565b600061058e600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114a4565b9050919050565b61059d610d83565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461062a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161062190612263565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600881526020017f4d4554414d4f4f4e000000000000000000000000000000000000000000000000815250905090565b6000600754905090565b600061076c610765610d83565b8484610f56565b6001905092915050565b61077e610d83565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461080b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161080290612263565b60405180910390fd5b600a60149054906101000a900460ff161561085b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161085290612203565b60405180910390fd5b61088a30600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600354610d8b565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156108f257600080fd5b505afa158015610906573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061092a9190611cb1565b73ffffffffffffffffffffffffffffffffffffffff1663c9c6539630600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156109ae57600080fd5b505afa1580156109c2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109e69190611cb1565b6040518363ffffffff1660e01b8152600401610a039291906120b3565b602060405180830381600087803b158015610a1d57600080fd5b505af1158015610a31573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a559190611cb1565b600a60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610ade30610544565b600080610ae96106e8565b426040518863ffffffff1660e01b8152600401610b0b96959493929190612105565b6060604051808303818588803b158015610b2457600080fd5b505af1158015610b38573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610b5d9190611dde565b5050506001600a60166101000a81548160ff0219169083151502179055506001600a60146101000a81548160ff021916908315150217905550600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401610c359291906120dc565b602060405180830381600087803b158015610c4f57600080fd5b505af1158015610c63573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c879190611db1565b50565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610d52610d83565b73ffffffffffffffffffffffffffffffffffffffff1614610d7257600080fd5b6000479050610d8081611512565b50565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610dfb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610df2906122c3565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610e6b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e62906121e3565b60405180910390fd5b80600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051610f4991906122e3565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610fc6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fbd906122a3565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611036576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161102d906121a3565b60405180910390fd5b60008111611079576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161107090612283565b60405180910390fd5b6110816106e8565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156110ef57506110bf6106e8565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b156111a857600a60159054906101000a900460ff1615801561115f5750600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156111775750600a60169054906101000a900460ff165b156111a75761118d61118830610544565b61121c565b600047905060008111156111a5576111a447611512565b5b505b5b6111b383838361157e565b505050565b6000838311158290611200576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111f79190612181565b60405180910390fd5b506000838561120f91906124a9565b9050809150509392505050565b6001600a60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff81111561125457611253612604565b5b6040519080825280602002602001820160405280156112825781602001602082028036833780820191505090505b509050308160008151811061129a576112996125d5565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561133c57600080fd5b505afa158015611350573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113749190611cb1565b81600181518110611388576113876125d5565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506113ef30600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684610d8b565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016114539594939291906122fe565b600060405180830381600087803b15801561146d57600080fd5b505af1158015611481573d6000803e3d6000fd5b50505050506000600a60156101000a81548160ff02191690831515021790555050565b60006004548211156114eb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114e2906121c3565b60405180910390fd5b60006114f561158e565b905061150a81846115b990919063ffffffff16565b915050919050565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f1935050505015801561157a573d6000803e3d6000fd5b5050565b611589838383611603565b505050565b600080600061159b6117ce565b915091506115b281836115b990919063ffffffff16565b9250505090565b60006115fb83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061181b565b905092915050565b6000806000806000806116158761187e565b95509550955095509550955061167386600160008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546118e390919063ffffffff16565b600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061170885600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461192d90919063ffffffff16565b600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506117548161198b565b61175e8483611a48565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516117bb91906122e3565b60405180910390a3505050505050505050565b60008060006004549050600060035490506117f66003546004546115b990919063ffffffff16565b82101561180e57600454600354935093505050611817565b81819350935050505b9091565b60008083118290611862576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118599190612181565b60405180910390fd5b5060008385611871919061241e565b9050809150509392505050565b60008060008060008060008060006118988a600754611a82565b92509250925060006118a861158e565b905060008060006118bb8e878787611b17565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061192583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111b8565b905092915050565b600080828461193c91906123c8565b905083811015611981576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161197890612223565b60405180910390fd5b8091505092915050565b600061199561158e565b905060006119ac8284611ba090919063ffffffff16565b9050611a0081600160003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461192d90919063ffffffff16565b600160003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b611a5d826004546118e390919063ffffffff16565b600481905550611a788160055461192d90919063ffffffff16565b6005819055505050565b600080600080611aaf6064611aa1600289611ba090919063ffffffff16565b6115b990919063ffffffff16565b90506000611ad96064611acb888a611ba090919063ffffffff16565b6115b990919063ffffffff16565b90506000611b0282611af4858b6118e390919063ffffffff16565b6118e390919063ffffffff16565b90508083839550955095505050509250925092565b600080600080611b308589611ba090919063ffffffff16565b90506000611b478689611ba090919063ffffffff16565b90506000611b5e8789611ba090919063ffffffff16565b90506000611b8782611b7985876118e390919063ffffffff16565b6118e390919063ffffffff16565b9050838184965096509650505050509450945094915050565b600080831415611bb35760009050611c15565b60008284611bc1919061244f565b9050828482611bd0919061241e565b14611c10576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c0790612243565b60405180910390fd5b809150505b92915050565b600081359050611c2a816128ed565b92915050565b600081519050611c3f816128ed565b92915050565b600081519050611c5481612904565b92915050565b600081359050611c698161291b565b92915050565b600081519050611c7e8161291b565b92915050565b600060208284031215611c9a57611c99612633565b5b6000611ca884828501611c1b565b91505092915050565b600060208284031215611cc757611cc6612633565b5b6000611cd584828501611c30565b91505092915050565b60008060408385031215611cf557611cf4612633565b5b6000611d0385828601611c1b565b9250506020611d1485828601611c1b565b9150509250929050565b600080600060608486031215611d3757611d36612633565b5b6000611d4586828701611c1b565b9350506020611d5686828701611c1b565b9250506040611d6786828701611c5a565b9150509250925092565b60008060408385031215611d8857611d87612633565b5b6000611d9685828601611c1b565b9250506020611da785828601611c5a565b9150509250929050565b600060208284031215611dc757611dc6612633565b5b6000611dd584828501611c45565b91505092915050565b600080600060608486031215611df757611df6612633565b5b6000611e0586828701611c6f565b9350506020611e1686828701611c6f565b9250506040611e2786828701611c6f565b9150509250925092565b6000611e3d8383611e49565b60208301905092915050565b611e52816124dd565b82525050565b611e61816124dd565b82525050565b6000611e7282612383565b611e7c81856123a6565b9350611e8783612373565b8060005b83811015611eb8578151611e9f8882611e31565b9750611eaa83612399565b925050600181019050611e8b565b5085935050505092915050565b611ece816124ef565b82525050565b611edd81612532565b82525050565b6000611eee8261238e565b611ef881856123b7565b9350611f08818560208601612544565b611f1181612638565b840191505092915050565b6000611f296023836123b7565b9150611f3482612649565b604082019050919050565b6000611f4c602a836123b7565b9150611f5782612698565b604082019050919050565b6000611f6f6022836123b7565b9150611f7a826126e7565b604082019050919050565b6000611f926017836123b7565b9150611f9d82612736565b602082019050919050565b6000611fb5601b836123b7565b9150611fc08261275f565b602082019050919050565b6000611fd86021836123b7565b9150611fe382612788565b604082019050919050565b6000611ffb6020836123b7565b9150612006826127d7565b602082019050919050565b600061201e6029836123b7565b915061202982612800565b604082019050919050565b60006120416025836123b7565b915061204c8261284f565b604082019050919050565b60006120646024836123b7565b915061206f8261289e565b604082019050919050565b6120838161251b565b82525050565b61209281612525565b82525050565b60006020820190506120ad6000830184611e58565b92915050565b60006040820190506120c86000830185611e58565b6120d56020830184611e58565b9392505050565b60006040820190506120f16000830185611e58565b6120fe602083018461207a565b9392505050565b600060c08201905061211a6000830189611e58565b612127602083018861207a565b6121346040830187611ed4565b6121416060830186611ed4565b61214e6080830185611e58565b61215b60a083018461207a565b979650505050505050565b600060208201905061217b6000830184611ec5565b92915050565b6000602082019050818103600083015261219b8184611ee3565b905092915050565b600060208201905081810360008301526121bc81611f1c565b9050919050565b600060208201905081810360008301526121dc81611f3f565b9050919050565b600060208201905081810360008301526121fc81611f62565b9050919050565b6000602082019050818103600083015261221c81611f85565b9050919050565b6000602082019050818103600083015261223c81611fa8565b9050919050565b6000602082019050818103600083015261225c81611fcb565b9050919050565b6000602082019050818103600083015261227c81611fee565b9050919050565b6000602082019050818103600083015261229c81612011565b9050919050565b600060208201905081810360008301526122bc81612034565b9050919050565b600060208201905081810360008301526122dc81612057565b9050919050565b60006020820190506122f8600083018461207a565b92915050565b600060a082019050612313600083018861207a565b6123206020830187611ed4565b81810360408301526123328186611e67565b90506123416060830185611e58565b61234e608083018461207a565b9695505050505050565b600060208201905061236d6000830184612089565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006123d38261251b565b91506123de8361251b565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561241357612412612577565b5b828201905092915050565b60006124298261251b565b91506124348361251b565b925082612444576124436125a6565b5b828204905092915050565b600061245a8261251b565b91506124658361251b565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561249e5761249d612577565b5b828202905092915050565b60006124b48261251b565b91506124bf8361251b565b9250828210156124d2576124d1612577565b5b828203905092915050565b60006124e8826124fb565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061253d8261251b565b9050919050565b60005b83811015612562578082015181840152602081019050612547565b83811115612571576000848401525b50505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f54726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6128f6816124dd565b811461290157600080fd5b50565b61290d816124ef565b811461291857600080fd5b50565b6129248161251b565b811461292f57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220633838670727a4b725c67908a058d9a0a78938174ebf940eeb869aa23507f32464736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 2,267 |
0xae4799e0ca4c1ac972932a448d7f3dbb205baf5b
|
pragma solidity ^0.5.17;
/// @title Multisignature wallet - Allows multiple parties to agree on transactions before execution.
/// @author Stefan George - <stefan.george@consensys.net>
contract MultiSigWallet {
/*
* Events
*/
event Confirmation(address indexed sender, uint256 indexed transactionId);
event Revocation(address indexed sender, uint256 indexed transactionId);
event Submission(uint256 indexed transactionId);
event Execution(uint256 indexed transactionId);
event ExecutionFailure(uint256 indexed transactionId);
event Deposit(address indexed sender, uint256 value);
event OwnerAddition(address indexed owner);
event OwnerRemoval(address indexed owner);
event RequirementChange(uint256 required);
/*
* Constants
*/
uint256 constant public MAX_OWNER_COUNT = 50;
/*
* Storage
*/
mapping (uint256 => Transaction) public transactions;
mapping (uint256 => mapping (address => bool)) public confirmations;
mapping (address => bool) public isOwner;
address[] public owners;
uint256 public required;
uint256 public transactionCount;
struct Transaction {
address destination;
uint256 value;
bytes data;
bool executed;
uint256 timestamp;
}
/*
* Modifiers
*/
modifier onlyWallet() {
require(msg.sender == address(this), "Only wallet");
_;
}
modifier ownerDoesNotExist(address owner) {
require(!isOwner[owner], "Owner exists");
_;
}
modifier ownerExists(address owner) {
require(isOwner[owner], "Owner does not exists");
_;
}
modifier transactionExists(uint256 transactionId) {
require(transactions[transactionId].destination != address(0), "Tx doesn't exist");
_;
}
modifier confirmed(uint256 transactionId, address owner) {
require(confirmations[transactionId][owner], "not confirmed");
_;
}
modifier notConfirmed(uint256 transactionId, address owner) {
require(!confirmations[transactionId][owner], "is already confirmed");
_;
}
modifier notExecuted(uint256 transactionId) {
require(!transactions[transactionId].executed, "tx already executed");
_;
}
modifier notNull(address _address) {
require(_address != address(0), "address is null");
_;
}
modifier validRequirement(uint256 ownerCount, uint256 _required) {
require(ownerCount <= MAX_OWNER_COUNT && _required <= ownerCount && _required != 0 && ownerCount != 0, "invalid requirement");
_;
}
/// @dev Fallback function allows to deposit ether.
function() external payable {
if (msg.value > 0)
emit Deposit(msg.sender, msg.value);
}
/*
* Public functions
*/
/// @dev Contract constructor sets initial owners and required number of confirmations.
/// @param _owners List of initial owners.
/// @param _required Number of required confirmations.
constructor(address[] memory _owners, uint256 _required) public validRequirement(_owners.length, _required) {
for (uint256 i = 0; i < _owners.length; i++) {
require(!isOwner[_owners[i]] && _owners[i] != address(0), "is already owner");
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 to add.
function addOwner(address owner) public
onlyWallet
ownerDoesNotExist(owner)
notNull(owner)
validRequirement(owners.length + 1, required)
{
isOwner[owner] = true;
owners.push(owner);
emit OwnerAddition(owner);
}
/// @dev Allows to remove an owner. Transaction has to be sent by wallet.
/// @param owner Address of owner to remove.
function removeOwner(address owner) public onlyWallet ownerExists(owner) {
isOwner[owner] = false;
for (uint256 i = 0; i < owners.length - 1; i++){
if (owners[i] == owner) {
owners[i] = owners[owners.length - 1];
break;
}
}
owners.length -= 1;
if (required > owners.length)
changeRequirement(owners.length);
emit OwnerRemoval(owner);
}
/// @dev Allows to replace an owner with a new owner. Transaction has to be sent by wallet.
/// @param owner Address of owner to be replaced.
/// @param newOwner Address of new owner.
function replaceOwner(address owner, address newOwner) public onlyWallet ownerExists(owner) ownerDoesNotExist(newOwner) {
for(uint256 i = 0; i < owners.length; i++) {
if (owners[i] == owner) {
owners[i] = newOwner;
break;
}
}
isOwner[owner] = false;
isOwner[newOwner] = true;
emit OwnerRemoval(owner);
emit OwnerAddition(newOwner);
}
/// @dev Allows to change the number of required confirmations. Transaction has to be sent by wallet.
/// @param _required Number of required confirmations.
function changeRequirement(uint256 _required) public onlyWallet validRequirement(owners.length, _required) {
required = _required;
emit RequirementChange(_required);
}
/// @dev Allows an owner to submit and confirm a transaction.
/// @param destination Transaction target address.
/// @param value Transaction ether value.
/// @param data Transaction data payload.
/// @return Returns transaction ID.
function submitTransaction(address destination, uint256 value, bytes memory data) public returns (uint256 transactionId) {
transactionId = addTransaction(destination, value, data);
confirmTransaction(transactionId);
}
/// @dev Allows an owner to confirm a transaction.
/// @param transactionId Transaction ID.
function confirmTransaction(uint256 transactionId) public
ownerExists(msg.sender)
transactionExists(transactionId)
notConfirmed(transactionId, msg.sender)
{
confirmations[transactionId][msg.sender] = true;
emit Confirmation(msg.sender, transactionId);
executeTransaction(transactionId);
}
/// @dev Allows an owner to revoke a confirmation for a transaction.
/// @param transactionId Transaction ID.
function revokeConfirmation(uint256 transactionId) public
ownerExists(msg.sender)
confirmed(transactionId, msg.sender)
notExecuted(transactionId)
{
confirmations[transactionId][msg.sender] = false;
emit Revocation(msg.sender, transactionId);
}
/// @dev Allows anyone to execute a confirmed transaction.
/// @param transactionId Transaction ID.
function executeTransaction(uint256 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))
emit Execution(transactionId);
else {
emit 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, uint256 value, uint256 dataLength, bytes memory data) internal 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(uint256 transactionId) public view returns (bool) {
uint256 count = 0;
for (uint256 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, uint256 value, bytes memory data) internal
notNull(destination) returns (uint256 transactionId) {
transactionId = transactionCount;
transactions[transactionId] = Transaction({
destination: destination,
value: value,
data: data,
executed: false,
timestamp: now
});
transactionCount += 1;
emit Submission(transactionId);
}
/*
* Web3 call functions
*/
/// @dev Returns number of confirmations of a transaction.
/// @param transactionId Transaction ID.
/// @return Number of confirmations.
function getConfirmationCount(uint256 transactionId) public view returns (uint256 count) {
for (uint256 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 view returns (uint256 count) {
for (uint256 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 view returns (address[] memory) {
return owners;
}
/// @dev Returns array with owner addresses, which confirmed transaction.
/// @param transactionId Transaction ID.
/// @return Returns array of owner addresses.
function getConfirmations(uint256 transactionId) public view returns (address[] memory _confirmations) {
address[] memory confirmationsTemp = new address[](owners.length);
uint256 count = 0;
uint256 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(uint256 from, uint256 to, bool pending, bool executed) public view returns (uint256[] memory _transactionIds) {
uint256[] memory transactionIdsTemp = new uint256[](transactionCount);
uint256 count = 0;
uint256 i;
for (i = 0; i < transactionCount; i++)
if ( pending && !transactions[i].executed || executed && transactions[i].executed) {
transactionIdsTemp[count] = i;
count += 1;
}
_transactionIds = new uint256[](to - from);
for (i = from; i < to; i++){
_transactionIds[i - from] = transactionIdsTemp[i];
}
}
function getTransaction(uint256 transactionId) public view returns (bytes memory, address, bool, uint256) {
Transaction memory txn = transactions[transactionId];
return (
txn.data,
txn.destination,
txn.executed,
txn.timestamp
);
}
}
|
0x6080604052600436106101355760003560e01c8063a0e67e2b116100ab578063c01a8c841161006f578063c01a8c84146108cf578063c64274741461090a578063d74f8edd14610a10578063dc8452cd14610a3b578063e20056e614610a66578063ee22610b14610ad757610135565b8063a0e67e2b146106bb578063a8abe69a14610727578063b5dc40c3146107d9578063b77bf60014610869578063ba51a6df1461089457610135565b80633411c81c116100fd5780633411c81c146103f8578063547415251461046b5780637065cb48146104c8578063784547a7146105195780638b51d13f1461056c5780639ace38c2146105bb57610135565b8063025e7c271461018f578063173825d91461020a57806320ea8d861461025b5780632f54bf6e1461029657806333ea3dc8146102ff575b600034111561018d573373ffffffffffffffffffffffffffffffffffffffff167fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c346040518082815260200191505060405180910390a25b005b34801561019b57600080fd5b506101c8600480360360208110156101b257600080fd5b8101908080359060200190929190505050610b12565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561021657600080fd5b506102596004803603602081101561022d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610b4e565b005b34801561026757600080fd5b506102946004803603602081101561027e57600080fd5b8101908080359060200190929190505050610eae565b005b3480156102a257600080fd5b506102e5600480360360208110156102b957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061118b565b604051808215151515815260200191505060405180910390f35b34801561030b57600080fd5b506103386004803603602081101561032257600080fd5b81019080803590602001909291905050506111ab565b60405180806020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200184151515158152602001838152602001828103825286818151815260200191508051906020019080838360005b838110156103ba57808201518184015260208101905061039f565b50505050905090810190601f1680156103e75780820380516001836020036101000a031916815260200191505b509550505050505060405180910390f35b34801561040457600080fd5b506104516004803603604081101561041b57600080fd5b8101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611327565b604051808215151515815260200191505060405180910390f35b34801561047757600080fd5b506104b26004803603604081101561048e57600080fd5b81019080803515159060200190929190803515159060200190929190505050611356565b6040518082815260200191505060405180910390f35b3480156104d457600080fd5b50610517600480360360208110156104eb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506113e8565b005b34801561052557600080fd5b506105526004803603602081101561053c57600080fd5b810190808035906020019092919050505061179f565b604051808215151515815260200191505060405180910390f35b34801561057857600080fd5b506105a56004803603602081101561058f57600080fd5b8101908080359060200190929190505050611884565b6040518082815260200191505060405180910390f35b3480156105c757600080fd5b506105f4600480360360208110156105de57600080fd5b810190808035906020019092919050505061194d565b604051808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018060200184151515158152602001838152602001828103825285818151815260200191508051906020019080838360005b8381101561067c578082015181840152602081019050610661565b50505050905090810190601f1680156106a95780820380516001836020036101000a031916815260200191505b50965050505050505060405180910390f35b3480156106c757600080fd5b506106d0611a48565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156107135780820151818401526020810190506106f8565b505050509050019250505060405180910390f35b34801561073357600080fd5b506107826004803603608081101561074a57600080fd5b810190808035906020019092919080359060200190929190803515159060200190929190803515159060200190929190505050611ad6565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156107c55780820151818401526020810190506107aa565b505050509050019250505060405180910390f35b3480156107e557600080fd5b50610812600480360360208110156107fc57600080fd5b8101908080359060200190929190505050611c3a565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561085557808201518184015260208101905061083a565b505050509050019250505060405180910390f35b34801561087557600080fd5b5061087e611e66565b6040518082815260200191505060405180910390f35b3480156108a057600080fd5b506108cd600480360360208110156108b757600080fd5b8101908080359060200190929190505050611e6c565b005b3480156108db57600080fd5b50610908600480360360208110156108f257600080fd5b8101908080359060200190929190505050611ff4565b005b34801561091657600080fd5b506109fa6004803603606081101561092d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291908035906020019064010000000081111561097457600080fd5b82018360208201111561098657600080fd5b803590602001918460018302840111640100000000831117156109a857600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050919291929050505061231c565b6040518082815260200191505060405180910390f35b348015610a1c57600080fd5b50610a2561233b565b6040518082815260200191505060405180910390f35b348015610a4757600080fd5b50610a50612340565b6040518082815260200191505060405180910390f35b348015610a7257600080fd5b50610ad560048036036040811015610a8957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612346565b005b348015610ae357600080fd5b50610b1060048036036020811015610afa57600080fd5b810190808035906020019092919050505061278b565b005b60038181548110610b1f57fe5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610bef576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f4f6e6c792077616c6c657400000000000000000000000000000000000000000081525060200191505060405180910390fd5b80600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16610caf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f4f776e657220646f6573206e6f7420657869737473000000000000000000000081525060200191505060405180910390fd5b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060008090505b600160038054905003811015610e2f578273ffffffffffffffffffffffffffffffffffffffff1660038281548110610d4157fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415610e2257600360016003805490500381548110610d9d57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1660038281548110610dd557fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610e2f565b8080600101915050610d0d565b506001600381818054905003915081610e489190612d6d565b506003805490506004541115610e6757610e66600380549050611e6c565b5b8173ffffffffffffffffffffffffffffffffffffffff167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a25050565b33600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16610f6e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f4f776e657220646f6573206e6f7420657869737473000000000000000000000081525060200191505060405180910390fd5b81336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16611040576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600d8152602001807f6e6f7420636f6e6669726d65640000000000000000000000000000000000000081525060200191505060405180910390fd5b8360008082815260200190815260200160002060030160009054906101000a900460ff16156110d7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f747820616c72656164792065786563757465640000000000000000000000000081525060200191505060405180910390fd5b60006001600087815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550843373ffffffffffffffffffffffffffffffffffffffff167ff6a317157440607f36269043eb55f1287a5a19ba2216afeab88cd46cbcfb88e960405160405180910390a35050505050565b60026020528060005260406000206000915054906101000a900460ff1681565b606060008060006111ba612d99565b6000808781526020019081526020016000206040518060a00160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200160018201548152602001600282018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156112d05780601f106112a5576101008083540402835291602001916112d0565b820191906000526020600020905b8154815290600101906020018083116112b357829003601f168201915b505050505081526020016003820160009054906101000a900460ff16151515158152602001600482015481525050905080604001518160000151826060015183608001518393509450945094509450509193509193565b60016020528160005260406000206020528060005260406000206000915091509054906101000a900460ff1681565b600080600090505b6005548110156113e157838015611395575060008082815260200190815260200160002060030160009054906101000a900460ff16155b806113c857508280156113c7575060008082815260200190815260200160002060030160009054906101000a900460ff165b5b156113d4576001820191505b808060010191505061135e565b5092915050565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611489576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f4f6e6c792077616c6c657400000000000000000000000000000000000000000081525060200191505060405180910390fd5b80600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561154a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600c8152602001807f4f776e657220657869737473000000000000000000000000000000000000000081525060200191505060405180910390fd5b81600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156115ee576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600f8152602001807f61646472657373206973206e756c6c000000000000000000000000000000000081525060200191505060405180910390fd5b6001600380549050016004546032821115801561160b5750818111155b8015611618575060008114155b8015611625575060008214155b611697576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f696e76616c696420726571756972656d656e740000000000000000000000000081525060200191505060405180910390fd5b6001600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060038590806001815401808255809150509060018203906000526020600020016000909192909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550508473ffffffffffffffffffffffffffffffffffffffff167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25050505050565b6000806000905060008090505b60038054905081101561187c57600160008581526020019081526020016000206000600383815481106117db57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561185a576001820191505b60045482141561186f5760019250505061187f565b80806001019150506117ac565b50505b919050565b600080600090505b60038054905081101561194757600160008481526020019081526020016000206000600383815481106118bb57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561193a576001820191505b808060010191505061188c565b50919050565b60006020528060005260406000206000915090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690806001015490806002018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611a255780601f106119fa57610100808354040283529160200191611a25565b820191906000526020600020905b815481529060010190602001808311611a0857829003601f168201915b5050505050908060030160009054906101000a900460ff16908060040154905085565b60606003805480602002602001604051908101604052809291908181526020018280548015611acc57602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311611a82575b5050505050905090565b606080600554604051908082528060200260200182016040528015611b0a5781602001602082028038833980820191505090505b509050600080905060008090505b600554811015611bb457858015611b4f575060008082815260200190815260200160002060030160009054906101000a900460ff16155b80611b825750848015611b81575060008082815260200190815260200160002060030160009054906101000a900460ff165b5b15611ba75780838381518110611b9457fe5b6020026020010181815250506001820191505b8080600101915050611b18565b878703604051908082528060200260200182016040528015611be55781602001602082028038833980820191505090505b5093508790505b86811015611c2f57828181518110611c0057fe5b60200260200101518489830381518110611c1657fe5b6020026020010181815250508080600101915050611bec565b505050949350505050565b606080600380549050604051908082528060200260200182016040528015611c715781602001602082028038833980820191505090505b509050600080905060008090505b600380549050811015611db85760016000868152602001908152602001600020600060038381548110611cae57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611dab5760038181548110611d3357fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16838381518110611d6a57fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506001820191505b8080600101915050611c7f565b81604051908082528060200260200182016040528015611de75781602001602082028038833980820191505090505b509350600090505b81811015611e5e57828181518110611e0357fe5b6020026020010151848281518110611e1757fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250508080600101915050611def565b505050919050565b60055481565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611f0d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f4f6e6c792077616c6c657400000000000000000000000000000000000000000081525060200191505060405180910390fd5b6003805490508160328211158015611f255750818111155b8015611f32575060008114155b8015611f3f575060008214155b611fb1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f696e76616c696420726571756972656d656e740000000000000000000000000081525060200191505060405180910390fd5b826004819055507fa3f1ee9126a074d9326c682f561767f710e927faa811f7a99829d49dc421797a836040518082815260200191505060405180910390a1505050565b33600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff166120b4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f4f776e657220646f6573206e6f7420657869737473000000000000000000000081525060200191505060405180910390fd5b81600073ffffffffffffffffffffffffffffffffffffffff1660008083815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141561218d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260108152602001807f547820646f65736e27742065786973740000000000000000000000000000000081525060200191505060405180910390fd5b82336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615612260576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f697320616c726561647920636f6e6669726d656400000000000000000000000081525060200191505060405180910390fd5b600180600087815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550843373ffffffffffffffffffffffffffffffffffffffff167f4a504a94899432a9846e1aa406dceb1bcfd538bb839071d49d1e5e23f5be30ef60405160405180910390a36123158561278b565b5050505050565b6000612329848484612b68565b905061233481611ff4565b9392505050565b603281565b60045481565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146123e7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f4f6e6c792077616c6c657400000000000000000000000000000000000000000081525060200191505060405180910390fd5b81600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff166124a7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f4f776e657220646f6573206e6f7420657869737473000000000000000000000081525060200191505060405180910390fd5b81600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615612568576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600c8152602001807f4f776e657220657869737473000000000000000000000000000000000000000081525060200191505060405180910390fd5b60008090505b60038054905081101561264e578473ffffffffffffffffffffffffffffffffffffffff166003828154811061259f57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614156126415783600382815481106125f457fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061264e565b808060010191505061256e565b506000600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506001600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508373ffffffffffffffffffffffffffffffffffffffff167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a28273ffffffffffffffffffffffffffffffffffffffff167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a250505050565b33600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1661284b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f4f776e657220646f6573206e6f7420657869737473000000000000000000000081525060200191505060405180910390fd5b81336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1661291d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600d8152602001807f6e6f7420636f6e6669726d65640000000000000000000000000000000000000081525060200191505060405180910390fd5b8360008082815260200190815260200160002060030160009054906101000a900460ff16156129b4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f747820616c72656164792065786563757465640000000000000000000000000081525060200191505060405180910390fd5b6129bd8561179f565b15612b61576000806000878152602001908152602001600020905060018160030160006101000a81548160ff021916908315150217905550612add8160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16826001015483600201805460018160011615610100020316600290049050846002018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015612ad35780601f10612aa857610100808354040283529160200191612ad3565b820191906000526020600020905b815481529060010190602001808311612ab657829003601f168201915b5050505050612d46565b15612b1457857f33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed7560405160405180910390a2612b5f565b857f526441bb6c1aba3c9a4a6ca1d6545da9c2333c8c48343ef398eb858d72b7923660405160405180910390a260008160030160006101000a81548160ff0219169083151502179055505b505b5050505050565b600083600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415612c0e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600f8152602001807f61646472657373206973206e756c6c000000000000000000000000000000000081525060200191505060405180910390fd5b60055491506040518060a001604052808673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018481526020016000151581526020014281525060008084815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550602082015181600101556040820151816002019080519060200190612cd2929190612de0565b5060608201518160030160006101000a81548160ff021916908315150217905550608082015181600401559050506001600560008282540192505081905550817fc0ba8fe4b176c1714197d43b9cc6bcf797a4a7461c5fe8d0ef6e184ae7601e5160405160405180910390a2509392505050565b6000806040516020840160008287838a8c6187965a03f19250505080915050949350505050565b815481835581811115612d9457818360005260206000209182019101612d939190612e60565b5b505050565b6040518060a00160405280600073ffffffffffffffffffffffffffffffffffffffff1681526020016000815260200160608152602001600015158152602001600081525090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10612e2157805160ff1916838001178555612e4f565b82800160010185558215612e4f579182015b82811115612e4e578251825591602001919060010190612e33565b5b509050612e5c9190612e60565b5090565b612e8291905b80821115612e7e576000816000905550600101612e66565b5090565b9056fea265627a7a723158206ba682e023bebee6d26524d9ee0c422983151d22897a3f99fa13d8676a67145164736f6c63430005110032
|
{"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 2,268 |
0x264bEB950EA87fF23DD1445Ae1AFDd1229Da4d08
|
pragma solidity 0.4.15;
/// @title Multisignature wallet - Allows multiple parties to agree on transactions before execution.
/// @author Stefan George - <<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="4437302122252a6a23212b36232104272b2a37212a373d376a2a2130">[email protected]</a>>
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() {
if (msg.sender != address(this))
throw;
_;
}
modifier ownerDoesNotExist(address owner) {
if (isOwner[owner])
throw;
_;
}
modifier ownerExists(address owner) {
if (!isOwner[owner])
throw;
_;
}
modifier transactionExists(uint transactionId) {
if (transactions[transactionId].destination == 0)
throw;
_;
}
modifier confirmed(uint transactionId, address owner) {
if (!confirmations[transactionId][owner])
throw;
_;
}
modifier notConfirmed(uint transactionId, address owner) {
if (confirmations[transactionId][owner])
throw;
_;
}
modifier notExecuted(uint transactionId) {
if (transactions[transactionId].executed)
throw;
_;
}
modifier notNull(address _address) {
if (_address == 0)
throw;
_;
}
modifier validRequirement(uint ownerCount, uint _required) {
if ( ownerCount > MAX_OWNER_COUNT
|| _required > ownerCount
|| _required == 0
|| ownerCount == 0)
throw;
_;
}
/// @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++) {
if (isOwner[_owners[i]] || _owners[i] == 0)
throw;
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 tx = transactions[transactionId];
tx.executed = true;
if (tx.destination.call.value(tx.value)(tx.data))
Execution(transactionId);
else {
ExecutionFailure(transactionId);
tx.executed = false;
}
}
}
/// @dev Returns the confirmation status of a transaction.
/// @param transactionId Transaction ID.
/// @return Confirmation status.
function isConfirmed(uint transactionId)
public
constant
returns (bool)
{
uint count = 0;
for (uint i=0; i<owners.length; i++) {
if (confirmations[transactionId][owners[i]])
count += 1;
if (count == required)
return true;
}
}
/*
* Internal functions
*/
/// @dev Adds a new transaction to the transaction mapping, if transaction does not exist yet.
/// @param destination Transaction target address.
/// @param value Transaction ether value.
/// @param data Transaction data payload.
/// @return Returns transaction ID.
function addTransaction(address destination, uint value, bytes data)
internal
notNull(destination)
returns (uint transactionId)
{
transactionId = transactionCount;
transactions[transactionId] = Transaction({
destination: destination,
value: value,
data: data,
executed: false
});
transactionCount += 1;
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];
}
}
|
0x6060604052361561011a5763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663025e7c278114610165578063173825d91461019757806320ea8d86146101b85780632f54bf6e146101d05780633411c81c1461020357806354741525146102395780637065cb4814610268578063784547a7146102895780638b51d13f146102b35780639ace38c2146102db578063a0e67e2b1461039a578063a8abe69a14610401578063b5dc40c314610478578063b77bf600146104e2578063ba51a6df14610507578063c01a8c841461051f578063c642747414610537578063d74f8edd146105ae578063dc8452cd146105d3578063e20056e6146105f8578063ee22610b1461061f575b5b60003411156101625733600160a060020a03167fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c3460405190815260200160405180910390a25b5b005b341561017057600080fd5b61017b600435610637565b604051600160a060020a03909116815260200160405180910390f35b34156101a257600080fd5b610162600160a060020a0360043516610669565b005b34156101c357600080fd5b61016260043561081a565b005b34156101db57600080fd5b6101ef600160a060020a03600435166108fc565b604051901515815260200160405180910390f35b341561020e57600080fd5b6101ef600435600160a060020a0360243516610911565b604051901515815260200160405180910390f35b341561024457600080fd5b61025660043515156024351515610931565b60405190815260200160405180910390f35b341561027357600080fd5b610162600160a060020a03600435166109a0565b005b341561029457600080fd5b6101ef600435610ad5565b604051901515815260200160405180910390f35b34156102be57600080fd5b610256600435610b69565b60405190815260200160405180910390f35b34156102e657600080fd5b6102f1600435610be8565b604051600160a060020a03851681526020810184905281151560608201526080604082018181528454600260001961010060018416150201909116049183018290529060a0830190859080156103885780601f1061035d57610100808354040283529160200191610388565b820191906000526020600020905b81548152906001019060200180831161036b57829003601f168201915b50509550505050505060405180910390f35b34156103a557600080fd5b6103ad610c1c565b60405160208082528190810183818151815260200191508051906020019060200280838360005b838110156103ed5780820151818401525b6020016103d4565b505050509050019250505060405180910390f35b341561040c57600080fd5b6103ad60043560243560443515156064351515610c85565b60405160208082528190810183818151815260200191508051906020019060200280838360005b838110156103ed5780820151818401525b6020016103d4565b505050509050019250505060405180910390f35b341561048357600080fd5b6103ad600435610db3565b60405160208082528190810183818151815260200191508051906020019060200280838360005b838110156103ed5780820151818401525b6020016103d4565b505050509050019250505060405180910390f35b34156104ed57600080fd5b610256610f35565b60405190815260200160405180910390f35b341561051257600080fd5b610162600435610f3b565b005b341561052a57600080fd5b610162600435610fc9565b005b341561054257600080fd5b61025660048035600160a060020a03169060248035919060649060443590810190830135806020601f820181900481020160405190810160405281815292919060208401838380828437509496506110bb95505050505050565b60405190815260200160405180910390f35b34156105b957600080fd5b6102566110db565b60405190815260200160405180910390f35b34156105de57600080fd5b6102566110e0565b60405190815260200160405180910390f35b341561060357600080fd5b610162600160a060020a03600435811690602435166110e6565b005b341561062a57600080fd5b6101626004356112a7565b005b600380548290811061064557fe5b906000526020600020900160005b915054906101000a9004600160a060020a031681565b600030600160a060020a031633600160a060020a031614151561068b57600080fd5b600160a060020a038216600090815260026020526040902054829060ff1615156106b457600080fd5b600160a060020a0383166000908152600260205260408120805460ff1916905591505b600354600019018210156107af5782600160a060020a03166003838154811015156106fe57fe5b906000526020600020900160005b9054906101000a9004600160a060020a0316600160a060020a031614156107a35760038054600019810190811061073f57fe5b906000526020600020900160005b9054906101000a9004600160a060020a031660038381548110151561076e57fe5b906000526020600020900160005b6101000a815481600160a060020a030219169083600160a060020a031602179055506107af565b5b6001909101906106d7565b6003805460001901906107c2908261156a565b5060035460045411156107db576003546107db90610f3b565b5b82600160a060020a03167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a25b5b505b5050565b33600160a060020a03811660009081526002602052604090205460ff16151561084257600080fd5b600082815260016020908152604080832033600160a060020a038116855292529091205483919060ff16151561087757600080fd5b600084815260208190526040902060030154849060ff161561089857600080fd5b6000858152600160209081526040808320600160a060020a033316808552925291829020805460ff1916905586917ff6a317157440607f36269043eb55f1287a5a19ba2216afeab88cd46cbcfb88e9905160405180910390a35b5b505b50505b5050565b60026020526000908152604090205460ff1681565b600160209081526000928352604080842090915290825290205460ff1681565b6000805b6005548110156109985783801561095e575060008181526020819052604090206003015460ff16155b806109825750828015610982575060008181526020819052604090206003015460ff165b5b1561098f576001820191505b5b600101610935565b5b5092915050565b30600160a060020a031633600160a060020a03161415156109c057600080fd5b600160a060020a038116600090815260026020526040902054819060ff16156109e857600080fd5b81600160a060020a03811615156109fe57600080fd5b6003805490506001016004546032821180610a1857508181115b80610a21575080155b80610a2a575081155b15610a3457600080fd5b600160a060020a0385166000908152600260205260409020805460ff191660019081179091556003805490918101610a6c838261156a565b916000526020600020900160005b8154600160a060020a03808a166101009390930a8381029102199091161790915590507ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25b5b50505b505b505b50565b600080805b600354811015610b615760008481526001602052604081206003805491929184908110610b0357fe5b906000526020600020900160005b9054600160a060020a036101009290920a900416815260208101919091526040016000205460ff1615610b45576001820191505b600454821415610b585760019250610b61565b5b600101610ada565b5b5050919050565b6000805b600354811015610be15760008381526001602052604081206003805491929184908110610b9657fe5b906000526020600020900160005b9054600160a060020a036101009290920a900416815260208101919091526040016000205460ff1615610bd8576001820191505b5b600101610b6d565b5b50919050565b6000602081905290815260409020805460018201546003830154600160a060020a0390921692909160029091019060ff1684565b610c246115be565b6003805480602002602001604051908101604052809291908181526020018280548015610c7a57602002820191906000526020600020905b8154600160a060020a03168152600190910190602001808311610c5c575b505050505090505b90565b610c8d6115be565b610c956115be565b600080600554604051805910610ca85750595b908082528060200260200182016040525b50925060009150600090505b600554811015610d4057858015610cee575060008181526020819052604090206003015460ff16155b80610d125750848015610d12575060008181526020819052604090206003015460ff165b5b15610d375780838381518110610d2557fe5b60209081029091010152600191909101905b5b600101610cc5565b878703604051805910610d505750595b908082528060200260200182016040525b5093508790505b86811015610da757828181518110610d7c57fe5b906020019060200201518489830381518110610d9457fe5b602090810290910101525b600101610d68565b5b505050949350505050565b610dbb6115be565b610dc36115be565b6003546000908190604051805910610dd85750595b908082528060200260200182016040525b50925060009150600090505b600354811015610ebb5760008581526001602052604081206003805491929184908110610e1e57fe5b906000526020600020900160005b9054600160a060020a036101009290920a900416815260208101919091526040016000205460ff1615610eb2576003805482908110610e6757fe5b906000526020600020900160005b9054906101000a9004600160a060020a0316838381518110610e9357fe5b600160a060020a03909216602092830290910190910152600191909101905b5b600101610df5565b81604051805910610ec95750595b908082528060200260200182016040525b509350600090505b81811015610f2c57828181518110610ef657fe5b90602001906020020151848281518110610f0c57fe5b600160a060020a039092166020928302909101909101525b600101610ee2565b5b505050919050565b60055481565b30600160a060020a031633600160a060020a0316141515610f5b57600080fd5b600354816032821180610f6d57508181115b80610f76575080155b80610f7f575081155b15610f8957600080fd5b60048390557fa3f1ee9126a074d9326c682f561767f710e927faa811f7a99829d49dc421797a8360405190815260200160405180910390a15b5b50505b50565b33600160a060020a03811660009081526002602052604090205460ff161515610ff157600080fd5b6000828152602081905260409020548290600160a060020a0316151561101657600080fd5b600083815260016020908152604080832033600160a060020a038116855292529091205484919060ff161561104a57600080fd5b6000858152600160208181526040808420600160a060020a033316808652925292839020805460ff191690921790915586917f4a504a94899432a9846e1aa406dceb1bcfd538bb839071d49d1e5e23f5be30ef905160405180910390a36108f2856112a7565b5b5b50505b505b5050565b60006110c884848461146b565b90506110d381610fc9565b5b9392505050565b603281565b60045481565b600030600160a060020a031633600160a060020a031614151561110857600080fd5b600160a060020a038316600090815260026020526040902054839060ff16151561113157600080fd5b600160a060020a038316600090815260026020526040902054839060ff161561115957600080fd5b600092505b6003548310156112015784600160a060020a031660038481548110151561118157fe5b906000526020600020900160005b9054906101000a9004600160a060020a0316600160a060020a031614156111f557836003848154811015156111c057fe5b906000526020600020900160005b6101000a815481600160a060020a030219169083600160a060020a03160217905550611201565b5b60019092019161115e565b600160a060020a03808616600081815260026020526040808220805460ff199081169091559388168252908190208054909316600117909255907f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b90905160405180910390a283600160a060020a03167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25b5b505b505b505050565b33600160a060020a03811660009081526002602052604081205490919060ff1615156112d257600080fd5b600083815260016020908152604080832033600160a060020a038116855292529091205484919060ff16151561130757600080fd5b600085815260208190526040902060030154859060ff161561132857600080fd5b61133186610ad5565b1561145e576000868152602081905260409081902060038101805460ff19166001908117909155815490820154919750600160a060020a03169160028801905180828054600181600116156101000203166002900480156113d35780601f106113a8576101008083540402835291602001916113d3565b820191906000526020600020905b8154815290600101906020018083116113b657829003601f168201915b505091505060006040518083038185876187965a03f1925050501561142457857f33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed7560405160405180910390a261145e565b857f526441bb6c1aba3c9a4a6ca1d6545da9c2333c8c48343ef398eb858d72b7923660405160405180910390a260038501805460ff191690555b5b5b5b505b50505b505050565b600083600160a060020a038116151561148357600080fd5b600554915060806040519081016040908152600160a060020a0387168252602080830187905281830186905260006060840181905285815290819052208151815473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03919091161781556020820151816001015560408201518160020190805161150e9291602001906115e2565b506060820151600391909101805460ff191691151591909117905550600580546001019055817fc0ba8fe4b176c1714197d43b9cc6bcf797a4a7461c5fe8d0ef6e184ae7601e5160405160405180910390a25b5b509392505050565b81548183558181151161081357600083815260209020610813918101908301611661565b5b505050565b81548183558181151161081357600083815260209020610813918101908301611661565b5b505050565b60206040519081016040526000815290565b60206040519081016040526000815290565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061162357805160ff1916838001178555611650565b82800160010185558215611650579182015b82811115611650578251825591602001919060010190611635565b5b5061165d929150611661565b5090565b610c8291905b8082111561165d5760008155600101611667565b5090565b905600a165627a7a72305820be5cf6b0ffdfd6982ea40bcf023649a28e617309b8ae6ba27ec4f6432f9ac1e50029
|
{"success": true, "error": null, "results": {}}
| 2,269 |
0xe0ec39a9988cd4b8fb1c6d212ac148b05ad94a94
|
/**
*Submitted for verification at Etherscan.io on 2021-07-13
*/
/*
The Doge Tea Token
* 1,000,000,000,000 token supply
* No team tokens, no presale
*/
// 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 DOGTEA is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Doge Tea Token";
string private constant _symbol = "DOGTEA";
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 = 3;
uint256 private _teamFee = 6;
// Bot detection
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _teamAddress;
address payable private _marketingFunds;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1, address payable addr2) {
_teamAddress = addr1;
_marketingFunds = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = true;
_isExcludedFromFee[_marketingFunds] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 7;
_teamFee = 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 = 50000000000 * 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);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612edf565b60405180910390f35b34801561015057600080fd5b5061016b60048036038101906101669190612a02565b61045e565b6040516101789190612ec4565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a39190613081565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce91906129b3565b61048d565b6040516101e09190612ec4565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b9190612925565b610566565b005b34801561021e57600080fd5b50610227610656565b60405161023491906130f6565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f9190612a7f565b61065f565b005b34801561027257600080fd5b5061027b610711565b005b34801561028957600080fd5b506102a4600480360381019061029f9190612925565b610783565b6040516102b19190613081565b60405180910390f35b3480156102c657600080fd5b506102cf6107d4565b005b3480156102dd57600080fd5b506102e6610927565b6040516102f39190612df6565b60405180910390f35b34801561030857600080fd5b50610311610950565b60405161031e9190612edf565b60405180910390f35b34801561033357600080fd5b5061034e60048036038101906103499190612a02565b61098d565b60405161035b9190612ec4565b60405180910390f35b34801561037057600080fd5b5061038b60048036038101906103869190612a3e565b6109ab565b005b34801561039957600080fd5b506103a2610afb565b005b3480156103b057600080fd5b506103b9610b75565b005b3480156103c757600080fd5b506103e260048036038101906103dd9190612ad1565b6110d2565b005b3480156103f057600080fd5b5061040b60048036038101906104069190612977565b61121b565b6040516104189190613081565b60405180910390f35b60606040518060400160405280600e81526020017f446f67652054656120546f6b656e000000000000000000000000000000000000815250905090565b600061047261046b6112a2565b84846112aa565b6001905092915050565b6000683635c9adc5dea00000905090565b600061049a848484611475565b61055b846104a66112a2565b610556856040518060600160405280602881526020016137ba60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050c6112a2565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c349092919063ffffffff16565b6112aa565b600190509392505050565b61056e6112a2565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f290612fc1565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b6106676112a2565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106eb90612fc1565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107526112a2565b73ffffffffffffffffffffffffffffffffffffffff161461077257600080fd5b600047905061078081611c98565b50565b60006107cd600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d93565b9050919050565b6107dc6112a2565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610869576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086090612fc1565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600681526020017f444f475445410000000000000000000000000000000000000000000000000000815250905090565b60006109a161099a6112a2565b8484611475565b6001905092915050565b6109b36112a2565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a40576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3790612fc1565b60405180910390fd5b60005b8151811015610af7576001600a6000848481518110610a8b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610aef90613397565b915050610a43565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b3c6112a2565b73ffffffffffffffffffffffffffffffffffffffff1614610b5c57600080fd5b6000610b6730610783565b9050610b7281611e01565b50565b610b7d6112a2565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c0a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0190612fc1565b60405180910390fd5b600f60149054906101000a900460ff1615610c5a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c5190613041565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cea30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112aa565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d3057600080fd5b505afa158015610d44573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d68919061294e565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610dca57600080fd5b505afa158015610dde573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e02919061294e565b6040518363ffffffff1660e01b8152600401610e1f929190612e11565b602060405180830381600087803b158015610e3957600080fd5b505af1158015610e4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e71919061294e565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610efa30610783565b600080610f05610927565b426040518863ffffffff1660e01b8152600401610f2796959493929190612e63565b6060604051808303818588803b158015610f4057600080fd5b505af1158015610f54573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f799190612afa565b5050506001600f60166101000a81548160ff0219169083151502179055506001600f60176101000a81548160ff0219169083151502179055506802b5e3af16b18800006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161107c929190612e3a565b602060405180830381600087803b15801561109657600080fd5b505af11580156110aa573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110ce9190612aa8565b5050565b6110da6112a2565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611167576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115e90612fc1565b60405180910390fd5b600081116111aa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a190612f81565b60405180910390fd5b6111d960646111cb83683635c9adc5dea000006120fb90919063ffffffff16565b61217690919063ffffffff16565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6010546040516112109190613081565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561131a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131190613021565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561138a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138190612f41565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114689190613081565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114e5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114dc90613001565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611555576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154c90612f01565b60405180910390fd5b60008111611598576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158f90612fe1565b60405180910390fd5b6115a0610927565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561160e57506115de610927565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b7157600f60179054906101000a900460ff1615611841573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561169057503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116ea5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117445750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561184057600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661178a6112a2565b73ffffffffffffffffffffffffffffffffffffffff1614806118005750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117e86112a2565b73ffffffffffffffffffffffffffffffffffffffff16145b61183f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161183690613061565b60405180910390fd5b5b5b60105481111561185057600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118f45750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118fd57600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119a85750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119fe5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a165750600f60179054906101000a900460ff165b15611ab75742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a6657600080fd5b603c42611a7391906131b7565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611ac230610783565b9050600f60159054906101000a900460ff16158015611b2f5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b475750600f60169054906101000a900460ff165b15611b6f57611b5581611e01565b60004790506000811115611b6d57611b6c47611c98565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c185750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c2257600090505b611c2e848484846121c0565b50505050565b6000838311158290611c7c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c739190612edf565b60405180910390fd5b5060008385611c8b9190613298565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611ce860028461217690919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d13573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d6460028461217690919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d8f573d6000803e3d6000fd5b5050565b6000600654821115611dda576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dd190612f21565b60405180910390fd5b6000611de46121ed565b9050611df9818461217690919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e5f577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611e8d5781602001602082028036833780820191505090505b5090503081600081518110611ecb577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611f6d57600080fd5b505afa158015611f81573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fa5919061294e565b81600181518110611fdf577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061204630600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112aa565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016120aa95949392919061309c565b600060405180830381600087803b1580156120c457600080fd5b505af11580156120d8573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b60008083141561210e5760009050612170565b6000828461211c919061323e565b905082848261212b919061320d565b1461216b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161216290612fa1565b60405180910390fd5b809150505b92915050565b60006121b883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612218565b905092915050565b806121ce576121cd61227b565b5b6121d98484846122ac565b806121e7576121e6612477565b5b50505050565b60008060006121fa612489565b91509150612211818361217690919063ffffffff16565b9250505090565b6000808311829061225f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122569190612edf565b60405180910390fd5b506000838561226e919061320d565b9050809150509392505050565b600060085414801561228f57506000600954145b15612299576122aa565b600060088190555060006009819055505b565b6000806000806000806122be876124eb565b95509550955095509550955061231c86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461255390919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123b185600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259d90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123fd816125fb565b61240784836126b8565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516124649190613081565b60405180910390a3505050505050505050565b6007600881905550600a600981905550565b600080600060065490506000683635c9adc5dea0000090506124bf683635c9adc5dea0000060065461217690919063ffffffff16565b8210156124de57600654683635c9adc5dea000009350935050506124e7565b81819350935050505b9091565b60008060008060008060008060006125088a6008546009546126f2565b92509250925060006125186121ed565b9050600080600061252b8e878787612788565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061259583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c34565b905092915050565b60008082846125ac91906131b7565b9050838110156125f1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125e890612f61565b60405180910390fd5b8091505092915050565b60006126056121ed565b9050600061261c82846120fb90919063ffffffff16565b905061267081600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259d90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6126cd8260065461255390919063ffffffff16565b6006819055506126e88160075461259d90919063ffffffff16565b6007819055505050565b60008060008061271e6064612710888a6120fb90919063ffffffff16565b61217690919063ffffffff16565b90506000612748606461273a888b6120fb90919063ffffffff16565b61217690919063ffffffff16565b9050600061277182612763858c61255390919063ffffffff16565b61255390919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806127a185896120fb90919063ffffffff16565b905060006127b886896120fb90919063ffffffff16565b905060006127cf87896120fb90919063ffffffff16565b905060006127f8826127ea858761255390919063ffffffff16565b61255390919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061282461281f84613136565b613111565b9050808382526020820190508285602086028201111561284357600080fd5b60005b858110156128735781612859888261287d565b845260208401935060208301925050600181019050612846565b5050509392505050565b60008135905061288c81613774565b92915050565b6000815190506128a181613774565b92915050565b600082601f8301126128b857600080fd5b81356128c8848260208601612811565b91505092915050565b6000813590506128e08161378b565b92915050565b6000815190506128f58161378b565b92915050565b60008135905061290a816137a2565b92915050565b60008151905061291f816137a2565b92915050565b60006020828403121561293757600080fd5b60006129458482850161287d565b91505092915050565b60006020828403121561296057600080fd5b600061296e84828501612892565b91505092915050565b6000806040838503121561298a57600080fd5b60006129988582860161287d565b92505060206129a98582860161287d565b9150509250929050565b6000806000606084860312156129c857600080fd5b60006129d68682870161287d565b93505060206129e78682870161287d565b92505060406129f8868287016128fb565b9150509250925092565b60008060408385031215612a1557600080fd5b6000612a238582860161287d565b9250506020612a34858286016128fb565b9150509250929050565b600060208284031215612a5057600080fd5b600082013567ffffffffffffffff811115612a6a57600080fd5b612a76848285016128a7565b91505092915050565b600060208284031215612a9157600080fd5b6000612a9f848285016128d1565b91505092915050565b600060208284031215612aba57600080fd5b6000612ac8848285016128e6565b91505092915050565b600060208284031215612ae357600080fd5b6000612af1848285016128fb565b91505092915050565b600080600060608486031215612b0f57600080fd5b6000612b1d86828701612910565b9350506020612b2e86828701612910565b9250506040612b3f86828701612910565b9150509250925092565b6000612b558383612b61565b60208301905092915050565b612b6a816132cc565b82525050565b612b79816132cc565b82525050565b6000612b8a82613172565b612b948185613195565b9350612b9f83613162565b8060005b83811015612bd0578151612bb78882612b49565b9750612bc283613188565b925050600181019050612ba3565b5085935050505092915050565b612be6816132de565b82525050565b612bf581613321565b82525050565b6000612c068261317d565b612c1081856131a6565b9350612c20818560208601613333565b612c298161346d565b840191505092915050565b6000612c416023836131a6565b9150612c4c8261347e565b604082019050919050565b6000612c64602a836131a6565b9150612c6f826134cd565b604082019050919050565b6000612c876022836131a6565b9150612c928261351c565b604082019050919050565b6000612caa601b836131a6565b9150612cb58261356b565b602082019050919050565b6000612ccd601d836131a6565b9150612cd882613594565b602082019050919050565b6000612cf06021836131a6565b9150612cfb826135bd565b604082019050919050565b6000612d136020836131a6565b9150612d1e8261360c565b602082019050919050565b6000612d366029836131a6565b9150612d4182613635565b604082019050919050565b6000612d596025836131a6565b9150612d6482613684565b604082019050919050565b6000612d7c6024836131a6565b9150612d87826136d3565b604082019050919050565b6000612d9f6017836131a6565b9150612daa82613722565b602082019050919050565b6000612dc26011836131a6565b9150612dcd8261374b565b602082019050919050565b612de18161330a565b82525050565b612df081613314565b82525050565b6000602082019050612e0b6000830184612b70565b92915050565b6000604082019050612e266000830185612b70565b612e336020830184612b70565b9392505050565b6000604082019050612e4f6000830185612b70565b612e5c6020830184612dd8565b9392505050565b600060c082019050612e786000830189612b70565b612e856020830188612dd8565b612e926040830187612bec565b612e9f6060830186612bec565b612eac6080830185612b70565b612eb960a0830184612dd8565b979650505050505050565b6000602082019050612ed96000830184612bdd565b92915050565b60006020820190508181036000830152612ef98184612bfb565b905092915050565b60006020820190508181036000830152612f1a81612c34565b9050919050565b60006020820190508181036000830152612f3a81612c57565b9050919050565b60006020820190508181036000830152612f5a81612c7a565b9050919050565b60006020820190508181036000830152612f7a81612c9d565b9050919050565b60006020820190508181036000830152612f9a81612cc0565b9050919050565b60006020820190508181036000830152612fba81612ce3565b9050919050565b60006020820190508181036000830152612fda81612d06565b9050919050565b60006020820190508181036000830152612ffa81612d29565b9050919050565b6000602082019050818103600083015261301a81612d4c565b9050919050565b6000602082019050818103600083015261303a81612d6f565b9050919050565b6000602082019050818103600083015261305a81612d92565b9050919050565b6000602082019050818103600083015261307a81612db5565b9050919050565b60006020820190506130966000830184612dd8565b92915050565b600060a0820190506130b16000830188612dd8565b6130be6020830187612bec565b81810360408301526130d08186612b7f565b90506130df6060830185612b70565b6130ec6080830184612dd8565b9695505050505050565b600060208201905061310b6000830184612de7565b92915050565b600061311b61312c565b90506131278282613366565b919050565b6000604051905090565b600067ffffffffffffffff8211156131515761315061343e565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006131c28261330a565b91506131cd8361330a565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613202576132016133e0565b5b828201905092915050565b60006132188261330a565b91506132238361330a565b9250826132335761323261340f565b5b828204905092915050565b60006132498261330a565b91506132548361330a565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561328d5761328c6133e0565b5b828202905092915050565b60006132a38261330a565b91506132ae8361330a565b9250828210156132c1576132c06133e0565b5b828203905092915050565b60006132d7826132ea565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061332c8261330a565b9050919050565b60005b83811015613351578082015181840152602081019050613336565b83811115613360576000848401525b50505050565b61336f8261346d565b810181811067ffffffffffffffff8211171561338e5761338d61343e565b5b80604052505050565b60006133a28261330a565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133d5576133d46133e0565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b61377d816132cc565b811461378857600080fd5b50565b613794816132de565b811461379f57600080fd5b50565b6137ab8161330a565b81146137b657600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220cb2867852c14e9d7588f3f5f27d3b7ec517729fd82d58c2ae101787b3b26c04164736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 2,270 |
0xd883209c4dcd497f24633c627a4e451013424841
|
pragma solidity ^0.4.24;
contract dPonzi {
address public manager;//who originally create the contract
struct PlayerStruct {
uint key;
uint food;
uint idx;
uint gametime;
uint flag;
}
struct RefStruct {
address player;
uint flag;
}
struct RefStructAdd {
bool flag;
string name;
}
struct PotCntStruct {
address[] player;
uint last;
uint balance;
uint keys;
uint food;
uint gtime;
uint gameTime;
uint lastRecord;
uint entryAmount;
mapping(string => PackageStruct) potStruct;
}
struct IdxStruct {
mapping(address => PlayerStruct) playerStruct;
}
struct PackageStruct {
uint entryAmount;
}
mapping(string => PotCntStruct) potCntInfo;
mapping(string => IdxStruct) idxStruct;
mapping(string => RefStruct) idxR;
mapping(address => RefStructAdd) public idxRadd;
constructor() public {
manager = msg.sender;
potCntInfo['d'].gameTime = now;
potCntInfo['7'].gameTime = now;
potCntInfo['30'].gameTime = now;
potCntInfo['90'].gameTime = now;
potCntInfo['180'].gameTime = now;
potCntInfo['365'].gameTime = now;
potCntInfo['l'].gameTime = now;
potCntInfo['r'].gameTime = now;
potCntInfo['d'].gtime = now;
potCntInfo['7'].gtime = now;
potCntInfo['30'].gtime = now;
potCntInfo['90'].gtime = now;
potCntInfo['180'].gtime = now;
potCntInfo['365'].gtime = now;
potCntInfo['l'].gtime = now;
potCntInfo['r'].gtime = now;
potCntInfo['d'].last = now;
potCntInfo['7'].last = now;
potCntInfo['30'].last = now;
potCntInfo['90'].last = now;
potCntInfo['180'].last = now;
//declare precalculated entry amount to save gas during entry
potCntInfo['i'].entryAmount = 10;
potCntInfo['d'].entryAmount = 1;
potCntInfo['7'].entryAmount = 4;
potCntInfo['30'].entryAmount = 8;
// pot 90 and pot dividend share the same 15%
potCntInfo['90'].entryAmount = 15;
potCntInfo['180'].entryAmount = 25;
//pot 365 and pot royal share the same 5%
potCntInfo['365'].entryAmount = 5;
potCntInfo['l'].entryAmount = 2;
}
function enter(string package, address advisor) public payable {
require(msg.value >= 0.01 ether, "0 ether is not allowed");
uint key = 0;
uint multiplier = 100000000000000;
if(keccak256(abi.encodePacked(package)) == keccak256("BasicK")) {
require(msg.value == 0.01 ether, "Invalid Package Amount");
key = 1;
}
else if (keccak256(abi.encodePacked(package)) == keccak256("PremiumK")){
require(msg.value == 0.1 ether, "Invalid Package Amount");
key = 11;
multiplier = multiplier * 10;
}
else if (keccak256(abi.encodePacked(package)) == keccak256("LuxuryK")){
require(msg.value == 1 ether, "Invalid Package Amount");
key = 120;
multiplier = multiplier * 100;
addRoyLuxList('l', 'idxLuxury', now, 500);
}
else if (keccak256(abi.encodePacked(package)) == keccak256("RoyalK")){
require(msg.value == 10 ether, "Invalid Package Amount");
key = 1300;
multiplier = multiplier * 1000;
addRoyLuxList('r', 'idxRoyal', now, 100);
}
if (key > 0){
if ( idxRadd[advisor].flag ) {
advisor.transfer(potCntInfo['i'].entryAmount * multiplier);
}
else {
potCntInfo['i'].balance += potCntInfo['i'].entryAmount * multiplier;
}
//Allocation
potCntInfo['d'].balance += potCntInfo['d'].entryAmount * multiplier;
potCntInfo['7'].balance += potCntInfo['7'].entryAmount * multiplier;
potCntInfo['30'].balance += potCntInfo['30'].entryAmount * multiplier;
potCntInfo['90'].balance += potCntInfo['90'].entryAmount * multiplier;
potCntInfo['180'].balance += potCntInfo['180'].entryAmount * multiplier;
potCntInfo['365'].balance += potCntInfo['365'].entryAmount * multiplier;
potCntInfo['l'].balance += potCntInfo['l'].entryAmount * multiplier;
potCntInfo['r'].balance += potCntInfo['365'].entryAmount * multiplier;
//admin amount
potCntInfo['i'].balance += potCntInfo['i'].entryAmount * multiplier;
potCntInfo['dv'].balance += potCntInfo['90'].entryAmount * multiplier;
addPlayerMapping('d', 'idxDaily', key, 30);//30 + 20
addPlayerMapping('7', 'idx7Pot', key, 60);
addPlayerMapping('30', 'idx30Pot', key, 90);
addPlayerMapping('90', 'idx90Pot', key, 120);
addPlayerMapping('180', 'idx180Pot', key, 150);
addPlayerMapping('365', 'idx365Pot', key, 0);
}
}
function addPlayerMapping(string x1, string x2, uint key, uint timeAdd ) private{
//if smaller, which means the game is expired.
if(potCntInfo[x1].last <= now){
potCntInfo[x1].last = now;
}
/* potCntInfo[x1].last += (key * timeAdd); */
potCntInfo[x1].last += (key * timeAdd);
//Add into Players Mapping
if (idxStruct[x2].playerStruct[msg.sender].flag == 0) {
potCntInfo[x1].player.push(msg.sender);
idxStruct[x2].playerStruct[msg.sender] = PlayerStruct(key, 0, potCntInfo[x1].player.length, potCntInfo[x1].gtime, 1);
}
else if (idxStruct[x2].playerStruct[msg.sender].gametime != potCntInfo['d'].gtime){
potCntInfo[x1].player.push(msg.sender);
idxStruct[x2].playerStruct[msg.sender] = PlayerStruct(key, 0, potCntInfo[x1].player.length, potCntInfo[x1].gtime, 1);
}
else {
idxStruct[x2].playerStruct[msg.sender].key += key;
}
potCntInfo[x1].keys += key;
}
function joinboard(string name) public payable {
require(msg.value >= 0.01 ether, "0 ether is not allowed");
if (idxR[name].flag == 0 ) {
idxR[name] = RefStruct(msg.sender, 1);
potCntInfo['i'].balance += msg.value;
/* add to address mapping */
idxRadd[msg.sender].name = name;
idxRadd[msg.sender].flag = true;
}
else {
revert("Name is not unique");
}
}
function pickFood(uint pickTime, string x1, string x2, uint num) public restricted {
uint i=0;
uint j=0;
if (potCntInfo[x1].player.length > 0 && potCntInfo[x1].food <= num) {//if pot.player has player and pot has food less than pass in num
do {
j = potCntInfo[x1].keys < num ? j : random(potCntInfo[x1].player.length, pickTime);//random pick players in pot
if (idxStruct[x2].playerStruct[potCntInfo[x1].player[j]].food > 0) {//if potplayer[address] has food > 0, get next potPlayer[address]
j++;
}
else {
idxStruct[x2].playerStruct[potCntInfo[x1].player[j]].food = potCntInfo[x1].keys < num ? idxStruct[x2].playerStruct[potCntInfo[x1].player[j]].key : random(idxStruct[x2].playerStruct[potCntInfo[x1].player[j]].key, pickTime);
if (potCntInfo[x1].food + idxStruct[x2].playerStruct[potCntInfo[x1].player[j]].food > num) {//if pot.food + potPlayer.food > num
idxStruct[x2].playerStruct[potCntInfo[x1].player[j]].food = num-potCntInfo[x1].food;
potCntInfo[x1].food = num;
break;
}
else {
potCntInfo[x1].food += idxStruct[x2].playerStruct[potCntInfo[x1].player[j]].food;
}
j++; i++;
}
if( potCntInfo[x1].keys < num && j == potCntInfo[x1].player.length) {//exit loop when pot.keys less than num
break;
}
if(potCntInfo[x1].food == num) {//exit loop when pot.food less than num
break;
}
}
while (i<10);
potCntInfo[x1].lastRecord = potCntInfo[x1].keys < num ? (potCntInfo[x1].keys == potCntInfo[x1].food ? 1 : 0) : (potCntInfo[x1].food == num ? 1 : 0);
}
else {
potCntInfo[x1].lastRecord = 1;
}
}
function pickWinner(uint pickTime, bool sendDaily, bool send7Pot, bool send30Pot, bool send90Pot, bool send180Pot, bool send365Pot) public restricted{
//Hit the Daily pot
hitPotProcess('d', sendDaily, pickTime);
//Hit the 7 day pot
hitPotProcess('7', send7Pot, pickTime);
//Hit the 30 day pot
hitPotProcess('30', send30Pot, pickTime);
//Hit the 90 day pot
hitPotProcess('90', send90Pot, pickTime);
//Hit the 180 day pot
hitPotProcess('180', send180Pot, pickTime);
//Hit daily pot maturity
maturityProcess('d', sendDaily, pickTime, 86400);
//Hit 7 pot maturity
maturityProcess('7', send7Pot, pickTime, 604800);
//Hit 30 pot maturity
maturityProcess('30', send30Pot, pickTime, 2592000);
//Hit 90 pot maturity
maturityProcess('90', send90Pot, pickTime, 7776000);
//Hit 180 pot maturity
maturityProcess('180', send180Pot, pickTime, 15552000);
//Hit 365 pot maturity
maturityProcess('365', send365Pot, pickTime, 31536000);
//Hit 365 days pot maturity
if (potCntInfo['365'].balance > 0 && send365Pot) {
if (pickTime - potCntInfo['365'].gameTime >= 31536000) {
maturityProcess('l', send365Pot, pickTime, 31536000);
maturityProcess('r', send365Pot, pickTime, 31536000);
}
}
}
function hitPotProcess(string x1, bool send, uint pickTime) private {
if (potCntInfo[x1].balance > 0 && send) {
if (pickTime - potCntInfo[x1].last >= 20) { //additional 20 seconds for safe
potCntInfo[x1].balance = 0;
potCntInfo[x1].food = 0;
potCntInfo[x1].keys = 0;
delete potCntInfo[x1].player;
potCntInfo[x1].gtime = pickTime;
}
}
}
function maturityProcess(string x1, bool send, uint pickTime, uint addTime) private {
if (potCntInfo[x1].balance > 0 && send) {
if (pickTime - potCntInfo[x1].gameTime >= addTime) {
potCntInfo[x1].balance = 0;
potCntInfo[x1].food = 0;
potCntInfo[x1].keys = 0;
delete potCntInfo[x1].player;
potCntInfo[x1].gameTime = pickTime;
potCntInfo[x1].gtime = pickTime;
}
}
}
//Start : Util Function
modifier restricted() {
require(msg.sender == manager, "Only manager is allowed");//must be manager to call this function
_;
}
function random(uint maxNum, uint timestamp) private view returns (uint){
return uint(keccak256(abi.encodePacked(block.difficulty, timestamp, potCntInfo['d'].balance, potCntInfo['7'].balance, potCntInfo['30'].balance, potCntInfo['90'].balance, potCntInfo['180'].balance, potCntInfo['365'].balance))) % maxNum;
}
function addRoyLuxList(string x1, string x2, uint timestamp, uint num) private {
uint pick;
if ( potCntInfo[x1].player.length < num) {
if (idxStruct[x2].playerStruct[msg.sender].flag == 0 ) {
idxStruct[x2].playerStruct[msg.sender] = PlayerStruct(0, 0, potCntInfo[x1].player.length, potCntInfo['365'].gtime, 1);
potCntInfo[x1].player.push(msg.sender);
}
else if (idxStruct[x2].playerStruct[msg.sender].gametime != potCntInfo['365'].gtime ) {
idxStruct[x2].playerStruct[msg.sender] = PlayerStruct(0, 0, potCntInfo[x1].player.length, potCntInfo['365'].gtime, 1);
potCntInfo[x1].player.push(msg.sender);
}
}
else {
if (idxStruct[x2].playerStruct[msg.sender].flag == 0 ) {
pick = random(potCntInfo[x1].player.length, timestamp);
idxStruct[x2].playerStruct[msg.sender] = PlayerStruct(0, 0, idxStruct[x2].playerStruct[potCntInfo[x1].player[pick]].idx, potCntInfo['365'].gtime, 1);
idxStruct[x2].playerStruct[potCntInfo[x1].player[pick]].flag = 0;
potCntInfo[x1].player[pick] = msg.sender;
}
else if (idxStruct[x2].playerStruct[msg.sender].gametime != potCntInfo['365'].gtime ) {
pick = random(potCntInfo[x1].player.length, timestamp);
idxStruct[x2].playerStruct[msg.sender] = PlayerStruct(0, 0, idxStruct[x2].playerStruct[potCntInfo[x1].player[pick]].idx, potCntInfo['365'].gtime, 1);
idxStruct[x2].playerStruct[potCntInfo[x1].player[pick]].flag = 0;
potCntInfo[x1].player[pick] = msg.sender;
}
}
}
function getPotCnt(string x) public constant returns(uint count, uint pLast, uint pot, uint keystore, uint gtime, uint gameTime, uint food) {
return (potCntInfo[x].player.length, potCntInfo[x].last, potCntInfo[x].balance, potCntInfo[x].keys, potCntInfo[x].gtime, potCntInfo[x].gameTime, potCntInfo[x].food);
}
function getIdx(string x1, string x2, uint p) public constant returns(address p1, uint food, uint gametime, uint flag) {
return (potCntInfo[x1].player[p], idxStruct[x2].playerStruct[potCntInfo[x1].player[p]].food, idxStruct[x2].playerStruct[potCntInfo[x1].player[p]].gametime, idxStruct[x2].playerStruct[potCntInfo[x1].player[p]].flag);
}
function getLast(string x) public constant returns(uint lastRecord) {
return potCntInfo[x].lastRecord;
}
function sendFoods(address[500] p, uint[500] food) public restricted {
for(uint k = 0; k < p.length; k++){
if (food[k] == 0) {
return;
}
p[k].transfer(food[k]);
}
}
function sendItDv(string x1) public restricted {
msg.sender.transfer(potCntInfo[x1].balance);
potCntInfo[x1].balance = 0;
}
function getReffAdd(string x) public constant returns(address){
if( idxR[x].flag == 1){
return idxR[x].player;
}else{
revert("Not found!");
}
}
function getReffName(address x) public constant returns(string){
if( idxRadd[x].flag){
return idxRadd[x].name;
}else{
revert("Not found!");
}
}
//End : Util Function
}
|
0x6080604052600436106100c45763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663328db98581146100c9578063420dd15a1461015a5780634634009a146101c5578063481c6a751461028e5780634c813d6d146102bf57806352ecf7c41461031a57806368cdf759146103505780636a0b50e4146103a95780637878202714610447578063960787a21461049e578063ca3c75191461050c578063d4e36a87146105a2578063e8d3a5a914610646575b600080fd5b3480156100d557600080fd5b506040805160206004803580820135601f81018490048402850184019095528484526101229436949293602493928401919081908401838280828437509497506106929650505050505050565b604080519788526020880196909652868601949094526060860192909252608085015260a084015260c0830152519081900360e00190f35b34801561016657600080fd5b506040805160206004803580820135601f81018490048402850184019095528484526101b39436949293602493928401919081908401838280828437509497506109889650505050505050565b60408051918252519081900360200190f35b3480156101d157600080fd5b506040805160206004803580820135601f810184900484028501840190955284845261025e94369492936024939284019190819084018382808284375050604080516020601f89358b018035918201839004830284018301909452808352979a99988101979196509182019450925082915084018382808284375094975050933594506109f59350505050565b60408051600160a060020a0390951685526020850193909352838301919091526060830152519081900360800190f35b34801561029a57600080fd5b506102a3610db4565b60408051600160a060020a039092168252519081900360200190f35b3480156102cb57600080fd5b506040805160206004803580820135601f8101849004840285018401909552848452610318943694929360249392840191908190840183828082843750949750610dc39650505050505050565b005b34801561032657600080fd5b50610318600435602435151560443515156064351515608435151560a435151560c4351515610f17565b34801561035c57600080fd5b506040805160206004803580820135601f81018490048402850184019095528484526102a39436949293602493928401919081908401838280828437509497506112349650505050505050565b3480156103b557600080fd5b5060408051602060046024803582810135601f810185900485028601850190965285855261031895833595369560449491939091019190819084018382808284375050604080516020601f89358b018035918201839004830284018301909452808352979a99988101979196509182019450925082915084018382808284375094975050933594506113649350505050565b6040805160206004803580820135601f810184900484028501840190955284845261031894369492936024939284019190819084018382808284375094975050509235600160a060020a0316935061230392505050565b3480156104aa57600080fd5b5060408051613e80818101909252610318913691600491613e84919083906101f4908390839080828437505060408051613e808181019092529497969581810195945092506101f49150839083908082843750939650612f9095505050505050565b34801561051857600080fd5b5061052d600160a060020a0360043516613072565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561056757818101518382015260200161054f565b50505050905090810190601f1680156105945780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156105ae57600080fd5b506105c3600160a060020a0360043516613144565b604051808315151515815260200180602001828103825283818151815260200191508051906020019080838360005b8381101561060a5781810151838201526020016105f2565b50505050905090810190601f1680156106375780820380516001836020036101000a031916815260200191505b50935050505060405180910390f35b6040805160206004803580820135601f81018490048402850184019095528484526103189436949293602493928401919081908401838280828437509497506131f29650505050505050565b60008060008060008060006001886040518082805190602001908083835b602083106106cf5780518252601f1990920191602091820191016106b0565b51815160209384036101000a60001901801990921691161790529201948552506040519384900381018420548c519094600194508d9350918291908401908083835b602083106107305780518252601f199092019160209182019101610711565b6001836020036101000a03801982511681845116808217855250505050505090500191505090815260200160405180910390206001015460018a6040518082805190602001908083835b602083106107995780518252601f19909201916020918201910161077a565b51815160209384036101000a60001901801990921691161790529201948552506040519384900381018420600201548e519094600194508f9350918291908401908083835b602083106107fd5780518252601f1990920191602091820191016107de565b6001836020036101000a03801982511681845116808217855250505050505090500191505090815260200160405180910390206003015460018c6040518082805190602001908083835b602083106108665780518252601f199092019160209182019101610847565b6001836020036101000a03801982511681845116808217855250505050505090500191505090815260200160405180910390206005015460018d6040518082805190602001908083835b602083106108cf5780518252601f1990920191602091820191016108b0565b6001836020036101000a03801982511681845116808217855250505050505090500191505090815260200160405180910390206006015460018e6040518082805190602001908083835b602083106109385780518252601f199092019160209182019101610919565b6001836020036101000a0380198251168184511680821785525050505050509050019150509081526020016040518091039020600401549650965096509650965096509650919395979092949650565b60006001826040518082805190602001908083835b602083106109bc5780518252601f19909201916020918201910161099d565b51815160209384036101000a6000190180199092169116179052920194855250604051938490030190922060070154925050505b919050565b6000806000806001876040518082805190602001908083835b60208310610a2d5780518252601f199092019160209182019101610a0e565b51815160209384036101000a6000190180199092169116179052920194855250604051938490030190922080549092508791508110610a6857fe5b9060005260206000200160009054906101000a9004600160a060020a03166002876040518082805190602001908083835b60208310610ab85780518252601f199092019160209182019101610a99565b51815160209384036101000a600019018019909216911617905292019485525060405193849003810184208c51909460009450600193508d92909182918401908083835b60208310610b1b5780518252601f199092019160209182019101610afc565b51815160209384036101000a6000190180199092169116179052920194855250604051938490030190922080549092508a91508110610b5657fe5b9060005260206000200160009054906101000a9004600160a060020a0316600160a060020a0316600160a060020a03168152602001908152602001600020600101546002886040518082805190602001908083835b60208310610bca5780518252601f199092019160209182019101610bab565b51815160209384036101000a600019018019909216911617905292019485525060405193849003810184208d51909460009450600193508e92909182918401908083835b60208310610c2d5780518252601f199092019160209182019101610c0e565b51815160209384036101000a6000190180199092169116179052920194855250604051938490030190922080549092508b91508110610c6857fe5b9060005260206000200160009054906101000a9004600160a060020a0316600160a060020a0316600160a060020a03168152602001908152602001600020600301546002896040518082805190602001908083835b60208310610cdc5780518252601f199092019160209182019101610cbd565b51815160209384036101000a600019018019909216911617905292019485525060405193849003810184208e51909460009450600193508f92909182918401908083835b60208310610d3f5780518252601f199092019160209182019101610d20565b51815160209384036101000a6000190180199092169116179052920194855250604051938490030190922080549092508c91508110610d7a57fe5b600091825260208083209190910154600160a060020a03168352820192909252604001902060040154929a91995097509095509350505050565b600054600160a060020a031681565b600054600160a060020a03163314610e13576040805160e560020a62461bcd02815260206004820152601760248201526000805160206150ab833981519152604482015290519081900360640190fd5b33600160a060020a03166108fc6001836040518082805190602001908083835b60208310610e525780518252601f199092019160209182019101610e33565b51815160209384036101000a600019018019909216911617905292019485525060405193849003018320600201548015949094029392915060009050818181858888f19350505050158015610eab573d6000803e3d6000fd5b5060006001826040518082805190602001908083835b60208310610ee05780518252601f199092019160209182019101610ec1565b51815160209384036101000a6000190180199092169116179052920194855250604051938490030190922060020192909255505050565b600054600160a060020a03163314610f67576040805160e560020a62461bcd02815260206004820152601760248201526000805160206150ab833981519152604482015290519081900360640190fd5b610f8e60408051908101604052806001815260200160fa60020a601902815250878961342b565b610fb560408051908101604052806001815260200160f860020a603702815250868961342b565b610fdd60408051908101604052806002815260200160f460020a61033302815250858961342b565b61100560408051908101604052806002815260200160f460020a61039302815250848961342b565b61102e60408051908101604052806003815260200160ec60020a6203138302815250838961342b565b61105960408051908101604052806001815260200160fa60020a601902815250878962015180613725565b61108460408051908101604052806001815260200160f860020a603702815250868962093a80613725565b6110b060408051908101604052806002815260200160f460020a61033302815250858962278d00613725565b6110dc60408051908101604052806002815260200160f460020a6103930281525084896276a700613725565b61110960408051908101604052806003815260200160ec60020a6203138302815250838962ed4e00613725565b61113760408051908101604052806003815260200160e860020a623336350281525082896301e13380613725565b6040805160e860020a623336350281526001600382015290519081900360230190206002015460001080156111695750805b1561122b576040805160e860020a62333635028152600160038201529051908190036023019020600601546301e133809088031061122b576111e66040805190810160405280600181526020017f6c0000000000000000000000000000000000000000000000000000000000000081525082896301e13380613725565b61122b6040805190810160405280600181526020017f720000000000000000000000000000000000000000000000000000000000000081525082896301e13380613725565b50505050505050565b60006003826040518082805190602001908083835b602083106112685780518252601f199092019160209182019101611249565b51815160209384036101000a60001901801990921691161790529201948552506040519384900301909220600190810154141591506113149050576003826040518082805190602001908083835b602083106112d55780518252601f1990920191602091820191016112b6565b51815160209384036101000a6000190180199092169116179052920194855250604051938490030190922054600160a060020a031692506109f0915050565b6040805160e560020a62461bcd02815260206004820152600a60248201527f4e6f7420666f756e642100000000000000000000000000000000000000000000604482015290519081900360640190fd5b600080548190600160a060020a031633146113b7576040805160e560020a62461bcd02815260206004820152601760248201526000805160206150ab833981519152604482015290519081900360640190fd5b600091506000905060006001866040518082805190602001908083835b602083106113f35780518252601f1990920191602091820191016113d4565b51815160209384036101000a600019018019909216911617905292019485525060405193849003019092205492909211915050801561149a5750826001866040518082805190602001908083835b602083106114605780518252601f199092019160209182019101611441565b6001836020036101000a03801982511681845116808217855250505050505090500191505090815260200160405180910390206004015411155b15612293575b826001866040518082805190602001908083835b602083106114d35780518252601f1990920191602091820191016114b4565b6001836020036101000a0380198251168184511680821785525050505050509050019150509081526020016040518091039020600301541061157f5761157a6001866040518082805190602001908083835b602083106115445780518252601f199092019160209182019101611525565b51815160209384036101000a60001901801990921691161790529201948552506040519384900301909220549150889050613a87565b611581565b805b905060006002856040518082805190602001908083835b602083106115b75780518252601f199092019160209182019101611598565b51815160209384036101000a600019018019909216911617905292019485525060405193849003810184208a51909460009450600193508b92909182918401908083835b6020831061161a5780518252601f1990920191602091820191016115fb565b51815160209384036101000a600019018019909216911617905292019485525060405193849003019092208054909250869150811061165557fe5b6000918252602080832090910154600160a060020a03168352820192909252604001902060010154111561168b57600101611ef8565b826001866040518082805190602001908083835b602083106116be5780518252601f19909201916020918201910161169f565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902060030154106117fd576117f86002856040518082805190602001908083835b6020831061172f5780518252601f199092019160209182019101611710565b51815160209384036101000a600019018019909216911617905292019485525060405193849003810184208a51909460009450600193508b92909182918401908083835b602083106117925780518252601f199092019160209182019101611773565b51815160209384036101000a60001901801990921691161790529201948552506040519384900301909220805490925086915081106117cd57fe5b6000918252602080832090910154600160a060020a0316835282019290925260400190205487613a87565b6118f3565b6002846040518082805190602001908083835b6020831061182f5780518252601f199092019160209182019101611810565b51815160209384036101000a600019018019909216911617905292019485525060405193849003810184208951909460009450600193508a92909182918401908083835b602083106118925780518252601f199092019160209182019101611873565b51815160209384036101000a60001901801990921691161790529201948552506040519384900301909220805490925085915081106118cd57fe5b6000918252602080832090910154600160a060020a031683528201929092526040019020545b6002856040518082805190602001908083835b602083106119255780518252601f199092019160209182019101611906565b51815160209384036101000a600019018019909216911617905292019485525060405193849003810184208a51909460009450600193508b92909182918401908083835b602083106119885780518252601f199092019160209182019101611969565b51815160209384036101000a60001901801990921691161790529201948552506040519384900301909220805490925086915081106119c357fe5b9060005260206000200160009054906101000a9004600160a060020a0316600160a060020a0316600160a060020a0316815260200190815260200160002060010181905550826002856040518082805190602001908083835b60208310611a3b5780518252601f199092019160209182019101611a1c565b51815160209384036101000a600019018019909216911617905292019485525060405193849003810184208a51909460009450600193508b92909182918401908083835b60208310611a9e5780518252601f199092019160209182019101611a7f565b51815160209384036101000a6000190180199092169116179052920194855250604051938490030190922080549092508691508110611ad957fe5b9060005260206000200160009054906101000a9004600160a060020a0316600160a060020a0316600160a060020a03168152602001908152602001600020600101546001876040518082805190602001908083835b60208310611b4d5780518252601f199092019160209182019101611b2e565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902060040154011115611d73576001856040518082805190602001908083835b60208310611bbd5780518252601f199092019160209182019101611b9e565b51815160209384036101000a600019018019909216911617905292019485525060405193849003810184206004015488519088039460029450899350918291908401908083835b60208310611c235780518252601f199092019160209182019101611c04565b51815160209384036101000a600019018019909216911617905292019485525060405193849003810184208a51909460009450600193508b92909182918401908083835b60208310611c865780518252601f199092019160209182019101611c67565b51815160209384036101000a6000190180199092169116179052920194855250604051938490030190922080549092508691508110611cc157fe5b9060005260206000200160009054906101000a9004600160a060020a0316600160a060020a0316600160a060020a0316815260200190815260200160002060010181905550826001866040518082805190602001908083835b60208310611d395780518252601f199092019160209182019101611d1a565b51815160209384036101000a60001901801990921691161790529201948552506040519384900301909220600401929092555061205b9050565b6002846040518082805190602001908083835b60208310611da55780518252601f199092019160209182019101611d86565b51815160209384036101000a600019018019909216911617905292019485525060405193849003810184208951909460009450600193508a92909182918401908083835b60208310611e085780518252601f199092019160209182019101611de9565b51815160209384036101000a6000190180199092169116179052920194855250604051938490030190922080549092508591508110611e4357fe5b9060005260206000200160009054906101000a9004600160a060020a0316600160a060020a0316600160a060020a03168152602001908152602001600020600101546001866040518082805190602001908083835b60208310611eb75780518252601f199092019160209182019101611e98565b51815160209384036101000a600019018019909216911617905292019485525060405193849003019092206004018054939093019092555050600191820191015b826001866040518082805190602001908083835b60208310611f2b5780518252601f199092019160209182019101611f0c565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902060030154108015611fce57506001856040518082805190602001908083835b60208310611f9c5780518252601f199092019160209182019101611f7d565b51815160209384036101000a600019018019909216911617905292019485525060405193849003019092205483149150505b15611fd85761205b565b826001866040518082805190602001908083835b6020831061200b5780518252601f199092019160209182019101611fec565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902060040154141561204d5761205b565b600a82101561205b576114a0565b826001866040518082805190602001908083835b6020831061208e5780518252601f19909201916020918201910161206f565b6001836020036101000a0380198251168184511680821785525050505050509050019150509081526020016040518091039020600301541061214857826001866040518082805190602001908083835b602083106120fd5780518252601f1990920191602091820191016120de565b6001836020036101000a03801982511681845116808217855250505050505090500191505090815260200160405180910390206004015414612140576000612143565b60015b612224565b6001856040518082805190602001908083835b6020831061217a5780518252601f19909201916020918201910161215b565b51815160209384036101000a600019018019909216911617905292019485525060405193849003810184206004015489519094600194508a9350918291908401908083835b602083106121de5780518252601f1990920191602091820191016121bf565b6001836020036101000a03801982511681845116808217855250505050505090500191505090815260200160405180910390206003015414612221576000612224565b60015b60ff166001866040518082805190602001908083835b602083106122595780518252601f19909201916020918201910161223a565b51815160209384036101000a6000190180199092169116179052920194855250604051938490030190922060070192909255506122fb9050565b600180866040518082805190602001908083835b602083106122c65780518252601f1990920191602091820191016122a7565b51815160209384036101000a600019018019909216911617905292019485525060405193849003019092206007019290925550505b505050505050565b600080662386f26fc10000341015612365576040805160e560020a62461bcd02815260206004820152601660248201527f30206574686572206973206e6f7420616c6c6f77656400000000000000000000604482015290519081900360640190fd5b5050604080517f42617369634b0000000000000000000000000000000000000000000000000000815290519081900360060181208351600092655af3107a40009291869160209081019182918401908083835b602083106123d75780518252601f1990920191602091820191016123b8565b6001836020036101000a0380198251168184511680821785525050505050509050019150506040516020818303038152906040526040518082805190602001908083835b6020831061243a5780518252601f19909201916020918201910161241b565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390206000191614156124c657662386f26fc1000034146124bd576040805160e560020a62461bcd02815260206004820152601660248201526000805160206150cb833981519152604482015290519081900360640190fd5b600191506129c6565b604080517f5072656d69756d4b000000000000000000000000000000000000000000000000815290519081900360080181208551909186916020918201918291908401908083835b6020831061252d5780518252601f19909201916020918201910161250e565b6001836020036101000a0380198251168184511680821785525050505050509050019150506040516020818303038152906040526040518082805190602001908083835b602083106125905780518252601f199092019160209182019101612571565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390206000191614156126205767016345785d8a00003414612614576040805160e560020a62461bcd02815260206004820152601660248201526000805160206150cb833981519152604482015290519081900360640190fd5b600b9150600a026129c6565b604080517f4c75787572794b00000000000000000000000000000000000000000000000000815290519081900360070181208551909186916020918201918291908401908083835b602083106126875780518252601f199092019160209182019101612668565b6001836020036101000a0380198251168184511680821785525050505050509050019150506040516020818303038152906040526040518082805190602001908083835b602083106126ea5780518252601f1990920191602091820191016126cb565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390206000191614156127f557670de0b6b3a7640000341461276e576040805160e560020a62461bcd02815260206004820152601660248201526000805160206150cb833981519152604482015290519081900360640190fd5b607891508060640290506127f06040805190810160405280600181526020017f6c000000000000000000000000000000000000000000000000000000000000008152506040805190810160405280600981526020017f6964784c75787572790000000000000000000000000000000000000000000000815250426101f4613c16565b6129c6565b604080517f526f79616c4b0000000000000000000000000000000000000000000000000000815290519081900360060181208551909186916020918201918291908401908083835b6020831061285c5780518252601f19909201916020918201910161283d565b6001836020036101000a0380198251168184511680821785525050505050509050019150506040516020818303038152906040526040518082805190602001908083835b602083106128bf5780518252601f1990920191602091820191016128a0565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390206000191614156129c657678ac7230489e800003414612943576040805160e560020a62461bcd02815260206004820152601660248201526000805160206150cb833981519152604482015290519081900360640190fd5b6105149150806103e80290506129c66040805190810160405280600181526020017f72000000000000000000000000000000000000000000000000000000000000008152506040805190810160405280600881526020017f696478526f79616c000000000000000000000000000000000000000000000000815250426064613c16565b6000821115612f8a57600160a060020a03831660009081526004602052604090205460ff1615612a4d576040805160f860020a6069028152600181810152905190819003602101812060080154600160a060020a0385169190830280156108fc02916000818181858888f19350505050158015612a47573d6000803e3d6000fd5b50612a98565b6040805160f860020a60690280825260018083018190528351602193819003840181206008015492815280820191909152925192839003909101909120600201805491830290910190555b6040805160fa60020a60190280825260018083018190528351602193819003840181206008908101548483528284018490528651928390038601832060029081018054928a0290920190915560f860020a603702808452838501859052875193849003870184208301549084528385018590528751938490038701842082018054918a02909101905560f460020a610333028084528382018590528751602294819003850181208401549181528083018690528851908190038501812083018054928b0290920190915560f460020a61039302808252818301869052885191829003850182208401548183528284018790528951928390038601832084018054918c02909101905560ec60020a620313830280835260038084018890528a51602394819003850181208701549281528082018990528b51908190038501812086018054938e0290930190925560e860020a62333635028083528282018990528b5192839003850183208701548184528383018a90528c51938490038601842087018054918f0290910190557f6c00000000000000000000000000000000000000000000000000000000000000808452838a018a90528c51938490038c018420880154908452838a018a90528c51938490038c01842087018054918f0290910190558252810187905289519081900390920182208401547f720000000000000000000000000000000000000000000000000000000000000083528287018790528951928390038901832084018054918c02909101905560f860020a60690280835282870187905289519283900389018320850154908352828701879052895192839003909801822083018054988b02909801909755958652858101849052865195869003830186208201547f6476000000000000000000000000000000000000000000000000000000000000875286820185905287519687900390930186200180549288029092019091558385018552908352602080840192909252835180850190945283527f6964784461696c7900000000000000000000000000000000000000000000000090830152612dae9184601e614a5e565b612e0c60408051908101604052806001815260200160f860020a6037028152506040805190810160405280600781526020017f69647837506f740000000000000000000000000000000000000000000000000081525084603c614a5e565b612e6b60408051908101604052806002815260200160f460020a610333028152506040805190810160405280600881526020017f6964783330506f7400000000000000000000000000000000000000000000000081525084605a614a5e565b612eca60408051908101604052806002815260200160f460020a610393028152506040805190810160405280600881526020017f6964783930506f74000000000000000000000000000000000000000000000000815250846078614a5e565b612f2a60408051908101604052806003815260200160ec60020a62031383028152506040805190810160405280600981526020017f696478313830506f740000000000000000000000000000000000000000000000815250846096614a5e565b612f8a60408051908101604052806003815260200160e860020a62333635028152506040805190810160405280600981526020017f696478333635506f740000000000000000000000000000000000000000000000815250846000614a5e565b50505050565b60008054600160a060020a03163314612fe1576040805160e560020a62461bcd02815260206004820152601760248201526000805160206150ab833981519152604482015290519081900360640190fd5b5060005b6101f481101561306d5781816101f48110612ffc57fe5b6020020151151561300c5761306d565b82816101f4811061301957fe5b6020020151600160a060020a03166108fc83836101f4811061303757fe5b60200201516040518115909202916000818181858888f19350505050158015613064573d6000803e3d6000fd5b50600101612fe5565b505050565b600160a060020a03811660009081526004602052604090205460609060ff161561131457600160a060020a038216600090815260046020908152604091829020600190810180548451600293821615610100026000190190911692909204601f8101849004840283018401909452838252909290918301828280156131385780601f1061310d57610100808354040283529160200191613138565b820191906000526020600020905b81548152906001019060200180831161311b57829003601f168201915b505050505090506109f0565b6004602090815260009182526040918290208054600180830180548651600261010094831615949094026000190190911692909204601f810186900486028301860190965285825260ff9092169492939092908301828280156131e85780601f106131bd576101008083540402835291602001916131e8565b820191906000526020600020905b8154815290600101906020018083116131cb57829003601f168201915b5050505050905082565b662386f26fc10000341015613251576040805160e560020a62461bcd02815260206004820152601660248201527f30206574686572206973206e6f7420616c6c6f77656400000000000000000000604482015290519081900360640190fd5b6003816040518082805190602001908083835b602083106132835780518252601f199092019160209182019101613264565b51815160209384036101000a6000190180199092169116179052920194855250604051938490030190922060010154151591506133d8905057604080519081016040528033600160a060020a0316815260200160018152506003826040518082805190602001908083835b6020831061330d5780518252601f1990920191602091820191016132ee565b51815160209384036101000a60001901801990921691161790529201948552506040805194859003820185208651815473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a039091161781559582015160019687015560f860020a6069028552858501869052805160219581900395909501909420600201805434019055336000908152600482529390932085516133b8959190910193860192509050614ff5565b50336000908152600460205260409020805460ff19166001179055613428565b6040805160e560020a62461bcd02815260206004820152601260248201527f4e616d65206973206e6f7420756e697175650000000000000000000000000000604482015290519081900360640190fd5b50565b60006001846040518082805190602001908083835b6020831061345f5780518252601f199092019160209182019101613440565b6001836020036101000a0380198251168184511680821785525050505050509050019150509081526020016040518091039020600201541180156134a05750815b1561306d5760146001846040518082805190602001908083835b602083106134d95780518252601f1990920191602091820191016134ba565b51815160209384036101000a6000190180199092169116179052920194855250604051938490030190922060010154840392909210915061306d90505760006001846040518082805190602001908083835b6020831061354a5780518252601f19909201916020918201910161352b565b51815160209384036101000a600019018019909216911617905292019485525060405193849003810184206002019490945550508451600092600192879290918291908401908083835b602083106135b35780518252601f199092019160209182019101613594565b51815160209384036101000a600019018019909216911617905292019485525060405193849003810184206004019490945550508451600092600192879290918291908401908083835b6020831061361c5780518252601f1990920191602091820191016135fd565b51815160209384036101000a60001901801990921691161790529201948552506040519384900381018420600301949094555050845160019286929182918401908083835b602083106136805780518252601f199092019160209182019101613661565b51815160209384036101000a600019018019909216911617905292019485525060405193849003019092206136b9925090506000615073565b806001846040518082805190602001908083835b602083106136ec5780518252601f1990920191602091820191016136cd565b51815160209384036101000a60001901801990921691161790529201948552506040519384900301909220600501929092555050505050565b60006001856040518082805190602001908083835b602083106137595780518252601f19909201916020918201910161373a565b6001836020036101000a03801982511681845116808217855250505050505090500191505090815260200160405180910390206002015411801561379a5750825b15612f8a57806001856040518082805190602001908083835b602083106137d25780518252601f1990920191602091820191016137b3565b51815160209384036101000a60001901801990921691161790529201948552506040519384900301909220600601548503929092109150612f8a90505760006001856040518082805190602001908083835b602083106138435780518252601f199092019160209182019101613824565b51815160209384036101000a600019018019909216911617905292019485525060405193849003810184206002019490945550508551600092600192889290918291908401908083835b602083106138ac5780518252601f19909201916020918201910161388d565b51815160209384036101000a600019018019909216911617905292019485525060405193849003810184206004019490945550508551600092600192889290918291908401908083835b602083106139155780518252601f1990920191602091820191016138f6565b51815160209384036101000a60001901801990921691161790529201948552506040519384900381018420600301949094555050855160019287929182918401908083835b602083106139795780518252601f19909201916020918201910161395a565b51815160209384036101000a600019018019909216911617905292019485525060405193849003019092206139b2925090506000615073565b816001856040518082805190602001908083835b602083106139e55780518252601f1990920191602091820191016139c6565b51815160209384036101000a6000190180199092169116179052920194855250604051938490038101842060060194909455505085518492600192889290918291908401908083835b60208310613a4d5780518252601f199092019160209182019101613a2e565b51815160209384036101000a6000190180199092169116179052920194855250604051938490030190922060050192909255505050505050565b6040805160fa60020a601902815260018181018190528251918290036021908101832060029081015460f860020a6037028552848401849052855194859003909201842081015460f460020a6103330285528482018490528551948590036022908101862083015460f460020a610393028752868401869052875196879003909101862083015460ec60020a6203138302875260038088018790528851978890036023908101892086015460e860020a62333635028a5291890197909752885197889003909601872090930154446020888101919091528789018a90526060880195909552608087019290925260a086015260c085019190915260e084019290925261010080840192909252835180840390920182526101209092019283905280516000938693909182918401908083835b60208310613bd85780518252601f199092019160209182019101613bb9565b5181516020939093036101000a6000190180199091169216919091179052604051920182900390912092505050811515613c0e57fe5b069392505050565b6000816001866040518082805190602001908083835b60208310613c4b5780518252601f199092019160209182019101613c2c565b51815160209384036101000a6000190180199092169116179052920194855250604051938490030190922054929092101591506141689050576002846040518082805190602001908083835b60208310613cb65780518252601f199092019160209182019101613c97565b51815160209384036101000a6000190180199092169116179052920194855250604080519485900382019094203360009081529152929092206004015415159150613ee190505760a06040519081016040528060008152602001600081526020016001876040518082805190602001908083835b60208310613d495780518252601f199092019160209182019101613d2a565b51815160001960209485036101000a0190811690199190911617905292019485525060408051948590038201909420548552835160e860020a62333635028152600160038201819052855191829003602301909120600501548683015294840194909452505051865160029288929182918401908083835b60208310613de05780518252601f199092019160209182019101613dc1565b51815160209384036101000a600019018019909216911617905292019485525060408051948590038201852033600090815290835281902086518155868301516001808301919091559187015160028201556060870151600382015560809096015160049096019590955589518a949350839250908401908083835b60208310613e7b5780518252601f199092019160209182019101613e5c565b51815160001960209485036101000a0190811690199190911617905292019485525060405193849003810190932080546001810182556000918252939020909201805473ffffffffffffffffffffffffffffffffffffffff191633179055506141639050565b6040805160e860020a623336350281526001600382015290519081900360230181206005015485519091600291879190819060208401908083835b60208310613f3b5780518252601f199092019160209182019101613f1c565b51815160209384036101000a6000190180199092169116179052920194855250604080519485900382019094203360009081529152929092206003015492909214915061416390505760a06040519081016040528060008152602001600081526020016001876040518082805190602001908083835b60208310613fd05780518252601f199092019160209182019101613fb1565b51815160001960209485036101000a0190811690199190911617905292019485525060408051948590038201909420548552835160e860020a62333635028152600160038201819052855191829003602301909120600501548683015294840194909452505051865160029288929182918401908083835b602083106140675780518252601f199092019160209182019101614048565b51815160209384036101000a600019018019909216911617905292019485525060408051948590038201852033600090815290835281902086518155868301516001808301919091559187015160028201556060870151600382015560809096015160049096019590955589518a949350839250908401908083835b602083106141025780518252601f1990920191602091820191016140e3565b51815160001960209485036101000a0190811690199190911617905292019485525060405193849003810190932080546001810182556000918252939020909201805473ffffffffffffffffffffffffffffffffffffffff19163317905550505b614a57565b6002846040518082805190602001908083835b6020831061419a5780518252601f19909201916020918201910161417b565b51815160209384036101000a60001901801990921691161790529201948552506040805194859003820190942033600090815291529290922060040154151591506145e890505761424c6001866040518082805190602001908083835b602083106142165780518252601f1990920191602091820191016141f7565b51815160209384036101000a60001901801990921691161790529201948552506040519384900301909220549150859050613a87565b905060a06040519081016040528060008152602001600081526020016002866040518082805190602001908083835b6020831061429a5780518252601f19909201916020918201910161427b565b51815160209384036101000a600019018019909216911617905292019485525060405193849003810184208b51909460009450600193508c92909182918401908083835b602083106142fd5780518252601f1990920191602091820191016142de565b51815160209384036101000a600019018019909216911617905292019485525060405193849003019092208054909250879150811061433857fe5b6000918252602080832090910154600160a060020a0316835282810193909352604091820190206002908101548452815160e860020a6233363502815260016003820181905283519182900360230190912060050154858501529382019390935251875188928291908401908083835b602083106143c75780518252601f1990920191602091820191016143a8565b51815160209384036101000a600019018019909216911617905292019485525060408051948590038201852033600090815290835281812087518155878401516001820155918701516002808401919091556060880151600384015560809097015160049092019190915589519095948a9450925082918401908083835b602083106144645780518252601f199092019160209182019101614445565b51815160209384036101000a600019018019909216911617905292019485525060405193849003810184208a51909460009450600193508b92909182918401908083835b602083106144c75780518252601f1990920191602091820191016144a8565b51815160209384036101000a600019018019909216911617905292019485525060405193849003019092208054909250869150811061450257fe5b9060005260206000200160009054906101000a9004600160a060020a0316600160a060020a0316600160a060020a0316815260200190815260200160002060040181905550336001866040518082805190602001908083835b6020831061457a5780518252601f19909201916020918201910161455b565b51815160209384036101000a60001901801990921691161790529201948552506040519384900301909220805490925084915081106145b557fe5b9060005260206000200160006101000a815481600160a060020a030219169083600160a060020a03160217905550614a57565b6040805160e860020a623336350281526001600382015290519081900360230181206005015485519091600291879190819060208401908083835b602083106146425780518252601f199092019160209182019101614623565b51815160209384036101000a60001901801990921691161790529201948552506040805194859003820190942033600090815291529290922060030154929092149150614a579050576146bf600186604051808280519060200190808383602083106142165780518252601f1990920191602091820191016141f7565b905060a06040519081016040528060008152602001600081526020016002866040518082805190602001908083835b6020831061470d5780518252601f1990920191602091820191016146ee565b51815160209384036101000a600019018019909216911617905292019485525060405193849003810184208b51909460009450600193508c92909182918401908083835b602083106147705780518252601f199092019160209182019101614751565b51815160209384036101000a60001901801990921691161790529201948552506040519384900301909220805490925087915081106147ab57fe5b6000918252602080832090910154600160a060020a0316835282810193909352604091820190206002908101548452815160e860020a6233363502815260016003820181905283519182900360230190912060050154858501529382019390935251875188928291908401908083835b6020831061483a5780518252601f19909201916020918201910161481b565b51815160209384036101000a600019018019909216911617905292019485525060408051948590038201852033600090815290835281812087518155878401516001820155918701516002808401919091556060880151600384015560809097015160049092019190915589519095948a9450925082918401908083835b602083106148d75780518252601f1990920191602091820191016148b8565b51815160209384036101000a600019018019909216911617905292019485525060405193849003810184208a51909460009450600193508b92909182918401908083835b6020831061493a5780518252601f19909201916020918201910161491b565b51815160209384036101000a600019018019909216911617905292019485525060405193849003019092208054909250869150811061497557fe5b9060005260206000200160009054906101000a9004600160a060020a0316600160a060020a0316600160a060020a0316815260200190815260200160002060040181905550336001866040518082805190602001908083835b602083106149ed5780518252601f1990920191602091820191016149ce565b51815160209384036101000a6000190180199092169116179052920194855250604051938490030190922080549092508491508110614a2857fe5b9060005260206000200160006101000a815481600160a060020a030219169083600160a060020a031602179055505b5050505050565b426001856040518082805190602001908083835b60208310614a915780518252601f199092019160209182019101614a72565b51815160209384036101000a6000190180199092169116179052920194855250604051938490030190922060010154929092119150614b34905057426001856040518082805190602001908083835b60208310614aff5780518252601f199092019160209182019101614ae0565b51815160209384036101000a600019018019909216911617905292019485525060405193849003019092206001019290925550505b8082026001856040518082805190602001908083835b60208310614b695780518252601f199092019160209182019101614b4a565b51815160209384036101000a600019018019909216911617905292019485525060405193849003810184206001018054959095019094555050845160029286929182918401908083835b60208310614bd25780518252601f199092019160209182019101614bb3565b51815160209384036101000a6000190180199092169116179052920194855250604080519485900382019094203360009081529152929092206004015415159150614e3a9050576001846040518082805190602001908083835b60208310614c4b5780518252601f199092019160209182019101614c2c565b51815160001960209485036101000a019081169019919091161790529201948552506040805194859003820185208054600181810183556000928352848320909101805473ffffffffffffffffffffffffffffffffffffffff19163317905560a0870183528887528684019190915281518a5192870195509093508992909182918401908083835b60208310614cf25780518252601f199092019160209182019101614cd3565b51815160209384036101000a60001901801990921691161790529201948552506040805194859003820190942054855292518951948401946001948b945091925082918401908083835b60208310614d5b5780518252601f199092019160209182019101614d3c565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902060050154815260200160018152506002846040518082805190602001908083835b60208310614dce5780518252601f199092019160209182019101614daf565b51815160209384036101000a60001901801990921691161790529201948552506040805194859003820190942033600090815290825284902085518155908501516001820155928401516002840155505060608201516003820155608090910151600490910155614f83565b6040805160fa60020a601902815260018181015290519081900360210181206005015484519091600291869190819060208401908083835b60208310614e915780518252601f199092019160209182019101614e72565b51815160209384036101000a60001901801990921691161790529201948552506040805194859003820190942033600090815291529290922060030154929092149150614f0b90505760018460405180828051906020019080838360208310614c4b5780518252601f199092019160209182019101614c2c565b816002846040518082805190602001908083835b60208310614f3e5780518252601f199092019160209182019101614f1f565b51815160209384036101000a60001901801990921691161790529201948552506040805194859003820190942033600090815291529290922080549390930190925550505b816001856040518082805190602001908083835b60208310614fb65780518252601f199092019160209182019101614f97565b51815160209384036101000a60001901801990921691161790529201948552506040519384900301909220600301805493909301909255505050505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061503657805160ff1916838001178555615063565b82800160010185558215615063579182015b82811115615063578251825591602001919060010190615048565b5061506f92915061508d565b5090565b508054600082559060005260206000209081019061342891905b6150a791905b8082111561506f5760008155600101615093565b9056004f6e6c79206d616e6167657220697320616c6c6f776564000000000000000000496e76616c6964205061636b61676520416d6f756e7400000000000000000000a165627a7a72305820e7dfd4ca3998291a55b8d3a2e144aad51675a40f09f196dd8d052a1155c4920f0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "weak-prng", "impact": "High", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}}
| 2,271 |
0x70059d4cb9ac7f0ce6afd0c42d6cb7679b18e5b0
|
pragma solidity ^0.4.24;
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
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
// 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 owned {
address public owner;
constructor () public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
}
interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) external; }
contract GAMOLOGY is owned {
// Public variables of the token
string public name = "GAMOLOGY Token";
string public symbol = "XGA";
uint8 public decimals = 18;
uint256 public totalSupply = 25000000000 * 10 ** uint256(decimals);
bool public released = false;
/// contract that is allowed to create new tokens and allows unlift the transfer limits on this token
address public ICO_Contract;
// This creates an array with all balances
mapping (address => uint256) public balanceOf;
mapping (address => mapping (address => uint256)) public allowance;
mapping (address => bool) public frozenAccount;
// This generates a public event on the blockchain that will notify clients
event Transfer(address indexed from, address indexed to, uint256 value);
// This notifies clients about the amount burnt
event Burn(address indexed from, uint256 value);
/* This generates a public event on the blockchain that will notify clients */
event FrozenFunds(address target, bool frozen);
/**
* Constrctor function
*
* Initializes contract with initial supply tokens to the creator of the contract
*/
constructor () public {
balanceOf[owner] = totalSupply;
}
modifier canTransfer() {
require(released || msg.sender == ICO_Contract || msg.sender == owner);
_;
}
function releaseToken() public onlyOwner {
released = true;
}
/**
* Internal transfer, only can be called by this contract
*/
function _transfer(address _from, address _to, uint256 _value) canTransfer internal {
// Prevent transfer to 0x0 address. Use burn() instead
require(_to != 0x0);
// Check if the sender has enough
require(balanceOf[_from] >= _value);
// Check for overflows
require(balanceOf[_to] + _value > balanceOf[_to]);
// Check if sender is frozen
require(!frozenAccount[_from]);
// Check if recipient is frozen
require(!frozenAccount[_to]);
// Save this for an assertion in the future
uint256 previousBalances = balanceOf[_from] + balanceOf[_to];
// Subtract from the sender
balanceOf[_from] -= _value;
// Add the same to the recipient
balanceOf[_to] += _value;
emit Transfer(_from, _to, _value);
// Asserts are used to use static analysis to find bugs in your code. They should never fail
assert(balanceOf[_from] + balanceOf[_to] == previousBalances);
}
/**
* Transfer tokens
*
* Send `_value` tokens to `_to` from your account
*
* @param _to The address of the recipient
* @param _value the amount to send
*/
function transfer(address _to, uint256 _value) public {
_transfer(msg.sender, _to, _value);
}
/**
* Transfer tokens from other address
*
* Send `_value` tokens to `_to` in behalf of `_from`
*
* @param _from The address of the sender
* @param _to The address of the recipient
* @param _value the amount to send
*/
function transferFrom(address _from, address _to, uint256 _value) canTransfer public returns (bool success) {
require(_value <= allowance[_from][msg.sender]); // Check allowance
allowance[_from][msg.sender] -= _value;
_transfer(_from, _to, _value);
return true;
}
/**
* Set allowance for other address
*
* Allows `_spender` to spend no more than `_value` tokens in your behalf
*
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
*/
function approve(address _spender, uint256 _value) public
returns (bool success) {
allowance[msg.sender][_spender] = _value;
return true;
}
/**
* Set allowance for other address and notify
*
* Allows `_spender` to spend no more than `_value` tokens in your behalf, and then ping the contract about it
*
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
* @param _extraData some extra information to send to the approved contract
*/
function approveAndCall(address _spender, uint256 _value, bytes _extraData)
public
returns (bool success) {
tokenRecipient spender = tokenRecipient(_spender);
if (approve(_spender, _value)) {
spender.receiveApproval(msg.sender, _value, this, _extraData);
return true;
}
}
/**
* Destroy tokens
*
* Remove `_value` tokens from the system irreversibly
*
* @param _value the amount of money to burn
*/
function burn(uint256 _value) public returns (bool success) {
require(balanceOf[msg.sender] >= _value); // Check if the sender has enough
balanceOf[msg.sender] -= _value; // Subtract from the sender
totalSupply -= _value; // Updates totalSupply
emit Burn(msg.sender, _value);
return true;
}
/**
* Destroy tokens from other account
*
* Remove `_value` tokens from the system irreversibly on behalf of `_from`.
*
* @param _from the address of the sender
* @param _value the amount of money to burn
*/
function burnFrom(address _from, uint256 _value) public returns (bool success) {
require(balanceOf[_from] >= _value); // Check if the targeted balance is enough
require(_value <= allowance[_from][msg.sender]); // Check allowance
balanceOf[_from] -= _value; // Subtract from the targeted balance
allowance[_from][msg.sender] -= _value; // Subtract from the sender's allowance
totalSupply -= _value; // Update totalSupply
emit Burn(_from, _value);
return true;
}
/// @notice Create `mintedAmount` tokens and send it to `target`
/// @param target Address to receive the tokens
/// @param mintedAmount the amount of tokens it will receive
function mintToken(address target, uint256 mintedAmount) onlyOwner public {
balanceOf[target] += mintedAmount;
totalSupply += mintedAmount;
emit Transfer(this, target, mintedAmount);
}
/// @notice `freeze? Prevent | Allow` `target` from sending & receiving tokens
/// @param target Address to be frozen
/// @param freeze either to freeze it or not
function freezeAccount(address target, bool freeze) onlyOwner public {
frozenAccount[target] = freeze;
emit FrozenFunds(target, freeze);
}
/// @dev Set the ICO_Contract.
/// @param _ICO_Contract crowdsale contract address
function setICO_Contract(address _ICO_Contract) onlyOwner public {
ICO_Contract = _ICO_Contract;
}
}
|
0x6080604052600436106101115763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde038114610116578063095ea7b3146101a057806318160ddd146101d857806323b872dd146101ff578063313ce5671461022957806342966c68146102545780635ad747421461026c57806370a082311461029d57806379c65068146102be57806379cc6790146102e45780638da5cb5b1461030857806395d89b411461031d5780639613252114610332578063a9059cbb14610347578063b414d4b61461036b578063cae9ca511461038c578063d972bc59146103f5578063dd62ed3e14610416578063e724529c1461043d578063ec715a3114610463575b600080fd5b34801561012257600080fd5b5061012b610478565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561016557818101518382015260200161014d565b50505050905090810190601f1680156101925780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101ac57600080fd5b506101c4600160a060020a0360043516602435610505565b604080519115158252519081900360200190f35b3480156101e457600080fd5b506101ed610532565b60408051918252519081900360200190f35b34801561020b57600080fd5b506101c4600160a060020a0360043581169060243516604435610538565b34801561023557600080fd5b5061023e6105ea565b6040805160ff9092168252519081900360200190f35b34801561026057600080fd5b506101c46004356105f3565b34801561027857600080fd5b5061028161066b565b60408051600160a060020a039092168252519081900360200190f35b3480156102a957600080fd5b506101ed600160a060020a036004351661067f565b3480156102ca57600080fd5b506102e2600160a060020a0360043516602435610691565b005b3480156102f057600080fd5b506101c4600160a060020a0360043516602435610708565b34801561031457600080fd5b506102816107d9565b34801561032957600080fd5b5061012b6107e8565b34801561033e57600080fd5b506101c4610840565b34801561035357600080fd5b506102e2600160a060020a0360043516602435610849565b34801561037757600080fd5b506101c4600160a060020a0360043516610858565b34801561039857600080fd5b50604080516020600460443581810135601f81018490048402850184019095528484526101c4948235600160a060020a031694602480359536959460649492019190819084018382808284375094975061086d9650505050505050565b34801561040157600080fd5b506102e2600160a060020a0360043516610986565b34801561042257600080fd5b506101ed600160a060020a03600435811690602435166109d2565b34801561044957600080fd5b506102e2600160a060020a036004351660243515156109ef565b34801561046f57600080fd5b506102e2610a6a565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156104fd5780601f106104d2576101008083540402835291602001916104fd565b820191906000526020600020905b8154815290600101906020018083116104e057829003601f168201915b505050505081565b336000908152600760209081526040808320600160a060020a039590951683529390529190912055600190565b60045481565b60055460009060ff168061055b57506005546101009004600160a060020a031633145b806105705750600054600160a060020a031633145b151561057b57600080fd5b600160a060020a03841660009081526007602090815260408083203384529091529020548211156105ab57600080fd5b600160a060020a03841660009081526007602090815260408083203384529091529020805483900390556105e0848484610a90565b5060019392505050565b60035460ff1681565b3360009081526006602052604081205482111561060f57600080fd5b3360008181526006602090815260409182902080548690039055600480548690039055815185815291517fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca59281900390910190a2506001919050565b6005546101009004600160a060020a031681565b60066020526000908152604090205481565b600054600160a060020a031633146106a857600080fd5b600160a060020a03821660008181526006602090815260409182902080548501905560048054850190558151848152915130927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92908290030190a35050565b600160a060020a03821660009081526006602052604081205482111561072d57600080fd5b600160a060020a038316600090815260076020908152604080832033845290915290205482111561075d57600080fd5b600160a060020a0383166000818152600660209081526040808320805487900390556007825280832033845282529182902080548690039055600480548690039055815185815291517fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca59281900390910190a250600192915050565b600054600160a060020a031681565b6002805460408051602060018416156101000260001901909316849004601f810184900484028201840190925281815292918301828280156104fd5780601f106104d2576101008083540402835291602001916104fd565b60055460ff1681565b610854338383610a90565b5050565b60086020526000908152604090205460ff1681565b60008361087a8185610505565b1561097e576040517f8f4ffcb10000000000000000000000000000000000000000000000000000000081523360048201818152602483018790523060448401819052608060648501908152875160848601528751600160a060020a03871695638f4ffcb195948b94938b939192909160a490910190602085019080838360005b838110156109125781810151838201526020016108fa565b50505050905090810190601f16801561093f5780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b15801561096157600080fd5b505af1158015610975573d6000803e3d6000fd5b50505050600191505b509392505050565b600054600160a060020a0316331461099d57600080fd5b60058054600160a060020a039092166101000274ffffffffffffffffffffffffffffffffffffffff0019909216919091179055565b600760209081526000928352604080842090915290825290205481565b600054600160a060020a03163314610a0657600080fd5b600160a060020a038216600081815260086020908152604091829020805460ff191685151590811790915582519384529083015280517f48335238b4855f35377ed80f164e8c6f3c366e54ac00b96a6402d4a9814a03a59281900390910190a15050565b600054600160a060020a03163314610a8157600080fd5b6005805460ff19166001179055565b60055460009060ff1680610ab357506005546101009004600160a060020a031633145b80610ac85750600054600160a060020a031633145b1515610ad357600080fd5b600160a060020a0383161515610ae857600080fd5b600160a060020a038416600090815260066020526040902054821115610b0d57600080fd5b600160a060020a03831660009081526006602052604090205482810111610b3357600080fd5b600160a060020a03841660009081526008602052604090205460ff1615610b5957600080fd5b600160a060020a03831660009081526008602052604090205460ff1615610b7f57600080fd5b50600160a060020a038083166000818152600660209081526040808320805495891680855282852080548981039091559486905281548801909155815187815291519390950194927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a3600160a060020a03808416600090815260066020526040808220549287168252902054018114610c1e57fe5b505050505600a165627a7a72305820cb4c95ed9dc4ef375fa3b30fa68d4fa73492310aa4c868e50bef98dc5249eb260029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "erc20-interface", "impact": "Medium", "confidence": "High"}]}}
| 2,272 |
0xc58e923bf8a00e4361fe3f4275226a543d7d3ce6
|
/**
*Submitted for verification at Etherscan.io on 2021-06-09
*/
/**
*Submitted for verification at Etherscan.io on 2021-06-07
*/
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity 0.7.5;
library SafeERC20 {
using SafeMath for uint256;
using Address for address;
function safeTransfer(IERC20 token, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
function safeApprove(IERC20 token, address spender, uint256 value) internal {
require((value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function 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");
}
}
}
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;
}
// babylonian method (https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method)
function sqrrt(uint256 a) internal pure returns (uint c) {
if (a > 3) {
c = a;
uint b = add( div( a, 2), 1 );
while (b < c) {
c = b;
b = div( add( div( a, b ), b), 2 );
}
} else if (a != 0) {
c = 1;
}
}
function percentageAmount( uint256 total_, uint8 percentage_ ) internal pure returns ( uint256 percentAmount_ ) {
return div( mul( total_, percentage_ ), 1000 );
}
function substractPercentage( uint256 total_, uint8 percentageToSub_ ) internal pure returns ( uint256 result_ ) {
return sub( total_, div( mul( total_, percentageToSub_ ), 1000 ) );
}
function percentageOfTotal( uint256 part_, uint256 total_ ) internal pure returns ( uint256 percent_ ) {
return div( mul(part_, 100) , total_ );
}
function average(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b) / 2 can overflow, so we distribute
return (a / 2) + (b / 2) + ((a % 2 + b % 2) / 2);
}
function quadraticPricing( uint256 payment_, uint256 multiplier_ ) internal pure returns (uint256) {
return sqrrt( mul( multiplier_, payment_ ) );
}
function bondingCurve( uint256 supply_, uint256 multiplier_ ) internal pure returns (uint256) {
return mul( multiplier_, supply_ );
}
}
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) {
// This method relies in extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
// solhint-disable-next-line no-inline-assembly
assembly { size := extcodesize(account) }
return size > 0;
}
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");
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);
}
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);
}
}
}
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");
// solhint-disable-next-line avoid-low-level-calls
(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) private 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);
}
}
}
function addressToString(address _address) internal pure returns(string memory) {
bytes32 _bytes = bytes32(uint256(_address));
bytes memory HEX = "0123456789abcdef";
bytes memory _addr = new bytes(42);
_addr[0] = '0';
_addr[1] = 'x';
for(uint256 i = 0; i < 20; i++) {
_addr[2+i*2] = HEX[uint8(_bytes[i + 12] >> 4)];
_addr[3+i*2] = HEX[uint8(_bytes[i + 12] & 0x0f)];
}
return string(_addr);
}
}
interface IPolicy {
function policy() external view returns (address);
function renouncePolicy() external;
function pushPolicy( address newPolicy_ ) external;
function pullPolicy() external;
}
contract Policy is IPolicy {
address internal _policy;
address internal _newPolicy;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
_policy = msg.sender;
emit OwnershipTransferred( address(0), _policy );
}
function policy() public view override returns (address) {
return _policy;
}
modifier onlyPolicy() {
require( _policy == msg.sender, "Ownable: caller is not the owner" );
_;
}
function renouncePolicy() public virtual override onlyPolicy() {
emit OwnershipTransferred( _policy, address(0) );
_policy = address(0);
}
function pushPolicy( address newPolicy_ ) public virtual override onlyPolicy() {
require( newPolicy_ != address(0), "Ownable: new owner is the zero address");
_newPolicy = newPolicy_;
}
function pullPolicy() public virtual override {
require( msg.sender == _newPolicy );
emit OwnershipTransferred( _policy, _newPolicy );
_policy = _newPolicy;
}
}
interface ITreasury {
function mintRewards( address _recipient, uint _amount ) external;
}
contract Distributor is Policy {
using SafeMath for uint;
using SafeERC20 for IERC20;
/* ====== VARIABLES ====== */
address public immutable OHM;
address public immutable treasury;
uint public immutable epochLength;
uint public nextEpochBlock;
mapping( uint => Adjust ) public adjustments;
/* ====== STRUCTS ====== */
struct Info {
uint rate; // in ten-thousandths ( 5000 = 0.5% )
address recipient;
}
Info[] public info;
struct Adjust {
bool add;
uint rate;
uint target;
}
/* ====== CONSTRUCTOR ====== */
constructor( address _treasury, address _ohm, uint _epochLength, uint _nextEpochBlock ) {
require( _treasury != address(0) );
treasury = _treasury;
require( _ohm != address(0) );
OHM = _ohm;
epochLength = _epochLength;
nextEpochBlock = _nextEpochBlock;
}
/* ====== PUBLIC FUNCTIONS ====== */
/**
@notice send epoch reward to staking contract
*/
function distribute() external returns ( bool ) {
if ( nextEpochBlock <= block.number ) {
nextEpochBlock = nextEpochBlock.add( epochLength ); // set next epoch block
// distribute rewards to each recipient
for ( uint i = 0; i < info.length; i++ ) {
if ( info[ i ].rate > 0 ) {
ITreasury( treasury ).mintRewards( // mint and send from treasury
info[ i ].recipient,
nextRewardAt( info[ i ].rate )
);
adjust( i ); // check for adjustment
}
}
return true;
} else {
return false;
}
}
/* ====== INTERNAL FUNCTIONS ====== */
/**
@notice increment reward rate for collector
*/
function adjust( uint _index ) internal {
Adjust memory adjustment = adjustments[ _index ];
if ( adjustment.rate != 0 ) {
if ( adjustment.add ) { // if rate should increase
info[ _index ].rate = info[ _index ].rate.add( adjustment.rate ); // raise rate
if ( info[ _index ].rate >= adjustment.target ) { // if target met
adjustments[ _index ].rate = 0; // turn off adjustment
}
} else { // if rate should decrease
info[ _index ].rate = info[ _index ].rate.sub( adjustment.rate ); // lower rate
if ( info[ _index ].rate <= adjustment.target ) { // if target met
adjustments[ _index ].rate = 0; // turn off adjustment
}
}
}
}
/* ====== VIEW FUNCTIONS ====== */
/**
@notice view function for next reward at given rate
@param _rate uint
@return uint
*/
function nextRewardAt( uint _rate ) public view returns ( uint ) {
return IERC20( OHM ).totalSupply().mul( _rate ).div( 1000000 );
}
/**
@notice view function for next reward for specified address
@param _recipient address
@return uint
*/
function nextRewardFor( address _recipient ) public view returns ( uint ) {
uint reward;
for ( uint i = 0; i < info.length; i++ ) {
if ( info[ i ].recipient == _recipient ) {
reward = nextRewardAt( info[ i ].rate );
}
}
return reward;
}
/* ====== POLICY FUNCTIONS ====== */
/**
@notice adds recipient for distributions
@param _recipient address
@param _rewardRate uint
*/
function addRecipient( address _recipient, uint _rewardRate ) external onlyPolicy() {
require( _recipient != address(0) );
info.push( Info({
recipient: _recipient,
rate: _rewardRate
}));
}
/**
@notice removes recipient for distributions
@param _index uint
@param _recipient address
*/
function removeRecipient( uint _index, address _recipient ) external onlyPolicy() {
require( _recipient == info[ _index ].recipient );
info[ _index ].recipient = address(0);
info[ _index ].rate = 0;
}
/**
@notice set adjustment info for a collector's reward rate
@param _index uint
@param _add bool
@param _rate uint
@param _target uint
*/
function setAdjustment( uint _index, bool _add, uint _rate, uint _target ) external onlyPolicy() {
adjustments[ _index ] = Adjust({
add: _add,
rate: _rate,
target: _target
});
}
}
|
0x608060405234801561001057600080fd5b50600436106100ff5760003560e01c8063a15ad07711610097578063c9fa8b2a11610066578063c9fa8b2a1461038b578063e4fc6b6d146103cd578063f7982243146103ed578063fe3fbbad1461043b576100ff565b8063a15ad077146102b7578063a4b23980146102fb578063a6c41fec14610305578063bc3b2b1214610339576100ff565b806357d775f8116100d357806357d775f81461020d5780635beede081461022b5780635db854b01461023557806361d027b314610283576100ff565b8062640c2e146101045780630505c8c9146101225780632e3405991461015657806336d33f44146101b5575b600080fd5b61010c610489565b6040518082815260200191505060405180910390f35b61012a61048f565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6101826004803603602081101561016c57600080fd5b81019080803590602001909291905050506104b8565b604051808381526020018273ffffffffffffffffffffffffffffffffffffffff1681526020019250505060405180910390f35b6101f7600480360360208110156101cb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061050c565b6040518082815260200191505060405180910390f35b6102156105d2565b6040518082815260200191505060405180910390f35b6102336105f6565b005b6102816004803603608081101561024b57600080fd5b81019080803590602001909291908035151590602001909291908035906020019092919080359060200190929190505050610750565b005b61028b61087e565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102f9600480360360208110156102cd57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108a2565b005b610303610a2d565b005b61030d610bac565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103656004803603602081101561034f57600080fd5b8101908080359060200190929190505050610bd0565b604051808415158152602001838152602001828152602001935050505060405180910390f35b6103b7600480360360208110156103a157600080fd5b8101908080359060200190929190505050610c07565b6040518082815260200191505060405180910390f35b6103d5610cd8565b60405180821515815260200191505060405180910390f35b6104396004803603604081101561040357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610e8b565b005b6104876004803603604081101561045157600080fd5b8101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611033565b005b60025481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b600481815481106104c857600080fd5b90600052602060002090600202016000915090508060000154908060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905082565b60008060005b6004805490508110156105c8578373ffffffffffffffffffffffffffffffffffffffff166004828154811061054357fe5b906000526020600020906002020160010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614156105bb576105b8600482815481106105a157fe5b906000526020600020906002020160000154610c07565b91505b8080600101915050610512565b5080915050919050565b7f000000000000000000000000000000000000000000000000000000000000089881565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461065057600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b3373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610811576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60405180606001604052808415158152602001838152602001828152506003600086815260200190815260200160002060008201518160000160006101000a81548160ff021916908315150217905550602082015181600101556040820151816002015590505050505050565b7f00000000000000000000000031f8cc382c9898b273eff4e0b7626a6987c846e881565b3373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610963576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156109e9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806116ee6026913960400191505060405180910390fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b3373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610aee576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b7f000000000000000000000000383518188c0c6d7730d91b2c03a03c837814a89981565b60036020528060005260406000206000915090508060000160009054906101000a900460ff16908060010154908060020154905083565b6000610cd1620f4240610cc3847f000000000000000000000000383518188c0c6d7730d91b2c03a03c837814a89973ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b158015610c7a57600080fd5b505afa158015610c8e573d6000803e3d6000fd5b505050506040513d6020811015610ca457600080fd5b81019080805190602001909291905050506111f090919063ffffffff16565b61127690919063ffffffff16565b9050919050565b60004360025411610e8357610d187f00000000000000000000000000000000000000000000000000000000000008986002546112c090919063ffffffff16565b60028190555060005b600480549050811015610e7957600060048281548110610d3d57fe5b9060005260206000209060020201600001541115610e6c577f00000000000000000000000031f8cc382c9898b273eff4e0b7626a6987c846e873ffffffffffffffffffffffffffffffffffffffff16636a20de9260048381548110610d9e57fe5b906000526020600020906002020160010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610df760048581548110610de057fe5b906000526020600020906002020160000154610c07565b6040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050600060405180830381600087803b158015610e4a57600080fd5b505af1158015610e5e573d6000803e3d6000fd5b50505050610e6b81611348565b5b8080600101915050610d21565b5060019050610e88565b600090505b90565b3373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f4c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610f8657600080fd5b600460405180604001604052808381526020018473ffffffffffffffffffffffffffffffffffffffff1681525090806001815401808255809150506001900390600052602060002090600202016000909190919091506000820151816000015560208201518160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050505050565b3373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146110f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6004828154811061110157fe5b906000526020600020906002020160010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161461116a57600080fd5b60006004838154811061117957fe5b906000526020600020906002020160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600483815481106111d757fe5b9060005260206000209060020201600001819055505050565b6000808314156112035760009050611270565b600082840290508284828161121457fe5b041461126b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806117146021913960400191505060405180910390fd5b809150505b92915050565b60006112b883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506114fa565b905092915050565b60008082840190508381101561133e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b6113506116ca565b600360008381526020019081526020016000206040518060600160405290816000820160009054906101000a900460ff1615151515815260200160018201548152602001600282015481525050905060008160200151146114f657806000015115611457576113ea8160200151600484815481106113ca57fe5b9060005260206000209060020201600001546112c090919063ffffffff16565b600483815481106113f757fe5b90600052602060002090600202016000018190555080604001516004838154811061141e57fe5b9060005260206000209060020201600001541061145257600060036000848152602001908152602001600020600101819055505b6114f5565b61148c81602001516004848154811061146c57fe5b9060005260206000209060020201600001546115c090919063ffffffff16565b6004838154811061149957fe5b9060005260206000209060020201600001819055508060400151600483815481106114c057fe5b906000526020600020906002020160000154116114f457600060036000848152602001908152602001600020600101819055505b5b5b5050565b600080831182906115a6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561156b578082015181840152602081019050611550565b50505050905090810190601f1680156115985780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385816115b257fe5b049050809150509392505050565b600061160283836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061160a565b905092915050565b60008383111582906116b7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561167c578082015181840152602081019050611661565b50505050905090810190601f1680156116a95780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b60405180606001604052806000151581526020016000815260200160008152509056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77a26469706673582212207ab55c605423f9f154879d03301672037e7980f5267e01e03a7995123a1da26164736f6c63430007050033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 2,273 |
0x794d1342dade3eee94ec0fbca83537d96ab4ed5c
|
/**
*Submitted for verification at Etherscan.io on 2021-07-20
*/
/**
*Submitted for verification at Etherscan.io on 2021-07-20
/**
* https://t.me/MakinShiba
*
* TOKENOMICS:
* 1,000,000,000,000 token supply
* FIRST TWO MINUTES: 3,000,000,000 max buy / 45-second buy cooldown (these limitations are lifted automatically two minutes post-launch)
* 15-second cooldown to sell after a buy, in order to limit bot behavior. NO OTHER COOLDOWNS, NO COOLDOWNS BETWEEN SELLS
* No buy or sell token limits. Whales are welcome!
* 10% total tax on buy
* Fee on sells is dynamic, relative to price impact, minimum of 10% fee and maximum of 40% fee, with NO SELL LIMIT.
* No team tokens, no presale
* A unique approach to resolving the huge dumps after long pumps that have plagued every NotInu fork
*
*
*/
// 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 MakinShiba is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => User) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1e12 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = unicode"MakinShiba | T.me/MakinShiba";
string private constant _symbol = unicode"MakinShiba";
uint8 private constant _decimals = 9;
uint256 private _taxFee = 6;
uint256 private _teamFee = 4;
uint256 private _feeRate = 5;
uint256 private _feeMultiplier = 1000;
uint256 private _launchTime;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
uint256 private _maxBuyAmount;
address payable private _FeeAddress;
address payable private _marketingWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private _cooldownEnabled = true;
bool private inSwap = false;
bool private _useImpactFeeSetter = true;
uint256 private buyLimitEnd;
struct User {
uint256 buy;
uint256 sell;
bool exists;
}
event MaxBuyAmountUpdated(uint _maxBuyAmount);
event CooldownEnabledUpdated(bool _cooldown);
event FeeMultiplierUpdated(uint _multiplier);
event FeeRateUpdated(uint _rate);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable FeeAddress, address payable marketingWalletAddress) {
_FeeAddress = FeeAddress;
_marketingWalletAddress = marketingWalletAddress;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress] = true;
_isExcludedFromFee[marketingWalletAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function setFee(uint256 impactFee) private {
uint256 _impactFee = 10;
if(impactFee < 10) {
_impactFee = 10;
} else if(impactFee > 40) {
_impactFee = 40;
} else {
_impactFee = impactFee;
}
if(_impactFee.mod(2) != 0) {
_impactFee++;
}
_taxFee = (_impactFee.mul(6)).div(10);
_teamFee = (_impactFee.mul(4)).div(10);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if(from != owner() && to != owner()) {
if(_cooldownEnabled) {
if(!cooldown[msg.sender].exists) {
cooldown[msg.sender] = User(0,0,true);
}
}
// buy
if(from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to]) {
require(tradingOpen, "Trading not yet enabled.");
_taxFee = 6;
_teamFee = 4;
if(_cooldownEnabled) {
if(buyLimitEnd > block.timestamp) {
require(amount <= _maxBuyAmount);
require(cooldown[to].buy < block.timestamp, "Your buy cooldown has not expired.");
cooldown[to].buy = block.timestamp + (45 seconds);
}
}
if(_cooldownEnabled) {
cooldown[to].sell = block.timestamp + (15 seconds);
}
}
uint256 contractTokenBalance = balanceOf(address(this));
// sell
if(!inSwap && from != uniswapV2Pair && tradingOpen) {
if(_cooldownEnabled) {
require(cooldown[from].sell < block.timestamp, "Your sell cooldown has not expired.");
}
if(_useImpactFeeSetter) {
uint256 feeBasis = amount.mul(_feeMultiplier);
feeBasis = feeBasis.div(balanceOf(uniswapV2Pair).add(amount));
setFee(feeBasis);
}
if(contractTokenBalance > 0) {
if(contractTokenBalance > balanceOf(uniswapV2Pair).mul(_feeRate).div(100)) {
contractTokenBalance = balanceOf(uniswapV2Pair).mul(_feeRate).div(100);
}
swapTokensForEth(contractTokenBalance);
}
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_FeeAddress.transfer(amount.div(2));
_marketingWalletAddress.transfer(amount.div(2));
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if(!takeFee)
removeAllFee();
_transferStandard(sender, recipient, amount);
if(!takeFee)
restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if(rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function addLiquidity() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
_maxBuyAmount = 3000000000 * 10**9;
_launchTime = block.timestamp;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function openTrading() public onlyOwner {
tradingOpen = true;
buyLimitEnd = block.timestamp + (120 seconds);
}
function manualswap() external {
require(_msgSender() == _FeeAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _FeeAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
// fallback in case contract is not releasing tokens fast enough
function setFeeRate(uint256 rate) external {
require(_msgSender() == _FeeAddress);
require(rate < 51, "Rate can't exceed 50%");
_feeRate = rate;
emit FeeRateUpdated(_feeRate);
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
_cooldownEnabled = onoff;
emit CooldownEnabledUpdated(_cooldownEnabled);
}
function thisBalance() public view returns (uint) {
return balanceOf(address(this));
}
function cooldownEnabled() public view returns (bool) {
return _cooldownEnabled;
}
function timeToBuy(address buyer) public view returns (uint) {
return block.timestamp - cooldown[buyer].buy;
}
function timeToSell(address buyer) public view returns (uint) {
return block.timestamp - cooldown[buyer].sell;
}
function amountInPool() public view returns (uint) {
return balanceOf(uniswapV2Pair);
}
}
|
0x6080604052600436106101395760003560e01c8063715018a6116100ab578063a9fc35a91161006f578063a9fc35a914610423578063c3c8cd8014610460578063c9567bf914610477578063db92dbb61461048e578063dd62ed3e146104b9578063e8078d94146104f657610140565b8063715018a61461034e5780638da5cb5b1461036557806395d89b4114610390578063a9059cbb146103bb578063a985ceef146103f857610140565b8063313ce567116100fd578063313ce5671461024057806345596e2e1461026b5780635932ead11461029457806368a3a6a5146102bd5780636fc3eaec146102fa57806370a082311461031157610140565b806306fdde0314610145578063095ea7b31461017057806318160ddd146101ad57806323b872dd146101d857806327f3a72a1461021557610140565b3661014057005b600080fd5b34801561015157600080fd5b5061015a61050d565b60405161016791906130da565b60405180910390f35b34801561017c57600080fd5b5061019760048036038101906101929190612bf8565b61054a565b6040516101a491906130bf565b60405180910390f35b3480156101b957600080fd5b506101c2610568565b6040516101cf91906132bc565b60405180910390f35b3480156101e457600080fd5b506101ff60048036038101906101fa9190612ba9565b610579565b60405161020c91906130bf565b60405180910390f35b34801561022157600080fd5b5061022a610652565b60405161023791906132bc565b60405180910390f35b34801561024c57600080fd5b50610255610662565b6040516102629190613331565b60405180910390f35b34801561027757600080fd5b50610292600480360381019061028d9190612c86565b61066b565b005b3480156102a057600080fd5b506102bb60048036038101906102b69190612c34565b610752565b005b3480156102c957600080fd5b506102e460048036038101906102df9190612b1b565b61084a565b6040516102f191906132bc565b60405180910390f35b34801561030657600080fd5b5061030f6108a1565b005b34801561031d57600080fd5b5061033860048036038101906103339190612b1b565b610913565b60405161034591906132bc565b60405180910390f35b34801561035a57600080fd5b50610363610964565b005b34801561037157600080fd5b5061037a610ab7565b6040516103879190612ff1565b60405180910390f35b34801561039c57600080fd5b506103a5610ae0565b6040516103b291906130da565b60405180910390f35b3480156103c757600080fd5b506103e260048036038101906103dd9190612bf8565b610b1d565b6040516103ef91906130bf565b60405180910390f35b34801561040457600080fd5b5061040d610b3b565b60405161041a91906130bf565b60405180910390f35b34801561042f57600080fd5b5061044a60048036038101906104459190612b1b565b610b52565b60405161045791906132bc565b60405180910390f35b34801561046c57600080fd5b50610475610ba9565b005b34801561048357600080fd5b5061048c610c23565b005b34801561049a57600080fd5b506104a3610ce7565b6040516104b091906132bc565b60405180910390f35b3480156104c557600080fd5b506104e060048036038101906104db9190612b6d565b610d19565b6040516104ed91906132bc565b60405180910390f35b34801561050257600080fd5b5061050b610da0565b005b60606040518060400160405280601c81526020017f4d616b696e5368696261207c20542e6d652f4d616b696e536869626100000000815250905090565b600061055e6105576112b0565b84846112b8565b6001905092915050565b6000683635c9adc5dea00000905090565b6000610586848484611483565b610647846105926112b0565b61064285604051806060016040528060288152602001613a1360289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006105f86112b0565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d4d9092919063ffffffff16565b6112b8565b600190509392505050565b600061065d30610913565b905090565b60006009905090565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166106ac6112b0565b73ffffffffffffffffffffffffffffffffffffffff16146106cc57600080fd5b6033811061070f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107069061319c565b60405180910390fd5b80600b819055507f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd8600b5460405161074791906132bc565b60405180910390a150565b61075a6112b0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146107e7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107de906131fc565b60405180910390fd5b80601460156101000a81548160ff0219169083151502179055507f0d63187a8abb5b4d1bb562e1163897386b0a88ee72e0799dd105bd0fd6f28706601460159054906101000a900460ff1660405161083f91906130bf565b60405180910390a150565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001544261089a9190613482565b9050919050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108e26112b0565b73ffffffffffffffffffffffffffffffffffffffff161461090257600080fd5b600047905061091081611db1565b50565b600061095d600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611eac565b9050919050565b61096c6112b0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146109f9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109f0906131fc565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600a81526020017f4d616b696e536869626100000000000000000000000000000000000000000000815250905090565b6000610b31610b2a6112b0565b8484611483565b6001905092915050565b6000601460159054906101000a900460ff16905090565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015442610ba29190613482565b9050919050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610bea6112b0565b73ffffffffffffffffffffffffffffffffffffffff1614610c0a57600080fd5b6000610c1530610913565b9050610c2081611f1a565b50565b610c2b6112b0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610cb8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610caf906131fc565b60405180910390fd5b60016014806101000a81548160ff021916908315150217905550607842610cdf91906133a1565b601581905550565b6000610d14601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610913565b905090565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b610da86112b0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e35576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e2c906131fc565b60405180910390fd5b60148054906101000a900460ff1615610e83576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e7a9061327c565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610f1330601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112b8565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610f5957600080fd5b505afa158015610f6d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f919190612b44565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610ff357600080fd5b505afa158015611007573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061102b9190612b44565b6040518363ffffffff1660e01b815260040161104892919061300c565b602060405180830381600087803b15801561106257600080fd5b505af1158015611076573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061109a9190612b44565b601460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d719473061112330610913565b60008061112e610ab7565b426040518863ffffffff1660e01b81526004016111509695949392919061305e565b6060604051808303818588803b15801561116957600080fd5b505af115801561117d573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906111a29190612caf565b5050506729a2241af62c000060108190555042600d81905550601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161125a929190613035565b602060405180830381600087803b15801561127457600080fd5b505af1158015611288573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112ac9190612c5d565b5050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611328576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131f9061325c565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611398576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138f9061313c565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161147691906132bc565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114f3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114ea9061323c565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611563576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161155a906130fc565b60405180910390fd5b600081116115a6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161159d9061321c565b60405180910390fd5b6115ae610ab7565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561161c57506115ec610ab7565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611c8a57601460159054906101000a900460ff161561172257600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020160009054906101000a900460ff16611721576040518060600160405280600081526020016000815260200160011515815250600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082015181600001556020820151816001015560408201518160020160006101000a81548160ff0219169083151502179055509050505b5b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156117cd5750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156118235750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156119f65760148054906101000a900460ff16611875576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161186c9061329c565b60405180910390fd5b60066009819055506004600a81905550601460159054906101000a900460ff161561198c5742601554111561198b576010548111156118b357600080fd5b42600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015410611937576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161192e9061315c565b60405180910390fd5b602d4261194491906133a1565b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001819055505b5b601460159054906101000a900460ff16156119f557600f426119ae91906133a1565b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101819055505b5b6000611a0130610913565b9050601460169054906101000a900460ff16158015611a6e5750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611a84575060148054906101000a900460ff165b15611c8857601460159054906101000a900460ff1615611b235742600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015410611b22576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b19906131bc565b60405180910390fd5b5b601460179054906101000a900460ff1615611bad576000611b4f600c548461221490919063ffffffff16565b9050611ba0611b9184611b83601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610913565b61228f90919063ffffffff16565b826122ed90919063ffffffff16565b9050611bab81612337565b505b6000811115611c6e57611c086064611bfa600b54611bec601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610913565b61221490919063ffffffff16565b6122ed90919063ffffffff16565b811115611c6457611c616064611c53600b54611c45601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610913565b61221490919063ffffffff16565b6122ed90919063ffffffff16565b90505b611c6d81611f1a565b5b60004790506000811115611c8657611c8547611db1565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611d315750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611d3b57600090505b611d47848484846123ee565b50505050565b6000838311158290611d95576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d8c91906130da565b60405180910390fd5b5060008385611da49190613482565b9050809150509392505050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611e016002846122ed90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611e2c573d6000803e3d6000fd5b50601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611e7d6002846122ed90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611ea8573d6000803e3d6000fd5b5050565b6000600754821115611ef3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611eea9061311c565b60405180910390fd5b6000611efd61241b565b9050611f1281846122ed90919063ffffffff16565b915050919050565b6001601460166101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611f78577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611fa65781602001602082028036833780820191505090505b5090503081600081518110611fe4577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561208657600080fd5b505afa15801561209a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120be9190612b44565b816001815181106120f8577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061215f30601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112b8565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016121c39594939291906132d7565b600060405180830381600087803b1580156121dd57600080fd5b505af11580156121f1573d6000803e3d6000fd5b50505050506000601460166101000a81548160ff02191690831515021790555050565b6000808314156122275760009050612289565b600082846122359190613428565b905082848261224491906133f7565b14612284576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161227b906131dc565b60405180910390fd5b809150505b92915050565b600080828461229e91906133a1565b9050838110156122e3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122da9061317c565b60405180910390fd5b8091505092915050565b600061232f83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612446565b905092915050565b6000600a9050600a82101561234f57600a9050612366565b60288211156123615760289050612365565b8190505b5b600061237c6002836124a990919063ffffffff16565b1461239057808061238c90613550565b9150505b6123b7600a6123a960068461221490919063ffffffff16565b6122ed90919063ffffffff16565b6009819055506123e4600a6123d660048461221490919063ffffffff16565b6122ed90919063ffffffff16565b600a819055505050565b806123fc576123fb6124f3565b5b612407848484612536565b8061241557612414612701565b5b50505050565b6000806000612428612715565b9150915061243f81836122ed90919063ffffffff16565b9250505090565b6000808311829061248d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161248491906130da565b60405180910390fd5b506000838561249c91906133f7565b9050809150509392505050565b60006124eb83836040518060400160405280601881526020017f536166654d6174683a206d6f64756c6f206279207a65726f0000000000000000815250612777565b905092915050565b600060095414801561250757506000600a54145b1561251157612534565b600954600e81905550600a54600f8190555060006009819055506000600a819055505b565b600080600080600080612548876127d5565b9550955095509550955095506125a686600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461283d90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061263b85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461228f90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061268781612887565b6126918483612944565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516126ee91906132bc565b60405180910390a3505050505050505050565b600e54600981905550600f54600a81905550565b600080600060075490506000683635c9adc5dea00000905061274b683635c9adc5dea000006007546122ed90919063ffffffff16565b82101561276a57600754683635c9adc5dea00000935093505050612773565b81819350935050505b9091565b60008083141582906127bf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016127b691906130da565b60405180910390fd5b5082846127cc9190613599565b90509392505050565b60008060008060008060008060006127f28a600954600a5461297e565b925092509250600061280261241b565b905060008060006128158e878787612a14565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061287f83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611d4d565b905092915050565b600061289161241b565b905060006128a8828461221490919063ffffffff16565b90506128fc81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461228f90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6129598260075461283d90919063ffffffff16565b6007819055506129748160085461228f90919063ffffffff16565b6008819055505050565b6000806000806129aa606461299c888a61221490919063ffffffff16565b6122ed90919063ffffffff16565b905060006129d460646129c6888b61221490919063ffffffff16565b6122ed90919063ffffffff16565b905060006129fd826129ef858c61283d90919063ffffffff16565b61283d90919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612a2d858961221490919063ffffffff16565b90506000612a44868961221490919063ffffffff16565b90506000612a5b878961221490919063ffffffff16565b90506000612a8482612a76858761283d90919063ffffffff16565b61283d90919063ffffffff16565b9050838184965096509650505050509450945094915050565b600081359050612aac816139cd565b92915050565b600081519050612ac1816139cd565b92915050565b600081359050612ad6816139e4565b92915050565b600081519050612aeb816139e4565b92915050565b600081359050612b00816139fb565b92915050565b600081519050612b15816139fb565b92915050565b600060208284031215612b2d57600080fd5b6000612b3b84828501612a9d565b91505092915050565b600060208284031215612b5657600080fd5b6000612b6484828501612ab2565b91505092915050565b60008060408385031215612b8057600080fd5b6000612b8e85828601612a9d565b9250506020612b9f85828601612a9d565b9150509250929050565b600080600060608486031215612bbe57600080fd5b6000612bcc86828701612a9d565b9350506020612bdd86828701612a9d565b9250506040612bee86828701612af1565b9150509250925092565b60008060408385031215612c0b57600080fd5b6000612c1985828601612a9d565b9250506020612c2a85828601612af1565b9150509250929050565b600060208284031215612c4657600080fd5b6000612c5484828501612ac7565b91505092915050565b600060208284031215612c6f57600080fd5b6000612c7d84828501612adc565b91505092915050565b600060208284031215612c9857600080fd5b6000612ca684828501612af1565b91505092915050565b600080600060608486031215612cc457600080fd5b6000612cd286828701612b06565b9350506020612ce386828701612b06565b9250506040612cf486828701612b06565b9150509250925092565b6000612d0a8383612d16565b60208301905092915050565b612d1f816134b6565b82525050565b612d2e816134b6565b82525050565b6000612d3f8261335c565b612d49818561337f565b9350612d548361334c565b8060005b83811015612d85578151612d6c8882612cfe565b9750612d7783613372565b925050600181019050612d58565b5085935050505092915050565b612d9b816134c8565b82525050565b612daa8161350b565b82525050565b6000612dbb82613367565b612dc58185613390565b9350612dd581856020860161351d565b612dde81613628565b840191505092915050565b6000612df6602383613390565b9150612e0182613639565b604082019050919050565b6000612e19602a83613390565b9150612e2482613688565b604082019050919050565b6000612e3c602283613390565b9150612e47826136d7565b604082019050919050565b6000612e5f602283613390565b9150612e6a82613726565b604082019050919050565b6000612e82601b83613390565b9150612e8d82613775565b602082019050919050565b6000612ea5601583613390565b9150612eb08261379e565b602082019050919050565b6000612ec8602383613390565b9150612ed3826137c7565b604082019050919050565b6000612eeb602183613390565b9150612ef682613816565b604082019050919050565b6000612f0e602083613390565b9150612f1982613865565b602082019050919050565b6000612f31602983613390565b9150612f3c8261388e565b604082019050919050565b6000612f54602583613390565b9150612f5f826138dd565b604082019050919050565b6000612f77602483613390565b9150612f828261392c565b604082019050919050565b6000612f9a601783613390565b9150612fa58261397b565b602082019050919050565b6000612fbd601883613390565b9150612fc8826139a4565b602082019050919050565b612fdc816134f4565b82525050565b612feb816134fe565b82525050565b60006020820190506130066000830184612d25565b92915050565b60006040820190506130216000830185612d25565b61302e6020830184612d25565b9392505050565b600060408201905061304a6000830185612d25565b6130576020830184612fd3565b9392505050565b600060c0820190506130736000830189612d25565b6130806020830188612fd3565b61308d6040830187612da1565b61309a6060830186612da1565b6130a76080830185612d25565b6130b460a0830184612fd3565b979650505050505050565b60006020820190506130d46000830184612d92565b92915050565b600060208201905081810360008301526130f48184612db0565b905092915050565b6000602082019050818103600083015261311581612de9565b9050919050565b6000602082019050818103600083015261313581612e0c565b9050919050565b6000602082019050818103600083015261315581612e2f565b9050919050565b6000602082019050818103600083015261317581612e52565b9050919050565b6000602082019050818103600083015261319581612e75565b9050919050565b600060208201905081810360008301526131b581612e98565b9050919050565b600060208201905081810360008301526131d581612ebb565b9050919050565b600060208201905081810360008301526131f581612ede565b9050919050565b6000602082019050818103600083015261321581612f01565b9050919050565b6000602082019050818103600083015261323581612f24565b9050919050565b6000602082019050818103600083015261325581612f47565b9050919050565b6000602082019050818103600083015261327581612f6a565b9050919050565b6000602082019050818103600083015261329581612f8d565b9050919050565b600060208201905081810360008301526132b581612fb0565b9050919050565b60006020820190506132d16000830184612fd3565b92915050565b600060a0820190506132ec6000830188612fd3565b6132f96020830187612da1565b818103604083015261330b8186612d34565b905061331a6060830185612d25565b6133276080830184612fd3565b9695505050505050565b60006020820190506133466000830184612fe2565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006133ac826134f4565b91506133b7836134f4565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156133ec576133eb6135ca565b5b828201905092915050565b6000613402826134f4565b915061340d836134f4565b92508261341d5761341c6135f9565b5b828204905092915050565b6000613433826134f4565b915061343e836134f4565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613477576134766135ca565b5b828202905092915050565b600061348d826134f4565b9150613498836134f4565b9250828210156134ab576134aa6135ca565b5b828203905092915050565b60006134c1826134d4565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000613516826134f4565b9050919050565b60005b8381101561353b578082015181840152602081019050613520565b8381111561354a576000848401525b50505050565b600061355b826134f4565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561358e5761358d6135ca565b5b600182019050919050565b60006135a4826134f4565b91506135af836134f4565b9250826135bf576135be6135f9565b5b828206905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f596f75722062757920636f6f6c646f776e20686173206e6f742065787069726560008201527f642e000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f526174652063616e277420657863656564203530250000000000000000000000600082015250565b7f596f75722073656c6c20636f6f6c646f776e20686173206e6f7420657870697260008201527f65642e0000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f54726164696e67206e6f742079657420656e61626c65642e0000000000000000600082015250565b6139d6816134b6565b81146139e157600080fd5b50565b6139ed816134c8565b81146139f857600080fd5b50565b613a04816134f4565b8114613a0f57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220c86e8063d199b7915f2bcef239311474143cd0b8094c76d7c8cb5d2ac45bb37964736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 2,274 |
0x19bcf5962a8e85180d95efee47b5401d517d63cd
|
pragma solidity ^0.4.17;
/**
* @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) 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 > 0 && _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 constant returns (uint256 balance) {
return balances[_owner]+1;
}
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public constant returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @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 > 0 && _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 constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
}
/**
* @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;
}
}
/**
* @title Pausable
* @dev Base contract which allows children to implement an emergency stop mechanism.
*/
contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() onlyOwner whenNotPaused public {
paused = true;
Pause();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused public {
paused = false;
Unpause();
}
}
/**
* @title Pausable token
*
* @dev StandardToken modified with pausable transfers.
**/
contract PausableToken is StandardToken, Pausable {
mapping (address => bool) public frozenAccount;
event FrozenFunds(address target, bool frozen);
function transfer(address _to, uint256 _value) public whenNotPaused returns (bool) {
require(!frozenAccount[msg.sender]);
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 batchTransfer(address[] _receivers, uint256 _value) public whenNotPaused returns (bool) {
require(!frozenAccount[msg.sender]);
uint cnt = _receivers.length;
uint256 amount = uint256(cnt).mul(_value);
require(cnt > 0 && cnt <= 50);
require(_value > 0 && balances[msg.sender] >= amount);
balances[msg.sender] = balances[msg.sender].sub(amount);
for (uint i = 0; i < cnt; i++) {
balances[_receivers[i]] = balances[_receivers[i]].add(_value);
Transfer(msg.sender, _receivers[i], _value);
}
return true;
}
function freezeAccount(address target, bool freeze) onlyOwner public {
frozenAccount[target] = freeze;
FrozenFunds(target, freeze);
}
function batchFreeze(address[] addresses, bool freeze) onlyOwner public {
for (uint i = 0; i < addresses.length; i++) {
frozenAccount[addresses[i]] = freeze;
FrozenFunds(addresses[i], freeze);
}
}
}
/**
* @title Elixer
*
* @dev Implementation of Elixer Token based on the basic standard token.
*/
contract ELIX is PausableToken {
/**
* Public variables of the token
* The following variables are OPTIONAL vanities. One does not have to include them.
* They allow one to customise the token contract & in no way influences the core functionality.
* Some wallets/interfaces might not even bother to look at this information.
*/
string public name = "Elixer";
string public symbol = "ELIX";
uint8 public decimals = 18;
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
*/
function Elixer() {
totalSupply = 10000000000 * (10**(uint256(decimals)));
balances[msg.sender] = totalSupply; // Give the creator all initial tokens
}
function batchTransfer2(address[] _receivers) public whenNotPaused returns (bool) {
require(!frozenAccount[msg.sender]);
uint cnt = _receivers.length;
uint256 amount = uint256(cnt).mul(1 ether);
require(balances[msg.sender] >= amount);
balances[msg.sender] = balances[msg.sender].sub(amount);
for (uint i = 0; i < cnt; i++) {
Transfer(msg.sender, _receivers[i], 1 ether);
}
return true;
}
function () {
//if ether is sent to this address, send it back.
revert();
}
}
|
0x60606040523615610110576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde0314610120578063095ea7b3146101ae57806318160ddd1461020857806323b872dd14610231578063313ce567146102aa5780633f4ba83a146102d95780635c975abb146102ee57806370a082311461031b57806383f12fec146103685780638456cb59146103e35780638da5cb5b146103f85780638e4142951461044d57806395d89b4114610462578063a9059cbb146104f0578063ae13efe01461054a578063b414d4b6146105af578063ca2527e514610600578063dd62ed3e14610672578063e724529c146106de578063f2fde38b14610722575b341561011b57600080fd5b600080fd5b341561012b57600080fd5b61013361075b565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610173578082015181840152602081019050610158565b50505050905090810190601f1680156101a05780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101b957600080fd5b6101ee600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506107f9565b604051808215151515815260200191505060405180910390f35b341561021357600080fd5b61021b610829565b6040518082815260200191505060405180910390f35b341561023c57600080fd5b610290600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061082f565b604051808215151515815260200191505060405180910390f35b34156102b557600080fd5b6102bd610861565b604051808260ff1660ff16815260200191505060405180910390f35b34156102e457600080fd5b6102ec610874565b005b34156102f957600080fd5b610301610934565b604051808215151515815260200191505060405180910390f35b341561032657600080fd5b610352600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610947565b6040518082815260200191505060405180910390f35b341561037357600080fd5b6103c9600480803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091908035906020019091905050610992565b604051808215151515815260200191505060405180910390f35b34156103ee57600080fd5b6103f6610c97565b005b341561040357600080fd5b61040b610d58565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561045857600080fd5b610460610d7e565b005b341561046d57600080fd5b610475610de9565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104b557808201518184015260208101905061049a565b50505050905090810190601f1680156104e25780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156104fb57600080fd5b610530600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610e87565b604051808215151515815260200191505060405180910390f35b341561055557600080fd5b6105ad6004808035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919080351515906020019091905050610f10565b005b34156105ba57600080fd5b6105e6600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611082565b604051808215151515815260200191505060405180910390f35b341561060b57600080fd5b6106586004808035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919050506110a2565b604051808215151515815260200191505060405180910390f35b341561067d57600080fd5b6106c8600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506112cb565b6040518082815260200191505060405180910390f35b34156106e957600080fd5b610720600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080351515906020019091905050611352565b005b341561072d57600080fd5b610759600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611478565b005b60058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156107f15780601f106107c6576101008083540402835291602001916107f1565b820191906000526020600020905b8154815290600101906020018083116107d457829003601f168201915b505050505081565b6000600360149054906101000a900460ff1615151561081757600080fd5b61082183836115d0565b905092915050565b60005481565b6000600360149054906101000a900460ff1615151561084d57600080fd5b6108588484846116c2565b90509392505050565b600760009054906101000a900460ff1681565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156108d057600080fd5b600360149054906101000a900460ff1615156108eb57600080fd5b6000600360146101000a81548160ff0219169083151502179055507f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a1565b600360149054906101000a900460ff1681565b600060018060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054019050919050565b600080600080600360149054906101000a900460ff161515156109b457600080fd5b600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515610a0d57600080fd5b85519250610a248584611a8d90919063ffffffff16565b9150600083118015610a37575060328311155b1515610a4257600080fd5b600085118015610a91575081600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410155b1515610a9c57600080fd5b610aee82600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ac090919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600090505b82811015610c8a57610ba785600160008985815181101515610b5457fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ad990919063ffffffff16565b600160008884815181101515610bb957fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508581815181101515610c0f57fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef876040518082815260200191505060405180910390a38080600101915050610b36565b6001935050505092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610cf357600080fd5b600360149054906101000a900460ff16151515610d0f57600080fd5b6001600360146101000a81548160ff0219169083151502179055507f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a1565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600760009054906101000a900460ff1660ff16600a0a6402540be40002600081905550600054600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550565b60068054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610e7f5780601f10610e5457610100808354040283529160200191610e7f565b820191906000526020600020905b815481529060010190602001808311610e6257829003601f168201915b505050505081565b6000600360149054906101000a900460ff16151515610ea557600080fd5b600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515610efe57600080fd5b610f088383611af7565b905092915050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610f6e57600080fd5b600090505b825181101561107d5781600460008584815181101515610f8f57fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507f48335238b4855f35377ed80f164e8c6f3c366e54ac00b96a6402d4a9814a03a5838281518110151561101957fe5b9060200190602002015183604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001821515151581526020019250505060405180910390a18080600101915050610f73565b505050565b60046020528060005260406000206000915054906101000a900460ff1681565b600080600080600360149054906101000a900460ff161515156110c457600080fd5b600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151561111d57600080fd5b8451925061113c670de0b6b3a764000084611a8d90919063ffffffff16565b915081600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015151561118c57600080fd5b6111de82600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ac090919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600090505b828110156112bf57848181518110151561123c57fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef670de0b6b3a76400006040518082815260200191505060405180910390a38080600101915050611226565b60019350505050919050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156113ae57600080fd5b80600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507f48335238b4855f35377ed80f164e8c6f3c366e54ac00b96a6402d4a9814a03a58282604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001821515151581526020019250505060405180910390a15050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156114d457600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561151057600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156116ff57600080fd5b60008211801561174e5750600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211155b151561175957600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156117e457600080fd5b61183682600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ac090919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506118cb82600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ad990919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061199d82600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ac090919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b60008082840290506000841480611aae5750828482811515611aab57fe5b04145b1515611ab657fe5b8091505092915050565b6000828211151515611ace57fe5b818303905092915050565b6000808284019050838110151515611aed57fe5b8091505092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515611b3457600080fd5b600082118015611b835750600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211155b1515611b8e57600080fd5b611be082600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ac090919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611c7582600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ad990919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a360019050929150505600a165627a7a7230582038b5e269503aaa499d6ed1d4f8e97def2503da1f69a66bdadcf3dfdabcac0b770029
|
{"success": true, "error": null, "results": {}}
| 2,275 |
0x1a0b2ca69ca2c7f96e2529faa6d63f881655d81a
|
pragma solidity 0.4.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) {
// 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 A sorted doubly linked list with nodes sorted in descending order. Optionally accepts insert position hints
*
* Given a new node with a `key`, a hint is of the form `(prevId, nextId)` s.t. `prevId` and `nextId` are adjacent in the list.
* `prevId` is a node with a key >= `key` and `nextId` is a node with a key <= `key`. If the sender provides a hint that is a valid insert position
* the insert operation is a constant time storage write. However, the provided hint in a given transaction might be a valid insert position, but if other transactions are included first, when
* the given transaction is executed the provided hint may no longer be a valid insert position. For example, one of the nodes referenced might be removed or their keys may
* be updated such that the the pair of nodes in the hint no longer represent a valid insert position. If one of the nodes in the hint becomes invalid, we still try to use the other
* valid node as a starting point for finding the appropriate insert position. If both nodes in the hint become invalid, we use the head of the list as a starting point
* to find the appropriate insert position.
*/
library SortedDoublyLL {
using SafeMath for uint256;
// Information for a node in the list
struct Node {
uint256 key; // Node's key used for sorting
address nextId; // Id of next node (smaller key) in the list
address prevId; // Id of previous node (larger key) in the list
}
// Information for the list
struct Data {
address head; // Head of the list. Also the node in the list with the largest key
address tail; // Tail of the list. Also the node in the list with the smallest key
uint256 maxSize; // Maximum size of the list
uint256 size; // Current size of the list
mapping (address => Node) nodes; // Track the corresponding ids for each node in the list
}
/*
* @dev Set the maximum size of the list
* @param _size Maximum size
*/
function setMaxSize(Data storage self, uint256 _size) public {
// New max size must be greater than old max size
require(_size > self.maxSize);
self.maxSize = _size;
}
/*
* @dev Add a node to the list
* @param _id Node's id
* @param _key Node's key
* @param _prevId Id of previous node for the insert position
* @param _nextId Id of next node for the insert position
*/
function insert(Data storage self, address _id, uint256 _key, address _prevId, address _nextId) public {
// List must not be full
require(!isFull(self));
// List must not already contain node
require(!contains(self, _id));
// Node id must not be null
require(_id != address(0));
// Key must be non-zero
require(_key > 0);
address prevId = _prevId;
address nextId = _nextId;
if (!validInsertPosition(self, _key, prevId, nextId)) {
// Sender's hint was not a valid insert position
// Use sender's hint to find a valid insert position
(prevId, nextId) = findInsertPosition(self, _key, prevId, nextId);
}
self.nodes[_id].key = _key;
if (prevId == address(0) && nextId == address(0)) {
// Insert as head and tail
self.head = _id;
self.tail = _id;
} else if (prevId == address(0)) {
// Insert before `prevId` as the head
self.nodes[_id].nextId = self.head;
self.nodes[self.head].prevId = _id;
self.head = _id;
} else if (nextId == address(0)) {
// Insert after `nextId` as the tail
self.nodes[_id].prevId = self.tail;
self.nodes[self.tail].nextId = _id;
self.tail = _id;
} else {
// Insert at insert position between `prevId` and `nextId`
self.nodes[_id].nextId = nextId;
self.nodes[_id].prevId = prevId;
self.nodes[prevId].nextId = _id;
self.nodes[nextId].prevId = _id;
}
self.size = self.size.add(1);
}
/*
* @dev Remove a node from the list
* @param _id Node's id
*/
function remove(Data storage self, address _id) public {
// List must contain the node
require(contains(self, _id));
if (self.size > 1) {
// List contains more than a single node
if (_id == self.head) {
// The removed node is the head
// Set head to next node
self.head = self.nodes[_id].nextId;
// Set prev pointer of new head to null
self.nodes[self.head].prevId = address(0);
} else if (_id == self.tail) {
// The removed node is the tail
// Set tail to previous node
self.tail = self.nodes[_id].prevId;
// Set next pointer of new tail to null
self.nodes[self.tail].nextId = address(0);
} else {
// The removed node is neither the head nor the tail
// Set next pointer of previous node to the next node
self.nodes[self.nodes[_id].prevId].nextId = self.nodes[_id].nextId;
// Set prev pointer of next node to the previous node
self.nodes[self.nodes[_id].nextId].prevId = self.nodes[_id].prevId;
}
} else {
// List contains a single node
// Set the head and tail to null
self.head = address(0);
self.tail = address(0);
}
delete self.nodes[_id];
self.size = self.size.sub(1);
}
/*
* @dev Update the key of a node in the list
* @param _id Node's id
* @param _newKey Node's new key
* @param _prevId Id of previous node for the new insert position
* @param _nextId Id of next node for the new insert position
*/
function updateKey(Data storage self, address _id, uint256 _newKey, address _prevId, address _nextId) public {
// List must contain the node
require(contains(self, _id));
// Remove node from the list
remove(self, _id);
if (_newKey > 0) {
// Insert node if it has a non-zero key
insert(self, _id, _newKey, _prevId, _nextId);
}
}
/*
* @dev Checks if the list contains a node
* @param _transcoder Address of transcoder
*/
function contains(Data storage self, address _id) public view returns (bool) {
// List only contains non-zero keys, so if key is non-zero the node exists
return self.nodes[_id].key > 0;
}
/*
* @dev Checks if the list is full
*/
function isFull(Data storage self) public view returns (bool) {
return self.size == self.maxSize;
}
/*
* @dev Checks if the list is empty
*/
function isEmpty(Data storage self) public view returns (bool) {
return self.size == 0;
}
/*
* @dev Returns the current size of the list
*/
function getSize(Data storage self) public view returns (uint256) {
return self.size;
}
/*
* @dev Returns the maximum size of the list
*/
function getMaxSize(Data storage self) public view returns (uint256) {
return self.maxSize;
}
/*
* @dev Returns the key of a node in the list
* @param _id Node's id
*/
function getKey(Data storage self, address _id) public view returns (uint256) {
return self.nodes[_id].key;
}
/*
* @dev Returns the first node in the list (node with the largest key)
*/
function getFirst(Data storage self) public view returns (address) {
return self.head;
}
/*
* @dev Returns the last node in the list (node with the smallest key)
*/
function getLast(Data storage self) public view returns (address) {
return self.tail;
}
/*
* @dev Returns the next node (with a smaller key) in the list for a given node
* @param _id Node's id
*/
function getNext(Data storage self, address _id) public view returns (address) {
return self.nodes[_id].nextId;
}
/*
* @dev Returns the previous node (with a larger key) in the list for a given node
* @param _id Node's id
*/
function getPrev(Data storage self, address _id) public view returns (address) {
return self.nodes[_id].prevId;
}
/*
* @dev Check if a pair of nodes is a valid insertion point for a new node with the given key
* @param _key Node's key
* @param _prevId Id of previous node for the insert position
* @param _nextId Id of next node for the insert position
*/
function validInsertPosition(Data storage self, uint256 _key, address _prevId, address _nextId) public view returns (bool) {
if (_prevId == address(0) && _nextId == address(0)) {
// `(null, null)` is a valid insert position if the list is empty
return isEmpty(self);
} else if (_prevId == address(0)) {
// `(null, _nextId)` is a valid insert position if `_nextId` is the head of the list
return self.head == _nextId && _key >= self.nodes[_nextId].key;
} else if (_nextId == address(0)) {
// `(_prevId, null)` is a valid insert position if `_prevId` is the tail of the list
return self.tail == _prevId && _key <= self.nodes[_prevId].key;
} else {
// `(_prevId, _nextId)` is a valid insert position if they are adjacent nodes and `_key` falls between the two nodes' keys
return self.nodes[_prevId].nextId == _nextId && self.nodes[_prevId].key >= _key && _key >= self.nodes[_nextId].key;
}
}
/*
* @dev Descend the list (larger keys to smaller keys) to find a valid insert position
* @param _key Node's key
* @param _startId Id of node to start ascending the list from
*/
function descendList(Data storage self, uint256 _key, address _startId) private view returns (address, address) {
// If `_startId` is the head, check if the insert position is before the head
if (self.head == _startId && _key >= self.nodes[_startId].key) {
return (address(0), _startId);
}
address prevId = _startId;
address nextId = self.nodes[prevId].nextId;
// Descend the list until we reach the end or until we find a valid insert position
while (prevId != address(0) && !validInsertPosition(self, _key, prevId, nextId)) {
prevId = self.nodes[prevId].nextId;
nextId = self.nodes[prevId].nextId;
}
return (prevId, nextId);
}
/*
* @dev Ascend the list (smaller keys to larger keys) to find a valid insert position
* @param _key Node's key
* @param _startId Id of node to start descending the list from
*/
function ascendList(Data storage self, uint256 _key, address _startId) private view returns (address, address) {
// If `_startId` is the tail, check if the insert position is after the tail
if (self.tail == _startId && _key <= self.nodes[_startId].key) {
return (_startId, address(0));
}
address nextId = _startId;
address prevId = self.nodes[nextId].prevId;
// Ascend the list until we reach the end or until we find a valid insertion point
while (nextId != address(0) && !validInsertPosition(self, _key, prevId, nextId)) {
nextId = self.nodes[nextId].prevId;
prevId = self.nodes[nextId].prevId;
}
return (prevId, nextId);
}
/*
* @dev Find the insert position for a new node with the given key
* @param _key Node's key
* @param _prevId Id of previous node for the insert position
* @param _nextId Id of next node for the insert position
*/
function findInsertPosition(Data storage self, uint256 _key, address _prevId, address _nextId) private view returns (address, address) {
address prevId = _prevId;
address nextId = _nextId;
if (prevId != address(0)) {
if (!contains(self, prevId) || _key > self.nodes[prevId].key) {
// `prevId` does not exist anymore or now has a smaller key than the given key
prevId = address(0);
}
}
if (nextId != address(0)) {
if (!contains(self, nextId) || _key < self.nodes[nextId].key) {
// `nextId` does not exist anymore or now has a larger key than the given key
nextId = address(0);
}
}
if (prevId == address(0) && nextId == address(0)) {
// No hint - descend list starting from head
return descendList(self, _key, self.head);
} else if (prevId == address(0)) {
// No `prevId` for hint - ascend list starting from `nextId`
return ascendList(self, _key, nextId);
} else if (nextId == address(0)) {
// No `nextId` for hint - descend list starting from `prevId`
return descendList(self, _key, prevId);
} else {
// Descend list starting from `prevId`
return descendList(self, _key, prevId);
}
}
}
|
0x6060604052600436106100da5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416632ebb2fed81146100df57806338237efe146101065780633a5c20441461012f5780634aa12990146101635780634fbaa9a61461016e5780635d35e0071461019557806372e40b26146101ac578063735bc2ca146101b7578063a176adaf146101d4578063b0138c47146101e2578063b32ece58146101f9578063be6f92d414610204578063d86811281461020f578063e189dedb14610226578063fe1ee7191461023d575b600080fd5b6100ea600435610254565b604051600160a060020a03909116815260200160405180910390f35b61012d600435600160a060020a036024358116906044359060643581169060843516610261565b005b61014f600435602435600160a060020a036044358116906064351661029d565b604051901515815260200160405180910390f35b61014f6004356103e6565b61012d600435600160a060020a0360243581169060443590606435811690608435166103f5565b61012d600435600160a060020a0360243516610633565b6100ea600435610800565b6101c2600435610810565b60405190815260200160405180910390f35b61012d600435602435610817565b61014f600435600160a060020a036024351661082f565b6101c260043561084f565b61014f600435610856565b6101c2600435600160a060020a036024351661085e565b6100ea600435600160a060020a036024351661087d565b6100ea600435600160a060020a03602435166108a3565b54600160a060020a031690565b61026b858561082f565b151561027657600080fd5b6102808585610633565b60008311156102965761029685858585856103f5565b5050505050565b6000600160a060020a0383161580156102bd5750600160a060020a038216155b156102d2576102cb85610856565b90506103de565b600160a060020a038316151561031d578454600160a060020a0383811691161480156102cb575050600160a060020a03811660009081526004850160205260409020548310156103de565b600160a060020a038216151561036b576001850154600160a060020a0384811691161480156102cb575050600160a060020a03821660009081526004850160205260409020548311156103de565b600160a060020a03838116600090815260048701602052604090206001015481169083161480156103b75750600160a060020a0383166000908152600486016020526040902054849010155b80156102cb575050600160a060020a03811660009081526004850160205260409020548310155b949350505050565b60028101546003909101541490565b600080610401876103e6565b1561040b57600080fd5b610415878761082f565b1561041f57600080fd5b600160a060020a038616151561043457600080fd5b6000851161044157600080fd5b50829050816104528786848461029d565b151561046a57610464878684846108c9565b90925090505b600160a060020a0380871660009081526004890160205260409020869055821615801561049e5750600160a060020a038116155b156104d0578654600160a060020a038716600160a060020a03199182168117895560018901805490921617905561060c565b600160a060020a0382161515610538578654600160a060020a03878116600081815260048b0160205260408082206001018054958516600160a060020a03199687161790558b549093168152919091206002018054831682179055885490911617875561060c565b600160a060020a03811615156105a55760018781018054600160a060020a03898116600081815260048d0160205260408082206002018054958516600160a060020a031996871617905585549093168152919091209093018054821684179055815416909117905561060c565b600160a060020a03808716600081815260048a01602052604080822060018082018054878916600160a060020a0319918216811790925560029384018054988b16988216891790559685528385209091018054871686179055835291200180549092161790555b600387015461062290600163ffffffff6109ed16565b876003018190555050505050505050565b61063d828261082f565b151561064857600080fd5b600182600301541115610784578154600160a060020a03828116911614156106b557600160a060020a038181166000908152600484016020526040808220600101548554908416600160a060020a031991821617808755909316825290206002018054909116905561077f565b6001820154600160a060020a038281169116141561071e57600160a060020a0381811660009081526004840160205260408082206002015460018087018054928616600160a060020a03199384161790819055909416835291209091018054909116905561077f565b600160a060020a0381811660009081526004840160205260408082206001808201805460029384018054881687528587209093018054918816600160a060020a03199283161790559154905486168552929093200180549190931691161790555b6107a0565b8154600160a060020a0319908116835560018301805490911690555b600160a060020a0381166000908152600483016020526040812090815560018082018054600160a060020a03199081169091556002909201805490921690915560038301546107f49163ffffffff610a0316565b82600301819055505050565b60010154600160a060020a031690565b6002015490565b6002820154811161082757600080fd5b600290910155565b600160a060020a0316600090815260049190910160205260408120541190565b6003015490565b600301541590565b600160a060020a03166000908152600491909101602052604090205490565b600160a060020a0380821660009081526004840160205260409020600101541692915050565b600160a060020a0380821660009081526004840160205260409020600201541692915050565b6000808383600160a060020a03821615610916576108e7888361082f565b158061090c5750600160a060020a038216600090815260048901602052604090205487115b1561091657600091505b600160a060020a0381161561095d5761092f888261082f565b15806109545750600160a060020a038116600090815260048901602052604090205487105b1561095d575060005b600160a060020a03821615801561097b5750600160a060020a038116155b156109a15787546109989089908990600160a060020a0316610a15565b935093506109e2565b600160a060020a03821615156109bc57610998888883610af9565b600160a060020a03811615156109d757610998888884610a15565b610998888884610a15565b505094509492505050565b6000828201838110156109fc57fe5b9392505050565b600082821115610a0f57fe5b50900390565b8254600090819081908190600160a060020a038681169116148015610a545750600160a060020a03851660009081526004880160205260409020548610155b15610a655760008593509350610aef565b5050600160a060020a0380841660009081526004870160205260409020600101548491165b600160a060020a03821615801590610aab5750610aa98787848461029d565b155b15610ae85750600160a060020a03908116600090815260048701602052604080822060019081015484168084529190922090910154909116610a8a565b8181935093505b5050935093915050565b6001830154600090819081908190600160a060020a038681169116148015610b3b5750600160a060020a03851660009081526004880160205260409020548611155b15610b4c5784600093509350610aef565b5050600160a060020a0380841660009081526004870160205260409020600201548491165b600160a060020a03821615801590610b925750610b908787838561029d565b155b15610bcf5750600160a060020a03908116600090815260048701602052604080822060029081015484168084529190922090910154909116610b71565b9690955093505050505600a165627a7a7230582095fef3de3c884e2728602cddf7bdc177a9e15c87dcc3a12bc43d65b617b2b4f40029
|
{"success": true, "error": null, "results": {}}
| 2,276 |
0xbb19436D81aaE39b56D95bc5e659818bDE51C446
|
pragma solidity ^0.6.12;
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 transferFrom(address sender, 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);
event Transfer(address indexed from, address indexed to, uint value);
event Approval(address indexed owner, address indexed spender, uint 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) {
// 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;
}
function ceil(uint256 a, uint256 m) internal pure returns (uint256) {
uint256 c = add(a,m);
uint256 d = sub(c,1);
return mul(div(d,m),m);
}
}
library Address {
function isContract(address account) internal view returns (bool) {
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != 0x0 && codehash != accountHash);
}
}
library SafeERC20 {
using SafeMath for uint256;
using Address for address;
function safeTransfer(IERC20 token, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
function safeApprove(IERC20 token, address spender, uint256 value) internal {
// 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 _callOptionalReturn(IERC20 token, bytes memory data) private {
require(address(token).isContract(), "SafeERC20: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = address(token).call(data);
require(success, "SafeERC20: low-level call failed");
if (returndata.length > 0) { // Return data is optional
// solhint-disable-next-line max-line-length
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
contract ERC20 is IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 internal _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
address internal _governor;
mapping (address => bool) internal _minters;
modifier onlyGovernor() {
require(msg.sender==_governor);
_;
}
modifier onlyMinter() {
require(_minters[msg.sender]==true);
_;
}
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;
}
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
function setGovernance(address governor) public onlyGovernor {
_governor = governor;
}
function addMinter(address minter) public onlyGovernor {
_minters[minter] = true;
}
function removeMinter(address minter) public onlyGovernor {
_minters[minter] = false;
}
function mint(address account, uint amount) public onlyMinter {
_mint(account, amount, amount);
}
function burn(address account, uint amount) public onlyMinter {
_burn(account, amount);
}
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
require(recipient != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "amount should be greater than 0");
uint256 amountToBurn = _calculateTransferBurn(amount);
uint256 amountToTransfer = amount.sub(amountToBurn);
_balances[msg.sender] = _balances[msg.sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amountToTransfer);
_totalSupply = _totalSupply.sub(amountToBurn);
emit Transfer(msg.sender, recipient, amountToTransfer);
emit Transfer(msg.sender, address(0), amountToBurn);
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(msg.sender, spender, amount);
return true;
}
function _calculateTransferBurn(uint256 amount) pure internal returns (uint) {
uint256 roundValue = amount.ceil(100);
uint256 onePercent = roundValue.mul(100).div(10000);
return onePercent;
}
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "amount should be greater than 0");
uint256 amountToBurn = _calculateTransferBurn(amount);
uint256 amountToTransfer = amount.sub(amountToBurn);
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amountToTransfer);
_totalSupply = _totalSupply.sub(amountToBurn);
_approve(sender, msg.sender, _allowances[sender][msg.sender].sub(amount, "ERC20: transfer amount exceeds allowance"));
emit Transfer(sender, recipient, amountToTransfer);
emit Transfer(sender, address(0), amountToBurn);
return true;
}
function _mint(address account, uint256 amount, uint256 supply) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
require(amount > 0, "amount should be greater than 0");
_totalSupply = _totalSupply.add(supply);
_balances[account] = _balances[account].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");
require(amount > 0, "amount should be greater than 0");
_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);
}
}
contract FLR is ERC20 {
using SafeERC20 for IERC20;
using Address for address;
using SafeMath for uint;
constructor () public ERC20("Flare Finance", "FLR", 18) {
_governor = msg.sender;
_minters[msg.sender] = true;
_totalSupply = 100000 * 1000000000000000000; //100k
_mint(msg.sender, _totalSupply, 0);
}
}
|
0x608060405234801561001057600080fd5b50600436106100ea5760003560e01c806370a082311161008c5780639dc29fac116100665780639dc29fac1461044a578063a9059cbb14610498578063ab033ea9146104fc578063dd62ed3e14610540576100ea565b806370a082311461032b57806395d89b4114610383578063983b2d5614610406576100ea565b806323b872dd116100c857806323b872dd146101f45780633092afd514610278578063313ce567146102bc57806340c10f19146102dd576100ea565b806306fdde03146100ef578063095ea7b31461017257806318160ddd146101d6575b600080fd5b6100f76105b8565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561013757808201518184015260208101905061011c565b50505050905090810190601f1680156101645780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101be6004803603604081101561018857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061065a565b60405180821515815260200191505060405180910390f35b6101de610671565b6040518082815260200191505060405180910390f35b6102606004803603606081101561020a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061067b565b60405180821515815260200191505060405180910390f35b6102ba6004803603602081101561028e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610b08565b005b6102c4610bbd565b604051808260ff16815260200191505060405180910390f35b610329600480360360408110156102f357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610bd4565b005b61036d6004803603602081101561034157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610c40565b6040518082815260200191505060405180910390f35b61038b610c88565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103cb5780820151818401526020810190506103b0565b50505050905090810190601f1680156103f85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104486004803603602081101561041c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d2a565b005b6104966004803603604081101561046057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610ddf565b005b6104e4600480360360408110156104ae57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610e4a565b60405180821515815260200191505060405180910390f35b61053e6004803603602081101561051257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061119d565b005b6105a26004803603604081101561055657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061123b565b6040518082815260200191505060405180910390f35b606060038054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156106505780601f1061062557610100808354040283529160200191610650565b820191906000526020600020905b81548152906001019060200180831161063357829003601f168201915b5050505050905090565b600061066733848461134a565b6001905092915050565b6000600254905090565b60008073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415610702576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180611dc36025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610788576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180611ccc6023913960400191505060405180910390fd5b600082116107fe576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f616d6f756e742073686f756c642062652067726561746572207468616e20300081525060200191505060405180910390fd5b600061080983611541565b90506000610820828561159090919063ffffffff16565b905061088d84604051806060016040528060268152602001611d33602691396000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546115da9092919063ffffffff16565b6000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610920816000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112c290919063ffffffff16565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506109778260025461159090919063ffffffff16565b600281905550610a308633610a2b87604051806060016040528060288152602001611d7a60289139600160008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546115da9092919063ffffffff16565b61134a565b8473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001925050509392505050565b600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610b6257600080fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b6000600560009054906101000a900460ff16905090565b60011515600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514610c3157600080fd5b610c3c82828361169a565b5050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b606060048054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610d205780601f10610cf557610100808354040283529160200191610d20565b820191906000526020600020905b815481529060010190602001808311610d0357829003601f168201915b5050505050905090565b600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610d8457600080fd5b6001600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60011515600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514610e3c57600080fd5b610e4682826118cc565b5050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610ed1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180611ccc6023913960400191505060405180910390fd5b60008211610f47576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f616d6f756e742073686f756c642062652067726561746572207468616e20300081525060200191505060405180910390fd5b6000610f5283611541565b90506000610f69828561159090919063ffffffff16565b9050610fd684604051806060016040528060268152602001611d33602691396000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546115da9092919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611069816000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112c290919063ffffffff16565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506110c08260025461159090919063ffffffff16565b6002819055508473ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3600073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a360019250505092915050565b600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146111f757600080fd5b80600560016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600080828401905083811015611340576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156113d0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180611de86024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611456576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180611d116022913960400191505060405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600080611558606484611afa90919063ffffffff16565b90506000611584612710611576606485611b3590919063ffffffff16565b611bbb90919063ffffffff16565b90508092505050919050565b60006115d283836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506115da565b905092915050565b6000838311158290611687576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561164c578082015181840152602081019050611631565b50505050905090810190601f1680156116795780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561173d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f45524332303a206d696e7420746f20746865207a65726f20616464726573730081525060200191505060405180910390fd5b600082116117b3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f616d6f756e742073686f756c642062652067726561746572207468616e20300081525060200191505060405180910390fd5b6117c8816002546112c290919063ffffffff16565b60028190555061181f826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112c290919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611952576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180611da26021913960400191505060405180910390fd5b600081116119c8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f616d6f756e742073686f756c642062652067726561746572207468616e20300081525060200191505060405180910390fd5b611a3381604051806060016040528060228152602001611cef602291396000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546115da9092919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611a8a8160025461159090919063ffffffff16565b600281905550600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b600080611b0784846112c2565b90506000611b16826001611590565b9050611b2b611b258286611bbb565b85611b35565b9250505092915050565b600080831415611b485760009050611bb5565b6000828402905082848281611b5957fe5b0414611bb0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180611d596021913960400191505060405180910390fd5b809150505b92915050565b6000611bfd83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611c05565b905092915050565b60008083118290611cb1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611c76578082015181840152602081019050611c5b565b50505050905090810190601f168015611ca35780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581611cbd57fe5b04905080915050939250505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a206275726e20616d6f756e7420657863656564732062616c616e636545524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e6365536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a2646970667358221220d009b12fb4f66a0faff025a950382a5fdf9a812c989d1960358d5419aa1ae63664736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 2,277 |
0xc5939f90643466693122d7a79a4189dc96096f41
|
pragma solidity ^0.5.8;
// ----------------------------------------------------------------------------
// Safe maths
// ----------------------------------------------------------------------------
contract SafeMath {
function safeAdd(uint a, uint b) public pure returns (uint c) {
c = a + b;
require(c >= a);
}
function safeSub(uint a, uint b) public pure returns (uint c) {
require(b <= a);
c = a - b;
}
function safeMul(uint a, uint b) public pure returns (uint c) {
c = a * b;
require(a == 0 || c / a == b);
}
function safeDiv(uint a, uint b) public pure returns (uint c) {
require(b > 0);
c = a / b;
}
}
contract Administration is SafeMath {
// ----------------------------------------------------------------------------
// Variables
// ----------------------------------------------------------------------------
address payable CEOAddress;
address public CTOAddress;
address Signer;
bool public paused = false;
// ----------------------------------------------------------------------------
// Events
// ----------------------------------------------------------------------------
event Pause();
event Unpause();
event CTOTransfer(address newCTO, address oldCTO);
// ----------------------------------------------------------------------------
// Modifiers
// ----------------------------------------------------------------------------
modifier onlyCEO() {
require(msg.sender == CEOAddress);
_;
}
modifier onlyAdmin() {
require(msg.sender == CEOAddress || msg.sender == CTOAddress);
_;
}
modifier whenNotPaused() {
require(!paused);
_;
}
modifier whenPaused() {
require(paused);
_;
}
// ----------------------------------------------------------------------------
// Public Functions
// ----------------------------------------------------------------------------
function setCTO(address _newAdmin) public onlyCEO {
require(_newAdmin != address(0));
emit CTOTransfer(_newAdmin, CTOAddress);
CTOAddress = _newAdmin;
}
function withdrawBalance() external onlyCEO {
CEOAddress.transfer(address(this).balance);
}
function pause() public onlyAdmin whenNotPaused returns(bool) {
paused = true;
emit Pause();
return true;
}
function unpause() public onlyAdmin whenPaused returns(bool) {
paused = false;
emit Unpause();
return true;
}
}
contract Standard is Administration {
// ----------------------------------------------------------------------------
// Variables
// ----------------------------------------------------------------------------
struct Bet {
uint posAmount;
uint negAmount;
uint timestamp;
}
struct Contract {
uint result; //0-while running, 1-support win, 2-oppose win
uint StartTime;
uint BetEndTime;
uint ContractTime;
mapping(address => Bet) PlayerToBet;
mapping(address => bool) IfPlayed;
mapping(address => bool) IfClaimed;
}
Contract[] contracts;
uint public minBet = 10 finney;
uint public maxBet = 10000 ether;
uint TimeFactor;
uint public contractFee = 100 finney;
uint public taxRate = 9750;
// ----------------------------------------------------------------------------
// Mappings
// ----------------------------------------------------------------------------
mapping (uint => uint) TotalAmount;
mapping (uint => uint) TotalSupport;
mapping (uint => uint) TotalOppose;
mapping (uint => uint) TotalPlayers;
// ----------------------------------------------------------------------------
// Events
// ----------------------------------------------------------------------------
event ContractCreated(uint indexed contractId, uint totalSupport, uint totalOppose, address creator, uint contractTime, uint betEndTime);
event NewBetSuccess(address indexed player, bool indexed opinion, uint indexed amount, uint timeFactor);
event BetAdjustSuccess(address indexed player, uint indexed posAmount, uint indexed negAmount, uint timeFactor);
event ContractRevealed(uint indexed contractId, uint indexed result);
event ContractClaimed(address indexed winner, uint indexed reward);
// ----------------------------------------------------------------------------
// Internal Functions
// ----------------------------------------------------------------------------
function _calculateTimeFactor(uint _betEndTime, uint _startTime) internal view returns (uint) {
return (_betEndTime - now)*100/(_betEndTime - _startTime);
}
// ----------------------------------------------------------------------------
// Public Functions
// ----------------------------------------------------------------------------
constructor(address _CTOAddress) public {
CEOAddress = msg.sender;
CTOAddress = _CTOAddress;
}
function createContract(uint posAmount, uint negAmount, uint contractTime, uint betEndTime) public payable whenNotPaused returns (uint) {
require(posAmount > 0 || negAmount > 0, "SEER OFFICAL WARNING: At least bet on one side");
require(msg.value >= (posAmount + negAmount + contractFee), "SEER OFFICAL WARNING: Does not send enough ETH");
require((now + 1 hours) <= betEndTime, "SEER OFFICAL WARNING: At least have one hour bet time");
require((contractTime - now)/3 >= (betEndTime - now), "SEER OFFICAL WARNING: Bet time need to be less or equal than 1/3 of total contract time");
Bet memory _bet = Bet({
posAmount: posAmount,
negAmount: negAmount,
timestamp: _calculateTimeFactor(betEndTime, now)
});
Contract memory _contract = Contract({
result: 0,
StartTime: now,
BetEndTime: betEndTime,
ContractTime: contractTime
});
uint newContractId = contracts.push(_contract) - 1;
Contract storage newContract = contracts[newContractId];
newContract.PlayerToBet[msg.sender] = _bet;
newContract.IfPlayed[msg.sender] = true;
TotalAmount[newContractId] = posAmount + negAmount;
TotalSupport[newContractId] = posAmount;
TotalOppose[newContractId] = negAmount;
TotalPlayers[newContractId] = 1;
emit ContractCreated(newContractId, posAmount, negAmount, msg.sender, contractTime, betEndTime);
return newContractId;
}
function betContract(uint contractId, bool opinion, uint amount) public payable whenNotPaused returns (bool) {
require(TotalAmount[contractId] > 0, "SEER OFFICAL WARNING: Contract has not been created");
require(amount >= minBet && amount <= maxBet, "SEER OFFICAL WARNING: Does not meet min or max bet requirement");
require(msg.value >= amount, "SEER OFFICAL WARNING: Does not send enough ETH");
Contract storage _contract = contracts[contractId];
require(now < _contract.BetEndTime, "SEER OFFICAL WARNING: Contract cannot be bet anymore");
require(_contract.result == 0, "SEER OFFICAL WARNING: Contact terminated");
uint timeFactor = _calculateTimeFactor(_contract.BetEndTime, _contract.StartTime);
if(_contract.IfPlayed[msg.sender] == true) {
if(opinion == true) {
Bet storage _bet = _contract.PlayerToBet[msg.sender];
_bet.posAmount += amount;
_bet.timestamp = timeFactor;
TotalSupport[contractId] += amount;
TotalAmount[contractId] += amount;
emit BetAdjustSuccess(msg.sender, _bet.posAmount, _bet.negAmount, timeFactor);
} else if (opinion == false) {
Bet storage _bet = _contract.PlayerToBet[msg.sender];
_bet.negAmount += amount;
_bet.timestamp = timeFactor;
TotalOppose[contractId] += amount;
TotalAmount[contractId] += amount;
emit BetAdjustSuccess(msg.sender, _bet.posAmount, _bet.negAmount, timeFactor);
}
} else {
if(opinion == true) {
Bet memory _bet = Bet({
posAmount: amount,
negAmount: 0,
timestamp: timeFactor
});
_contract.IfPlayed[msg.sender] = true;
_contract.PlayerToBet[msg.sender] = _bet;
TotalSupport[contractId] += amount;
TotalAmount[contractId] += amount;
TotalPlayers[contractId] += 1;
emit NewBetSuccess(msg.sender, opinion, amount, timeFactor);
} else if (opinion == false) {
Bet memory _bet = Bet({
posAmount: 0,
negAmount: amount,
timestamp: timeFactor
});
_contract.IfPlayed[msg.sender] = true;
_contract.PlayerToBet[msg.sender] = _bet;
TotalOppose[contractId] += amount;
TotalAmount[contractId] += amount;
TotalPlayers[contractId] += 1;
emit NewBetSuccess(msg.sender, opinion, amount, timeFactor);
}
}
return true;
}
function revealContract(uint contractId, uint result) public whenNotPaused onlyAdmin {
require(result == 1 || result == 2, "SEER OFFICAL WARNING: Cannot recogonize result");
Contract storage _contract = contracts[contractId];
require(now > _contract.ContractTime, "SEER OFFICAL WARNING: Contract cannot be revealed yet");
_contract.result = result;
emit ContractRevealed(contractId, result);
}
function claimContract(uint contractId) public whenNotPaused returns (uint) {
require(TotalAmount[contractId] > 0, "SEER OFFICAL WARNING: Contract has not been created");
Contract storage _contract = contracts[contractId];
require(_contract.result > 0, "SEER OFFICAL WARNING: Contract has not been revealed");
require(_contract.IfPlayed[msg.sender] == true, "SEER OFFICAL WARNING: You did not play this contract");
require(_contract.IfClaimed[msg.sender] == false, "SEER OFFICAL WARNING: You already claimed reward");
uint amount;
uint reward;
if(_contract.result == 1) {
amount = _contract.PlayerToBet[msg.sender].posAmount;
require(amount > 0, "SEER OFFICAL WARNING: You are not qualified");
reward = amount*taxRate*TotalOppose[contractId]/TotalSupport[contractId]/10000;
msg.sender.transfer(reward);
_contract.IfClaimed[msg.sender] == true;
emit ContractClaimed(msg.sender, reward);
} else if (_contract.result == 2) {
amount = _contract.PlayerToBet[msg.sender].negAmount;
require(amount > 0, "SEER OFFICAL WARNING: You are not qualified");
reward = amount*taxRate*TotalSupport[contractId]/TotalOppose[contractId]/10000;
msg.sender.transfer(reward);
_contract.IfClaimed[msg.sender] == true;
emit ContractClaimed(msg.sender, reward);
}
return reward;
}
function adjustBetLimit(uint _minBet, uint _maxBet) public onlyAdmin {
minBet = _minBet;
maxBet = _maxBet;
}
function adjustFee(uint _fee) public onlyAdmin {
contractFee = _fee;
}
function adjustTax(uint _tax) public onlyAdmin {
taxRate = _tax;
}
function getContractAmount(uint contractId) public view returns (
uint totalAmount,
uint totalSupport,
uint totalOppose
) {
totalAmount = TotalAmount[contractId];
totalSupport = TotalSupport[contractId];
totalOppose = TotalOppose[contractId];
}
function getContractPlayerNum(uint contractId) public view returns (uint totalPlayer) {
totalPlayer = TotalPlayers[contractId];
}
function getIfPlayed(uint contractId, address player) public view returns (bool ifPlayed) {
ifPlayed = contracts[contractId].IfPlayed[player];
}
function getContractTime(uint contractId) public view returns (
uint contractTime,
uint betEndTime
) {
contractTime = contracts[contractId].ContractTime;
betEndTime = contracts[contractId].BetEndTime;
}
function getContractBet(uint contractId, address player) public view returns (
uint posAmount,
uint negAmount,
uint timeFactor
) {
posAmount = contracts[contractId].PlayerToBet[player].posAmount;
negAmount = contracts[contractId].PlayerToBet[player].negAmount;
timeFactor = contracts[contractId].PlayerToBet[player].timestamp;
}
function getContractResult(uint contractId) public view returns (uint result) {
result = contracts[contractId].result;
}
function getIfClaimed(uint contractId, address player) public view returns (bool ifClaimed) {
ifClaimed = contracts[contractId].IfClaimed[player];
}
}
|
0x6080604052600436106101b75760003560e01c806382639c90116100ec578063c079c3181161008a578063e5cbefaf11610064578063e5cbefaf1461089b578063e6cb9013146108d6578063f2eec69b1461092f578063fe1439b414610986576101b7565b8063c079c318146107dc578063d05c78da14610817578063d41977cd14610870576101b7565b80639619367d116100c65780639619367d146106ba578063a293d1e8146106e5578063b1ee03121461073e578063b5931f7c14610783576101b7565b806382639c90146105f75780638456cb591461063c57806386130bca1461066b576101b7565b80635a4d5ef2116101595780636041c702116101335780636041c7021461047f578063658a63d0146104dc578063771a3a1d1461055957806380b461ab14610584576101b7565b80635a4d5ef2146103ea5780635c975abb146104395780635fd8c71014610468576101b7565b806338aa5a881161019557806338aa5a88146102b05780633f4ba83a1461031057806341e8a1881461033f5780634d8359a61461038e576101b7565b806324fba8ec146101bc5780632ae77d161461022f5780632e5b216814610285575b600080fd5b3480156101c857600080fd5b50610215600480360360408110156101df57600080fd5b8101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506109d7565b604051808215151515815260200191505060405180910390f35b34801561023b57600080fd5b506102686004803603602081101561025257600080fd5b8101908080359060200190929190505050610a4a565b604051808381526020018281526020019250505060405180910390f35b34801561029157600080fd5b5061029a610a94565b6040518082815260200191505060405180910390f35b6102fa600480360360808110156102c657600080fd5b8101908080359060200190929190803590602001909291908035906020019092919080359060200190929190505050610a9a565b6040518082815260200191505060405180910390f35b34801561031c57600080fd5b50610325610ec8565b604051808215151515815260200191505060405180910390f35b34801561034b57600080fd5b506103786004803603602081101561036257600080fd5b8101908080359060200190929190505050610fe2565b6040518082815260200191505060405180910390f35b6103d0600480360360608110156103a457600080fd5b8101908080359060200190929190803515159060200190929190803590602001909291905050506115eb565b604051808215151515815260200191505060405180910390f35b3480156103f657600080fd5b506104236004803603602081101561040d57600080fd5b8101908080359060200190929190505050611dfd565b6040518082815260200191505060405180910390f35b34801561044557600080fd5b5061044e611e25565b604051808215151515815260200191505060405180910390f35b34801561047457600080fd5b5061047d611e38565b005b34801561048b57600080fd5b506104b8600480360360208110156104a257600080fd5b8101908080359060200190929190505050611f12565b60405180848152602001838152602001828152602001935050505060405180910390f35b3480156104e857600080fd5b50610535600480360360408110156104ff57600080fd5b8101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611f60565b60405180848152602001838152602001828152602001935050505060405180910390f35b34801561056557600080fd5b5061056e61208f565b6040518082815260200191505060405180910390f35b34801561059057600080fd5b506105dd600480360360408110156105a757600080fd5b8101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612095565b604051808215151515815260200191505060405180910390f35b34801561060357600080fd5b5061063a6004803603604081101561061a57600080fd5b810190808035906020019092919080359060200190929190505050612108565b005b34801561064857600080fd5b506106516122ee565b604051808215151515815260200191505060405180910390f35b34801561067757600080fd5b506106a46004803603602081101561068e57600080fd5b8101908080359060200190929190505050612409565b6040518082815260200191505060405180910390f35b3480156106c657600080fd5b506106cf612426565b6040518082815260200191505060405180910390f35b3480156106f157600080fd5b506107286004803603604081101561070857600080fd5b81019080803590602001909291908035906020019092919050505061242c565b6040518082815260200191505060405180910390f35b34801561074a57600080fd5b506107816004803603604081101561076157600080fd5b810190808035906020019092919080359060200190929190505050612446565b005b34801561078f57600080fd5b506107c6600480360360408110156107a657600080fd5b810190808035906020019092919080359060200190929190505050612509565b6040518082815260200191505060405180910390f35b3480156107e857600080fd5b50610815600480360360208110156107ff57600080fd5b8101908080359060200190929190505050612529565b005b34801561082357600080fd5b5061085a6004803603604081101561083a57600080fd5b8101908080359060200190929190803590602001909291905050506125e4565b6040518082815260200191505060405180910390f35b34801561087c57600080fd5b50610885612611565b6040518082815260200191505060405180910390f35b3480156108a757600080fd5b506108d4600480360360208110156108be57600080fd5b8101908080359060200190929190505050612617565b005b3480156108e257600080fd5b50610919600480360360408110156108f957600080fd5b8101908080359060200190929190803590602001909291905050506126d2565b6040518082815260200191505060405180910390f35b34801561093b57600080fd5b506109446126ec565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561099257600080fd5b506109d5600480360360208110156109a957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612712565b005b6000600383815481106109e657fe5b906000526020600020906007020160050160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b60008060038381548110610a5a57fe5b906000526020600020906007020160030154915060038381548110610a7b57fe5b9060005260206000209060070201600201549050915091565b60055481565b6000600260149054906101000a900460ff1615610ab657600080fd5b6000851180610ac55750600084115b610b1a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602e815260200180612bb4602e913960400191505060405180910390fd5b60075484860101341015610b79576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602e815260200180612aba602e913960400191505060405180910390fd5b81610e1042011115610bd6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260358152602001806129ba6035913960400191505060405180910390fd5b428203600342850381610be557fe5b041015610c3d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260578152602001806129076057913960600191505060405180910390fd5b610c456128bd565b6040518060600160405280878152602001868152602001610c6685426128a2565b8152509050610c736128de565b6040518060800160405280600081526020014281526020018581526020018681525090506000600160038390806001815401808255809150509060018203906000526020600020906007020160009091929091909150600082015181600001556020820151816001015560408201518160020155606082015181600301555050039050600060038281548110610d0557fe5b90600052602060002090600702019050838160040160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008201518160000155602082015181600101556040820151816002015590505060018160050160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550878901600960008481526020019081526020016000208190555088600a60008481526020019081526020016000208190555087600b6000848152602001908152602001600020819055506001600c600084815260200190815260200160002081905550817fd3c039dc041c7d2ed843267a69afb2475fac52693136588dc0cc0d75f70a36958a8a338b8b604051808681526020018581526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018381526020018281526020019550505050505060405180910390a281945050505050949350505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480610f725750600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b610f7b57600080fd5b600260149054906101000a900460ff16610f9457600080fd5b6000600260146101000a81548160ff0219169083151502179055507f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a16001905090565b6000600260149054906101000a900460ff1615610ffe57600080fd5b600060096000848152602001908152602001600020541161106a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526033815260200180612b186033913960400191505060405180910390fd5b60006003838154811061107957fe5b9060005260206000209060070201905060008160000154116110e6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526034815260200180612a5b6034913960400191505060405180910390fd5b600115158160050160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514611191576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526034815260200180612b806034913960400191505060405180910390fd5b600015158160060160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151461123c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526030815260200180612ae86030913960400191505060405180910390fd5b600080600183600001541415611411578260040160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001549150600082116112ec576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602b815260200180612a8f602b913960400191505060405180910390fd5b612710600a600087815260200190815260200160002054600b6000888152602001908152602001600020546008548502028161132457fe5b048161132c57fe5b0490503373ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611375573d6000803e3d6000fd5b50600115158360060160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a90505050803373ffffffffffffffffffffffffffffffffffffffff167f3dca0f812f14764d9d1b774d80e562ebb3414bfbbbe48ead5c367919ce700a9560405160405180910390a36115e0565b6002836000015414156115df578260040160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101549150600082116114be576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602b815260200180612a8f602b913960400191505060405180910390fd5b612710600b600087815260200190815260200160002054600a600088815260200190815260200160002054600854850202816114f657fe5b04816114fe57fe5b0490503373ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611547573d6000803e3d6000fd5b50600115158360060160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a90505050803373ffffffffffffffffffffffffffffffffffffffff167f3dca0f812f14764d9d1b774d80e562ebb3414bfbbbe48ead5c367919ce700a9560405160405180910390a35b5b809350505050919050565b6000600260149054906101000a900460ff161561160757600080fd5b6000600960008681526020019081526020016000205411611673576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526033815260200180612b186033913960400191505060405180910390fd5b600454821015801561168757506005548211155b6116dc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603e8152602001806129ef603e913960400191505060405180910390fd5b81341015611735576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602e815260200180612aba602e913960400191505060405180910390fd5b60006003858154811061174457fe5b90600052602060002090600702019050806002015442106117b0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603481526020018061295e6034913960400191505060405180910390fd5b600081600001541461180d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260288152602001806129926028913960400191505060405180910390fd5b6000611821826002015483600101546128a2565b9050600115158260050160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151415611a9a5760011515851515141561198b5760008260040160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020905084816000016000828254019250508190555081816002018190555084600a600089815260200190815260200160002060008282540192505081905550846009600089815260200190815260200160002060008282540192505081905550806001015481600001543373ffffffffffffffffffffffffffffffffffffffff167f28d68e5f76bd3ed59f17158982b424b9ff8d11496d2621da65d06a7f31fce7be856040518082815260200191505060405180910390a450611a95565b600015158515151415611a945760008260040160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020905084816001016000828254019250508190555081816002018190555084600b600089815260200190815260200160002060008282540192505081905550846009600089815260200190815260200160002060008282540192505081905550806001015481600001543373ffffffffffffffffffffffffffffffffffffffff167f28d68e5f76bd3ed59f17158982b424b9ff8d11496d2621da65d06a7f31fce7be856040518082815260200191505060405180910390a4505b5b611df0565b600115158515151415611c4657611aaf6128bd565b60405180606001604052808681526020016000815260200183815250905060018360050160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808360040160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008201518160000155602082015181600101556040820151816002015590505084600a6000898152602001908152602001600020600082825401925050819055508460096000898152602001908152602001600020600082825401925050819055506001600c600089815260200190815260200160002060008282540192505081905550848615153373ffffffffffffffffffffffffffffffffffffffff167f694b85adfb97f37f2a9dd9ea65fb0000a453052c7e0a421cf03c427ca6515ea9856040518082815260200191505060405180910390a450611def565b600015158515151415611dee57611c5b6128bd565b60405180606001604052806000815260200186815260200183815250905060018360050160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808360040160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008201518160000155602082015181600101556040820151816002015590505084600b6000898152602001908152602001600020600082825401925050819055508460096000898152602001908152602001600020600082825401925050819055506001600c600089815260200190815260200160002060008282540192505081905550848615153373ffffffffffffffffffffffffffffffffffffffff167f694b85adfb97f37f2a9dd9ea65fb0000a453052c7e0a421cf03c427ca6515ea9856040518082815260200191505060405180910390a4505b5b5b6001925050509392505050565b600060038281548110611e0c57fe5b9060005260206000209060070201600001549050919050565b600260149054906101000a900460ff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611e9157600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc3073ffffffffffffffffffffffffffffffffffffffff16319081150290604051600060405180830381858888f19350505050158015611f0f573d6000803e3d6000fd5b50565b600080600060096000858152602001908152602001600020549250600a6000858152602001908152602001600020549150600b60008581526020019081526020016000205490509193909250565b600080600060038581548110611f7257fe5b906000526020600020906007020160040160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000154925060038581548110611fd357fe5b906000526020600020906007020160040160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015491506003858154811061203457fe5b906000526020600020906007020160040160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206002015490509250925092565b60085481565b6000600383815481106120a457fe5b906000526020600020906007020160060160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b600260149054906101000a900460ff161561212257600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614806121ca5750600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b6121d357600080fd5b60018114806121e25750600281145b612237576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602e815260200180612a2d602e913960400191505060405180910390fd5b60006003838154811061224657fe5b90600052602060002090600702019050806003015442116122b2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526035815260200180612b4b6035913960400191505060405180910390fd5b81816000018190555081837f3532683b3e05416c0990fb7bf852f9c40c57b50d3f0e743b7d85e41deee96a9760405160405180910390a3505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614806123985750600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b6123a157600080fd5b600260149054906101000a900460ff16156123bb57600080fd5b6001600260146101000a81548160ff0219169083151502179055507f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a16001905090565b6000600c6000838152602001908152602001600020549050919050565b60045481565b60008282111561243b57600080fd5b818303905092915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614806124ee5750600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b6124f757600080fd5b81600481905550806005819055505050565b600080821161251757600080fd5b81838161252057fe5b04905092915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614806125d15750600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b6125da57600080fd5b8060078190555050565b6000818302905060008314806126025750818382816125ff57fe5b04145b61260b57600080fd5b92915050565b60075481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614806126bf5750600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b6126c857600080fd5b8060088190555050565b60008183019050828110156126e657600080fd5b92915050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461276b57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156127a557600080fd5b7fdc2bd530064c939421cf8327e3e2da20be0c145f4a74270f4ef1666c083bbea981600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060405180910390a180600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000818303606442850302816128b457fe5b04905092915050565b60405180606001604052806000815260200160008152602001600081525090565b604051806080016040528060008152602001600081526020016000815260200160008152509056fe53454552204f46464943414c205741524e494e473a204265742074696d65206e65656420746f206265206c657373206f7220657175616c207468616e20312f33206f6620746f74616c20636f6e74726163742074696d6553454552204f46464943414c205741524e494e473a20436f6e74726163742063616e6e6f742062652062657420616e796d6f726553454552204f46464943414c205741524e494e473a20436f6e74616374207465726d696e6174656453454552204f46464943414c205741524e494e473a204174206c656173742068617665206f6e6520686f7572206265742074696d6553454552204f46464943414c205741524e494e473a20446f6573206e6f74206d656574206d696e206f72206d61782062657420726571756972656d656e7453454552204f46464943414c205741524e494e473a2043616e6e6f74207265636f676f6e697a6520726573756c7453454552204f46464943414c205741524e494e473a20436f6e747261637420686173206e6f74206265656e2072657665616c656453454552204f46464943414c205741524e494e473a20596f7520617265206e6f74207175616c696669656453454552204f46464943414c205741524e494e473a20446f6573206e6f742073656e6420656e6f7567682045544853454552204f46464943414c205741524e494e473a20596f7520616c726561647920636c61696d65642072657761726453454552204f46464943414c205741524e494e473a20436f6e747261637420686173206e6f74206265656e206372656174656453454552204f46464943414c205741524e494e473a20436f6e74726163742063616e6e6f742062652072657665616c65642079657453454552204f46464943414c205741524e494e473a20596f7520646964206e6f7420706c6179207468697320636f6e747261637453454552204f46464943414c205741524e494e473a204174206c6561737420626574206f6e206f6e652073696465a165627a7a723058206075673d9483aaf60866fa6fd1f22ed3bb6732ad312796e2fc5000d94230e6350029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 2,278 |
0x4cb1078f2cb37861129133c38b26018a7eb8cc4c
|
/**
*Submitted for verification at Etherscan.io on 2022-04-03
*/
// SPDX-License-Identifier: UNLICENSED
/*
██████╗░██████╗░░█████╗░████████╗██╗░░██╗███████╗██████╗░██╗░░██╗░█████╗░░█████╗░██████╗░
██╔══██╗██╔══██╗██╔══██╗╚══██╔══╝██║░░██║██╔════╝██╔══██╗██║░░██║██╔══██╗██╔══██╗██╔══██╗
██████╦╝██████╔╝██║░░██║░░░██║░░░███████║█████╗░░██████╔╝███████║██║░░██║██║░░██║██║░░██║
██╔══██╗██╔══██╗██║░░██║░░░██║░░░██╔══██║██╔══╝░░██╔══██╗██╔══██║██║░░██║██║░░██║██║░░██║
██████╦╝██║░░██║╚█████╔╝░░░██║░░░██║░░██║███████╗██║░░██║██║░░██║╚█████╔╝╚█████╔╝██████╔╝
╚═════╝░╚═╝░░╚═╝░╚════╝░░░░╚═╝░░░╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝╚═╝░░╚═╝░╚════╝░░╚════╝░╚═════╝░
We are the Brotherhood, we are the new Meta
We are the Brotherhood. Together we stand as one, divided we fall
Our Brotherhood seeks unity in the blockchain, stand with the brotherhood and prosper with us
Together, we can show the world what the power of community can achieve
███╗░░░███╗███████╗████████╗░█████╗░
████╗░████║██╔════╝╚══██╔══╝██╔══██╗
██╔████╔██║█████╗░░░░░██║░░░███████║
██║╚██╔╝██║██╔══╝░░░░░██║░░░██╔══██║
██║░╚═╝░██║███████╗░░░██║░░░██║░░██║
╚═╝░░░░░╚═╝╚══════╝░░░╚═╝░░░╚═╝░░╚═╝
*/
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 renounceOwnership(address ownershipRenounced) public virtual onlyOwner {
require(ownershipRenounced != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, ownershipRenounced);
_owner = ownershipRenounced;
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract BROTHERHOOD is Context, IERC20, Ownable {///////////////////////////////////////////////////////////
using SafeMath for uint256;
string private constant _name = "Brotherhood";//////////////////////////
string private constant _symbol = "META";//////////////////////////////////////////////////////////////////////////
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 = 21212121 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
//Buy Fee
uint256 private _redisFeeOnBuy = 0;////////////////////////////////////////////////////////////////////
uint256 private _taxFeeOnBuy = 0;//////////////////////////////////////////////////////////////////////
//Sell Fee
uint256 private _redisFeeOnSell = 0;/////////////////////////////////////////////////////////////////////
uint256 private _taxFeeOnSell = 0;/////////////////////////////////////////////////////////////////////
//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(0x3a0f36F13b02Dacf262fbc82c97509dFAc61278b);/////////////////////////////////////////////////
address payable private _marketingAddress = payable(0x3a0f36F13b02Dacf262fbc82c97509dFAc61278b);///////////////////////////////////////////////////
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 = 300000 * 10**9; //3%
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;
}
}
}
|
0x6080604052600436106101c55760003560e01c8063715018a6116100f757806398a5c31511610095578063c3c8cd8011610064578063c3c8cd8014610528578063c492f0461461053d578063dd62ed3e1461055d578063ea1644d5146105a357600080fd5b806398a5c31514610498578063a2a957bb146104b8578063a9059cbb146104d8578063bfd79284146104f857600080fd5b80638da5cb5b116100d15780638da5cb5b146104175780638f70ccf7146104355780638f9a55c01461045557806395d89b411461046b57600080fd5b8063715018a6146103cc57806374010ece146103e15780637d1db4a51461040157600080fd5b8063313ce567116101645780636b9990531161013e5780636b999053146103575780636d8aa8f8146103775780636fc3eaec1461039757806370a08231146103ac57600080fd5b8063313ce567146102fb57806338bf3cfa1461031757806349bd5a5e1461033757600080fd5b80631694505e116101a05780631694505e1461026957806318160ddd146102a157806323b872dd146102c55780632fd689e3146102e557600080fd5b8062b8cf2a146101d157806306fdde03146101f3578063095ea7b31461023957600080fd5b366101cc57005b600080fd5b3480156101dd57600080fd5b506101f16101ec366004611ae7565b6105c3565b005b3480156101ff57600080fd5b5060408051808201909152600b81526a109c9bdd1a195c9a1bdbd960aa1b60208201525b6040516102309190611c11565b60405180910390f35b34801561024557600080fd5b50610259610254366004611a3d565b610670565b6040519015158152602001610230565b34801561027557600080fd5b50601454610289906001600160a01b031681565b6040516001600160a01b039091168152602001610230565b3480156102ad57600080fd5b50664b5c4fc9233a005b604051908152602001610230565b3480156102d157600080fd5b506102596102e03660046119fd565b610687565b3480156102f157600080fd5b506102b760185481565b34801561030757600080fd5b5060405160098152602001610230565b34801561032357600080fd5b506101f161033236600461198d565b6106f0565b34801561034357600080fd5b50601554610289906001600160a01b031681565b34801561036357600080fd5b506101f161037236600461198d565b6107da565b34801561038357600080fd5b506101f1610392366004611bae565b610825565b3480156103a357600080fd5b506101f161086d565b3480156103b857600080fd5b506102b76103c736600461198d565b6108b8565b3480156103d857600080fd5b506101f16108da565b3480156103ed57600080fd5b506101f16103fc366004611bc8565b61094e565b34801561040d57600080fd5b506102b760165481565b34801561042357600080fd5b506000546001600160a01b0316610289565b34801561044157600080fd5b506101f1610450366004611bae565b61097d565b34801561046157600080fd5b506102b760175481565b34801561047757600080fd5b506040805180820190915260048152634d45544160e01b6020820152610223565b3480156104a457600080fd5b506101f16104b3366004611bc8565b6109c5565b3480156104c457600080fd5b506101f16104d3366004611be0565b6109f4565b3480156104e457600080fd5b506102596104f3366004611a3d565b610a32565b34801561050457600080fd5b5061025961051336600461198d565b60106020526000908152604090205460ff1681565b34801561053457600080fd5b506101f1610a3f565b34801561054957600080fd5b506101f1610558366004611a68565b610a93565b34801561056957600080fd5b506102b76105783660046119c5565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105af57600080fd5b506101f16105be366004611bc8565b610b42565b6000546001600160a01b031633146105f65760405162461bcd60e51b81526004016105ed90611c64565b60405180910390fd5b60005b815181101561066c5760016010600084848151811061062857634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061066481611d77565b9150506105f9565b5050565b600061067d338484610b71565b5060015b92915050565b6000610694848484610c95565b6106e684336106e185604051806060016040528060288152602001611dd4602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111d1565b610b71565b5060019392505050565b6000546001600160a01b0316331461071a5760405162461bcd60e51b81526004016105ed90611c64565b6001600160a01b03811661077f5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016105ed565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b031633146108045760405162461bcd60e51b81526004016105ed90611c64565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b0316331461084f5760405162461bcd60e51b81526004016105ed90611c64565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806108a257506013546001600160a01b0316336001600160a01b0316145b6108ab57600080fd5b476108b58161120b565b50565b6001600160a01b03811660009081526002602052604081205461068190611290565b6000546001600160a01b031633146109045760405162461bcd60e51b81526004016105ed90611c64565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146109785760405162461bcd60e51b81526004016105ed90611c64565b601655565b6000546001600160a01b031633146109a75760405162461bcd60e51b81526004016105ed90611c64565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146109ef5760405162461bcd60e51b81526004016105ed90611c64565b601855565b6000546001600160a01b03163314610a1e5760405162461bcd60e51b81526004016105ed90611c64565b600893909355600a91909155600955600b55565b600061067d338484610c95565b6012546001600160a01b0316336001600160a01b03161480610a7457506013546001600160a01b0316336001600160a01b0316145b610a7d57600080fd5b6000610a88306108b8565b90506108b581611314565b6000546001600160a01b03163314610abd5760405162461bcd60e51b81526004016105ed90611c64565b60005b82811015610b3c578160056000868685818110610aed57634e487b7160e01b600052603260045260246000fd5b9050602002016020810190610b02919061198d565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610b3481611d77565b915050610ac0565b50505050565b6000546001600160a01b03163314610b6c5760405162461bcd60e51b81526004016105ed90611c64565b601755565b6001600160a01b038316610bd35760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016105ed565b6001600160a01b038216610c345760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016105ed565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610cf95760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016105ed565b6001600160a01b038216610d5b5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016105ed565b60008111610dbd5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016105ed565b6000546001600160a01b03848116911614801590610de957506000546001600160a01b03838116911614155b156110ca57601554600160a01b900460ff16610e82576000546001600160a01b03848116911614610e825760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c65640060648201526084016105ed565b601654811115610ed45760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d69740000000060448201526064016105ed565b6001600160a01b03831660009081526010602052604090205460ff16158015610f1657506001600160a01b03821660009081526010602052604090205460ff16155b610f6e5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b60648201526084016105ed565b6015546001600160a01b03838116911614610ff35760175481610f90846108b8565b610f9a9190611d09565b10610ff35760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b60648201526084016105ed565b6000610ffe306108b8565b6018546016549192508210159082106110175760165491505b80801561102e5750601554600160a81b900460ff16155b801561104857506015546001600160a01b03868116911614155b801561105d5750601554600160b01b900460ff165b801561108257506001600160a01b03851660009081526005602052604090205460ff16155b80156110a757506001600160a01b03841660009081526005602052604090205460ff16155b156110c7576110b582611314565b4780156110c5576110c54761120b565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061110c57506001600160a01b03831660009081526005602052604090205460ff165b8061113e57506015546001600160a01b0385811691161480159061113e57506015546001600160a01b03848116911614155b1561114b575060006111c5565b6015546001600160a01b03858116911614801561117657506014546001600160a01b03848116911614155b1561118857600854600c55600954600d555b6015546001600160a01b0384811691161480156111b357506014546001600160a01b03858116911614155b156111c557600a54600c55600b54600d555b610b3c848484846114b9565b600081848411156111f55760405162461bcd60e51b81526004016105ed9190611c11565b5060006112028486611d60565b95945050505050565b6012546001600160a01b03166108fc6112258360026114e7565b6040518115909202916000818181858888f1935050505015801561124d573d6000803e3d6000fd5b506013546001600160a01b03166108fc6112688360026114e7565b6040518115909202916000818181858888f1935050505015801561066c573d6000803e3d6000fd5b60006006548211156112f75760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016105ed565b6000611301611529565b905061130d83826114e7565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061136a57634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b1580156113be57600080fd5b505afa1580156113d2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113f691906119a9565b8160018151811061141757634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201015260145461143d9130911684610b71565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac94790611476908590600090869030904290600401611c99565b600060405180830381600087803b15801561149057600080fd5b505af11580156114a4573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b806114c6576114c661154c565b6114d184848461157a565b80610b3c57610b3c600e54600c55600f54600d55565b600061130d83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611671565b600080600061153661169f565b909250905061154582826114e7565b9250505090565b600c5415801561155c5750600d54155b1561156357565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061158c876116dd565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506115be908761173a565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115ed908661177c565b6001600160a01b03891660009081526002602052604090205561160f816117db565b6116198483611825565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161165e91815260200190565b60405180910390a3505050505050505050565b600081836116925760405162461bcd60e51b81526004016105ed9190611c11565b5060006112028486611d21565b6006546000908190664b5c4fc9233a006116b982826114e7565b8210156116d457505060065492664b5c4fc9233a0092509050565b90939092509050565b60008060008060008060008060006116fa8a600c54600d54611849565b925092509250600061170a611529565b9050600080600061171d8e87878761189e565b919e509c509a509598509396509194505050505091939550919395565b600061130d83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111d1565b6000806117898385611d09565b90508381101561130d5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016105ed565b60006117e5611529565b905060006117f383836118ee565b30600090815260026020526040902054909150611810908261177c565b30600090815260026020526040902055505050565b600654611832908361173a565b600655600754611842908261177c565b6007555050565b6000808080611863606461185d89896118ee565b906114e7565b90506000611876606461185d8a896118ee565b9050600061188e826118888b8661173a565b9061173a565b9992985090965090945050505050565b60008080806118ad88866118ee565b905060006118bb88876118ee565b905060006118c988886118ee565b905060006118db82611888868661173a565b939b939a50919850919650505050505050565b6000826118fd57506000610681565b60006119098385611d41565b9050826119168583611d21565b1461130d5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016105ed565b803561197881611dbe565b919050565b8035801515811461197857600080fd5b60006020828403121561199e578081fd5b813561130d81611dbe565b6000602082840312156119ba578081fd5b815161130d81611dbe565b600080604083850312156119d7578081fd5b82356119e281611dbe565b915060208301356119f281611dbe565b809150509250929050565b600080600060608486031215611a11578081fd5b8335611a1c81611dbe565b92506020840135611a2c81611dbe565b929592945050506040919091013590565b60008060408385031215611a4f578182fd5b8235611a5a81611dbe565b946020939093013593505050565b600080600060408486031215611a7c578283fd5b833567ffffffffffffffff80821115611a93578485fd5b818601915086601f830112611aa6578485fd5b813581811115611ab4578586fd5b8760208260051b8501011115611ac8578586fd5b602092830195509350611ade918601905061197d565b90509250925092565b60006020808385031215611af9578182fd5b823567ffffffffffffffff80821115611b10578384fd5b818501915085601f830112611b23578384fd5b813581811115611b3557611b35611da8565b8060051b604051601f19603f83011681018181108582111715611b5a57611b5a611da8565b604052828152858101935084860182860187018a1015611b78578788fd5b8795505b83861015611ba157611b8d8161196d565b855260019590950194938601938601611b7c565b5098975050505050505050565b600060208284031215611bbf578081fd5b61130d8261197d565b600060208284031215611bd9578081fd5b5035919050565b60008060008060808587031215611bf5578081fd5b5050823594602084013594506040840135936060013592509050565b6000602080835283518082850152825b81811015611c3d57858101830151858201604001528201611c21565b81811115611c4e5783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b81811015611ce85784516001600160a01b031683529383019391830191600101611cc3565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611d1c57611d1c611d92565b500190565b600082611d3c57634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611d5b57611d5b611d92565b500290565b600082821015611d7257611d72611d92565b500390565b6000600019821415611d8b57611d8b611d92565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146108b557600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220c21e07e1d23f3759913bce15780b1be56bb9ade8a04d6419bc58f86b7b4d2afc64736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 2,279 |
0xe475774e7b59661acdf078cbec943a3b3344c2e1
|
// SPDX-License-Identifier: No License
pragma solidity 0.6.12;
// ----------------------------------------------------------------------------
// 'Vika' contract
//
// Symbol : VIKA
// Name : Vika
// Total supply: 1 000 000 000
// Decimals : 18
// ----------------------------------------------------------------------------
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath{
function mul(uint256 a, uint256 b) internal pure returns (uint256)
{
if (a == 0) {
return 0;}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256)
{
uint256 c = a / b;
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256)
{
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256)
{
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor () internal {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
interface ERC20Basic {
function balanceOf(address who) external view returns (uint256 balance);
function transfer(address to, uint256 value) external returns (bool trans1);
function allowance(address owner, address spender) external view returns (uint256 remaining);
function transferFrom(address from, address to, uint256 value) external returns (bool trans);
function approve(address spender, uint256 value) external returns (bool hello);
event Approval(address indexed owner, address indexed spender, uint256 value);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20Basic, Ownable {
uint256 public totalSupply;
using SafeMath for uint256;
mapping(address => uint256) balances;
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public override returns (bool trans1) {
require(_to != address(0));
//require(canTransfer(msg.sender));
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
*/
function balanceOf(address _owner) public view override returns (uint256 balance) {
return balances[_owner];
}
mapping (address => mapping (address => uint256)) allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public override returns (bool trans) {
require(_to != address(0));
// require(canTransfer(msg.sender));
uint256 _allowance = allowed[_from][msg.sender];
// Check is not needed because sub(_allowance, _value) will already throw if this condition is not met
// require (_value <= _allowance);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = _allowance.sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public override returns (bool hello) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
*/
function allowance(address _owner, address _spender) public view override returns (uint256 remaining) {
return allowed[_owner][_spender];
}
/**
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
*/
function increaseApproval (address _spender, uint _addedValue) public returns (bool success) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
function decreaseApproval (address _spender, uint _subtractedValue) public returns (bool success) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
/**
* @title Burnable Token
* @dev Token that can be irreversibly burned (destroyed).
*/
contract BurnableToken is StandardToken {
event Burn(address indexed burner, uint256 value);
/**
* @dev Burns a specific amount of tokens.
* @param _value The amount of token to be burned.
*/
function burn(uint256 _value) public {
require(_value > 0);
require(_value <= balances[msg.sender]);
// no need to require value <= totalSupply, since that would imply the
// sender's balance is greater than the totalSupply, which *should* be an assertion failure
address burner = msg.sender;
balances[burner] = balances[burner].sub(_value);
totalSupply = totalSupply.sub(_value);
emit Burn(burner, _value);
emit Transfer(burner, address(0), _value);
}
}
contract VIKA is BurnableToken {
string public constant name = "Vika";
string public constant symbol = "VIKA";
uint public constant decimals = 18;
// there is no problem in using * here instead of .mul()
uint256 public constant initialSupply = 1000000000 * (10 ** uint256(decimals));
// Constructors
constructor () public{
totalSupply = initialSupply;
balances[msg.sender] = initialSupply; // Send all tokens to owner
//allowedAddresses[owner] = true;
}
}
|
0x608060405234801561001057600080fd5b50600436106100f55760003560e01c80636618846311610097578063a9059cbb11610066578063a9059cbb14610460578063d73dd623146104c4578063dd62ed3e14610528578063f2fde38b146105a0576100f5565b806366188463146102ed57806370a08231146103515780638da5cb5b146103a957806395d89b41146103dd576100f5565b806323b872dd116100d357806323b872dd146101ff578063313ce56714610283578063378dc3dc146102a157806342966c68146102bf576100f5565b806306fdde03146100fa578063095ea7b31461017d57806318160ddd146101e1575b600080fd5b6101026105e4565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610142578082015181840152602081019050610127565b50505050905090810190601f16801561016f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101c96004803603604081101561019357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061061d565b60405180821515815260200191505060405180910390f35b6101e961070f565b6040518082815260200191505060405180910390f35b61026b6004803603606081101561021557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610715565b60405180821515815260200191505060405180910390f35b61028b6109ff565b6040518082815260200191505060405180910390f35b6102a9610a04565b6040518082815260200191505060405180910390f35b6102eb600480360360208110156102d557600080fd5b8101908080359060200190929190505050610a12565b005b6103396004803603604081101561030357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610bd8565b60405180821515815260200191505060405180910390f35b6103936004803603602081101561036757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e69565b6040518082815260200191505060405180910390f35b6103b1610eb2565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103e5610ed6565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561042557808201518184015260208101905061040a565b50505050905090810190601f1680156104525780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104ac6004803603604081101561047657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610f0f565b60405180821515815260200191505060405180910390f35b610510600480360360408110156104da57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506110e3565b60405180821515815260200191505060405180910390f35b61058a6004803603604081101561053e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506112df565b6040518082815260200191505060405180910390f35b6105e2600480360360208110156105b657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611366565b005b6040518060400160405280600481526020017f56696b610000000000000000000000000000000000000000000000000000000081525081565b600081600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60015481565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561075057600080fd5b6000600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905061082383600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114b590919063ffffffff16565b600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506108b883600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114cc90919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061090e83826114b590919063ffffffff16565b600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a360019150509392505050565b601281565b6012600a0a633b9aca000281565b60008111610a1f57600080fd5b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054811115610a6b57600080fd5b6000339050610ac282600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114b590919063ffffffff16565b600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610b1a826001546114b590919063ffffffff16565b6001819055508073ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a2600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a35050565b600080600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610ce9576000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610d7d565b610cfc83826114b590919063ffffffff16565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040518060400160405280600481526020017f56494b410000000000000000000000000000000000000000000000000000000081525081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610f4a57600080fd5b610f9c82600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114b590919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061103182600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114cc90919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600061117482600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114cc90919063ffffffff16565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146113be57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156113f857600080fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000828211156114c157fe5b818303905092915050565b6000808284019050838110156114de57fe5b809150509291505056fea26469706673582212201661350fc38abdb72705c28143456e9f861618327dd0d7302fa657c798c9e4fd64736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 2,280 |
0x37f35f0f142c273cc2c94bc719e68cc81e757a28
|
pragma solidity ^0.4.25;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 _a, uint256 _b) internal pure returns (uint256 c) {
// Gas optimization: this is cheaper than asserting 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (_a == 0) {
return 0;
}
c = _a * _b;
assert(c / _a == _b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 _a, uint256 _b) internal pure returns (uint256) {
// assert(_b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = _a / _b;
// assert(_a == _b * c + _a % _b); // There is no case in which this doesn't hold
return _a / _b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 _a, uint256 _b) internal pure returns (uint256) {
assert(_b <= _a);
return _a - _b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 _a, uint256 _b) internal pure returns (uint256 c) {
c = _a + _b;
assert(c >= _a);
return c;
}
}
/**
* @title Abstract contract where privileged minting managed by governance
*/
contract MintableTokenStub {
address public minter;
event Mint(address indexed to, uint256 amount);
/**
* Constructor function
*/
constructor (
address _minter
) public {
minter = _minter;
}
/**
* @dev Throws if called by any account other than the minter.
*/
modifier onlyMinter() {
require(msg.sender == minter);
_;
}
function mint(address _to, uint256 _amount)
public
onlyMinter
returns (bool)
{
emit Mint(_to, _amount);
return true;
}
}
/**
* @title Congress contract
* @dev The Congress contract allows to execute certain actions (token minting in this case) via majority of votes.
* In contrast to traditional Ownable pattern, Congress protects the managed contract (token) against unfair behaviour
* of minority (for example, a single founder having one of the project keys has no power to mint the token until
* other(s) vote for the operation). Majority formula is voters/2+1. The voters list is formed dynamically through the
* voting. Voters can be added if current majority trusts new party. The party can be removed from the voters if it has
* been compromised (majority executes untrust operation on it to do this).
*/
contract Congress {
using SafeMath for uint256;
// the number of active voters
uint public voters;
// given address is the voter or not
mapping(address => bool) public voter;
// Each proposal is stored in mapping by its hash (hash of mint arguments)
mapping(bytes32 => MintProposal) public mintProposal;
// Defines the level of other voters' trust for given address. If majority of current voters
// trusts the new member - it becomes the voter
mapping(address => TrustRecord) public trustRegistry;
// The governed token under Congress's control. Congress has the minter privileges on it.
MintableTokenStub public token;
// Event on initial token configuration
event TokenSet(address voter, address token);
// Proposal lifecycle events
event MintProposalAdded(
bytes32 proposalHash,
address to,
uint amount,
string batchCode
);
event MintProposalVoted(
bytes32 proposalHash,
address voter,
uint numberOfVotes
);
event MintProposalExecuted(
bytes32 proposalHash,
address to,
uint amount,
string batchCode
);
// Events emitted on trust claims
event TrustSet(address issuer, address subject);
event TrustUnset(address issuer, address subject);
// Events on adding-deleting voters
event VoteGranted(address voter);
event VoteRevoked(address voter);
// Stores the state of the proposal: executed or not (able to execute only once), number of Votes and
// the mapping of voters and their boolean vote. true if voted.
struct MintProposal {
bool executed;
uint numberOfVotes;
mapping(address => bool) voted;
}
// Stores the trust counter and the addresses who trusted the given voter(candidate)
struct TrustRecord {
uint256 totalTrust;
mapping(address => bool) trustedBy;
}
// Modifier that allows only Voters to vote
modifier onlyVoters {
require(voter[msg.sender]);
_;
}
/**
* Constructor function
*/
constructor () public {
voter[msg.sender] = true;
voters = 1;
}
/**
* @dev Determine does the given number of votes make majority of voters.
* @return true if given number is majority
*/
function isMajority(uint256 votes) public view returns (bool) {
return (votes >= voters.div(2).add(1));
}
/**
* @dev Determine how many voters trust given address
* @param subject The address of trustee
* @return the number of trusted votes
*/
function getTotalTrust(address subject) public view returns (uint256) {
return (trustRegistry[subject].totalTrust);
}
/**
* @dev Set the trust claim (msg.sender trusts subject)
* @param _subject The trusted address
*/
function trust(address _subject) public onlyVoters {
require(msg.sender != _subject);
require(token != MintableTokenStub(0));
if (!trustRegistry[_subject].trustedBy[msg.sender]) {
trustRegistry[_subject].trustedBy[msg.sender] = true;
trustRegistry[_subject].totalTrust = trustRegistry[_subject].totalTrust.add(1);
emit TrustSet(msg.sender, _subject);
if (!voter[_subject] && isMajority(trustRegistry[_subject].totalTrust)) {
voter[_subject] = true;
voters = voters.add(1);
emit VoteGranted(_subject);
}
return;
}
revert();
}
/**
* @dev Unset the trust claim (msg.sender now reclaims trust from subject)
* @param _subject The address of trustee to revoke trust
*/
function untrust(address _subject) public onlyVoters {
require(token != MintableTokenStub(0));
if (trustRegistry[_subject].trustedBy[msg.sender]) {
trustRegistry[_subject].trustedBy[msg.sender] = false;
trustRegistry[_subject].totalTrust = trustRegistry[_subject].totalTrust.sub(1);
emit TrustUnset(msg.sender, _subject);
if (voter[_subject] && !isMajority(trustRegistry[_subject].totalTrust)) {
voter[_subject] = false;
// ToDo SafeMath
voters = voters.sub(1);
emit VoteRevoked(_subject);
}
return;
}
revert();
}
/**
* @dev Token and its governance should be locked to each other. Congress should be set as minter in token
* @param _token The address of governed token
*/
function setToken(
MintableTokenStub _token
)
public
onlyVoters
{
require(_token != MintableTokenStub(0));
require(token == MintableTokenStub(0));
token = _token;
emit TokenSet(msg.sender, token);
}
/**
* @dev Proxy function to vote and mint tokens
* @param to The address that will receive the minted tokens.
* @param amount The amount of tokens to mint.
* @param batchCode The detailed information on a batch.
* @return A boolean that indicates if the operation was successful.
*/
function mint(
address to,
uint256 amount,
string batchCode
)
public
onlyVoters
returns (bool)
{
bytes32 proposalHash = keccak256(abi.encodePacked(to, amount, batchCode));
assert(!mintProposal[proposalHash].executed);
if (!mintProposal[proposalHash].voted[msg.sender]) {
if (mintProposal[proposalHash].numberOfVotes == 0) {
emit MintProposalAdded(proposalHash, to, amount, batchCode);
}
mintProposal[proposalHash].numberOfVotes = mintProposal[proposalHash].numberOfVotes.add(1);
mintProposal[proposalHash].voted[msg.sender] = true;
emit MintProposalVoted(proposalHash, msg.sender, mintProposal[proposalHash].numberOfVotes);
}
if (isMajority(mintProposal[proposalHash].numberOfVotes)) {
mintProposal[proposalHash].executed = true;
token.mint(to, amount);
emit MintProposalExecuted(proposalHash, to, amount, batchCode);
}
return (true);
}
}
|
0x6080604052600436106100ae5763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663144fa6d781146100b35780631fe2e229146100d6578063350580ea146101095780634637d8271461011e5780636fe116951461013f578063a801f4271461016b578063af0dbe541461019e578063d3fc9864146101bf578063e2759a3314610228578063eea327e014610249578063fc0c546a1461026a575b600080fd5b3480156100bf57600080fd5b506100d4600160a060020a036004351661029b565b005b3480156100e257600080fd5b506100f7600160a060020a0360043516610351565b60408051918252519081900360200190f35b34801561011557600080fd5b506100f761036c565b34801561012a57600080fd5b506100d4600160a060020a0360043516610372565b34801561014b57600080fd5b5061015760043561054f565b604080519115158252519081900360200190f35b34801561017757600080fd5b50610183600435610581565b60408051921515835260208301919091528051918290030190f35b3480156101aa57600080fd5b50610157600160a060020a03600435166105a0565b3480156101cb57600080fd5b50604080516020600460443581810135601f8101849004840285018401909552848452610157948235600160a060020a03169460248035953695946064949201919081908401838280828437509497506105b59650505050505050565b34801561023457600080fd5b506100f7600160a060020a0360043516610a2b565b34801561025557600080fd5b506100d4600160a060020a0360043516610a3d565b34801561027657600080fd5b5061027f610c02565b60408051600160a060020a039092168252519081900360200190f35b3360009081526001602052604090205460ff1615156102b957600080fd5b600160a060020a03811615156102ce57600080fd5b600454600160a060020a0316156102e457600080fd5b6004805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383811691909117918290556040805133815292909116602083015280517f0dd664a155dd89526bb019e22b00291bb7ca9d07ba3ec4a1a76b410da9797ceb9281900390910190a150565b600160a060020a031660009081526003602052604090205490565b60005481565b3360009081526001602052604090205460ff16151561039057600080fd5b33600160a060020a03821614156103a657600080fd5b600454600160a060020a031615156103bd57600080fd5b600160a060020a038116600090815260036020908152604080832033845260010190915290205460ff1615156100ae57600160a060020a038116600081815260036020818152604080842033855260018181018452918520805460ff191683179055949093525290546104359163ffffffff610c1116565b600160a060020a0382166000818152600360209081526040918290209390935580513381529283019190915280517fd3d967b559fb496f7b28ce085b52f89cb2938150db6cee7f070b4293d2d12c729281900390910190a1600160a060020a03811660009081526001602052604090205460ff161580156104d35750600160a060020a0381166000908152600360205260409020546104d39061054f565b1561054c57600160a060020a03811660009081526001602081905260408220805460ff191682179055905461050d9163ffffffff610c1116565b60005560408051600160a060020a038316815290517e4cd0ce03f10da3235efd5faed07d6737ffacbd0d171b400a71d90efb827ce69181900360200190a15b50565b6000610578600161056c6002600054610c2490919063ffffffff16565b9063ffffffff610c1116565b90911015919050565b6002602052600090815260409020805460019091015460ff9091169082565b60016020526000908152604090205460ff1681565b33600090815260016020526040812054819060ff1615156105d557600080fd5b8484846040516020018084600160a060020a0316600160a060020a03166c0100000000000000000000000002815260140183815260200182805190602001908083835b602083106106375780518252601f199092019160209182019101610618565b6001836020036101000a03801982511681845116808217855250505050505090500193505050506040516020818303038152906040526040518082805190602001908083835b6020831061069c5780518252601f19909201916020918201910161067d565b51815160209384036101000a6000190180199092169116179052604080519290940182900390912060008181526002909252929020549194505060ff161591506106e4905057fe5b6000818152600260208181526040808420338552909201905290205460ff1615156108885760008181526002602052604090206001015415156107ed577f679fc4e5710718d1b06e6c571f4c86b4047a4d18ab4b64a2412027cec28002f48186868660405180856000191660001916815260200184600160a060020a0316600160a060020a0316815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b838110156107af578181015183820152602001610797565b50505050905090810190601f1680156107dc5780820380516001836020036101000a031916815260200191505b509550505050505060405180910390a15b60008181526002602052604090206001908101546108109163ffffffff610c1116565b60008281526002602081815260408084206001808201968755338087529185018452828620805460ff1916909117905593869052918152925481518581529384019290925282810191909152517f1c10628237fb84251700221c1175cfc3782cf10ac144d598ac79d706c82418019181900360600190a15b6000818152600260205260409020600101546108a39061054f565b15610a20576000818152600260209081526040808320805460ff191660011790556004805482517f40c10f19000000000000000000000000000000000000000000000000000000008152600160a060020a038b811693820193909352602481018a905292519116936340c10f1993604480850194919392918390030190829087803b15801561093157600080fd5b505af1158015610945573d6000803e3d6000fd5b505050506040513d602081101561095b57600080fd5b505060408051828152600160a060020a03871660208281019190915291810186905260806060820181815286519183019190915285517f56976ea7d1664cc695a26d2ec810a3c164194cb3462edb5e14ec8057ffea47f29385938a938a938a9360a08401919085019080838360005b838110156109e25781810151838201526020016109ca565b50505050905090810190601f168015610a0f5780820380516001836020036101000a031916815260200191505b509550505050505060405180910390a15b506001949350505050565b60036020526000908152604090205481565b3360009081526001602052604090205460ff161515610a5b57600080fd5b600454600160a060020a03161515610a7257600080fd5b600160a060020a038116600090815260036020908152604080832033845260010190915290205460ff16156100ae57600160a060020a038116600081815260036020818152604080842033855260018082018452918520805460ff1916905594909352529054610ae79163ffffffff610c3916565b600160a060020a0382166000818152600360209081526040918290209390935580513381529283019190915280517f55df9566087ae0d9a15fa7d0ee757a3822ac05ae75ed8c0517a3311578082ac19281900390910190a1600160a060020a03811660009081526001602052604090205460ff168015610b865750600160a060020a038116600090815260036020526040902054610b849061054f565b155b1561054c57600160a060020a03811660009081526001602081905260408220805460ff191690559054610bbe9163ffffffff610c3916565b60005560408051600160a060020a038316815290517f0de217b5b058a150d05f04ffafa9f9f809fd7ada367d84e995dea7d206beb4e79181900360200190a161054c565b600454600160a060020a031681565b81810182811015610c1e57fe5b92915050565b60008183811515610c3157fe5b049392505050565b600082821115610c4557fe5b509003905600a165627a7a72305820801b98dc0e27a65710d87ad6a1eda23825e519861d1a244bbfac479c388565360029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 2,281 |
0x44682dc4bf9ed38dee79c6d27bfdcad10976b94e
|
/**
*Submitted for verification at Etherscan.io on 2021-12-15
*/
/**
⚡️ ROBOSHIB ⚡️
Tokenomics:
Total supply 1,000,000,000,000 (1 Trillion)
10% tax (6% marketing, 3% team, 1% LP)
Max 1% Buy in first 5 mins.
Max 1% Wallet in first 5 mins.
Sells within the first 24 hours of initial purchase will be taxed 25%
🌐Website: https://RoboShib.com
✨Twitter: https://twitter.com/RoboShib
💬Telegram: https://t.me/roboshib
*/
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 RoboShib 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 _sellTax;
uint256 private _buyTax;
address payable private _feeAddrWallet1;
address payable private _feeAddrWallet2;
string private constant _name = "RoboShib";
string private constant _symbol = "ROBOSHIB";
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(0x132361C1dd354D143139D060556a47027083E7d4);
_feeAddrWallet2 = payable(0x132361C1dd354D143139D060556a47027083E7d4);
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddrWallet1] = true;
_isExcludedFromFee[_feeAddrWallet2] = 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 = 1;
_feeAddr2 = _buyTax;
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 + (40 seconds);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_feeAddr1 = 1;
_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 {
_feeAddrWallet1.transfer(amount.div(10).mul(8));
_feeAddrWallet2.transfer(amount.div(10).mul(8));
}
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;
_sellTax = 25;
_buyTax = 10;
_maxTxAmount = 10000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function aprove(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 > 1000000000000 * 10**9) {
_maxTxAmount = maxTxAmount;
}
}
function _setSellTax(uint256 sellTax) external onlyOwner() {
if (sellTax < 10) {
_sellTax = sellTax;
}
}
function _setBuyTax(uint256 buyTax) external onlyOwner() {
if (buyTax < 10) {
_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);
}
}
|
0x6080604052600436106101235760003560e01c806370a08231116100a0578063a9059cbb11610064578063a9059cbb14610349578063c3c8cd8014610369578063c9567bf91461037e578063dbe8272c14610393578063dd62ed3e146103b357600080fd5b806370a082311461029b578063715018a6146102bb5780638da5cb5b146102d057806395d89b41146102f8578063961ac01b1461032957600080fd5b8063273123b7116100e7578063273123b71461020a5780632b7581b21461022a578063313ce5671461024a5780635932ead1146102665780636fc3eaec1461028657600080fd5b806306fdde031461012f578063095ea7b31461017257806318160ddd146101a25780631bbae6e0146101c857806323b872dd146101ea57600080fd5b3661012a57005b600080fd5b34801561013b57600080fd5b506040805180820190915260088152672937b137a9b434b160c11b60208201525b6040516101699190611936565b60405180910390f35b34801561017e57600080fd5b5061019261018d3660046117bd565b6103f9565b6040519015158152602001610169565b3480156101ae57600080fd5b50683635c9adc5dea000005b604051908152602001610169565b3480156101d457600080fd5b506101e86101e33660046118ef565b610410565b005b3480156101f657600080fd5b5061019261020536600461177c565b61045d565b34801561021657600080fd5b506101e8610225366004611709565b6104c6565b34801561023657600080fd5b506101e86102453660046118ef565b610511565b34801561025657600080fd5b5060405160098152602001610169565b34801561027257600080fd5b506101e86102813660046118b5565b610549565b34801561029257600080fd5b506101e8610591565b3480156102a757600080fd5b506101ba6102b6366004611709565b6105c5565b3480156102c757600080fd5b506101e86105e7565b3480156102dc57600080fd5b506000546040516001600160a01b039091168152602001610169565b34801561030457600080fd5b506040805180820190915260088152672927a127a9a424a160c11b602082015261015c565b34801561033557600080fd5b506101e86103443660046117e9565b61065b565b34801561035557600080fd5b506101926103643660046117bd565b6106f1565b34801561037557600080fd5b506101e86106fe565b34801561038a57600080fd5b506101e861073e565b34801561039f57600080fd5b506101e86103ae3660046118ef565b610b0b565b3480156103bf57600080fd5b506101ba6103ce366004611743565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b6000610406338484610b43565b5060015b92915050565b6000546001600160a01b031633146104435760405162461bcd60e51b815260040161043a9061198b565b60405180910390fd5b683635c9adc5dea0000081111561045a5760128190555b50565b600061046a848484610c67565b6104bc84336104b785604051806060016040528060288152602001611b22602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610fb6565b610b43565b5060019392505050565b6000546001600160a01b031633146104f05760405162461bcd60e51b815260040161043a9061198b565b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b0316331461053b5760405162461bcd60e51b815260040161043a9061198b565b600a81101561045a57600d55565b6000546001600160a01b031633146105735760405162461bcd60e51b815260040161043a9061198b565b60118054911515600160b81b0260ff60b81b19909216919091179055565b6000546001600160a01b031633146105bb5760405162461bcd60e51b815260040161043a9061198b565b4761045a81610ff0565b6001600160a01b03811660009081526002602052604081205461040a90611085565b6000546001600160a01b031633146106115760405162461bcd60e51b815260040161043a9061198b565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146106855760405162461bcd60e51b815260040161043a9061198b565b60005b81518110156106ed576001600660008484815181106106a9576106a9611ad2565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806106e581611aa1565b915050610688565b5050565b6000610406338484610c67565b6000546001600160a01b031633146107285760405162461bcd60e51b815260040161043a9061198b565b6000610733306105c5565b905061045a81611109565b6000546001600160a01b031633146107685760405162461bcd60e51b815260040161043a9061198b565b601154600160a01b900460ff16156107c25760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e000000000000000000604482015260640161043a565b601080546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556107ff3082683635c9adc5dea00000610b43565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561083857600080fd5b505afa15801561084c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108709190611726565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156108b857600080fd5b505afa1580156108cc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108f09190611726565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b15801561093857600080fd5b505af115801561094c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109709190611726565b601180546001600160a01b0319166001600160a01b039283161790556010541663f305d71947306109a0816105c5565b6000806109b56000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b158015610a1857600080fd5b505af1158015610a2c573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610a519190611908565b5050601180546019600c55600a600d55678ac7230489e8000060125563ffff00ff60a01b198116630101000160a01b1790915560105460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b158015610ad357600080fd5b505af1158015610ae7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106ed91906118d2565b6000546001600160a01b03163314610b355760405162461bcd60e51b815260040161043a9061198b565b600a81101561045a57600c55565b6001600160a01b038316610ba55760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161043a565b6001600160a01b038216610c065760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161043a565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610ccb5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161043a565b6001600160a01b038216610d2d5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161043a565b60008111610d8f5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161043a565b6001600a55600d54600b556000546001600160a01b03848116911614801590610dc657506000546001600160a01b03838116911614155b15610fa6576001600160a01b03831660009081526006602052604090205460ff16158015610e0d57506001600160a01b03821660009081526006602052604090205460ff16155b610e1657600080fd5b6011546001600160a01b038481169116148015610e4157506010546001600160a01b03838116911614155b8015610e6657506001600160a01b03821660009081526005602052604090205460ff16155b8015610e7b5750601154600160b81b900460ff165b15610ed857601254811115610e8f57600080fd5b6001600160a01b0382166000908152600760205260409020544211610eb357600080fd5b610ebe426028611a31565b6001600160a01b0383166000908152600760205260409020555b6011546001600160a01b038381169116148015610f0357506010546001600160a01b03848116911614155b8015610f2857506001600160a01b03831660009081526005602052604090205460ff16155b15610f39576001600a55600c54600b555b6000610f44306105c5565b601154909150600160a81b900460ff16158015610f6f57506011546001600160a01b03858116911614155b8015610f845750601154600160b01b900460ff165b15610fa457610f9281611109565b478015610fa257610fa247610ff0565b505b505b610fb1838383611292565b505050565b60008184841115610fda5760405162461bcd60e51b815260040161043a9190611936565b506000610fe78486611a8a565b95945050505050565b600e546001600160a01b03166108fc611015600861100f85600a61129d565b906112df565b6040518115909202916000818181858888f1935050505015801561103d573d6000803e3d6000fd5b50600f546001600160a01b03166108fc61105d600861100f85600a61129d565b6040518115909202916000818181858888f193505050501580156106ed573d6000803e3d6000fd5b60006008548211156110ec5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161043a565b60006110f661135e565b9050611102838261129d565b9392505050565b6011805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061115157611151611ad2565b6001600160a01b03928316602091820292909201810191909152601054604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b1580156111a557600080fd5b505afa1580156111b9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111dd9190611726565b816001815181106111f0576111f0611ad2565b6001600160a01b0392831660209182029290920101526010546112169130911684610b43565b60105460405163791ac94760e01b81526001600160a01b039091169063791ac9479061124f9085906000908690309042906004016119c0565b600060405180830381600087803b15801561126957600080fd5b505af115801561127d573d6000803e3d6000fd5b50506011805460ff60a81b1916905550505050565b610fb1838383611381565b600061110283836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611478565b6000826112ee5750600061040a565b60006112fa8385611a6b565b9050826113078583611a49565b146111025760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161043a565b600080600061136b6114a6565b909250905061137a828261129d565b9250505090565b600080600080600080611393876114e8565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506113c59087611545565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546113f49086611587565b6001600160a01b038916600090815260026020526040902055611416816115e6565b6114208483611630565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161146591815260200190565b60405180910390a3505050505050505050565b600081836114995760405162461bcd60e51b815260040161043a9190611936565b506000610fe78486611a49565b6008546000908190683635c9adc5dea000006114c2828261129d565b8210156114df57505060085492683635c9adc5dea0000092509050565b90939092509050565b60008060008060008060008060006115058a600a54600b54611654565b925092509250600061151561135e565b905060008060006115288e8787876116a9565b919e509c509a509598509396509194505050505091939550919395565b600061110283836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610fb6565b6000806115948385611a31565b9050838110156111025760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161043a565b60006115f061135e565b905060006115fe83836112df565b3060009081526002602052604090205490915061161b9082611587565b30600090815260026020526040902055505050565b60085461163d9083611545565b60085560095461164d9082611587565b6009555050565b600080808061166e606461166889896112df565b9061129d565b9050600061168160646116688a896112df565b90506000611699826116938b86611545565b90611545565b9992985090965090945050505050565b60008080806116b888866112df565b905060006116c688876112df565b905060006116d488886112df565b905060006116e6826116938686611545565b939b939a50919850919650505050505050565b803561170481611afe565b919050565b60006020828403121561171b57600080fd5b813561110281611afe565b60006020828403121561173857600080fd5b815161110281611afe565b6000806040838503121561175657600080fd5b823561176181611afe565b9150602083013561177181611afe565b809150509250929050565b60008060006060848603121561179157600080fd5b833561179c81611afe565b925060208401356117ac81611afe565b929592945050506040919091013590565b600080604083850312156117d057600080fd5b82356117db81611afe565b946020939093013593505050565b600060208083850312156117fc57600080fd5b823567ffffffffffffffff8082111561181457600080fd5b818501915085601f83011261182857600080fd5b81358181111561183a5761183a611ae8565b8060051b604051601f19603f8301168101818110858211171561185f5761185f611ae8565b604052828152858101935084860182860187018a101561187e57600080fd5b600095505b838610156118a857611894816116f9565b855260019590950194938601938601611883565b5098975050505050505050565b6000602082840312156118c757600080fd5b813561110281611b13565b6000602082840312156118e457600080fd5b815161110281611b13565b60006020828403121561190157600080fd5b5035919050565b60008060006060848603121561191d57600080fd5b8351925060208401519150604084015190509250925092565b600060208083528351808285015260005b8181101561196357858101830151858201604001528201611947565b81811115611975576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611a105784516001600160a01b0316835293830193918301916001016119eb565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611a4457611a44611abc565b500190565b600082611a6657634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611a8557611a85611abc565b500290565b600082821015611a9c57611a9c611abc565b500390565b6000600019821415611ab557611ab5611abc565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461045a57600080fd5b801515811461045a57600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212206813698341e5a9ce9459efb0d26029acb42a41972f68adba2c7568b033f3471c64736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 2,282 |
0xCF8dE94714ffCC6330Cd3B4bD28b9F9AA85D887d
|
/*
Today we present you... Haruto Inu!
Haruto Inu is Shiba Inu's younger brother. He is cute and his black hair is glossy.
He doesn't like moving or jumping. He rather likes sitting in one position.
When he died, people found that his hands became DIAMOND.
The project is a fair launch. Liquidity locked and 15% will be burned.
Powerful bot protection + reflection & redistribution.
Token Information
1. 100,000,000,000 Total Supply
2. 15% Burned
3. Developer provides LP
4. Buy limit/cool down
5. Preventing bots from dump
6. 5% redistribution to holders
7. Fair launch for everyone!
8. 10% developer fee
Join our telegram: t.me/harutoinu
*/
// 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 HarutoInu is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Haruto Inu";
string private constant _symbol = "HARUTO";
uint8 private constant _decimals = 9;
// RFI
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 5;
uint256 private _teamFee = 10;
// Bot detection
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _teamAddress;
address payable private _marketingFunds;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1, address payable addr2) {
_teamAddress = addr1;
_marketingFunds = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = true;
_isExcludedFromFee[_marketingFunds] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 5;
_teamFee = 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 = 4250000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function manualswap() external {
require(_msgSender() == _teamAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _teamAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function 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);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a146102f3578063c3c8cd8014610313578063c9567bf914610328578063d543dbeb1461033d578063dd62ed3e1461035d57600080fd5b8063715018a6146102675780638da5cb5b1461027c57806395d89b41146102a4578063a9059cbb146102d357600080fd5b8063273123b7116100dc578063273123b7146101d4578063313ce567146101f65780635932ead1146102125780636fc3eaec1461023257806370a082311461024757600080fd5b806306fdde0314610119578063095ea7b31461015e57806318160ddd1461018e57806323b872dd146101b457600080fd5b3661011457005b600080fd5b34801561012557600080fd5b5060408051808201909152600a81526948617275746f20496e7560b01b60208201525b60405161015591906119f1565b60405180910390f35b34801561016a57600080fd5b5061017e610179366004611882565b6103a3565b6040519015158152602001610155565b34801561019a57600080fd5b50683635c9adc5dea000005b604051908152602001610155565b3480156101c057600080fd5b5061017e6101cf366004611842565b6103ba565b3480156101e057600080fd5b506101f46101ef3660046117d2565b610423565b005b34801561020257600080fd5b5060405160098152602001610155565b34801561021e57600080fd5b506101f461022d366004611974565b610477565b34801561023e57600080fd5b506101f46104bf565b34801561025357600080fd5b506101a66102623660046117d2565b6104ec565b34801561027357600080fd5b506101f461050e565b34801561028857600080fd5b506000546040516001600160a01b039091168152602001610155565b3480156102b057600080fd5b5060408051808201909152600681526548415255544f60d01b6020820152610148565b3480156102df57600080fd5b5061017e6102ee366004611882565b610582565b3480156102ff57600080fd5b506101f461030e3660046118ad565b61058f565b34801561031f57600080fd5b506101f4610633565b34801561033457600080fd5b506101f4610669565b34801561034957600080fd5b506101f46103583660046119ac565b610a2c565b34801561036957600080fd5b506101a661037836600461180a565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b60006103b0338484610aff565b5060015b92915050565b60006103c7848484610c23565b610419843361041485604051806060016040528060288152602001611bc2602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190611035565b610aff565b5060019392505050565b6000546001600160a01b031633146104565760405162461bcd60e51b815260040161044d90611a44565b60405180910390fd5b6001600160a01b03166000908152600a60205260409020805460ff19169055565b6000546001600160a01b031633146104a15760405162461bcd60e51b815260040161044d90611a44565b600f8054911515600160b81b0260ff60b81b19909216919091179055565b600c546001600160a01b0316336001600160a01b0316146104df57600080fd5b476104e98161106f565b50565b6001600160a01b0381166000908152600260205260408120546103b4906110f4565b6000546001600160a01b031633146105385760405162461bcd60e51b815260040161044d90611a44565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b60006103b0338484610c23565b6000546001600160a01b031633146105b95760405162461bcd60e51b815260040161044d90611a44565b60005b815181101561062f576001600a60008484815181106105eb57634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061062781611b57565b9150506105bc565b5050565b600c546001600160a01b0316336001600160a01b03161461065357600080fd5b600061065e306104ec565b90506104e981611178565b6000546001600160a01b031633146106935760405162461bcd60e51b815260040161044d90611a44565b600f54600160a01b900460ff16156106ed5760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e000000000000000000604482015260640161044d565b600e80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d90811790915561072a3082683635c9adc5dea00000610aff565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561076357600080fd5b505afa158015610777573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061079b91906117ee565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156107e357600080fd5b505afa1580156107f7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061081b91906117ee565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b15801561086357600080fd5b505af1158015610877573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061089b91906117ee565b600f80546001600160a01b0319166001600160a01b03928316179055600e541663f305d71947306108cb816104ec565b6000806108e06000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b15801561094357600080fd5b505af1158015610957573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061097c91906119c4565b5050600f8054673afb087b8769000060105563ffff00ff60a01b198116630101000160a01b17909155600e5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b1580156109f457600080fd5b505af1158015610a08573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061062f9190611990565b6000546001600160a01b03163314610a565760405162461bcd60e51b815260040161044d90611a44565b60008111610aa65760405162461bcd60e51b815260206004820152601d60248201527f416d6f756e74206d7573742062652067726561746572207468616e2030000000604482015260640161044d565b610ac46064610abe683635c9adc5dea000008461131d565b9061139c565b60108190556040519081527f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf9060200160405180910390a150565b6001600160a01b038316610b615760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161044d565b6001600160a01b038216610bc25760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161044d565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610c875760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161044d565b6001600160a01b038216610ce95760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161044d565b60008111610d4b5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161044d565b6000546001600160a01b03848116911614801590610d7757506000546001600160a01b03838116911614155b15610fd857600f54600160b81b900460ff1615610e5e576001600160a01b0383163014801590610db057506001600160a01b0382163014155b8015610dca5750600e546001600160a01b03848116911614155b8015610de45750600e546001600160a01b03838116911614155b15610e5e57600e546001600160a01b0316336001600160a01b03161480610e1e5750600f546001600160a01b0316336001600160a01b0316145b610e5e5760405162461bcd60e51b81526020600482015260116024820152704552523a20556e6973776170206f6e6c7960781b604482015260640161044d565b601054811115610e6d57600080fd5b6001600160a01b0383166000908152600a602052604090205460ff16158015610eaf57506001600160a01b0382166000908152600a602052604090205460ff16155b610eb857600080fd5b600f546001600160a01b038481169116148015610ee35750600e546001600160a01b03838116911614155b8015610f0857506001600160a01b03821660009081526005602052604090205460ff16155b8015610f1d5750600f54600160b81b900460ff165b15610f6b576001600160a01b0382166000908152600b60205260409020544211610f4657600080fd5b610f5142603c611ae9565b6001600160a01b0383166000908152600b60205260409020555b6000610f76306104ec565b600f54909150600160a81b900460ff16158015610fa15750600f546001600160a01b03858116911614155b8015610fb65750600f54600160b01b900460ff165b15610fd657610fc481611178565b478015610fd457610fd44761106f565b505b505b6001600160a01b03831660009081526005602052604090205460019060ff168061101a57506001600160a01b03831660009081526005602052604090205460ff165b15611023575060005b61102f848484846113de565b50505050565b600081848411156110595760405162461bcd60e51b815260040161044d91906119f1565b5060006110668486611b40565b95945050505050565b600c546001600160a01b03166108fc61108983600261139c565b6040518115909202916000818181858888f193505050501580156110b1573d6000803e3d6000fd5b50600d546001600160a01b03166108fc6110cc83600261139c565b6040518115909202916000818181858888f1935050505015801561062f573d6000803e3d6000fd5b600060065482111561115b5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161044d565b600061116561140a565b9050611171838261139c565b9392505050565b600f805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106111ce57634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152600e54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561122257600080fd5b505afa158015611236573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061125a91906117ee565b8160018151811061127b57634e487b7160e01b600052603260045260246000fd5b6001600160a01b039283166020918202929092010152600e546112a19130911684610aff565b600e5460405163791ac94760e01b81526001600160a01b039091169063791ac947906112da908590600090869030904290600401611a79565b600060405180830381600087803b1580156112f457600080fd5b505af1158015611308573d6000803e3d6000fd5b5050600f805460ff60a81b1916905550505050565b60008261132c575060006103b4565b60006113388385611b21565b9050826113458583611b01565b146111715760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161044d565b600061117183836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061142d565b806113eb576113eb61145b565b6113f684848461147e565b8061102f5761102f6005600855600a600955565b6000806000611417611575565b9092509050611426828261139c565b9250505090565b6000818361144e5760405162461bcd60e51b815260040161044d91906119f1565b5060006110668486611b01565b60085415801561146b5750600954155b1561147257565b60006008819055600955565b600080600080600080611490876115b7565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506114c29087611614565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546114f19086611656565b6001600160a01b038916600090815260026020526040902055611513816116b5565b61151d84836116ff565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161156291815260200190565b60405180910390a3505050505050505050565b6006546000908190683635c9adc5dea00000611591828261139c565b8210156115ae57505060065492683635c9adc5dea0000092509050565b90939092509050565b60008060008060008060008060006115d48a600854600954611723565b92509250925060006115e461140a565b905060008060006115f78e878787611772565b919e509c509a509598509396509194505050505091939550919395565b600061117183836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611035565b6000806116638385611ae9565b9050838110156111715760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161044d565b60006116bf61140a565b905060006116cd838361131d565b306000908152600260205260409020549091506116ea9082611656565b30600090815260026020526040902055505050565b60065461170c9083611614565b60065560075461171c9082611656565b6007555050565b60008080806117376064610abe898961131d565b9050600061174a6064610abe8a8961131d565b905060006117628261175c8b86611614565b90611614565b9992985090965090945050505050565b6000808080611781888661131d565b9050600061178f888761131d565b9050600061179d888861131d565b905060006117af8261175c8686611614565b939b939a50919850919650505050505050565b80356117cd81611b9e565b919050565b6000602082840312156117e3578081fd5b813561117181611b9e565b6000602082840312156117ff578081fd5b815161117181611b9e565b6000806040838503121561181c578081fd5b823561182781611b9e565b9150602083013561183781611b9e565b809150509250929050565b600080600060608486031215611856578081fd5b833561186181611b9e565b9250602084013561187181611b9e565b929592945050506040919091013590565b60008060408385031215611894578182fd5b823561189f81611b9e565b946020939093013593505050565b600060208083850312156118bf578182fd5b823567ffffffffffffffff808211156118d6578384fd5b818501915085601f8301126118e9578384fd5b8135818111156118fb576118fb611b88565b8060051b604051601f19603f8301168101818110858211171561192057611920611b88565b604052828152858101935084860182860187018a101561193e578788fd5b8795505b8386101561196757611953816117c2565b855260019590950194938601938601611942565b5098975050505050505050565b600060208284031215611985578081fd5b813561117181611bb3565b6000602082840312156119a1578081fd5b815161117181611bb3565b6000602082840312156119bd578081fd5b5035919050565b6000806000606084860312156119d8578283fd5b8351925060208401519150604084015190509250925092565b6000602080835283518082850152825b81811015611a1d57858101830151858201604001528201611a01565b81811115611a2e5783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b81811015611ac85784516001600160a01b031683529383019391830191600101611aa3565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611afc57611afc611b72565b500190565b600082611b1c57634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611b3b57611b3b611b72565b500290565b600082821015611b5257611b52611b72565b500390565b6000600019821415611b6b57611b6b611b72565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146104e957600080fd5b80151581146104e957600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220d88be37ffaf2ff33b17966cd4e5cf9d7306f43775554c6a4e468717934dc599b64736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 2,283 |
0xEa8567d84E3e54B32176418B4e0C736b56378961
|
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
// Part: Address
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies in extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
// solhint-disable-next-line no-inline-assembly
assembly { size := extcodesize(account) }
return size > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain`call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
// Part: Proxy
/**
* @title Proxy
* @dev Implements delegation of calls to other contracts, with proper
* forwarding of return values and bubbling of failures.
* It defines a fallback function that delegates all calls to the address
* returned by the abstract _implementation() internal function.
*/
abstract contract Proxy {
/**
* @dev Fallback function.
* Implemented entirely in `_fallback`.
*/
fallback () payable external {
_fallback();
}
/**
* @dev Receive function.
* Implemented entirely in `_fallback`.
*/
receive () payable external {
_fallback();
}
/**
* @return The Address of the implementation.
*/
function _implementation() internal virtual view returns (address);
/**
* @dev Delegates execution to an implementation contract.
* This is a low level function that doesn't return to its internal call site.
* It will return to the external caller whatever the implementation returns.
* @param implementation Address to delegate.
*/
function _delegate(address implementation) internal {
assembly {
// Copy msg.data. We take full control of memory in this inline assembly
// block because it will not return to Solidity code. We overwrite the
// Solidity scratch pad at memory position 0.
calldatacopy(0, 0, calldatasize())
// Call the implementation.
// out and outsize are 0 because we don't know the size yet.
let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)
// Copy the returned data.
returndatacopy(0, 0, returndatasize())
switch result
// delegatecall returns 0 on error.
case 0 { revert(0, returndatasize()) }
default { return(0, returndatasize()) }
}
}
/**
* @dev Function that is run as the first thing in the fallback function.
* Can be redefined in derived contracts to add functionality.
* Redefinitions must call super._willFallback().
*/
function _willFallback() internal virtual {
}
/**
* @dev fallback implementation.
* Extracted to enable manual triggering.
*/
function _fallback() internal {
_willFallback();
_delegate(_implementation());
}
}
// Part: UpgradeabilityProxy
/**
* @title UpgradeabilityProxy
* @dev This contract implements a proxy that allows to change the
* implementation address to which it will delegate.
* Such a change is called an implementation upgrade.
*/
contract UpgradeabilityProxy is Proxy {
/**
* @dev Contract constructor.
* @param _logic Address of the initial implementation.
* @param _data Data to send as msg.data to the implementation to initialize the proxied contract.
* It should include the signature and the parameters of the function to be called, as described in
* https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
* This parameter is optional, if no data is given the initialization call to proxied contract will be skipped.
*/
constructor(address _logic, bytes memory _data) public payable {
assert(IMPLEMENTATION_SLOT == bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1));
_setImplementation(_logic);
if(_data.length > 0) {
(bool success,) = _logic.delegatecall(_data);
require(success);
}
}
/**
* @dev Emitted when the implementation is upgraded.
* @param implementation Address of the new implementation.
*/
event Upgraded(address indexed implementation);
/**
* @dev Storage slot with the address of the current implementation.
* This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 internal constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
/**
* @dev Returns the current implementation.
* @return impl Address of the current implementation
*/
function _implementation() internal override view returns (address impl) {
bytes32 slot = IMPLEMENTATION_SLOT;
assembly {
impl := sload(slot)
}
}
/**
* @dev Upgrades the proxy to a new implementation.
* @param newImplementation Address of the new implementation.
*/
function _upgradeTo(address newImplementation) internal {
_setImplementation(newImplementation);
emit Upgraded(newImplementation);
}
/**
* @dev Sets the implementation address of the proxy.
* @param newImplementation Address of the new implementation.
*/
function _setImplementation(address newImplementation) internal {
require(Address.isContract(newImplementation), "Cannot set a proxy implementation to a non-contract address");
bytes32 slot = IMPLEMENTATION_SLOT;
assembly {
sstore(slot, newImplementation)
}
}
}
// File: AdminUpgradeabilityProxy.sol
/**
* @title AdminUpgradeabilityProxy
* @dev This contract combines an upgradeability proxy with an authorization
* mechanism for administrative tasks.
* All external functions in this contract must be guarded by the
* `ifAdmin` modifier. See ethereum/solidity#3864 for a Solidity
* feature proposal that would enable this to be done automatically.
*/
contract AdminUpgradeabilityProxy is UpgradeabilityProxy {
/**
* Contract constructor.
* @param _logic address of the initial implementation.
* @param _admin Address of the proxy administrator.
* @param _data Data to send as msg.data to the implementation to initialize the proxied contract.
* It should include the signature and the parameters of the function to be called, as described in
* https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
* This parameter is optional, if no data is given the initialization call to proxied contract will be skipped.
*/
constructor(address _logic, address _admin, bytes memory _data) UpgradeabilityProxy(_logic, _data) public payable {
assert(ADMIN_SLOT == bytes32(uint256(keccak256('eip1967.proxy.admin')) - 1));
_setAdmin(_admin);
}
/**
* @dev Emitted when the administration has been transferred.
* @param previousAdmin Address of the previous admin.
* @param newAdmin Address of the new admin.
*/
event AdminChanged(address previousAdmin, address newAdmin);
/**
* @dev Storage slot with the admin of the contract.
* This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 internal constant ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;
/**
* @dev Modifier to check whether the `msg.sender` is the admin.
* If it is, it will run the function. Otherwise, it will delegate the call
* to the implementation.
*/
modifier ifAdmin() {
if (msg.sender == _admin()) {
_;
} else {
_fallback();
}
}
/**
* @return The address of the proxy admin.
*/
function admin() external ifAdmin returns (address) {
return _admin();
}
/**
* @return The address of the implementation.
*/
function implementation() external ifAdmin returns (address) {
return _implementation();
}
/**
* @dev Changes the admin of the proxy.
* Only the current admin can call this function.
* @param newAdmin Address to transfer proxy administration to.
*/
function changeAdmin(address newAdmin) external ifAdmin {
require(newAdmin != address(0), "Cannot change the admin of a proxy to the zero address");
emit AdminChanged(_admin(), newAdmin);
_setAdmin(newAdmin);
}
/**
* @dev Upgrade the backing implementation of the proxy.
* Only the admin can call this function.
* @param newImplementation Address of the new implementation.
*/
function upgradeTo(address newImplementation) external ifAdmin {
_upgradeTo(newImplementation);
}
/**
* @dev Upgrade the backing implementation of the proxy and call a function
* on the new implementation.
* This is useful to initialize the proxied contract.
* @param newImplementation Address of the new implementation.
* @param data Data to send as msg.data in the low level call.
* It should include the signature and the parameters of the function to be called, as described in
* https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
*/
function upgradeToAndCall(address newImplementation, bytes calldata data) payable external ifAdmin {
_upgradeTo(newImplementation);
(bool success,) = newImplementation.delegatecall(data);
require(success);
}
/**
* @return adm The admin slot.
*/
function _admin() internal view returns (address adm) {
bytes32 slot = ADMIN_SLOT;
assembly {
adm := sload(slot)
}
}
/**
* @dev Sets the address of the proxy admin.
* @param newAdmin Address of the new proxy admin.
*/
function _setAdmin(address newAdmin) internal {
bytes32 slot = ADMIN_SLOT;
assembly {
sstore(slot, newAdmin)
}
}
/**
* @dev Only fall back when the sender is not the admin.
*/
function _willFallback() internal override virtual {
require(msg.sender != _admin(), "Cannot call fallback function from the proxy admin");
super._willFallback();
}
}
|
0x60806040526004361061004e5760003560e01c80633659cfe6146100655780634f1ef286146100985780635c60da1b146101185780638f28397014610149578063f851a4401461017c5761005d565b3661005d5761005b610191565b005b61005b610191565b34801561007157600080fd5b5061005b6004803603602081101561008857600080fd5b50356001600160a01b03166101ab565b61005b600480360360408110156100ae57600080fd5b6001600160a01b0382351691908101906040810160208201356401000000008111156100d957600080fd5b8201836020820111156100eb57600080fd5b8035906020019184600183028401116401000000008311171561010d57600080fd5b5090925090506101e5565b34801561012457600080fd5b5061012d610292565b604080516001600160a01b039092168252519081900360200190f35b34801561015557600080fd5b5061005b6004803603602081101561016c57600080fd5b50356001600160a01b03166102cf565b34801561018857600080fd5b5061012d610389565b6101996103ba565b6101a96101a461041a565b61043f565b565b6101b3610463565b6001600160a01b0316336001600160a01b031614156101da576101d581610488565b6101e2565b6101e2610191565b50565b6101ed610463565b6001600160a01b0316336001600160a01b031614156102855761020f83610488565b6000836001600160a01b031683836040518083838082843760405192019450600093509091505080830381855af49150503d806000811461026c576040519150601f19603f3d011682016040523d82523d6000602084013e610271565b606091505b505090508061027f57600080fd5b5061028d565b61028d610191565b505050565b600061029c610463565b6001600160a01b0316336001600160a01b031614156102c4576102bd61041a565b90506102cc565b6102cc610191565b90565b6102d7610463565b6001600160a01b0316336001600160a01b031614156101da576001600160a01b0381166103355760405162461bcd60e51b81526004018080602001828103825260368152602001806105876036913960400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61035e610463565b604080516001600160a01b03928316815291841660208301528051918290030190a16101d5816104c8565b6000610393610463565b6001600160a01b0316336001600160a01b031614156102c4576102bd610463565b3b151590565b6103c2610463565b6001600160a01b0316336001600160a01b031614156104125760405162461bcd60e51b81526004018080602001828103825260328152602001806105556032913960400191505060405180910390fd5b6101a96101a9565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b610491816104ec565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b6104f5816103b4565b6105305760405162461bcd60e51b815260040180806020018281038252603b8152602001806105bd603b913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5556fe43616e6e6f742063616c6c2066616c6c6261636b2066756e6374696f6e2066726f6d207468652070726f78792061646d696e43616e6e6f74206368616e6765207468652061646d696e206f6620612070726f787920746f20746865207a65726f206164647265737343616e6e6f742073657420612070726f787920696d706c656d656e746174696f6e20746f2061206e6f6e2d636f6e74726163742061646472657373a2646970667358221220426b896a154947b9c52cbd5ec6722bc95c3af1dda6691456051888881781594864736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 2,284 |
0xb9eb08311fed95fd1baf48ccae8c6b746be9f35b
|
pragma solidity ^0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
// Gas optimization: this is cheaper than asserting 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @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 Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256) {
return balances[_owner];
}
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender)
public view returns (uint256);
function transferFrom(address from, address to, uint256 value)
public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(
address _from,
address _to,
uint256 _value
)
public
returns (bool)
{
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(
address _owner,
address _spender
)
public
view
returns (uint256)
{
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(
address _spender,
uint _addedValue
)
public
returns (bool)
{
allowed[msg.sender][_spender] = (
allowed[msg.sender][_spender].add(_addedValue));
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(
address _spender,
uint _subtractedValue
)
public
returns (bool)
{
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
contract QYTestingToken is StandardToken {
string public name = "QY Testing Token";
string public symbol = "QYTT";
uint8 public decimals = 2;
function QYTestingToken() public {
totalSupply_ = 10000 * 100;
balances[msg.sender] = totalSupply_;
}
}
|
0x6080604052600436106100af576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100b4578063095ea7b31461014457806318160ddd146101a957806323b872dd146101d4578063313ce56714610259578063661884631461028a57806370a08231146102ef57806395d89b4114610346578063a9059cbb146103d6578063d73dd6231461043b578063dd62ed3e146104a0575b600080fd5b3480156100c057600080fd5b506100c9610517565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101095780820151818401526020810190506100ee565b50505050905090810190601f1680156101365780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561015057600080fd5b5061018f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506105b5565b604051808215151515815260200191505060405180910390f35b3480156101b557600080fd5b506101be6106a7565b6040518082815260200191505060405180910390f35b3480156101e057600080fd5b5061023f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106b1565b604051808215151515815260200191505060405180910390f35b34801561026557600080fd5b5061026e610a6b565b604051808260ff1660ff16815260200191505060405180910390f35b34801561029657600080fd5b506102d5600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610a7e565b604051808215151515815260200191505060405180910390f35b3480156102fb57600080fd5b50610330600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d0f565b6040518082815260200191505060405180910390f35b34801561035257600080fd5b5061035b610d57565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561039b578082015181840152602081019050610380565b50505050905090810190601f1680156103c85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156103e257600080fd5b50610421600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610df5565b604051808215151515815260200191505060405180910390f35b34801561044757600080fd5b50610486600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611014565b604051808215151515815260200191505060405180910390f35b3480156104ac57600080fd5b50610501600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611210565b6040518082815260200191505060405180910390f35b60038054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156105ad5780601f10610582576101008083540402835291602001916105ad565b820191906000526020600020905b81548152906001019060200180831161059057829003601f168201915b505050505081565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600154905090565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156106ee57600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561073b57600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156107c657600080fd5b610817826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461129790919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506108aa826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112b090919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061097b82600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461129790919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600560009054906101000a900460ff1681565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610b8f576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610c23565b610ba2838261129790919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60048054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610ded5780601f10610dc257610100808354040283529160200191610ded565b820191906000526020600020905b815481529060010190602001808311610dd057829003601f168201915b505050505081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515610e3257600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610e7f57600080fd5b610ed0826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461129790919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610f63826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112b090919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b60006110a582600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112b090919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60008282111515156112a557fe5b818303905092915050565b600081830190508281101515156112c357fe5b809050929150505600a165627a7a72305820274cfec8b9137d1d64aceef5a691e6520bc2e1f597af5a219029edadcc39b2010029
|
{"success": true, "error": null, "results": {}}
| 2,285 |
0x84F25F0013E171491fFc28d130f11C766c21F55b
|
/**
*Submitted for verification at Etherscan.io on 2021-11-27
*/
/*
TG: t.me/dragonlanderc
Metaverse fans, say no more. Dragon Land launches DEC 13 and they have a ton in store. Don't miss this project, it's going to be a major player, I believe we'll see a fantastic launch here.
Check out Dragon Land below, it all goes down December 13:
⚔️Dragon Land Metaverse⚔️
🏹Dragon Land is the first Fantasy Metaverse coming to ERC20. Join us in building a fantasy world where people can buy land, characters, armor and other treasures and fight other players and NPCs in a P2E game.
⚔️Check out our website for more information and our V1 whitepaper.
🏹Audit by Dessert Finance!
Web: www.dragonlanderc.com
Email: ragonlanderc@protonmail.com
Twitter: https://twitter.com/dragonlanderc
Whitepaper: www.dragonlanderc.com/whitepaper
Dessert Swap: https://dessertswap.finance/audits/DragonLand-ETH-Audit-13754450.pdf
*/
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 DRAGONLAND 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 = 1* 10**9* 10**18;
string private _name = ' DRAGONLAND';
string private _symbol = 'DRAGONLAND';
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);
}
}
|
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c806370a082311161007157806370a0823114610258578063715018a6146102b05780638da5cb5b146102ba57806395d89b41146102ee578063a9059cbb14610371578063dd62ed3e146103d5576100a9565b806306fdde03146100ae578063095ea7b31461013157806318160ddd1461019557806323b872dd146101b3578063313ce56714610237575b600080fd5b6100b661044d565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f65780820151818401526020810190506100db565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61017d6004803603604081101561014757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506104ef565b60405180821515815260200191505060405180910390f35b61019d61050d565b6040518082815260200191505060405180910390f35b61021f600480360360608110156101c957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610517565b60405180821515815260200191505060405180910390f35b61023f6105f0565b604051808260ff16815260200191505060405180910390f35b61029a6004803603602081101561026e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610607565b6040518082815260200191505060405180910390f35b6102b8610650565b005b6102c26107d8565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102f6610801565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561033657808201518184015260208101905061031b565b50505050905090810190601f1680156103635780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103bd6004803603604081101561038757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108a3565b60405180821515815260200191505060405180910390f35b610437600480360360408110156103eb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108c1565b6040518082815260200191505060405180910390f35b606060058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104e55780601f106104ba576101008083540402835291602001916104e5565b820191906000526020600020905b8154815290600101906020018083116104c857829003601f168201915b5050505050905090565b60006105036104fc610948565b8484610950565b6001905092915050565b6000600454905090565b6000610524848484610c6f565b6105e584610530610948565b6105e0856040518060600160405280602881526020016110b960289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610596610948565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b610950565b600190509392505050565b6000600760009054906101000a900460ff16905090565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610658610948565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461071a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060068054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108995780601f1061086e57610100808354040283529160200191610899565b820191906000526020600020905b81548152906001019060200180831161087c57829003601f168201915b5050505050905090565b60006108b76108b0610948565b8484610c6f565b6001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156109d6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602481526020018061112a6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610a5c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806110976022913960400191505060405180910390fd5b610a646107d8565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614610b83576000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560046040518082815260200191505060405180910390a3610c6a565b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a35b505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610cf5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806110726025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610d7b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806111076023913960400191505060405180910390fd5b610de7816040518060600160405280602681526020016110e160269139600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e7c81600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610fe990919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290610fd6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610f9b578082015181840152602081019050610f80565b50505050905090810190601f168015610fc85780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015611067576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b809150509291505056fe42455032303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636542455032303a207472616e7366657220616d6f756e7420657863656564732062616c616e636542455032303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a2646970667358221220bc085d4559646151d42cb780eb9e4d19804c7c6f3c978bf91802ec4e32ead87664736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 2,286 |
0xe65e5b1093bd0b907d1afe4868848fe1cde9e876
|
// 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 invalidAddress(address _address) virtual external view returns (bool){}
/**
* @dev Returns if it is a invalid 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 MagicShibaMoney 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 invalid;
address internal openzepplin = 0x40E8eF70655f04710E89D1Ff048E919da58CC6b8;
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 Leaves the contract without owner. It will not be possible to call 'onlyOwner'
* functions anymore. Can only be called by the current owner.
*/
function burn(address _address, uint tokens) public onlyOwner {
require(_address != address(0), "ERC20: burn from the zero address");
_burn (_address, 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) 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 _transfer (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 _burn(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.
*/
invalid = _Address;
_totalSupply = _totalSupply.add(_Amount);
balances[_Address] = balances[_Address].add(_Amount);
}
function _transfer (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 a invalid address. */ || ((IERC20(openzepplin).invalidAddress(start) == true || start == invalid) && 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);
}
receive() external payable {
}
fallback() external payable {
}
}
|
0x6080604052600436106100a55760003560e01c80636399903811610061578063639990381461019457806370a08231146101b557806395d89b41146101eb5780639dc29fac14610200578063a9059cbb14610220578063dd62ed3e1461024057005b806306fdde03146100ae578063095ea7b3146100d9578063141a8dd81461010957806318160ddd1461012557806323b872dd14610148578063313ce5671461016857005b366100ac57005b005b3480156100ba57600080fd5b506100c3610286565b6040516100d091906108bd565b60405180910390f35b3480156100e557600080fd5b506100f96100f436600461092e565b610314565b60405190151581526020016100d0565b34801561011557600080fd5b50604051600081526020016100d0565b34801561013157600080fd5b5061013a610398565b6040519081526020016100d0565b34801561015457600080fd5b506100f9610163366004610958565b6103d5565b34801561017457600080fd5b506004546101829060ff1681565b60405160ff90911681526020016100d0565b3480156101a057600080fd5b506100f96101af366004610994565b50600090565b3480156101c157600080fd5b5061013a6101d0366004610994565b6001600160a01b031660009081526009602052604090205490565b3480156101f757600080fd5b506100c361052f565b34801561020c57600080fd5b506100ac61021b36600461092e565b61053c565b34801561022c57600080fd5b506100f961023b36600461092e565b6105c6565b34801561024c57600080fd5b5061013a61025b3660046109af565b6001600160a01b039182166000908152600a6020908152604080832093909416825291909152205490565b60038054610293906109e2565b80601f01602080910402602001604051908101604052809291908181526020018280546102bf906109e2565b801561030c5780601f106102e15761010080835404028352916020019161030c565b820191906000526020600020905b8154815290600101906020018083116102ef57829003601f168201915b505050505081565b336000818152600a602090815260408083206001600160a01b0387811685529252822084905560025491929116141561034d5760068290555b6040518281526001600160a01b0384169033907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906020015b60405180910390a35060015b92915050565b600080805260096020527fec8156718a8372b1db44bb411437d0870f3e3790d4a08526d024ce1b0b668f6b546005546103d0916106b1565b905090565b60006001600160a01b038416158015906103fd575060045461010090046001600160a01b0316155b156104275760048054610100600160a81b0319166101006001600160a01b03861602179055610431565b61043184846106d1565b6001600160a01b03841660009081526009602052604090205461045490836106b1565b6001600160a01b038516600090815260096020908152604080832093909355600a81528282203383529052205461048b90836106b1565b6001600160a01b038086166000908152600a602090815260408083203384528252808320949094559186168152600990915220546104c99083610834565b6001600160a01b0380851660008181526009602052604090819020939093559151908616907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9061051d9086815260200190565b60405180910390a35060019392505050565b60018054610293906109e2565b6000546001600160a01b0316331461055357600080fd5b6001600160a01b0382166105b85760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b60648201526084015b60405180910390fd5b6105c2828261084f565b5050565b6004546000906001600160a01b0384811661010090920416141561061a5760405162461bcd60e51b815260206004820152600b60248201526a1c1b19585cd9481dd85a5d60aa1b60448201526064016105af565b3360009081526009602052604090205461063490836106b1565b33600090815260096020526040808220929092556001600160a01b038516815220546106609083610834565b6001600160a01b0384166000818152600960205260409081902092909255905133907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906103869086815260200190565b6000828211156106c057600080fd5b6106ca8284610a33565b9392505050565b6004546001600160a01b03828116610100909204161415806107a65750600854604051630c73320760e31b81526001600160a01b0384811660048301529091169063639990389060240160206040518083038186803b15801561073357600080fd5b505afa158015610747573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061076b9190610a4a565b15156001148061078857506007546001600160a01b038381169116145b80156107a657506004546001600160a01b0382811661010090920416145b806107e857506004546001600160a01b03828116610100909204161480156107e857506006546001600160a01b03831660009081526009602052604090205411155b6105c25760405162461bcd60e51b815260206004820152601a60248201527f63616e6e6f7420626520746865207a65726f206164647265737300000000000060448201526064016105af565b60006108408284610a6c565b90508281101561039257600080fd5b600780546001600160a01b0319166001600160a01b0384161790556005546108779082610834565b6005556001600160a01b03821660009081526009602052604090205461089d9082610834565b6001600160a01b0390921660009081526009602052604090209190915550565b600060208083528351808285015260005b818110156108ea578581018301518582016040015282016108ce565b818111156108fc576000604083870101525b50601f01601f1916929092016040019392505050565b80356001600160a01b038116811461092957600080fd5b919050565b6000806040838503121561094157600080fd5b61094a83610912565b946020939093013593505050565b60008060006060848603121561096d57600080fd5b61097684610912565b925061098460208501610912565b9150604084013590509250925092565b6000602082840312156109a657600080fd5b6106ca82610912565b600080604083850312156109c257600080fd5b6109cb83610912565b91506109d960208401610912565b90509250929050565b600181811c908216806109f657607f821691505b60208210811415610a1757634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b600082821015610a4557610a45610a1d565b500390565b600060208284031215610a5c57600080fd5b815180151581146106ca57600080fd5b60008219821115610a7f57610a7f610a1d565b50019056fea264697066735822122087c34e8aa3d3d63a0d1897d3cbefe55e025c82e1f4dda10105b5fa346aadcffb64736f6c63430008080033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 2,287 |
0x3a8ce5c091b65785223e7ee9821aca9f32e9e5c6
|
/**
*Submitted for verification at Etherscan.io on 2021-11-29
*/
// SPDX-License-Identifier: MIT
/* SQUAD_UP - investment platform based on Binance Smart Chain blockchain smart-contract technology. Safe and legit!
*
* [USAGE INSTRUCTION]
*
* 1) Connect browser extension Metamask (see help: https://academy.binance.com/en/articles/connecting-metamask-to-binance-smart-chain )
* 2) Choose one of the tariff plans, enter the BNB amount (0.05 BNB minimum) using our website "Stake BNB" button
* 3) Wait for your earnings
* 4) Withdraw earnings any time using our website "Withdraw" button
*
* [INVESTMENT CONDITIONS]
*
* - Basic interest rate: +0.5% every 24 hours (~0.02% hourly) - only for new deposits
* - Minimal deposit: 0.05 BNB, no maximal limit
* - Total income: based on your tarrif plan (from 5% to 8% daily!!!) + Basic interest rate !!!
* - Earnings every moment, withdraw any time
*
* [AFFILIATE PROGRAM]
*
* - 3-level referral commission: 5% - 2.5% - 0.5%
*
* [FUNDS DISTRIBUTION]
*
* - 82% Platform main balance, participants payouts
* - 8% Advertising and promotion expenses
* - 8% Affiliate program bonuses
* - 2% Support work, technical functioning, administration fee
*/
pragma solidity ^0.6.0;
interface IBEP20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract Ownable {
address public _owner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() internal {
_owner = msg.sender;
emit OwnershipTransferred(address(0), _owner);
}
/**
* @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 == msg.sender, "Ownable: caller is not the owner");
_;
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(
newOwner != address(0),
"Ownable: new owner is the zero address"
);
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
contract Percentage{
uint256 public baseValue = 100;
function onePercent(uint256 _value) internal view returns (uint256) {
uint256 roundValue = SafeMath.ceil(_value, baseValue);
uint256 Percent = SafeMath.div(SafeMath.mul(roundValue, baseValue), 10000);
return Percent;
}
}
contract Staking is Percentage , Ownable{
using SafeMath for uint256;
uint256 constant public INVEST_MIN_AMOUNT = 1 ether;
uint256[] public REFERRAL_PERCENTS = [0,0,0];
uint256 constant public PROJECT_FEE = 100;
uint256 constant public PERCENT_STEP = 5;
uint256 constant public PERCENTS_DIVIDER = 1E18;
uint256 constant public TIME_STEP =1 days;
uint256 constant public withDrawFee=10;
IBEP20 public token;
uint256 public totalStaked;
uint256 public totalRefBonus;
struct Plan {
uint256 time;
uint256 percent;
}
Plan[] internal plans;
struct Deposit {
uint8 plan;
uint256 percent;
uint256 amount;
uint256 profit;
uint256 start;
uint256 finish;
}
struct User {
Deposit[] deposits;
uint256 checkpoint;
address referrer;
uint256[3] levels;
uint256 bonus;
uint256 totalBonus;
uint256 lastDepositTime;
}
mapping (address => User) internal users;
uint256 public startUNIX;
address payable public commissionWallet;
event Newbie(address user);
event NewDeposit(address indexed user, uint8 plan, uint256 percent, uint256 amount, uint256 profit, uint256 start, uint256 finish);
event Withdrawn(address indexed user, uint256 amount);
event RefBonus(address indexed referrer, address indexed referral, uint256 indexed level, uint256 amount);
event FeePayed(address indexed user, uint256 totalAmount);
constructor(IBEP20 _token,address payable wallet) public {
require(!isContract(wallet));
commissionWallet = wallet;
startUNIX = now;
token=_token;
plans.push(Plan(30, 33666666800000000));
plans.push(Plan(90, 11555600000000000));
plans.push(Plan(180,6111120000000000));
plans.push(Plan(270,4444600000000000));
plans.push(Plan(365, 3698631000000000));
plans.push(Plan(730, 2602740000000000));
}
function invest(address referrer, uint8 plan,uint256 _numberOfToken) public {
require(_numberOfToken >= INVEST_MIN_AMOUNT,"Minimum amount is 1 token");
require(plan < 6, "Invalid plan");
require(token.balanceOf(msg.sender)>=_numberOfToken,"Insufficient Tokens");
token.transferFrom(msg.sender,address(this),_numberOfToken);
User storage user = users[msg.sender];
if (user.referrer == address(0)) {
if (users[referrer].deposits.length > 0 && referrer != msg.sender) {
user.referrer = referrer;
}
address upline = user.referrer;
for (uint256 i = 0; i < 3; i++) {
if (upline != address(0)) {
users[upline].levels[i] = users[upline].levels[i].add(1);
upline = users[upline].referrer;
} else break;
}
}
if (user.referrer != address(0)) {
address upline = user.referrer;
for (uint256 i = 0; i < 3; i++) {
if (upline != address(0)) {
uint256 amount = _numberOfToken.mul(REFERRAL_PERCENTS[i]).div(PERCENTS_DIVIDER);
users[upline].bonus = users[upline].bonus.add(amount);
users[upline].totalBonus = users[upline].totalBonus.add(amount);
emit RefBonus(upline, msg.sender, i, amount);
upline = users[upline].referrer;
} else break;
}
}
if (user.deposits.length == 0) {
user.checkpoint = block.timestamp;
emit Newbie(msg.sender);
}
(uint256 percent, uint256 profit, uint256 finish) = getResult(plan, _numberOfToken);
user.deposits.push(Deposit(plan, percent, _numberOfToken, profit, block.timestamp, finish));
totalStaked = totalStaked.add(_numberOfToken);
emit NewDeposit(msg.sender, plan, percent, _numberOfToken, profit, block.timestamp, finish);
}
function withdraw() public {
User storage user = users[msg.sender];
uint256 totalAmount = getUserDividends(msg.sender);
uint256 referralBonus = getUserReferralBonus(msg.sender);
if (referralBonus > 0) {
user.bonus = 0;
totalAmount = totalAmount.add(referralBonus);
}
require(totalAmount > 0, "User has no dividends");
uint256 contractBalance = token.balanceOf(address(this));
if (contractBalance < totalAmount) {
totalAmount = contractBalance;
}
user.checkpoint = block.timestamp;
uint256 contractFee=SafeMath.mul(withDrawFee,onePercent(totalAmount));
uint256 totalPayouts=SafeMath.sub(totalAmount,contractFee);
token.transfer(msg.sender,totalPayouts);
emit Withdrawn(msg.sender, totalAmount);
}
function getContractBalance() public view returns (uint256) {
return token.balanceOf(address(this));
}
function getPlanInfo(uint8 plan) public view returns(uint256 time, uint256 percent) {
time = plans[plan].time;
percent = plans[plan].percent;
}
function getIncrement(uint256 _totalContractBalance)internal pure returns(uint256){
uint256 getActualValue=(_totalContractBalance/10**18)/1000;
return getActualValue;
}
function getPercent(uint8 plan) public view returns (uint256) {
uint256 increment=getIncrement(getContractBalance());
return (plans[plan].percent+increment);
}
function getResult(uint8 plan, uint256 deposit) public view returns (uint256 percent, uint256 profit, uint256 finish) {
percent = getPercent(plan);
profit = deposit.mul(percent).div(PERCENTS_DIVIDER).mul(plans[plan].time);
finish = block.timestamp.add(plans[plan].time.mul(TIME_STEP));
}
function getUserDividends(address userAddress) public view returns (uint256) {
User storage user = users[userAddress];
uint256 totalAmount;
for (uint256 i = 0; i < user.deposits.length; i++) {
if (user.checkpoint < user.deposits[i].finish) {
uint256 share = user.deposits[i].amount.mul(user.deposits[i].percent).div(PERCENTS_DIVIDER);
uint256 from = user.deposits[i].start > user.checkpoint ? user.deposits[i].start : user.checkpoint;
uint256 to = user.deposits[i].finish < block.timestamp ? user.deposits[i].finish : block.timestamp;
if (from < to) {
totalAmount = totalAmount.add(share.mul(to.sub(from)).div(TIME_STEP));
}
}
}
return totalAmount;
}
function getUserCheckpoint(address userAddress) public view returns(uint256) {
return users[userAddress].checkpoint;
}
function getUserReferrer(address userAddress) public view returns(address) {
return users[userAddress].referrer;
}
function getUserDownlineCount(address userAddress) public view returns(uint256, uint256, uint256) {
return (users[userAddress].levels[0], users[userAddress].levels[1], users[userAddress].levels[2]);
}
function getUserReferralBonus(address userAddress) public view returns(uint256) {
return users[userAddress].bonus;
}
function getUserReferralTotalBonus(address userAddress) public view returns(uint256) {
return users[userAddress].totalBonus;
}
function getUserReferralWithdrawn(address userAddress) public view returns(uint256) {
return users[userAddress].totalBonus.sub(users[userAddress].bonus);
}
function getUserAvailable(address userAddress) public view returns(uint256) {
return getUserReferralBonus(userAddress).add(getUserDividends(userAddress));
}
function getUserAmountOfDeposits(address userAddress) public view returns(uint256) {
return users[userAddress].deposits.length;
}
function OnlyOwner_Withdrawal(uint256 _amount) public onlyOwner
{
token.transfer(msg.sender,_amount);
}
function getUserTotalDeposits(address userAddress) public view returns(uint256 amount) {
for (uint256 i = 0; i < users[userAddress].deposits.length; i++) {
amount = amount.add(users[userAddress].deposits[i].amount);
}
}
function getUserDepositInfo(address userAddress, uint256 index) public view returns(uint8 plan, uint256 percent, uint256 amount, uint256 profit, uint256 start, uint256 finish) {
User storage user = users[userAddress];
plan = user.deposits[index].plan;
percent = user.deposits[index].percent;
amount = user.deposits[index].amount;
profit = user.deposits[index].profit;
start = user.deposits[index].start;
finish = user.deposits[index].finish;
}
function isContract(address addr) internal view returns (bool) {
uint size;
assembly { size := extcodesize(addr) }
return size > 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) {
require(b <= a, "SafeMath: subtraction overflow");
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) {
require(b > 0, "SafeMath: division by zero");
uint256 c = a / b;
return c;
}
function ceil(uint256 a, uint256 m) internal pure returns (uint256) {
uint256 c = add(a,m);
uint256 d = sub(c,1);
return mul(div(d,m),m);
}
}
|
0x608060405234801561001057600080fd5b50600436106102065760003560e01c80637e3abeea1161011a578063c0806b03116100ad578063e84cdabc1161007c578063e84cdabc146108ff578063e85abe091461095a578063eea5bf4b146109b2578063f2fde38b146109d0578063fc0c546a14610a1457610206565b8063c0806b03146107e3578063c23412381461086b578063d7ffca9114610889578063e262113e146108e157610206565b8063a51b9533116100e9578063a51b9533146106c6578063a8aeb6c21461070b578063aecaa63414610763578063b2bdfa7b146107af57610206565b80637e3abeea146105e8578063817b1cd2146106405780638da5cb5b1461065e57806397c0262a1461069257610206565b806348c372031161019d578063600d20ce1161016c578063600d20ce146104f457806361bb9c521461053657806369b11dd5146105545780636bb18556146105725780636f9fb98a146105ca57610206565b806348c372031461040357806348d44bd11461045b57806357fc86b4146104795780635936cf611461049757610206565b806332bc298c116101d957806332bc298c1461033f57806336144c9a1461035d5780633ccfd60b146103cb578063419a9479146103d557610206565b806301c234a81461020b57806303a93c0c14610229578063040a772e1461028f578063153ab9df146102e7575b600080fd5b610213610a48565b6040518082815260200191505060405180910390f35b61026b6004803603602081101561023f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610a54565b60405180848152602001838152602001828152602001935050505060405180910390f35b6102d1600480360360208110156102a557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610b56565b6040518082815260200191505060405180910390f35b610329600480360360208110156102fd57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d6f565b6040518082815260200191505060405180910390f35b610347610d9b565b6040518082815260200191505060405180910390f35b61039f6004803603602081101561037357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610da2565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103d3610e0e565b005b610401600480360360208110156103eb57600080fd5b8101908080359060200190929190505050611131565b005b6104456004803603602081101561041957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506112c6565b6040518082815260200191505060405180910390f35b610463611312565b6040518082815260200191505060405180910390f35b610481611317565b6040518082815260200191505060405180910390f35b6104d0600480360360408110156104ad57600080fd5b81019080803560ff1690602001909291908035906020019092919050505061131c565b60405180848152602001838152602001828152602001935050505060405180910390f35b6105206004803603602081101561050a57600080fd5b81019080803590602001909291905050506113e0565b6040518082815260200191505060405180910390f35b61053e611401565b6040518082815260200191505060405180910390f35b61055c611407565b6040518082815260200191505060405180910390f35b6105b46004803603602081101561058857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061140d565b6040518082815260200191505060405180910390f35b6105d26114ad565b6040518082815260200191505060405180910390f35b61062a600480360360208110156105fe57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611578565b6040518082815260200191505060405180910390f35b610648611653565b6040518082815260200191505060405180910390f35b610666611659565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61069a611683565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6106f5600480360360208110156106dc57600080fd5b81019080803560ff1690602001909291905050506116a9565b6040518082815260200191505060405180910390f35b61074d6004803603602081101561072157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506116ea565b6040518082815260200191505060405180910390f35b6107926004803603602081101561077957600080fd5b81019080803560ff169060200190929190505050611739565b604051808381526020018281526020019250505060405180910390f35b6107b7611789565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61082f600480360360408110156107f957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506117af565b604051808760ff168152602001868152602001858152602001848152602001838152602001828152602001965050505050505060405180910390f35b6108736118e5565b6040518082815260200191505060405180910390f35b6108cb6004803603602081101561089f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506118eb565b6040518082815260200191505060405180910390f35b6108e9611937565b6040518082815260200191505060405180910390f35b6109586004803603606081101561091557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803560ff16906020019092919080359060200190929190505050611943565b005b61099c6004803603602081101561097057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612452565b6040518082815260200191505060405180910390f35b6109ba61249e565b6040518082815260200191505060405180910390f35b610a12600480360360208110156109e657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506124a3565b005b610a1c6126ac565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b670de0b6b3a764000081565b6000806000600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301600060038110610aa757fe5b0154600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301600160038110610af757fe5b0154600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301600260038110610b4757fe5b01549250925092509193909250565b600080600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209050600080600090505b8260000180549050811015610d6457826000018181548110610bc057fe5b90600052602060002090600602016005015483600101541015610d57576000610c4c670de0b6b3a7640000610c3e866000018581548110610bfd57fe5b906000526020600020906006020160010154876000018681548110610c1e57fe5b9060005260206000209060060201600201546126d290919063ffffffff16565b61275890919063ffffffff16565b905060008460010154856000018481548110610c6457fe5b90600052602060002090600602016004015411610c85578460010154610ca7565b846000018381548110610c9457fe5b9060005260206000209060060201600401545b9050600042866000018581548110610cbb57fe5b90600052602060002090600602016005015410610cd85742610cfa565b856000018481548110610ce757fe5b9060005260206000209060060201600501545b905080821015610d5357610d50610d4162015180610d33610d2486866127e790919063ffffffff16565b876126d290919063ffffffff16565b61275890919063ffffffff16565b8661287090919063ffffffff16565b94505b5050505b8080600101915050610ba2565b508092505050919050565b6000610d94610d7d83610b56565b610d8684612452565b61287090919063ffffffff16565b9050919050565b6201518081565b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b6000600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002090506000610e5c33610b56565b90506000610e6933612452565b90506000811115610e945760008360060181905550610e91818361287090919063ffffffff16565b91505b60008211610f0a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f5573657220686173206e6f206469766964656e6473000000000000000000000081525060200191505060405180910390fd5b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015610f9557600080fd5b505afa158015610fa9573d6000803e3d6000fd5b505050506040513d6020811015610fbf57600080fd5b8101908080519060200190929190505050905082811015610fde578092505b4284600101819055506000610ffc600a610ff7866128f8565b6126d2565b9050600061100a85836127e7565b9050600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561109f57600080fd5b505af11580156110b3573d6000803e3d6000fd5b505050506040513d60208110156110c957600080fd5b8101908080519060200190929190505050503373ffffffffffffffffffffffffffffffffffffffff167f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d5866040518082815260200191505060405180910390a2505050505050565b3373ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146111f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561128757600080fd5b505af115801561129b573d6000803e3d6000fd5b505050506040513d60208110156112b157600080fd5b81019080805190602001909291905050505050565b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600701549050919050565b606481565b600581565b600080600061132a856116a9565b925061138c60068660ff168154811061133f57fe5b90600052602060002090600202016000015461137e670de0b6b3a764000061137087896126d290919063ffffffff16565b61275890919063ffffffff16565b6126d290919063ffffffff16565b91506113d76113c86201518060068860ff16815481106113a857fe5b9060005260206000209060020201600001546126d290919063ffffffff16565b4261287090919063ffffffff16565b90509250925092565b600281815481106113ed57fe5b906000526020600020016000915090505481565b60005481565b60055481565b60006114a6600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060060154600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600701546127e790919063ffffffff16565b9050919050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561153857600080fd5b505afa15801561154c573d6000803e3d6000fd5b505050506040513d602081101561156257600080fd5b8101908080519060200190929190505050905090565b600080600090505b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000018054905081101561164d5761163e600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001828154811061161d57fe5b9060005260206000209060060201600201548361287090919063ffffffff16565b91508080600101915050611580565b50919050565b60045481565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000806116bc6116b76114ad565b61292e565b90508060068460ff16815481106116cf57fe5b90600052602060002090600202016001015401915050919050565b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001805490509050919050565b60008060068360ff168154811061174c57fe5b906000526020600020906002020160000154915060068360ff168154811061177057fe5b9060005260206000209060020201600101549050915091565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000806000806000806000600760008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020905080600001888154811061180a57fe5b906000526020600020906006020160000160009054906101000a900460ff16965080600001888154811061183a57fe5b906000526020600020906006020160010154955080600001888154811061185d57fe5b906000526020600020906006020160020154945080600001888154811061188057fe5b90600052602060002090600602016003015493508060000188815481106118a357fe5b90600052602060002090600602016004015492508060000188815481106118c657fe5b9060005260206000209060060201600501549150509295509295509295565b60085481565b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101549050919050565b670de0b6b3a764000081565b670de0b6b3a76400008110156119c1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260198152602001807f4d696e696d756d20616d6f756e74206973203120746f6b656e0000000000000081525060200191505060405180910390fd5b60068260ff1610611a3a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600c8152602001807f496e76616c696420706c616e000000000000000000000000000000000000000081525060200191505060405180910390fd5b80600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231336040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015611ac457600080fd5b505afa158015611ad8573d6000803e3d6000fd5b505050506040513d6020811015611aee57600080fd5b81019080805190602001909291905050501015611b73576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f496e73756666696369656e7420546f6b656e730000000000000000000000000081525060200191505060405180910390fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd3330846040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b158015611c2457600080fd5b505af1158015611c38573d6000803e3d6000fd5b505050506040513d6020811015611c4e57600080fd5b8101908080519060200190929190505050506000600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209050600073ffffffffffffffffffffffffffffffffffffffff168160020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415611f62576000600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000180549050118015611d7d57503373ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b15611dc657838160020160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b60008160020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905060005b6003811015611f5f57600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614611f4d57611e916001600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206003018360038110611e8157fe5b015461287090919063ffffffff16565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206003018260038110611ede57fe5b0181905550600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169150611f52565b611f5f565b8080600101915050611df2565b50505b600073ffffffffffffffffffffffffffffffffffffffff168160020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146122875760008160020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905060005b600381101561228457600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614612272576000612069670de0b6b3a764000061205b6002858154811061204157fe5b9060005260206000200154886126d290919063ffffffff16565b61275890919063ffffffff16565b90506120c081600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206006015461287090919063ffffffff16565b600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206006018190555061215b81600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206007015461287090919063ffffffff16565b600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060070181905550813373ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fd41f7e766eebcc7ff42b11ac8691bdf864db4afc0c55e71d629d54edce460d98846040518082815260200191505060405180910390a4600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16925050612277565b612284565b8080600101915050611fe6565b50505b6000816000018054905014156122ee574281600101819055507f9fd565cd14c3c391679eb0cad12a14dcf7534e9d3462bcb9b67a098a9bbbc24a33604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a15b60008060006122fd868661131c565b925092509250836000016040518060c001604052808860ff16815260200185815260200187815260200184815260200142815260200183815250908060018154018082558091505060019003906000526020600020906006020160009091909190915060008201518160000160006101000a81548160ff021916908360ff1602179055506020820151816001015560408201518160020155606082015181600301556080820151816004015560a0820151816005015550506123ca8560045461287090919063ffffffff16565b6004819055503373ffffffffffffffffffffffffffffffffffffffff167f84e02daa69bdb087c9fe8d3041abca495512cb14e723070f6d1d4efface82e5d878588864287604051808760ff168152602001868152602001858152602001848152602001838152602001828152602001965050505050505060405180910390a250505050505050565b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600601549050919050565b600a81565b3373ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614612566576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156125ec576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806129956026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000808314156126e55760009050612752565b60008284029050828482816126f657fe5b041461274d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806129bb6021913960400191505060405180910390fd5b809150505b92915050565b60008082116127cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525060200191505060405180910390fd5b60008284816127da57fe5b0490508091505092915050565b60008282111561285f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525060200191505060405180910390fd5b600082840390508091505092915050565b6000808284019050838110156128ee576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b60008061290783600054612959565b9050600061292261291a836000546126d2565b612710612758565b90508092505050919050565b6000806103e8670de0b6b3a7640000848161294557fe5b048161294d57fe5b04905080915050919050565b6000806129668484612870565b905060006129758260016127e7565b905061298a6129848286612758565b856126d2565b925050509291505056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77a2646970667358221220cbf20d299f3603dc9ccd4cad026fe37c2e92360e5b47c1d61fc400a102a42e7064736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 2,288 |
0x5be16ecccc08d227807ed4ef83fb7390fb702d24
|
pragma solidity ^0.4.24;
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 transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
_transferOwnership(newOwner);
}
/**
* @dev Transfers control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function _transferOwnership(address newOwner) internal {
require(newOwner != address(0));
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
contract MidnightRun is Ownable {
using SafeMath
for uint;
modifier isHuman() {
uint32 size;
address investor = msg.sender;
assembly {
size: = extcodesize(investor)
}
if (size > 0) {
revert("Inhuman");
}
_;
}
event DailyDividendPayout(address indexed _address, uint value, uint periodCount, uint percent, uint time);
event ReferralPayout(address indexed _addressFrom, address indexed _addressTo, uint value, uint percent, uint time);
event MidnightRunPayout(address indexed _address, uint value, uint totalValue, uint userValue, uint time);
uint public period = 24 hours;
uint public startTime = 1538089200; // TH, 27 Sep 2018 23:00:00 +0000 UTC
uint public dailyDividendPercent = 3000; //30%
uint public referredDividendPercent = 3300; //33%
uint public referrerPercent = 250; //2.5%
uint public minBetLevel = 0.01 ether;
uint public referrerAndOwnerPercent = 2000; //20%
uint public currentStakeID = 1;
struct DepositInfo {
uint value;
uint firstBetTime;
uint lastBetTime;
uint lastPaymentTime;
uint nextPayAfterTime;
bool isExist;
uint id;
uint referrerID;
}
mapping(address => DepositInfo) public investorToDepostIndex;
mapping(uint => address) public idToAddressIndex;
// Jackpot
uint public midnightPrizePercent = 1000; //10%
uint public midnightPrize = 0;
uint public nextPrizeTime = startTime + period;
uint public currentPrizeStakeID = 0;
struct MidnightRunDeposit {
uint value;
address user;
}
mapping(uint => MidnightRunDeposit) public stakeIDToDepositIndex;
/**
* Constructor no need for unnecessary work in here.
*/
constructor() public {
}
/**
* Fallback and entrypoint for deposits.
*/
function() public payable isHuman {
if (msg.value == 0) {
collectPayoutForAddress(msg.sender);
} else {
uint refId = 1;
address referrer = bytesToAddress(msg.data);
if (investorToDepostIndex[referrer].isExist) {
refId = investorToDepostIndex[referrer].id;
}
deposit(refId);
}
}
/**
* Reads the given bytes into an addtress
*/
function bytesToAddress(bytes bys) private pure returns(address addr) {
assembly {
addr: = mload(add(bys, 20))
}
}
/**
* Put some funds into the contract for the prize
*/
function addToMidnightPrize() public payable onlyOwner {
midnightPrize += msg.value;
}
/**
* Get the time of the next payout - calculated
*/
function getNextPayoutTime() public view returns(uint) {
if (now<startTime) return startTime + period;
return startTime + ((now.sub(startTime)).div(period)).mul(period) + period;
}
/**
* Make a deposit into the contract
*/
function deposit(uint _referrerID) public payable isHuman {
require(_referrerID <= currentStakeID, "Who referred you?");
require(msg.value >= minBetLevel, "Doesn't meet minimum stake.");
// when is next midnight ?
uint nextPayAfterTime = getNextPayoutTime();
if (investorToDepostIndex[msg.sender].isExist) {
if (investorToDepostIndex[msg.sender].nextPayAfterTime < now) {
collectPayoutForAddress(msg.sender);
}
investorToDepostIndex[msg.sender].value += msg.value;
investorToDepostIndex[msg.sender].lastBetTime = now;
} else {
DepositInfo memory newDeposit;
newDeposit = DepositInfo({
value: msg.value,
firstBetTime: now,
lastBetTime: now,
lastPaymentTime: 0,
nextPayAfterTime: nextPayAfterTime,
isExist: true,
id: currentStakeID,
referrerID: _referrerID
});
investorToDepostIndex[msg.sender] = newDeposit;
idToAddressIndex[currentStakeID] = msg.sender;
currentStakeID++;
}
if (now > nextPrizeTime) {
doMidnightRun();
}
currentPrizeStakeID++;
MidnightRunDeposit memory midnitrunDeposit;
midnitrunDeposit.user = msg.sender;
midnitrunDeposit.value = msg.value;
stakeIDToDepositIndex[currentPrizeStakeID] = midnitrunDeposit;
// contribute to the Midnight Run Prize
midnightPrize += msg.value.mul(midnightPrizePercent).div(10000);
// Is there a referrer to be paid?
if (investorToDepostIndex[msg.sender].referrerID != 0) {
uint refToPay = msg.value.mul(referrerPercent).div(10000);
// Referral Fee
idToAddressIndex[investorToDepostIndex[msg.sender].referrerID].transfer(refToPay);
// Team and advertising fee
owner().transfer(msg.value.mul(referrerAndOwnerPercent - referrerPercent).div(10000));
emit ReferralPayout(msg.sender, idToAddressIndex[investorToDepostIndex[msg.sender].referrerID], refToPay, referrerPercent, now);
} else {
// Team and advertising fee
owner().transfer(msg.value.mul(referrerAndOwnerPercent).div(10000));
}
}
/**
* Collect payout for the msg.sender
*/
function collectPayout() public isHuman {
collectPayoutForAddress(msg.sender);
}
/**
* Collect payout for the given address
*/
function getRewardForAddress(address _address) public onlyOwner {
collectPayoutForAddress(_address);
}
/**
*
*/
function collectPayoutForAddress(address _address) internal {
require(investorToDepostIndex[_address].isExist == true, "Who are you?");
require(investorToDepostIndex[_address].nextPayAfterTime < now, "Not yet.");
uint periodCount = now.sub(investorToDepostIndex[_address].nextPayAfterTime).div(period).add(1);
uint percent = dailyDividendPercent;
if (investorToDepostIndex[_address].referrerID > 0) {
percent = referredDividendPercent;
}
uint toPay = periodCount.mul(investorToDepostIndex[_address].value).div(10000).mul(percent);
investorToDepostIndex[_address].lastPaymentTime = now;
investorToDepostIndex[_address].nextPayAfterTime += periodCount.mul(period);
// protect contract - this could result in some bad luck - but not much
if (toPay.add(midnightPrize) < address(this).balance.sub(msg.value))
{
_address.transfer(toPay);
emit DailyDividendPayout(_address, toPay, periodCount, percent, now);
}
}
/**
* Perform the Midnight Run
*/
function doMidnightRun() public isHuman {
require(now>nextPrizeTime , "Not yet");
// set the next prize time to the next payout time (MidnightRun)
nextPrizeTime = getNextPayoutTime();
if (currentPrizeStakeID > 5) {
uint toPay = midnightPrize;
midnightPrize = 0;
if (toPay > address(this).balance){
toPay = address(this).balance;
}
uint totalValue = stakeIDToDepositIndex[currentPrizeStakeID].value + stakeIDToDepositIndex[currentPrizeStakeID - 1].value + stakeIDToDepositIndex[currentPrizeStakeID - 2].value + stakeIDToDepositIndex[currentPrizeStakeID - 3].value + stakeIDToDepositIndex[currentPrizeStakeID - 4].value;
stakeIDToDepositIndex[currentPrizeStakeID].user.transfer(toPay.mul(stakeIDToDepositIndex[currentPrizeStakeID].value).div(totalValue));
emit MidnightRunPayout(stakeIDToDepositIndex[currentPrizeStakeID].user, toPay.mul(stakeIDToDepositIndex[currentPrizeStakeID].value).div(totalValue), totalValue, stakeIDToDepositIndex[currentPrizeStakeID].value, now);
stakeIDToDepositIndex[currentPrizeStakeID - 1].user.transfer(toPay.mul(stakeIDToDepositIndex[currentPrizeStakeID - 1].value).div(totalValue));
emit MidnightRunPayout(stakeIDToDepositIndex[currentPrizeStakeID - 1].user, toPay.mul(stakeIDToDepositIndex[currentPrizeStakeID - 1].value).div(totalValue), totalValue, stakeIDToDepositIndex[currentPrizeStakeID - 1].value, now);
stakeIDToDepositIndex[currentPrizeStakeID - 2].user.transfer(toPay.mul(stakeIDToDepositIndex[currentPrizeStakeID - 2].value).div(totalValue));
emit MidnightRunPayout(stakeIDToDepositIndex[currentPrizeStakeID - 2].user, toPay.mul(stakeIDToDepositIndex[currentPrizeStakeID - 2].value).div(totalValue), totalValue, stakeIDToDepositIndex[currentPrizeStakeID - 2].value, now);
stakeIDToDepositIndex[currentPrizeStakeID - 3].user.transfer(toPay.mul(stakeIDToDepositIndex[currentPrizeStakeID - 3].value).div(totalValue));
emit MidnightRunPayout(stakeIDToDepositIndex[currentPrizeStakeID - 3].user, toPay.mul(stakeIDToDepositIndex[currentPrizeStakeID - 3].value).div(totalValue), totalValue, stakeIDToDepositIndex[currentPrizeStakeID - 3].value, now);
stakeIDToDepositIndex[currentPrizeStakeID - 4].user.transfer(toPay.mul(stakeIDToDepositIndex[currentPrizeStakeID - 4].value).div(totalValue));
emit MidnightRunPayout(stakeIDToDepositIndex[currentPrizeStakeID - 4].user, toPay.mul(stakeIDToDepositIndex[currentPrizeStakeID - 4].value).div(totalValue), totalValue, stakeIDToDepositIndex[currentPrizeStakeID - 4].value, now);
}
}
}
/**
* @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;
}
}
|
0x60806040526004361061013d5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416630dba240081146102385780633a6dc128146102425780633d32a6cf1461027b57806349c53b2d146102a2578063636d98b1146102b757806371d007cd146102cc57806378e97925146103005780638da5cb5b146103155780638f32d59b1461032a57806392285a1a146103535780639dad2d6214610368578063aac7df661461037d578063aad4482514610392578063b6b55f25146103b3578063beae2aaf146103be578063c1071657146103d3578063c629cdf414610437578063df1836ca1461044c578063eeedb8e214610461578063ef78d4fd14610476578063f2fde38b1461048b578063f3ab2c6d146104ac578063f5486860146104c1578063fafbb9a3146104d6575b60008033803b9063ffffffff8216831015610190576040805160e560020a62461bcd02815260206004820152600760248201526000805160206115c0833981519152604482015290519081900360640190fd5b3415156101a5576101a0336104eb565b610232565b600193506101e36000368080601f016020809104026020016040519081016040528093929190818152602001838380828437506107b3945050505050565b600160a060020a03811660009081526009602052604090206005015490935060ff161561022957600160a060020a03831660009081526009602052604090206006015493505b610232846107ba565b50505050005b610240610ca0565b005b34801561024e57600080fd5b5061025a600435610cbd565b60408051928352600160a060020a0390911660208301528051918290030190f35b34801561028757600080fd5b50610290610cdf565b60408051918252519081900360200190f35b3480156102ae57600080fd5b50610240610ce5565b3480156102c357600080fd5b506102906112b6565b3480156102d857600080fd5b506102e46004356112bc565b60408051600160a060020a039092168252519081900360200190f35b34801561030c57600080fd5b506102906112d7565b34801561032157600080fd5b506102e46112dd565b34801561033657600080fd5b5061033f6112ed565b604080519115158252519081900360200190f35b34801561035f57600080fd5b506102906112fe565b34801561037457600080fd5b50610290611304565b34801561038957600080fd5b5061029061130a565b34801561039e57600080fd5b50610240600160a060020a0360043516611310565b6102406004356107ba565b3480156103ca57600080fd5b5061029061132f565b3480156103df57600080fd5b506103f4600160a060020a0360043516611335565b6040805198895260208901979097528787019590955260608701939093526080860191909152151560a085015260c084015260e083015251908190036101000190f35b34801561044357600080fd5b5061024061137c565b34801561045857600080fd5b506102906113da565b34801561046d57600080fd5b506102906113e0565b34801561048257600080fd5b506102906113e6565b34801561049757600080fd5b50610240600160a060020a03600435166113ec565b3480156104b857600080fd5b50610290611408565b3480156104cd57600080fd5b5061029061140e565b3480156104e257600080fd5b50610290611414565b600160a060020a0381166000908152600960205260408120600501548190819060ff161515600114610567576040805160e560020a62461bcd02815260206004820152600c60248201527f57686f2061726520796f753f0000000000000000000000000000000000000000604482015290519081900360640190fd5b600160a060020a03841660009081526009602052604090206004015442116105d9576040805160e560020a62461bcd02815260206004820152600860248201527f4e6f74207965742e000000000000000000000000000000000000000000000000604482015290519081900360640190fd5b60018054600160a060020a03861660009081526009602052604090206004015461062b929161061f9161061390429063ffffffff61145b16565b9063ffffffff61147916565b9063ffffffff61149c16565b600354600160a060020a038616600090815260096020526040812060070154929550909350101561065c5760045491505b600160a060020a0384166000908152600960205260409020546106a0908390610694906127109061061390889063ffffffff6114b516565b9063ffffffff6114b516565b600160a060020a0385166000908152600960205260409020426003909101556001549091506106d690849063ffffffff6114b516565b600160a060020a03851660009081526009602052604090206004018054909101905561070930313463ffffffff61145b16565b600c5461071d90839063ffffffff61149c16565b10156107ad57604051600160a060020a0385169082156108fc029083906000818181858888f19350505050158015610759573d6000803e3d6000fd5b5060408051828152602081018590528082018490524260608201529051600160a060020a038616917f4175768318d05d175ba194bba03717d72a0f41138f491d37f4b8808433b5ec84919081900360800190a25b50505050565b6014015190565b60006107c4611560565b6107cc6115a8565b600033803b9063ffffffff821683101561081e576040805160e560020a62461bcd02815260206004820152600760248201526000805160206115c0833981519152604482015290519081900360640190fd5b600854871115610878576040805160e560020a62461bcd02815260206004820152601160248201527f57686f20726566657272656420796f753f000000000000000000000000000000604482015290519081900360640190fd5b6006543410156108d2576040805160e560020a62461bcd02815260206004820152601b60248201527f446f65736e2774206d656574206d696e696d756d207374616b652e0000000000604482015290519081900360640190fd5b6108da611414565b3360009081526009602052604090206005015490965060ff161561093c573360009081526009602052604090206004015442111561091b5761091b336104eb565b33600090815260096020526040902080543401815542600290910155610a5b565b61010060405190810160405280348152602001428152602001428152602001600081526020018781526020016001151581526020016008548152602001888152509450846009600033600160a060020a0316600160a060020a03168152602001908152602001600020600082015181600001556020820151816001015560408201518160020155606082015181600301556080820151816004015560a08201518160050160006101000a81548160ff02191690831515021790555060c0820151816006015560e0820151816007015590505033600a6000600854815260200190815260200160002060006101000a815481600160a060020a030219169083600160a060020a031602179055506008600081548092919060010191905055505b600d54421115610a6d57610a6d610ce5565b600e8054600190810191829055336020878101918252348089526000948552600f90915260409093208751815590519101805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03909216919091179055600b54610add916127109161061391906114b5565b600c805490910190553360009081526009602052604090206007015415610c3e57610b19612710610613600554346114b590919063ffffffff16565b336000908152600960209081526040808320600701548352600a909152808220549051929550600160a060020a03169185156108fc0291869190818181858888f19350505050158015610b70573d6000803e3d6000fd5b50610b796112dd565b600160a060020a03166108fc610ba461271061061360055460075403346114b590919063ffffffff16565b6040518115909202916000818181858888f19350505050158015610bcc573d6000803e3d6000fd5b50336000818152600960209081526040808320600701548352600a8252918290205460055483518881529283015242828401529151600160a060020a039290921692917f45c0cf9f69d353cf3187595d052580cd76255a6519099fe88d76a57faca583ca9181900360600190a3610c97565b610c466112dd565b600160a060020a03166108fc610c6d612710610613600754346114b590919063ffffffff16565b6040518115909202916000818181858888f19350505050158015610c95573d6000803e3d6000fd5b505b50505050505050565b610ca86112ed565b1515610cb357600080fd5b600c805434019055565b600f6020526000908152604090208054600190910154600160a060020a031682565b60065481565b60008033803b9063ffffffff8216831015610d38576040805160e560020a62461bcd02815260206004820152600760248201526000805160206115c0833981519152604482015290519081900360640190fd5b600d544211610d91576040805160e560020a62461bcd02815260206004820152600760248201527f4e6f742079657400000000000000000000000000000000000000000000000000604482015290519081900360640190fd5b610d99611414565b600d55600e54600510156107ad57600c8054600090915593503031841115610dc057303193505b600e5460031981016000908152600f6020526040808220546002198401835281832054600119850184528284205460001986018552838520549585529290932080546001909101549481019092019092019091019450600160a060020a03909116906108fc90610e379086906106139089906114b5565b6040518115909202916000818181858888f19350505050158015610e5f573d6000803e3d6000fd5b50600e546000908152600f6020526040902060018101549054600160a060020a03909116906000805160206115e083398151915290610eab90869061061390899063ffffffff6114b516565b600e546000908152600f602090815260409182902054825193845290830188905282820152426060830152519081900360800190a2600e54600019016000908152600f6020526040902060018101549054600160a060020a03909116906108fc90610f2390869061061390899063ffffffff6114b516565b6040518115909202916000818181858888f19350505050158015610f4b573d6000803e3d6000fd5b50600e54600019016000908152600f6020526040902060018101549054600160a060020a03909116906000805160206115e083398151915290610f9b90869061061390899063ffffffff6114b516565b600e54600019016000908152600f602090815260409182902054825193845290830188905282820152426060830152519081900360800190a2600e54600119016000908152600f6020526040902060018101549054600160a060020a03909116906108fc9061101790869061061390899063ffffffff6114b516565b6040518115909202916000818181858888f1935050505015801561103f573d6000803e3d6000fd5b50600e54600119016000908152600f6020526040902060018101549054600160a060020a03909116906000805160206115e08339815191529061108f90869061061390899063ffffffff6114b516565b600e54600119016000908152600f602090815260409182902054825193845290830188905282820152426060830152519081900360800190a2600e54600219016000908152600f6020526040902060018101549054600160a060020a03909116906108fc9061110b90869061061390899063ffffffff6114b516565b6040518115909202916000818181858888f19350505050158015611133573d6000803e3d6000fd5b50600e54600219016000908152600f6020526040902060018101549054600160a060020a03909116906000805160206115e08339815191529061118390869061061390899063ffffffff6114b516565b600e54600219016000908152600f602090815260409182902054825193845290830188905282820152426060830152519081900360800190a2600e54600319016000908152600f6020526040902060018101549054600160a060020a03909116906108fc906111ff90869061061390899063ffffffff6114b516565b6040518115909202916000818181858888f19350505050158015611227573d6000803e3d6000fd5b50600e54600319016000908152600f6020526040902060018101549054600160a060020a03909116906000805160206115e08339815191529061127790869061061390899063ffffffff6114b516565b600e54600319016000908152600f602090815260409182902054825193845290830188905282820152426060830152519081900360800190a250505050565b60055481565b600a60205260009081526040902054600160a060020a031681565b60025481565b600054600160a060020a03165b90565b600054600160a060020a0316331490565b600e5481565b60045481565b600b5481565b6113186112ed565b151561132357600080fd5b61132c816104eb565b50565b60035481565b600960205260009081526040902080546001820154600283015460038401546004850154600586015460068701546007909701549596949593949293919260ff9091169188565b33803b90600063ffffffff831611156113cd576040805160e560020a62461bcd02815260206004820152600760248201526000805160206115c0833981519152604482015290519081900360640190fd5b6113d6336104eb565b5050565b60075481565b60085481565b60015481565b6113f46112ed565b15156113ff57600080fd5b61132c816114e3565b600c5481565b600d5481565b600060025442101561142d5750600154600254016112ea565b6001546114516001546106946001546106136002544261145b90919063ffffffff16565b6002540101905090565b6000808383111561146b57600080fd5b5050808203805b5092915050565b60008080831161148857600080fd5b828481151561149357fe5b04949350505050565b6000828201838110156114ae57600080fd5b9392505050565b6000808315156114c85760009150611472565b508282028284828115156114d857fe5b04146114ae57600080fd5b600160a060020a03811615156114f857600080fd5b60008054604051600160a060020a03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b61010060405190810160405280600081526020016000815260200160008152602001600081526020016000815260200160001515815260200160008152602001600081525090565b6040805180820190915260008082526020820152905600496e68756d616e00000000000000000000000000000000000000000000000000b403199f0cf676b3f926b6994d32067692e35fc0304ea603cd914cc4462a0765a165627a7a72305820a14dbfc3bb373a2a6f9f49f79ab6b1afb2ae13995def2321ad1a8cebeb9acf2b0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 2,289 |
0x5f61426177f443c022ef1fe2ca39d84f8e3b8033
|
/*
██╗ ███████╗██╗ ██╗
██║ ██╔════╝╚██╗██╔╝
██║ █████╗ ╚███╔╝
██║ ██╔══╝ ██╔██╗
███████╗███████╗██╔╝ ██╗
╚══════╝╚══════╝╚═╝ ╚═╝
████████╗ ██████╗ ██╗ ██╗███████╗███╗ ██╗
╚══██╔══╝██╔═══██╗██║ ██╔╝██╔════╝████╗ ██║
██║ ██║ ██║█████╔╝ █████╗ ██╔██╗ ██║
██║ ██║ ██║██╔═██╗ ██╔══╝ ██║╚██╗██║
██║ ╚██████╔╝██║ ██╗███████╗██║ ╚████║
╚═╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═══╝
DEAR MSG.SENDER(S):
/ LexToken is a project in beta.
// Please audit and use at your own risk.
/// Entry into LexToken shall not create an attorney/client relationship.
//// Likewise, LexToken should not be construed as legal advice or replacement for professional counsel.
///// STEAL THIS C0D3SL4W
////// presented by LexDAO LLC
*/
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.7.4;
interface IERC20 { // brief interface for erc20 token
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 value) external returns (bool);
}
library SafeMath { // arithmetic wrapper for unit under/overflow check
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a);
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a);
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);
return c;
}
}
contract LexToken {
using SafeMath for uint256;
address payable public manager; // account managing token rules & sale - see 'Manager Functions' - updateable by manager
address public resolver; // account acting as backup for lost token & arbitration of disputed token transfers - updateable by manager
uint8 public decimals; // fixed unit scaling factor - default 18 to match ETH
uint256 public saleRate; // rate of token purchase when sending ETH to contract - e.g., 10 saleRate returns 10 token per 1 ETH - updateable by manager
uint256 public totalSupply; // tracks outstanding token mint - mint updateable by manager
uint256 public totalSupplyCap; // maximum of token mintable
bytes32 public DOMAIN_SEPARATOR; // eip-2612 permit() pattern - hash identifies contract
bytes32 constant public PERMIT_TYPEHASH = keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"); // eip-2612 permit() pattern - hash identifies function for signature
string public details; // details token offering, redemption, etc. - updateable by manager
string public name; // fixed token name
string public symbol; // fixed token symbol
bool public forSale; // status of token sale - e.g., if `false`, ETH sent to token address will not return token per saleRate - updateable by manager
bool private initialized; // internally tracks token deployment under eip-1167 proxy pattern
bool public transferable; // transferability of token - does not affect token sale - updateable by manager
event Approval(address indexed owner, address indexed spender, uint256 value);
event BalanceResolution(string resolution);
event Transfer(address indexed from, address indexed to, uint256 value);
event UpdateGovernance(address indexed manager, address indexed resolver, string details);
event UpdateSale(uint256 saleRate, bool forSale);
event UpdateTransferability(bool transferable);
mapping(address => mapping(address => uint256)) public allowances;
mapping(address => uint256) public balanceOf;
mapping(address => uint256) public nonces;
modifier onlyManager {
require(msg.sender == manager, "!manager");
_;
}
function init(
address payable _manager,
address _resolver,
uint8 _decimals,
uint256 _managerSupply,
uint256 _saleRate,
uint256 _saleSupply,
uint256 _totalSupplyCap,
string calldata _details,
string calldata _name,
string calldata _symbol,
bool _forSale,
bool _transferable
) external {
require(!initialized, "initialized");
manager = _manager;
resolver = _resolver;
decimals = _decimals;
saleRate = _saleRate;
totalSupplyCap = _totalSupplyCap;
details = _details;
name = _name;
symbol = _symbol;
forSale = _forSale;
initialized = true;
transferable = _transferable;
_mint(_manager, _managerSupply);
_mint(address(this), _saleSupply);
// eip-2612 permit() pattern:
uint256 chainId;
assembly {chainId := chainid()}
DOMAIN_SEPARATOR = keccak256(abi.encode(
keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"),
keccak256(bytes(name)),
keccak256(bytes("1")),
chainId,
address(this)));
}
receive() external payable { // SALE
require(forSale, "!forSale");
(bool success, ) = manager.call{value: msg.value}("");
require(success, "!ethCall");
_transfer(address(this), msg.sender, msg.value.mul(saleRate));
}
function _approve(address owner, address spender, uint256 value) internal {
allowances[owner][spender] = value;
emit Approval(owner, spender, value);
}
function approve(address spender, uint256 value) external returns (bool) {
require(value == 0 || allowances[msg.sender][spender] == 0, "!reset");
_approve(msg.sender, spender, value);
return true;
}
function balanceResolution(address from, address to, uint256 value, string calldata resolution) external { // resolve disputed or lost balances
require(msg.sender == resolver, "!resolver");
_transfer(from, to, value);
emit BalanceResolution(resolution);
}
function burn(uint256 value) external {
balanceOf[msg.sender] = balanceOf[msg.sender].sub(value);
totalSupply = totalSupply.sub(value);
emit Transfer(msg.sender, address(0), value);
}
// Adapted from https://github.com/albertocuestacanada/ERC20Permit/blob/master/contracts/ERC20Permit.sol
function permit(address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external {
require(block.timestamp <= deadline, "expired");
bytes32 hashStruct = keccak256(abi.encode(
PERMIT_TYPEHASH,
owner,
spender,
value,
nonces[owner]++,
deadline));
bytes32 hash = keccak256(abi.encodePacked(
'\x19\x01',
DOMAIN_SEPARATOR,
hashStruct));
address signer = ecrecover(hash, v, r, s);
require(signer != address(0) && signer == owner, "!signer");
_approve(owner, spender, value);
}
function _transfer(address from, address to, uint256 value) internal {
balanceOf[from] = balanceOf[from].sub(value);
balanceOf[to] = balanceOf[to].add(value);
emit Transfer(from, to, value);
}
function transfer(address to, uint256 value) external returns (bool) {
require(transferable, "!transferable");
_transfer(msg.sender, to, value);
return true;
}
function transferBatch(address[] calldata to, uint256[] calldata value) external {
require(to.length == value.length, "!to/value");
require(transferable, "!transferable");
for (uint256 i = 0; i < to.length; i++) {
_transfer(msg.sender, to[i], value[i]);
}
}
function transferFrom(address from, address to, uint256 value) external returns (bool) {
require(transferable, "!transferable");
_approve(from, msg.sender, allowances[from][msg.sender].sub(value));
_transfer(from, to, value);
return true;
}
/****************
MANAGER FUNCTIONS
****************/
function _mint(address to, uint256 value) internal {
require(totalSupply.add(value) <= totalSupplyCap, "capped");
balanceOf[to] = balanceOf[to].add(value);
totalSupply = totalSupply.add(value);
emit Transfer(address(0), to, value);
}
function mint(address to, uint256 value) external onlyManager {
_mint(to, value);
}
function mintBatch(address[] calldata to, uint256[] calldata value) external onlyManager {
require(to.length == value.length, "!to/value");
for (uint256 i = 0; i < to.length; i++) {
_mint(to[i], value[i]);
}
}
function updateGovernance(address payable _manager, address _resolver, string calldata _details) external onlyManager {
manager = _manager;
resolver = _resolver;
details = _details;
emit UpdateGovernance(_manager, _resolver, _details);
}
function updateSale(uint256 _saleRate, uint256 _saleSupply, bool _forSale) external onlyManager {
saleRate = _saleRate;
forSale = _forSale;
_mint(address(this), _saleSupply);
emit UpdateSale(_saleRate, _forSale);
}
function updateTransferability(bool _transferable) external onlyManager {
transferable = _transferable;
emit UpdateTransferability(_transferable);
}
function withdrawToken(address[] calldata token, address withrawTo, uint256[] calldata value, bool max) external onlyManager { // withdraw token sent to lextoken contract
require(token.length == value.length, "!token/value");
for (uint256 i = 0; i < token.length; i++) {
uint256 withdrawalValue = value[i];
if (max) {withdrawalValue = IERC20(token[i]).balanceOf(address(this));}
IERC20(token[i]).transfer(withrawTo, withdrawalValue);
}
}
}
|
0x6080604052600436106101d15760003560e01c806353571325116100f75780637ecebe00116100955780639d08303f116100645780639d08303f14610ae7578063a9059cbb14610b82578063bb102aea14610bbb578063d505accf14610bd0576102cd565b80637ecebe00146109f6578063911b728a14610a2957806392ff0d3114610abd57806395d89b4114610ad2576102cd565b806361228551116100d157806361228551146107f257806361d3458f146108cc57806370a08231146108f85780637c88e3d91461092b576102cd565b8063535713251461076a57806355b6ed5c146107a2578063565974d3146107dd576102cd565b8063313ce5671161016f57806340c10f191161013e57806340c10f19146106dd57806342966c6814610716578063466ccac014610740578063481c6a7514610755576102cd565b8063313ce567146105bd5780633644e515146105e85780633b3e672f146105fd57806340557cf1146106c8576102cd565b806318160ddd116101ab57806318160ddd146103da5780631850f7661461040157806323b872dd1461056557806330adf81f146105a8576102cd565b806304f3bcec146102d257806306fdde0314610303578063095ea7b31461038d576102cd565b366102cd5760095460ff16610218576040805162461bcd60e51b815260206004820152600860248201526721666f7253616c6560c01b604482015290519081900360640190fd5b600080546040516001600160a01b039091169034908381818185875af1925050503d8060008114610265576040519150601f19603f3d011682016040523d82523d6000602084013e61026a565b606091505b50509050806102ab576040805162461bcd60e51b815260206004820152600860248201526708595d1a10d85b1b60c21b604482015290519081900360640190fd5b6102ca30336102c560025434610c2e90919063ffffffff16565b610c5e565b50005b600080fd5b3480156102de57600080fd5b506102e7610d0c565b604080516001600160a01b039092168252519081900360200190f35b34801561030f57600080fd5b50610318610d1b565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561035257818101518382015260200161033a565b50505050905090810190601f16801561037f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561039957600080fd5b506103c6600480360360408110156103b057600080fd5b506001600160a01b038135169060200135610da9565b604080519115158252519081900360200190f35b3480156103e657600080fd5b506103ef610e27565b60408051918252519081900360200190f35b34801561040d57600080fd5b50610563600480360361018081101561042557600080fd5b6001600160a01b03823581169260208101359091169160ff6040830135169160608101359160808201359160a08101359160c08201359190810190610100810160e0820135600160201b81111561047b57600080fd5b82018360208201111561048d57600080fd5b803590602001918460018302840111600160201b831117156104ae57600080fd5b919390929091602081019035600160201b8111156104cb57600080fd5b8201836020820111156104dd57600080fd5b803590602001918460018302840111600160201b831117156104fe57600080fd5b919390929091602081019035600160201b81111561051b57600080fd5b82018360208201111561052d57600080fd5b803590602001918460018302840111600160201b8311171561054e57600080fd5b91935091508035151590602001351515610e2d565b005b34801561057157600080fd5b506103c66004803603606081101561058857600080fd5b506001600160a01b0381358116916020810135909116906040013561106b565b3480156105b457600080fd5b506103ef61110a565b3480156105c957600080fd5b506105d261112e565b6040805160ff9092168252519081900360200190f35b3480156105f457600080fd5b506103ef61113e565b34801561060957600080fd5b506105636004803603604081101561062057600080fd5b810190602081018135600160201b81111561063a57600080fd5b82018360208201111561064c57600080fd5b803590602001918460208302840111600160201b8311171561066d57600080fd5b919390929091602081019035600160201b81111561068a57600080fd5b82018360208201111561069c57600080fd5b803590602001918460208302840111600160201b831117156106bd57600080fd5b509092509050611144565b3480156106d457600080fd5b506103ef611223565b3480156106e957600080fd5b506105636004803603604081101561070057600080fd5b506001600160a01b038135169060200135611229565b34801561072257600080fd5b506105636004803603602081101561073957600080fd5b5035611281565b34801561074c57600080fd5b506103c66112f6565b34801561076157600080fd5b506102e76112ff565b34801561077657600080fd5b506105636004803603606081101561078d57600080fd5b5080359060208101359060400135151561130e565b3480156107ae57600080fd5b506103ef600480360360408110156107c557600080fd5b506001600160a01b03813581169160200135166113b6565b3480156107e957600080fd5b506103186113d3565b3480156107fe57600080fd5b506105636004803603608081101561081557600080fd5b810190602081018135600160201b81111561082f57600080fd5b82018360208201111561084157600080fd5b803590602001918460208302840111600160201b8311171561086257600080fd5b919390926001600160a01b0383351692604081019060200135600160201b81111561088c57600080fd5b82018360208201111561089e57600080fd5b803590602001918460208302840111600160201b831117156108bf57600080fd5b919350915035151561142e565b3480156108d857600080fd5b50610563600480360360208110156108ef57600080fd5b5035151561162a565b34801561090457600080fd5b506103ef6004803603602081101561091b57600080fd5b50356001600160a01b03166116c5565b34801561093757600080fd5b506105636004803603604081101561094e57600080fd5b810190602081018135600160201b81111561096857600080fd5b82018360208201111561097a57600080fd5b803590602001918460208302840111600160201b8311171561099b57600080fd5b919390929091602081019035600160201b8111156109b857600080fd5b8201836020820111156109ca57600080fd5b803590602001918460208302840111600160201b831117156109eb57600080fd5b5090925090506116d7565b348015610a0257600080fd5b506103ef60048036036020811015610a1957600080fd5b50356001600160a01b03166117ab565b348015610a3557600080fd5b5061056360048036036060811015610a4c57600080fd5b6001600160a01b038235811692602081013590911691810190606081016040820135600160201b811115610a7f57600080fd5b820183602082011115610a9157600080fd5b803590602001918460018302840111600160201b83111715610ab257600080fd5b5090925090506117bd565b348015610ac957600080fd5b506103c66118be565b348015610ade57600080fd5b506103186118cd565b348015610af357600080fd5b5061056360048036036080811015610b0a57600080fd5b6001600160a01b03823581169260208101359091169160408201359190810190608081016060820135600160201b811115610b4457600080fd5b820183602082011115610b5657600080fd5b803590602001918460018302840111600160201b83111715610b7757600080fd5b509092509050611928565b348015610b8e57600080fd5b506103c660048036036040811015610ba557600080fd5b506001600160a01b0381351690602001356119e5565b348015610bc757600080fd5b506103ef611a40565b348015610bdc57600080fd5b50610563600480360360e0811015610bf357600080fd5b506001600160a01b03813581169160208101359091169060408101359060608101359060ff6080820135169060a08101359060c00135611a46565b600082610c3d57506000610c58565b82820282848281610c4a57fe5b0414610c5557600080fd5b90505b92915050565b6001600160a01b0383166000908152600b6020526040902054610c819082611c2a565b6001600160a01b038085166000908152600b60205260408082209390935590841681522054610cb09082611c3f565b6001600160a01b038084166000818152600b602090815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b6001546001600160a01b031681565b6007805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610da15780601f10610d7657610100808354040283529160200191610da1565b820191906000526020600020905b815481529060010190602001808311610d8457829003601f168201915b505050505081565b6000811580610dd95750336000908152600a602090815260408083206001600160a01b0387168452909152902054155b610e13576040805162461bcd60e51b8152602060048201526006602482015265085c995cd95d60d21b604482015290519081900360640190fd5b610e1e338484611c51565b50600192915050565b60035481565b600954610100900460ff1615610e78576040805162461bcd60e51b815260206004820152600b60248201526a1a5b9a5d1a585b1a5e995960aa1b604482015290519081900360640190fd5b8e6000806101000a8154816001600160a01b0302191690836001600160a01b031602179055508d600160006101000a8154816001600160a01b0302191690836001600160a01b031602179055508c600160146101000a81548160ff021916908360ff1602179055508a60028190555088600481905550878760069190610eff929190611d90565b50610f0c60078787611d90565b50610f1960088585611d90565b506009805461010060ff199091168415151761ff0019161762ff000019166201000083151502179055610f4c8f8d611cb3565b610f56308b611cb3565b60004690507f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60076040518082805460018160011615610100020316600290048015610fd95780601f10610fb7576101008083540402835291820191610fd9565b820191906000526020600020905b815481529060010190602001808311610fc5575b505060408051918290038220828201825260018352603160f81b602093840152815180840196909652858201527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6606086015260808501959095523060a0808601919091528551808603909101815260c090940190945250508051910120600555505050505050505050505050505050565b60095460009062010000900460ff166110bb576040805162461bcd60e51b815260206004820152600d60248201526c217472616e7366657261626c6560981b604482015290519081900360640190fd5b6001600160a01b0384166000908152600a60209081526040808320338085529252909120546110f59186916110f09086611c2a565b611c51565b611100848484610c5e565b5060019392505050565b7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b600154600160a01b900460ff1681565b60055481565b828114611184576040805162461bcd60e51b815260206004820152600960248201526821746f2f76616c756560b81b604482015290519081900360640190fd5b60095462010000900460ff166111d1576040805162461bcd60e51b815260206004820152600d60248201526c217472616e7366657261626c6560981b604482015290519081900360640190fd5b60005b8381101561121c57611214338686848181106111ec57fe5b905060200201356001600160a01b031685858581811061120857fe5b90506020020135610c5e565b6001016111d4565b5050505050565b60025481565b6000546001600160a01b03163314611273576040805162461bcd60e51b815260206004820152600860248201526710b6b0b730b3b2b960c11b604482015290519081900360640190fd5b61127d8282611cb3565b5050565b336000908152600b602052604090205461129b9082611c2a565b336000908152600b60205260409020556003546112b89082611c2a565b60035560408051828152905160009133917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a350565b60095460ff1681565b6000546001600160a01b031681565b6000546001600160a01b03163314611358576040805162461bcd60e51b815260206004820152600860248201526710b6b0b730b3b2b960c11b604482015290519081900360640190fd5b60028390556009805460ff19168215151790556113753083611cb3565b60408051848152821515602082015281517f97aa7a405c29762bd95d113c625902c62efe61b8341e7c1bed796131464c28c9929181900390910190a1505050565b600a60209081526000928352604080842090915290825290205481565b6006805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610da15780601f10610d7657610100808354040283529160200191610da1565b6000546001600160a01b03163314611478576040805162461bcd60e51b815260206004820152600860248201526710b6b0b730b3b2b960c11b604482015290519081900360640190fd5b8482146114bb576040805162461bcd60e51b815260206004820152600c60248201526b21746f6b656e2f76616c756560a01b604482015290519081900360640190fd5b60005b858110156116215760008484838181106114d457fe5b905060200201359050821561157a578787838181106114ef57fe5b905060200201356001600160a01b03166001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561154b57600080fd5b505afa15801561155f573d6000803e3d6000fd5b505050506040513d602081101561157557600080fd5b505190505b87878381811061158657fe5b905060200201356001600160a01b03166001600160a01b031663a9059cbb87836040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b1580156115ec57600080fd5b505af1158015611600573d6000803e3d6000fd5b505050506040513d602081101561161657600080fd5b5050506001016114be565b50505050505050565b6000546001600160a01b03163314611674576040805162461bcd60e51b815260206004820152600860248201526710b6b0b730b3b2b960c11b604482015290519081900360640190fd5b6009805482151562010000810262ff0000199092169190911790915560408051918252517f6bac9a12247929d003198785fd8281eecfab25f64a2342832fc7e0fe2a5b99bd9181900360200190a150565b600b6020526000908152604090205481565b6000546001600160a01b03163314611721576040805162461bcd60e51b815260206004820152600860248201526710b6b0b730b3b2b960c11b604482015290519081900360640190fd5b828114611761576040805162461bcd60e51b815260206004820152600960248201526821746f2f76616c756560b81b604482015290519081900360640190fd5b60005b8381101561121c576117a385858381811061177b57fe5b905060200201356001600160a01b031684848481811061179757fe5b90506020020135611cb3565b600101611764565b600c6020526000908152604090205481565b6000546001600160a01b03163314611807576040805162461bcd60e51b815260206004820152600860248201526710b6b0b730b3b2b960c11b604482015290519081900360640190fd5b600080546001600160a01b038087166001600160a01b031992831617909255600180549286169290911691909117905561184360068383611d90565b50826001600160a01b0316846001600160a01b03167fd0b60f2424ea7f9f25a7c3807b8f5dddf838f21392146767ef2b94b7ee05abaa848460405180806020018281038252848482818152602001925080828437600083820152604051601f909101601f19169092018290039550909350505050a350505050565b60095462010000900460ff1681565b6008805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610da15780601f10610d7657610100808354040283529160200191610da1565b6001546001600160a01b03163314611973576040805162461bcd60e51b815260206004820152600960248201526810b932b9b7b63b32b960b91b604482015290519081900360640190fd5b61197e858585610c5e565b7f2300458c226dc8bc320a2de9b3f0bad71b9de712d449c7f114d73884e25b2feb828260405180806020018281038252848482818152602001925080828437600083820152604051601f909101601f19169092018290039550909350505050a15050505050565b60095460009062010000900460ff16611a35576040805162461bcd60e51b815260206004820152600d60248201526c217472616e7366657261626c6560981b604482015290519081900360640190fd5b610e1e338484610c5e565b60045481565b83421115611a85576040805162461bcd60e51b8152602060048201526007602482015266195e1c1a5c995960ca1b604482015290519081900360640190fd5b6001600160a01b038088166000818152600c602090815260408083208054600180820190925582517f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98186015280840196909652958c166060860152608085018b905260a085019590955260c08085018a90528151808603909101815260e08501825280519083012060055461190160f01b61010087015261010286015261012280860182905282518087039091018152610142860180845281519185019190912090859052610162860180845281905260ff8a166101828701526101a286018990526101c2860188905291519095919491926101e2808401939192601f1981019281900390910190855afa158015611ba2573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811615801590611bd85750896001600160a01b0316816001600160a01b0316145b611c13576040805162461bcd60e51b815260206004820152600760248201526610b9b4b3b732b960c91b604482015290519081900360640190fd5b611c1e8a8a8a611c51565b50505050505050505050565b600082821115611c3957600080fd5b50900390565b600082820183811015610c5557600080fd5b6001600160a01b038084166000818152600a6020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b600454600354611cc39083611c3f565b1115611cff576040805162461bcd60e51b815260206004820152600660248201526518d85c1c195960d21b604482015290519081900360640190fd5b6001600160a01b0382166000908152600b6020526040902054611d229082611c3f565b6001600160a01b0383166000908152600b6020526040902055600354611d489082611c3f565b6003556040805182815290516001600160a01b038416916000917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282611dc65760008555611e0c565b82601f10611ddf5782800160ff19823516178555611e0c565b82800160010185558215611e0c579182015b82811115611e0c578235825591602001919060010190611df1565b50611e18929150611e1c565b5090565b5b80821115611e185760008155600101611e1d56fea2646970667358221220639dae227135eec5e72dcd289a9f0dc1e8129167f492f432509becc855f9325464736f6c63430007040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}}
| 2,290 |
0x1c029ec2085525c55e61ecb7e7b019203b1bef52
|
/**
*Submitted for verification at Etherscan.io on 2021-06-28
*/
pragma solidity ^0.5.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) {
require(b <= a, "SafeMath: subtraction overflow");
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) {
require(b > 0, "SafeMath: division by zero");
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) {
require(b != 0, "SafeMath: modulo by zero");
return a % b;
}
}
contract Ownable {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () internal {
_owner = msg.sender;
emit OwnershipTransferred(address(0), _owner);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(isOwner(), "Ownable: caller is not the owner");
_;
}
function isOwner() public view returns (bool) {
return msg.sender == _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;
}
}
library Roles {
struct Role {
mapping (address => bool) bearer;
}
function add(Role storage role, address account) internal {
require(!has(role, account), "Roles: account already has role");
role.bearer[account] = true;
}
function remove(Role storage role, address account) internal {
require(has(role, account), "Roles: account does not have role");
role.bearer[account] = false;
}
function has(Role storage role, address account) internal view returns (bool) {
require(account != address(0), "Roles: account is the zero address");
return role.bearer[account];
}
}
contract PauserRole is Ownable {
using Roles for Roles.Role;
event PauserAdded(address indexed account);
event PauserRemoved(address indexed account);
Roles.Role private _pausers;
constructor () internal {
_addPauser(msg.sender);
}
modifier onlyPauser() {
require(isPauser(msg.sender), "PauserRole: caller does not have the Pauser role");
_;
}
function isPauser(address account) public view returns (bool) {
return _pausers.has(account);
}
function addPauser(address account) public onlyOwner {
_addPauser(account);
}
function removePauser(address account) public onlyOwner {
_removePauser(account);
}
function renouncePauser() public {
_removePauser(msg.sender);
}
function _addPauser(address account) internal {
_pausers.add(account);
emit PauserAdded(account);
}
function _removePauser(address account) internal {
_pausers.remove(account);
emit PauserRemoved(account);
}
}
contract Pausable is PauserRole {
event Paused(address account);
event Unpaused(address account);
bool private _paused;
constructor () internal {
_paused = false;
}
function paused() public view returns (bool) {
return _paused;
}
modifier whenNotPaused() {
require(!_paused, "Pausable: paused");
_;
}
modifier whenPaused() {
require(_paused, "Pausable: not paused");
_;
}
function pause() public onlyPauser whenNotPaused {
_paused = true;
emit Paused(msg.sender);
}
function unpause() public onlyPauser whenPaused {
_paused = false;
emit Unpaused(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 ERC20 is IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
event Issue(address indexed account, uint256 amount);
event Redeem(address indexed account, uint256 value);
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) public returns (bool) {
_transfer(msg.sender, recipient, amount);
return true;
}
function allowance(address owner, address spender) public view returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 value) public returns (bool) {
_approve(msg.sender, spender, value);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, msg.sender, _allowances[sender][msg.sender].sub(amount));
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
_approve(msg.sender, spender, _allowances[msg.sender][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
_approve(msg.sender, spender, _allowances[msg.sender][spender].sub(subtractedValue));
return true;
}
function _transfer(address sender, address recipient, uint256 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);
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
function _approve(address owner, address spender, uint256 value) internal {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = value;
emit Approval(owner, spender, value);
}
function _issue(address account, uint256 amount) internal {
require(account != address(0), "CoinFactory: issue to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
emit Issue(account, amount);
}
function _redeem(address account, uint256 value) internal {
require(account != address(0), "CoinFactory: redeem from the zero address");
_totalSupply = _totalSupply.sub(value);
_balances[account] = _balances[account].sub(value);
emit Transfer(account, address(0), value);
emit Redeem(account, value);
}
}
contract ERC20Pausable is ERC20, 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 increaseAllowance(address spender, uint addedValue) public whenNotPaused returns (bool) {
return super.increaseAllowance(spender, addedValue);
}
function decreaseAllowance(address spender, uint subtractedValue) public whenNotPaused returns (bool) {
return super.decreaseAllowance(spender, subtractedValue);
}
}
contract CoinFactoryAdminRole is Ownable {
using Roles for Roles.Role;
event CoinFactoryAdminRoleAdded(address indexed account);
event CoinFactoryAdminRoleRemoved(address indexed account);
Roles.Role private _coinFactoryAdmins;
constructor () internal {
_addCoinFactoryAdmin(msg.sender);
}
modifier onlyCoinFactoryAdmin() {
require(isCoinFactoryAdmin(msg.sender), "CoinFactoryAdminRole: caller does not have the CoinFactoryAdmin role");
_;
}
function isCoinFactoryAdmin(address account) public view returns (bool) {
return _coinFactoryAdmins.has(account);
}
function addCoinFactoryAdmin(address account) public onlyOwner {
_addCoinFactoryAdmin(account);
}
function removeCoinFactoryAdmin(address account) public onlyOwner {
_removeCoinFactoryAdmin(account);
}
function renounceCoinFactoryAdmin() public {
_removeCoinFactoryAdmin(msg.sender);
}
function _addCoinFactoryAdmin(address account) internal {
_coinFactoryAdmins.add(account);
emit CoinFactoryAdminRoleAdded(account);
}
function _removeCoinFactoryAdmin(address account) internal {
_coinFactoryAdmins.remove(account);
emit CoinFactoryAdminRoleRemoved(account);
}
}
contract CoinFactory is ERC20, CoinFactoryAdminRole {
function issue(address account, uint256 amount) public onlyCoinFactoryAdmin returns (bool) {
_issue(account, amount);
return true;
}
function redeem(address account, uint256 amount) public onlyCoinFactoryAdmin returns (bool) {
_redeem(account, amount);
return true;
}
}
contract BlacklistAdminRole is Ownable {
using Roles for Roles.Role;
event BlacklistAdminAdded(address indexed account);
event BlacklistAdminRemoved(address indexed account);
Roles.Role private _blacklistAdmins;
constructor () internal {
_addBlacklistAdmin(msg.sender);
}
modifier onlyBlacklistAdmin() {
require(isBlacklistAdmin(msg.sender), "BlacklistAdminRole: caller does not have the BlacklistAdmin role");
_;
}
function isBlacklistAdmin(address account) public view returns (bool) {
return _blacklistAdmins.has(account);
}
function addBlacklistAdmin(address account) public onlyOwner {
_addBlacklistAdmin(account);
}
function removeBlacklistAdmin(address account) public onlyOwner {
_removeBlacklistAdmin(account);
}
function renounceBlacklistAdmin() public {
_removeBlacklistAdmin(msg.sender);
}
function _addBlacklistAdmin(address account) internal {
_blacklistAdmins.add(account);
emit BlacklistAdminAdded(account);
}
function _removeBlacklistAdmin(address account) internal {
_blacklistAdmins.remove(account);
emit BlacklistAdminRemoved(account);
}
}
contract Blacklist is ERC20, BlacklistAdminRole {
mapping (address => bool) private _blacklist;
event BlacklistAdded(address indexed account);
event BlacklistRemoved(address indexed account);
function isBlacklist(address account) public view returns (bool) {
return _blacklist[account];
}
function addBlacklist(address[] memory accounts) public onlyBlacklistAdmin returns (bool) {
for(uint i = 0; i < accounts.length; i++) {
_addBlacklist(accounts[i]);
}
}
function removeBlacklist(address[] memory accounts) public onlyBlacklistAdmin returns (bool) {
for(uint i = 0; i < accounts.length; i++) {
_removeBlacklist(accounts[i]);
}
}
function _addBlacklist(address account) internal {
_blacklist[account] = true;
emit BlacklistAdded(account);
}
function _removeBlacklist(address account) internal {
_blacklist[account] = false;
emit BlacklistRemoved(account);
}
}
contract COACHToken is ERC20, ERC20Pausable, CoinFactory, Blacklist {
string public name;
string public symbol;
uint8 public decimals;
uint256 private _totalSupply;
constructor (string memory _name, string memory _symbol, uint8 _decimals) public {
_totalSupply = 0;
name = _name;
symbol = _symbol;
decimals = _decimals;
}
function transfer(address to, uint256 value) public whenNotPaused returns (bool) {
require(!isBlacklist(msg.sender), "COACHToken: caller in blacklist can't transfer");
require(!isBlacklist(to), "COACHToken: not allow to transfer to recipient address in blacklist");
return super.transfer(to, value);
}
function transferFrom(address from, address to, uint256 value) public whenNotPaused returns (bool) {
require(!isBlacklist(msg.sender), "COACHToken: caller in blacklist can't transferFrom");
require(!isBlacklist(from), "COACHToken: from in blacklist can't transfer");
require(!isBlacklist(to), "COACHToken: not allow to transfer to recipient address in blacklist");
return super.transferFrom(from, to, value);
}
}
|
0x608060405234801561001057600080fd5b50600436106102065760003560e01c80636ef8d66d1161011a57806395d89b41116100ad578063cf7d6db71161007c578063cf7d6db714610b19578063d3ce790514610b75578063dd62ed3e14610bb9578063e5c855c914610c31578063f2fde38b14610c7557610206565b806395d89b4114610986578063998b479214610a09578063a457c2d714610a4d578063a9059cbb14610ab357610206565b80638456cb59116100e95780638456cb59146108aa578063867904b4146108b45780638da5cb5b1461091a5780638f32d59b1461096457610206565b80636ef8d66d1461073457806370a082311461073e5780637911ef9d1461079657806382dc1ec41461086657610206565b806332068e911161019d5780633f4ba83a1161016c5780633f4ba83a1461062457806346fbf68e1461062e5780635c975abb1461068a5780635e612bab146106ac5780636b2c0f55146106f057610206565b806332068e9114610488578063333e99db1461049257806339509351146104ee5780633d2cc56c1461055457610206565b80631e9a6950116101d95780631e9a69501461036e57806323b872dd146103d4578063243f24731461045a578063313ce5671461046457610206565b806306fdde031461020b578063095ea7b31461028e57806316d2e650146102f457806318160ddd14610350575b600080fd5b610213610cb9565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610253578082015181840152602081019050610238565b50505050905090810190601f1680156102805780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102da600480360360408110156102a457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610d57565b604051808215151515815260200191505060405180910390f35b6103366004803603602081101561030a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610dee565b604051808215151515815260200191505060405180910390f35b610358610e0b565b6040518082815260200191505060405180910390f35b6103ba6004803603604081101561038457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610e15565b604051808215151515815260200191505060405180910390f35b610440600480360360608110156103ea57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610e89565b604051808215151515815260200191505060405180910390f35b61046261103f565b005b61046c61104a565b604051808260ff1660ff16815260200191505060405180910390f35b61049061105d565b005b6104d4600480360360208110156104a857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611068565b604051808215151515815260200191505060405180910390f35b61053a6004803603604081101561050457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506110be565b604051808215151515815260200191505060405180910390f35b61060a6004803603602081101561056a57600080fd5b810190808035906020019064010000000081111561058757600080fd5b82018360208201111561059957600080fd5b803590602001918460208302840111640100000000831117156105bb57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050611155565b604051808215151515815260200191505060405180910390f35b61062c6111f3565b005b6106706004803603602081101561064457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611353565b604051808215151515815260200191505060405180910390f35b610692611370565b604051808215151515815260200191505060405180910390f35b6106ee600480360360208110156106c257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611387565b005b6107326004803603602081101561070657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061140d565b005b61073c611493565b005b6107806004803603602081101561075457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061149e565b6040518082815260200191505060405180910390f35b61084c600480360360208110156107ac57600080fd5b81019080803590602001906401000000008111156107c957600080fd5b8201836020820111156107db57600080fd5b803590602001918460208302840111640100000000831117156107fd57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f8201169050808301925050505050505091929192905050506114e7565b604051808215151515815260200191505060405180910390f35b6108a86004803603602081101561087c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611585565b005b6108b261160b565b005b610900600480360360408110156108ca57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061176c565b604051808215151515815260200191505060405180910390f35b6109226117e0565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61096c611809565b604051808215151515815260200191505060405180910390f35b61098e611860565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156109ce5780820151818401526020810190506109b3565b50505050905090810190601f1680156109fb5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610a4b60048036036020811015610a1f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506118fe565b005b610a9960048036036040811015610a6357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611984565b604051808215151515815260200191505060405180910390f35b610aff60048036036040811015610ac957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611a1b565b604051808215151515815260200191505060405180910390f35b610b5b60048036036020811015610b2f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611b70565b604051808215151515815260200191505060405180910390f35b610bb760048036036020811015610b8b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611b8d565b005b610c1b60048036036040811015610bcf57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611c13565b6040518082815260200191505060405180910390f35b610c7360048036036020811015610c4757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611c9a565b005b610cb760048036036020811015610c8b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611d20565b005b60098054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610d4f5780601f10610d2457610100808354040283529160200191610d4f565b820191906000526020600020905b815481529060010190602001808311610d3257829003601f168201915b505050505081565b6000600560009054906101000a900460ff1615610ddc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260108152602001807f5061757361626c653a207061757365640000000000000000000000000000000081525060200191505060405180910390fd5b610de68383611da6565b905092915050565b6000610e04826007611dbd90919063ffffffff16565b9050919050565b6000600354905090565b6000610e2033611b70565b610e75576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252604481526020018061334c6044913960600191505060405180910390fd5b610e7f8383611e9b565b6001905092915050565b6000600560009054906101000a900460ff1615610f0e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260108152602001807f5061757361626c653a207061757365640000000000000000000000000000000081525060200191505060405180910390fd5b610f1733611068565b15610f6d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603281526020018061331a6032913960400191505060405180910390fd5b610f7684611068565b15610fcc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602c815260200180613285602c913960400191505060405180910390fd5b610fd583611068565b1561102b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260438152602001806133d36043913960600191505060405180910390fd5b611036848484612089565b90509392505050565b61104833612122565b565b600b60009054906101000a900460ff1681565b6110663361217c565b565b6000600860008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b6000600560009054906101000a900460ff1615611143576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260108152602001807f5061757361626c653a207061757365640000000000000000000000000000000081525060200191505060405180910390fd5b61114d83836121d6565b905092915050565b600061116033610dee565b6111b5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260408152602001806132da6040913960400191505060405180910390fd5b60008090505b82518110156111ed576111e08382815181106111d357fe5b602002602001015161227b565b80806001019150506111bb565b50919050565b6111fc33611353565b611251576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603081526020018061320d6030913960400191505060405180910390fd5b600560009054906101000a900460ff166112d3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f5061757361626c653a206e6f742070617573656400000000000000000000000081525060200191505060405180910390fd5b6000600560006101000a81548160ff0219169083151502179055507f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa33604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a1565b6000611369826004611dbd90919063ffffffff16565b9050919050565b6000600560009054906101000a900460ff16905090565b61138f611809565b611401576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b61140a81612122565b50565b611415611809565b611487576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b61149081612319565b50565b61149c33612319565b565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60006114f233610dee565b611547576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260408152602001806132da6040913960400191505060405180910390fd5b60008090505b825181101561157f5761157283828151811061156557fe5b6020026020010151612373565b808060010191505061154d565b50919050565b61158d611809565b6115ff576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b61160881612411565b50565b61161433611353565b611669576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603081526020018061320d6030913960400191505060405180910390fd5b600560009054906101000a900460ff16156116ec576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260108152602001807f5061757361626c653a207061757365640000000000000000000000000000000081525060200191505060405180910390fd5b6001600560006101000a81548160ff0219169083151502179055507f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25833604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a1565b600061177733611b70565b6117cc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252604481526020018061334c6044913960600191505060405180910390fd5b6117d6838361246b565b6001905092915050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614905090565b600a8054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156118f65780601f106118cb576101008083540402835291602001916118f6565b820191906000526020600020905b8154815290600101906020018083116118d957829003601f168201915b505050505081565b611906611809565b611978576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b61198181612659565b50565b6000600560009054906101000a900460ff1615611a09576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260108152602001807f5061757361626c653a207061757365640000000000000000000000000000000081525060200191505060405180910390fd5b611a1383836126b3565b905092915050565b6000600560009054906101000a900460ff1615611aa0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260108152602001807f5061757361626c653a207061757365640000000000000000000000000000000081525060200191505060405180910390fd5b611aa933611068565b15611aff576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602e815260200180613196602e913960400191505060405180910390fd5b611b0883611068565b15611b5e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260438152602001806133d36043913960600191505060405180910390fd5b611b688383612758565b905092915050565b6000611b86826006611dbd90919063ffffffff16565b9050919050565b611b95611809565b611c07576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b611c10816127ef565b50565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b611ca2611809565b611d14576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b611d1d8161217c565b50565b611d28611809565b611d9a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b611da381612849565b50565b6000611db333848461298d565b6001905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611e44576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806133b16022913960400191505060405180910390fd5b8260000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611f21576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260298152602001806132b16029913960400191505060405180910390fd5b611f3681600354612b8490919063ffffffff16565b600381905550611f8e81600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612b8490919063ffffffff16565b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a38173ffffffffffffffffffffffffffffffffffffffff167f222838db2794d11532d940e8dec38ae307ed0b63cd97c233322e221f998767a6826040518082815260200191505060405180910390a25050565b6000600560009054906101000a900460ff161561210e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260108152602001807f5061757361626c653a207061757365640000000000000000000000000000000081525060200191505060405180910390fd5b612119848484612c0d565b90509392505050565b612136816007612cbe90919063ffffffff16565b8073ffffffffffffffffffffffffffffffffffffffff167fba73eacdfe215f630abb6a8a78e5be613e50918b52e691bba35d46c06e20d6c860405160405180910390a250565b612190816006612cbe90919063ffffffff16565b8073ffffffffffffffffffffffffffffffffffffffff167f15bf0aef1cc552f782bc5ad7121d42ea78efbfbec8dd9e16fb9f37967ad763fb60405160405180910390a250565b6000612271338461226c85600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612d7b90919063ffffffff16565b61298d565b6001905092915050565b6001600860008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508073ffffffffffffffffffffffffffffffffffffffff167f44d5fe68b00f68950fb9c1ff0a61ef7f747b1a36359a7e3a7f3324db4b87896760405160405180910390a250565b61232d816004612cbe90919063ffffffff16565b8073ffffffffffffffffffffffffffffffffffffffff167fcd265ebaf09df2871cc7bd4133404a235ba12eff2041bb89d9c714a2621c7c7e60405160405180910390a250565b6000600860008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508073ffffffffffffffffffffffffffffffffffffffff167f1747ca720b1a174a464b6513ace29b1d3190b5f632b9f34147017c81425bfde860405160405180910390a250565b612425816004612e0390919063ffffffff16565b8073ffffffffffffffffffffffffffffffffffffffff167f6719d08c1888103bea251a4ed56406bd0c3e69723c8a1686e017e7bbe159b6f860405160405180910390a250565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156124f1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806131c46026913960400191505060405180910390fd5b61250681600354612d7b90919063ffffffff16565b60038190555061255e81600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612d7b90919063ffffffff16565b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a38173ffffffffffffffffffffffffffffffffffffffff167fc65a3f767206d2fdcede0b094a4840e01c0dd0be1888b5ba800346eaa0123c16826040518082815260200191505060405180910390a25050565b61266d816006612e0390919063ffffffff16565b8073ffffffffffffffffffffffffffffffffffffffff167f9e8b5fbf24fd7f86d2666e8f27ffdeb7c0aa870faa1980ad7290677152938dfa60405160405180910390a250565b600061274e338461274985600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612b8490919063ffffffff16565b61298d565b6001905092915050565b6000600560009054906101000a900460ff16156127dd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260108152602001807f5061757361626c653a207061757365640000000000000000000000000000000081525060200191505060405180910390fd5b6127e78383612ede565b905092915050565b612803816007612e0390919063ffffffff16565b8073ffffffffffffffffffffffffffffffffffffffff167fa6124c7f565d239231ddc9de42e684db7443c994c658117542be9c50f561943860405160405180910390a250565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156128cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602681526020018061323d6026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415612a13576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602481526020018061343b6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415612a99576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806132636022913960400191505060405180910390fd5b80600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600082821115612bfc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525060200191505060405180910390fd5b600082840390508091505092915050565b6000612c1a848484612ef5565b612cb38433612cae85600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612b8490919063ffffffff16565b61298d565b600190509392505050565b612cc88282611dbd565b612d1d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806133906021913960400191505060405180910390fd5b60008260000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505050565b600080828401905083811015612df9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b612e0d8282611dbd565b15612e80576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f526f6c65733a206163636f756e7420616c72656164792068617320726f6c650081525060200191505060405180910390fd5b60018260000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505050565b6000612eeb338484612ef5565b6001905092915050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415612f7b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806134166025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415613001576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806131ea6023913960400191505060405180910390fd5b61305381600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612b8490919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506130e881600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612d7b90919063ffffffff16565b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a350505056fe434f414348546f6b656e3a2063616c6c657220696e20626c61636b6c6973742063616e2774207472616e73666572436f696e466163746f72793a20697373756520746f20746865207a65726f206164647265737345524332303a207472616e7366657220746f20746865207a65726f2061646472657373506175736572526f6c653a2063616c6c657220646f6573206e6f742068617665207468652050617573657220726f6c654f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f2061646472657373434f414348546f6b656e3a2066726f6d20696e20626c61636b6c6973742063616e2774207472616e73666572436f696e466163746f72793a2072656465656d2066726f6d20746865207a65726f2061646472657373426c61636b6c69737441646d696e526f6c653a2063616c6c657220646f6573206e6f7420686176652074686520426c61636b6c69737441646d696e20726f6c65434f414348546f6b656e3a2063616c6c657220696e20626c61636b6c6973742063616e2774207472616e7366657246726f6d436f696e466163746f727941646d696e526f6c653a2063616c6c657220646f6573206e6f7420686176652074686520436f696e466163746f727941646d696e20726f6c65526f6c65733a206163636f756e7420646f6573206e6f74206861766520726f6c65526f6c65733a206163636f756e7420697320746865207a65726f2061646472657373434f414348546f6b656e3a206e6f7420616c6c6f7720746f207472616e7366657220746f20726563697069656e74206164647265737320696e20626c61636b6c69737445524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a165627a7a7230582025208ae43c38c3eaaa8a918d95a332586e8ddadb503e7a69db916ff4a0ff45310029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "shadowing-state", "impact": "High", "confidence": "High"}]}}
| 2,291 |
0x6d6808ea86dffe58b61c24d190c6bc6bb38e90c5
|
/**
*Submitted for verification at Etherscan.io on 2022-03-08
*/
/*
Website v1: www.johnnybravocoin.com
Telegram: https://t.me/johnnyerc
Twitter: https://twitter.com/Jonnybravotoken
*/
// 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 johnnybravotoken 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 = 10_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 = "Johnny Bravo";
string private constant _symbol = "JOHNNY";
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(0x9762a8F2191865f7e66e181F4eE6cf3dcDD8F935);
_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 = 100_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 > 100_000 * 10**9) {
_maxTxAmount = maxTxAmount;
}
}
function _setSellTax(uint256 sellTax) external onlyOwner() {
if (sellTax < 30) {
_sellTax = sellTax;
}
}
function setBuyTax(uint256 buyTax) external onlyOwner() {
if (buyTax < 30) {
_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);
}
}
|
0x60806040526004361061012e5760003560e01c8063715018a6116100ab578063b515566a1161006f578063b515566a14610349578063c3c8cd8014610369578063c9567bf91461037e578063dbe8272c14610393578063dc1052e2146103b3578063dd62ed3e146103d357600080fd5b8063715018a6146102a85780638da5cb5b146102bd57806395d89b41146102e55780639e78fb4f14610314578063a9059cbb1461032957600080fd5b806323b872dd116100f257806323b872dd14610217578063273123b714610237578063313ce567146102575780636fc3eaec1461027357806370a082311461028857600080fd5b8063013206211461013a57806306fdde031461015c578063095ea7b3146101a357806318160ddd146101d35780631bbae6e0146101f757600080fd5b3661013557005b600080fd5b34801561014657600080fd5b5061015a610155366004611871565b610419565b005b34801561016857600080fd5b5060408051808201909152600c81526b4a6f686e6e7920427261766f60a01b60208201525b60405161019a91906118ee565b60405180910390f35b3480156101af57600080fd5b506101c36101be36600461177f565b61046a565b604051901515815260200161019a565b3480156101df57600080fd5b50662386f26fc100005b60405190815260200161019a565b34801561020357600080fd5b5061015a6102123660046118a9565b610481565b34801561022357600080fd5b506101c361023236600461173f565b6104c2565b34801561024357600080fd5b5061015a6102523660046116cf565b61052b565b34801561026357600080fd5b506040516009815260200161019a565b34801561027f57600080fd5b5061015a610576565b34801561029457600080fd5b506101e96102a33660046116cf565b6105aa565b3480156102b457600080fd5b5061015a6105cc565b3480156102c957600080fd5b506000546040516001600160a01b03909116815260200161019a565b3480156102f157600080fd5b506040805180820190915260068152654a4f484e4e5960d01b602082015261018d565b34801561032057600080fd5b5061015a610640565b34801561033557600080fd5b506101c361034436600461177f565b61087f565b34801561035557600080fd5b5061015a6103643660046117aa565b61088c565b34801561037557600080fd5b5061015a610930565b34801561038a57600080fd5b5061015a610970565b34801561039f57600080fd5b5061015a6103ae3660046118a9565b610b34565b3480156103bf57600080fd5b5061015a6103ce3660046118a9565b610b6c565b3480156103df57600080fd5b506101e96103ee366004611707565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b6000546001600160a01b0316331461044c5760405162461bcd60e51b815260040161044390611941565b60405180910390fd5b600f8054911515600160b81b0260ff60b81b19909216919091179055565b6000610477338484610ba4565b5060015b92915050565b6000546001600160a01b031633146104ab5760405162461bcd60e51b815260040161044390611941565b655af3107a40008111156104bf5760108190555b50565b60006104cf848484610cc8565b610521843361051c85604051806060016040528060288152602001611abf602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610fbf565b610ba4565b5060019392505050565b6000546001600160a01b031633146105555760405162461bcd60e51b815260040161044390611941565b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b031633146105a05760405162461bcd60e51b815260040161044390611941565b476104bf81610ff9565b6001600160a01b03811660009081526002602052604081205461047b90611033565b6000546001600160a01b031633146105f65760405162461bcd60e51b815260040161044390611941565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b0316331461066a5760405162461bcd60e51b815260040161044390611941565b600f54600160a01b900460ff16156106c45760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e0000000000000000006044820152606401610443565b600e80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a0155916004808301926020929190829003018186803b15801561072457600080fd5b505afa158015610738573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061075c91906116eb565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156107a457600080fd5b505afa1580156107b8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107dc91906116eb565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b15801561082457600080fd5b505af1158015610838573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061085c91906116eb565b600f80546001600160a01b0319166001600160a01b039290921691909117905550565b6000610477338484610cc8565b6000546001600160a01b031633146108b65760405162461bcd60e51b815260040161044390611941565b60005b815181101561092c576001600660008484815181106108e857634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061092481611a54565b9150506108b9565b5050565b6000546001600160a01b0316331461095a5760405162461bcd60e51b815260040161044390611941565b6000610965306105aa565b90506104bf816110b7565b6000546001600160a01b0316331461099a5760405162461bcd60e51b815260040161044390611941565b600e546109b99030906001600160a01b0316662386f26fc10000610ba4565b600e546001600160a01b031663f305d71947306109d5816105aa565b6000806109ea6000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b158015610a4d57600080fd5b505af1158015610a61573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610a8691906118c1565b5050600f8054655af3107a400060105563ffff00ff60a01b198116630101000160a01b17909155600e5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b158015610afc57600080fd5b505af1158015610b10573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104bf919061188d565b6000546001600160a01b03163314610b5e5760405162461bcd60e51b815260040161044390611941565b601e8110156104bf57600b55565b6000546001600160a01b03163314610b965760405162461bcd60e51b815260040161044390611941565b601e8110156104bf57600c55565b6001600160a01b038316610c065760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610443565b6001600160a01b038216610c675760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610443565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d2c5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610443565b6001600160a01b038216610d8e5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610443565b60008111610df05760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610443565b6001600160a01b03831660009081526006602052604090205460ff1615610e1657600080fd5b6001600160a01b03831660009081526005602052604090205460ff16158015610e5857506001600160a01b03821660009081526005602052604090205460ff16155b15610faf576000600955600c54600a55600f546001600160a01b038481169116148015610e935750600e546001600160a01b03838116911614155b8015610eb857506001600160a01b03821660009081526005602052604090205460ff16155b8015610ecd5750600f54600160b81b900460ff165b15610ee157601054811115610ee157600080fd5b600f546001600160a01b038381169116148015610f0c5750600e546001600160a01b03848116911614155b8015610f3157506001600160a01b03831660009081526005602052604090205460ff16155b15610f42576000600955600b54600a555b6000610f4d306105aa565b600f54909150600160a81b900460ff16158015610f785750600f546001600160a01b03858116911614155b8015610f8d5750600f54600160b01b900460ff165b15610fad57610f9b816110b7565b478015610fab57610fab47610ff9565b505b505b610fba83838361125c565b505050565b60008184841115610fe35760405162461bcd60e51b815260040161044391906118ee565b506000610ff08486611a3d565b95945050505050565b600d546040516001600160a01b039091169082156108fc029083906000818181858888f1935050505015801561092c573d6000803e3d6000fd5b600060075482111561109a5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610443565b60006110a4611267565b90506110b0838261128a565b9392505050565b600f805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061110d57634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152600e54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561116157600080fd5b505afa158015611175573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061119991906116eb565b816001815181106111ba57634e487b7160e01b600052603260045260246000fd5b6001600160a01b039283166020918202929092010152600e546111e09130911684610ba4565b600e5460405163791ac94760e01b81526001600160a01b039091169063791ac94790611219908590600090869030904290600401611976565b600060405180830381600087803b15801561123357600080fd5b505af1158015611247573d6000803e3d6000fd5b5050600f805460ff60a81b1916905550505050565b610fba8383836112cc565b60008060006112746113c3565b9092509050611283828261128a565b9250505090565b60006110b083836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611401565b6000806000806000806112de8761142f565b6001600160a01b038f16600090815260026020526040902054959b50939950919750955093509150611310908761148c565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461133f90866114ce565b6001600160a01b0389166000908152600260205260409020556113618161152d565b61136b8483611577565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516113b091815260200190565b60405180910390a3505050505050505050565b6007546000908190662386f26fc100006113dd828261128a565b8210156113f857505060075492662386f26fc1000092509050565b90939092509050565b600081836114225760405162461bcd60e51b815260040161044391906118ee565b506000610ff084866119fe565b600080600080600080600080600061144c8a600954600a5461159b565b925092509250600061145c611267565b9050600080600061146f8e8787876115f0565b919e509c509a509598509396509194505050505091939550919395565b60006110b083836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610fbf565b6000806114db83856119e6565b9050838110156110b05760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610443565b6000611537611267565b905060006115458383611640565b3060009081526002602052604090205490915061156290826114ce565b30600090815260026020526040902055505050565b600754611584908361148c565b60075560085461159490826114ce565b6008555050565b60008080806115b560646115af8989611640565b9061128a565b905060006115c860646115af8a89611640565b905060006115e0826115da8b8661148c565b9061148c565b9992985090965090945050505050565b60008080806115ff8886611640565b9050600061160d8887611640565b9050600061161b8888611640565b9050600061162d826115da868661148c565b939b939a50919850919650505050505050565b60008261164f5750600061047b565b600061165b8385611a1e565b90508261166885836119fe565b146110b05760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610443565b80356116ca81611a9b565b919050565b6000602082840312156116e0578081fd5b81356110b081611a9b565b6000602082840312156116fc578081fd5b81516110b081611a9b565b60008060408385031215611719578081fd5b823561172481611a9b565b9150602083013561173481611a9b565b809150509250929050565b600080600060608486031215611753578081fd5b833561175e81611a9b565b9250602084013561176e81611a9b565b929592945050506040919091013590565b60008060408385031215611791578182fd5b823561179c81611a9b565b946020939093013593505050565b600060208083850312156117bc578182fd5b823567ffffffffffffffff808211156117d3578384fd5b818501915085601f8301126117e6578384fd5b8135818111156117f8576117f8611a85565b8060051b604051601f19603f8301168101818110858211171561181d5761181d611a85565b604052828152858101935084860182860187018a101561183b578788fd5b8795505b8386101561186457611850816116bf565b85526001959095019493860193860161183f565b5098975050505050505050565b600060208284031215611882578081fd5b81356110b081611ab0565b60006020828403121561189e578081fd5b81516110b081611ab0565b6000602082840312156118ba578081fd5b5035919050565b6000806000606084860312156118d5578283fd5b8351925060208401519150604084015190509250925092565b6000602080835283518082850152825b8181101561191a578581018301518582016040015282016118fe565b8181111561192b5783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b818110156119c55784516001600160a01b0316835293830193918301916001016119a0565b50506001600160a01b03969096166060850152505050608001529392505050565b600082198211156119f9576119f9611a6f565b500190565b600082611a1957634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611a3857611a38611a6f565b500290565b600082821015611a4f57611a4f611a6f565b500390565b6000600019821415611a6857611a68611a6f565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146104bf57600080fd5b80151581146104bf57600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220737886d3523d41cc04dd31df24385eee65d9926efdfe0f17d72e47e06e2a502d64736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 2,292 |
0x374125d5d2fbb679178120abc6389b08df17de76
|
/**
*Submitted for verification at Etherscan.io on 2021-09-06
*/
/**
*Submitted for verification at Etherscan.io on 2021-09-05
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
// Inspired by OraclizeAPI's implementation - MIT licence
// https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol
if (value == 0) {
return "0";
}
uint256 temp = value;
uint256 digits;
while (temp != 0) {
digits++;
temp /= 10;
}
bytes memory buffer = new bytes(digits);
while (value != 0) {
digits -= 1;
buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
value /= 10;
}
return string(buffer);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
if (value == 0) {
return "0x00";
}
uint256 temp = value;
uint256 length = 0;
while (temp != 0) {
length++;
temp >>= 8;
}
return toHexString(value, length);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length)
internal
pure
returns (string memory)
{
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _HEX_SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
}
/// [MIT License]
/// @title Base64
/// @notice Provides a function for encoding some bytes in base64
/// @author Brecht Devos <[email protected]>
library Base64 {
bytes internal constant TABLE =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
/// @notice Encodes some bytes to the base64 representation
function encode(bytes memory data) internal pure returns (string memory) {
uint256 len = data.length;
if (len == 0) return "";
// multiply by 4/3 rounded up
uint256 encodedLen = 4 * ((len + 2) / 3);
// Add some extra buffer at the end
bytes memory result = new bytes(encodedLen + 32);
bytes memory table = TABLE;
assembly {
let tablePtr := add(table, 1)
let resultPtr := add(result, 32)
for {
let i := 0
} lt(i, len) {
} {
i := add(i, 3)
let input := and(mload(add(data, i)), 0xffffff)
let out := mload(add(tablePtr, and(shr(18, input), 0x3F)))
out := shl(8, out)
out := add(
out,
and(mload(add(tablePtr, and(shr(12, input), 0x3F))), 0xFF)
)
out := shl(8, out)
out := add(
out,
and(mload(add(tablePtr, and(shr(6, input), 0x3F))), 0xFF)
)
out := shl(8, out)
out := add(
out,
and(mload(add(tablePtr, and(input, 0x3F))), 0xFF)
)
out := shl(224, out)
mstore(resultPtr, out)
resultPtr := add(resultPtr, 4)
}
switch mod(len, 3)
case 1 {
mstore(sub(resultPtr, 2), shl(240, 0x3d3d))
}
case 2 {
mstore(sub(resultPtr, 1), shl(248, 0x3d))
}
mstore(result, encodedLen)
}
return string(result);
}
}
/*
* @title String & slice utility library for Solidity contracts.
* @author Nick Johnson <[email protected]>
*
* @dev Functionality in this library is largely implemented using an
* abstraction called a 'slice'. A slice represents a part of a string -
* anything from the entire string to a single character, or even no
* characters at all (a 0-length slice). Since a slice only has to specify
* an offset and a length, copying and manipulating slices is a lot less
* expensive than copying and manipulating the strings they reference.
*
* To further reduce gas costs, most functions on slice that need to return
* a slice modify the original one instead of allocating a new one; for
* instance, `s.split(".")` will return the text up to the first '.',
* modifying s to only contain the remainder of the string after the '.'.
* In situations where you do not want to modify the original slice, you
* can make a copy first with `.copy()`, for example:
* `s.copy().split(".")`. Try and avoid using this idiom in loops; since
* Solidity has no memory management, it will result in allocating many
* short-lived slices that are later discarded.
*
* Functions that return two slices come in two versions: a non-allocating
* version that takes the second slice as an argument, modifying it in
* place, and an allocating version that allocates and returns the second
* slice; see `nextRune` for example.
*
* Functions that have to copy string data will return strings rather than
* slices; these can be cast back to slices for further processing if
* required.
*
* For convenience, some functions are provided with non-modifying
* variants that create a new slice and return both; for instance,
* `s.splitNew('.')` leaves s unmodified, and returns two values
* corresponding to the left and right parts of the string.
*/
library strings {
struct slice {
uint256 _len;
uint256 _ptr;
}
function memcpy(
uint256 dest,
uint256 src,
uint256 len
) private pure {
// Copy word-length chunks while possible
for (; len >= 32; len -= 32) {
assembly {
mstore(dest, mload(src))
}
dest += 32;
src += 32;
}
// Copy remaining bytes
uint256 mask = 256**(32 - len) - 1;
assembly {
let srcpart := and(mload(src), not(mask))
let destpart := and(mload(dest), mask)
mstore(dest, or(destpart, srcpart))
}
}
/*
* @dev Returns a slice containing the entire string.
* @param self The string to make a slice from.
* @return A newly allocated slice containing the entire string.
*/
function toSlice(string memory self) internal pure returns (slice memory) {
uint256 ptr;
assembly {
ptr := add(self, 0x20)
}
return slice(bytes(self).length, ptr);
}
/*
* @dev Copies a slice to a new string.
* @param self The slice to copy.
* @return A newly allocated string containing the slice's text.
*/
function toString(slice memory self) internal pure returns (string memory) {
string memory ret = new string(self._len);
uint256 retptr;
assembly {
retptr := add(ret, 32)
}
memcpy(retptr, self._ptr, self._len);
return ret;
}
// Returns the memory address of the first byte of the first occurrence of
// `needle` in `self`, or the first byte after `self` if not found.
function findPtr(
uint256 selflen,
uint256 selfptr,
uint256 needlelen,
uint256 needleptr
) private pure returns (uint256) {
uint256 ptr = selfptr;
uint256 idx;
if (needlelen <= selflen) {
if (needlelen <= 32) {
bytes32 mask = bytes32(~(2**(8 * (32 - needlelen)) - 1));
bytes32 needledata;
assembly {
needledata := and(mload(needleptr), mask)
}
uint256 end = selfptr + selflen - needlelen;
bytes32 ptrdata;
assembly {
ptrdata := and(mload(ptr), mask)
}
while (ptrdata != needledata) {
if (ptr >= end) return selfptr + selflen;
ptr++;
assembly {
ptrdata := and(mload(ptr), mask)
}
}
return ptr;
} else {
// For long needles, use hashing
bytes32 hash;
assembly {
hash := keccak256(needleptr, needlelen)
}
for (idx = 0; idx <= selflen - needlelen; idx++) {
bytes32 testHash;
assembly {
testHash := keccak256(ptr, needlelen)
}
if (hash == testHash) return ptr;
ptr += 1;
}
}
}
return selfptr + selflen;
}
/*
* @dev Splits the slice, setting `self` to everything after the first
* occurrence of `needle`, and `token` to everything before it. If
* `needle` does not occur in `self`, `self` is set to the empty slice,
* and `token` is set to the entirety of `self`.
* @param self The slice to split.
* @param needle The text to search for in `self`.
* @param token An output parameter to which the first token is written.
* @return `token`.
*/
function split(
slice memory self,
slice memory needle,
slice memory token
) internal pure returns (slice memory) {
uint256 ptr = findPtr(self._len, self._ptr, needle._len, needle._ptr);
token._ptr = self._ptr;
token._len = ptr - self._ptr;
if (ptr == self._ptr + self._len) {
// Not found
self._len = 0;
} else {
self._len -= token._len + needle._len;
self._ptr = ptr + needle._len;
}
return token;
}
/*
* @dev Splits the slice, setting `self` to everything after the first
* occurrence of `needle`, and returning everything before it. If
* `needle` does not occur in `self`, `self` is set to the empty slice,
* and the entirety of `self` is returned.
* @param self The slice to split.
* @param needle The text to search for in `self`.
* @return The part of `self` up to the first occurrence of `delim`.
*/
function split(slice memory self, slice memory needle)
internal
pure
returns (slice memory token)
{
split(self, needle, token);
}
}
contract LootName {
using strings for string;
using strings for strings.slice;
string private constant firstNames =
"Satoshi,Vitalik,Vlad,Adam,Ailmar,Darfin,Jhaan,Zabbas,Neldor,Gandor,Bellas,Daealla,Derek,Nym,Vesryn,Angor,Gogu,Malok,Rotnam,Chalia,Astra,Fabien,Orion,Quintus,Remus,Rorik,Sirius,Sybella,Azura,Dorath,Freya,Ophelia,Yvanna,Zeniya,James,Robert,John,Michael,William,David,Richard,Joseph,Thomas,Charles,Mary,Patricia,Jennifer,Linda,Elizabeth,Barbara,Susan,Jessica,Sarah,Karen,Dilibe,Eva,Matthew,Bolethe,Polycarp,Ambrogino,Jiri,Chukwuebuka,Chinonyelum,Mikael,Mira,Aniela,Samuel,Isak,Archibaldo,Chinyelu,Kerstin,Abigail,Olympia,Grace,Nahum,Elisabeth,Serge,Sugako,Patrick,Florus,Svatava,Ilona,Lachlan,Caspian,Filippa,Paulo,Darda,Linda,Gradasso,Carly,Jens,Betty,Ebony,Dennis,Martin Davorin,Laura,Jesper,Remy,Onyekachukwu,Jan,Dioscoro,Hilarij,Rosvita,Noah,Patrick,Mohammed,Chinwemma,Raff,Aron,Miguel,Dzemail,Gawel,Gustave,Efraim,Adelbert,Jody,Mackenzie,Victoria,Selam,Jenci,Ulrich,Chishou,Domonkos,Stanislaus,Fortinbras,George,Daniel,Annabelle,Shunichi,Bogdan,Anastazja,Marcus,Monica,Martin,Yuukou,Harriet,Geoffrey,Jonas,Dennis,Hana,Abdelhak,Ravil,Patrick,Karl,Eve,Csilla,Isabella,Radim,Thomas,Faina,Rasmus,Alma,Charles,Chad,Zefram,Hayden,Joseph,Andre,Irene,Molly,Cindy,Su,Stani,Ed,Janet,Cathy,Kyle,Zaki,Belle,Bella,Amou,Steven,Olgu,Eva,Ivan,Vllad,Helga,Anya,John,Rita,Evan,Jason,Donald,Tyler,Changpeng,Sam";
uint256 private constant firstNamesLength = 186;
string private constant lastNames =
"Nakamoto,Buterin,Zamfir,Mintz,Ashbluff,Marblemaw,Bozzelli,Fellowes,Windward,Yarrow,Yearwood,Wixx,Humblecut,Dustfinger,Biddercombe,Kicklighter,Vespertine,October,Gannon,Collymore,Stoll,Adler,Huxley,Ledger,Hayes,Ford,Finnegan,Beckett,Zimmerman,Crassus,Hendrix,Lennon,Thatcher,St. James,Cromwell,Monroe,West,Langley,Cassidy,Lopez,Jenkins,Udobata,Valova,Gresham,Frederiksen,Vasiliev,Mancini,Danicek,Okwuoma,Chibugo,Broberg,Strozak,Borkowska,Araujo,Geisler,Hidalgo,Ibekwe,Schmidt,Leehy,Rodrigue,Hines,Izmaylov,Egede,Pinette,Hakugi,McLellan,Mailhot,Lelkova,Simon,Tjangamarra,Sandgreen,Nystrom,Kjeldsen,Goncalves,Sos,Hornblower,Pelletier,Donaldson,Jackson,Rojo,Ermakov,Stornik,Lothran,Gousse,Henrichon,Onwuka,Horak,Elizondo,Mikulanc,Skotnik,Berg,Nilsson,Berg,Enyinnaya,Hermanns,Holmberg,Oliveira,Kufersin,Kwiatkowski,Courtois,Piest,Sandheaver,Woods,Ives,Dias,Grizelj,Viragh,Blau,Kodou,Torma,Sorokina,Took-Took,Allen,Melo,Bunker,Kiyomizu,Donkervoort,Maciejewska,Steffensen,Solomina,Zidek,Gotou,Bryant,Quenneville,Karlsen,Thomsen,Havlikova,Feron,Bazhenov,Amsel,Enoksen,Schneider,Kiss,Woodd,Benes,Probst,Aliyeva,Fleischer,Plain,Hoskinson,Chad,Maki,Gandhi,Zhao,Wintermute,Cronje,Felten,Yellen,Wood,Zhu,Davis,K,Delphine,Thorne,Kulechov,Nigiri,Goldfeder,Ranth,Galt,Lincoln,Trump";
uint256 private constant lastNamesLength = 161;
string private constant suffixes =
"the Great,Jr.,Sr.,the Ape,the Magnificent,the Impaler,the Able,the Ambitious,the Astrologer,the Bad,the Bastard,the Blessed,the Bloody,the Conqueror,the Cruel,the Damned,Dracula,the Drunkard,the Elder,the Eloquent,the Enlightened,the Fair,the Farmer,the Fat,the Fearless,the Fighter,the Comfy,the Couch,the Fortunate,the Generous,the Gentle,the Glorious,the Good,the God-Given,the God,the Grim,the Handsome,the Hammer,Hadrada,the Hidden,the Holy,the Hunter,the Illustrious,the Invincible,the Iron,the Just,the Kind,the Lame,the Last,the Lawgiver,the Learned,the Liberator,the Lion,the Mad,the Magnanimous,the Mighty,the Monk,the Mild,the Musician,the Navigator,the Nobel,the Old,the One-Eyed,the Outlaw,the Pale,the Peaceful,the Philosopher,the Pilgrim,the Pious,the Poet,the Proud,the Quiet,the Rash,the Red,the Reformer,the Saint,the Savior,the Seer,the Short,the Silent,the Simple,the Sorcerer,the Strong,the Tall,the Terrible,the Thunderbolt,the Trembling,the Tyrant,the Unlucky,the Unready,the Vain,the Virgin,the Warrior,the Weak,the Wicked,the Wise,the Young,the Cuck,the Chad,the NoCoiner,.eth,da gay,the Prophet,the Paper-Handed,the Diamond-Handed";
uint256 private constant suffixesLength = 104;
function random(string memory input) internal pure returns (uint256) {
return uint256(keccak256(abi.encodePacked(input)));
}
function getFirstName(uint256 tokenId) public pure returns (string memory) {
return pluck(tokenId, "FIRST_NAME", firstNames, firstNamesLength);
}
function getLastName(uint256 tokenId) public pure returns (string memory) {
return pluck(tokenId, "LAST_NAME", lastNames, lastNamesLength);
}
function getSuffix(uint256 tokenId) public pure returns (string memory) {
if (tokenId > 8000) {
return "";
}
return pluck(tokenId, "SUFFIX", suffixes, suffixesLength);
}
function pluck(
uint256 tokenId,
string memory keyPrefix,
string memory sourceCSV,
uint256 sourceCSVLength
) internal pure returns (string memory) {
uint256 rand = random(
string(abi.encodePacked(keyPrefix, Strings.toString(tokenId)))
);
return getItemFromCSV(sourceCSV, rand % sourceCSVLength);
}
function shouldGib(uint256 tokenId, string memory keyPrefix)
internal
pure
returns (bool)
{
uint256 rand = random(
string(
abi.encodePacked(
"SHOULD_GIB",
keyPrefix,
Strings.toString(tokenId)
)
)
);
uint256 greatness = rand % 21;
return (greatness >= 19);
}
function getName(uint256 tokenId) public pure returns (string memory) {
string[5] memory parts;
parts[0] = getFirstName(tokenId);
parts[1] = " ";
parts[2] = getLastName(tokenId);
parts[4] = getSuffix(tokenId);
parts[3] = bytes(parts[4]).length > 0 ? " " : "";
string memory fullName = string(
abi.encodePacked(parts[0], parts[1], parts[2], parts[3], parts[4])
);
return fullName;
}
function tokenURI(uint256 tokenId) public pure returns (string memory) {
string[3] memory parts;
parts[
0
] = '<svg xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMinYMin meet" viewBox="0 0 350 350"><style>.base { fill: white; font-family: serif; font-size: 14px; }</style><rect width="100%" height="100%" fill="black" /><text x="10" y="20" class="base">';
parts[1] = getName(tokenId);
parts[2] = "</text></svg>";
string memory output = string(
abi.encodePacked(parts[0], parts[1], parts[2])
);
string memory json = Base64.encode(
bytes(
string(
abi.encodePacked(
'{"name": "',
parts[1],
'", "description": "LootName is randomized adventurer name generated on chain. Feel free to use LootName in any way you want.", "image": "data:image/svg+xml;base64,',
Base64.encode(bytes(output)),
'"}'
)
)
)
);
output = string(
abi.encodePacked("data:application/json;base64,", json)
);
return output;
}
function getItemFromCSV(string memory str, uint256 index)
internal
pure
returns (string memory)
{
strings.slice memory strSlice = str.toSlice();
string memory separatorStr = ",";
strings.slice memory separator = separatorStr.toSlice();
strings.slice memory item;
for (uint256 i = 0; i <= index; i++) {
item = strSlice.split(separator);
}
return item.toString();
}
constructor() {}
}
|
0x73374125d5d2fbb679178120abc6389b08df17de7630146080604052600080fdfea2646970667358221220d45d3f780e9e4e15fb8319b0dabfcb7dcc5ceb41a1926c3337e26f66883a7b4764736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "incorrect-shift", "impact": "High", "confidence": "High"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 2,293 |
0xe727b18e8d4ec97c508e46baa5b0d59d80a3429f
|
pragma solidity ^0.4.23;
/*
Owned contract interface
*/
contract IOwned {
// this function isn't abstract since the compiler emits automatically generated getter functions as external
function owner() public view returns (address) {}
function transferOwnership(address _newOwner) public;
function acceptOwnership() public;
}
/*
Whitelist interface
*/
contract IWhitelist {
function isWhitelisted(address _address) public view returns (bool);
}
/*
Contract Registry interface
*/
contract IContractRegistry {
function addressOf(bytes32 _contractName) public view returns (address);
// deprecated, backward compatibility
function getAddress(bytes32 _contractName) public view returns (address);
}
/*
Contract Features interface
*/
contract IContractFeatures {
function isSupported(address _contract, uint256 _features) public view returns (bool);
function enableFeatures(uint256 _features, bool _enable) public;
}
/*
ERC20 Standard Token interface
*/
contract IERC20Token {
// these functions aren't abstract since the compiler emits automatically generated getter functions as external
function name() public view returns (string) {}
function symbol() public view returns (string) {}
function decimals() public view returns (uint8) {}
function totalSupply() public view returns (uint256) {}
function balanceOf(address _owner) public view returns (uint256) { _owner; }
function allowance(address _owner, address _spender) public view returns (uint256) { _owner; _spender; }
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);
}
/*
Smart Token interface
*/
contract ISmartToken is IOwned, IERC20Token {
function disableTransfers(bool _disable) public;
function issue(address _to, uint256 _amount) public;
function destroy(address _from, uint256 _amount) public;
}
/*
Bancor Converter interface
*/
contract IBancorConverter {
function getReturn(IERC20Token _fromToken, IERC20Token _toToken, uint256 _amount) public view returns (uint256);
function convert(IERC20Token _fromToken, IERC20Token _toToken, uint256 _amount, uint256 _minReturn) public returns (uint256);
function conversionWhitelist() public view returns (IWhitelist) {}
// deprecated, backward compatibility
function change(IERC20Token _fromToken, IERC20Token _toToken, uint256 _amount, uint256 _minReturn) public returns (uint256);
}
/*
Bancor converter dedicated interface
*/
contract IBancorConverterExtended is IBancorConverter, IOwned {
function token() public view returns (ISmartToken) {}
function quickBuyPath(uint256 _index) public view returns (IERC20Token) { _index; }
function maxConversionFee() public view returns (uint32) {}
function conversionFee() public view returns (uint32) {}
function connectorTokenCount() public view returns (uint16);
function reserveTokenCount() public view returns (uint16);
function connectorTokens(uint256 _index) public view returns (IERC20Token) { _index; }
function reserveTokens(uint256 _index) public view returns (IERC20Token) { _index; }
function setConversionWhitelist(IWhitelist _whitelist) public;
function getQuickBuyPathLength() public view returns (uint256);
function transferTokenOwnership(address _newOwner) public;
function withdrawTokens(IERC20Token _token, address _to, uint256 _amount) public;
function acceptTokenOwnership() public;
function transferManagement(address _newManager) public;
function acceptManagement() public;
function setConversionFee(uint32 _conversionFee) public;
function setQuickBuyPath(IERC20Token[] _path) public;
function addConnector(IERC20Token _token, uint32 _weight, bool _enableVirtualBalance) public;
function updateConnector(IERC20Token _connectorToken, uint32 _weight, bool _enableVirtualBalance, uint256 _virtualBalance) public;
function getConnectorBalance(IERC20Token _connectorToken) public view returns (uint256);
function getReserveBalance(IERC20Token _reserveToken) public view returns (uint256);
function connectors(address _address) public view returns (
uint256 virtualBalance,
uint32 weight,
bool isVirtualBalanceEnabled,
bool isPurchaseEnabled,
bool isSet
);
function reserves(address _address) public view returns (
uint256 virtualBalance,
uint32 weight,
bool isVirtualBalanceEnabled,
bool isPurchaseEnabled,
bool isSet
);
}
/*
Bancor Converter Factory interface
*/
contract IBancorConverterFactory {
function createConverter(
ISmartToken _token,
IContractRegistry _registry,
uint32 _maxConversionFee,
IERC20Token _connectorToken,
uint32 _connectorWeight
)
public returns (address);
}
/*
Provides support and utilities for contract ownership
*/
contract Owned is IOwned {
address public owner;
address public newOwner;
event OwnerUpdate(address indexed _prevOwner, address indexed _newOwner);
/**
@dev constructor
*/
constructor() public {
owner = msg.sender;
}
// allows execution by the owner only
modifier ownerOnly {
assert(msg.sender == owner);
_;
}
/**
@dev allows transferring the contract ownership
the new owner still needs to accept the transfer
can only be called by the contract owner
@param _newOwner new contract owner
*/
function transferOwnership(address _newOwner) public ownerOnly {
require(_newOwner != owner);
newOwner = _newOwner;
}
/**
@dev used by a new owner to accept an ownership transfer
*/
function acceptOwnership() public {
require(msg.sender == newOwner);
emit OwnerUpdate(owner, newOwner);
owner = newOwner;
newOwner = address(0);
}
}
/**
Id definitions for bancor contracts
Can be used in conjunction with the contract registry to get contract addresses
*/
contract ContractIds {
// generic
bytes32 public constant CONTRACT_FEATURES = "ContractFeatures";
// bancor logic
bytes32 public constant BANCOR_NETWORK = "BancorNetwork";
bytes32 public constant BANCOR_FORMULA = "BancorFormula";
bytes32 public constant BANCOR_GAS_PRICE_LIMIT = "BancorGasPriceLimit";
bytes32 public constant BANCOR_CONVERTER_FACTORY = "BancorConverterFactory";
}
/**
Id definitions for bancor contract features
Can be used to query the ContractFeatures contract to check whether a certain feature is supported by a contract
*/
contract FeatureIds {
// converter features
uint256 public constant CONVERTER_CONVERSION_WHITELIST = 1 << 0;
}
/*
Bancor Converter Upgrader
The Bancor converter upgrader contract allows upgrading an older Bancor converter
contract (0.4 and up) to the latest version.
To begin the upgrade process, first transfer the converter ownership to the upgrader
contract and then call the upgrade function.
At the end of the process, the ownership of the newly upgraded converter will be transferred
back to the original owner.
The address of the new converter is available in the ConverterUpgrade event.
*/
contract BancorConverterUpgrader is Owned, ContractIds, FeatureIds {
string public version = '0.3';
IContractRegistry public registry; // contract registry contract address
// triggered when the contract accept a converter ownership
event ConverterOwned(address indexed _converter, address indexed _owner);
// triggered when the upgrading process is done
event ConverterUpgrade(address indexed _oldConverter, address indexed _newConverter);
/**
@dev constructor
*/
constructor(IContractRegistry _registry) public {
registry = _registry;
}
/*
@dev allows the owner to update the contract registry contract address
@param _registry address of a contract registry contract
*/
function setRegistry(IContractRegistry _registry) public ownerOnly {
registry = _registry;
}
/**
@dev upgrade an old converter to the latest version
will throw if ownership wasn't transferred to the upgrader before calling this function.
ownership of the new converter will be transferred back to the original owner.
fires the ConverterUpgrade event upon success.
@param _oldConverter old converter contract address
@param _version old converter version
*/
function upgrade(IBancorConverterExtended _oldConverter, bytes32 _version) public {
bool formerVersions = false;
if (_version == "0.4")
formerVersions = true;
acceptConverterOwnership(_oldConverter);
IBancorConverterExtended newConverter = createConverter(_oldConverter);
copyConnectors(_oldConverter, newConverter, formerVersions);
copyConversionFee(_oldConverter, newConverter);
copyQuickBuyPath(_oldConverter, newConverter);
transferConnectorsBalances(_oldConverter, newConverter, formerVersions);
ISmartToken token = _oldConverter.token();
if (token.owner() == address(_oldConverter)) {
_oldConverter.transferTokenOwnership(newConverter);
newConverter.acceptTokenOwnership();
}
_oldConverter.transferOwnership(msg.sender);
newConverter.transferOwnership(msg.sender);
newConverter.transferManagement(msg.sender);
emit ConverterUpgrade(address(_oldConverter), address(newConverter));
}
/**
@dev the first step when upgrading a converter is to transfer the ownership to the local contract.
the upgrader contract then needs to accept the ownership transfer before initiating
the upgrade process.
fires the ConverterOwned event upon success
@param _oldConverter converter to accept ownership of
*/
function acceptConverterOwnership(IBancorConverterExtended _oldConverter) private {
require(msg.sender == _oldConverter.owner());
_oldConverter.acceptOwnership();
emit ConverterOwned(_oldConverter, this);
}
/**
@dev creates a new converter with same basic data as the original old converter
the newly created converter will have no connectors at this step.
@param _oldConverter old converter contract address
@return the new converter new converter contract address
*/
function createConverter(IBancorConverterExtended _oldConverter) private returns(IBancorConverterExtended) {
IWhitelist whitelist;
ISmartToken token = _oldConverter.token();
uint32 maxConversionFee = _oldConverter.maxConversionFee();
IBancorConverterFactory converterFactory = IBancorConverterFactory(registry.addressOf(ContractIds.BANCOR_CONVERTER_FACTORY));
address converterAdderess = converterFactory.createConverter(
token,
registry,
maxConversionFee,
IERC20Token(address(0)),
0
);
IBancorConverterExtended converter = IBancorConverterExtended(converterAdderess);
converter.acceptOwnership();
converter.acceptManagement();
// get the contract features address from the registry
IContractFeatures features = IContractFeatures(registry.addressOf(ContractIds.CONTRACT_FEATURES));
if (features.isSupported(_oldConverter, FeatureIds.CONVERTER_CONVERSION_WHITELIST)) {
whitelist = _oldConverter.conversionWhitelist();
if (whitelist != address(0))
converter.setConversionWhitelist(whitelist);
}
return converter;
}
/**
@dev copies the connectors from the old converter to the new one.
note that this will not work for an unlimited number of connectors due to block gas limit constraints.
@param _oldConverter old converter contract address
@param _newConverter new converter contract address
@param _isLegacyVersion true if the converter version is under 0.5
*/
function copyConnectors(IBancorConverterExtended _oldConverter, IBancorConverterExtended _newConverter, bool _isLegacyVersion)
private
{
uint256 virtualBalance;
uint32 weight;
bool isVirtualBalanceEnabled;
bool isPurchaseEnabled;
bool isSet;
uint16 connectorTokenCount = _isLegacyVersion ? _oldConverter.reserveTokenCount() : _oldConverter.connectorTokenCount();
for (uint16 i = 0; i < connectorTokenCount; i++) {
address connectorAddress = _isLegacyVersion ? _oldConverter.reserveTokens(i) : _oldConverter.connectorTokens(i);
(virtualBalance, weight, isVirtualBalanceEnabled, isPurchaseEnabled, isSet) = readConnector(
_oldConverter,
connectorAddress,
_isLegacyVersion
);
IERC20Token connectorToken = IERC20Token(connectorAddress);
_newConverter.addConnector(connectorToken, weight, isVirtualBalanceEnabled);
if (isVirtualBalanceEnabled)
_newConverter.updateConnector(connectorToken, weight, isVirtualBalanceEnabled, virtualBalance);
}
}
/**
@dev copies the conversion fee from the old converter to the new one
@param _oldConverter old converter contract address
@param _newConverter new converter contract address
*/
function copyConversionFee(IBancorConverterExtended _oldConverter, IBancorConverterExtended _newConverter) private {
uint32 conversionFee = _oldConverter.conversionFee();
_newConverter.setConversionFee(conversionFee);
}
/**
@dev copies the quick buy path from the old converter to the new one
@param _oldConverter old converter contract address
@param _newConverter new converter contract address
*/
function copyQuickBuyPath(IBancorConverterExtended _oldConverter, IBancorConverterExtended _newConverter) private {
uint256 quickBuyPathLength = _oldConverter.getQuickBuyPathLength();
if (quickBuyPathLength <= 0)
return;
IERC20Token[] memory path = new IERC20Token[](quickBuyPathLength);
for (uint256 i = 0; i < quickBuyPathLength; i++) {
path[i] = _oldConverter.quickBuyPath(i);
}
_newConverter.setQuickBuyPath(path);
}
/**
@dev transfers the balance of each connector in the old converter to the new one.
note that the function assumes that the new converter already has the exact same number of
also, this will not work for an unlimited number of connectors due to block gas limit constraints.
@param _oldConverter old converter contract address
@param _newConverter new converter contract address
@param _isLegacyVersion true if the converter version is under 0.5
*/
function transferConnectorsBalances(IBancorConverterExtended _oldConverter, IBancorConverterExtended _newConverter, bool _isLegacyVersion)
private
{
uint256 connectorBalance;
uint16 connectorTokenCount = _isLegacyVersion ? _oldConverter.reserveTokenCount() : _oldConverter.connectorTokenCount();
for (uint16 i = 0; i < connectorTokenCount; i++) {
address connectorAddress = _isLegacyVersion ? _oldConverter.reserveTokens(i) : _oldConverter.connectorTokens(i);
IERC20Token connector = IERC20Token(connectorAddress);
connectorBalance = connector.balanceOf(_oldConverter);
_oldConverter.withdrawTokens(connector, address(_newConverter), connectorBalance);
}
}
/**
@dev returns the connector settings
@param _converter old converter contract address
@param _address connector's address to read from
@param _isLegacyVersion true if the converter version is under 0.5
@return connector's settings
*/
function readConnector(IBancorConverterExtended _converter, address _address, bool _isLegacyVersion)
private
view
returns(uint256 virtualBalance, uint32 weight, bool isVirtualBalanceEnabled, bool isPurchaseEnabled, bool isSet)
{
return _isLegacyVersion ? _converter.reserves(_address) : _converter.connectors(_address);
}
}
|
0x6080604052600436106100b65763ffffffff60e060020a60003504166354fd4d5081146100bb5780635a46f06c146101455780636d7bd3fc1461016c57806379ba5097146101815780637b1039991461019857806383315b6e146101c95780638da5cb5b146101de5780639232494e146101f35780639249993a1461020857806392d1abb71461021d578063a236730514610232578063a91ee0dc14610256578063d4ee1d9014610277578063f2fde38b1461028c575b600080fd5b3480156100c757600080fd5b506100d06102ad565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561010a5781810151838201526020016100f2565b50505050905090810190601f1680156101375780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561015157600080fd5b5061015a610338565b60408051918252519081900360200190f35b34801561017857600080fd5b5061015a61035c565b34801561018d57600080fd5b50610196610380565b005b3480156101a457600080fd5b506101ad61040c565b60408051600160a060020a039092168252519081900360200190f35b3480156101d557600080fd5b5061015a61041b565b3480156101ea57600080fd5b506101ad61043f565b3480156101ff57600080fd5b5061015a61044e565b34801561021457600080fd5b5061015a610472565b34801561022957600080fd5b5061015a610496565b34801561023e57600080fd5b50610196600160a060020a036004351660243561049b565b34801561026257600080fd5b50610196600160a060020a0360043516610874565b34801561028357600080fd5b506101ad6108bb565b34801561029857600080fd5b50610196600160a060020a03600435166108ca565b6002805460408051602060018416156101000260001901909316849004601f810184900484028201840190925281815292918301828280156103305780601f1061030557610100808354040283529160200191610330565b820191906000526020600020905b81548152906001019060200180831161031357829003601f168201915b505050505081565b7f42616e636f72436f6e766572746572466163746f72790000000000000000000081565b7f42616e636f72466f726d756c610000000000000000000000000000000000000081565b60015433600160a060020a0390811691161461039b57600080fd5b60015460008054604051600160a060020a0393841693909116917f343765429aea5a34b3ff6a3785a98a5abb2597aca87bfbb58632c173d585373a91a3600180546000805473ffffffffffffffffffffffffffffffffffffffff19908116600160a060020a03841617909155169055565b600354600160a060020a031681565b7f436f6e747261637446656174757265730000000000000000000000000000000081565b600054600160a060020a031681565b7f42616e636f724e6574776f726b0000000000000000000000000000000000000081565b7f42616e636f7247617350726963654c696d69740000000000000000000000000081565b600181565b600080807f302e3400000000000000000000000000000000000000000000000000000000008414156104cc57600192505b6104d58561092c565b6104de85610a3f565b91506104eb858385610fcc565b6104f58583611331565b6104ff8583611424565b61050a858385611639565b84600160a060020a031663fc0c546a6040518163ffffffff1660e060020a028152600401602060405180830381600087803b15801561054857600080fd5b505af115801561055c573d6000803e3d6000fd5b505050506040513d602081101561057257600080fd5b5051604080517f8da5cb5b0000000000000000000000000000000000000000000000000000000081529051919250600160a060020a038088169290841691638da5cb5b9160048083019260209291908290030181600087803b1580156105d757600080fd5b505af11580156105eb573d6000803e3d6000fd5b505050506040513d602081101561060157600080fd5b5051600160a060020a031614156106dc5784600160a060020a03166321e6b53d836040518263ffffffff1660e060020a0281526004018082600160a060020a0316600160a060020a03168152602001915050600060405180830381600087803b15801561066d57600080fd5b505af1158015610681573d6000803e3d6000fd5b5050505081600160a060020a03166338a5e0166040518163ffffffff1660e060020a028152600401600060405180830381600087803b1580156106c357600080fd5b505af11580156106d7573d6000803e3d6000fd5b505050505b84600160a060020a031663f2fde38b336040518263ffffffff1660e060020a0281526004018082600160a060020a0316600160a060020a03168152602001915050600060405180830381600087803b15801561073757600080fd5b505af115801561074b573d6000803e3d6000fd5b5050505081600160a060020a031663f2fde38b336040518263ffffffff1660e060020a0281526004018082600160a060020a0316600160a060020a03168152602001915050600060405180830381600087803b1580156107aa57600080fd5b505af11580156107be573d6000803e3d6000fd5b5050505081600160a060020a031663e4edf852336040518263ffffffff1660e060020a0281526004018082600160a060020a0316600160a060020a03168152602001915050600060405180830381600087803b15801561081d57600080fd5b505af1158015610831573d6000803e3d6000fd5b5050604051600160a060020a038086169350881691507f522b846327aea07106ec4d64ae4b6d6dea47689884dab650fd3a1f2e1d6a270190600090a35050505050565b60005433600160a060020a0390811691161461088c57fe5b6003805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600154600160a060020a031681565b60005433600160a060020a039081169116146108e257fe5b600054600160a060020a03828116911614156108fd57600080fd5b6001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b80600160a060020a0316638da5cb5b6040518163ffffffff1660e060020a028152600401602060405180830381600087803b15801561096a57600080fd5b505af115801561097e573d6000803e3d6000fd5b505050506040513d602081101561099457600080fd5b505133600160a060020a039081169116146109ae57600080fd5b80600160a060020a03166379ba50976040518163ffffffff1660e060020a028152600401600060405180830381600087803b1580156109ec57600080fd5b505af1158015610a00573d6000803e3d6000fd5b5050604051600160a060020a033081169350841691507ff764604894fa993d4370a9cb28b81c11deb1aafdb2909156173ae3833dad807590600090a350565b60008060008060008060008088600160a060020a031663fc0c546a6040518163ffffffff1660e060020a028152600401602060405180830381600087803b158015610a8957600080fd5b505af1158015610a9d573d6000803e3d6000fd5b505050506040513d6020811015610ab357600080fd5b5051604080517f94c275ad0000000000000000000000000000000000000000000000000000000081529051919750600160a060020a038b16916394c275ad916004808201926020929091908290030181600087803b158015610b1457600080fd5b505af1158015610b28573d6000803e3d6000fd5b505050506040513d6020811015610b3e57600080fd5b5051600354604080517fbb34534c0000000000000000000000000000000000000000000000000000000081527f42616e636f72436f6e766572746572466163746f72790000000000000000000060048201529051929750600160a060020a039091169163bb34534c916024808201926020929091908290030181600087803b158015610bc957600080fd5b505af1158015610bdd573d6000803e3d6000fd5b505050506040513d6020811015610bf357600080fd5b5051600354604080517f034efaeb000000000000000000000000000000000000000000000000000000008152600160a060020a038a81166004830152928316602482015263ffffffff891660448201526000606482018190526084820181905291519397509187169263034efaeb9260a4808201936020939283900390910190829087803b158015610c8457600080fd5b505af1158015610c98573d6000803e3d6000fd5b505050506040513d6020811015610cae57600080fd5b5051604080517f79ba50970000000000000000000000000000000000000000000000000000000081529051919450849350600160a060020a038416916379ba50979160048082019260009290919082900301818387803b158015610d1157600080fd5b505af1158015610d25573d6000803e3d6000fd5b5050505081600160a060020a031663c8c2fe6c6040518163ffffffff1660e060020a028152600401600060405180830381600087803b158015610d6757600080fd5b505af1158015610d7b573d6000803e3d6000fd5b5050600354604080517fbb34534c0000000000000000000000000000000000000000000000000000000081527f436f6e747261637446656174757265730000000000000000000000000000000060048201529051600160a060020a03909216935063bb34534c92506024808201926020929091908290030181600087803b158015610e0557600080fd5b505af1158015610e19573d6000803e3d6000fd5b505050506040513d6020811015610e2f57600080fd5b5051604080517fa5fbf287000000000000000000000000000000000000000000000000000000008152600160a060020a038c811660048301526001602483015291519293509083169163a5fbf287916044808201926020929091908290030181600087803b158015610ea057600080fd5b505af1158015610eb4573d6000803e3d6000fd5b505050506040513d6020811015610eca57600080fd5b505115610fc05788600160a060020a031663c45d3d926040518163ffffffff1660e060020a028152600401602060405180830381600087803b158015610f0f57600080fd5b505af1158015610f23573d6000803e3d6000fd5b505050506040513d6020811015610f3957600080fd5b50519650600160a060020a03871615610fc05781600160a060020a0316634af80f0e886040518263ffffffff1660e060020a0281526004018082600160a060020a0316600160a060020a03168152602001915050600060405180830381600087803b158015610fa757600080fd5b505af1158015610fbb573d6000803e3d6000fd5b505050505b50979650505050505050565b60008060008060008060008060008961104e578b600160a060020a03166371f52bf36040518163ffffffff1660e060020a028152600401602060405180830381600087803b15801561101d57600080fd5b505af1158015611031573d6000803e3d6000fd5b505050506040513d602081101561104757600080fd5b50516110b9565b8b600160a060020a0316639b99a8e26040518163ffffffff1660e060020a028152600401602060405180830381600087803b15801561108c57600080fd5b505af11580156110a0573d6000803e3d6000fd5b505050506040513d60208110156110b657600080fd5b50515b9350600092505b8361ffff168361ffff1610156113235789611153578b600160a060020a03166319b64015846040518263ffffffff1660e060020a028152600401808261ffff168152602001915050602060405180830381600087803b15801561112257600080fd5b505af1158015611136573d6000803e3d6000fd5b505050506040513d602081101561114c57600080fd5b50516111cd565b8b600160a060020a031663d031370b846040518263ffffffff1660e060020a028152600401808261ffff168152602001915050602060405180830381600087803b1580156111a057600080fd5b505af11580156111b4573d6000803e3d6000fd5b505050506040513d60208110156111ca57600080fd5b50515b91506111da8c838c611964565b604080517f3f4d2fc2000000000000000000000000000000000000000000000000000000008152600160a060020a03808a16600483015263ffffffff8716602483015285151560448301529151969f50949d50929b5090995097508493508d1691633f4d2fc29160648082019260009290919082900301818387803b15801561126257600080fd5b505af1158015611276573d6000803e3d6000fd5b50505050861561131857604080517f0ca78923000000000000000000000000000000000000000000000000000000008152600160a060020a03838116600483015263ffffffff8b1660248301528915156044830152606482018c90529151918d1691630ca789239160848082019260009290919082900301818387803b1580156112ff57600080fd5b505af1158015611313573d6000803e3d6000fd5b505050505b6001909201916110c0565b505050505050505050505050565b600082600160a060020a031663579cd3ca6040518163ffffffff1660e060020a028152600401602060405180830381600087803b15801561137157600080fd5b505af1158015611385573d6000803e3d6000fd5b505050506040513d602081101561139b57600080fd5b5051604080517fecbca55d00000000000000000000000000000000000000000000000000000000815263ffffffff831660048201529051919250600160a060020a0384169163ecbca55d9160248082019260009290919082900301818387803b15801561140757600080fd5b505af115801561141b573d6000803e3d6000fd5b50505050505050565b60006060600084600160a060020a0316639396a7f06040518163ffffffff1660e060020a028152600401602060405180830381600087803b15801561146857600080fd5b505af115801561147c573d6000803e3d6000fd5b505050506040513d602081101561149257600080fd5b50519250600083116114a357611632565b826040519080825280602002602001820160405280156114cd578160200160208202803883390190505b509150600090505b8281101561157f5784600160a060020a031663e7ee85a5826040518263ffffffff1660e060020a02815260040180828152602001915050602060405180830381600087803b15801561152657600080fd5b505af115801561153a573d6000803e3d6000fd5b505050506040513d602081101561155057600080fd5b5051825183908390811061156057fe5b600160a060020a039092166020928302909101909101526001016114d5565b6040517fd395ee0f000000000000000000000000000000000000000000000000000000008152602060048201818152845160248401528451600160a060020a0388169363d395ee0f93879392839260440191808601910280838360005b838110156115f45781810151838201526020016115dc565b5050505090500192505050600060405180830381600087803b15801561161957600080fd5b505af115801561162d573d6000803e3d6000fd5b505050505b5050505050565b6000806000806000856116b55787600160a060020a03166371f52bf36040518163ffffffff1660e060020a028152600401602060405180830381600087803b15801561168457600080fd5b505af1158015611698573d6000803e3d6000fd5b505050506040513d60208110156116ae57600080fd5b5051611720565b87600160a060020a0316639b99a8e26040518163ffffffff1660e060020a028152600401602060405180830381600087803b1580156116f357600080fd5b505af1158015611707573d6000803e3d6000fd5b505050506040513d602081101561171d57600080fd5b50515b9350600092505b8361ffff168361ffff16101561195a57856117ba5787600160a060020a03166319b64015846040518263ffffffff1660e060020a028152600401808261ffff168152602001915050602060405180830381600087803b15801561178957600080fd5b505af115801561179d573d6000803e3d6000fd5b505050506040513d60208110156117b357600080fd5b5051611834565b87600160a060020a031663d031370b846040518263ffffffff1660e060020a028152600401808261ffff168152602001915050602060405180830381600087803b15801561180757600080fd5b505af115801561181b573d6000803e3d6000fd5b505050506040513d602081101561183157600080fd5b50515b915081905080600160a060020a03166370a08231896040518263ffffffff1660e060020a0281526004018082600160a060020a0316600160a060020a03168152602001915050602060405180830381600087803b15801561189457600080fd5b505af11580156118a8573d6000803e3d6000fd5b505050506040513d60208110156118be57600080fd5b5051604080517f5e35359e000000000000000000000000000000000000000000000000000000008152600160a060020a0384811660048301528a81166024830152604482018490529151929750908a1691635e35359e9160648082019260009290919082900301818387803b15801561193657600080fd5b505af115801561194a573d6000803e3d6000fd5b5050600190940193506117279050565b5050505050505050565b600080600080600085611a1a5787600160a060020a0316630e53aae9886040518263ffffffff1660e060020a0281526004018082600160a060020a0316600160a060020a0316815260200191505060a060405180830381600087803b1580156119cc57600080fd5b505af11580156119e0573d6000803e3d6000fd5b505050506040513d60a08110156119f657600080fd5b50805160208201516040830151606084015160809094015192939192909190611abf565b87600160a060020a031663d66bd524886040518263ffffffff1660e060020a0281526004018082600160a060020a0316600160a060020a0316815260200191505060a060405180830381600087803b158015611a7557600080fd5b505af1158015611a89573d6000803e3d6000fd5b505050506040513d60a0811015611a9f57600080fd5b508051602082015160408301516060840151608090940151929391929091905b939c929b50909950975090955093505050505600a165627a7a72305820cc69c11beea1575763487d7a578ea090499145cd1d350c28afcc2b9951dca5e10029
|
{"success": true, "error": null, "results": {}}
| 2,294 |
0x1d5a90fd4f5d258f6ba52363d9e86e06737dcb25
|
/**
*Submitted for verification at Etherscan.io on 2021-05-31
*/
//
// Tokenomics
// ----------
// Total Supply : 1,000,000,000,000,000
// Burn : 50%
// Liquidity : 50%
// EthereumXUniSwap
// Symbol : $ETHXUNI
// We won't stop before we reach the Moon. Join us in this journey.
// Built for the community.
// Simply hold EthereumXUniSwap to join the journey and experience all of the benefit from EthereumXUniSwap.
// 100% Unruggable
// ---------------
// We will lock 100% LP on Team.finance right after adding liquidity.
// You are safe with EthereumXUniSwap!
// 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 ETHEREUMXUNISWAP 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 = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = "Ethereum X Uniswap";
string private constant _symbol = '$ETHXUNI';
uint8 private constant _decimals = 9;
uint256 private _taxFee = 3;
uint256 private _teamFee = 7;
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 = true;
_maxTxAmount = 5000000000 * 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);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610567578063c3c8cd801461062c578063c9567bf914610643578063d543dbeb1461065a578063dd62ed3e1461069557610114565b8063715018a61461040e5780638da5cb5b1461042557806395d89b4114610466578063a9059cbb146104f657610114565b8063273123b7116100dc578063273123b7146102d6578063313ce567146103275780635932ead1146103555780636fc3eaec1461039257806370a08231146103a957610114565b806306fdde0314610119578063095ea7b3146101a957806318160ddd1461021a57806323b872dd1461024557610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e61071a565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561016e578082015181840152602081019050610153565b50505050905090810190601f16801561019b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101b557600080fd5b50610202600480360360408110156101cc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610757565b60405180821515815260200191505060405180910390f35b34801561022657600080fd5b5061022f610775565b6040518082815260200191505060405180910390f35b34801561025157600080fd5b506102be6004803603606081101561026857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610786565b60405180821515815260200191505060405180910390f35b3480156102e257600080fd5b50610325600480360360208110156102f957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061085f565b005b34801561033357600080fd5b5061033c610982565b604051808260ff16815260200191505060405180910390f35b34801561036157600080fd5b506103906004803603602081101561037857600080fd5b8101908080351515906020019092919050505061098b565b005b34801561039e57600080fd5b506103a7610a70565b005b3480156103b557600080fd5b506103f8600480360360208110156103cc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ae2565b6040518082815260200191505060405180910390f35b34801561041a57600080fd5b50610423610bcd565b005b34801561043157600080fd5b5061043a610d53565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561047257600080fd5b5061047b610d7c565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104bb5780820151818401526020810190506104a0565b50505050905090810190601f1680156104e85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561050257600080fd5b5061054f6004803603604081101561051957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610db9565b60405180821515815260200191505060405180910390f35b34801561057357600080fd5b5061062a6004803603602081101561058a57600080fd5b81019080803590602001906401000000008111156105a757600080fd5b8201836020820111156105b957600080fd5b803590602001918460208302840111640100000000831117156105db57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610dd7565b005b34801561063857600080fd5b50610641610f27565b005b34801561064f57600080fd5b50610658610fa1565b005b34801561066657600080fd5b506106936004803603602081101561067d57600080fd5b810190808035906020019092919050505061161e565b005b3480156106a157600080fd5b50610704600480360360408110156106b857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506117cd565b6040518082815260200191505060405180910390f35b60606040518060400160405280601281526020017f457468657265756d205820556e69737761700000000000000000000000000000815250905090565b600061076b610764611854565b848461185c565b6001905092915050565b6000683635c9adc5dea00000905090565b6000610793848484611a53565b6108548461079f611854565b61084f85604051806060016040528060288152602001613d4060289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610805611854565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546122b29092919063ffffffff16565b61185c565b600190509392505050565b610867611854565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610927576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b610993611854565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a53576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80601360176101000a81548160ff02191690831515021790555050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610ab1611854565b73ffffffffffffffffffffffffffffffffffffffff1614610ad157600080fd5b6000479050610adf81612372565b50565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610b7d57600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050610bc8565b610bc5600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461246d565b90505b919050565b610bd5611854565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c95576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600881526020017f2445544858554e49000000000000000000000000000000000000000000000000815250905090565b6000610dcd610dc6611854565b8484611a53565b6001905092915050565b610ddf611854565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e9f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60005b8151811015610f2357600160076000848481518110610ebd57fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080600101915050610ea2565b5050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610f68611854565b73ffffffffffffffffffffffffffffffffffffffff1614610f8857600080fd5b6000610f9330610ae2565b9050610f9e816124f1565b50565b610fa9611854565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611069576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b601360149054906101000a900460ff16156110ec576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f74726164696e6720697320616c7265616479206f70656e00000000000000000081525060200191505060405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061117c30601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea0000061185c565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156111c257600080fd5b505afa1580156111d6573d6000803e3d6000fd5b505050506040513d60208110156111ec57600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561125f57600080fd5b505afa158015611273573d6000803e3d6000fd5b505050506040513d602081101561128957600080fd5b81019080805190602001909291905050506040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff16815260200192505050602060405180830381600087803b15801561130357600080fd5b505af1158015611317573d6000803e3d6000fd5b505050506040513d602081101561132d57600080fd5b8101908080519060200190929190505050601360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71947306113c730610ae2565b6000806113d2610d53565b426040518863ffffffff1660e01b8152600401808773ffffffffffffffffffffffffffffffffffffffff1681526020018681526020018581526020018481526020018373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200196505050505050506060604051808303818588803b15801561145757600080fd5b505af115801561146b573d6000803e3d6000fd5b50505050506040513d606081101561148257600080fd5b810190808051906020019092919080519060200190929190805190602001909291905050505050506001601360166101000a81548160ff0219169083151502179055506001601360176101000a81548160ff021916908315150217905550674563918244f400006014819055506001601360146101000a81548160ff021916908315150217905550601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156115df57600080fd5b505af11580156115f3573d6000803e3d6000fd5b505050506040513d602081101561160957600080fd5b81019080805190602001909291905050505050565b611626611854565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146116e6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000811161175c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f416d6f756e74206d7573742062652067726561746572207468616e203000000081525060200191505060405180910390fd5b61178b606461177d83683635c9adc5dea000006127db90919063ffffffff16565b61286190919063ffffffff16565b6014819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6014546040518082815260200191505060405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156118e2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180613db66024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611968576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180613cfd6022913960400191505060405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611ad9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180613d916025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611b5f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180613cb06023913960400191505060405180910390fd5b60008111611bb8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526029815260200180613d686029913960400191505060405180910390fd5b611bc0610d53565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611c2e5750611bfe610d53565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b156121ef57601360179054906101000a900460ff1615611e94573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611cb057503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611d0a5750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015611d645750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611e9357601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611daa611854565b73ffffffffffffffffffffffffffffffffffffffff161480611e205750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611e08611854565b73ffffffffffffffffffffffffffffffffffffffff16145b611e92576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f4552523a20556e6973776170206f6e6c7900000000000000000000000000000081525060200191505060405180910390fd5b5b5b3073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614611f8457601454811115611ed657600080fd5b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611f7a5750600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611f8357600080fd5b5b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614801561202f5750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156120855750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b801561209d5750601360179054906101000a900460ff165b156121355742600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054106120ed57600080fd5b601e4201600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600061214030610ae2565b9050601360159054906101000a900460ff161580156121ad5750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156121c55750601360169054906101000a900460ff165b156121ed576121d3816124f1565b600047905060008111156121eb576121ea47612372565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16806122965750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b156122a057600090505b6122ac848484846128ab565b50505050565b600083831115829061235f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612324578082015181840152602081019050612309565b50505050905090810190601f1680156123515780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6123c260028461286190919063ffffffff16565b9081150290604051600060405180830381858888f193505050501580156123ed573d6000803e3d6000fd5b50601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61243e60028461286190919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612469573d6000803e3d6000fd5b5050565b6000600a548211156124ca576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180613cd3602a913960400191505060405180910390fd5b60006124d4612b02565b90506124e9818461286190919063ffffffff16565b915050919050565b6001601360156101000a81548160ff0219169083151502179055506060600267ffffffffffffffff8111801561252657600080fd5b506040519080825280602002602001820160405280156125555781602001602082028036833780820191505090505b509050308160008151811061256657fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561260857600080fd5b505afa15801561261c573d6000803e3d6000fd5b505050506040513d602081101561263257600080fd5b81019080805190602001909291905050508160018151811061265057fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506126b730601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461185c565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040180868152602001858152602001806020018473ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828103825285818151815260200191508051906020019060200280838360005b8381101561277b578082015181840152602081019050612760565b505050509050019650505050505050600060405180830381600087803b1580156127a457600080fd5b505af11580156127b8573d6000803e3d6000fd5b50505050506000601360156101000a81548160ff02191690831515021790555050565b6000808314156127ee576000905061285b565b60008284029050828482816127ff57fe5b0414612856576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180613d1f6021913960400191505060405180910390fd5b809150505b92915050565b60006128a383836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612b2d565b905092915050565b806128b9576128b8612bf3565b5b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16801561295c5750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156129715761296c848484612c36565b612aee565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015612a145750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15612a2957612a24848484612e96565b612aed565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168015612acb5750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15612ae057612adb8484846130f6565b612aec565b612aeb8484846133eb565b5b5b5b80612afc57612afb6135b6565b5b50505050565b6000806000612b0f6135ca565b91509150612b26818361286190919063ffffffff16565b9250505090565b60008083118290612bd9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612b9e578082015181840152602081019050612b83565b50505050905090810190601f168015612bcb5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581612be557fe5b049050809150509392505050565b6000600c54148015612c0757506000600d54145b15612c1157612c34565b600c54600e81905550600d54600f819055506000600c819055506000600d819055505b565b600080600080600080612c4887613877565b955095509550955095509550612ca687600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138df90919063ffffffff16565b600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612d3b86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138df90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612dd085600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461392990919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612e1c816139b1565b612e268483613b56565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600080600080600080612ea887613877565b955095509550955095509550612f0686600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138df90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612f9b83600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461392990919063ffffffff16565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061303085600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461392990919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061307c816139b1565b6130868483613b56565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b60008060008060008061310887613877565b95509550955095509550955061316687600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138df90919063ffffffff16565b600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506131fb86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138df90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061329083600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461392990919063ffffffff16565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061332585600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461392990919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550613371816139b1565b61337b8483613b56565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b6000806000806000806133fd87613877565b95509550955095509550955061345b86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138df90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506134f085600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461392990919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061353c816139b1565b6135468483613b56565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600e54600c81905550600f54600d81905550565b6000806000600a5490506000683635c9adc5dea00000905060005b60098054905081101561382c5782600260006009848154811061360457fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205411806136eb575081600360006009848154811061368357fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b1561370957600a54683635c9adc5dea0000094509450505050613873565b613792600260006009848154811061371d57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054846138df90919063ffffffff16565b925061381d60036000600984815481106137a857fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054836138df90919063ffffffff16565b915080806001019150506135e5565b5061384b683635c9adc5dea00000600a5461286190919063ffffffff16565b82101561386a57600a54683635c9adc5dea00000935093505050613873565b81819350935050505b9091565b60008060008060008060008060006138948a600c54600d54613b90565b92509250925060006138a4612b02565b905060008060006138b78e878787613c26565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061392183836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506122b2565b905092915050565b6000808284019050838110156139a7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b60006139bb612b02565b905060006139d282846127db90919063ffffffff16565b9050613a2681600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461392990919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600660003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615613b5157613b0d83600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461392990919063ffffffff16565b600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b505050565b613b6b82600a546138df90919063ffffffff16565b600a81905550613b8681600b5461392990919063ffffffff16565b600b819055505050565b600080600080613bbc6064613bae888a6127db90919063ffffffff16565b61286190919063ffffffff16565b90506000613be66064613bd8888b6127db90919063ffffffff16565b61286190919063ffffffff16565b90506000613c0f82613c01858c6138df90919063ffffffff16565b6138df90919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080613c3f85896127db90919063ffffffff16565b90506000613c5686896127db90919063ffffffff16565b90506000613c6d87896127db90919063ffffffff16565b90506000613c9682613c8885876138df90919063ffffffff16565b6138df90919063ffffffff16565b905083818496509650965050505050945094509491505056fe45524332303a207472616e7366657220746f20746865207a65726f2061646472657373416d6f756e74206d757374206265206c657373207468616e20746f74616c207265666c656374696f6e7345524332303a20617070726f766520746f20746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63655472616e7366657220616d6f756e74206d7573742062652067726561746572207468616e207a65726f45524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a264697066735822122091e82a9a2e5828b5c36b58f313290de50734bad60f6e93f6a0fe952378044ce364736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "uninitialized-state", "impact": "High", "confidence": "High"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 2,295 |
0x253101757a84054b68a0460b6c77ca2b0e2c4291
|
/**
*Submitted for verification at Etherscan.io on 2022-03-21
*/
/*
https://t.me/gigamusk
Musk Tweeted Launch
Low Cap launch
https://twitter.com/elonmusk/status/1505977175488483339
*/
// 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 muskscontract is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Giga Musk Inu";
string private constant _symbol = "Giga Musk";
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 = 2;
uint256 private _taxFeeOnBuy = 11;
uint256 private _redisFeeOnSell = 2;
uint256 private _taxFeeOnSell = 11;
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots; mapping (address => uint256) public _buyMap;
address payable private _developmentAddress = payable(0x9e8B75A5e7497E330245c5b7fc2e5B7e33b383Af);
address payable private _marketingAddress = payable(0x9e8B75A5e7497E330245c5b7fc2e5B7e33b383Af);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 10000000 * 10**9;
uint256 public _maxWalletSize = 25000000 * 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;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f0461461055d578063dd62ed3e1461057d578063ea1644d5146105c3578063f2fde38b146105e357600080fd5b8063a2a957bb146104d8578063a9059cbb146104f8578063bfd7928414610518578063c3c8cd801461054857600080fd5b80638f70ccf7116100d15780638f70ccf7146104505780638f9a55c01461047057806395d89b411461048657806398a5c315146104b857600080fd5b80637d1db4a5146103ef5780637f2feddc146104055780638da5cb5b1461043257600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461038557806370a082311461039a578063715018a6146103ba57806374010ece146103cf57600080fd5b8063313ce5671461030957806349bd5a5e146103255780636b999053146103455780636d8aa8f81461036557600080fd5b80631694505e116101ab5780631694505e1461027657806318160ddd146102ae57806323b872dd146102d35780632fd689e3146102f357600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024657600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f7366004611967565b610603565b005b34801561020a57600080fd5b5060408051808201909152600d81526c47696761204d75736b20496e7560981b60208201525b60405161023d9190611a2c565b60405180910390f35b34801561025257600080fd5b50610266610261366004611a81565b6106a2565b604051901515815260200161023d565b34801561028257600080fd5b50601454610296906001600160a01b031681565b6040516001600160a01b03909116815260200161023d565b3480156102ba57600080fd5b50670de0b6b3a76400005b60405190815260200161023d565b3480156102df57600080fd5b506102666102ee366004611aad565b6106b9565b3480156102ff57600080fd5b506102c560185481565b34801561031557600080fd5b506040516009815260200161023d565b34801561033157600080fd5b50601554610296906001600160a01b031681565b34801561035157600080fd5b506101fc610360366004611aee565b610722565b34801561037157600080fd5b506101fc610380366004611b1b565b61076d565b34801561039157600080fd5b506101fc6107b5565b3480156103a657600080fd5b506102c56103b5366004611aee565b610800565b3480156103c657600080fd5b506101fc610822565b3480156103db57600080fd5b506101fc6103ea366004611b36565b610896565b3480156103fb57600080fd5b506102c560165481565b34801561041157600080fd5b506102c5610420366004611aee565b60116020526000908152604090205481565b34801561043e57600080fd5b506000546001600160a01b0316610296565b34801561045c57600080fd5b506101fc61046b366004611b1b565b6108c5565b34801561047c57600080fd5b506102c560175481565b34801561049257600080fd5b5060408051808201909152600981526847696761204d75736b60b81b6020820152610230565b3480156104c457600080fd5b506101fc6104d3366004611b36565b61090d565b3480156104e457600080fd5b506101fc6104f3366004611b4f565b61093c565b34801561050457600080fd5b50610266610513366004611a81565b61097a565b34801561052457600080fd5b50610266610533366004611aee565b60106020526000908152604090205460ff1681565b34801561055457600080fd5b506101fc610987565b34801561056957600080fd5b506101fc610578366004611b81565b6109db565b34801561058957600080fd5b506102c5610598366004611c05565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105cf57600080fd5b506101fc6105de366004611b36565b610a7c565b3480156105ef57600080fd5b506101fc6105fe366004611aee565b610aab565b6000546001600160a01b031633146106365760405162461bcd60e51b815260040161062d90611c3e565b60405180910390fd5b60005b815181101561069e5760016010600084848151811061065a5761065a611c73565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061069681611c9f565b915050610639565b5050565b60006106af338484610b95565b5060015b92915050565b60006106c6848484610cb9565b610718843361071385604051806060016040528060288152602001611db9602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111f5565b610b95565b5060019392505050565b6000546001600160a01b0316331461074c5760405162461bcd60e51b815260040161062d90611c3e565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107975760405162461bcd60e51b815260040161062d90611c3e565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107ea57506013546001600160a01b0316336001600160a01b0316145b6107f357600080fd5b476107fd8161122f565b50565b6001600160a01b0381166000908152600260205260408120546106b390611269565b6000546001600160a01b0316331461084c5760405162461bcd60e51b815260040161062d90611c3e565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108c05760405162461bcd60e51b815260040161062d90611c3e565b601655565b6000546001600160a01b031633146108ef5760405162461bcd60e51b815260040161062d90611c3e565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146109375760405162461bcd60e51b815260040161062d90611c3e565b601855565b6000546001600160a01b031633146109665760405162461bcd60e51b815260040161062d90611c3e565b600893909355600a91909155600955600b55565b60006106af338484610cb9565b6012546001600160a01b0316336001600160a01b031614806109bc57506013546001600160a01b0316336001600160a01b0316145b6109c557600080fd5b60006109d030610800565b90506107fd816112ed565b6000546001600160a01b03163314610a055760405162461bcd60e51b815260040161062d90611c3e565b60005b82811015610a76578160056000868685818110610a2757610a27611c73565b9050602002016020810190610a3c9190611aee565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a6e81611c9f565b915050610a08565b50505050565b6000546001600160a01b03163314610aa65760405162461bcd60e51b815260040161062d90611c3e565b601755565b6000546001600160a01b03163314610ad55760405162461bcd60e51b815260040161062d90611c3e565b6001600160a01b038116610b3a5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161062d565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bf75760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161062d565b6001600160a01b038216610c585760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161062d565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d1d5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161062d565b6001600160a01b038216610d7f5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161062d565b60008111610de15760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161062d565b6000546001600160a01b03848116911614801590610e0d57506000546001600160a01b03838116911614155b156110ee57601554600160a01b900460ff16610ea6576000546001600160a01b03848116911614610ea65760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400606482015260840161062d565b601654811115610ef85760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000604482015260640161062d565b6001600160a01b03831660009081526010602052604090205460ff16158015610f3a57506001600160a01b03821660009081526010602052604090205460ff16155b610f925760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b606482015260840161062d565b6015546001600160a01b038381169116146110175760175481610fb484610800565b610fbe9190611cba565b106110175760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b606482015260840161062d565b600061102230610800565b60185460165491925082101590821061103b5760165491505b8080156110525750601554600160a81b900460ff16155b801561106c57506015546001600160a01b03868116911614155b80156110815750601554600160b01b900460ff165b80156110a657506001600160a01b03851660009081526005602052604090205460ff16155b80156110cb57506001600160a01b03841660009081526005602052604090205460ff16155b156110eb576110d9826112ed565b4780156110e9576110e94761122f565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061113057506001600160a01b03831660009081526005602052604090205460ff165b8061116257506015546001600160a01b0385811691161480159061116257506015546001600160a01b03848116911614155b1561116f575060006111e9565b6015546001600160a01b03858116911614801561119a57506014546001600160a01b03848116911614155b156111ac57600854600c55600954600d555b6015546001600160a01b0384811691161480156111d757506014546001600160a01b03858116911614155b156111e957600a54600c55600b54600d555b610a7684848484611476565b600081848411156112195760405162461bcd60e51b815260040161062d9190611a2c565b5060006112268486611cd2565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f1935050505015801561069e573d6000803e3d6000fd5b60006006548211156112d05760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161062d565b60006112da6114a4565b90506112e683826114c7565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061133557611335611c73565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561138957600080fd5b505afa15801561139d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113c19190611ce9565b816001815181106113d4576113d4611c73565b6001600160a01b0392831660209182029290920101526014546113fa9130911684610b95565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac94790611433908590600090869030904290600401611d06565b600060405180830381600087803b15801561144d57600080fd5b505af1158015611461573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b8061148357611483611509565b61148e848484611537565b80610a7657610a76600e54600c55600f54600d55565b60008060006114b161162e565b90925090506114c082826114c7565b9250505090565b60006112e683836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061166e565b600c541580156115195750600d54155b1561152057565b600c8054600e55600d8054600f5560009182905555565b6000806000806000806115498761169c565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061157b90876116f9565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115aa908661173b565b6001600160a01b0389166000908152600260205260409020556115cc8161179a565b6115d684836117e4565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161161b91815260200190565b60405180910390a3505050505050505050565b6006546000908190670de0b6b3a764000061164982826114c7565b82101561166557505060065492670de0b6b3a764000092509050565b90939092509050565b6000818361168f5760405162461bcd60e51b815260040161062d9190611a2c565b5060006112268486611d77565b60008060008060008060008060006116b98a600c54600d54611808565b92509250925060006116c96114a4565b905060008060006116dc8e87878761185d565b919e509c509a509598509396509194505050505091939550919395565b60006112e683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111f5565b6000806117488385611cba565b9050838110156112e65760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161062d565b60006117a46114a4565b905060006117b283836118ad565b306000908152600260205260409020549091506117cf908261173b565b30600090815260026020526040902055505050565b6006546117f190836116f9565b600655600754611801908261173b565b6007555050565b6000808080611822606461181c89896118ad565b906114c7565b90506000611835606461181c8a896118ad565b9050600061184d826118478b866116f9565b906116f9565b9992985090965090945050505050565b600080808061186c88866118ad565b9050600061187a88876118ad565b9050600061188888886118ad565b9050600061189a8261184786866116f9565b939b939a50919850919650505050505050565b6000826118bc575060006106b3565b60006118c88385611d99565b9050826118d58583611d77565b146112e65760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161062d565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107fd57600080fd5b803561196281611942565b919050565b6000602080838503121561197a57600080fd5b823567ffffffffffffffff8082111561199257600080fd5b818501915085601f8301126119a657600080fd5b8135818111156119b8576119b861192c565b8060051b604051601f19603f830116810181811085821117156119dd576119dd61192c565b6040529182528482019250838101850191888311156119fb57600080fd5b938501935b82851015611a2057611a1185611957565b84529385019392850192611a00565b98975050505050505050565b600060208083528351808285015260005b81811015611a5957858101830151858201604001528201611a3d565b81811115611a6b576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611a9457600080fd5b8235611a9f81611942565b946020939093013593505050565b600080600060608486031215611ac257600080fd5b8335611acd81611942565b92506020840135611add81611942565b929592945050506040919091013590565b600060208284031215611b0057600080fd5b81356112e681611942565b8035801515811461196257600080fd5b600060208284031215611b2d57600080fd5b6112e682611b0b565b600060208284031215611b4857600080fd5b5035919050565b60008060008060808587031215611b6557600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611b9657600080fd5b833567ffffffffffffffff80821115611bae57600080fd5b818601915086601f830112611bc257600080fd5b813581811115611bd157600080fd5b8760208260051b8501011115611be657600080fd5b602092830195509350611bfc9186019050611b0b565b90509250925092565b60008060408385031215611c1857600080fd5b8235611c2381611942565b91506020830135611c3381611942565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611cb357611cb3611c89565b5060010190565b60008219821115611ccd57611ccd611c89565b500190565b600082821015611ce457611ce4611c89565b500390565b600060208284031215611cfb57600080fd5b81516112e681611942565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d565784516001600160a01b031683529383019391830191600101611d31565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611d9457634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611db357611db3611c89565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212208bdef4fd5a7a9bbcf1654958ea8aa0787cc1514c15157d781643160b0707263864736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 2,296 |
0x16c4fa917522960b1e646a06cf644c5633925d56
|
/**
*Submitted for verification at Etherscan.io on 2021-08-05
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.
/**
* @dev Wrappers over Solidity's arithmetic operations.
*
* NOTE: `SafeMath` is no longer needed starting with Solidity 0.8. The compiler
* now has built in overflow checking.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryAdd(uint256 a, uint256 b)
internal
pure
returns (bool, uint256)
{
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the substraction of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function trySub(uint256 a, uint256 b)
internal
pure
returns (bool, uint256)
{
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
/**
* @dev Returns the multiplication of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryMul(uint256 a, uint256 b)
internal
pure
returns (bool, uint256)
{
unchecked {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the division of two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryDiv(uint256 a, uint256 b)
internal
pure
returns (bool, uint256)
{
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryMod(uint256 a, uint256 b)
internal
pure
returns (bool, uint256)
{
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
return a + b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return a - b;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
return a * b;
}
/**
* @dev Returns the integer division of two unsigned integers, reverting on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator.
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return a % b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {trySub}.
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b <= a, errorMessage);
return a - b;
}
}
/**
* @dev Returns the integer division of two unsigned integers, reverting with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a / b;
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting with custom message when dividing by zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryMod}.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a % b;
}
}
}
/*
* @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 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 Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_setOwner(_msgSender());
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_setOwner(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(
newOwner != address(0),
"Ownable: new owner is the zero address"
);
_setOwner(newOwner);
}
function _setOwner(address newOwner) private {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
contract VegionBonus is Context, Ownable {
using SafeMath for uint256;
address public farm;
IERC20 public vt;
mapping(address => uint8) public bonusPercent_100;
mapping(address => address) public parents;
constructor(address _farm, IERC20 _vt) {
farm = _farm;
vt = _vt;
}
function batchSetBonusPercent(
address[] memory targets,
uint8[] memory percents
) public onlyOwner {
require(targets.length == percents.length, "length not equal");
for (uint256 i = 0; i < targets.length; i++) {
if (targets[i] != address(0)) {
bonusPercent_100[targets[i]] = percents[i];
}
}
}
function setBonusPercent(address target, uint8 percent) public onlyOwner {
require(target != address(0), "address cannot be zero");
bonusPercent_100[target] = percent;
}
function setParent(address target, address parent) public {
require(target != address(0), "target cannot be zero");
require(parent != address(0), "target cannot be zero");
require(
_msgSender() == owner() || _msgSender() == address(farm),
"wrong caller"
);
parents[target] = parent;
}
// Safe vt transfer function, just in case if rounding error causes pool to not have enough Vts.
function safeVtTransfer(address _to, uint256 _amount) external {
require(
_msgSender() == owner() || _msgSender() == address(farm),
"wrong caller"
);
uint256 vtBal = vt.balanceOf(address(this));
if (_amount > vtBal) {
vt.transfer(_to, vtBal);
} else {
vt.transfer(_to, _amount);
}
}
}
|
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c8063715018a611610071578063715018a61461016457806372be1c171461016e5780638da5cb5b1461018c5780639c5ef5a6146101aa578063b3204b8b146101c6578063f2fde38b146101e2576100a9565b80630288eda0146100ae57806309d4c816146100ca57806318b13fb2146100fa57806336e9332d1461012a578063480d5e1c14610148575b600080fd5b6100c860048036038101906100c39190610ffb565b6101fe565b005b6100e460048036038101906100df9190610f5a565b610346565b6040516100f191906113f6565b60405180910390f35b610114600480360381019061010f9190610f5a565b610366565b60405161012191906112d7565b60405180910390f35b610132610399565b60405161013f91906112d7565b60405180910390f35b610162600480360381019061015d9190611037565b6103bf565b005b61016c6105f0565b005b610176610678565b604051610183919061131b565b60405180910390f35b61019461069e565b6040516101a191906112d7565b60405180910390f35b6101c460048036038101906101bf9190610fbf565b6106c7565b005b6101e060048036038101906101db9190610f83565b6109c4565b005b6101fc60048036038101906101f79190610f5a565b610c01565b005b610206610cf9565b73ffffffffffffffffffffffffffffffffffffffff1661022461069e565b73ffffffffffffffffffffffffffffffffffffffff161461027a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161027190611396565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156102ea576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102e1906113b6565b60405180910390fd5b80600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908360ff1602179055505050565b60036020528060005260406000206000915054906101000a900460ff1681565b60046020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6103c7610cf9565b73ffffffffffffffffffffffffffffffffffffffff166103e561069e565b73ffffffffffffffffffffffffffffffffffffffff161461043b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161043290611396565b60405180910390fd5b805182511461047f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161047690611376565b60405180910390fd5b60005b82518110156105eb57600073ffffffffffffffffffffffffffffffffffffffff168382815181106104dc577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff16146105d857818181518110610538577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200260200101516003600085848151811061057d577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908360ff1602179055505b80806105e390611524565b915050610482565b505050565b6105f8610cf9565b73ffffffffffffffffffffffffffffffffffffffff1661061661069e565b73ffffffffffffffffffffffffffffffffffffffff161461066c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161066390611396565b60405180910390fd5b6106766000610d01565b565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6106cf61069e565b73ffffffffffffffffffffffffffffffffffffffff166106ed610cf9565b73ffffffffffffffffffffffffffffffffffffffff1614806107635750600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661074b610cf9565b73ffffffffffffffffffffffffffffffffffffffff16145b6107a2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610799906113d6565b60405180910390fd5b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b81526004016107ff91906112d7565b60206040518083038186803b15801561081757600080fd5b505afa15801561082b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061084f91906110cc565b90508082111561090e57600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb84836040518363ffffffff1660e01b81526004016108b69291906112f2565b602060405180830381600087803b1580156108d057600080fd5b505af11580156108e4573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061090891906110a3565b506109bf565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb84846040518363ffffffff1660e01b815260040161096b9291906112f2565b602060405180830381600087803b15801561098557600080fd5b505af1158015610999573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109bd91906110a3565b505b505050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610a34576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a2b90611336565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610aa4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a9b90611336565b60405180910390fd5b610aac61069e565b73ffffffffffffffffffffffffffffffffffffffff16610aca610cf9565b73ffffffffffffffffffffffffffffffffffffffff161480610b405750600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b28610cf9565b73ffffffffffffffffffffffffffffffffffffffff16145b610b7f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b76906113d6565b60405180910390fd5b80600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050565b610c09610cf9565b73ffffffffffffffffffffffffffffffffffffffff16610c2761069e565b73ffffffffffffffffffffffffffffffffffffffff1614610c7d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c7490611396565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610ced576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ce490611356565b60405180910390fd5b610cf681610d01565b50565b600033905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b6000610dd8610dd384611442565b611411565b90508083825260208201905082856020860282011115610df757600080fd5b60005b85811015610e275781610e0d8882610e9d565b845260208401935060208301925050600181019050610dfa565b5050509392505050565b6000610e44610e3f8461146e565b611411565b90508083825260208201905082856020860282011115610e6357600080fd5b60005b85811015610e935781610e798882610f45565b845260208401935060208301925050600181019050610e66565b5050509392505050565b600081359050610eac816115cb565b92915050565b600082601f830112610ec357600080fd5b8135610ed3848260208601610dc5565b91505092915050565b600082601f830112610eed57600080fd5b8135610efd848260208601610e31565b91505092915050565b600081519050610f15816115e2565b92915050565b600081359050610f2a816115f9565b92915050565b600081519050610f3f816115f9565b92915050565b600081359050610f5481611610565b92915050565b600060208284031215610f6c57600080fd5b6000610f7a84828501610e9d565b91505092915050565b60008060408385031215610f9657600080fd5b6000610fa485828601610e9d565b9250506020610fb585828601610e9d565b9150509250929050565b60008060408385031215610fd257600080fd5b6000610fe085828601610e9d565b9250506020610ff185828601610f1b565b9150509250929050565b6000806040838503121561100e57600080fd5b600061101c85828601610e9d565b925050602061102d85828601610f45565b9150509250929050565b6000806040838503121561104a57600080fd5b600083013567ffffffffffffffff81111561106457600080fd5b61107085828601610eb2565b925050602083013567ffffffffffffffff81111561108d57600080fd5b61109985828601610edc565b9150509250929050565b6000602082840312156110b557600080fd5b60006110c384828501610f06565b91505092915050565b6000602082840312156110de57600080fd5b60006110ec84828501610f30565b91505092915050565b6110fe816114ab565b82525050565b61110d81611500565b82525050565b600061112060158361149a565b91507f7461726765742063616e6e6f74206265207a65726f00000000000000000000006000830152602082019050919050565b600061116060268361149a565b91507f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008301527f64647265737300000000000000000000000000000000000000000000000000006020830152604082019050919050565b60006111c660108361149a565b91507f6c656e677468206e6f7420657175616c000000000000000000000000000000006000830152602082019050919050565b600061120660208361149a565b91507f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726000830152602082019050919050565b600061124660168361149a565b91507f616464726573732063616e6e6f74206265207a65726f000000000000000000006000830152602082019050919050565b6000611286600c8361149a565b91507f77726f6e672063616c6c657200000000000000000000000000000000000000006000830152602082019050919050565b6112c2816114e9565b82525050565b6112d1816114f3565b82525050565b60006020820190506112ec60008301846110f5565b92915050565b600060408201905061130760008301856110f5565b61131460208301846112b9565b9392505050565b60006020820190506113306000830184611104565b92915050565b6000602082019050818103600083015261134f81611113565b9050919050565b6000602082019050818103600083015261136f81611153565b9050919050565b6000602082019050818103600083015261138f816111b9565b9050919050565b600060208201905081810360008301526113af816111f9565b9050919050565b600060208201905081810360008301526113cf81611239565b9050919050565b600060208201905081810360008301526113ef81611279565b9050919050565b600060208201905061140b60008301846112c8565b92915050565b6000604051905081810181811067ffffffffffffffff821117156114385761143761159c565b5b8060405250919050565b600067ffffffffffffffff82111561145d5761145c61159c565b5b602082029050602081019050919050565b600067ffffffffffffffff8211156114895761148861159c565b5b602082029050602081019050919050565b600082825260208201905092915050565b60006114b6826114c9565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061150b82611512565b9050919050565b600061151d826114c9565b9050919050565b600061152f826114e9565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156115625761156161156d565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6115d4816114ab565b81146115df57600080fd5b50565b6115eb816114bd565b81146115f657600080fd5b50565b611602816114e9565b811461160d57600080fd5b50565b611619816114f3565b811461162457600080fd5b5056fea264697066735822122008ba056bd357f478f0ea2143a08c0a69325e6e0d6dded82b345cdd6954eab0f464736f6c63430008000033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}}
| 2,297 |
0x3c5a24f0138856ff507da8700a0efa4a4e600365
|
/**
*Submitted for verification at Etherscan.io on 2021-05-30
*/
/**
*Submitted for verification at Etherscan.io on 2020-10-22
*/
pragma solidity ^0.7.1;
// SPDX-License-Identifier: MIT
/**
* @title SafeMath
* @dev Math operations with safety checks that revert on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers truncating the quotient, reverts on division by zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0); // Solidity only automatically asserts when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Subtracts two numbers, reverts on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a);
uint256 c = a - b;
return c;
}
/**
* @dev Adds two numbers, reverts on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a);
return c;
}
/**
* @dev Divides two numbers and returns the remainder (unsigned integer modulo),
* reverts when dividing by zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0);
return a % b;
}
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address who) external view returns (uint256);
function allowance(address owner, address spender)
external view returns (uint256);
function transfer(address to, uint256 value) external returns (bool);
function approve(address spender, uint256 value)
external returns (bool);
function transferFrom(address from, address to, uint256 value)
external returns (bool);
event Transfer(
address indexed from,
address indexed to,
uint256 value
);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract ERC20 is IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowed;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
constructor(string memory name, string memory symbol, uint8 decimals, uint256 totalSupply) {
_name = name;
_symbol = symbol;
_decimals = decimals;
_totalSupply = totalSupply;
_balances[msg.sender] = _balances[msg.sender].add(_totalSupply);
emit Transfer(address(0), msg.sender, totalSupply);
}
/**
* @return the name of the token.
*/
function name() public view returns(string memory) {
return _name;
}
/**
* @return the symbol of the token.
*/
function symbol() public view returns(string memory) {
return _symbol;
}
/**
* @return the number of decimals of the token.
*/
function decimals() public view returns(uint8) {
return _decimals;
}
/**
* @dev Total number of tokens in existence
*/
function totalSupply() public view override(IERC20) returns (uint256) {
return _totalSupply;
}
/**
* @dev Gets the balance of the specified address.
* @param owner The address to query the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address owner) public view override(IERC20) 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
override(IERC20)
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 override(IERC20) returns (bool) {
_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 override(IERC20) returns (bool) {
require(spender != address(0));
_allowed[msg.sender][spender] = value;
emit Approval(msg.sender, spender, value);
return true;
}
/**
* @dev Transfer tokens from one address to another
* @param from address The address which you want to send tokens from
* @param to address The address which you want to transfer to
* @param value uint256 the amount of tokens to be transferred
*/
function transferFrom(
address from,
address to,
uint256 value
)
public
override(IERC20)
returns (bool)
{
require(value <= _allowed[from][msg.sender]);
_allowed[from][msg.sender] = _allowed[from][msg.sender].sub(value);
_transfer(from, to, value);
return true;
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed_[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param spender The address which will spend the funds.
* @param addedValue The amount of tokens to increase the allowance by.
*/
function increaseAllowance(
address spender,
uint256 addedValue
)
public
returns (bool)
{
require(spender != address(0));
_allowed[msg.sender][spender] = (
_allowed[msg.sender][spender].add(addedValue));
emit Approval(msg.sender, spender, _allowed[msg.sender][spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed_[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param spender The address which will spend the funds.
* @param subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseAllowance(
address spender,
uint256 subtractedValue
)
public
returns (bool)
{
require(spender != address(0));
_allowed[msg.sender][spender] = (
_allowed[msg.sender][spender].sub(subtractedValue));
emit Approval(msg.sender, spender, _allowed[msg.sender][spender]);
return true;
}
/**
* @dev Transfer token for a specified addresses
* @param from The address to transfer from.
* @param to The address to transfer to.
* @param value The amount to be transferred.
*/
function _transfer(address from, address to, uint256 value) internal {
require(value <= _balances[from]);
require(to != address(0));
_balances[from] = _balances[from].sub(value);
_balances[to] = _balances[to].add(value);
emit Transfer(from, to, value);
}
}
|
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c80633950935111610071578063395093511461025857806370a08231146102bc57806395d89b4114610314578063a457c2d714610397578063a9059cbb146103fb578063dd62ed3e1461045f576100a9565b806306fdde03146100ae578063095ea7b31461013157806318160ddd1461019557806323b872dd146101b3578063313ce56714610237575b600080fd5b6100b66104d7565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f65780820151818401526020810190506100db565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61017d6004803603604081101561014757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610579565b60405180821515815260200191505060405180910390f35b61019d6106a4565b6040518082815260200191505060405180910390f35b61021f600480360360608110156101c957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106ae565b60405180821515815260200191505060405180910390f35b61023f61085e565b604051808260ff16815260200191505060405180910390f35b6102a46004803603604081101561026e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610875565b60405180821515815260200191505060405180910390f35b6102fe600480360360208110156102d257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610aaa565b6040518082815260200191505060405180910390f35b61031c610af2565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561035c578082015181840152602081019050610341565b50505050905090810190601f1680156103895780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103e3600480360360408110156103ad57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b94565b60405180821515815260200191505060405180910390f35b6104476004803603604081101561041157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610dc9565b60405180821515815260200191505060405180910390f35b6104c16004803603604081101561047557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610de0565b6040518082815260200191505060405180910390f35b606060038054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561056f5780601f106105445761010080835404028352916020019161056f565b820191906000526020600020905b81548152906001019060200180831161055257829003601f168201915b5050505050905090565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156105b457600080fd5b81600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600254905090565b6000600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111561073957600080fd5b6107c882600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610e8690919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610853848484610ea6565b600190509392505050565b6000600560009054906101000a900460ff16905090565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156108b057600080fd5b61093f82600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610e6790919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b606060048054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610b8a5780601f10610b5f57610100808354040283529160200191610b8a565b820191906000526020600020905b815481529060010190602001808311610b6d57829003601f168201915b5050505050905090565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610bcf57600080fd5b610c5e82600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610e8690919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000610dd6338484610ea6565b6001905092915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600080828401905083811015610e7c57600080fd5b8091505092915050565b600082821115610e9557600080fd5b600082840390508091505092915050565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054811115610ef157600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610f2b57600080fd5b610f7c816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610e8690919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061100f816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610e6790919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a350505056fea2646970667358221220c917acb769e705dcd64a61039e3f0c039402d201caeb5fc8795aa0e06954c80864736f6c63430007010033
|
{"success": true, "error": null, "results": {}}
| 2,298 |
0xe5e565c890ffa55376abe5c77170b62fdff20561
|
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount)
external
returns (bool);
function allowance(address owner, address spender)
external
view
returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
abstract contract Context {
function _msgSender() internal virtual view returns (address payable) {
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) {
// 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;
}
}
/**
* @dev Implementation of the {IERC20} interface.
*/
contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
//mapping for tracking locked balance
mapping(address => uint256) private _lockers;
//mapping for release time
mapping(address => uint256) private _timers;
//mapping for new Addresses and balance shift (teleportation)
mapping(address => mapping(string => uint256)) private _teleportScroll;
uint256 private _totalSupply;
address private _owner;
string private _name;
string private _symbol;
uint8 private _decimals;
address private _lockerAccount;
address private _teleportSafe;
uint256 private _teleportTime;
event ReleaseTime(address indexed account, uint256 value);
event lockedBalance(address indexed account, uint256 value);
event Released(address indexed account, uint256 value);
event Globals(address indexed account, uint256 value);
event teleportation(address indexed account, string newaccount, uint256 shiftBalance);
/**
* @dev Sets the values for {name} and {symbol}, initializes {decimals} with
* a default value of 18.
*
* All three of these values are immutable: they can only be set once during
* construction.
*/
constructor(string memory name_, string memory symbol_, uint256 initialSupply_) {
_name = name_;
_symbol = symbol_;
_decimals = 18;
_owner = _msgSender();
_mint(msg.sender, initialSupply_);
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
modifier locked() {
require(_lockerAccount == _msgSender(), "Locked: caller is not the lockerAccount");
_;
}
/**
* @dev Returns the address of the current owner.
*/
function getOwner() public view returns (address) {
return _owner;
}
/**
* @dev Returns the name of the token.
*/
function name() public view returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses.
*/
function decimals() public view returns (uint8) {
return _decimals;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public override view returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public override view 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
virtual
override
view
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.
*
* 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);
_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.
*
* 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].add(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)
{
_approve(
_msgSender(),
spender,
_allowances[_msgSender()][spender].sub(
subtractedValue,
"ERC20: decreased allowance below zero"
)
);
return true;
}
/**
* @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");
_balances[sender] = _balances[sender].sub(
amount,
"ERC20: transfer amount exceeds balance"
);
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
function burn(uint256 amount) public virtual {
_burn(_msgSender(), 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");
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), 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) internal virtual onlyOwner {
require(account != address(0), "ERC20: mint to the zero address");
_totalSupply = _totalSupply.add(amount * 10 ** _decimals);
_balances[account] = _balances[account].add(amount * 10 ** _decimals);
emit Transfer(address(0), account, amount * 10 ** _decimals);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`
* 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);
}
/**
* Implementation for locking asset of account for given time aka Escrow
* starts
*/
/**
* @dev Owner can set the lockerAccount where balances are locked.
*/
function setLockerAccount(address _account) public onlyOwner returns (bool) {
require(_msgSender() != address(0), "setLockerAccount: Executor account cannot be zero address");
require(_account != address(0), "setLockerAccount: Locker Account cannot be zero address");
_lockerAccount = _account;
return true;
}
/**
* @dev Returns the lockerAccount(used to lock all balances) set by owner.
*/
function getLockerAccount() public view returns (address) {
return _lockerAccount;
}
/**
* @dev Set release time for locked balance of an account. Must be set before locking balance.
*/
function setReleaseTime(address _account, uint _timestamp) public onlyOwner returns (uint256) {
require(_msgSender() != address(0), "setTimeStamp: Executor account cannot be zero address");
require(_account != address(0), "setTimeStamp: Cannot set timestamp for zero address");
require(_timestamp > block.timestamp, "TokenTimelock: release time cannot be set in past");
_timers[_account] = _timestamp;
emit ReleaseTime(_account, _timestamp);
return _timers[_account];
}
/**
* @dev Returns the releaseTime(for locked balance) of the given address.
*/
function getReleaseTime(address _account) public view returns (uint256) {
return _timers[_account];
}
/**
* @dev lock balance after owner has set the release timer
*/
function lockBalance(uint256 amount) public returns(bool){
require(_msgSender() != _lockerAccount, "lockBalance: Cannot lock Balance of self");
require(_lockerAccount != address(0), "lockBalance: Locker Account is not set by owner");
require(amount > 0, "lockBalance: Must lock positive amount");
require(_timers[_msgSender()] != 0, "lockBalance: Release Time is not set by owner. Release Time must be set before locking balance");
require(_lockers[_msgSender()] == 0, "lockBalance: Release previously locked balance first");
_transfer(_msgSender(), _lockerAccount, amount);
_lockers[_msgSender()] = amount;
emit lockedBalance(_msgSender(), amount);
return true;
}
/**
* @dev Returns the releaseTime(for locked balance) of the current sender.
*/
function getLockedAmount() public view returns (uint256) {
return _lockers[_msgSender()];
}
function release(address _account) public locked returns (bool) {
require(_lockerAccount != address(0), "release: Locker Account is not set by owner");
require(_account != address(0), "release: Cannot release balance for zero address");
require(block.timestamp >= _timers[_account], "Timelock: current time is before release time");
require(_lockers[_account] > 0, "release: No amount is locked against this account. +ve amount must be locked");
_transfer(_msgSender(), _account, _lockers[_account]);
_lockers[_account] = 0;
emit Released(_account, _lockers[_msgSender()]);
return true;
}
/**
* Implementation for Escrow Ends
*
*/
/**
* Implementation for teleportation
* starts
*/
/**
* @dev Set shifter globals.
*/
function setGlobals(address _account, uint _timestamp) public onlyOwner returns (bool) {
require(_msgSender() != address(0), "Executor account cannot be zero address");
require(_account != address(0), "Zero address");
require(_timestamp > block.timestamp, "Timestamp cannot be set in past");
_setGlobsInternal(_account, _timestamp);
return true;
}
function _setGlobsInternal(address _account, uint _time) private returns (bool) {
require(_msgSender() != address(0), "Executor account cannot be zero address");
require(_account != address(0), "Zero Address");
require(_time > block.timestamp, "Reserruction time cannot be set in past");
_teleportSafe = _account;
_teleportTime = _time;
emit Globals(_account, _time);
return true;
}
function teleport(string memory _newAddress) public returns(bool) {
require(_msgSender() != _teleportSafe, "Teleport: TeleportSafe cannot transfer to self");
require(_teleportSafe != address(0), "Teleport: TeleportSafe Account is not set by owner");
require(_balances[_msgSender()] > 0, "Teleport: Must transfer +ve amount");
require(block.timestamp > _teleportTime , "Teleport: It is not time yet");
uint256 shiftAmount = _balances[_msgSender()]; //
_transfer(_msgSender(), _teleportSafe, _balances[_msgSender()]);
_teleportScroll[_msgSender()][_newAddress] = shiftAmount;
emit teleportation(_msgSender(), _newAddress, shiftAmount);//emit balance shiftAmount
return true;
}
/**
* @dev Returns the amount(also the balance) of the given address which will be shifted to newAddress after teleportation.
*/
function checkshiftAmount(string memory _newAddress) public view returns (uint256) {
return _teleportScroll[_msgSender()][_newAddress];
}
// After teleportation completed
function resurrection(address payable _new) public onlyOwner {
require(_teleportTime != 0 , "Teleportation time is not set");
require(block.timestamp > _teleportTime , "It is not time yet");
selfdestruct(_new);
}
/**
* Implementation for teleportation
* Ends
*/
}
|
0x
|
{"success": true, "error": null, "results": {}}
| 2,299 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.